From a9d8b8915e5d9f9d2bb30ac94a882795d2a2d517 Mon Sep 17 00:00:00 2001 From: dianshi Date: Sat, 27 Jun 2020 11:47:52 +0100 Subject: Add support for non source fs --- Makefile | 5 ++++- nmount.c | 57 +++++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 5f8c38a..3ebdd49 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ make: gcc -Wall nmount.c -o nmount - gcc -static nmount.c -o nmount_static \ No newline at end of file + gcc -static nmount.c -o nmount_static + +clean: + rm nmount nmount_static \ No newline at end of file diff --git a/nmount.c b/nmount.c index 8142531..94ed76d 100644 --- a/nmount.c +++ b/nmount.c @@ -80,19 +80,20 @@ vfs_options vfs_options_proc[] = static const struct vfs { - char *name; - long flags; - char *mountpoint; - vfs_options *options; + char *name; //filesystem name + long flags; //dunno + char *mountpoint; //default mount point if mount dir is not set + int nosource; //does fs have source or not + vfs_options *options; //hellpers to show all possible options to config fs mount } vfstab[] = { - {"devtmpfs", 0, "/Device", NULL}, - {"mqueue", 0, "/MQueue/", NULL}, - {"proc", 0, "/Process", (struct vfs_options*)&vfs_options_proc}, - {"tmpfs", 0, "/Ram", NULL}, - {"sysfs", 0, "/System", NULL}, - {"ext4", 0, NULL, NULL}, - {"vfat", 0, NULL, NULL}, - {NULL, 0, NULL, NULL}, + {"devtmpfs", 0, "/Device", 0, NULL}, + {"mqueue", 0, "/MQueue/", 0, NULL}, + {"proc", 0, "/Process", 1, (struct vfs_options*)&vfs_options_proc}, + {"tmpfs", 0, "/Ram", 0, NULL}, + {"sysfs", 0, "/System", 0, NULL}, + {"ext4", 0, NULL, 0, NULL}, + {"vfat", 0, NULL, 0, NULL}, + {NULL, 0, NULL, 0, NULL}, }; static const struct mount_flags @@ -173,6 +174,19 @@ int check_filetype(char *fsname) return 0; } +int get_fs_idx(char *fsname) +{ + int i; + for (i=0;i