tag | line | file | source code |
fl | 23 | fs/locks.c | static int copy_flock(struct file *filp, struct file_lock *fl, struct flock *l); |
fl | 29 | fs/locks.c | static void free_lock(struct file *filp, struct file_lock *fl); |
fl | 40 | fs/locks.c | struct file_lock *fl; |
fl | 42 | fs/locks.c | for (fl = &file_lock_table[0]; fl < file_lock_table + NR_FILE_LOCKS - 1; fl++) { |
fl | 43 | fs/locks.c | fl->fl_next = fl + 1; |
fl | 44 | fs/locks.c | fl->fl_owner = NULL; |
fl | 55 | fs/locks.c | struct file_lock *fl,file_lock; |
fl | 66 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; fl = fl->fl_next) { |
fl | 67 | fs/locks.c | if (conflict(&file_lock, fl)) { |
fl | 68 | fs/locks.c | flock.l_pid = fl->fl_owner->pid; |
fl | 69 | fs/locks.c | flock.l_start = fl->fl_start; |
fl | 70 | fs/locks.c | flock.l_len = fl->fl_end == OFFSET_MAX ? 0 : |
fl | 71 | fs/locks.c | fl->fl_end - fl->fl_start + 1; |
fl | 72 | fs/locks.c | flock.l_whence = fl->fl_whence; |
fl | 73 | fs/locks.c | flock.l_type = fl->fl_type; |
fl | 91 | fs/locks.c | struct file_lock *fl,file_lock; |
fl | 139 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; fl = fl->fl_next) { |
fl | 140 | fs/locks.c | if (!conflict(&file_lock, fl)) |
fl | 148 | fs/locks.c | interruptible_sleep_on(&fl->fl_wait); |
fl | 167 | fs/locks.c | struct file_lock *fl,*next; |
fl | 169 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; ) { |
fl | 174 | fs/locks.c | next = fl->fl_next; |
fl | 175 | fs/locks.c | if (fl->fl_owner == task) |
fl | 176 | fs/locks.c | free_lock(filp, fl); |
fl | 177 | fs/locks.c | fl = next; |
fl | 186 | fs/locks.c | static int copy_flock(struct file *filp, struct file_lock *fl, struct flock *l) |
fl | 205 | fs/locks.c | fl->fl_type = l->l_type; |
fl | 206 | fs/locks.c | fl->fl_start = start; /* we record the absolute position */ |
fl | 207 | fs/locks.c | fl->fl_whence = 0; /* FIXME: do we record {l_start} as passed? */ |
fl | 208 | fs/locks.c | if (l->l_len == 0 || (fl->fl_end = start + l->l_len - 1) < 0) |
fl | 209 | fs/locks.c | fl->fl_end = OFFSET_MAX; |
fl | 210 | fs/locks.c | fl->fl_owner = current; |
fl | 211 | fs/locks.c | fl->fl_wait = NULL; /* just for cleanliness */ |
fl | 259 | fs/locks.c | struct file_lock *fl,*new; |
fl | 276 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; fl = fl->fl_next) { |
fl | 277 | fs/locks.c | if (caller->fl_owner != fl->fl_owner) |
fl | 279 | fs/locks.c | if (caller == fl) |
fl | 281 | fs/locks.c | if (!overlap(caller, fl)) { |
fl | 285 | fs/locks.c | if (caller->fl_type != fl->fl_type) |
fl | 287 | fs/locks.c | if (caller->fl_end + 1 == fl->fl_start) { |
fl | 288 | fs/locks.c | fl->fl_start = caller->fl_start; |
fl | 290 | fs/locks.c | caller = fl; |
fl | 292 | fs/locks.c | } else if (caller->fl_start - 1 == fl->fl_end) { |
fl | 293 | fs/locks.c | fl->fl_end = caller->fl_end; |
fl | 295 | fs/locks.c | caller = fl; |
fl | 304 | fs/locks.c | if (caller->fl_type != fl->fl_type) { |
fl | 305 | fs/locks.c | if (caller->fl_start > fl->fl_start && caller->fl_end < fl->fl_end) { |
fl | 311 | fs/locks.c | if ((new = alloc_lock(filp, fl)) == NULL) { |
fl | 315 | fs/locks.c | fl->fl_end = caller->fl_start - 1; |
fl | 319 | fs/locks.c | if (caller->fl_start <= fl->fl_start && caller->fl_end >= fl->fl_end) { |
fl | 323 | fs/locks.c | free_lock(filp, fl); |
fl | 326 | fs/locks.c | if (caller->fl_end < fl->fl_end) { |
fl | 327 | fs/locks.c | fl->fl_start = caller->fl_end + 1; |
fl | 329 | fs/locks.c | } else if (caller->fl_start > fl->fl_start) { |
fl | 330 | fs/locks.c | fl->fl_end = caller->fl_start - 1; |
fl | 340 | fs/locks.c | if (caller->fl_start < fl->fl_start) { |
fl | 341 | fs/locks.c | fl->fl_start = caller->fl_start; |
fl | 344 | fs/locks.c | if (caller->fl_end > fl->fl_end) { |
fl | 345 | fs/locks.c | fl->fl_end = caller->fl_end; |
fl | 349 | fs/locks.c | caller = fl; |
fl | 373 | fs/locks.c | struct file_lock *fl,*next; |
fl | 375 | fs/locks.c | for (fl = filp->f_inode->i_flock; fl != NULL; ) { |
fl | 376 | fs/locks.c | if (caller->fl_owner != fl->fl_owner || !overlap(caller, fl)) { |
fl | 377 | fs/locks.c | fl = fl->fl_next; |
fl | 381 | fs/locks.c | if (caller->fl_start > fl->fl_start && caller->fl_end < fl->fl_end) { |
fl | 386 | fs/locks.c | if ((next = alloc_lock(filp, fl)) == NULL) |
fl | 388 | fs/locks.c | fl->fl_end = caller->fl_start - 1; |
fl | 409 | fs/locks.c | next = fl->fl_next; |
fl | 410 | fs/locks.c | if (caller->fl_start <= fl->fl_start && caller->fl_end >= fl->fl_end) { |
fl | 411 | fs/locks.c | free_lock(filp, fl); |
fl | 412 | fs/locks.c | } else if (caller->fl_start > fl->fl_start) { |
fl | 413 | fs/locks.c | fl->fl_end = caller->fl_start - 1; |
fl | 416 | fs/locks.c | fl->fl_start = caller->fl_end + 1; |
fl | 418 | fs/locks.c | if (caller->fl_start >= fl->fl_start && caller->fl_end <= fl->fl_end) |
fl | 420 | fs/locks.c | fl = next; |
fl | 455 | fs/locks.c | static void free_lock(struct file *filp, struct file_lock *fl) |
fl | 459 | fs/locks.c | if (fl->fl_owner == NULL) /* sanity check */ |
fl | 468 | fs/locks.c | if (*fl_p == fl) |
fl | 477 | fs/locks.c | fl->fl_next = file_lock_free_list; /* add to free list */ |
fl | 478 | fs/locks.c | file_lock_free_list = fl; |
fl | 479 | fs/locks.c | fl->fl_owner = NULL; /* for sanity checks */ |
fl | 481 | fs/locks.c | wake_up(&fl->fl_wait); |