1 #ifndef _LINUX_STAT_H 2 #define _LINUX_STAT_H 3 4 #ifdef __KERNEL__ 5 6 struct old_stat { 7 unsigned short st_dev; 8 unsigned short st_ino; 9 unsigned short st_mode; 10 unsigned short st_nlink; 11 unsigned short st_uid; 12 unsigned short st_gid; 13 unsigned short st_rdev; 14 unsigned long st_size; 15 unsigned long st_atime; 16 unsigned long st_mtime; 17 unsigned long st_ctime; 18 }; 19 20 struct new_stat { 21 unsigned short st_dev; 22 unsigned short __pad1; 23 unsigned long st_ino; 24 unsigned short st_mode; 25 unsigned short st_nlink; 26 unsigned short st_uid; 27 unsigned short st_gid; 28 unsigned short st_rdev; 29 unsigned short __pad2; 30 unsigned long st_size; 31 unsigned long st_blksize; 32 unsigned long st_blocks; 33 unsigned long st_atime; 34 unsigned long __unused1; 35 unsigned long st_mtime; 36 unsigned long __unused2; 37 unsigned long st_ctime; 38 unsigned long __unused3; 39 unsigned long __unused4; 40 unsigned long __unused5; 41 }; 42 43 #endif 44 45 #define S_IFMT 00170000 46 #define S_IFSOCK 0140000 47 #define S_IFLNK 0120000 48 #define S_IFREG 0100000 49 #define S_IFBLK 0060000 50 #define S_IFDIR 0040000 51 #define S_IFCHR 0020000 52 #define S_IFIFO 0010000 53 #define S_ISUID 0004000 54 #define S_ISGID 0002000 55 #define S_ISVTX 0001000 56 57 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) 58 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 59 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 60 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 61 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 62 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 63 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 64 65 #define S_IRWXU 00700 66 #define S_IRUSR 00400 67 #define S_IWUSR 00200 68 #define S_IXUSR 00100 69 70 #define S_IRWXG 00070 71 #define S_IRGRP 00040 72 #define S_IWGRP 00020 73 #define S_IXGRP 00010 74 75 #define S_IRWXO 00007 76 #define S_IROTH 00004 77 #define S_IWOTH 00002 78 #define S_IXOTH 00001 79 80 #ifdef __KERNEL__ 81 #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) 82 #define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO) 83 #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) 84 #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH) 85 #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH) 86 #endif 87 88 #endif