曲径通幽论坛

标题: 对文件夹及文件操作的一些数据结构 [打印本页]

作者: beyes    时间: 2008-11-16 23:04
标题: 对文件夹及文件操作的一些数据结构
文件夹:(对应调用 readdir(),被定义在 /usr/include/dirent.h)
struct dirent {
    ino_t          d_ino;       /* inode number 节点号*/
    off_t          d_off;       /* offset to the next dirent 下一个结构偏移*/
    unsigned short d_reclen;    /* length of this record 记录的长度*/
    unsigned char  d_type;      /* type of file 文件的类型*/
    char           d_name[256]; /* filename 文件名*/
};

文件的状态:(对应调用 stat(char *fname, struct stat *buf))
struct stat {
    dev_t     st_dev;     /* ID of device containing file */
    ino_t     st_ino;     /* inode number */
    mode_t    st_mode;    /* protection 文件类型和许可权限*/
    nlink_t   st_nlink;   /* number of hard links 硬链接数*/
    uid_t     st_uid;     /* user ID of owner 用户所有者的ID*/
    gid_t     st_gid;     /* group ID of owner 所属组的ID*/
    dev_t     st_rdev;    /* device ID (if special file) */
    off_t     st_size;    /* total size, in bytes 所占的字节数*/
    blksize_t st_blksize; /* blocksize for filesystem I/O */
    blkcnt_t  st_blocks;  /* number of blocks allocated */
    time_t    st_atime;   /* time of last access 文件最后访问时间*/
    time_t    st_mtime;   /* time of last modification文件最后修改时间*/
    time_t    st_ctime;   /* time of last status change 文件属性最后改变时间*/
};




欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2