* [RFC] UAPI: Check headers by compiling all together as C++ @ 2018-09-06 9:18 David Howells 2018-09-06 9:18 ` [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2] David Howells ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: David Howells @ 2018-09-06 9:18 UTC (permalink / raw) To: linux-api, linux-kbuild Cc: Michal Marek, dri-devel, virtualization, keyrings, David Airlie, linux-nilfs, linux-nvdimm, Michael S. Tsirkin, codalist, coda, coreteam, Rob Clark, linux-arm-msm, Kent Overstreet, Dan Williams, linux-bcache, Coly Li, Jan Harkes, Yann Droneaud, Masahiro Yamada, Ryusuke Konishi, Jason Wang, Mat Martineau, netfilter-devel, linux-fsdevel, freedreno, linux-kernel, dhowells Here's a set of patches that inserts a step into the build process to make sure that the UAPI headers can all be built together with C++ (if the compiler being used supports C++). Note that it's based on a commit from the sound tree to fix usage of u32 and co.. Most of the patches perform fixups, including: (1) Fix member names that conflict with C++ reserved words by providing alternates that can be used anywhere. An anonymous union is used so that that the conflicting name is still available outside of C++. (2) Fix the use of flexible arrays in structs that get embedded (which is illegal in C++). (3) Remove the use of internal kernel structs in UAPI structures. (4) Fix symbol collisions. (5) Fix use of sparsely initialised arrays (which g++ doesn't implement). (6) Remove some use of PAGE_SIZE since this isn't valid outside of the kernel. There's also: (7) Move the coda_psdev.h header file to fs/coda/. And lastly: (8) Compile all of the UAPI headers (with a few exceptions) together as C++ to catch new errors occurring as part of the regular build process. Changes for v2: - Merge commit from sound tree to fix u32 usage issues - Use a switch to fix sparse array initialisation - Simplify nilfs2 by performing bitwise ops in LE space not CPU space - Handle conflicting fix to use of 'private' in keyctl.h - Move kernel internal coda bits to coda internal headers - Move coda_psdev.h header to fs/coda/. The patches can also be found here: http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check Thanks, David --- David Howells (11): UAPI: drm: Fix use of C++ keywords as structural members UAPI: keys: Fix use of C++ keywords as structural members UAPI: virtio_net: Fix use of C++ keywords as structural members UAPI: bcache: Fix use of embedded flexible array UAPI: coda: Move kernel internals out of public view coda: Move internal defs out of include/linux/ UAPI: netfilter: Fix symbol collision issues UAPI: nilfs2: Fix use of undefined byteswapping functions UAPI: ndctl: Fix g++-unsupported initialisation in headers UAPI: ndctl: Remove use of PAGE_SIZE UAPI: Check headers build for C++ Makefile | 1 fs/coda/cache.c | 2 fs/coda/cnode.c | 2 fs/coda/coda_linux.c | 2 fs/coda/coda_psdev.h | 88 +++++++++++++++ fs/coda/dir.c | 2 fs/coda/file.c | 3 - fs/coda/inode.c | 2 fs/coda/pioctl.c | 3 - fs/coda/psdev.c | 3 - fs/coda/symlink.c | 3 - fs/coda/upcall.c | 2 include/linux/coda_psdev.h | 72 ------------ include/linux/ndctl.h | 22 ++++ include/uapi/drm/i810_drm.h | 7 + include/uapi/drm/msm_drm.h | 7 + include/uapi/linux/bcache.h | 2 include/uapi/linux/coda_psdev.h | 18 --- include/uapi/linux/keyctl.h | 7 + include/uapi/linux/ndctl.h | 52 ++++----- include/uapi/linux/netfilter/nfnetlink_cthelper.h | 2 include/uapi/linux/netfilter_ipv4/ipt_ECN.h | 9 -- include/uapi/linux/nilfs2_ondisk.h | 28 ++--- include/uapi/linux/virtio_net.h | 7 + scripts/headers-c++.sh | 124 +++++++++++++++++++++ 25 files changed, 304 insertions(+), 166 deletions(-) create mode 100644 fs/coda/coda_psdev.h delete mode 100644 include/linux/coda_psdev.h create mode 100644 include/linux/ndctl.h create mode 100755 scripts/headers-c++.sh ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2] 2018-09-06 9:18 [RFC] UAPI: Check headers by compiling all together as C++ David Howells @ 2018-09-06 9:18 ` David Howells 2018-09-06 9:19 ` [PATCH 06/11] coda: Move internal defs out of include/linux/ " David Howells 2018-09-06 9:19 ` [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions " David Howells 2 siblings, 0 replies; 4+ messages in thread From: David Howells @ 2018-09-06 9:18 UTC (permalink / raw) To: linux-api, linux-kbuild Cc: Yann Droneaud, Yann Droneaud, Jan Harkes, coda, codalist, linux-fsdevel, linux-kernel, dhowells The upc_req struct and the CODA_REQ_* constants are kernel internals and shouldn't have been exposed to userspace. Indeed, the upc_req struct contains other kernel internal structs. Move them to include/linux/coda_psdev.h. Suggested-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: David Howells <dhowells@redhat.com> cc: Yann Droneaud <ydroneaud@opteya.com> cc: Jan Harkes <jaharkes@cs.cmu.edu> cc: coda@cs.cmu.edu cc: codalist@coda.cs.cmu.edu cc: linux-fsdevel@vger.kernel.org --- include/linux/coda_psdev.h | 18 +++++++++++++++++- include/uapi/linux/coda_psdev.h | 18 ------------------ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 15170954aa2b..c61e70b97319 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h @@ -8,6 +8,23 @@ struct kstatfs; +/* messages between coda filesystem in kernel and Venus */ +struct upc_req { + struct list_head uc_chain; + caddr_t uc_data; + u_short uc_flags; + u_short uc_inSize; /* Size is at most 5000 bytes */ + u_short uc_outSize; + u_short uc_opcode; /* copied from data to save lookup */ + int uc_unique; + wait_queue_head_t uc_sleep; /* process' wait queue */ +}; + +#define CODA_REQ_ASYNC 0x1 +#define CODA_REQ_READ 0x2 +#define CODA_REQ_WRITE 0x4 +#define CODA_REQ_ABORT 0x8 + /* communication pending/processing queues */ struct venus_comm { u_long vc_seq; @@ -19,7 +36,6 @@ struct venus_comm { struct mutex vc_mutex; }; - static inline struct venus_comm *coda_vcp(struct super_block *sb) { return (struct venus_comm *)((sb)->s_fs_info); diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h index aa6623efd2dd..3dacb7fad66a 100644 --- a/include/uapi/linux/coda_psdev.h +++ b/include/uapi/linux/coda_psdev.h @@ -7,22 +7,4 @@ #define CODA_PSDEV_MAJOR 67 #define MAX_CODADEVS 5 /* how many do we allow */ - -/* messages between coda filesystem in kernel and Venus */ -struct upc_req { - struct list_head uc_chain; - caddr_t uc_data; - u_short uc_flags; - u_short uc_inSize; /* Size is at most 5000 bytes */ - u_short uc_outSize; - u_short uc_opcode; /* copied from data to save lookup */ - int uc_unique; - wait_queue_head_t uc_sleep; /* process' wait queue */ -}; - -#define CODA_REQ_ASYNC 0x1 -#define CODA_REQ_READ 0x2 -#define CODA_REQ_WRITE 0x4 -#define CODA_REQ_ABORT 0x8 - #endif /* _UAPI__CODA_PSDEV_H */ ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 06/11] coda: Move internal defs out of include/linux/ [ver #2] 2018-09-06 9:18 [RFC] UAPI: Check headers by compiling all together as C++ David Howells 2018-09-06 9:18 ` [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2] David Howells @ 2018-09-06 9:19 ` David Howells 2018-09-06 9:19 ` [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions " David Howells 2 siblings, 0 replies; 4+ messages in thread From: David Howells @ 2018-09-06 9:19 UTC (permalink / raw) To: linux-api, linux-kbuild Cc: Yann Droneaud, Jan Harkes, coda, codalist, linux-fsdevel, linux-kernel, dhowells Move include/linux/coda_psdev.h to fs/coda/ as there's nothing else that uses it. Signed-off-by: David Howells <dhowells@redhat.com> cc: Yann Droneaud <ydroneaud@opteya.com> cc: Jan Harkes <jaharkes@cs.cmu.edu> cc: coda@cs.cmu.edu cc: codalist@coda.cs.cmu.edu cc: linux-fsdevel@vger.kernel.org --- fs/coda/cache.c | 2 + fs/coda/cnode.c | 2 + fs/coda/coda_linux.c | 2 + fs/coda/coda_psdev.h | 88 ++++++++++++++++++++++++++++++++++++++++++++ fs/coda/dir.c | 2 + fs/coda/file.c | 3 +- fs/coda/inode.c | 2 + fs/coda/pioctl.c | 3 +- fs/coda/psdev.c | 3 +- fs/coda/symlink.c | 3 +- fs/coda/upcall.c | 2 + include/linux/coda_psdev.h | 88 -------------------------------------------- 12 files changed, 98 insertions(+), 102 deletions(-) create mode 100644 fs/coda/coda_psdev.h delete mode 100644 include/linux/coda_psdev.h diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 201fc08a8b4f..3b8c4513118f 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c @@ -21,7 +21,7 @@ #include <linux/spinlock.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> +#include "coda_psdev.h" #include "coda_linux.h" #include "coda_cache.h" diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 845b5a66952a..2e5badf67f98 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c @@ -8,8 +8,8 @@ #include <linux/time.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> #include <linux/pagemap.h> +#include "coda_psdev.h" #include "coda_linux.h" static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c index f3d543dd9a98..f7741e4f499a 100644 --- a/fs/coda/coda_linux.c +++ b/fs/coda/coda_linux.c @@ -18,7 +18,7 @@ #include <linux/string.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> +#include "coda_psdev.h" #include "coda_linux.h" /* initialize the debugging variables */ diff --git a/fs/coda/coda_psdev.h b/fs/coda/coda_psdev.h new file mode 100644 index 000000000000..e1abfb0fc9f9 --- /dev/null +++ b/fs/coda/coda_psdev.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __CODA_PSDEV_H +#define __CODA_PSDEV_H + +#include <linux/backing-dev.h> +#include <linux/mutex.h> +#include <linux/coda_psdev.h> + +struct kstatfs; + +/* messages between coda filesystem in kernel and Venus */ +struct upc_req { + struct list_head uc_chain; + caddr_t uc_data; + u_short uc_flags; + u_short uc_inSize; /* Size is at most 5000 bytes */ + u_short uc_outSize; + u_short uc_opcode; /* copied from data to save lookup */ + int uc_unique; + wait_queue_head_t uc_sleep; /* process' wait queue */ +}; + +#define CODA_REQ_ASYNC 0x1 +#define CODA_REQ_READ 0x2 +#define CODA_REQ_WRITE 0x4 +#define CODA_REQ_ABORT 0x8 + +/* communication pending/processing queues */ +struct venus_comm { + u_long vc_seq; + wait_queue_head_t vc_waitq; /* Venus wait queue */ + struct list_head vc_pending; + struct list_head vc_processing; + int vc_inuse; + struct super_block *vc_sb; + struct mutex vc_mutex; +}; + +static inline struct venus_comm *coda_vcp(struct super_block *sb) +{ + return (struct venus_comm *)((sb)->s_fs_info); +} + +/* upcalls */ +int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); +int venus_getattr(struct super_block *sb, struct CodaFid *fid, + struct coda_vattr *attr); +int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *); +int venus_lookup(struct super_block *sb, struct CodaFid *fid, + const char *name, int length, int *type, + struct CodaFid *resfid); +int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, + kuid_t uid); +int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, + struct file **f); +int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, + const char *name, int length, + struct CodaFid *newfid, struct coda_vattr *attrs); +int venus_create(struct super_block *sb, struct CodaFid *dirfid, + const char *name, int length, int excl, int mode, + struct CodaFid *newfid, struct coda_vattr *attrs) ; +int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, + const char *name, int length); +int venus_remove(struct super_block *sb, struct CodaFid *dirfid, + const char *name, int length); +int venus_readlink(struct super_block *sb, struct CodaFid *fid, + char *buffer, int *length); +int venus_rename(struct super_block *, struct CodaFid *new_fid, + struct CodaFid *old_fid, size_t old_length, + size_t new_length, const char *old_name, + const char *new_name); +int venus_link(struct super_block *sb, struct CodaFid *fid, + struct CodaFid *dirfid, const char *name, int len ); +int venus_symlink(struct super_block *sb, struct CodaFid *fid, + const char *name, int len, const char *symname, int symlen); +int venus_access(struct super_block *sb, struct CodaFid *fid, int mask); +int venus_pioctl(struct super_block *sb, struct CodaFid *fid, + unsigned int cmd, struct PioctlData *data); +int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out); +int venus_fsync(struct super_block *sb, struct CodaFid *fid); +int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); + +/* + * Statistics + */ + +extern struct venus_comm coda_comms[]; +#endif diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 00876ddadb43..b4bb34862899 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -23,7 +23,7 @@ #include <linux/uaccess.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> +#include "coda_psdev.h" #include "coda_linux.h" #include "coda_cache.h" diff --git a/fs/coda/file.c b/fs/coda/file.c index 1cbc1f2298ee..ef135b209e18 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -22,8 +22,7 @@ #include <linux/uaccess.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> - +#include "coda_psdev.h" #include "coda_linux.h" #include "coda_int.h" diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 97424cf206c0..4c512572f257 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -27,7 +27,7 @@ #include <linux/vmalloc.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> +#include "coda_psdev.h" #include "coda_linux.h" #include "coda_cache.h" diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index e0c17b7dccce..644d48c12ce8 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c @@ -20,8 +20,7 @@ #include <linux/uaccess.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> - +#include "coda_psdev.h" #include "coda_linux.h" /* pioctl ops */ diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index c5234c21b539..a13764e9bb79 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -43,8 +43,7 @@ #include <linux/uaccess.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> - +#include "coda_psdev.h" #include "coda_linux.h" #include "coda_int.h" diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index 202297d156df..8907d0508198 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c @@ -17,8 +17,7 @@ #include <linux/pagemap.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> - +#include "coda_psdev.h" #include "coda_linux.h" static int coda_symlink_filler(struct file *file, struct page *page) diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 1175a1722411..8babd2cc647a 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c @@ -33,7 +33,7 @@ #include <linux/vfs.h> #include <linux/coda.h> -#include <linux/coda_psdev.h> +#include "coda_psdev.h" #include "coda_linux.h" #include "coda_cache.h" diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h deleted file mode 100644 index c61e70b97319..000000000000 --- a/include/linux/coda_psdev.h +++ /dev/null @@ -1,88 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __CODA_PSDEV_H -#define __CODA_PSDEV_H - -#include <linux/backing-dev.h> -#include <linux/mutex.h> -#include <uapi/linux/coda_psdev.h> - -struct kstatfs; - -/* messages between coda filesystem in kernel and Venus */ -struct upc_req { - struct list_head uc_chain; - caddr_t uc_data; - u_short uc_flags; - u_short uc_inSize; /* Size is at most 5000 bytes */ - u_short uc_outSize; - u_short uc_opcode; /* copied from data to save lookup */ - int uc_unique; - wait_queue_head_t uc_sleep; /* process' wait queue */ -}; - -#define CODA_REQ_ASYNC 0x1 -#define CODA_REQ_READ 0x2 -#define CODA_REQ_WRITE 0x4 -#define CODA_REQ_ABORT 0x8 - -/* communication pending/processing queues */ -struct venus_comm { - u_long vc_seq; - wait_queue_head_t vc_waitq; /* Venus wait queue */ - struct list_head vc_pending; - struct list_head vc_processing; - int vc_inuse; - struct super_block *vc_sb; - struct mutex vc_mutex; -}; - -static inline struct venus_comm *coda_vcp(struct super_block *sb) -{ - return (struct venus_comm *)((sb)->s_fs_info); -} - -/* upcalls */ -int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); -int venus_getattr(struct super_block *sb, struct CodaFid *fid, - struct coda_vattr *attr); -int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *); -int venus_lookup(struct super_block *sb, struct CodaFid *fid, - const char *name, int length, int *type, - struct CodaFid *resfid); -int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, - kuid_t uid); -int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, - struct file **f); -int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, - const char *name, int length, - struct CodaFid *newfid, struct coda_vattr *attrs); -int venus_create(struct super_block *sb, struct CodaFid *dirfid, - const char *name, int length, int excl, int mode, - struct CodaFid *newfid, struct coda_vattr *attrs) ; -int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, - const char *name, int length); -int venus_remove(struct super_block *sb, struct CodaFid *dirfid, - const char *name, int length); -int venus_readlink(struct super_block *sb, struct CodaFid *fid, - char *buffer, int *length); -int venus_rename(struct super_block *, struct CodaFid *new_fid, - struct CodaFid *old_fid, size_t old_length, - size_t new_length, const char *old_name, - const char *new_name); -int venus_link(struct super_block *sb, struct CodaFid *fid, - struct CodaFid *dirfid, const char *name, int len ); -int venus_symlink(struct super_block *sb, struct CodaFid *fid, - const char *name, int len, const char *symname, int symlen); -int venus_access(struct super_block *sb, struct CodaFid *fid, int mask); -int venus_pioctl(struct super_block *sb, struct CodaFid *fid, - unsigned int cmd, struct PioctlData *data); -int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out); -int venus_fsync(struct super_block *sb, struct CodaFid *fid); -int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); - -/* - * Statistics - */ - -extern struct venus_comm coda_comms[]; -#endif ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions [ver #2] 2018-09-06 9:18 [RFC] UAPI: Check headers by compiling all together as C++ David Howells 2018-09-06 9:18 ` [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2] David Howells 2018-09-06 9:19 ` [PATCH 06/11] coda: Move internal defs out of include/linux/ " David Howells @ 2018-09-06 9:19 ` David Howells 2 siblings, 0 replies; 4+ messages in thread From: David Howells @ 2018-09-06 9:19 UTC (permalink / raw) To: linux-api, linux-kbuild Cc: Ryusuke Konishi, linux-nilfs, linux-fsdevel, linux-kernel, dhowells nilfs2 exports a load of inline functions to userspace that call kernel byteswapping functions that don't exist in UAPI. Fix this by making it #include asm/byteorder.h and use the functions declared there. A better way is probably to remove these inline functions from the nilfs2 header since they are technically broken. Signed-off-by: David Howells <dhowells@redhat.com> cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> cc: linux-nilfs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- include/uapi/linux/nilfs2_ondisk.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h index a7e66ab11d1d..47f8f596ff1c 100644 --- a/include/uapi/linux/nilfs2_ondisk.h +++ b/include/uapi/linux/nilfs2_ondisk.h @@ -29,6 +29,7 @@ #include <linux/types.h> #include <linux/magic.h> +#include <asm/byteorder.h> #define NILFS_INODE_BMAP_SIZE 7 @@ -533,20 +534,17 @@ enum { static inline void \ nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ { \ - cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ - (1UL << NILFS_CHECKPOINT_##flag)); \ + cp->cp_flags |= __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag); \ } \ static inline void \ nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ { \ - cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ - ~(1UL << NILFS_CHECKPOINT_##flag)); \ + cp->cp_flags &= __cpu_to_le32(~(1UL << NILFS_CHECKPOINT_##flag)); \ } \ static inline int \ nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ { \ - return !!(le32_to_cpu(cp->cp_flags) & \ - (1UL << NILFS_CHECKPOINT_##flag)); \ + return !!(cp->cp_flags & __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag)); \ } NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot) @@ -595,21 +593,17 @@ enum { static inline void \ nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ { \ - su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ - (1UL << NILFS_SEGMENT_USAGE_##flag));\ + su->su_flags |= __cpu_to_le32(1UL << NILFS_SEGMENT_USAGE_##flag); \ } \ static inline void \ nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ { \ - su->su_flags = \ - cpu_to_le32(le32_to_cpu(su->su_flags) & \ - ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ + su->su_flags &= __cpu_to_le32(~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ } \ static inline int \ nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ { \ - return !!(le32_to_cpu(su->su_flags) & \ - (1UL << NILFS_SEGMENT_USAGE_##flag)); \ + return !!(su->su_flags & __cpu_to_le32(1UL << NILFS_SEGMENT_USAGE_##flag)); \ } NILFS_SEGMENT_USAGE_FNS(ACTIVE, active) @@ -619,15 +613,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error) static inline void nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) { - su->su_lastmod = cpu_to_le64(0); - su->su_nblocks = cpu_to_le32(0); - su->su_flags = cpu_to_le32(0); + su->su_lastmod = __cpu_to_le64(0); + su->su_nblocks = __cpu_to_le32(0); + su->su_flags = __cpu_to_le32(0); } static inline int nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) { - return !le32_to_cpu(su->su_flags); + return !su->su_flags; } /** ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-06 13:53 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-09-06 9:18 [RFC] UAPI: Check headers by compiling all together as C++ David Howells 2018-09-06 9:18 ` [PATCH 05/11] UAPI: coda: Move kernel internals out of public view [ver #2] David Howells 2018-09-06 9:19 ` [PATCH 06/11] coda: Move internal defs out of include/linux/ " David Howells 2018-09-06 9:19 ` [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions " David Howells
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).