Use wqalloc for dirit

上级 323d260b
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include "user.h" #include "user.h"
#include "fs.h" #include "fs.h"
#include "lib.h" #include "lib.h"
#include "dirit.hh"
#include "wq.hh" #include "wq.hh"
#include "dirit.hh"
#define ST_SIZE(st) (st).size #define ST_SIZE(st) (st).size
#define ST_TYPE(st) (st).type #define ST_TYPE(st) (st).type
#define ST_INO(st) (st).ino #define ST_INO(st) (st).ino
......
...@@ -44,12 +44,12 @@ private: ...@@ -44,12 +44,12 @@ private:
static inline const char* static inline const char*
copy_value(dirit &it) copy_value(dirit &it)
{ {
char *buf = (char*)malloc(256); char *buf = (char*)wqalloc(DIRSIZ+1);
return it.name(buf, 256); return it.name(buf, DIRSIZ+1);
} }
static inline void static inline void
free_value(dirit &it, const char *name) free_value(dirit &it, const char *name)
{ {
free((void*)name); wqfree((void*)name);
} }
...@@ -38,10 +38,10 @@ struct cwork : public work { ...@@ -38,10 +38,10 @@ struct cwork : public work {
#define xallocwork(n) kmalloc(n, "xallocwork") #define xallocwork(n) kmalloc(n, "xallocwork")
#define xfreework(p, sz) kmfree(p, sz) #define xfreework(p, sz) kmfree(p, sz)
#else #else
extern void* allocwork(unsigned long nbytes); extern void* wqalloc(unsigned long nbytes);
extern void freework(void *ptr); extern void wqfree(void *ptr);
#define xallocwork(n) allocwork(n) #define xallocwork(n) wqalloc(n)
#define xfreework(n, sz) freework(n) #define xfreework(n, sz) wqfree(n)
#endif #endif
#include "wqfor.hh" #include "wqfor.hh"
...@@ -30,7 +30,7 @@ refill(void) ...@@ -30,7 +30,7 @@ refill(void)
} }
void* void*
allocwork(unsigned long nbytes) wqalloc(unsigned long nbytes)
{ {
assert(nbytes <= WQBLOCKSZ); assert(nbytes <= WQBLOCKSZ);
...@@ -44,7 +44,7 @@ allocwork(unsigned long nbytes) ...@@ -44,7 +44,7 @@ allocwork(unsigned long nbytes)
} }
void void
freework(void *ptr) wqfree(void *ptr)
{ {
wqblock* b = (wqblock*) ptr; wqblock* b = (wqblock*) ptr;
b->next = *block; b->next = *block;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论