From: Thomas Veerman Date: Wed, 12 Aug 2009 19:57:37 +0000 (+0000) Subject: - Moved (u)mount prototypes from unistd.h to sys/mount.h. X-Git-Tag: v3.1.5~205 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=c2ffe723d1ab237ffd801657f2c50f5d095a406a;p=minix.git - 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. --- diff --git a/commands/simple/badblocks.c b/commands/simple/badblocks.c index e5d59e9ca..1ff680200 100755 --- a/commands/simple/badblocks.c +++ b/commands/simple/badblocks.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/commands/simple/mount.c b/commands/simple/mount.c index 3ee188eaf..7f0aef6b2 100755 --- a/commands/simple/mount.c +++ b/commands/simple/mount.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/commands/simple/newroot.c b/commands/simple/newroot.c index f979dabe0..0fa1fd77e 100644 --- a/commands/simple/newroot.c +++ b/commands/simple/newroot.c @@ -8,7 +8,7 @@ Replace the current root with a new one #include #include #include -#include +#include int main(int argc, char *argv[]) { diff --git a/commands/simple/umount.c b/commands/simple/umount.c index 8904ae1bf..893a4c4eb 100755 --- a/commands/simple/umount.c +++ b/commands/simple/umount.c @@ -13,6 +13,7 @@ #include #include #include +#include #include _PROTOTYPE(int main, (int argc, char **argv)); diff --git a/include/sys/mount.h b/include/sys/mount.h new file mode 100755 index 000000000..10d48c687 --- /dev/null +++ b/include/sys/mount.h @@ -0,0 +1,21 @@ +/* + * definitions for mount(2) + */ + +#ifndef _MOUNT_H +#define _MOUNT_H + +#define MS_RDONLY 0x001 /* Mount device read only */ +#define MS_REUSE 0x002 /* Tell RS to try reusing binary from memory */ + + +/* Function Prototypes. */ +#ifndef _ANSI_H +#include +#endif + +_PROTOTYPE( int mount, (char *_spec, char *_name, int _mountflags, + char *type, char *args) ); +_PROTOTYPE( int umount, (const char *_name) ); + +#endif /* _MOUNT_H */ diff --git a/include/unistd.h b/include/unistd.h index 0e52d10f2..01346a0ce 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -171,13 +171,10 @@ _PROTOTYPE( int mknod, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr) ); _PROTOTYPE( int mknod4, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr, long _size) ); _PROTOTYPE( char *mktemp, (char *_template) ); -_PROTOTYPE( int mount, (char *_spec, char *_name, int _flag, - char *type, char *args) ); _PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) ); _PROTOTYPE( char *sbrk, (int _incr) ); _PROTOTYPE( int sync, (void) ); _PROTOTYPE( int fsync, (int fd) ); -_PROTOTYPE( int umount, (const char *_name) ); _PROTOTYPE( int reboot, (int _how, ...) ); _PROTOTYPE( int gethostname, (char *_hostname, size_t _len) ); _PROTOTYPE( int getdomainname, (char *_domain, size_t _len) ); diff --git a/lib/posix/_mount.c b/lib/posix/_mount.c index 8d7adda29..16975923c 100755 --- a/lib/posix/_mount.c +++ b/lib/posix/_mount.c @@ -3,7 +3,7 @@ #define mount _mount #define umount _umount #include -#include +#include #include #include #include @@ -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; diff --git a/man/man2/mount.2 b/man/man2/mount.2 index fa7780823..2a03e3dc2 100644 --- a/man/man2/mount.2 +++ b/man/man2/mount.2 @@ -4,10 +4,9 @@ mount, umount \- mount or umount a file system .SH SYNOPSIS .ft B .nf -#include #include -int mount(char *\fIspecial\fP, char *\fIname\fP, int \fIflag\fP, char *\fItype\fP, char *\fIargs\fP) +int mount(char *\fIspecial\fP, char *\fIname\fP, int \fImountflags\fP, char *\fItype\fP, char *\fIargs\fP) int umount(char *\fIname\fP) .fi .ft P