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
相关文档:
总览
用iptables -ADC 来指定链的规
则
,-A添加 -D删除 -C 修改
iptables - [RI] chain rule num rule-specification[option]
用iptables - RI 通过规则的顺序指定
iptables -D chain rule num[option]
删除指定规则
iptables -[LFZ] [chain][option]
用iptables -LFZ 链名 [选项]
iptables -[NX] chain
用 -NX ......
LINUX中时间有两种:
1)日历时间
2)进程时间
日历时间顾名思义即用来获取日历;
主要涉及到的函数有:
time(time_t*);
stime(time_t*);
tm* gmtime(time_t*);
tm* localtime(time_t*);
char *strftime(tm*);
char *asctime(tm*);
time_t* mktime(tm*);
数据结构如下:
time_t
struct tm{
int tm_se ......
#!/bin/sh
/sbin/modprobe ip_conntrack_ftp
CONNECTION_TRACKING="1"
ACCEPT_AUTH="0"
DHCP_CLIENT="0"
IPT="/sbin/iptables" # Location of iptables on your system
INTERNET="eth0" # Internet-connected interface
LO ......
http://linux.ctocio.com.cn/437/8831437.shtml
我们在调试硬件板时,经常需要做多个jffs2的根文件系统映像,有时也要对比其他途径得到的可用的jffs2根文件系
统映像。但jffs2的文件系统映像不象光盘的映像文件一样可以通过loop设备来挂载……
我们在调试硬件板时,经常需要做多个jffs2的根文件系统
映像, ......
http://www.soidc.net/articles/1215484977397/20080407/1215945405315_1.html
一、在一个已建好的文件系统上进行修改
设已建立好的文件系统压缩文件为ramdisk.gz
1、解压
#cd ramdisk.gz所在目录
#gunzip ramdisk.gz
&nb ......