mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
fs: add a vfs_fchmod helper
[ Upstream commit9e96c8c0e9
] Add a helper for struct file based chmode operations. To be used by the initramfs code soon. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Stable-dep-of:4624b346cf
("init: open /initrd.image with O_LARGEFILE") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8eba8d1145
commit
13b2d81505
2 changed files with 8 additions and 2 deletions
|
@ -570,14 +570,19 @@ static int chmod_common(const struct path *path, umode_t mode)
|
|||
return error;
|
||||
}
|
||||
|
||||
int vfs_fchmod(struct file *file, umode_t mode)
|
||||
{
|
||||
audit_file(file);
|
||||
return chmod_common(&file->f_path, mode);
|
||||
}
|
||||
|
||||
int ksys_fchmod(unsigned int fd, umode_t mode)
|
||||
{
|
||||
struct fd f = fdget(fd);
|
||||
int err = -EBADF;
|
||||
|
||||
if (f.file) {
|
||||
audit_file(f.file);
|
||||
err = chmod_common(&f.file->f_path, mode);
|
||||
err = vfs_fchmod(f.file, mode);
|
||||
fdput(f);
|
||||
}
|
||||
return err;
|
||||
|
|
|
@ -1731,6 +1731,7 @@ int vfs_mkobj(struct dentry *, umode_t,
|
|||
void *);
|
||||
|
||||
int vfs_fchown(struct file *file, uid_t user, gid_t group);
|
||||
int vfs_fchmod(struct file *file, umode_t mode);
|
||||
|
||||
extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
|
||||
|
||||
|
|
Loading…
Reference in a new issue