aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-01 16:01:11 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-01 16:01:11 +0000
commitc4cef5ab063d7abb604d48610424566202dcade0 (patch)
treec661196acbb1adfa81257a7f23b08bd15d653be8
parentf77d88641d934fbd9ed0da8c8e31c84dc5856532 (diff)
downloadbusybox-w32-c4cef5ab063d7abb604d48610424566202dcade0.tar.gz
busybox-w32-c4cef5ab063d7abb604d48610424566202dcade0.tar.bz2
busybox-w32-c4cef5ab063d7abb604d48610424566202dcade0.zip
Move the mtab support stuff into libbb
-Erik
-rw-r--r--Config.h10
-rw-r--r--Makefile4
-rw-r--r--applets/usage.h2
-rw-r--r--debian/Config.h-deb10
-rw-r--r--debian/Config.h-static10
-rw-r--r--debian/Config.h-udeb10
-rw-r--r--include/usage.h2
-rw-r--r--libbb/mtab.c (renamed from mtab.c)2
-rw-r--r--libbb/mtab_file.c (renamed from mtab_file.c)2
-rw-r--r--mount.c4
-rw-r--r--umount.c8
-rw-r--r--usage.h2
-rw-r--r--util-linux/mount.c4
-rw-r--r--util-linux/umount.c8
14 files changed, 23 insertions, 55 deletions
diff --git a/Config.h b/Config.h
index 8c7684876..bd6366558 100644
--- a/Config.h
+++ b/Config.h
@@ -210,7 +210,7 @@
210#define BB_FEATURE_MOUNT_LOOP 210#define BB_FEATURE_MOUNT_LOOP
211// 211//
212// Enable support for a real /etc/mtab file instead of /proc/mounts 212// Enable support for a real /etc/mtab file instead of /proc/mounts
213//#define BB_FEATURE_MOUNT_MTAB_SUPPORT 213//#define BB_FEATURE_MTAB_SUPPORT
214// 214//
215// Enable support for mounting remote NFS volumes. 215// Enable support for mounting remote NFS volumes.
216// You may need to mount with "-o nolock" if you are 216// You may need to mount with "-o nolock" if you are
@@ -345,14 +345,6 @@
345// Nothing beyond this point should ever be touched by 345// Nothing beyond this point should ever be touched by
346// mere mortals so leave this stuff alone. 346// mere mortals so leave this stuff alone.
347// 347//
348#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
349 #ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
350 #define BB_MTAB
351 #endif
352#else
353 #undef BB_MTAB
354#endif
355//
356#if defined BB_SH 348#if defined BB_SH
357 #if defined BB_FEATURE_COMMAND_EDITING 349 #if defined BB_FEATURE_COMMAND_EDITING
358 #define BB_CMDEDIT 350 #define BB_CMDEDIT
diff --git a/Makefile b/Makefile
index ba2b2c3cb..231073a96 100644
--- a/Makefile
+++ b/Makefile
@@ -202,7 +202,7 @@ endif
202# And option 4: 202# And option 4:
203-include applet_source_list 203-include applet_source_list
204 204
205OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o messages.o usage.o applets.o mtab_file.o 205OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o messages.o usage.o applets.o
206CFLAGS += $(CROSS_CFLAGS) 206CFLAGS += $(CROSS_CFLAGS)
207CFLAGS += -DBB_VER='"$(VERSION)"' 207CFLAGS += -DBB_VER='"$(VERSION)"'
208CFLAGS += -DBB_BT='"$(BUILDTIME)"' 208CFLAGS += -DBB_BT='"$(BUILDTIME)"'
@@ -236,7 +236,7 @@ my_getgrgid.c my_getpwnamegid.c my_getpwuid.c my_getgrnam.c my_getpwnam.c \
236recursive_action.c safe_read.c safe_strncpy.c syscalls.c \ 236recursive_action.c safe_read.c safe_strncpy.c syscalls.c \
237syslog_msg_with_name.c time_string.c trim.c vdprintf.c wfopen.c xfuncs.c \ 237syslog_msg_with_name.c time_string.c trim.c vdprintf.c wfopen.c xfuncs.c \
238xregcomp.c error_msg_and_die.c perror_msg.c perror_msg_and_die.c \ 238xregcomp.c error_msg_and_die.c perror_msg.c perror_msg_and_die.c \
239verror_msg.c vperror_msg.c 239verror_msg.c vperror_msg.c mtab.c mtab_file.c
240LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC)) 240LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC))
241LIBBB_CFLAGS = -I$(LIBBB_DIR) 241LIBBB_CFLAGS = -I$(LIBBB_DIR)
242 242
diff --git a/applets/usage.h b/applets/usage.h
index 32b34e45f..1ee2ab328 100644
--- a/applets/usage.h
+++ b/applets/usage.h
@@ -1067,7 +1067,7 @@
1067#else 1067#else
1068 #define USAGE_MOUNT_LOOP(a) 1068 #define USAGE_MOUNT_LOOP(a)
1069#endif 1069#endif
1070#ifdef BB_MTAB 1070#ifdef BB_FEATURE_MTAB_SUPPORT
1071 #define USAGE_MTAB(a) a 1071 #define USAGE_MTAB(a) a
1072#else 1072#else
1073 #define USAGE_MTAB(a) 1073 #define USAGE_MTAB(a)
diff --git a/debian/Config.h-deb b/debian/Config.h-deb
index 075e23557..606204bfe 100644
--- a/debian/Config.h-deb
+++ b/debian/Config.h-deb
@@ -208,7 +208,7 @@
208#define BB_FEATURE_MOUNT_LOOP 208#define BB_FEATURE_MOUNT_LOOP
209// 209//
210// Enable support for a real /etc/mtab file instead of /proc/mounts 210// Enable support for a real /etc/mtab file instead of /proc/mounts
211//#define BB_FEATURE_MOUNT_MTAB_SUPPORT 211//#define BB_FEATURE_MTAB_SUPPORT
212// 212//
213// Enable support for mounting remote NFS volumes. 213// Enable support for mounting remote NFS volumes.
214// You may need to mount with "-o nolock" if you are 214// You may need to mount with "-o nolock" if you are
@@ -343,14 +343,6 @@
343// Nothing beyond this point should ever be touched by 343// Nothing beyond this point should ever be touched by
344// mere mortals so leave this stuff alone. 344// mere mortals so leave this stuff alone.
345// 345//
346#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
347 #ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
348 #define BB_MTAB
349 #endif
350#else
351 #undef BB_MTAB
352#endif
353//
354#if defined BB_SH 346#if defined BB_SH
355 #if defined BB_FEATURE_COMMAND_EDITING 347 #if defined BB_FEATURE_COMMAND_EDITING
356 #define BB_CMDEDIT 348 #define BB_CMDEDIT
diff --git a/debian/Config.h-static b/debian/Config.h-static
index fc89e329d..4cde55fda 100644
--- a/debian/Config.h-static
+++ b/debian/Config.h-static
@@ -208,7 +208,7 @@
208#define BB_FEATURE_MOUNT_LOOP 208#define BB_FEATURE_MOUNT_LOOP
209// 209//
210// Enable support for a real /etc/mtab file instead of /proc/mounts 210// Enable support for a real /etc/mtab file instead of /proc/mounts
211//#define BB_FEATURE_MOUNT_MTAB_SUPPORT 211//#define BB_FEATURE_MTAB_SUPPORT
212// 212//
213// Enable support for mounting remote NFS volumes. 213// Enable support for mounting remote NFS volumes.
214// You may need to mount with "-o nolock" if you are 214// You may need to mount with "-o nolock" if you are
@@ -343,14 +343,6 @@
343// Nothing beyond this point should ever be touched by 343// Nothing beyond this point should ever be touched by
344// mere mortals so leave this stuff alone. 344// mere mortals so leave this stuff alone.
345// 345//
346#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
347 #ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
348 #define BB_MTAB
349 #endif
350#else
351 #undef BB_MTAB
352#endif
353//
354#if defined BB_SH 346#if defined BB_SH
355 #if defined BB_FEATURE_COMMAND_EDITING 347 #if defined BB_FEATURE_COMMAND_EDITING
356 #define BB_CMDEDIT 348 #define BB_CMDEDIT
diff --git a/debian/Config.h-udeb b/debian/Config.h-udeb
index 4028a71da..7aeba2873 100644
--- a/debian/Config.h-udeb
+++ b/debian/Config.h-udeb
@@ -208,7 +208,7 @@
208#define BB_FEATURE_MOUNT_LOOP 208#define BB_FEATURE_MOUNT_LOOP
209// 209//
210// Enable support for a real /etc/mtab file instead of /proc/mounts 210// Enable support for a real /etc/mtab file instead of /proc/mounts
211//#define BB_FEATURE_MOUNT_MTAB_SUPPORT 211//#define BB_FEATURE_MTAB_SUPPORT
212// 212//
213// Enable support for mounting remote NFS volumes. 213// Enable support for mounting remote NFS volumes.
214// You may need to mount with "-o nolock" if you are 214// You may need to mount with "-o nolock" if you are
@@ -343,14 +343,6 @@
343// Nothing beyond this point should ever be touched by 343// Nothing beyond this point should ever be touched by
344// mere mortals so leave this stuff alone. 344// mere mortals so leave this stuff alone.
345// 345//
346#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
347 #ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
348 #define BB_MTAB
349 #endif
350#else
351 #undef BB_MTAB
352#endif
353//
354#if defined BB_SH 346#if defined BB_SH
355 #if defined BB_FEATURE_COMMAND_EDITING 347 #if defined BB_FEATURE_COMMAND_EDITING
356 #define BB_CMDEDIT 348 #define BB_CMDEDIT
diff --git a/include/usage.h b/include/usage.h
index 32b34e45f..1ee2ab328 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1067,7 +1067,7 @@
1067#else 1067#else
1068 #define USAGE_MOUNT_LOOP(a) 1068 #define USAGE_MOUNT_LOOP(a)
1069#endif 1069#endif
1070#ifdef BB_MTAB 1070#ifdef BB_FEATURE_MTAB_SUPPORT
1071 #define USAGE_MTAB(a) a 1071 #define USAGE_MTAB(a) a
1072#else 1072#else
1073 #define USAGE_MTAB(a) 1073 #define USAGE_MTAB(a)
diff --git a/mtab.c b/libbb/mtab.c
index 049765775..28c9978ef 100644
--- a/mtab.c
+++ b/libbb/mtab.c
@@ -5,7 +5,7 @@
5#include <string.h> 5#include <string.h>
6#include <stdio.h> 6#include <stdio.h>
7#include <mntent.h> 7#include <mntent.h>
8#include "busybox.h" 8#include "libbb.h"
9 9
10extern const char mtab_file[]; /* Defined in utility.c */ 10extern const char mtab_file[]; /* Defined in utility.c */
11static const int MS_RDONLY = 1; /* Mount read-only. */ 11static const int MS_RDONLY = 1; /* Mount read-only. */
diff --git a/mtab_file.c b/libbb/mtab_file.c
index 3235e35d6..d9c3de3c3 100644
--- a/mtab_file.c
+++ b/libbb/mtab_file.c
@@ -26,7 +26,7 @@
26 */ 26 */
27 27
28#include <stdio.h> 28#include <stdio.h>
29#include "busybox.h" 29#include "libbb.h"
30 30
31 31
32/* Busybox mount uses either /proc/mounts or /dev/mtab to 32/* Busybox mount uses either /proc/mounts or /dev/mtab to
diff --git a/mount.c b/mount.c
index 9f7ac43c1..57dc73e55 100644
--- a/mount.c
+++ b/mount.c
@@ -160,7 +160,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
160 /* If the mount was sucessful, do anything needed, then return TRUE */ 160 /* If the mount was sucessful, do anything needed, then return TRUE */
161 if (status == 0 || fakeIt==TRUE) { 161 if (status == 0 || fakeIt==TRUE) {
162 162
163#if defined BB_MTAB 163#if defined BB_FEATURE_MTAB_SUPPORT
164 if (useMtab == TRUE) { 164 if (useMtab == TRUE) {
165 erase_mtab(specialfile); // Clean any stale entries 165 erase_mtab(specialfile); // Clean any stale entries
166 write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts); 166 write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts);
@@ -385,7 +385,7 @@ extern int mount_main(int argc, char **argv)
385 case 'f': 385 case 'f':
386 fakeIt = TRUE; 386 fakeIt = TRUE;
387 break; 387 break;
388#ifdef BB_MTAB 388#ifdef BB_FEATURE_MTAB_SUPPORT
389 case 'n': 389 case 'n':
390 useMtab = FALSE; 390 useMtab = FALSE;
391 break; 391 break;
diff --git a/umount.c b/umount.c
index cc7d38d7c..3e23b9705 100644
--- a/umount.c
+++ b/umount.c
@@ -57,7 +57,7 @@ static int doForce = FALSE;
57#if defined BB_FEATURE_MOUNT_LOOP 57#if defined BB_FEATURE_MOUNT_LOOP
58static int freeLoop = TRUE; 58static int freeLoop = TRUE;
59#endif 59#endif
60#if defined BB_MTAB 60#if defined BB_FEATURE_MTAB_SUPPORT
61static int useMtab = TRUE; 61static int useMtab = TRUE;
62#endif 62#endif
63static int umountAll = FALSE; 63static int umountAll = FALSE;
@@ -106,7 +106,7 @@ char *mtab_getinfo(const char *match, const char which)
106 if (which == MTAB_GETMOUNTPT) { 106 if (which == MTAB_GETMOUNTPT) {
107 return cur->mountpt; 107 return cur->mountpt;
108 } else { 108 } else {
109#if !defined BB_MTAB 109#if !defined BB_FEATURE_MTAB_SUPPORT
110 if (strcmp(cur->device, "/dev/root") == 0) { 110 if (strcmp(cur->device, "/dev/root") == 0) {
111 /* Adjusts device to be the real root device, 111 /* Adjusts device to be the real root device,
112 * or leaves device alone if it can't find it */ 112 * or leaves device alone if it can't find it */
@@ -197,7 +197,7 @@ static int do_umount(const char *name)
197 } 197 }
198 } 198 }
199 if (status == 0) { 199 if (status == 0) {
200#if defined BB_MTAB 200#if defined BB_FEATURE_MTAB_SUPPORT
201 if (useMtab == TRUE) 201 if (useMtab == TRUE)
202 erase_mtab(name); 202 erase_mtab(name);
203#endif 203#endif
@@ -255,7 +255,7 @@ extern int umount_main(int argc, char **argv)
255 freeLoop = FALSE; 255 freeLoop = FALSE;
256 break; 256 break;
257#endif 257#endif
258#ifdef BB_MTAB 258#ifdef BB_FEATURE_MTAB_SUPPORT
259 case 'n': 259 case 'n':
260 useMtab = FALSE; 260 useMtab = FALSE;
261 break; 261 break;
diff --git a/usage.h b/usage.h
index 32b34e45f..1ee2ab328 100644
--- a/usage.h
+++ b/usage.h
@@ -1067,7 +1067,7 @@
1067#else 1067#else
1068 #define USAGE_MOUNT_LOOP(a) 1068 #define USAGE_MOUNT_LOOP(a)
1069#endif 1069#endif
1070#ifdef BB_MTAB 1070#ifdef BB_FEATURE_MTAB_SUPPORT
1071 #define USAGE_MTAB(a) a 1071 #define USAGE_MTAB(a) a
1072#else 1072#else
1073 #define USAGE_MTAB(a) 1073 #define USAGE_MTAB(a)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 9f7ac43c1..57dc73e55 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -160,7 +160,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
160 /* If the mount was sucessful, do anything needed, then return TRUE */ 160 /* If the mount was sucessful, do anything needed, then return TRUE */
161 if (status == 0 || fakeIt==TRUE) { 161 if (status == 0 || fakeIt==TRUE) {
162 162
163#if defined BB_MTAB 163#if defined BB_FEATURE_MTAB_SUPPORT
164 if (useMtab == TRUE) { 164 if (useMtab == TRUE) {
165 erase_mtab(specialfile); // Clean any stale entries 165 erase_mtab(specialfile); // Clean any stale entries
166 write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts); 166 write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts);
@@ -385,7 +385,7 @@ extern int mount_main(int argc, char **argv)
385 case 'f': 385 case 'f':
386 fakeIt = TRUE; 386 fakeIt = TRUE;
387 break; 387 break;
388#ifdef BB_MTAB 388#ifdef BB_FEATURE_MTAB_SUPPORT
389 case 'n': 389 case 'n':
390 useMtab = FALSE; 390 useMtab = FALSE;
391 break; 391 break;
diff --git a/util-linux/umount.c b/util-linux/umount.c
index cc7d38d7c..3e23b9705 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -57,7 +57,7 @@ static int doForce = FALSE;
57#if defined BB_FEATURE_MOUNT_LOOP 57#if defined BB_FEATURE_MOUNT_LOOP
58static int freeLoop = TRUE; 58static int freeLoop = TRUE;
59#endif 59#endif
60#if defined BB_MTAB 60#if defined BB_FEATURE_MTAB_SUPPORT
61static int useMtab = TRUE; 61static int useMtab = TRUE;
62#endif 62#endif
63static int umountAll = FALSE; 63static int umountAll = FALSE;
@@ -106,7 +106,7 @@ char *mtab_getinfo(const char *match, const char which)
106 if (which == MTAB_GETMOUNTPT) { 106 if (which == MTAB_GETMOUNTPT) {
107 return cur->mountpt; 107 return cur->mountpt;
108 } else { 108 } else {
109#if !defined BB_MTAB 109#if !defined BB_FEATURE_MTAB_SUPPORT
110 if (strcmp(cur->device, "/dev/root") == 0) { 110 if (strcmp(cur->device, "/dev/root") == 0) {
111 /* Adjusts device to be the real root device, 111 /* Adjusts device to be the real root device,
112 * or leaves device alone if it can't find it */ 112 * or leaves device alone if it can't find it */
@@ -197,7 +197,7 @@ static int do_umount(const char *name)
197 } 197 }
198 } 198 }
199 if (status == 0) { 199 if (status == 0) {
200#if defined BB_MTAB 200#if defined BB_FEATURE_MTAB_SUPPORT
201 if (useMtab == TRUE) 201 if (useMtab == TRUE)
202 erase_mtab(name); 202 erase_mtab(name);
203#endif 203#endif
@@ -255,7 +255,7 @@ extern int umount_main(int argc, char **argv)
255 freeLoop = FALSE; 255 freeLoop = FALSE;
256 break; 256 break;
257#endif 257#endif
258#ifdef BB_MTAB 258#ifdef BB_FEATURE_MTAB_SUPPORT
259 case 'n': 259 case 'n':
260 useMtab = FALSE; 260 useMtab = FALSE;
261 break; 261 break;