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