Fix builds without CONFIG_SEMAPHORE_DEBUG
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 10 Jan 2019 22:02:13 +0000 (17:02 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 10 Jan 2019 22:02:13 +0000 (17:02 -0500)
Earlier, I moved to using empty C functions instead of macros for the
cases where we have debugging turned off.  However, I still had the
CVs/SEMs conditionally including the 'db' struct.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/kthread.h

index 115b552..8581d5b 100644 (file)
@@ -59,28 +59,34 @@ struct kthread {
 #define KTH_DB_SEM                     1
 #define KTH_DB_CV                      2
 
+#ifdef CONFIG_SEMAPHORE_DEBUG
+
 struct kth_db_info {
        TAILQ_ENTRY(kth_db_info)        link;
        unsigned int                            type;
        bool                                            on_list;
 };
 
+#define KTH_DB_INIT .db         = { .type = KTH_DB_SEM },
+
+#else
+
+struct kth_db_info {
+};
+
+#define KTH_DB_INIT
+
+#endif
+
+
 /* Semaphore for kthreads to sleep on.  0 or less means you need to sleep */
 struct semaphore {
-#ifdef CONFIG_SEMAPHORE_DEBUG
        struct kth_db_info                      db;
-#endif
        struct kthread_tailq            waiters;
        int                                             nr_signals;
        spinlock_t                                      lock;
 };
 
-#ifdef CONFIG_SEMAPHORE_DEBUG
-#define KTH_DB_INIT .db         = { .type = KTH_DB_SEM },
-#else
-#define KTH_DB_INIT
-#endif
-
 #define SEMAPHORE_INITIALIZER(name, n)                                         \
 {                                                                              \
     .waiters    = TAILQ_HEAD_INITIALIZER((name).waiters),                      \
@@ -98,9 +104,7 @@ struct semaphore {
 }
 
 struct cond_var {
-#ifdef CONFIG_SEMAPHORE_DEBUG
        struct kth_db_info                      db;
-#endif
        struct kthread_tailq            waiters;
        spinlock_t                                      *lock;          /* usually points to internal_ */
        spinlock_t                                      internal_lock;