]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - arch/x86/include/asm/stat.h
vfs: don't force a big memset of stat data just to clear padding fields
[thirdparty/linux.git] / arch / x86 / include / asm / stat.h
index e0b1d9bbcbc66b2b1717949537795c2688cd09bc..7b3ddc348585f0c8b4cc0afe63b6ac36206217d3 100644 (file)
@@ -25,6 +25,12 @@ struct stat {
        unsigned long  __unused5;
 };
 
+/* We don't need to memset the whole thing just to initialize the padding */
+#define INIT_STRUCT_STAT_PADDING(st) do {      \
+       st.__unused4 = 0;                       \
+       st.__unused5 = 0;                       \
+} while (0)
+
 #define STAT64_HAS_BROKEN_ST_INO       1
 
 /* This matches struct stat64 in glibc2.1, hence the absolutely
@@ -63,6 +69,12 @@ struct stat64 {
        unsigned long long      st_ino;
 };
 
+/* We don't need to memset the whole thing just to initialize the padding */
+#define INIT_STRUCT_STAT64_PADDING(st) do {            \
+       memset(&st.__pad0, 0, sizeof(st.__pad0));       \
+       memset(&st.__pad3, 0, sizeof(st.__pad3));       \
+} while (0)
+
 #else /* __i386__ */
 
 struct stat {
@@ -87,6 +99,15 @@ struct stat {
        unsigned long   st_ctime_nsec;
        long            __unused[3];
 };
+
+/* We don't need to memset the whole thing just to initialize the padding */
+#define INIT_STRUCT_STAT_PADDING(st) do {      \
+       st.__pad0 = 0;                          \
+       st.__unused[0] = 0;                     \
+       st.__unused[1] = 0;                     \
+       st.__unused[2] = 0;                     \
+} while (0)
+
 #endif
 
 /* for 32bit emulation and 32 bit kernels */