fs: reorginize memory allocations and frees
This commit is contained in:
parent
aee65e1dd2
commit
070af3aba0
4 changed files with 65 additions and 29 deletions
|
|
@ -65,15 +65,16 @@ struct vnode {
|
|||
struct vnode *next;
|
||||
|
||||
struct dirent *dirents; /* for directories */
|
||||
size_t num_dirents;
|
||||
|
||||
bool mount_ptr; /* does this node point to a root of a mounted fs? */
|
||||
bool no_free; /* permanently cached vnodes */
|
||||
};
|
||||
|
||||
struct dirent {
|
||||
uint64_t inode;
|
||||
uint16_t reclen;
|
||||
ftype_t type;
|
||||
uint64_t inode; /* fs-specific inode number */
|
||||
uint16_t reclen; /* length of this record */
|
||||
ftype_t type; /* type: file, dir, chrdev, blkdev, etc. */
|
||||
char name[256];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@
|
|||
#define ALLOC_KERN 0x01
|
||||
#define ALLOC_DMA 0x02
|
||||
|
||||
#define ATTEMPT_FREE(_x) \
|
||||
if (_x) { \
|
||||
kfree(_x); \
|
||||
_x = NULL; \
|
||||
}
|
||||
|
||||
typedef struct _slab {
|
||||
size_t size; /* size of each object */
|
||||
size_t tsize; /* total size of this slab */
|
||||
|
|
|
|||
Loading…
Reference in a new issue