summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt10
-rw-r--r--nmount.c19
2 files changed, 23 insertions, 6 deletions
diff --git a/README.txt b/README.txt
index e5ed452..f253022 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,12 @@
nmount -t proc -d /proc2 -f nosuid,nodev,noexec
nmount -v -t proc -d /Process -f nosuid,nodev,noexec
-nmount -v -t ext4 -s /dev/mmcblk0p7 -d /mnt/disk0 -f nodev,noexec,nosuid \ No newline at end of file
+nmount -v -t ext4 -s /dev/mmcblk0p7 -d /mnt/disk0 -f nodev,noexec,nosuid
+
+#mount proc
+nmount_static -v -t proc -d /Process -f nosuid
+#mount dev
+nmount_static -v -t devtmpfs -d /Devices -f nosuid,nodev,nosuid
+#mount sys
+nmount_static -v -t sysfs -d /System -f nosuid,nodec,nosuid
+#mount other disk \ No newline at end of file
diff --git a/nmount.c b/nmount.c
index 94ed76d..7746855 100644
--- a/nmount.c
+++ b/nmount.c
@@ -86,11 +86,11 @@ static const struct vfs {
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", 0, NULL},
+ {"devtmpfs", 0, "/Device", 1, 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},
+ {"sysfs", 0, "/System", 1, NULL},
{"ext4", 0, NULL, 0, NULL},
{"vfat", 0, NULL, 0, NULL},
{NULL, 0, NULL, 0, NULL},
@@ -126,6 +126,8 @@ typedef struct {
int f_helper;
} mount_params;
+#define VERBOSE() if (g_params.f_verbose == 1)
+
static mount_params g_params;
void helper(char *progname)
@@ -319,19 +321,24 @@ int main(int argc, char **argv)
{
//find index of fs in fs table
fs_idx = get_fs_idx(g_params.f_type); //should allways be possitive as its allready checked
+ VERBOSE() printf("Filesystem is have index %d\n",fs_idx);
+
}
+ } else {
+ printf("Filesystem type is not set\n");
+ return -1;
}
if (NULL != g_params.f_flags)
{
char *token = strtok(g_params.f_flags,",");
- printf("Flags: %d\n",g_params.mount_flags);
+ VERBOSE() printf("Flags: %d\n",g_params.mount_flags);
while ( token != NULL )
{
- printf("Flags: %s\n",token);
+ VERBOSE() printf("Flags: %s\n",token);
g_params.mount_flags |= str2flag(token);
- printf("Flags: %d\n",g_params.mount_flags);
+ VERBOSE() printf("Flags: %d\n",g_params.mount_flags);
token = strtok(NULL,",");
}
}
@@ -339,10 +346,12 @@ int main(int argc, char **argv)
//if target dir is defined use it
if (NULL != g_params.f_target_dir)
{
+ VERBOSE() printf("Target dir %s\n",g_params.f_target_dir);
mkdir(g_params.f_target_dir, 0000);
//if target dir is not define use default one
} else {
g_params.f_target_dir = vfstab[fs_idx].mountpoint;
+ VERBOSE() printf("Default target dir is set to %s\n",g_params.f_target_dir);
mkdir(g_params.f_target_dir, 0000);
}