Commit 9e96c8c0 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

fs: add a vfs_fchmod helper



Add a helper for struct file based chmode operations.  To be used by
the initramfs code soon.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c04011fe
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -602,14 +602,19 @@ out_unlock:
	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;
+1 −0
Original line number Diff line number Diff line
@@ -1745,6 +1745,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);