OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [locks.h] - Diff between revs 1765 and 1782

Only display areas with differences | Details | Blame | View Log

Rev 1765 Rev 1782
#ifndef _LINUX_LOCKS_H
#ifndef _LINUX_LOCKS_H
#define _LINUX_LOCKS_H
#define _LINUX_LOCKS_H
 
 
#ifndef _LINUX_MM_H
#ifndef _LINUX_MM_H
#include <linux/mm.h>
#include <linux/mm.h>
#endif
#endif
#ifndef _LINUX_PAGEMAP_H
#ifndef _LINUX_PAGEMAP_H
#include <linux/pagemap.h>
#include <linux/pagemap.h>
#endif
#endif
 
 
/*
/*
 * Unlocked, temporary IO buffer_heads gets moved to the reuse_list
 * Unlocked, temporary IO buffer_heads gets moved to the reuse_list
 * once their page becomes unlocked.
 * once their page becomes unlocked.
 */
 */
extern struct buffer_head *reuse_list;
extern struct buffer_head *reuse_list;
 
 
/*
/*
 * Buffer cache locking - note that interrupts may only unlock, not
 * Buffer cache locking - note that interrupts may only unlock, not
 * lock buffers.
 * lock buffers.
 */
 */
extern void __wait_on_buffer(struct buffer_head *);
extern void __wait_on_buffer(struct buffer_head *);
 
 
extern inline void wait_on_buffer(struct buffer_head * bh)
extern inline void wait_on_buffer(struct buffer_head * bh)
{
{
        if (test_bit(BH_Lock, &bh->b_state))
        if (test_bit(BH_Lock, &bh->b_state))
                __wait_on_buffer(bh);
                __wait_on_buffer(bh);
}
}
 
 
extern inline void lock_buffer(struct buffer_head * bh)
extern inline void lock_buffer(struct buffer_head * bh)
{
{
        while (set_bit(BH_Lock, &bh->b_state))
        while (set_bit(BH_Lock, &bh->b_state))
                __wait_on_buffer(bh);
                __wait_on_buffer(bh);
}
}
 
 
void unlock_buffer(struct buffer_head *);
void unlock_buffer(struct buffer_head *);
 
 
 
 
/*
/*
 * super-block locking. Again, interrupts may only unlock
 * super-block locking. Again, interrupts may only unlock
 * a super-block (although even this isn't done right now.
 * a super-block (although even this isn't done right now.
 * nfs may need it).
 * nfs may need it).
 */
 */
extern void __wait_on_super(struct super_block *);
extern void __wait_on_super(struct super_block *);
 
 
extern inline void wait_on_super(struct super_block * sb)
extern inline void wait_on_super(struct super_block * sb)
{
{
        if (sb->s_lock)
        if (sb->s_lock)
                __wait_on_super(sb);
                __wait_on_super(sb);
}
}
 
 
extern inline void lock_super(struct super_block * sb)
extern inline void lock_super(struct super_block * sb)
{
{
        if (sb->s_lock)
        if (sb->s_lock)
                __wait_on_super(sb);
                __wait_on_super(sb);
        sb->s_lock = 1;
        sb->s_lock = 1;
}
}
 
 
extern inline void unlock_super(struct super_block * sb)
extern inline void unlock_super(struct super_block * sb)
{
{
        sb->s_lock = 0;
        sb->s_lock = 0;
        wake_up(&sb->s_wait);
        wake_up(&sb->s_wait);
}
}
 
 
#endif /* _LINUX_LOCKS_H */
#endif /* _LINUX_LOCKS_H */
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.