Commit 4c82456e authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: fix type definitions in uapi header

Commit 7e98d530 (Synchronize fuse header with
one used in library) added #ifdef __linux__ around defines if it is not set.
The kernel build is self-contained and can be built on non-Linux toolchains.
After the mentioned commit builds on non-Linux toolchains will try to include
stdint.h and fail due to -nostdinc, and then fail with a bunch of undefined type
errors.

Fix by checking for __KERNEL__ instead of __linux__ and using the standard int
types instead of the linux specific ones.
Reported-by: default avatarArve Hjønnevåg <arve@android.com>
Reported-by: default avatarColin Cross <ccross@android.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent 41ef2d56
...@@ -95,15 +95,10 @@ ...@@ -95,15 +95,10 @@
#ifndef _LINUX_FUSE_H #ifndef _LINUX_FUSE_H
#define _LINUX_FUSE_H #define _LINUX_FUSE_H
#ifdef __linux__ #ifdef __KERNEL__
#include <linux/types.h> #include <linux/types.h>
#else #else
#include <stdint.h> #include <stdint.h>
#define __u64 uint64_t
#define __s64 int64_t
#define __u32 uint32_t
#define __s32 int32_t
#define __u16 uint16_t
#endif #endif
/* /*
...@@ -139,42 +134,42 @@ ...@@ -139,42 +134,42 @@
userspace works under 64bit kernels */ userspace works under 64bit kernels */
struct fuse_attr { struct fuse_attr {
__u64 ino; uint64_t ino;
__u64 size; uint64_t size;
__u64 blocks; uint64_t blocks;
__u64 atime; uint64_t atime;
__u64 mtime; uint64_t mtime;
__u64 ctime; uint64_t ctime;
__u32 atimensec; uint32_t atimensec;
__u32 mtimensec; uint32_t mtimensec;
__u32 ctimensec; uint32_t ctimensec;
__u32 mode; uint32_t mode;
__u32 nlink; uint32_t nlink;
__u32 uid; uint32_t uid;
__u32 gid; uint32_t gid;
__u32 rdev; uint32_t rdev;
__u32 blksize; uint32_t blksize;
__u32 padding; uint32_t padding;
}; };
struct fuse_kstatfs { struct fuse_kstatfs {
__u64 blocks; uint64_t blocks;
__u64 bfree; uint64_t bfree;
__u64 bavail; uint64_t bavail;
__u64 files; uint64_t files;
__u64 ffree; uint64_t ffree;
__u32 bsize; uint32_t bsize;
__u32 namelen; uint32_t namelen;
__u32 frsize; uint32_t frsize;
__u32 padding; uint32_t padding;
__u32 spare[6]; uint32_t spare[6];
}; };
struct fuse_file_lock { struct fuse_file_lock {
__u64 start; uint64_t start;
__u64 end; uint64_t end;
__u32 type; uint32_t type;
__u32 pid; /* tgid */ uint32_t pid; /* tgid */
}; };
/** /**
...@@ -364,143 +359,143 @@ enum fuse_notify_code { ...@@ -364,143 +359,143 @@ enum fuse_notify_code {
#define FUSE_COMPAT_ENTRY_OUT_SIZE 120 #define FUSE_COMPAT_ENTRY_OUT_SIZE 120
struct fuse_entry_out { struct fuse_entry_out {
__u64 nodeid; /* Inode ID */ uint64_t nodeid; /* Inode ID */
__u64 generation; /* Inode generation: nodeid:gen must uint64_t generation; /* Inode generation: nodeid:gen must
be unique for the fs's lifetime */ be unique for the fs's lifetime */
__u64 entry_valid; /* Cache timeout for the name */ uint64_t entry_valid; /* Cache timeout for the name */
__u64 attr_valid; /* Cache timeout for the attributes */ uint64_t attr_valid; /* Cache timeout for the attributes */
__u32 entry_valid_nsec; uint32_t entry_valid_nsec;
__u32 attr_valid_nsec; uint32_t attr_valid_nsec;
struct fuse_attr attr; struct fuse_attr attr;
}; };
struct fuse_forget_in { struct fuse_forget_in {
__u64 nlookup; uint64_t nlookup;
}; };
struct fuse_forget_one { struct fuse_forget_one {
__u64 nodeid; uint64_t nodeid;
__u64 nlookup; uint64_t nlookup;
}; };
struct fuse_batch_forget_in { struct fuse_batch_forget_in {
__u32 count; uint32_t count;
__u32 dummy; uint32_t dummy;
}; };
struct fuse_getattr_in { struct fuse_getattr_in {
__u32 getattr_flags; uint32_t getattr_flags;
__u32 dummy; uint32_t dummy;
__u64 fh; uint64_t fh;
}; };
#define FUSE_COMPAT_ATTR_OUT_SIZE 96 #define FUSE_COMPAT_ATTR_OUT_SIZE 96
struct fuse_attr_out { struct fuse_attr_out {
__u64 attr_valid; /* Cache timeout for the attributes */ uint64_t attr_valid; /* Cache timeout for the attributes */
__u32 attr_valid_nsec; uint32_t attr_valid_nsec;
__u32 dummy; uint32_t dummy;
struct fuse_attr attr; struct fuse_attr attr;
}; };
#define FUSE_COMPAT_MKNOD_IN_SIZE 8 #define FUSE_COMPAT_MKNOD_IN_SIZE 8
struct fuse_mknod_in { struct fuse_mknod_in {
__u32 mode; uint32_t mode;
__u32 rdev; uint32_t rdev;
__u32 umask; uint32_t umask;
__u32 padding; uint32_t padding;
}; };
struct fuse_mkdir_in { struct fuse_mkdir_in {
__u32 mode; uint32_t mode;
__u32 umask; uint32_t umask;
}; };
struct fuse_rename_in { struct fuse_rename_in {
__u64 newdir; uint64_t newdir;
}; };
struct fuse_link_in { struct fuse_link_in {
__u64 oldnodeid; uint64_t oldnodeid;
}; };
struct fuse_setattr_in { struct fuse_setattr_in {
__u32 valid; uint32_t valid;
__u32 padding; uint32_t padding;
__u64 fh; uint64_t fh;
__u64 size; uint64_t size;
__u64 lock_owner; uint64_t lock_owner;
__u64 atime; uint64_t atime;
__u64 mtime; uint64_t mtime;
__u64 unused2; uint64_t unused2;
__u32 atimensec; uint32_t atimensec;
__u32 mtimensec; uint32_t mtimensec;
__u32 unused3; uint32_t unused3;
__u32 mode; uint32_t mode;
__u32 unused4; uint32_t unused4;
__u32 uid; uint32_t uid;
__u32 gid; uint32_t gid;
__u32 unused5; uint32_t unused5;
}; };
struct fuse_open_in { struct fuse_open_in {
__u32 flags; uint32_t flags;
__u32 unused; uint32_t unused;
}; };
struct fuse_create_in { struct fuse_create_in {
__u32 flags; uint32_t flags;
__u32 mode; uint32_t mode;
__u32 umask; uint32_t umask;
__u32 padding; uint32_t padding;
}; };
struct fuse_open_out { struct fuse_open_out {
__u64 fh; uint64_t fh;
__u32 open_flags; uint32_t open_flags;
__u32 padding; uint32_t padding;
}; };
struct fuse_release_in { struct fuse_release_in {
__u64 fh; uint64_t fh;
__u32 flags; uint32_t flags;
__u32 release_flags; uint32_t release_flags;
__u64 lock_owner; uint64_t lock_owner;
}; };
struct fuse_flush_in { struct fuse_flush_in {
__u64 fh; uint64_t fh;
__u32 unused; uint32_t unused;
__u32 padding; uint32_t padding;
__u64 lock_owner; uint64_t lock_owner;
}; };
struct fuse_read_in { struct fuse_read_in {
__u64 fh; uint64_t fh;
__u64 offset; uint64_t offset;
__u32 size; uint32_t size;
__u32 read_flags; uint32_t read_flags;
__u64 lock_owner; uint64_t lock_owner;
__u32 flags; uint32_t flags;
__u32 padding; uint32_t padding;
}; };
#define FUSE_COMPAT_WRITE_IN_SIZE 24 #define FUSE_COMPAT_WRITE_IN_SIZE 24
struct fuse_write_in { struct fuse_write_in {
__u64 fh; uint64_t fh;
__u64 offset; uint64_t offset;
__u32 size; uint32_t size;
__u32 write_flags; uint32_t write_flags;
__u64 lock_owner; uint64_t lock_owner;
__u32 flags; uint32_t flags;
__u32 padding; uint32_t padding;
}; };
struct fuse_write_out { struct fuse_write_out {
__u32 size; uint32_t size;
__u32 padding; uint32_t padding;
}; };
#define FUSE_COMPAT_STATFS_SIZE 48 #define FUSE_COMPAT_STATFS_SIZE 48
...@@ -510,32 +505,32 @@ struct fuse_statfs_out { ...@@ -510,32 +505,32 @@ struct fuse_statfs_out {
}; };
struct fuse_fsync_in { struct fuse_fsync_in {
__u64 fh; uint64_t fh;
__u32 fsync_flags; uint32_t fsync_flags;
__u32 padding; uint32_t padding;
}; };
struct fuse_setxattr_in { struct fuse_setxattr_in {
__u32 size; uint32_t size;
__u32 flags; uint32_t flags;
}; };
struct fuse_getxattr_in { struct fuse_getxattr_in {
__u32 size; uint32_t size;
__u32 padding; uint32_t padding;
}; };
struct fuse_getxattr_out { struct fuse_getxattr_out {
__u32 size; uint32_t size;
__u32 padding; uint32_t padding;
}; };
struct fuse_lk_in { struct fuse_lk_in {
__u64 fh; uint64_t fh;
__u64 owner; uint64_t owner;
struct fuse_file_lock lk; struct fuse_file_lock lk;
__u32 lk_flags; uint32_t lk_flags;
__u32 padding; uint32_t padding;
}; };
struct fuse_lk_out { struct fuse_lk_out {
...@@ -543,134 +538,135 @@ struct fuse_lk_out { ...@@ -543,134 +538,135 @@ struct fuse_lk_out {
}; };
struct fuse_access_in { struct fuse_access_in {
__u32 mask; uint32_t mask;
__u32 padding; uint32_t padding;
}; };
struct fuse_init_in { struct fuse_init_in {
__u32 major; uint32_t major;
__u32 minor; uint32_t minor;
__u32 max_readahead; uint32_t max_readahead;
__u32 flags; uint32_t flags;
}; };
struct fuse_init_out { struct fuse_init_out {
__u32 major; uint32_t major;
__u32 minor; uint32_t minor;
__u32 max_readahead; uint32_t max_readahead;
__u32 flags; uint32_t flags;
__u16 max_background; uint16_t max_background;
__u16 congestion_threshold; uint16_t congestion_threshold;
__u32 max_write; uint32_t max_write;
}; };
#define CUSE_INIT_INFO_MAX 4096 #define CUSE_INIT_INFO_MAX 4096
struct cuse_init_in { struct cuse_init_in {
__u32 major; uint32_t major;
__u32 minor; uint32_t minor;
__u32 unused; uint32_t unused;
__u32 flags; uint32_t flags;
}; };
struct cuse_init_out { struct cuse_init_out {
__u32 major; uint32_t major;
__u32 minor; uint32_t minor;
__u32 unused; uint32_t unused;
__u32 flags; uint32_t flags;
__u32 max_read; uint32_t max_read;
__u32 max_write; uint32_t max_write;
__u32 dev_major; /* chardev major */ uint32_t dev_major; /* chardev major */
__u32 dev_minor; /* chardev minor */ uint32_t dev_minor; /* chardev minor */
__u32 spare[10]; uint32_t spare[10];
}; };
struct fuse_interrupt_in { struct fuse_interrupt_in {
__u64 unique; uint64_t unique;
}; };
struct fuse_bmap_in { struct fuse_bmap_in {
__u64 block; uint64_t block;
__u32 blocksize; uint32_t blocksize;
__u32 padding; uint32_t padding;
}; };
struct fuse_bmap_out { struct fuse_bmap_out {
__u64 block; uint64_t block;
}; };
struct fuse_ioctl_in { struct fuse_ioctl_in {
__u64 fh; uint64_t fh;
__u32 flags; uint32_t flags;
__u32 cmd; uint32_t cmd;
__u64 arg; uint64_t arg;
__u32 in_size; uint32_t in_size;
__u32 out_size; uint32_t out_size;
}; };
struct fuse_ioctl_iovec { struct fuse_ioctl_iovec {
__u64 base; uint64_t base;
__u64 len; uint64_t len;
}; };
struct fuse_ioctl_out { struct fuse_ioctl_out {
__s32 result; int32_t result;
__u32 flags; uint32_t flags;
__u32 in_iovs; uint32_t in_iovs;
__u32 out_iovs; uint32_t out_iovs;
}; };
struct fuse_poll_in { struct fuse_poll_in {
__u64 fh; uint64_t fh;
__u64 kh; uint64_t kh;
__u32 flags; uint32_t flags;
__u32 events; uint32_t events;
}; };
struct fuse_poll_out { struct fuse_poll_out {
__u32 revents; uint32_t revents;
__u32 padding; uint32_t padding;
}; };
struct fuse_notify_poll_wakeup_out { struct fuse_notify_poll_wakeup_out {
__u64 kh; uint64_t kh;
}; };
struct fuse_fallocate_in { struct fuse_fallocate_in {
__u64 fh; uint64_t fh;
__u64 offset; uint64_t offset;
__u64 length; uint64_t length;
__u32 mode; uint32_t mode;
__u32 padding; uint32_t padding;
}; };
struct fuse_in_header { struct fuse_in_header {
__u32 len; uint32_t len;
__u32 opcode; uint32_t opcode;
__u64 unique; uint64_t unique;
__u64 nodeid; uint64_t nodeid;
__u32 uid; uint32_t uid;
__u32 gid; uint32_t gid;
__u32 pid; uint32_t pid;
__u32 padding; uint32_t padding;
}; };
struct fuse_out_header { struct fuse_out_header {
__u32 len; uint32_t len;
__s32 error; int32_t error;
__u64 unique; uint64_t unique;
}; };
struct fuse_dirent { struct fuse_dirent {
__u64 ino; uint64_t ino;
__u64 off; uint64_t off;
__u32 namelen; uint32_t namelen;
__u32 type; uint32_t type;
char name[]; char name[];
}; };
#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) #define FUSE_DIRENT_ALIGN(x) \
(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
#define FUSE_DIRENT_SIZE(d) \ #define FUSE_DIRENT_SIZE(d) \
FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
...@@ -685,47 +681,47 @@ struct fuse_direntplus { ...@@ -685,47 +681,47 @@ struct fuse_direntplus {
FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen) FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
struct fuse_notify_inval_inode_out { struct fuse_notify_inval_inode_out {
__u64 ino; uint64_t ino;
__s64 off; int64_t off;
__s64 len; int64_t len;
}; };
struct fuse_notify_inval_entry_out { struct fuse_notify_inval_entry_out {
__u64 parent; uint64_t parent;
__u32 namelen; uint32_t namelen;
__u32 padding; uint32_t padding;
}; };
struct fuse_notify_delete_out { struct fuse_notify_delete_out {
__u64 parent; uint64_t parent;
__u64 child; uint64_t child;
__u32 namelen; uint32_t namelen;
__u32 padding; uint32_t padding;
}; };
struct fuse_notify_store_out { struct fuse_notify_store_out {
__u64 nodeid; uint64_t nodeid;
__u64 offset; uint64_t offset;
__u32 size; uint32_t size;
__u32 padding; uint32_t padding;
}; };
struct fuse_notify_retrieve_out { struct fuse_notify_retrieve_out {
__u64 notify_unique; uint64_t notify_unique;
__u64 nodeid; uint64_t nodeid;
__u64 offset; uint64_t offset;
__u32 size; uint32_t size;
__u32 padding; uint32_t padding;
}; };
/* Matches the size of fuse_write_in */ /* Matches the size of fuse_write_in */
struct fuse_notify_retrieve_in { struct fuse_notify_retrieve_in {
__u64 dummy1; uint64_t dummy1;
__u64 offset; uint64_t offset;
__u32 size; uint32_t size;
__u32 dummy2; uint32_t dummy2;
__u64 dummy3; uint64_t dummy3;
__u64 dummy4; uint64_t dummy4;
}; };
#endif /* _LINUX_FUSE_H */ #endif /* _LINUX_FUSE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment