Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2008-12-12 13:52:44 -08:00
commit a4fce46af9
1 changed files with 21 additions and 7 deletions

View File

@ -203,18 +203,32 @@ extern kthread_t *zk_thread_create(void (*func)(void), void *arg);
/* /*
* Mutexes * Mutexes
*/ */
typedef mutex_t kmutex_t; typedef struct kmutex {
void *m_owner;
boolean_t initialized;
mutex_t m_lock;
} kmutex_t;
#define MUTEX_DEFAULT USYNC_THREAD #define MUTEX_DEFAULT USYNC_THREAD
#undef MUTEX_HELD
#define MUTEX_HELD(m) _mutex_held(&(m)->m_lock)
/* /*
* Conflicts with lib/libspl/include/thread.h. The kernel and user * Argh -- we have to get cheesy here because the kernel and userland
* space prototypes differ forcing us to do some special handling. * have different signatures for the same routine.
*/ */
#ifdef mutex_init extern int _mutex_init(mutex_t *mp, int type, void *arg);
#undef mutex_init extern int _mutex_destroy(mutex_t *mp);
#define mutex_init(mp, name, type, args) _mutex_init(mp, type, args)
#endif #define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp))
#define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp))
extern void zmutex_init(kmutex_t *mp);
extern void zmutex_destroy(kmutex_t *mp);
extern void mutex_enter(kmutex_t *mp);
extern void mutex_exit(kmutex_t *mp);
extern int mutex_tryenter(kmutex_t *mp);
extern void *mutex_owner(kmutex_t *mp);
/* /*
* RW locks * RW locks