From ef9dc93f44157dea667de514ba31c214ccba64cc Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Sun, 24 Aug 2014 11:53:52 +0000 Subject: [PATCH] Clean up obsolete FS support routines Change-Id: I56d0ab51f32064bb964051732de7e2465dc22b75 --- minix/include/minix/libminixfs.h | 8 ------ minix/include/minix/minlib.h | 1 - minix/lib/libc/gen/fslib.c | 19 ------------- minix/lib/libminixfs/Makefile | 2 +- minix/lib/libminixfs/cache.c | 35 ------------------------ minix/lib/libminixfs/fetch_credentials.c | 31 --------------------- 6 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 minix/lib/libminixfs/fetch_credentials.c diff --git a/minix/include/minix/libminixfs.h b/minix/include/minix/libminixfs.h index a0369904b..20fff4152 100644 --- a/minix/include/minix/libminixfs.h +++ b/minix/include/minix/libminixfs.h @@ -3,9 +3,6 @@ #ifndef _MINIX_FSLIB_H #define _MINIX_FSLIB_H -#include -#include -#include #include struct buf { @@ -30,9 +27,6 @@ struct buf { u64_t lmfs_inode_offset; }; -int fs_lookup_credentials(vfs_ucred_t *credentials, - uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size); - void lmfs_markdirty(struct buf *bp); void lmfs_markclean(struct buf *bp); int lmfs_isclean(struct buf *bp); @@ -55,7 +49,6 @@ void lmfs_invalidate(dev_t device); void lmfs_put_block(struct buf *bp, int block_type); void lmfs_rw_scattered(dev_t, struct buf **, int, int); void lmfs_setquiet(int q); -int lmfs_do_bpeek(message *); void lmfs_cache_reevaluate(dev_t dev); void lmfs_blockschange(dev_t dev, int delta); @@ -86,4 +79,3 @@ ssize_t lmfs_bio(dev_t dev, struct fsdriver_data *data, size_t bytes, void lmfs_bflush(dev_t dev); #endif /* _MINIX_FSLIB_H */ - diff --git a/minix/include/minix/minlib.h b/minix/include/minix/minlib.h index 1e66eae99..52059eb5a 100644 --- a/minix/include/minix/minlib.h +++ b/minix/include/minix/minlib.h @@ -13,7 +13,6 @@ int fsversion(char *_dev, char *_prog); int getprocessor(void); void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); int load_mtab(char *_prog_name); -uint8_t fs_mode_to_type(mode_t mode); int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX], char type[MNTNAMELEN], char flags[MNTFLAGLEN]); diff --git a/minix/lib/libc/gen/fslib.c b/minix/lib/libc/gen/fslib.c index 4e54cae16..58f01e78c 100644 --- a/minix/lib/libc/gen/fslib.c +++ b/minix/lib/libc/gen/fslib.c @@ -8,7 +8,6 @@ #include #include #include /* for unshort :-( */ -#include #include #include #include "mfs/const.h" /* depends of -I flag in Makefile */ @@ -16,7 +15,6 @@ #include "mfs/inode.h" /* ditto */ #include "mfs/super.h" #include -#include /* The next routine is copied from fsck.c and mkfs.c... (Re)define some * things for consistency. Some things should be done better. @@ -46,20 +44,3 @@ int block_size; if (((bit_t) nr_blocks * FS_BITS_PER_BLOCK(block_size)) < nr_bits) ++nr_blocks; return(nr_blocks); } - -uint8_t fs_mode_to_type(mode_t mode) -{ - if(S_ISREG(mode)) return DT_REG; - else if(S_ISDIR(mode)) return DT_DIR; - else if(S_ISLNK(mode)) return DT_LNK; - else if(S_ISCHR(mode)) return DT_CHR; - else if(S_ISBLK(mode)) return DT_BLK; - else if(S_ISFIFO(mode)) return DT_FIFO; - else if(S_ISSOCK(mode)) return DT_SOCK; - - assert(0 && "unknown type"); - - /* assert()s are removed on NDEBUG builds. */ - abort(); -} - diff --git a/minix/lib/libminixfs/Makefile b/minix/lib/libminixfs/Makefile index 5a3578eb2..0426137c7 100644 --- a/minix/lib/libminixfs/Makefile +++ b/minix/lib/libminixfs/Makefile @@ -6,6 +6,6 @@ CPPFLAGS+= -D_MINIX_SYSTEM .include LIB= minixfs -SRCS= fetch_credentials.c cache.c bio.c +SRCS= cache.c bio.c .include diff --git a/minix/lib/libminixfs/cache.c b/minix/lib/libminixfs/cache.c index aba2a9bb9..8c410981a 100644 --- a/minix/lib/libminixfs/cache.c +++ b/minix/lib/libminixfs/cache.c @@ -931,38 +931,3 @@ int lmfs_rdwt_err(void) { return rdwt_err; } - -int lmfs_do_bpeek(message *m) -{ - block_t startblock, b, limitblock; - dev_t dev = m->m_vfs_fs_breadwrite.device; - off_t extra, pos = m->m_vfs_fs_breadwrite.seek_pos; - size_t len = m->m_vfs_fs_breadwrite.nbytes; - struct buf *bp; - - assert(m->m_type == REQ_BPEEK); - assert(fs_block_size > 0); - assert(dev != NO_DEV); - - if(!vmcache) { return ENXIO; } - - assert(!(fs_block_size % PAGE_SIZE)); - - if((extra=(pos % fs_block_size))) { - pos -= extra; - len += extra; - } - - len = roundup(len, fs_block_size); - - startblock = pos/fs_block_size; - limitblock = startblock + len/fs_block_size; - - for(b = startblock; b < limitblock; b++) { - bp = lmfs_get_block(dev, b, NORMAL); - assert(bp); - lmfs_put_block(bp, FULL_DATA_BLOCK); - } - - return OK; -} diff --git a/minix/lib/libminixfs/fetch_credentials.c b/minix/lib/libminixfs/fetch_credentials.c deleted file mode 100644 index 34fb6fd35..000000000 --- a/minix/lib/libminixfs/fetch_credentials.c +++ /dev/null @@ -1,31 +0,0 @@ - -#include -#include -#include -#include -#include - -#include "minixfs.h" - -int fs_lookup_credentials(vfs_ucred_t *credentials, - uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size) -{ - int r; - - memset(credentials, 0, sizeof(*credentials)); - - r = sys_safecopyfrom(VFS_PROC_NR, grant2, (vir_bytes) 0, - (vir_bytes) credentials, cred_size); - if (r != OK) { - printf("FS: cred copy failed\n"); - return(r); - } - - assert(credentials->vu_ngroups <= NGROUPS_MAX); - - *caller_uid = credentials->vu_uid; - *caller_gid = credentials->vu_gid; - - return OK; -} -