wdenk | 6534c9c | 2002-07-14 15:49:39 +0000 | [diff] [blame] | 1 | #ifndef _LINUX_STAT_H |
| 2 | #define _LINUX_STAT_H |
| 3 | |
| 4 | #include <linux/types.h> |
| 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
Wolfgang Denk | b99c1e6 | 2007-04-18 16:53:52 +0200 | [diff] [blame] | 10 | #define S_IFMT 00170000 /* type of file */ |
wdenk | 6534c9c | 2002-07-14 15:49:39 +0000 | [diff] [blame] | 11 | #define S_IFSOCK 0140000 /* named socket */ |
| 12 | #define S_IFLNK 0120000 /* symbolic link */ |
| 13 | #define S_IFREG 0100000 /* regular */ |
| 14 | #define S_IFBLK 0060000 /* block special */ |
| 15 | #define S_IFDIR 0040000 /* directory */ |
| 16 | #define S_IFCHR 0020000 /* character special */ |
| 17 | #define S_IFIFO 0010000 /* fifo */ |
| 18 | #define S_ISUID 0004000 /* set user id on execution */ |
| 19 | #define S_ISGID 0002000 /* set group id on execution */ |
| 20 | #define S_ISVTX 0001000 /* save swapped text even after use */ |
| 21 | |
| 22 | #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) |
| 23 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
| 24 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
| 25 | #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) |
| 26 | #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) |
| 27 | #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) |
| 28 | #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) |
| 29 | |
| 30 | #define S_IRWXU 00700 /* rwx for owner */ |
| 31 | #define S_IRUSR 00400 /* read permission for owner */ |
| 32 | #define S_IWUSR 00200 /* write permission for owner */ |
| 33 | #define S_IXUSR 00100 /* execute/search permission for owner */ |
| 34 | |
| 35 | #define S_IRWXG 00070 /* rwx for group */ |
| 36 | #define S_IRGRP 00040 /* read permission for group */ |
| 37 | #define S_IWGRP 00020 /* write permission for group */ |
| 38 | #define S_IXGRP 00010 /* execute/search permission for group */ |
| 39 | |
| 40 | #define S_IRWXO 00007 /* rwx for other */ |
| 41 | #define S_IROTH 00004 /* read permission for other */ |
| 42 | #define S_IWOTH 00002 /* read permission for other */ |
| 43 | #define S_IXOTH 00001 /* execute/search permission for other */ |
| 44 | |
| 45 | #ifdef __PPC__ |
| 46 | |
| 47 | struct stat { |
| 48 | dev_t st_dev; /* file system id */ |
| 49 | ino_t st_ino; /* file id */ |
| 50 | mode_t st_mode; /* ownership/protection */ |
| 51 | nlink_t st_nlink; /* number of links */ |
Wolfgang Denk | b99c1e6 | 2007-04-18 16:53:52 +0200 | [diff] [blame] | 52 | uid_t st_uid; /* user id */ |
| 53 | gid_t st_gid; /* group id */ |
wdenk | 6534c9c | 2002-07-14 15:49:39 +0000 | [diff] [blame] | 54 | dev_t st_rdev; |
| 55 | off_t st_size; /* file size in # of bytes */ |
Wolfgang Denk | b99c1e6 | 2007-04-18 16:53:52 +0200 | [diff] [blame] | 56 | unsigned long st_blksize; /* block size */ |
| 57 | unsigned long st_blocks; /* file size in # of blocks */ |
| 58 | unsigned long st_atime; /* time file was last accessed */ |
| 59 | unsigned long __unused1; |
| 60 | unsigned long st_mtime; /* time file was last modified */ |
| 61 | unsigned long __unused2; |
| 62 | unsigned long st_ctime; /* time file status was last changed */ |
| 63 | unsigned long __unused3; |
| 64 | unsigned long __unused4; |
| 65 | unsigned long __unused5; |
wdenk | 6534c9c | 2002-07-14 15:49:39 +0000 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | #endif /* __PPC__ */ |
| 69 | |
Michal Simek | 3c4bd60 | 2007-05-08 00:32:35 +0200 | [diff] [blame] | 70 | #if defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\ |
Thomas Chou | c72bfaf | 2010-03-20 07:05:47 +0800 | [diff] [blame] | 71 | defined (__microblaze__) || defined (__nios2__) |
wdenk | 6534c9c | 2002-07-14 15:49:39 +0000 | [diff] [blame] | 72 | |
| 73 | struct stat { |
| 74 | unsigned short st_dev; |
| 75 | unsigned short __pad1; |
| 76 | unsigned long st_ino; |
| 77 | unsigned short st_mode; |
| 78 | unsigned short st_nlink; |
| 79 | unsigned short st_uid; |
| 80 | unsigned short st_gid; |
| 81 | unsigned short st_rdev; |
| 82 | unsigned short __pad2; |
| 83 | unsigned long st_size; |
| 84 | unsigned long st_blksize; |
| 85 | unsigned long st_blocks; |
| 86 | unsigned long st_atime; |
| 87 | unsigned long __unused1; |
| 88 | unsigned long st_mtime; |
| 89 | unsigned long __unused2; |
| 90 | unsigned long st_ctime; |
| 91 | unsigned long __unused3; |
| 92 | unsigned long __unused4; |
| 93 | unsigned long __unused5; |
| 94 | }; |
| 95 | |
| 96 | #endif /* __ARM__ */ |
| 97 | |
wdenk | 5c745d2 | 2003-12-12 00:02:26 +0000 | [diff] [blame] | 98 | #if defined (__MIPS__) |
| 99 | |
| 100 | struct stat { |
Wolfgang Denk | b99c1e6 | 2007-04-18 16:53:52 +0200 | [diff] [blame] | 101 | dev_t st_dev; |
| 102 | long st_pad1[3]; |
| 103 | ino_t st_ino; |
| 104 | mode_t st_mode; |
| 105 | nlink_t st_nlink; |
| 106 | uid_t st_uid; |
| 107 | gid_t st_gid; |
| 108 | dev_t st_rdev; |
| 109 | long st_pad2[2]; |
| 110 | off_t st_size; |
| 111 | long st_pad3; |
wdenk | 5c745d2 | 2003-12-12 00:02:26 +0000 | [diff] [blame] | 112 | /* |
| 113 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 114 | * but we don't have it under Linux. |
| 115 | */ |
Wolfgang Denk | b99c1e6 | 2007-04-18 16:53:52 +0200 | [diff] [blame] | 116 | time_t st_atime; |
| 117 | long reserved0; |
| 118 | time_t st_mtime; |
| 119 | long reserved1; |
| 120 | time_t st_ctime; |
| 121 | long reserved2; |
| 122 | long st_blksize; |
| 123 | long st_blocks; |
| 124 | long st_pad4[14]; |
wdenk | 5c745d2 | 2003-12-12 00:02:26 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | #endif /* __MIPS__ */ |
| 128 | |
Nobuhiro Iwamatsu | 280df59a8 | 2008-03-27 15:44:12 +0900 | [diff] [blame] | 129 | #if defined(__AVR32__) || defined(__SH__) |
Haavard Skinnemoen | 9c0deb5 | 2007-03-21 19:44:48 +0100 | [diff] [blame] | 130 | |
| 131 | struct stat { |
Wolfgang Denk | b99c1e6 | 2007-04-18 16:53:52 +0200 | [diff] [blame] | 132 | unsigned long st_dev; |
| 133 | unsigned long st_ino; |
| 134 | unsigned short st_mode; |
| 135 | unsigned short st_nlink; |
| 136 | unsigned short st_uid; |
| 137 | unsigned short st_gid; |
| 138 | unsigned long st_rdev; |
| 139 | unsigned long st_size; |
| 140 | unsigned long st_blksize; |
| 141 | unsigned long st_blocks; |
| 142 | unsigned long st_atime; |
| 143 | unsigned long st_atime_nsec; |
| 144 | unsigned long st_mtime; |
| 145 | unsigned long st_mtime_nsec; |
| 146 | unsigned long st_ctime; |
| 147 | unsigned long st_ctime_nsec; |
| 148 | unsigned long __unused4; |
| 149 | unsigned long __unused5; |
Haavard Skinnemoen | 9c0deb5 | 2007-03-21 19:44:48 +0100 | [diff] [blame] | 150 | }; |
| 151 | |
Nobuhiro Iwamatsu | 280df59a8 | 2008-03-27 15:44:12 +0900 | [diff] [blame] | 152 | #endif /* __AVR32__ || __SH__ */ |
Haavard Skinnemoen | 9c0deb5 | 2007-03-21 19:44:48 +0100 | [diff] [blame] | 153 | |
wdenk | 6534c9c | 2002-07-14 15:49:39 +0000 | [diff] [blame] | 154 | #ifdef __cplusplus |
| 155 | } |
| 156 | #endif |
| 157 | |
| 158 | #endif |