diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2005-11-08 04:13:39 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2005-11-08 04:13:39 +0000 |
commit | ee849009e585e08e4b137926d0f8e793abaae3e2 (patch) | |
tree | 7cf7e5d3b2ffd0b0ba4be9aef4b16b72382f9383 /sys/kern | |
parent | 050523732761a57a15aea48459a321c41191bfaa (diff) | |
download | FreeBSD-src-ee849009e585e08e4b137926d0f8e793abaae3e2.zip FreeBSD-src-ee849009e585e08e4b137926d0f8e793abaae3e2.tar.gz |
Add utility function to propagate mount errors as text string messages.
Discussed with: phk
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_mount.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index e13146f..508fd7b 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1184,6 +1184,27 @@ devfs_fixup(struct thread *td) } /* + * 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 */ void |