> -#define mutex_init(lock, type, name) sema_init(lock, 1)
> -#define mutex_destroy(lock) sema_init(lock, -99)
> -#define mutex_lock(lock, num) down(lock)
> -#define mutex_trylock(lock) (down_trylock(lock) ? 0 : 1)
> -#define mutex_unlock(lock) up(lock)
> +#define xfs_mutex_init(lock, type, name) sema_init(lock, 1)
> +#define xfs_mutex_destroy(lock) sema_init(lock, -99)
> +#define xfs_mutex_lock(lock, num) down(lock)
> +#define xfs_mutex_trylock(lock) (down_trylock(lock) ? 0 : 1)
> +#define xfs_mutex_unlock(lock) up(lock)
Again, this should really be using the mutex primitives (obviously ;-)).
The patch should become (pseudo-patch):
-typedef struct semaphore mutex_t
-
-#define mutex_init(lock, type, name) sema_init(lock, 1)
-#define mutex_destroy(lock) sema_init(lock, -99)
-#define mutex_lock(lock, num) down(lock)
-#define mutex_trylock(lock) (down_trylock(lock) ? 0 : 1)
-#define mutex_unlock(lock) up(lock)
+#define mutex_init(lock, type, name) mutex_init(lock)
+#define mutex_destroy(lock) do { } while (0)
While we're at it, maybe we should a mutex_destroy aswell? it would
be non-mandatory and allow that a lock is gone for the debugging variant.
-
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]