Skip to content

Commit 51db776

Browse files
author
Miklos Szeredi
committed
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>
1 parent 8871d84 commit 51db776

2 files changed

Lines changed: 0 additions & 99 deletions

File tree

fs/inode.c

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/security.h>
1313
#include <linux/cdev.h>
1414
#include <linux/memblock.h>
15-
#include <linux/fscrypt.h>
1615
#include <linux/fsnotify.h>
1716
#include <linux/mount.h>
1817
#include <linux/posix_acl.h>
@@ -2314,89 +2313,3 @@ struct timespec64 current_time(struct inode *inode)
23142313
return timestamp_truncate(now, inode);
23152314
}
23162315
EXPORT_SYMBOL(current_time);
2317-
2318-
/*
2319-
* Generic function to check FS_IOC_SETFLAGS values and reject any invalid
2320-
* configurations.
2321-
*
2322-
* Note: the caller should be holding i_mutex, or else be sure that they have
2323-
* exclusive access to the inode structure.
2324-
*/
2325-
int vfs_ioc_setflags_prepare(struct inode *inode, unsigned int oldflags,
2326-
unsigned int flags)
2327-
{
2328-
/*
2329-
* The IMMUTABLE and APPEND_ONLY flags can only be changed by
2330-
* the relevant capability.
2331-
*
2332-
* This test looks nicer. Thanks to Pauline Middelink
2333-
*/
2334-
if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL) &&
2335-
!capable(CAP_LINUX_IMMUTABLE))
2336-
return -EPERM;
2337-
2338-
return fscrypt_prepare_setflags(inode, oldflags, flags);
2339-
}
2340-
EXPORT_SYMBOL(vfs_ioc_setflags_prepare);
2341-
2342-
/*
2343-
* Generic function to check FS_IOC_FSSETXATTR values and reject any invalid
2344-
* configurations.
2345-
*
2346-
* Note: the caller should be holding i_mutex, or else be sure that they have
2347-
* exclusive access to the inode structure.
2348-
*/
2349-
int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa,
2350-
struct fsxattr *fa)
2351-
{
2352-
/*
2353-
* Can't modify an immutable/append-only file unless we have
2354-
* appropriate permission.
2355-
*/
2356-
if ((old_fa->fsx_xflags ^ fa->fsx_xflags) &
2357-
(FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND) &&
2358-
!capable(CAP_LINUX_IMMUTABLE))
2359-
return -EPERM;
2360-
2361-
/*
2362-
* Project Quota ID state is only allowed to change from within the init
2363-
* namespace. Enforce that restriction only if we are trying to change
2364-
* the quota ID state. Everything else is allowed in user namespaces.
2365-
*/
2366-
if (current_user_ns() != &init_user_ns) {
2367-
if (old_fa->fsx_projid != fa->fsx_projid)
2368-
return -EINVAL;
2369-
if ((old_fa->fsx_xflags ^ fa->fsx_xflags) &
2370-
FS_XFLAG_PROJINHERIT)
2371-
return -EINVAL;
2372-
}
2373-
2374-
/* Check extent size hints. */
2375-
if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(inode->i_mode))
2376-
return -EINVAL;
2377-
2378-
if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) &&
2379-
!S_ISDIR(inode->i_mode))
2380-
return -EINVAL;
2381-
2382-
if ((fa->fsx_xflags & FS_XFLAG_COWEXTSIZE) &&
2383-
!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
2384-
return -EINVAL;
2385-
2386-
/*
2387-
* It is only valid to set the DAX flag on regular files and
2388-
* directories on filesystems.
2389-
*/
2390-
if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
2391-
!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
2392-
return -EINVAL;
2393-
2394-
/* Extent size hints of zero turn off the flags. */
2395-
if (fa->fsx_extsize == 0)
2396-
fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT);
2397-
if (fa->fsx_cowextsize == 0)
2398-
fa->fsx_xflags &= ~FS_XFLAG_COWEXTSIZE;
2399-
2400-
return 0;
2401-
}
2402-
EXPORT_SYMBOL(vfs_ioc_fssetxattr_check);

include/linux/fs.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,18 +3571,6 @@ extern int vfs_fadvise(struct file *file, loff_t offset, loff_t len,
35713571
extern int generic_fadvise(struct file *file, loff_t offset, loff_t len,
35723572
int advice);
35733573

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-
35863574
/*
35873575
* Flush file data before changing attributes. Caller must hold any locks
35883576
* required to prevent further writes to this file until we're done setting

0 commit comments

Comments
 (0)