Linux 文件系统(部分)

来源:互联网 发布:中国移动宽带网络电视 编辑:程序博客网 时间:2024/05/17 07:59

Linux 文件系统

struct stat:
这里写图片描述

文件属性 解释

  • dev_t st_dev 设备号

  • ino_t st_ino inode 编号

  • mode_t st_mode 访问权限相关

  • nlink_t st_nlink 硬链接数量

  • uid_t st_uid 拥有该文件的用户

  • gid_t st_gid 拥有该文件的组

  • dev_t st_rdev 设备号

  • off_t st_size 文件尺寸

  • blksize_t st_blksize 文件系统的IO尺寸

  • blkcnt_t st_blocks 占用的block数量,一个block为512字节

  • time_t st_atime 最后访问时间

  • time_t st_mtime 最后修改时间

  • time_t st_ctime 最后文件状态修改时间

struct dirent

Markdown Extra 定义列表语法:

struct dirent {        long            d_ino;                  /* inode number 索引节点号 */        off_t           d_off;                  /* offset to this dirent 在目录文件中的偏移 */        unsigned short  d_reclen;               /* length of this d_name 文件名长 */        unsigned char   d_type;                 /* the type of d_name 文件类型 */        char            d_name [NAME_MAX+1];    /* file name (null-terminated) 文件名,最长255字符 *///d_type    DT_UNKNOWN = 0,  // unknown type    #define DT_UNKNOWN DT_UNKNOWN    DT_FIFO = 1,     // a named pipe, or FIFO    #define DT_FIFO DT_FIFO    DT_CHR = 2,     // a character device    #define DT_CHR DT_CHR    DT_DIR = 4,     // a directory    #define DT_DIR DT_DIR    DT_BLK = 6,     // a block device    #define DT_BLK DT_BLK    DT_REG = 8,     // regular file    #define DT_REG DT_REG    DT_LNK = 10,    // symbolic link    #define DT_LNK DT_LNK    DT_SOCK = 12,   // local domain socket    #define DT_SOCK DT_SOCK    DT_WHT = 14     // ?    #define DT_WHT DT_WHT

0 0
原创粉丝点击