Lines Matching refs:fl

104 static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)  in v9fs_file_lock()  argument
108 p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); in v9fs_file_lock()
110 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock()
118 static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_do_lock() argument
130 BUG_ON((fl->fl_flags & FL_POSIX) != FL_POSIX); in v9fs_file_do_lock()
132 res = locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
139 switch (fl->fl_type) { in v9fs_file_do_lock()
150 flock.start = fl->fl_start; in v9fs_file_do_lock()
151 if (fl->fl_end == OFFSET_MAX) in v9fs_file_do_lock()
154 flock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_do_lock()
155 flock.proc_id = fl->fl_pid; in v9fs_file_do_lock()
210 if (res < 0 && fl->fl_type != F_UNLCK) { in v9fs_file_do_lock()
211 fl_type = fl->fl_type; in v9fs_file_do_lock()
212 fl->fl_type = F_UNLCK; in v9fs_file_do_lock()
214 locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
215 fl->fl_type = fl_type; in v9fs_file_do_lock()
223 static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) in v9fs_file_getlock() argument
232 posix_test_lock(filp, fl); in v9fs_file_getlock()
237 if (fl->fl_type != F_UNLCK) in v9fs_file_getlock()
243 glock.start = fl->fl_start; in v9fs_file_getlock()
244 if (fl->fl_end == OFFSET_MAX) in v9fs_file_getlock()
247 glock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_getlock()
248 glock.proc_id = fl->fl_pid; in v9fs_file_getlock()
257 fl->fl_type = F_RDLCK; in v9fs_file_getlock()
260 fl->fl_type = F_WRLCK; in v9fs_file_getlock()
263 fl->fl_type = F_UNLCK; in v9fs_file_getlock()
267 fl->fl_start = glock.start; in v9fs_file_getlock()
269 fl->fl_end = OFFSET_MAX; in v9fs_file_getlock()
271 fl->fl_end = glock.start + glock.length - 1; in v9fs_file_getlock()
272 fl->fl_pid = -glock.proc_id; in v9fs_file_getlock()
288 static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock_dotl() argument
294 filp, cmd, fl, filp); in v9fs_file_lock_dotl()
296 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock_dotl()
302 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_lock_dotl()
304 ret = v9fs_file_getlock(filp, fl); in v9fs_file_lock_dotl()
319 struct file_lock *fl) in v9fs_file_flock_dotl() argument
325 filp, cmd, fl, filp); in v9fs_file_flock_dotl()
327 if (!(fl->fl_flags & FL_FLOCK)) in v9fs_file_flock_dotl()
330 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_flock_dotl()
335 fl->fl_flags |= FL_POSIX; in v9fs_file_flock_dotl()
336 fl->fl_flags ^= FL_FLOCK; in v9fs_file_flock_dotl()
339 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_flock_dotl()