From 839758496322072a0a2334abdcccf074068ccdf9 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 18 Jun 2014 00:49:42 -0600 Subject: [PATCH] LU-2675 libcfs: remove unused open flag conversions Remove the unused cfs_oflag2univ() and cfs_univ2oflag() conversion routines. These were intended to convert O_* open flags to and from platform-specific flags at the user interface, but are not used anywhere in the code. The conversion of the client-specific open flags to the Lustre protocol flags is done in mds_pack_open_flags() and there is no need to ever convert back to client-specific flags. Signed-off-by: Andreas Dilger Change-Id: I1f5f7fb7eefa2f8dff161f02b37bee6a9d500c1e Reviewed-on: http://review.whamcloud.com/10742 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/libcfs.h | 29 ------------------------- libcfs/libcfs/darwin/darwin-fs.c | 28 ------------------------ libcfs/libcfs/linux/linux-fs.c | 46 ---------------------------------------- lustre/mdc/mdc_lib.c | 2 +- 4 files changed, 1 insertion(+), 104 deletions(-) diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index 19a7257..321712e 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -229,35 +229,6 @@ void cfs_stack_trace_fill(struct cfs_stack_trace *trace); */ void *cfs_stack_trace_frame(struct cfs_stack_trace *trace, int frame_no); -#ifndef O_NOACCESS -#define O_NOACCESS O_NONBLOCK -#endif - -/* - * Universal open flags. - */ -#define CFS_O_NOACCESS 0003 -#define CFS_O_ACCMODE CFS_O_NOACCESS -#define CFS_O_CREAT 0100 -#define CFS_O_EXCL 0200 -#define CFS_O_NOCTTY 0400 -#define CFS_O_TRUNC 01000 -#define CFS_O_APPEND 02000 -#define CFS_O_NONBLOCK 04000 -#define CFS_O_NDELAY CFS_O_NONBLOCK -#define CFS_O_SYNC 010000 -#define CFS_O_ASYNC 020000 -#define CFS_O_DIRECT 040000 -#define CFS_O_LARGEFILE 0100000 -#define CFS_O_DIRECTORY 0200000 -#define CFS_O_NOFOLLOW 0400000 -#define CFS_O_NOATIME 01000000 - -/* convert local open flags to universal open flags */ -int cfs_oflags2univ(int flags); -/* convert universal open flags to local open flags */ -int cfs_univ2oflags(int flags); - /* * Random number handling */ diff --git a/libcfs/libcfs/darwin/darwin-fs.c b/libcfs/libcfs/darwin/darwin-fs.c index 88b9b1e..09b103b 100644 --- a/libcfs/libcfs/darwin/darwin-fs.c +++ b/libcfs/libcfs/darwin/darwin-fs.c @@ -431,31 +431,3 @@ struct posix_acl *posix_acl_alloc(int count, int flags) static struct posix_acl acl; return &acl; } - -/* - * XXX Liang: I've not converted all of them, - * more is needed? - */ -int cfs_oflags2univ(int flags) -{ - int f; - - f = flags & O_NOACCESS; - f |= (flags & O_CREAT) ? CFS_O_CREAT: 0; - f |= (flags & O_TRUNC) ? CFS_O_TRUNC: 0; - f |= (flags & O_EXCL) ? CFS_O_EXCL: 0; - f |= (flags & O_NONBLOCK) ? CFS_O_NONBLOCK: 0; - f |= (flags & O_APPEND) ? CFS_O_APPEND: 0; - f |= (flags & O_NOFOLLOW) ? CFS_O_NOFOLLOW: 0; - f |= (flags & O_SYNC)? CFS_O_SYNC: 0; - return f; -} - -/* - * XXX Liang: we don't need it in OSX. - * But it should be implemented anyway. - */ -int cfs_univ2oflags(int flags) -{ - return flags; -} diff --git a/libcfs/libcfs/linux/linux-fs.c b/libcfs/libcfs/linux/linux-fs.c index 21fa32c..a456b65 100644 --- a/libcfs/libcfs/linux/linux-fs.c +++ b/libcfs/libcfs/linux/linux-fs.c @@ -65,49 +65,3 @@ filp_user_write(struct file *filp, const void *buf, size_t count, return size; } EXPORT_SYMBOL(filp_user_write); - -#if !(CFS_O_CREAT == O_CREAT && CFS_O_EXCL == O_EXCL && \ - CFS_O_NOACCESS == O_NOACCESS &&\ - CFS_O_TRUNC == O_TRUNC && CFS_O_APPEND == O_APPEND &&\ - CFS_O_NONBLOCK == O_NONBLOCK && CFS_O_NDELAY == O_NDELAY &&\ - CFS_O_SYNC == O_SYNC && CFS_O_ASYNC == FASYNC &&\ - CFS_O_DIRECT == O_DIRECT && CFS_O_LARGEFILE == O_LARGEFILE &&\ - CFS_O_DIRECTORY == O_DIRECTORY && CFS_O_NOFOLLOW == O_NOFOLLOW) - -int cfs_oflags2univ(int flags) -{ - int f; - - f = flags & O_NOACCESS; - f |= (flags & O_CREAT) ? CFS_O_CREAT: 0; - f |= (flags & O_EXCL) ? CFS_O_EXCL: 0; - f |= (flags & O_NOCTTY) ? CFS_O_NOCTTY: 0; - f |= (flags & O_TRUNC) ? CFS_O_TRUNC: 0; - f |= (flags & O_APPEND) ? CFS_O_APPEND: 0; - f |= (flags & O_NONBLOCK) ? CFS_O_NONBLOCK: 0; - f |= (flags & O_SYNC)? CFS_O_SYNC: 0; - f |= (flags & FASYNC)? CFS_O_ASYNC: 0; - f |= (flags & O_DIRECTORY)? CFS_O_DIRECTORY: 0; - f |= (flags & O_DIRECT)? CFS_O_DIRECT: 0; - f |= (flags & O_LARGEFILE)? CFS_O_LARGEFILE: 0; - f |= (flags & O_NOFOLLOW)? CFS_O_NOFOLLOW: 0; - f |= (flags & O_NOATIME)? CFS_O_NOATIME: 0; - return f; -} -#else - -int cfs_oflags2univ(int flags) -{ - return (flags); -} -#endif -EXPORT_SYMBOL(cfs_oflags2univ); - -/* - * XXX Liang: we don't need cfs_univ2oflags() now. - */ -int cfs_univ2oflags(int flags) -{ - return (flags); -} -EXPORT_SYMBOL(cfs_univ2oflags); diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index b3a2769..490204b 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -227,7 +227,7 @@ static __u64 mds_pack_open_flags(__u64 flags, __u32 mode) if (cl_is_lov_delay_create(flags)) cr_flags |= MDS_OPEN_DELAY_CREATE; - if ((flags & O_NOACCESS) || (flags & O_NONBLOCK)) + if (flags & O_NONBLOCK) cr_flags |= MDS_OPEN_NORESTORE; return cr_flags; -- 1.8.3.1