- Moved (u)mount prototypes from unistd.h to sys/mount.h.

- Prepared mount system call to accept multiple mount flags
   instead of just read_only (however, it remains backwards
   compatible).
 - Updated the man mount(2) to reflect new header file usage. 
 - Updated badblocks, newroot, mount, and umount commands to use the
   new header file.
This commit is contained in:
Thomas Veerman
2009-08-12 19:57:37 +00:00
parent 1defc4fc3a
commit c2ffe723d1
8 changed files with 37 additions and 11 deletions

View File

@@ -3,7 +3,7 @@
#define mount _mount
#define umount _umount
#include <string.h>
#include <unistd.h>
#include <sys/mount.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
@@ -46,9 +46,9 @@ PRIVATE char *makelabel(_CONST char *special)
return label;
}
PUBLIC int mount(special, name, rwflag, type, args)
PUBLIC int mount(special, name, mountflags, type, args)
char *name, *special, *type, *args;
int rwflag;
int mountflags;
{
int r;
message m;
@@ -59,10 +59,12 @@ int rwflag;
char cmd[200];
FILE *pipe;
int ep;
int reuse;
/* Default values. */
if (type == NULL) type = FSDEFAULT;
if (args == NULL) args = "";
reuse = 0;
/* Make FS process label for RS from special name. */
if(!(label=makelabel(special))) {
@@ -93,6 +95,11 @@ int rwflag;
return -1;
}
if(mountflags & MS_REUSE) {
reuse = 1;
mountflags &= ~MS_REUSE; /* Temporary: turn off to not confuse VFS */
}
sprintf(cmd, _PATH_SERVICE " up %s -label '%s' -config " _PATH_DRIVERS_CONF
" -args '%s%s' -printep yes",
path, label, args[0] ? "-o " : "", args);
@@ -112,7 +119,7 @@ int rwflag;
/* Now perform mount(). */
m.m1_i1 = strlen(special) + 1;
m.m1_i2 = strlen(name) + 1;
m.m1_i3 = rwflag;
m.m1_i3 = mountflags;
m.m1_p1 = special;
m.m1_p2 = name;
m.m1_p3 = (char*) ep;