posix_lock_file

Name

posix_lock_file -- 

Synopsis

int posix_lock_file (struct file * filp, struct file_lock * caller, unsigned int wait);

Arguments

filp

The file to apply the lock to

caller

The lock to be applied

wait

1 to retry automatically, 0 to return -EAGAIN

Description

Add a POSIX style lock to a file. We merge adjacent locks whenever possible. POSIX locks are sorted by owner task, then by starting address

Kai Petzke writes

To make freeing a lock much faster, we keep a pointer to the lock before the actual one. But the real gain of the new coding was, that lock_it and unlock_it became one function.

To all purists

Yes, I use a few goto's. Just pass on to the next function.