Loading fs/9p/vfs_file.c +27 −7 Original line number Original line Diff line number Diff line Loading @@ -169,7 +169,18 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) /* convert posix lock to p9 tlock args */ /* convert posix lock to p9 tlock args */ memset(&flock, 0, sizeof(flock)); memset(&flock, 0, sizeof(flock)); flock.type = fl->fl_type; /* map the lock type */ switch (fl->fl_type) { case F_RDLCK: flock.type = P9_LOCK_TYPE_RDLCK; break; case F_WRLCK: flock.type = P9_LOCK_TYPE_WRLCK; break; case F_UNLCK: flock.type = P9_LOCK_TYPE_UNLCK; break; } flock.start = fl->fl_start; flock.start = fl->fl_start; if (fl->fl_end == OFFSET_MAX) if (fl->fl_end == OFFSET_MAX) flock.length = 0; flock.length = 0; Loading Loading @@ -245,7 +256,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) /* convert posix lock to p9 tgetlock args */ /* convert posix lock to p9 tgetlock args */ memset(&glock, 0, sizeof(glock)); memset(&glock, 0, sizeof(glock)); glock.type = fl->fl_type; glock.type = P9_LOCK_TYPE_UNLCK; glock.start = fl->fl_start; glock.start = fl->fl_start; if (fl->fl_end == OFFSET_MAX) if (fl->fl_end == OFFSET_MAX) glock.length = 0; glock.length = 0; Loading @@ -257,17 +268,26 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) res = p9_client_getlock_dotl(fid, &glock); res = p9_client_getlock_dotl(fid, &glock); if (res < 0) if (res < 0) return res; return res; if (glock.type != F_UNLCK) { /* map 9p lock type to os lock type */ fl->fl_type = glock.type; switch (glock.type) { case P9_LOCK_TYPE_RDLCK: fl->fl_type = F_RDLCK; break; case P9_LOCK_TYPE_WRLCK: fl->fl_type = F_WRLCK; break; case P9_LOCK_TYPE_UNLCK: fl->fl_type = F_UNLCK; break; } if (glock.type != P9_LOCK_TYPE_UNLCK) { fl->fl_start = glock.start; fl->fl_start = glock.start; if (glock.length == 0) if (glock.length == 0) fl->fl_end = OFFSET_MAX; fl->fl_end = OFFSET_MAX; else else fl->fl_end = glock.start + glock.length - 1; fl->fl_end = glock.start + glock.length - 1; fl->fl_pid = glock.proc_id; fl->fl_pid = glock.proc_id; } else } fl->fl_type = F_UNLCK; return res; return res; } } Loading include/net/9p/9p.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -312,6 +312,11 @@ enum p9_perm_t { /* 9p2000.L at flags */ /* 9p2000.L at flags */ #define P9_DOTL_AT_REMOVEDIR 0x200 #define P9_DOTL_AT_REMOVEDIR 0x200 /* 9p2000.L lock type */ #define P9_LOCK_TYPE_RDLCK 0 #define P9_LOCK_TYPE_WRLCK 1 #define P9_LOCK_TYPE_UNLCK 2 /** /** * enum p9_qid_t - QID types * enum p9_qid_t - QID types * @P9_QTDIR: directory * @P9_QTDIR: directory Loading Loading
fs/9p/vfs_file.c +27 −7 Original line number Original line Diff line number Diff line Loading @@ -169,7 +169,18 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) /* convert posix lock to p9 tlock args */ /* convert posix lock to p9 tlock args */ memset(&flock, 0, sizeof(flock)); memset(&flock, 0, sizeof(flock)); flock.type = fl->fl_type; /* map the lock type */ switch (fl->fl_type) { case F_RDLCK: flock.type = P9_LOCK_TYPE_RDLCK; break; case F_WRLCK: flock.type = P9_LOCK_TYPE_WRLCK; break; case F_UNLCK: flock.type = P9_LOCK_TYPE_UNLCK; break; } flock.start = fl->fl_start; flock.start = fl->fl_start; if (fl->fl_end == OFFSET_MAX) if (fl->fl_end == OFFSET_MAX) flock.length = 0; flock.length = 0; Loading Loading @@ -245,7 +256,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) /* convert posix lock to p9 tgetlock args */ /* convert posix lock to p9 tgetlock args */ memset(&glock, 0, sizeof(glock)); memset(&glock, 0, sizeof(glock)); glock.type = fl->fl_type; glock.type = P9_LOCK_TYPE_UNLCK; glock.start = fl->fl_start; glock.start = fl->fl_start; if (fl->fl_end == OFFSET_MAX) if (fl->fl_end == OFFSET_MAX) glock.length = 0; glock.length = 0; Loading @@ -257,17 +268,26 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) res = p9_client_getlock_dotl(fid, &glock); res = p9_client_getlock_dotl(fid, &glock); if (res < 0) if (res < 0) return res; return res; if (glock.type != F_UNLCK) { /* map 9p lock type to os lock type */ fl->fl_type = glock.type; switch (glock.type) { case P9_LOCK_TYPE_RDLCK: fl->fl_type = F_RDLCK; break; case P9_LOCK_TYPE_WRLCK: fl->fl_type = F_WRLCK; break; case P9_LOCK_TYPE_UNLCK: fl->fl_type = F_UNLCK; break; } if (glock.type != P9_LOCK_TYPE_UNLCK) { fl->fl_start = glock.start; fl->fl_start = glock.start; if (glock.length == 0) if (glock.length == 0) fl->fl_end = OFFSET_MAX; fl->fl_end = OFFSET_MAX; else else fl->fl_end = glock.start + glock.length - 1; fl->fl_end = glock.start + glock.length - 1; fl->fl_pid = glock.proc_id; fl->fl_pid = glock.proc_id; } else } fl->fl_type = F_UNLCK; return res; return res; } } Loading
include/net/9p/9p.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -312,6 +312,11 @@ enum p9_perm_t { /* 9p2000.L at flags */ /* 9p2000.L at flags */ #define P9_DOTL_AT_REMOVEDIR 0x200 #define P9_DOTL_AT_REMOVEDIR 0x200 /* 9p2000.L lock type */ #define P9_LOCK_TYPE_RDLCK 0 #define P9_LOCK_TYPE_WRLCK 1 #define P9_LOCK_TYPE_UNLCK 2 /** /** * enum p9_qid_t - QID types * enum p9_qid_t - QID types * @P9_QTDIR: directory * @P9_QTDIR: directory Loading