Lines Matching refs:fl
131 static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock() argument
136 p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); in v9fs_file_lock()
139 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) in v9fs_file_lock()
142 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock()
150 static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_do_lock() argument
161 if ((fl->fl_flags & FL_POSIX) != FL_POSIX) in v9fs_file_do_lock()
164 res = locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
171 switch (fl->fl_type) { in v9fs_file_do_lock()
182 flock.start = fl->fl_start; in v9fs_file_do_lock()
183 if (fl->fl_end == OFFSET_MAX) in v9fs_file_do_lock()
186 flock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_do_lock()
187 flock.proc_id = fl->fl_pid; in v9fs_file_do_lock()
231 if (res < 0 && fl->fl_type != F_UNLCK) { in v9fs_file_do_lock()
232 fl_type = fl->fl_type; in v9fs_file_do_lock()
233 fl->fl_type = F_UNLCK; in v9fs_file_do_lock()
235 locks_lock_file_wait(filp, fl); in v9fs_file_do_lock()
236 fl->fl_type = fl_type; in v9fs_file_do_lock()
242 static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) in v9fs_file_getlock() argument
251 posix_test_lock(filp, fl); in v9fs_file_getlock()
256 if (fl->fl_type != F_UNLCK) in v9fs_file_getlock()
262 glock.start = fl->fl_start; in v9fs_file_getlock()
263 if (fl->fl_end == OFFSET_MAX) in v9fs_file_getlock()
266 glock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_getlock()
267 glock.proc_id = fl->fl_pid; in v9fs_file_getlock()
276 fl->fl_type = F_RDLCK; in v9fs_file_getlock()
279 fl->fl_type = F_WRLCK; in v9fs_file_getlock()
282 fl->fl_type = F_UNLCK; in v9fs_file_getlock()
286 fl->fl_start = glock.start; in v9fs_file_getlock()
288 fl->fl_end = OFFSET_MAX; in v9fs_file_getlock()
290 fl->fl_end = glock.start + glock.length - 1; in v9fs_file_getlock()
291 fl->fl_pid = glock.proc_id; in v9fs_file_getlock()
305 static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock_dotl() argument
311 filp, cmd, fl, filp); in v9fs_file_lock_dotl()
314 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) in v9fs_file_lock_dotl()
317 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock_dotl()
323 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_lock_dotl()
325 ret = v9fs_file_getlock(filp, fl); in v9fs_file_lock_dotl()
341 struct file_lock *fl) in v9fs_file_flock_dotl() argument
347 filp, cmd, fl, filp); in v9fs_file_flock_dotl()
350 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) in v9fs_file_flock_dotl()
353 if (!(fl->fl_flags & FL_FLOCK)) in v9fs_file_flock_dotl()
356 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_flock_dotl()
361 fl->fl_flags |= FL_POSIX; in v9fs_file_flock_dotl()
362 fl->fl_flags ^= FL_FLOCK; in v9fs_file_flock_dotl()
365 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_flock_dotl()