Skip to content

Commit da9aa5d

Browse files
Christoph HellwigAl Viro
authored andcommitted
fs: remove vfs_statx_fd
vfs_statx_fd is only used to implement vfs_fstat. Remove vfs_statx_fd and just implement vfs_fstat directly. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent a7c9df0 commit da9aa5d

2 files changed

Lines changed: 8 additions & 21 deletions

File tree

fs/stat.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,35 +126,27 @@ int vfs_getattr(const struct path *path, struct kstat *stat,
126126
EXPORT_SYMBOL(vfs_getattr);
127127

128128
/**
129-
* vfs_statx_fd - Get the enhanced basic attributes by file descriptor
129+
* vfs_fstat - Get the basic attributes by file descriptor
130130
* @fd: The file descriptor referring to the file of interest
131131
* @stat: The result structure to fill in.
132-
* @request_mask: STATX_xxx flags indicating what the caller wants
133-
* @query_flags: Query mode (KSTAT_QUERY_FLAGS)
134132
*
135133
* This function is a wrapper around vfs_getattr(). The main difference is
136134
* that it uses a file descriptor to determine the file location.
137135
*
138136
* 0 will be returned on success, and a -ve error code if unsuccessful.
139137
*/
140-
int vfs_statx_fd(unsigned int fd, struct kstat *stat,
141-
u32 request_mask, unsigned int query_flags)
138+
int vfs_fstat(int fd, struct kstat *stat)
142139
{
143140
struct fd f;
144-
int error = -EBADF;
145-
146-
if (query_flags & ~KSTAT_QUERY_FLAGS)
147-
return -EINVAL;
141+
int error;
148142

149143
f = fdget_raw(fd);
150-
if (f.file) {
151-
error = vfs_getattr(&f.file->f_path, stat,
152-
request_mask, query_flags);
153-
fdput(f);
154-
}
144+
if (!f.file)
145+
return -EBADF;
146+
error = vfs_getattr(&f.file->f_path, stat, STATX_BASIC_STATS, 0);
147+
fdput(f);
155148
return error;
156149
}
157-
EXPORT_SYMBOL(vfs_statx_fd);
158150

159151
static inline unsigned vfs_stat_set_lookup_flags(unsigned *lookup_flags,
160152
int flags)

include/linux/fs.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,7 +3163,7 @@ extern const struct inode_operations simple_symlink_inode_operations;
31633163
extern int iterate_dir(struct file *, struct dir_context *);
31643164

31653165
extern int vfs_statx(int, const char __user *, int, struct kstat *, u32);
3166-
extern int vfs_statx_fd(unsigned int, struct kstat *, u32, unsigned int);
3166+
int vfs_fstat(int fd, struct kstat *stat);
31673167

31683168
static inline int vfs_stat(const char __user *filename, struct kstat *stat)
31693169
{
@@ -3181,11 +3181,6 @@ static inline int vfs_fstatat(int dfd, const char __user *filename,
31813181
return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
31823182
stat, STATX_BASIC_STATS);
31833183
}
3184-
static inline int vfs_fstat(int fd, struct kstat *stat)
3185-
{
3186-
return vfs_statx_fd(fd, stat, STATX_BASIC_STATS, 0);
3187-
}
3188-
31893184

31903185
extern const char *vfs_get_link(struct dentry *, struct delayed_call *);
31913186
extern int vfs_readlink(struct dentry *, char __user *, int);

0 commit comments

Comments
 (0)