Rewrite the kernel hashtable struct
This commit is contained in:
@ -54,7 +54,7 @@ int32_t vfs_stat(char *mountpoint, const char *path, IoctlStat *stat) {
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
HSHTB_GET(&VFS_TABLE, mountpoints, mountpoint, label, mp);
|
||||
HSHTB_GET(VFS_TABLE.mountpoints, label, mountpoint, mp);
|
||||
spinlock_release(&VFS_TABLE.spinlock);
|
||||
|
||||
if (mp == NULL) {
|
||||
@ -68,7 +68,7 @@ int32_t vfs_fetchdirent(char *mountpoint, const char *path, IoctlDirent *direntb
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
HSHTB_GET(&VFS_TABLE, mountpoints, mountpoint, label, mp);
|
||||
HSHTB_GET(VFS_TABLE.mountpoints, label, mountpoint, mp);
|
||||
spinlock_release(&VFS_TABLE.spinlock);
|
||||
|
||||
if (mp == NULL) {
|
||||
@ -82,7 +82,7 @@ int32_t vfs_mount(char *mountpoint, int32_t fstype, StoreDev *backingsd, bool fo
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
HSHTB_ALLOC(&VFS_TABLE, mountpoints, mountpoint, label, mp);
|
||||
HSHTB_ALLOC(VFS_TABLE.mountpoints, label, mountpoint, mp);
|
||||
spinlock_release(&VFS_TABLE.spinlock);
|
||||
|
||||
if (mp == NULL) {
|
||||
@ -107,7 +107,7 @@ int32_t vfs_unmount(char *mountpoint) {
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
HSHTB_GET(&VFS_TABLE, mountpoints, mountpoint, label, mp);
|
||||
HSHTB_GET(VFS_TABLE.mountpoints, label, mountpoint, mp);
|
||||
spinlock_release(&VFS_TABLE.spinlock);
|
||||
|
||||
if (mp == NULL) {
|
||||
@ -129,7 +129,7 @@ VfsObj *vfs_open(char *mountpoint, const char *path, uint32_t flags) {
|
||||
VfsMountPoint *mp = NULL;
|
||||
|
||||
spinlock_acquire(&VFS_TABLE.spinlock);
|
||||
HSHTB_GET(&VFS_TABLE, mountpoints, mountpoint, label, mp);
|
||||
HSHTB_GET(VFS_TABLE.mountpoints, label, mountpoint, mp);
|
||||
spinlock_release(&VFS_TABLE.spinlock);
|
||||
|
||||
if (mp == NULL) {
|
||||
@ -168,7 +168,7 @@ void vfs_init(void) {
|
||||
LOG("vfs", "init\n");
|
||||
|
||||
for (size_t i = 0; i < LEN(VFS_TABLE.mountpoints); i++) {
|
||||
if (!VFS_TABLE.mountpoints[i].taken) continue;
|
||||
if (VFS_TABLE.mountpoints[i]._hshtbstate != HSHTB_TAKEN) continue;
|
||||
VfsMountPoint *vmp = &VFS_TABLE.mountpoints[i];
|
||||
LOG("vfs", "mount point %s: %s, backing device: %s\n",
|
||||
vmp->label, vfs_strings[vmp->fstype], storedev_strings[vmp->backingsd->sdtype]);
|
||||
|
@ -42,8 +42,9 @@ typedef struct VfsObj {
|
||||
} VfsObj;
|
||||
|
||||
typedef struct VfsMountPoint {
|
||||
bool taken;
|
||||
uint8_t label[VFS_MOUNTPOINT_LABEL_MAX];
|
||||
int _hshtbstate;
|
||||
char label[VFS_MOUNTPOINT_LABEL_MAX];
|
||||
|
||||
int32_t fstype;
|
||||
StoreDev *backingsd;
|
||||
|
||||
|
Reference in New Issue
Block a user