如何用C获取文件的更多VFAT属性在Linux呢? [英] How to get more vfat attributes of files in Linux using C?
问题描述
这是一个后续行动,我的其他问题在这里:
This is a follow-up to my other question here:
<一个href=\"http://stackoverflow.com/questions/1644416/how-to-read-vfat-attributes-of-files-in-linux-using-c\">http://stackoverflow.com/questions/1644416/how-to-read-vfat-attributes-of-files-in-linux-using-c
-
我看到这个结构在linux / msdos_fs.h:
I saw this struct in linux/msdos_fs.h:
struct msdos_dir_entry {
__u8 name[8],ext[3]; /* name and extension */
__u8 attr; /* attribute bits */
__u8 lcase; /* Case for base and extension */
__u8 ctime_cs; /* Creation time, centiseconds (0-199) */
__le16 ctime; /* Creation time */
__le16 cdate; /* Creation date */
__le16 adate; /* Last access date */
__le16 starthi; /* High 16 bits of cluster in FAT32 */
__le16 time,date,start;/* time, date and first cluster */
__le32 size; /* file size (in bytes) */
};
我的问题是,将有可能填充我的用户应用程序内这样的结构?我的应用程序的要求是,它应该能够穿越的VFAT文件系统,并获得VFAT属性( msdos_dir_entry
)的每个目录/文件找到。
My question is, would it be possible to populate such a struct inside my user application? My app requirement is that it should be able traverse a vfat filesystem, and get the vfat attributes (msdos_dir_entry
) for each directory/file it finds.
感谢。
推荐答案
其实你可以通过组合信息,您可以从FSTAT得到()得到几乎所有这一切,在FAT_IOCTL_GET_ATTRIBUTES和VFAT_IOCTL_READDIR_BOTH读写控制。它不会很好看不过,因为对于弗罗默你们两个需要的文件FD和后两者您需要的文件位于目录的FD。
Actually you can get almost all of this by combining the information you can get from fstat(), the FAT_IOCTL_GET_ATTRIBUTES and VFAT_IOCTL_READDIR_BOTH ioctls. It's not going to nice to look at though, since for the fromer two you need the file fd and for the latter two you need the fd of the dir the file is located in.
这篇关于如何用C获取文件的更多VFAT属性在Linux呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!