svn commit: branches/busybox_1_1_stable: modutils util-linux

landley at busybox.net landley at busybox.net
Wed Apr 5 03:10:48 UTC 2006


Author: landley
Date: 2006-04-04 20:10:42 -0700 (Tue, 04 Apr 2006)
New Revision: 14753

Log:
Bring this up to date with busybox-1.1.1.fixes.patch by importing
svn 14653, 14684, 14746, and 14749.


Modified:
   branches/busybox_1_1_stable/modutils/insmod.c
   branches/busybox_1_1_stable/util-linux/mount.c


Changeset:
Modified: branches/busybox_1_1_stable/modutils/insmod.c
===================================================================
--- branches/busybox_1_1_stable/modutils/insmod.c	2006-04-05 02:45:24 UTC (rev 14752)
+++ branches/busybox_1_1_stable/modutils/insmod.c	2006-04-05 03:10:42 UTC (rev 14753)
@@ -516,12 +516,6 @@
 #include <elf.h>
 #include <endian.h>
 
-#if BB_LITTLE_ENDIAN
-# define ELFDATAM	ELFDATA2LSB
-#else
-# define ELFDATAM	ELFDATA2MSB
-#endif
-
 #ifndef ElfW
 # if ELFCLASSM == ELFCLASS32
 #  define ElfW(x)  Elf32_ ## x
@@ -3331,7 +3325,8 @@
 		return NULL;
 	}
 	if (f->header.e_ident[EI_CLASS] != ELFCLASSM
-			|| f->header.e_ident[EI_DATA] != ELFDATAM
+			|| f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN
+			   	? ELFDATA2MSB : ELFDATA2LSB)
 			|| f->header.e_ident[EI_VERSION] != EV_CURRENT
 			|| !MATCH_MACHINE(f->header.e_machine)) {
 		bb_error_msg("ELF file not for this architecture");

Modified: branches/busybox_1_1_stable/util-linux/mount.c
===================================================================
--- branches/busybox_1_1_stable/util-linux/mount.c	2006-04-05 02:45:24 UTC (rev 14752)
+++ branches/busybox_1_1_stable/util-linux/mount.c	2006-04-05 03:10:42 UTC (rev 14753)
@@ -184,6 +184,8 @@
 {
 	llist_free(fslist);
 }
+#else
+void delete_block_backed_filesystems(void);
 #endif
 
 #if ENABLE_FEATURE_MTAB_SUPPORT
@@ -196,13 +198,10 @@
 
 // Perform actual mount of specific filesystem at specific location.
 
-static int mount_it_now(struct mntent *mp, int vfsflags)
+static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
 {
 	int rc;
-	char *filteropts = 0;
 
-	parse_mount_options(mp->mnt_opts, &filteropts);
-
 	if (fakeIt) { return 0; }
 
 	// Mount, with fallback to read-only if necessary.
@@ -217,8 +216,6 @@
 		vfsflags |= MS_RDONLY;
 	}
 
-    free(filteropts);
-
 	// Abort entirely if permission denied.
 
 	if (rc && errno == EPERM)
@@ -266,11 +263,11 @@
 static int singlemount(struct mntent *mp)
 {
 	int rc = 1, vfsflags;
-	char *loopFile = 0;
+	char *loopFile = 0, *filteropts = 0;
 	llist_t *fl = 0;
 	struct stat st;
 
-	vfsflags = parse_mount_options(mp->mnt_opts, 0);
+	vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
 
 	// Treat fstype "auto" as unspecified.
 
@@ -282,23 +279,24 @@
 		(!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) &&
 		strchr(mp->mnt_fsname, ':') != NULL)
 	{
-		char *options=0;
-		parse_mount_options(mp->mnt_opts, &options);
-		if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &options, 1)) {
+		if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &filteropts, 1)) {
 			bb_perror_msg("nfsmount failed");
 			return 1;
+		} else {
+			// Strangely enough, nfsmount() doesn't actually mount() anything.
+			mp->mnt_type = "nfs";
+			rc = mount_it_now(mp, vfsflags, filteropts);
+			if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
+			
+			return rc;
 		}
-
-		// Strangely enough, nfsmount() doesn't actually mount() anything.
-
-		else return mount_it_now(mp, vfsflags);
 	}
 
-	// Look at the file.  (Not found isn't a failure for remount.)
+	// Look at the file.  (Not found isn't a failure for remount, or for
+	// a synthetic filesystem like proc or sysfs.)
 
 	if (lstat(mp->mnt_fsname, &st));
-
-	if (!(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) {
+	else if (!(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) {
 		// Do we need to allocate a loopback device for it?
 
 		if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
@@ -324,7 +322,7 @@
 	 * to the actual mount. */
 
 	if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
-		rc = mount_it_now(mp, vfsflags);
+		rc = mount_it_now(mp, vfsflags, filteropts);
 
 	// Loop through filesystem types until mount succeeds or we run out
 
@@ -336,25 +334,26 @@
 
 		if (!fslist) {
 			fslist = get_block_backed_filesystems();
-#if ENABLE_FEATURE_CLEAN_UP
 			if (ENABLE_FEATURE_CLEAN_UP && fslist)
 				atexit(delete_block_backed_filesystems);
-#endif
 		}
 
 		for (fl = fslist; fl; fl = fl->link) {
 			mp->mnt_type = fl->data;
 
-			if (!(rc = mount_it_now(mp,vfsflags))) break;
+			if (!(rc = mount_it_now(mp,vfsflags, filteropts))) break;
 
 			mp->mnt_type = 0;
 		}
 	}
 
-	// Mount failed.  Clean up
+	if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
+
+	// If mount failed, clean up loop file (if any).
+
 	if (rc && loopFile) {
 		del_loop(mp->mnt_fsname);
-		if(ENABLE_FEATURE_CLEAN_UP) {
+		if (ENABLE_FEATURE_CLEAN_UP) {
 			free(loopFile);
 			free(mp->mnt_fsname);
 		}




More information about the busybox-cvs mailing list