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 = posix_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()
234 res = posix_lock_file_wait(filp, fl); in v9fs_file_do_lock()
235 fl->fl_type = fl_type; in v9fs_file_do_lock()
241 static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) in v9fs_file_getlock() argument
250 posix_test_lock(filp, fl); in v9fs_file_getlock()
255 if (fl->fl_type != F_UNLCK) in v9fs_file_getlock()
261 glock.start = fl->fl_start; in v9fs_file_getlock()
262 if (fl->fl_end == OFFSET_MAX) in v9fs_file_getlock()
265 glock.length = fl->fl_end - fl->fl_start + 1; in v9fs_file_getlock()
266 glock.proc_id = fl->fl_pid; in v9fs_file_getlock()
275 fl->fl_type = F_RDLCK; in v9fs_file_getlock()
278 fl->fl_type = F_WRLCK; in v9fs_file_getlock()
281 fl->fl_type = F_UNLCK; in v9fs_file_getlock()
285 fl->fl_start = glock.start; in v9fs_file_getlock()
287 fl->fl_end = OFFSET_MAX; in v9fs_file_getlock()
289 fl->fl_end = glock.start + glock.length - 1; in v9fs_file_getlock()
290 fl->fl_pid = glock.proc_id; in v9fs_file_getlock()
304 static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) in v9fs_file_lock_dotl() argument
310 filp, cmd, fl, filp); in v9fs_file_lock_dotl()
313 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) in v9fs_file_lock_dotl()
316 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_lock_dotl()
322 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_lock_dotl()
324 ret = v9fs_file_getlock(filp, fl); in v9fs_file_lock_dotl()
340 struct file_lock *fl) in v9fs_file_flock_dotl() argument
346 filp, cmd, fl, filp); in v9fs_file_flock_dotl()
349 if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) in v9fs_file_flock_dotl()
352 if (!(fl->fl_flags & FL_FLOCK)) in v9fs_file_flock_dotl()
355 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { in v9fs_file_flock_dotl()
360 fl->fl_flags |= FL_POSIX; in v9fs_file_flock_dotl()
361 fl->fl_flags ^= FL_FLOCK; in v9fs_file_flock_dotl()
364 ret = v9fs_file_do_lock(filp, cmd, fl); in v9fs_file_flock_dotl()