Skip to content

Commit

Permalink
for aufs: new f_op->setfl() to support fcntl(F_SETFL)
Browse files Browse the repository at this point in the history
In order to customize fcntl(F_SETFL) in filesystem, make the function
./fs/fcntl.c:setfl() a global generic VFS function as vfs_* file I/O
functions, and add ->setfl() into struct file_operations.

Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
  • Loading branch information
sfjro committed Feb 28, 2016
1 parent 8d5cd0e commit 565ce4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/fcntl.c
Expand Up @@ -29,7 +29,7 @@

#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)

static int setfl(int fd, struct file * filp, unsigned long arg)
int setfl(int fd, struct file * filp, unsigned long arg)
{
struct inode * inode = file_inode(filp);
int error = 0;
Expand Down Expand Up @@ -59,6 +59,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)

if (filp->f_op->check_flags)
error = filp->f_op->check_flags(arg);
if (!error && filp->f_op->setfl)
error = filp->f_op->setfl(filp, arg);
if (error)
return error;

Expand Down
2 changes: 2 additions & 0 deletions include/linux/fs.h
Expand Up @@ -1149,6 +1149,7 @@ extern void fasync_free(struct fasync_struct *);
/* can be called from interrupts */
extern void kill_fasync(struct fasync_struct **, int, int);

extern int setfl(int fd, struct file * filp, unsigned long arg);
extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
extern void f_setown(struct file *filp, unsigned long arg, int force);
extern void f_delown(struct file *filp);
Expand Down Expand Up @@ -1507,6 +1508,7 @@ struct file_operations {
ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
int (*check_flags)(int);
int (*setfl)(struct file *, unsigned long);
int (*flock) (struct file *, int, struct file_lock *);
ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
Expand Down

0 comments on commit 565ce4a

Please sign in to comment.