- 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:
		
							parent
							
								
									1defc4fc3a
								
							
						
					
					
						commit
						c2ffe723d1
					
				@ -25,6 +25,7 @@
 | 
			
		||||
#include <minix/type.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
#include <dirent.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <dirent.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <minix/config.h>
 | 
			
		||||
#include <minix/const.h>
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@ Replace the current root with a new one
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -13,6 +13,7 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
_PROTOTYPE(int main, (int argc, char **argv));
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										21
									
								
								include/sys/mount.h
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								include/sys/mount.h
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
/* <sys/mount.h>
 | 
			
		||||
 * 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 <ansi.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
_PROTOTYPE( int mount, (char *_spec, char *_name, int _mountflags,
 | 
			
		||||
                                                char *type, char *args) );
 | 
			
		||||
_PROTOTYPE( int umount, (const char *_name)                             );
 | 
			
		||||
 | 
			
		||||
#endif /* _MOUNT_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)		);
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -4,10 +4,9 @@ mount, umount \- mount or umount a file system
 | 
			
		||||
.SH SYNOPSIS
 | 
			
		||||
.ft B
 | 
			
		||||
.nf
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user