mount: improve error message for invalid filesystem names
For an invalid filesystem name used like this: mount -t asdfs /dev/ada1p5 /usr/obj emit an error message like this: mount: /dev/ada1p5: Invalid fstype: Invalid argument instead of: mount: /dev/ada1p5: Operation not supported by device Differential Revision: https://reviews.freebsd.org/D31540
This commit is contained in:
parent
2de4c7f6d0
commit
6e8272f317
@ -966,6 +966,12 @@ vfs_donmount(struct thread *td, uint64_t fsflags, struct uio *fsoptions)
|
||||
}
|
||||
|
||||
error = vfs_domount(td, fstype, fspath, fsflags, &optlist);
|
||||
if (error == ENOENT) {
|
||||
error = EINVAL;
|
||||
if (errmsg != NULL)
|
||||
strncpy(errmsg, "Invalid fstype", errmsg_len);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we can mount in the read-only mode if the error code suggests
|
||||
@ -1525,12 +1531,13 @@ vfs_domount(
|
||||
vfsp = NULL;
|
||||
if ((fsflags & MNT_UPDATE) == 0) {
|
||||
/* Don't try to load KLDs if we're mounting the root. */
|
||||
if (fsflags & MNT_ROOTFS)
|
||||
vfsp = vfs_byname(fstype);
|
||||
else
|
||||
vfsp = vfs_byname_kld(fstype, td, &error);
|
||||
if (vfsp == NULL)
|
||||
return (ENODEV);
|
||||
if (fsflags & MNT_ROOTFS) {
|
||||
if ((vfsp = vfs_byname(fstype)) == NULL)
|
||||
return (ENODEV);
|
||||
} else {
|
||||
if ((vfsp = vfs_byname_kld(fstype, td, &error)) == NULL)
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user