Fix for bug #1255 -- support for mount -t <type>
This commit is contained in:
parent
2a4a8d8ffb
commit
d0dd3d31e2
@ -347,7 +347,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_mounts(void)
|
static void show_mounts(char *onlytype)
|
||||||
{
|
{
|
||||||
#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
||||||
int fd, i, numfilesystems;
|
int fd, i, numfilesystems;
|
||||||
@ -371,11 +371,13 @@ static void show_mounts(void)
|
|||||||
perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
|
perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
|
||||||
|
|
||||||
for( i = 0 ; i < numfilesystems ; i++) {
|
for( i = 0 ; i < numfilesystems ; i++) {
|
||||||
|
if ( !onlytype || ( strcmp ( mntentlist[i].mnt_type, onlytype ) == 0 )) {
|
||||||
printf( "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
|
printf( "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
|
||||||
mntentlist[i].mnt_dir, mntentlist[i].mnt_type,
|
mntentlist[i].mnt_dir, mntentlist[i].mnt_type,
|
||||||
mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
|
mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
|
||||||
mntentlist[i].mnt_passno);
|
mntentlist[i].mnt_passno);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||||
/* Don't bother to close files or free memory. Exit
|
/* Don't bother to close files or free memory. Exit
|
||||||
* does that automagically, so we can save a few bytes */
|
* does that automagically, so we can save a few bytes */
|
||||||
@ -394,8 +396,10 @@ static void show_mounts(void)
|
|||||||
if (strcmp(blockDevice, "/dev/root") == 0) {
|
if (strcmp(blockDevice, "/dev/root") == 0) {
|
||||||
blockDevice = find_real_root_device_name(blockDevice);
|
blockDevice = find_real_root_device_name(blockDevice);
|
||||||
}
|
}
|
||||||
|
if ( !onlytype || ( strcmp ( m-> mnt_type, onlytype ) == 0 )) {
|
||||||
printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
|
printf("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
|
||||||
m->mnt_type, m->mnt_opts);
|
m->mnt_type, m->mnt_opts);
|
||||||
|
}
|
||||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||||
if(blockDevice != m->mnt_fsname)
|
if(blockDevice != m->mnt_fsname)
|
||||||
free(blockDevice);
|
free(blockDevice);
|
||||||
@ -416,6 +420,7 @@ extern int mount_main(int argc, char **argv)
|
|||||||
char *extra_opts;
|
char *extra_opts;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
char *filesystemType = "auto";
|
char *filesystemType = "auto";
|
||||||
|
int got_filesystemType = 0;
|
||||||
char *device = xmalloc(PATH_MAX);
|
char *device = xmalloc(PATH_MAX);
|
||||||
char *directory = xmalloc(PATH_MAX);
|
char *directory = xmalloc(PATH_MAX);
|
||||||
struct mntent *m = NULL;
|
struct mntent *m = NULL;
|
||||||
@ -437,6 +442,7 @@ extern int mount_main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
filesystemType = optarg;
|
filesystemType = optarg;
|
||||||
|
got_filesystemType = 1;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
flags &= ~MS_RDONLY;
|
flags &= ~MS_RDONLY;
|
||||||
@ -458,7 +464,7 @@ extern int mount_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!all && optind == argc)
|
if (!all && optind == argc)
|
||||||
show_mounts();
|
show_mounts(got_filesystemType ? filesystemType : 0);
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
/* if device is a filename get its real path */
|
/* if device is a filename get its real path */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user