Lines Matching refs:fl
115 static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock() argument
120 p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); in v9fs_file_lock()
122 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock()
130 static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_do_lock() argument
142 if ((fl->fl_flags & FL_POSIX) != FL_POSIX) in v9fs_file_do_lock()
145 res = locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
152 switch (fl->fl_type) { in v9fs_file_do_lock()
163 flock.start = fl->fl_start; in v9fs_file_do_lock()
164 if (fl->fl_end == OFFSET_MAX) in v9fs_file_do_lock()
167 flock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_do_lock()
168 flock.proc_id = fl->fl_pid; in v9fs_file_do_lock()
223 if (res < 0 && fl->fl_type != F_UNLCK) { in v9fs_file_do_lock()
224 fl_type = fl->fl_type; in v9fs_file_do_lock()
225 fl->fl_type = F_UNLCK; in v9fs_file_do_lock()
227 locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
228 fl->fl_type = fl_type; in v9fs_file_do_lock()
236 static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) in v9fs_file_getlock() argument
245 posix_test_lock(filp, fl); in v9fs_file_getlock()
250 if (fl->fl_type != F_UNLCK) in v9fs_file_getlock()
256 glock.start = fl->fl_start; in v9fs_file_getlock()
257 if (fl->fl_end == OFFSET_MAX) in v9fs_file_getlock()
260 glock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_getlock()
261 glock.proc_id = fl->fl_pid; in v9fs_file_getlock()
270 fl->fl_type = F_RDLCK; in v9fs_file_getlock()
273 fl->fl_type = F_WRLCK; in v9fs_file_getlock()
276 fl->fl_type = F_UNLCK; in v9fs_file_getlock()
280 fl->fl_start = glock.start; in v9fs_file_getlock()
282 fl->fl_end = OFFSET_MAX; in v9fs_file_getlock()
284 fl->fl_end = glock.start + glock.length - 1; in v9fs_file_getlock()
285 fl->fl_pid = -glock.proc_id; in v9fs_file_getlock()
301 static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock_dotl() argument
307 filp, cmd, fl, filp); in v9fs_file_lock_dotl()
309 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock_dotl()
315 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_lock_dotl()
317 ret = v9fs_file_getlock(filp, fl); in v9fs_file_lock_dotl()
332 struct file_lock *fl) in v9fs_file_flock_dotl() argument
338 filp, cmd, fl, filp); in v9fs_file_flock_dotl()
340 if (!(fl->fl_flags & FL_FLOCK)) in v9fs_file_flock_dotl()
343 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_flock_dotl()
348 fl->fl_flags |= FL_POSIX; in v9fs_file_flock_dotl()
349 fl->fl_flags ^= FL_FLOCK; in v9fs_file_flock_dotl()
352 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_flock_dotl()