root/include/linux/locks.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. wait_on_buffer
  2. lock_buffer
  3. unlock_buffer
  4. wait_on_super
  5. lock_super
  6. unlock_super

   1 #ifndef _LINUX_LOCKS_H
   2 #define _LINUX_LOCKS_H
   3 
   4 /*
   5  * Buffer cache locking - note that interrupts may only unlock, not
   6  * lock buffers.
   7  */
   8 extern void __wait_on_buffer(struct buffer_head *);
   9 
  10 extern inline void wait_on_buffer(struct buffer_head * bh)
     /* [previous][next][first][last][top][bottom][index][help] */
  11 {
  12         if (test_bit(BH_Lock, &bh->b_state))
  13                 __wait_on_buffer(bh);
  14 }
  15 
  16 extern inline void lock_buffer(struct buffer_head * bh)
     /* [previous][next][first][last][top][bottom][index][help] */
  17 {
  18         if (set_bit(BH_Lock, &bh->b_state))
  19                 __wait_on_buffer(bh);
  20 }
  21 
  22 extern inline void unlock_buffer(struct buffer_head * bh)
     /* [previous][next][first][last][top][bottom][index][help] */
  23 {
  24         clear_bit(BH_Lock, &bh->b_state);
  25         wake_up(&bh->b_wait);
  26 }
  27 
  28 /*
  29  * super-block locking. Again, interrupts may only unlock
  30  * a super-block (although even this isn't done right now.
  31  * nfs may need it).
  32  */
  33 extern void __wait_on_super(struct super_block *);
  34 
  35 extern inline void wait_on_super(struct super_block * sb)
     /* [previous][next][first][last][top][bottom][index][help] */
  36 {
  37         if (sb->s_lock)
  38                 __wait_on_super(sb);
  39 }
  40 
  41 extern inline void lock_super(struct super_block * sb)
     /* [previous][next][first][last][top][bottom][index][help] */
  42 {
  43         if (sb->s_lock)
  44                 __wait_on_super(sb);
  45         sb->s_lock = 1;
  46 }
  47 
  48 extern inline void unlock_super(struct super_block * sb)
     /* [previous][next][first][last][top][bottom][index][help] */
  49 {
  50         sb->s_lock = 0;
  51         wake_up(&sb->s_wait);
  52 }
  53 
  54 #endif /* _LINUX_LOCKS_H */
  55 

/* [previous][next][first][last][top][bottom][index][help] */