aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-01-20 05:29:45 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-27 14:43:58 -0400
commitc2aca5e529a2499d454c41e01f59f1d5fe4a1364 (patch)
tree80515a22164ab4722ccac3026e65dfa186b0707e /include/linux/fs.h
parent10f303ae1e5e77a9f7cb053e6329906afb132c67 (diff)
vfs: Update fs.h to use inline functions when no file locking set
This avoids various issues which might give rise to compiler warnings about missing functions and/or unused variable with the previous macros. This also fixes a bug where one of the macros was returning 0, but it should have been void. Reported-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Tested-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h165
1 files changed, 139 insertions, 26 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 51de83bd8a87..d84020b7e676 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1063,34 +1063,147 @@ extern int lease_modify(struct file_lock **, int);
1063extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1063extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1064extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1064extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1065#else /* !CONFIG_FILE_LOCKING */ 1065#else /* !CONFIG_FILE_LOCKING */
1066#define fcntl_getlk(a, b) ({ -EINVAL; }) 1066static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1067#define fcntl_setlk(a, b, c, d) ({ -EACCES; }) 1067{
1068 return -EINVAL;
1069}
1070
1071static inline int fcntl_setlk(unsigned int fd, struct file *file,
1072 unsigned int cmd, struct flock __user *user)
1073{
1074 return -EACCES;
1075}
1076
1068#if BITS_PER_LONG == 32 1077#if BITS_PER_LONG == 32
1069#define fcntl_getlk64(a, b) ({ -EINVAL; }) 1078static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user)
1070#define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) 1079{
1080 return -EINVAL;
1081}
1082
1083static inline int fcntl_setlk64(unsigned int fd, struct file *file,
1084 unsigned int cmd, struct flock64 __user *user)
1085{
1086 return -EACCES;
1087}
1071#endif 1088#endif
1072#define fcntl_setlease(a, b, c) ({ 0; }) 1089static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1073#define fcntl_getlease(a) ({ 0; }) 1090{
1074#define locks_init_lock(a) ({ }) 1091 return 0;
1075#define __locks_copy_lock(a, b) ({ }) 1092}
1076#define locks_copy_lock(a, b) ({ }) 1093
1077#define locks_remove_posix(a, b) ({ }) 1094static inline int fcntl_getlease(struct file *filp)
1078#define locks_remove_flock(a) ({ }) 1095{
1079#define posix_test_lock(a, b) ({ 0; }) 1096 return 0;
1080#define posix_lock_file(a, b, c) ({ -ENOLCK; }) 1097}
1081#define posix_lock_file_wait(a, b) ({ -ENOLCK; }) 1098
1082#define posix_unblock_lock(a, b) (-ENOENT) 1099static inline void locks_init_lock(struct file_lock *fl)
1083#define vfs_test_lock(a, b) ({ 0; }) 1100{
1084#define vfs_lock_file(a, b, c, d) (-ENOLCK) 1101 return;
1085#define vfs_cancel_lock(a, b) ({ 0; }) 1102}
1086#define flock_lock_file_wait(a, b) ({ -ENOLCK; }) 1103
1087#define __break_lease(a, b) ({ 0; }) 1104static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl)
1088#define lease_get_mtime(a, b) ({ }) 1105{
1089#define generic_setlease(a, b, c) ({ -EINVAL; }) 1106 return;
1090#define vfs_setlease(a, b, c) ({ -EINVAL; }) 1107}
1091#define lease_modify(a, b) ({ -EINVAL; }) 1108
1092#define lock_may_read(a, b, c) ({ 1; }) 1109static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl)
1093#define lock_may_write(a, b, c) ({ 1; }) 1110{
1111 return;
1112}
1113
1114static inline void locks_remove_posix(struct file *filp, fl_owner_t owner)
1115{
1116 return;
1117}
1118
1119static inline void locks_remove_flock(struct file *filp)
1120{
1121 return;
1122}
1123
1124static inline void posix_test_lock(struct file *filp, struct file_lock *fl)
1125{
1126 return;
1127}
1128
1129static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
1130 struct file_lock *conflock)
1131{
1132 return -ENOLCK;
1133}
1134
1135static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1136{
1137 return -ENOLCK;
1138}
1139
1140static inline int posix_unblock_lock(struct file *filp,
1141 struct file_lock *waiter)
1142{
1143 return -ENOENT;
1144}
1145
1146static inline int vfs_test_lock(struct file *filp, struct file_lock *fl)
1147{
1148 return 0;
1149}
1150
1151static inline int vfs_lock_file(struct file *filp, unsigned int cmd,
1152 struct file_lock *fl, struct file_lock *conf)
1153{
1154 return -ENOLCK;
1155}
1156
1157static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
1158{
1159 return 0;
1160}
1161
1162static inline int flock_lock_file_wait(struct file *filp,
1163 struct file_lock *request)
1164{
1165 return -ENOLCK;
1166}
1167
1168static inline int __break_lease(struct inode *inode, unsigned int mode)
1169{
1170 return 0;
1171}
1172
1173static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1174{
1175 return;
1176}
1177
1178static inline int generic_setlease(struct file *filp, long arg,
1179 struct file_lock **flp)
1180{
1181 return -EINVAL;
1182}
1183
1184static inline int vfs_setlease(struct file *filp, long arg,
1185 struct file_lock **lease)
1186{
1187 return -EINVAL;
1188}
1189
1190static inline int lease_modify(struct file_lock **before, int arg)
1191{
1192 return -EINVAL;
1193}
1194
1195static inline int lock_may_read(struct inode *inode, loff_t start,
1196 unsigned long len)
1197{
1198 return 1;
1199}
1200
1201static inline int lock_may_write(struct inode *inode, loff_t start,
1202 unsigned long len)
1203{
1204 return 1;
1205}
1206
1094#endif /* !CONFIG_FILE_LOCKING */ 1207#endif /* !CONFIG_FILE_LOCKING */
1095 1208
1096 1209