Some bug fixes I forgot to check-in the other day.

Mounting loop devices w/o specifying the filesystem
type choked if it didn't guess right the first time.
 -Erik
This commit is contained in:
Erik Andersen 2000-03-13 04:07:02 +00:00
parent 3522eb1ab3
commit ce91732416
5 changed files with 32 additions and 6 deletions

View File

@ -45,6 +45,8 @@
* Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e") * Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e")
* ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width * ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width
to match the terminal (defaults to width=79 when this is off). to match the terminal (defaults to width=79 when this is off).
* Fixed mount'ing loop devices when the filesystem type was not
specified. It used to revert to non-loop after the first try.
-Erik Andersen -Erik Andersen

View File

@ -142,7 +142,6 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
fprintf(stderr, "WARNING: loop device is read-only\n"); fprintf(stderr, "WARNING: loop device is read-only\n");
flags &= ~MS_RDONLY; flags &= ~MS_RDONLY;
} }
use_loop = FALSE;
} }
#endif #endif
status = status =
@ -415,10 +414,10 @@ extern int mount_main(int argc, char **argv)
case 'a': case 'a':
all = TRUE; all = TRUE;
break; break;
#ifdef BB_MTAB
case 'f': case 'f':
fakeIt = TRUE; fakeIt = TRUE;
break; break;
#ifdef BB_MTAB
case 'n': case 'n':
useMtab = FALSE; useMtab = FALSE;
break; break;

View File

@ -41,6 +41,9 @@ static const char umount_usage[] =
#ifdef BB_FEATURE_REMOUNT #ifdef BB_FEATURE_REMOUNT
"\t-r:\tTry to remount devices as read-only if mount is busy\n" "\t-r:\tTry to remount devices as read-only if mount is busy\n"
#endif #endif
#if defined BB_FEATURE_MOUNT_LOOP
"\t-f:\tDo not free loop device (if a loop device has been used)\n"
#endif
; ;
struct _mtab_entry_t { struct _mtab_entry_t {
@ -53,9 +56,14 @@ static struct _mtab_entry_t *mtab_cache = NULL;
#if defined BB_FEATURE_MOUNT_LOOP
static int freeLoop = TRUE;
#endif
static int useMtab = TRUE; static int useMtab = TRUE;
static int umountAll = FALSE; static int umountAll = FALSE;
#if defined BB_FEATURE_REMOUNT
static int doRemount = FALSE; static int doRemount = FALSE;
#endif
extern const char mtab_file[]; /* Defined in utility.c */ extern const char mtab_file[]; /* Defined in utility.c */
@ -167,7 +175,7 @@ static int do_umount(const char *name, int useMtab)
status = umount(name); status = umount(name);
#if defined BB_FEATURE_MOUNT_LOOP #if defined BB_FEATURE_MOUNT_LOOP
if (blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
/* this was a loop device, delete it */ /* this was a loop device, delete it */
del_loop(blockDevice); del_loop(blockDevice);
#endif #endif
@ -236,6 +244,11 @@ extern int umount_main(int argc, char **argv)
case 'a': case 'a':
umountAll = TRUE; umountAll = TRUE;
break; break;
#if defined BB_FEATURE_MOUNT_LOOP
case 'f':
freeLoop = FALSE;
break;
#endif
#ifdef BB_MTAB #ifdef BB_MTAB
case 'n': case 'n':
useMtab = FALSE; useMtab = FALSE;

View File

@ -142,7 +142,6 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
fprintf(stderr, "WARNING: loop device is read-only\n"); fprintf(stderr, "WARNING: loop device is read-only\n");
flags &= ~MS_RDONLY; flags &= ~MS_RDONLY;
} }
use_loop = FALSE;
} }
#endif #endif
status = status =
@ -415,10 +414,10 @@ extern int mount_main(int argc, char **argv)
case 'a': case 'a':
all = TRUE; all = TRUE;
break; break;
#ifdef BB_MTAB
case 'f': case 'f':
fakeIt = TRUE; fakeIt = TRUE;
break; break;
#ifdef BB_MTAB
case 'n': case 'n':
useMtab = FALSE; useMtab = FALSE;
break; break;

View File

@ -41,6 +41,9 @@ static const char umount_usage[] =
#ifdef BB_FEATURE_REMOUNT #ifdef BB_FEATURE_REMOUNT
"\t-r:\tTry to remount devices as read-only if mount is busy\n" "\t-r:\tTry to remount devices as read-only if mount is busy\n"
#endif #endif
#if defined BB_FEATURE_MOUNT_LOOP
"\t-f:\tDo not free loop device (if a loop device has been used)\n"
#endif
; ;
struct _mtab_entry_t { struct _mtab_entry_t {
@ -53,9 +56,14 @@ static struct _mtab_entry_t *mtab_cache = NULL;
#if defined BB_FEATURE_MOUNT_LOOP
static int freeLoop = TRUE;
#endif
static int useMtab = TRUE; static int useMtab = TRUE;
static int umountAll = FALSE; static int umountAll = FALSE;
#if defined BB_FEATURE_REMOUNT
static int doRemount = FALSE; static int doRemount = FALSE;
#endif
extern const char mtab_file[]; /* Defined in utility.c */ extern const char mtab_file[]; /* Defined in utility.c */
@ -167,7 +175,7 @@ static int do_umount(const char *name, int useMtab)
status = umount(name); status = umount(name);
#if defined BB_FEATURE_MOUNT_LOOP #if defined BB_FEATURE_MOUNT_LOOP
if (blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
/* this was a loop device, delete it */ /* this was a loop device, delete it */
del_loop(blockDevice); del_loop(blockDevice);
#endif #endif
@ -236,6 +244,11 @@ extern int umount_main(int argc, char **argv)
case 'a': case 'a':
umountAll = TRUE; umountAll = TRUE;
break; break;
#if defined BB_FEATURE_MOUNT_LOOP
case 'f':
freeLoop = FALSE;
break;
#endif
#ifdef BB_MTAB #ifdef BB_MTAB
case 'n': case 'n':
useMtab = FALSE; useMtab = FALSE;