@@ -191,6 +191,9 @@ do { \
*/
extern void down_read_non_owner(struct rw_semaphore *sem);
extern void up_read_non_owner(struct rw_semaphore *sem);
+extern void down_write_non_owner(struct rw_semaphore *sem);
+extern int down_write_trylock_non_owner(struct rw_semaphore *sem);
+extern void up_write_non_owner(struct rw_semaphore *sem);
#else
# define down_read_nested(sem, subclass) down_read(sem)
# define down_write_nest_lock(sem, nest_lock) down_write(sem)
@@ -198,6 +201,9 @@ extern void up_read_non_owner(struct rw_semaphore *sem);
# define down_write_killable_nested(sem, subclass) down_write_killable(sem)
# define down_read_non_owner(sem) down_read(sem)
# define up_read_non_owner(sem) up_read(sem)
+# define down_write_non_owner(sem) down_write(sem)
+# define down_write_trylock_non_owner(sem) down_write_trylock(sem)
+# define up_write_non_owner(sem) up_write(sem)
#endif
#endif /* _LINUX_RWSEM_H */
@@ -1654,4 +1654,27 @@ void up_read_non_owner(struct rw_semaphore *sem)
}
EXPORT_SYMBOL(up_read_non_owner);
+void down_write_non_owner(struct rw_semaphore *sem)
+{
+ might_sleep();
+ __down_write(sem);
+}
+EXPORT_SYMBOL(down_write_non_owner);
+
+/*
+ * trylock for writing -- returns 1 if successful, 0 if contention
+ */
+int down_write_trylock_non_owner(struct rw_semaphore *sem)
+{
+ return __down_write_trylock(sem);
+}
+EXPORT_SYMBOL(down_write_trylock_non_owner);
+
+void up_write_non_owner(struct rw_semaphore *sem)
+{
+ rwsem_set_owner(sem);
+ __up_write(sem);
+}
+EXPORT_SYMBOL(up_write_non_owner);
+
#endif