易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux 访问fat格式文件系统

首先要导入这些头文件
#include
#include
#include
#include
#include
#include



然后看一下实际的操作


1、查看文件系统信息
asmlinkage long get_files_info(char * filesystem_type)//取得当前目录的文件系统信息
{
struct fs_struct *fs ;
struct vfsmount *mnt ;
struct super_block *mnt_sb ;
struct file_system_type *s_type;
read_lock(¤t->fs->lock);
fs = current->fs;
mnt = fs->pwdmnt;
mnt_sb = mnt-> mnt_sb ;
s_type = mnt_sb -> s_type;

printk("PWD Filesystem Type is : %s\n",s_type->name);
copy_to_user(filesystem_type,s_type->name,strlen(s_type->name));

printk("PWD= %ld\n",mnt_sb->s_blocksize);

read_unlock(¤t->fs->lock);
return 0;
}







2、查看fat_boot_sector 信息
asmlinkage long get_FAT_boot(char * filesystem_type)//取得fat文件系统的信息
{
struct fs_struct *fs ;
struct vfsmount *mnt ;
struct super_block *mnt_sb ;
struct buffer_head * bh=NULL;
struct fat_boot_sector *fat_sector;
char c[512];
int len;

read_lock(¤t->fs->lock);
fs = current->fs;
mnt = fs->pwdmnt;
mnt_sb = mnt-> mnt_sb ;
char *fsname=mnt_sb -> s_type->name;
char *sfs="vfat";
if(strcmp(fsname,sfs)==0)//此时文件系统是vfat
{
sb_min_blocksize(mnt_sb, 512);
bh = sb_bread(mnt_sb, 0);
if(bh!=NULL)
{
fat_sector=(struct fat_boot_sector *)bh->b_data;
len=sprintf(c,"FAT文件系统具体参数如下:\n");
len=sprintf(c,"%sbackup boot sector= %d\n",c,fat_sector->backup_boot);
len=sprintf(c,"%ssectors/cluster= %d\n",c,fat_sector->sec_per_clus);
len=sprintf(c,"%snumber of heads= %d\n",c,fat_sector->heads);
len=sprintf(c,"%shidden sectors (unused)= %d\n",c,fat_sector->hidden);
len=sprintf(c,"%smedia code= %d\n",c,fat_sector->media);
len=sprintf(c,"%sbytes per logic


相关文档:

Linux 的多线程编程的高效开发经验

2009 年 4 月 23 日
本文中我们针对 Linux 上多线程编程的主要特性总结出 5 条经验,用以改善 Linux 多线程编程的习惯和避免其中的开发陷阱。在本文中,我们穿插一些 Windows 的编程用例用以对比 Linux 特性,以加深读者印象。
背景
Linux 平台上的多线程程序开发相对应其他平台(比如 Windows)的多线程 API 有一些细微 ......

去除虚拟机vmware中Linux的报警声

vi 中关闭出错 bell 声音
http://blog.csdn.net/coolrocky/archive/2001/06/05/8080.aspx
去除虚拟机Linux的报警声
http://hi.baidu.com/zjd168/blog/item/c8300846b5a6ec0e6a63e5d8.html
关闭主板报警音
http://linux.chinaunix.net/techdoc/install/2009/05/16/1112897.shtml
linux中关闭报警音和修改分辨率
http ......

去除虚拟机vmware中Linux的报警声


Vmware上装的Linux,在Shell下由于输错命令或是种种原因,会发出“嘟嘟”的报警声,并不是声卡发出的,而是主板的报警,所以不能通过关闭音箱来解决。寝室里经常响起这样的声音非常刺耳,今天在网上找到了解决方法,记下:
将/etc/inputrc中的set bell-style none 前的#去掉,之后重启系统即可。
不过这种方 ......

去除虚拟机vmware中Linux的报警声

vi 中关闭出错 bell 声音
http://blog.csdn.net/coolrocky/archive/2001/06/05/8080.aspx
去除虚拟机Linux的报警声
http://hi.baidu.com/zjd168/blog/item/c8300846b5a6ec0e6a63e5d8.html
关闭主板报警音
http://linux.chinaunix.net/techdoc/install/2009/05/16/1112897.shtml
linux中关闭报警音和修改分辨率
http ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号