enum{
AFFS_SUPER_MAGIC = 0xADFF,
BFS_MAGIC = 0x1BADFACE,
CODA_SUPER_MAGIC = 0x73757245,
COH_SUPER_MAGIC = 0x012FF7B7,
EXT_SUPER_MAGIC = 0x137D,
EXT2_OLD_SUPER_MAGIC = 0xEF51,
EXT2_SUPER_MAGIC = 0xEF53,
EXT3_SUPER_MAGIC = 0xEF53,
HFS_SUPER_MAGIC = 0x4244,
HPFS_SUPER_MAGIC = 0xF995,
AFS_FS_MAGIC = 0x6B414653, /* 'kAFS' */
AUTOFS_SUPER_MAGIC = 0x0187,
BEFS_SUPER_MAGIC1 = 0x42465331, /* BFS1 */
BEFS_SUPER_MAGIC2 = 0xdd121031,
BEFS_SUPER_MAGIC3 = 0x15b6830e,
BEFS_SUPER_MAGIC = BEFS_SUPER_MAGIC1,
CIFS_MAGIC_NUMBER = 0xFF534D42, /* the first four bytes of all SMB PDUs */
CODA_MAGIC = 0xC0DAC0DA,
CRAMFS_MAGIC = 0x28cd3d45, /* some random number */
DEVFS_SUPER_MAGIC = 0x1373,
DEVPTS_SUPER_MAGIC = 0x1cd1,
EFS_SUPER_MAGIC = 0x414A53,
MSDOS_SUPER_MAGIC = 0x4d44, /* MD */
VXFS_SUPER_MAGIC = 0xa501FCF5,
HFSPLUS_SUPER_MAGIC = 0x482b,
SB_MAGIC = 0xf995e849,
/* some random number */
HUGETLBFS_MAGIC = 0x958458f6,
ISOFS_SUPER_MAGIC = 0x9660,
MINIX_SUPER_MAGIC = 0x137F, /* original minix fs */
NCP_SUPER_MAGIC = 0x564c,
NFS_SUPER_MAGIC = 0x6969,
NTFS_SB_MAGIC = 0x5346544e, /* 'NTFS' */
OPENPROM_SUPER_MAGIC = 0x9fa1,
PROC_SUPER_MAGIC = 0x9fa0,
QNX4_SUPER_MAGIC = 0x002f, /* qnx4 fs detection */
/* some random number */
RAMFS_MAGIC = 0x858458f6,
ROMFS_MAGIC = 0x7275,
/* used by gcc */
REISERFS_SUPER_MAGIC = 0x52654973,
SMB_SUPER_MAGIC = 0x517B,
/* Random magic number */
SYSFS_MAGIC = 0x62656572,
SYSV_MAGIC_BASE = 0x012FF7B3,
/* Since UDF 2.01 is ISO 13346 based... */
UDF_SUPER_MAGIC = 0x15013346,
UFS_MAGIC = 0x00011954,
JFFS2_SUPER_MAGIC = 0x72b6,
XFS_SB_MAGIC = 0x58465342,/* 'XFSB' 88 70 83 66*/
JFS_SUPER_MAGIC = 0x3153464a/* "JFS1" 4A 70 83 49 */
}FSType;
一般也就用到几个常用的MS-DOS,NTFS,NFS,EXT2,EXT3
把这个枚举加到代码里,配合下面的代码:
struct statfs64 stVfs;
memset(&stVfs, 0, sizeof(stVfs));
if(-1 == statfs64(MountName, &stVfs))
{
KK_ERROR("[%s]Failed to get file system info. \n",__FUNCTION__);
return KK_FS_FAIL;
}
switch(stVfs.f_type){
case 0x4d44:
printf("MSDOS\n");
sprintf((char*)FilesysType, "%s", "MSDOS");
break;
}
http://hi.baidu.com/zhaofeng068318/blog/item/614b681991f433bb4aedbc97.html