diff options
author | phk <phk@FreeBSD.org> | 2000-12-15 16:40:11 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-12-15 16:40:11 +0000 |
commit | 139e3e3e413d31c576b790001e28b1fcffe4551f (patch) | |
tree | 4f7adbe428e90fe0a10c6fd01bb56d6ae2d012b6 /usr.sbin/vnconfig/vnconfig.c | |
parent | 0f35e87fbb82834775bcf84ada759ba0efc39d74 (diff) | |
download | FreeBSD-src-139e3e3e413d31c576b790001e28b1fcffe4551f.zip FreeBSD-src-139e3e3e413d31c576b790001e28b1fcffe4551f.tar.gz |
Don't do raw device 'r' mangling.
Try to use vn%d.ctl for setup and control if possible.
This paves the way for a DEVFS/cloning vn driver.
Diffstat (limited to 'usr.sbin/vnconfig/vnconfig.c')
-rw-r--r-- | usr.sbin/vnconfig/vnconfig.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/usr.sbin/vnconfig/vnconfig.c b/usr.sbin/vnconfig/vnconfig.c index 11f9324..8c28fc9 100644 --- a/usr.sbin/vnconfig/vnconfig.c +++ b/usr.sbin/vnconfig/vnconfig.c @@ -101,7 +101,6 @@ char *configfile; int config __P((struct vndisk *)); void getoptions __P((struct vndisk *, char *)); -char *rawdevice __P((char *)); void readconfig __P((int)); static void usage __P((void)); static int getsize(const char *arg); @@ -314,8 +313,11 @@ config(vnp) } } - rdev = rawdevice(dev); + rdev = dev; + (void)asprintf(&rdev, "%s.ctl", dev); f = fopen(rdev, "rw"); + if (f == NULL) + f = fopen(dev, "rw"); if (f == NULL) { warn("%s", dev); return(1); @@ -555,28 +557,6 @@ getoptions(vnp, fstr) vnp->oarg = NULL; } -char * -rawdevice(dev) - char *dev; -{ - register char *rawbuf, *dp, *ep; - struct stat sb; - int len; - - len = strlen(dev); - rawbuf = malloc(len + 2); - strcpy(rawbuf, dev); - if (stat(rawbuf, &sb) != 0 || !S_ISCHR(sb.st_mode)) { - dp = rindex(rawbuf, '/'); - if (dp) { - for (ep = &rawbuf[len]; ep > dp; --ep) - *(ep+1) = *ep; - *++ep = 'r'; - } - } - return (rawbuf); -} - static void usage() { |