Add utility function to propagate mount errors as text string messages.

Discussed with:		phk
This commit is contained in:
Craig Rodrigues 2005-11-08 04:13:39 +00:00
parent a122444660
commit 84e69560b6
2 changed files with 22 additions and 0 deletions

View File

@ -1183,6 +1183,27 @@ devfs_fixup(struct thread *td)
kern_unlink(td, "/dev/dev", UIO_SYSSPACE);
}
/*
* Report errors during filesystem mounting.
*/
void
vfs_mount_error(struct mount *mp, const char *fmt, ...)
{
struct vfsoptlist *moptlist = mp->mnt_optnew;
va_list ap;
int error, len;
char *errmsg;
error = vfs_getopt(moptlist, "errmsg", (void **)&errmsg, &len);
if (error || errmsg == NULL || len <= 0) {
return;
}
va_start(ap, fmt);
vsnprintf(errmsg, (size_t)len, fmt, ap);
va_end(ap);
}
/*
* Find and mount the root filesystem
*/

View File

@ -624,6 +624,7 @@ void vfs_getnewfsid(struct mount *);
struct cdev *vfs_getrootfsid(struct mount *);
struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */
int vfs_modevent(module_t, int, void *);
void vfs_mount_error(struct mount *, const char *, ...);
void vfs_mountroot(void); /* mount our root filesystem */
void vfs_mountedfrom(struct mount *, const char *from);
int vfs_suser(struct mount *, struct thread *);