"Das U-Boot" Source Tree

linux: Add generic struct stat {}

Add generic implementation of struct stat {} imported from Linux 6.13.y
commit 27560b371ab8 ("fs: pack struct kstat better"). This can be used
by filesystem code imported from elsewhere. Now struct stat {} becomes
available on all supported architectures.

Signed-off-by: Marek Vasut <marex@denx.de>

authored by

Marek Vasut and committed by
Tom Rini
be96ac51 6592425c

+35 -10
+35 -10
include/linux/stat.h
··· 65 65 unsigned long __unused5; 66 66 }; 67 67 68 - #endif /* __PPC__ */ 69 - 70 - #if defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\ 68 + #elif defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\ 71 69 defined (__microblaze__) || defined (__nios2__) 72 70 73 71 struct stat { ··· 93 91 unsigned long __unused5; 94 92 }; 95 93 96 - #endif /* __ARM__ */ 97 - 98 - #if defined (__MIPS__) 94 + #elif defined (__MIPS__) 99 95 100 96 struct stat { 101 97 dev_t st_dev; ··· 124 120 long st_pad4[14]; 125 121 }; 126 122 127 - #endif /* __MIPS__ */ 128 - 129 - #if defined(__SH__) || defined(__XTENSA__) 123 + #elif defined(__SH__) || defined(__XTENSA__) 130 124 131 125 struct stat { 132 126 unsigned long st_dev; ··· 149 143 unsigned long __unused5; 150 144 }; 151 145 152 - #endif /* __SH__ || __XTENSA__ */ 146 + #else 147 + 148 + /* 149 + * Everybody gets this wrong and has to stick with it for all 150 + * eternity. Hopefully, this version gets used by new architectures 151 + * so they don't fall into the same traps. 152 + * 153 + */ 154 + struct stat { 155 + unsigned long st_dev; /* Device. */ 156 + unsigned long st_ino; /* File serial number. */ 157 + unsigned int st_mode; /* File mode. */ 158 + unsigned int st_nlink; /* Link count. */ 159 + unsigned int st_uid; /* User ID of the file's owner. */ 160 + unsigned int st_gid; /* Group ID of the file's group. */ 161 + unsigned long st_rdev; /* Device number, if device. */ 162 + unsigned long __pad1; 163 + long st_size; /* Size of file, in bytes. */ 164 + int st_blksize; /* Optimal block size for I/O. */ 165 + int __pad2; 166 + long st_blocks; /* Number 512-byte blocks allocated. */ 167 + long st_atime; /* Time of last access. */ 168 + unsigned long st_atime_nsec; 169 + long st_mtime; /* Time of last modification. */ 170 + unsigned long st_mtime_nsec; 171 + long st_ctime; /* Time of last status change. */ 172 + unsigned long st_ctime_nsec; 173 + unsigned int __unused4; 174 + unsigned int __unused5; 175 + }; 176 + 177 + #endif 153 178 154 179 #ifdef __cplusplus 155 180 }