Linus Torvalds writes:
>
[...]
> + * so it's ok to test it independently on the lock/unlock path
> + * rather than explicitly remembering whether we locked it.
> + */
> +static inline loff_t file_pos_read_lock(struct file *file)
> {
> + if (file->f_mode & FMODE_LSEEK)
> + mutex_lock(&file->f_pos_lock);
> return file->f_pos;
> }
>
> -static inline void file_pos_write(struct file *file, loff_t pos)
> +static inline void file_pos_write_unlock(struct file *file, loff_t pos)
> {
> file->f_pos = pos;
> + if (file->f_mode & FMODE_LSEEK)
> + mutex_unlock(&file->f_pos_lock);
> }
Naming of two functions above is confusing: it looks like read/write
lock is taken. Maybe file_pos_lock_and_get() and
file_pos_set_and_unlock()?
Nikita.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]