include/uapi/linux/btrfs.h: define NULL

Started by Mikko Rapeli on Oct 15, 2015

Subsystems (2)

Maintainers (2)

DORMANTno replies SUPERSEDED

Status: Superseded by v05 (posted 2016-08-22). [go to v05]

Revision v4 (3 revisions archived).

Revisions (3)
  1. v03
  2. v4 current [diff against previous]
  3. v05 [diff against previous]

open the first message on its own page

Message details and related content
Copied the NULL definition from include/linux/stddef.h which does not have
it in userspace.

Fixes userspace compilation error:

error: ‘NULL’ undeclared (first use in this function)
    return NULL;

Signed-off-by: Mikko Rapeli <redacted>
---
 include/uapi/linux/btrfs.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index b6dec05..a8ae69b 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -20,6 +20,12 @@
 #define _UAPI_LINUX_BTRFS_H
 #include <linux/types.h>
 #include <linux/ioctl.h>
+#include <linux/stddef.h>
+
+/* for userspace where linux/stddef.h doesn't define this */
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
 
 #define BTRFS_IOCTL_MAGIC 0x94
 #define BTRFS_VOL_NAME_MAX 255
-- 
2.5.0
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help