Commit d9077f7b authored by Jeff Layton's avatar Jeff Layton Committed by Christian Brauner

filelock: make assign_type helper take a file_lock_core pointer

Have assign_type take struct file_lock_core instead of file_lock.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20240131-flsplit-v3-29-c6129007ee8d@kernel.orgReviewed-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 269a6194
...@@ -439,13 +439,13 @@ static void flock_make_lock(struct file *filp, struct file_lock *fl, int type) ...@@ -439,13 +439,13 @@ static void flock_make_lock(struct file *filp, struct file_lock *fl, int type)
fl->fl_end = OFFSET_MAX; fl->fl_end = OFFSET_MAX;
} }
static int assign_type(struct file_lock *fl, int type) static int assign_type(struct file_lock_core *flc, int type)
{ {
switch (type) { switch (type) {
case F_RDLCK: case F_RDLCK:
case F_WRLCK: case F_WRLCK:
case F_UNLCK: case F_UNLCK:
fl->c.flc_type = type; flc->flc_type = type;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -497,7 +497,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, ...@@ -497,7 +497,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
fl->fl_ops = NULL; fl->fl_ops = NULL;
fl->fl_lmops = NULL; fl->fl_lmops = NULL;
return assign_type(fl, l->l_type); return assign_type(&fl->c, l->l_type);
} }
/* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX
...@@ -552,7 +552,7 @@ static const struct lock_manager_operations lease_manager_ops = { ...@@ -552,7 +552,7 @@ static const struct lock_manager_operations lease_manager_ops = {
*/ */
static int lease_init(struct file *filp, int type, struct file_lock *fl) static int lease_init(struct file *filp, int type, struct file_lock *fl)
{ {
if (assign_type(fl, type) != 0) if (assign_type(&fl->c, type) != 0)
return -EINVAL; return -EINVAL;
fl->c.flc_owner = filp; fl->c.flc_owner = filp;
...@@ -1409,7 +1409,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg) ...@@ -1409,7 +1409,7 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
/* We already had a lease on this file; just change its type */ /* We already had a lease on this file; just change its type */
int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose) int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose)
{ {
int error = assign_type(fl, arg); int error = assign_type(&fl->c, arg);
if (error) if (error)
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment