From 78cfc9712b4aeddee6126ca794fd47b59a98bcf7 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Mon, 17 Mar 2014 14:01:22 +0100 Subject: [PATCH] Prefix libc (u)mount with minix_ The goal is to prevent a name collision with the expected mount/umount function signatures, if we decide one day to allow any application using those to work on MINIX. At this moment the caller has to start the required services, but if we implement that logic inside the mount/unmout function, this would allow any application to call those function successfully. By renaming those now, we prevent a possible ABI break in the future. Change-Id: Iaf6a9472bca0dda6bfe634bdb6029b3aa2e1ea3b --- commands/mount/mount.c | 4 ++-- commands/umount/umount.c | 2 +- lib/libc/sys-minix/mount.c | 4 ++-- man/man2/mount.2 | 4 ++-- sys/sys/mount.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/commands/mount/mount.c b/commands/mount/mount.c index fa34bcccd..e3e968b84 100644 --- a/commands/mount/mount.c +++ b/commands/mount/mount.c @@ -76,7 +76,7 @@ char *argv[]; } } - if (mount(device, argv[2], mountflags, srvflags, type, args) < 0) { + if (minix_mount(device, argv[2], mountflags, srvflags, type, args) < 0) { err = strerror(errno); fprintf(stderr, "mount: Can't mount %s on %s: %s\n", argv[1], argv[2], err); @@ -153,7 +153,7 @@ mount_all() if (!strcmp(device, "none")) device = NULL; - if (mount(device, mountpoint, mountflags, 0, fs->fs_vfstype, + if (minix_mount(device, mountpoint, mountflags, 0, fs->fs_vfstype, fs->fs_mntops) != 0) { err = strerror(errno); fprintf(stderr, "mount: Can't mount %s on %s: %s\n", diff --git a/commands/umount/umount.c b/commands/umount/umount.c index b724a7a11..411a9da5b 100644 --- a/commands/umount/umount.c +++ b/commands/umount/umount.c @@ -47,7 +47,7 @@ char *argv[]; found = find_mtab_entry(name); - if (umount(name, umount_flags) < 0) { + if (minix_umount(name, umount_flags) < 0) { if (errno == EINVAL) std_err("umount: Device not mounted\n"); else if (errno == ENOTBLK) diff --git a/lib/libc/sys-minix/mount.c b/lib/libc/sys-minix/mount.c index 6ca0543a8..3f942b744 100644 --- a/lib/libc/sys-minix/mount.c +++ b/lib/libc/sys-minix/mount.c @@ -28,7 +28,7 @@ static int rs_down(char *label) char *find_rslabel(char *args_line); -int mount(char *special, char *name, int mountflags, int srvflags, +int minix_mount(char *special, char *name, int mountflags, int srvflags, char *type, char *args) { int r; @@ -165,7 +165,7 @@ int mount(char *special, char *name, int mountflags, int srvflags, return r; } -int umount(const char *name, int srvflags) +int minix_umount(const char *name, int srvflags) { char label[MNT_LABEL_LEN]; message m; diff --git a/man/man2/mount.2 b/man/man2/mount.2 index 78d762fea..afad7c972 100644 --- a/man/man2/mount.2 +++ b/man/man2/mount.2 @@ -6,8 +6,8 @@ mount, umount \- mount or umount a file system .nf #include -int mount(char *\fIspecial\fP, char *\fIname\fP, int \fImountflags\fP, int \fIsrvflags\fP, char *\fItype\fP, char *\fIargs\fP) -int umount(char *\fIname\fP, int \fIsrvflags) +int minix_mount(char *\fIspecial\fP, char *\fIname\fP, int \fImountflags\fP, int \fIsrvflags\fP, char *\fItype\fP, char *\fIargs\fP) +int minix_umount(char *\fIname\fP, int \fIsrvflags) .fi .ft P .SH DESCRIPTION diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 7cfdb8648..b197461e0 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -480,7 +480,7 @@ int getfh(const char *, void *, size_t *) #if !defined(__minix) int unmount(const char *, int); #else -int umount(const char *_name, int srvflags); +int minix_umount(const char *_name, int srvflags); #endif /* !defined(__minix) */ #if defined(_NETBSD_SOURCE) @@ -488,7 +488,7 @@ int umount(const char *_name, int srvflags); #if !defined(__minix) int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50); #else -int mount(char *_spec, char *_name, int _mountflags, int srvflags, char *type, +int minix_mount(char *_spec, char *_name, int _mountflags, int srvflags, char *type, char *args); #endif /* !defined(__minix) */ int fhopen(const void *, size_t, int) __RENAME(__fhopen40); -- 2.44.0