Whamcloud - gitweb
libcfs: add spin_lock_nested() function to user level and old linux kernels.
authornikita <nikita>
Sun, 10 Aug 2008 00:24:33 +0000 (00:24 +0000)
committernikita <nikita>
Sun, 10 Aug 2008 00:24:33 +0000 (00:24 +0000)
libcfs/include/libcfs/linux/linux-lock.h
libcfs/include/libcfs/user-lock.h
libcfs/libcfs/user-lock.c

index d78e2b5..0ada733 100644 (file)
  * - spin_unlock_irqrestore(x, f)
  */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+static inline void spin_lock_nested(spinlock_t *lock, unsigned subclass)
+{
+        spin_lock(lock);
+}
+#endif
+
 /*
  * rw_semaphore (use Linux kernel's primitives)
  *
index b134096..913ba8e 100644 (file)
@@ -72,6 +72,7 @@
  *
  * - spin_lock_init(x)
  * - spin_lock(x)
+ * - spin_lock_nested(x, subclass)
  * - spin_unlock(x)
  * - spin_trylock(x)
  *
@@ -90,6 +91,7 @@ typedef struct spin_lock spinlock_t;
 
 void spin_lock_init(spinlock_t *lock);
 void spin_lock(spinlock_t *lock);
+void spin_lock_nested(spinlock_t *lock, unsigned int subclass);
 void spin_unlock(spinlock_t *lock);
 int spin_trylock(spinlock_t *lock);
 void spin_lock_bh_init(spinlock_t *lock);
index 2657dbc..b01319f 100644 (file)
@@ -61,6 +61,7 @@
  *
  * - spin_lock_init(x)
  * - spin_lock(x)
+ * - spin_lock_nested(x, subclass)
  * - spin_unlock(x)
  * - spin_trylock(x)
  *
@@ -81,6 +82,12 @@ void spin_lock(spinlock_t *lock)
         (void)lock;
 }
 
+void spin_lock_nested(spinlock_t *lock, unsigned int subclass)
+{
+        (void)lock;
+        (void)subclass;
+}
+
 void spin_unlock(spinlock_t *lock)
 {
         (void)lock;