Skip to contentSkip to conversation

nvme-cli: Fix build on aarch64-linux-android-4.9

PATCH Superseded Rakesh Pandit 2 participants 2 messages Apr 23, 2017 – Apr 24, 2017 NVMe

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-cli: Fix build on aarch64-linux-android-4.9

Need to include sys/stat.h to fix:
fabrics.c:414:45: error: 'S_IRUSR' undeclared (first use in this function) fabrics.c:414:53: error: 'S_IWUSR' undeclared (first use in this function)

Standard header had offsetof predefined. Fix this trivial warning. common.h:4:0: warning: "offsetof" redefined
#define offsetof(x, y) __builtin_offsetof(x, y)
^

Signed-off-by Rakesh Pandit <rakesh at tuxera.com>
---
 common.h  |    2 ++
 fabrics.c |    1 +
 2 files changed, 3 insertions(+)
common.h +2 -0
index f0a94de..6f810c1 100644
@@ -1,7 +1,9 @@
 #ifndef _COMMON_H
 #define _COMMON_H
 
+#ifndef offsetof
 #define offsetof(x, y)	__builtin_offsetof(x, y)
+#endif
 
 #define __round_mask(x, y) ((__typeof__(x))((y)-1))
 #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
fabrics.c +1 -0
index a2e8f60..e7f42e3 100644
@@ -32,6 +32,7 @@
 #include <inttypes.h>
 #include <linux/types.h>
 #include <libgen.h>
+#include <sys/stat.h>
 
 #include "parser.h"
 #include "nvme-ioctl.h"
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 nvme-cli: Fix build on aarch64-linux-android-4.9

common.h line 6

Quoted 6 lines

#ifndef _COMMON_H
#define _COMMON_H

common.h +2 -0
+#ifndef offsetof
 #define offsetof(x, y)	__builtin_offsetof(x, y)
+#endif

Please just remove the defintion entirely and make sure we always have <stddef.h> included for the offsetoff definition.