From 5500b880eabb042d97e2a6bf7495d872f20dcf98 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 10 Apr 2018 23:16:42 +0100 Subject: [PATCH] superblock: get the kernel inoptr out of the superblock Put it in the memory only area where it belongs --- Kernel/filesys.c | 6 +++--- Kernel/include/kernel.h | 2 +- Kernel/syscall_other.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kernel/filesys.c b/Kernel/filesys.c index 675995db..247f6141 100644 --- a/Kernel/filesys.c +++ b/Kernel/filesys.c @@ -112,7 +112,7 @@ inoptr n_open(char *namep, inoptr *parent) name += 2; continue; } - temp = fs_tab[wd->c_super].m_fs.s_mntpt; + temp = fs_tab[wd->c_super].m_mntpt; ++temp->c_refs; i_deref(wd); wd = temp; @@ -193,7 +193,7 @@ inoptr srch_mt(inoptr ino) struct mount *m = &fs_tab[0]; for(j=0; j < NMOUNTS; ++j){ - if(m->m_dev != NO_DEVICE && m->m_fs.s_mntpt == ino) { + if(m->m_dev != NO_DEVICE && m->m_mntpt == ino) { i_deref(ino); return i_open(m->m_dev, ROOTINODE); } @@ -1282,7 +1282,7 @@ bool fmount(uint16_t dev, inoptr ino, uint16_t flags) fp->s_fmod = FMOD_DIRTY; else /* Clean in memory, don't write it back to media */ fp->s_fmod = FMOD_CLEAN; - fp->s_mntpt = ino; + m->m_mntpt = ino; if(ino) ++ino->c_refs; m->m_flags = flags; diff --git a/Kernel/include/kernel.h b/Kernel/include/kernel.h index a736262d..9fa75e8d 100644 --- a/Kernel/include/kernel.h +++ b/Kernel/include/kernel.h @@ -338,7 +338,6 @@ typedef struct filesys { // note: exists in mem and on disk uint8_t s_shift; /* Extent size */ uint8_t s_reserved; /* Below this is only used in memory so alignments don't matter */ - inoptr s_mntpt; /* Mount point */ /* TODO: Add geometry hints and support > 512 byte blocks */ } filesys, *fsptr; @@ -353,6 +352,7 @@ typedef struct oft { struct mount { uint16_t m_dev; uint16_t m_flags; + inoptr m_mntpt; /* Mount point */ struct filesys m_fs; }; #define MS_RDONLY 1 diff --git a/Kernel/syscall_other.c b/Kernel/syscall_other.c index 3e9efbca..69fab02f 100644 --- a/Kernel/syscall_other.c +++ b/Kernel/syscall_other.c @@ -435,7 +435,7 @@ static int do_umount(uint16_t dev) return 0; } - i_deref(mnt->m_fs.s_mntpt); + i_deref(mnt->m_mntpt); /* Vanish the entry */ mnt->m_dev = NO_DEVICE; return 0; -- 2.34.1