Make vnconfig's device argument not require a leading "/dev/", ala "ccdconfig".
Cleanup a few "-Wall -O" warnings. Make "usage()" agree with man page.
This commit is contained in:
parent
3608e384ca
commit
77cff66552
@ -185,18 +185,18 @@ option.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
.Pp
|
||||
.Dl vnconfig /dev/vn0c /tmp/diskimage
|
||||
.Dl vnconfig vn0c /tmp/diskimage
|
||||
.Pp
|
||||
Configures the vnode disk
|
||||
.Pa vn0c .
|
||||
.Pp
|
||||
.Dl vnconfig -e /dev/vn0c /var/swapfile swap
|
||||
.Dl vnconfig -e vn0c /var/swapfile swap
|
||||
.Pp
|
||||
Configures
|
||||
.Pa vn0c
|
||||
and enables swapping on it.
|
||||
.Pp
|
||||
.Dl vnconfig -d /dev/vn0c myfilesystem mount=/mnt
|
||||
.Dl vnconfig -d vn0c myfilesystem mount=/mnt
|
||||
.Pp
|
||||
Unmounts (disables)
|
||||
.Pa vn0c .
|
||||
|
@ -46,6 +46,7 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -54,6 +55,7 @@ static const char rcsid[] =
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/stat.h>
|
||||
@ -236,6 +238,14 @@ config(vnp)
|
||||
FILE *f;
|
||||
u_long l;
|
||||
|
||||
rv = 0;
|
||||
|
||||
/*
|
||||
* Prepend "/dev/" to the specified device name, if necessary.
|
||||
* Operate on vnp->dev because it is used later.
|
||||
*/
|
||||
if (vnp->dev[0] != '/' && vnp->dev[0] != '.')
|
||||
(void)asprintf(&vnp->dev, "/dev/%s", vnp->dev);
|
||||
dev = vnp->dev;
|
||||
file = vnp->file;
|
||||
flags = vnp->flags;
|
||||
@ -318,7 +328,7 @@ config(vnp)
|
||||
if (rv) {
|
||||
warn("VNIO[GU]SET");
|
||||
} else if (verbose)
|
||||
printf("%s: flags now=%08x\n",dev,l);
|
||||
printf("%s: flags now=%08lx\n",dev,l);
|
||||
}
|
||||
/*
|
||||
* Reset an option
|
||||
@ -332,7 +342,7 @@ config(vnp)
|
||||
if (rv) {
|
||||
warn("VNIO[GU]CLEAR");
|
||||
} else if (verbose)
|
||||
printf("%s: flags now=%08x\n",dev,l);
|
||||
printf("%s: flags now=%08lx\n",dev,l);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -482,8 +492,10 @@ rawdevice(dev)
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: vnconfig [-acdefguv] [-s option] [-r option] [special-device file]\n");
|
||||
fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: vnconfig [-cdeguv] [-s option] [-r option] [-S value] special_file",
|
||||
" [regular_file] [feature]",
|
||||
" vnconfig -a [-cdeguv] [-s option] [-r option] [-f config_file]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user