Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfs: remove unused ioctl helpers

Remove vfs_ioc_setflags_prepare(), vfs_ioc_fssetxattr_check() and
simple_fill_fsxattr(), which are no longer used.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

-99
-87
fs/inode.c
··· 12 12 #include <linux/security.h> 13 13 #include <linux/cdev.h> 14 14 #include <linux/memblock.h> 15 - #include <linux/fscrypt.h> 16 15 #include <linux/fsnotify.h> 17 16 #include <linux/mount.h> 18 17 #include <linux/posix_acl.h> ··· 2313 2314 return timestamp_truncate(now, inode); 2314 2315 } 2315 2316 EXPORT_SYMBOL(current_time); 2316 - 2317 - /* 2318 - * Generic function to check FS_IOC_SETFLAGS values and reject any invalid 2319 - * configurations. 2320 - * 2321 - * Note: the caller should be holding i_mutex, or else be sure that they have 2322 - * exclusive access to the inode structure. 2323 - */ 2324 - int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, 2325 - unsigned int flags) 2326 - { 2327 - /* 2328 - * The IMMUTABLE and APPEND_ONLY flags can only be changed by 2329 - * the relevant capability. 2330 - * 2331 - * This test looks nicer. Thanks to Pauline Middelink 2332 - */ 2333 - if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL) && 2334 - !capable(CAP_LINUX_IMMUTABLE)) 2335 - return -EPERM; 2336 - 2337 - return fscrypt_prepare_setflags(inode, oldflags, flags); 2338 - } 2339 - EXPORT_SYMBOL(vfs_ioc_setflags_prepare); 2340 - 2341 - /* 2342 - * Generic function to check FS_IOC_FSSETXATTR values and reject any invalid 2343 - * configurations. 2344 - * 2345 - * Note: the caller should be holding i_mutex, or else be sure that they have 2346 - * exclusive access to the inode structure. 2347 - */ 2348 - int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, 2349 - struct fsxattr *fa) 2350 - { 2351 - /* 2352 - * Can't modify an immutable/append-only file unless we have 2353 - * appropriate permission. 2354 - */ 2355 - if ((old_fa->fsx_xflags ^ fa->fsx_xflags) & 2356 - (FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND) && 2357 - !capable(CAP_LINUX_IMMUTABLE)) 2358 - return -EPERM; 2359 - 2360 - /* 2361 - * Project Quota ID state is only allowed to change from within the init 2362 - * namespace. Enforce that restriction only if we are trying to change 2363 - * the quota ID state. Everything else is allowed in user namespaces. 2364 - */ 2365 - if (current_user_ns() != &init_user_ns) { 2366 - if (old_fa->fsx_projid != fa->fsx_projid) 2367 - return -EINVAL; 2368 - if ((old_fa->fsx_xflags ^ fa->fsx_xflags) & 2369 - FS_XFLAG_PROJINHERIT) 2370 - return -EINVAL; 2371 - } 2372 - 2373 - /* Check extent size hints. */ 2374 - if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(inode->i_mode)) 2375 - return -EINVAL; 2376 - 2377 - if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) && 2378 - !S_ISDIR(inode->i_mode)) 2379 - return -EINVAL; 2380 - 2381 - if ((fa->fsx_xflags & FS_XFLAG_COWEXTSIZE) && 2382 - !S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) 2383 - return -EINVAL; 2384 - 2385 - /* 2386 - * It is only valid to set the DAX flag on regular files and 2387 - * directories on filesystems. 2388 - */ 2389 - if ((fa->fsx_xflags & FS_XFLAG_DAX) && 2390 - !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) 2391 - return -EINVAL; 2392 - 2393 - /* Extent size hints of zero turn off the flags. */ 2394 - if (fa->fsx_extsize == 0) 2395 - fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT); 2396 - if (fa->fsx_cowextsize == 0) 2397 - fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; 2398 - 2399 - return 0; 2400 - } 2401 - EXPORT_SYMBOL(vfs_ioc_fssetxattr_check);
-12
include/linux/fs.h
··· 3571 3571 extern int generic_fadvise(struct file *file, loff_t offset, loff_t len, 3572 3572 int advice); 3573 3573 3574 - int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags, 3575 - unsigned int flags); 3576 - 3577 - int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa, 3578 - struct fsxattr *fa); 3579 - 3580 - static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags) 3581 - { 3582 - memset(fa, 0, sizeof(*fa)); 3583 - fa->fsx_xflags = xflags; 3584 - } 3585 - 3586 3574 /* 3587 3575 * Flush file data before changing attributes. Caller must hold any locks 3588 3576 * required to prevent further writes to this file until we're done setting