1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2af170c50SDavid Howells #ifndef _ASM_X86_STAT_H 3af170c50SDavid Howells #define _ASM_X86_STAT_H 4af170c50SDavid Howells 5b70fedc1SH.J. Lu #include <asm/posix_types.h> 6b70fedc1SH.J. Lu 7af170c50SDavid Howells #define STAT_HAVE_NSEC 1 8af170c50SDavid Howells 9af170c50SDavid Howells #ifdef __i386__ 10af170c50SDavid Howells struct stat { 11af170c50SDavid Howells unsigned long st_dev; 12af170c50SDavid Howells unsigned long st_ino; 13af170c50SDavid Howells unsigned short st_mode; 14af170c50SDavid Howells unsigned short st_nlink; 15af170c50SDavid Howells unsigned short st_uid; 16af170c50SDavid Howells unsigned short st_gid; 17af170c50SDavid Howells unsigned long st_rdev; 18af170c50SDavid Howells unsigned long st_size; 19af170c50SDavid Howells unsigned long st_blksize; 20af170c50SDavid Howells unsigned long st_blocks; 21af170c50SDavid Howells unsigned long st_atime; 22af170c50SDavid Howells unsigned long st_atime_nsec; 23af170c50SDavid Howells unsigned long st_mtime; 24af170c50SDavid Howells unsigned long st_mtime_nsec; 25af170c50SDavid Howells unsigned long st_ctime; 26af170c50SDavid Howells unsigned long st_ctime_nsec; 27af170c50SDavid Howells unsigned long __unused4; 28af170c50SDavid Howells unsigned long __unused5; 29af170c50SDavid Howells }; 30af170c50SDavid Howells 31af170c50SDavid Howells /* We don't need to memset the whole thing just to initialize the padding */ 32af170c50SDavid Howells #define INIT_STRUCT_STAT_PADDING(st) do { \ 33af170c50SDavid Howells st.__unused4 = 0; \ 34af170c50SDavid Howells st.__unused5 = 0; \ 35af170c50SDavid Howells } while (0) 36af170c50SDavid Howells 37af170c50SDavid Howells #define STAT64_HAS_BROKEN_ST_INO 1 38af170c50SDavid Howells 39af170c50SDavid Howells /* This matches struct stat64 in glibc2.1, hence the absolutely 40af170c50SDavid Howells * insane amounts of padding around dev_t's. 41af170c50SDavid Howells */ 42af170c50SDavid Howells struct stat64 { 43af170c50SDavid Howells unsigned long long st_dev; 44af170c50SDavid Howells unsigned char __pad0[4]; 45af170c50SDavid Howells 46af170c50SDavid Howells unsigned long __st_ino; 47af170c50SDavid Howells 48af170c50SDavid Howells unsigned int st_mode; 49af170c50SDavid Howells unsigned int st_nlink; 50af170c50SDavid Howells 51af170c50SDavid Howells unsigned long st_uid; 52af170c50SDavid Howells unsigned long st_gid; 53af170c50SDavid Howells 54af170c50SDavid Howells unsigned long long st_rdev; 55af170c50SDavid Howells unsigned char __pad3[4]; 56af170c50SDavid Howells 57af170c50SDavid Howells long long st_size; 58af170c50SDavid Howells unsigned long st_blksize; 59af170c50SDavid Howells 60af170c50SDavid Howells /* Number 512-byte blocks allocated. */ 61af170c50SDavid Howells unsigned long long st_blocks; 62af170c50SDavid Howells 63af170c50SDavid Howells unsigned long st_atime; 64af170c50SDavid Howells unsigned long st_atime_nsec; 65af170c50SDavid Howells 66af170c50SDavid Howells unsigned long st_mtime; 67af170c50SDavid Howells unsigned int st_mtime_nsec; 68af170c50SDavid Howells 69af170c50SDavid Howells unsigned long st_ctime; 70af170c50SDavid Howells unsigned long st_ctime_nsec; 71af170c50SDavid Howells 72af170c50SDavid Howells unsigned long long st_ino; 73af170c50SDavid Howells }; 74af170c50SDavid Howells 75af170c50SDavid Howells /* We don't need to memset the whole thing just to initialize the padding */ 76af170c50SDavid Howells #define INIT_STRUCT_STAT64_PADDING(st) do { \ 77af170c50SDavid Howells memset(&st.__pad0, 0, sizeof(st.__pad0)); \ 78af170c50SDavid Howells memset(&st.__pad3, 0, sizeof(st.__pad3)); \ 79af170c50SDavid Howells } while (0) 80af170c50SDavid Howells 81af170c50SDavid Howells #else /* __i386__ */ 82af170c50SDavid Howells 83af170c50SDavid Howells struct stat { 84b70fedc1SH.J. Lu __kernel_ulong_t st_dev; 85b70fedc1SH.J. Lu __kernel_ulong_t st_ino; 86b70fedc1SH.J. Lu __kernel_ulong_t st_nlink; 87af170c50SDavid Howells 88af170c50SDavid Howells unsigned int st_mode; 89af170c50SDavid Howells unsigned int st_uid; 90af170c50SDavid Howells unsigned int st_gid; 91af170c50SDavid Howells unsigned int __pad0; 92b70fedc1SH.J. Lu __kernel_ulong_t st_rdev; 93b70fedc1SH.J. Lu __kernel_long_t st_size; 94b70fedc1SH.J. Lu __kernel_long_t st_blksize; 95b70fedc1SH.J. Lu __kernel_long_t st_blocks; /* Number 512-byte blocks allocated. */ 96af170c50SDavid Howells 97b70fedc1SH.J. Lu __kernel_ulong_t st_atime; 98b70fedc1SH.J. Lu __kernel_ulong_t st_atime_nsec; 99b70fedc1SH.J. Lu __kernel_ulong_t st_mtime; 100b70fedc1SH.J. Lu __kernel_ulong_t st_mtime_nsec; 101b70fedc1SH.J. Lu __kernel_ulong_t st_ctime; 102b70fedc1SH.J. Lu __kernel_ulong_t st_ctime_nsec; 103b70fedc1SH.J. Lu __kernel_long_t __unused[3]; 104af170c50SDavid Howells }; 105af170c50SDavid Howells 106af170c50SDavid Howells /* We don't need to memset the whole thing just to initialize the padding */ 107af170c50SDavid Howells #define INIT_STRUCT_STAT_PADDING(st) do { \ 108af170c50SDavid Howells st.__pad0 = 0; \ 109af170c50SDavid Howells st.__unused[0] = 0; \ 110af170c50SDavid Howells st.__unused[1] = 0; \ 111af170c50SDavid Howells st.__unused[2] = 0; \ 112af170c50SDavid Howells } while (0) 113af170c50SDavid Howells 114af170c50SDavid Howells #endif 115af170c50SDavid Howells 116af170c50SDavid Howells /* for 32bit emulation and 32 bit kernels */ 117af170c50SDavid Howells struct __old_kernel_stat { 118af170c50SDavid Howells unsigned short st_dev; 119af170c50SDavid Howells unsigned short st_ino; 120af170c50SDavid Howells unsigned short st_mode; 121af170c50SDavid Howells unsigned short st_nlink; 122af170c50SDavid Howells unsigned short st_uid; 123af170c50SDavid Howells unsigned short st_gid; 124af170c50SDavid Howells unsigned short st_rdev; 125af170c50SDavid Howells #ifdef __i386__ 126af170c50SDavid Howells unsigned long st_size; 127af170c50SDavid Howells unsigned long st_atime; 128af170c50SDavid Howells unsigned long st_mtime; 129af170c50SDavid Howells unsigned long st_ctime; 130af170c50SDavid Howells #else 131af170c50SDavid Howells unsigned int st_size; 132af170c50SDavid Howells unsigned int st_atime; 133af170c50SDavid Howells unsigned int st_mtime; 134af170c50SDavid Howells unsigned int st_ctime; 135af170c50SDavid Howells #endif 136af170c50SDavid Howells }; 137af170c50SDavid Howells 138af170c50SDavid Howells #endif /* _ASM_X86_STAT_H */ 139