Do not export kernel prototypes to userland, structure definitions is 
what we need... or do we need love?

ok?

Index: sys/rwlock.h
===================================================================
RCS file: /cvs/src/sys/sys/rwlock.h,v
retrieving revision 1.18
diff -u -p -r1.18 rwlock.h
--- sys/rwlock.h        11 Feb 2015 00:14:11 -0000      1.18
+++ sys/rwlock.h        21 Sep 2016 07:11:33 -0000
@@ -51,8 +51,8 @@
  *  set, call rw_exit_waiters with the old contents of the lock.
  */
 
-#ifndef SYS_RWLOCK_H
-#define SYS_RWLOCK_H
+#ifndef _SYS_RWLOCK_H
+#define _SYS_RWLOCK_H
 
 struct proc;
 
@@ -73,27 +73,6 @@ struct rwlock {
 #define RWLOCK_READER_SHIFT    3UL
 #define RWLOCK_READ_INCR       (1UL << RWLOCK_READER_SHIFT)
 
-void rw_init(struct rwlock *, const char *);
-
-void rw_enter_read(struct rwlock *);
-void rw_enter_write(struct rwlock *);
-void rw_exit_read(struct rwlock *);
-void rw_exit_write(struct rwlock *);
-
-#ifdef DIAGNOSTIC
-void rw_assert_wrlock(struct rwlock *);
-void rw_assert_rdlock(struct rwlock *);
-void rw_assert_unlocked(struct rwlock *);
-#else
-#define rw_assert_wrlock(rwl) ((void)0)
-#define rw_assert_rdlock(rwl) ((void)0)
-#define rw_assert_unlocked(rwl) ((void)0)
-#endif
-
-int rw_enter(struct rwlock *, int);
-void rw_exit(struct rwlock *);
-int rw_status(struct rwlock *);
-
 #define RW_WRITE       0x0001UL        /* exclusive lock */
 #define RW_READ                0x0002UL        /* shared lock */
 #define RW_DOWNGRADE   0x0004UL        /* downgrade exclusive to shared */
@@ -116,9 +95,34 @@ struct rrwlock {
        uint32_t        rrwl_wcnt;      /* # writers. */
 };
 
+#ifdef _KERNEL
+
+void rw_init(struct rwlock *, const char *);
+
+void rw_enter_read(struct rwlock *);
+void rw_enter_write(struct rwlock *);
+void rw_exit_read(struct rwlock *);
+void rw_exit_write(struct rwlock *);
+
+#ifdef DIAGNOSTIC
+void rw_assert_wrlock(struct rwlock *);
+void rw_assert_rdlock(struct rwlock *);
+void rw_assert_unlocked(struct rwlock *);
+#else
+#define rw_assert_wrlock(rwl) ((void)0)
+#define rw_assert_rdlock(rwl) ((void)0)
+#define rw_assert_unlocked(rwl) ((void)0)
+#endif
+
+int rw_enter(struct rwlock *, int);
+void rw_exit(struct rwlock *);
+int rw_status(struct rwlock *);
+
 void   rrw_init(struct rrwlock *, char *);
 int    rrw_enter(struct rrwlock *, int);
 void   rrw_exit(struct rrwlock *);
 int    rrw_status(struct rrwlock *);
 
-#endif
+#endif /* _KERNEL */
+
+#endif /* _SYS_RWLOCK_H */

Reply via email to