Lines Matching refs:fl

118 static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)  in v9fs_file_lock()  argument
122 p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); in v9fs_file_lock()
124 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock()
132 static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_do_lock() argument
144 BUG_ON((fl->fl_flags & FL_POSIX) != FL_POSIX); in v9fs_file_do_lock()
146 res = locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
153 switch (fl->fl_type) { in v9fs_file_do_lock()
164 flock.start = fl->fl_start; in v9fs_file_do_lock()
165 if (fl->fl_end == OFFSET_MAX) in v9fs_file_do_lock()
168 flock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_do_lock()
169 flock.proc_id = fl->fl_pid; in v9fs_file_do_lock()
224 if (res < 0 && fl->fl_type != F_UNLCK) { in v9fs_file_do_lock()
225 fl_type = fl->fl_type; in v9fs_file_do_lock()
226 fl->fl_type = F_UNLCK; in v9fs_file_do_lock()
228 locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
229 fl->fl_type = fl_type; in v9fs_file_do_lock()
237 static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) in v9fs_file_getlock() argument
246 posix_test_lock(filp, fl); in v9fs_file_getlock()
251 if (fl->fl_type != F_UNLCK) in v9fs_file_getlock()
257 glock.start = fl->fl_start; in v9fs_file_getlock()
258 if (fl->fl_end == OFFSET_MAX) in v9fs_file_getlock()
261 glock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_getlock()
262 glock.proc_id = fl->fl_pid; in v9fs_file_getlock()
271 fl->fl_type = F_RDLCK; in v9fs_file_getlock()
274 fl->fl_type = F_WRLCK; in v9fs_file_getlock()
277 fl->fl_type = F_UNLCK; in v9fs_file_getlock()
281 fl->fl_start = glock.start; in v9fs_file_getlock()
283 fl->fl_end = OFFSET_MAX; in v9fs_file_getlock()
285 fl->fl_end = glock.start + glock.length - 1; in v9fs_file_getlock()
286 fl->fl_pid = -glock.proc_id; in v9fs_file_getlock()
302 static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock_dotl() argument
308 filp, cmd, fl, filp); in v9fs_file_lock_dotl()
310 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock_dotl()
316 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_lock_dotl()
318 ret = v9fs_file_getlock(filp, fl); in v9fs_file_lock_dotl()
333 struct file_lock *fl) in v9fs_file_flock_dotl() argument
339 filp, cmd, fl, filp); in v9fs_file_flock_dotl()
341 if (!(fl->fl_flags & FL_FLOCK)) in v9fs_file_flock_dotl()
344 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_flock_dotl()
349 fl->fl_flags |= FL_POSIX; in v9fs_file_flock_dotl()
350 fl->fl_flags ^= FL_FLOCK; in v9fs_file_flock_dotl()
353 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_flock_dotl()