Fix c++ compile errors with lockstat

上级 435eaffb
...@@ -102,19 +102,19 @@ holding(struct spinlock *lock) ...@@ -102,19 +102,19 @@ holding(struct spinlock *lock)
#if LOCKSTAT #if LOCKSTAT
LIST_HEAD(lockstat_list, klockstat); LIST_HEAD(lockstat_list, klockstat);
static struct lockstat_list lockstat_list = LIST_HEAD_INITIALIZER(lockstat_list); static struct lockstat_list lockstat_list = { (struct klockstat*) NULL };
static struct spinlock lockstat_lock = { static struct spinlock lockstat_lock = {
.locked = 0, locked: 0,
#if SPINLOCK_DEBUG #if SPINLOCK_DEBUG
.name = "lockstat", name: "lockstat",
.cpu = NULL, cpu: (struct cpu*) NULL,
#endif #endif
}; };
void void
lockstat_init(struct spinlock *lk) lockstat_init(struct spinlock *lk)
{ {
lk->stat = kmalloc(sizeof(*lk->stat)); lk->stat = (struct klockstat*) kmalloc(sizeof(*lk->stat));
if (lk->stat == NULL) if (lk->stat == NULL)
return; return;
...@@ -145,7 +145,7 @@ lockstat_clear(void) ...@@ -145,7 +145,7 @@ lockstat_clear(void)
if (stat->magic == 0) { if (stat->magic == 0) {
LIST_REMOVE(stat, link); LIST_REMOVE(stat, link);
// So verifyfree doesn't follow le_next // So verifyfree doesn't follow le_next
stat->link.le_next = NULL; stat->link.le_next = (struct klockstat*) NULL;
gc_delayed(stat, kmfree); gc_delayed(stat, kmfree);
} else { } else {
memset(&stat->s.cpu, 0, sizeof(stat->s.cpu)); memset(&stat->s.cpu, 0, sizeof(stat->s.cpu));
...@@ -192,7 +192,7 @@ lockstat_read(struct inode *ip, char *dst, u32 off, u32 n) ...@@ -192,7 +192,7 @@ lockstat_read(struct inode *ip, char *dst, u32 off, u32 n)
if (cur < off) { if (cur < off) {
cache.off = 0; cache.off = 0;
cache.stat = NULL; cache.stat = (struct klockstat*) NULL;
return 0; return 0;
} }
...@@ -243,7 +243,7 @@ initlock(struct spinlock *lk, const char *name, int lockstat) ...@@ -243,7 +243,7 @@ initlock(struct spinlock *lk, const char *name, int lockstat)
lk->cpu = 0; lk->cpu = 0;
#endif #endif
#if LOCKSTAT #if LOCKSTAT
lk->stat = NULL; lk->stat = (struct klockstat*) NULL;
if (lockstat) if (lockstat)
lockstat_init(lk); lockstat_init(lk);
#endif #endif
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论