开发者

How to get more vfat attributes of files in Linux using C?

This is a follow-up to my other question here:

How to read vfat attributes of files in Linux using C

--

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;      /开发者_JS百科* 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) */
};

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.

Thanks.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜