scoutfs: break the build if we export raw types

Raw [su]{8,16,32,64} types keep leaking into our exported headers where
they break userspace builds.  Make sure that we only use the exported __
types and add a check to break our build if we get it wrong.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-08-04 10:37:49 -07:00
committed by Zach Brown
parent cefe06af61
commit 9f4095bffb
3 changed files with 18 additions and 3 deletions
+15
View File
@@ -7,3 +7,18 @@ CFLAGS_scoutfs_trace.o = -I$(src) # define_trace.h double include
scoutfs-y += alloc.o bio.o btree.o compact.o counters.o data.o dir.o kvec.o \
inode.o ioctl.o item.o key.o lock.o manifest.o msg.o net.o \
options.o seg.o scoutfs_trace.o sort_priv.o super.o trans.o xattr.o
#
# The raw types aren't available in userspace headers. Make sure all
# the types we use in the headers are the exported __ versions.
#
# XXX dunno how we're really supposed to do this in kbuild
#
.PHONY: $(src)/check_exported_types
$(src)/check_exported_types:
@if egrep '\<[us](8|16|32|64\>)' $(src)/format.h $(src)/ioctl.h; then \
echo "no raw types in exported headers, preface with __"; \
exit 1; \
fi
extra-y += check_exported_types
+2 -2
View File
@@ -212,8 +212,8 @@ struct scoutfs_segment_item {
__u8 nr_links;
__le32 skip_links[0];
/*
* u8 key_bytes[key_len]
* u8 val_bytes[val_len]
* __u8 key_bytes[key_len]
* __u8 val_bytes[val_len]
*/
} __packed;
+1 -1
View File
@@ -116,7 +116,7 @@ struct scoutfs_ioctl_ino_path {
} __packed;
#define SCOUTFS_IOC_INO_PATH_CURSOR_BYTES \
(sizeof(u64) + SCOUTFS_NAME_LEN + 1)
(sizeof(__u64) + SCOUTFS_NAME_LEN + 1)
/* Get a single path from the root to the given inode number */
#define SCOUTFS_IOC_INO_PATH _IOW(SCOUTFS_IOCTL_MAGIC, 2, \