diff --git a/lib/spinlock.c b/lib/spinlock.c index 595432e..5277a8b 100644 --- a/lib/spinlock.c +++ b/lib/spinlock.c @@ -39,8 +39,8 @@ * On RISC-V, this emits a fence instruction. */ -/** Initialize spinlock */ -void initlock(struct spinlock *lk, char *name) { +/** Initialize Spinlock */ +void initlock(struct Spinlock *lk, char *name) { lk->name = name; lk->locked = 0; lk->cpu = 0; @@ -51,7 +51,7 @@ void initlock(struct spinlock *lk, char *name) { * Loops (spins) until the lock is acquired. * Panics if the lock is already held by this cpu. */ -void acquire(struct spinlock *lk) { +void acquire(struct Spinlock *lk) { push_off(); // disable interrupts to avoid deadlock. if (holding(lk)) // If the lock is already held, panic. @@ -70,7 +70,7 @@ void acquire(struct spinlock *lk) { * Release the lock. * Panics if the lock is not held. */ -void release(struct spinlock *lk) { +void release(struct Spinlock *lk) { if (!holding(lk)) // If the lock is not held, panic. panic("release"); @@ -83,7 +83,7 @@ void release(struct spinlock *lk) { // Check whether this cpu is holding the lock. // Interrupts must be off. -int holding(struct spinlock *lk) { +int holding(struct Spinlock *lk) { int r; r = (lk->locked && lk->cpu == mycpu()); return r; diff --git a/lib/spinlock.h b/lib/spinlock.h index 48bcb27..eb4f4b3 100644 --- a/lib/spinlock.h +++ b/lib/spinlock.h @@ -1,10 +1,10 @@ -#ifndef KERNEL_SPINLOCK_H -#define KERNEL_SPINLOCK_H +#ifndef KERNEL_Spinlock_H +#define KERNEL_Spinlock_H #include "types.h" /** Mutual exclusion spin lock */ -struct spinlock { +struct Spinlock { u32 locked; // Is the lock held? // NOTE: Perhaps feature gate this? @@ -19,24 +19,24 @@ struct spinlock { * Loops (spins) until the lock is acquired. * Panics if the lock is already held by this cpu. */ -void acquire(struct spinlock *); +void acquire(struct Spinlock *); /** * Check whether this cpu is holding the lock. * Interrupts must be off. */ -int holding(struct spinlock *); +int holding(struct Spinlock *); /** - * Initialize spinlock + * Initialize Spinlock */ -void initlock(struct spinlock *, char *); +void initlock(struct Spinlock *, char *); /** * Release the lock. * Panics if the lock is not held. */ -void release(struct spinlock *); +void release(struct Spinlock *); /** * @brief push_off/pop_off are like intr_off()/intr_on() except that they are diff --git a/start.c b/start.c index 656ac65..8d369f9 100644 --- a/start.c +++ b/start.c @@ -15,7 +15,7 @@ char stack0[4096 * NCPU] __attribute__((aligned(16))); /* Keep this here and sync on it until we have synchronized printf */ -struct spinlock sl = {0}; +struct Spinlock sl = {0}; volatile int greeted = 0; /* This is where entry.S drops us of. All cores land here */