From sanewo@ba2.so-net.ne.jp Sun May  9 07:57:57 1999
Return-Path: <sanewo@ba2.so-net.ne.jp>
Received: from mgate07.so-net.ne.jp (mgate07.so-net.ne.jp [210.132.247.37])
	by hub.freebsd.org (Postfix) with ESMTP id 5160715691
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  9 May 1999 07:57:16 -0700 (PDT)
	(envelope-from sanewo@ba2.so-net.ne.jp)
Received: from mail.ba2.so-net.ne.jp (mail.ba2.so-net.ne.jp [210.132.247.97])
	by mgate07.so-net.ne.jp (8.8.8+3.0Wbeta9/3.6W99042816) with ESMTP id XAA06603
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 9 May 1999 23:57:12 +0900 (JST)
Received: from ba2.so-net.ne.jp (root@p84b42b.sng2.ap.so-net.ne.jp [210.132.180.43])
	by mail.ba2.so-net.ne.jp (8.8.8+3.0Wbeta9/3.7W99040113) with ESMTP id XAA12270
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 9 May 1999 23:57:07 +0900 (JST)
Received: (from root@localhost)
	by ba2.so-net.ne.jp (8.9.3/8.9.3) id XAA06294;
	Sun, 9 May 1999 23:57:07 +0900 (JST)
	(envelope-from sanewo)
Message-Id: <199905091457.XAA06294@ba2.so-net.ne.jp>
Date: Sun, 9 May 1999 23:57:07 +0900 (JST)
From: sanewo@ba2.so-net.ne.jp
Reply-To: sanewo@ba2.so-net.ne.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: vnconfig not supporting swap-backed vn device except via config file
X-Send-Pr-Version: 3.2

>Number:         11608
>Category:       bin
>Synopsis:       vnconfig not supporting swap-backed vn device except via config file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May  9 08:00:01 PDT 1999
>Closed-Date:    Mon Mar 26 13:00:05 PST 2001
>Last-Modified:  Mon Mar 26 13:06:05 PST 2001
>Originator:     Takanori Saneto
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
An individual
>Environment:

4.0-CURRENT as of 1999-May-08

>Description:

Without using config file (/etc/vntab), there is no way to configure vn device
so it is swap-backed.

To let vn device know it should be swap-backed, ``vn_file'' argument should be NULL.
In vnconfig command, in the case of not using config file, vn_file will always be filled
from argv, thus cannot be NULL.

In the case of using config file, if ``regular-file'' part is in the form of "%xxx", it is
interpreted as a swap-size spec and vn_file will be NULL.
(this feature is not documented, BTW)

>How-To-Repeat:

>Fix:

Possible fix is as follows:

Index: /usr/src/usr.sbin/vnconfig/vnconfig.c
===================================================================
RCS file: /sd0/FreeBSD/cvs/src/usr.sbin/vnconfig/vnconfig.c,v
retrieving revision 1.9
diff -u -r1.9 vnconfig.c
--- vnconfig.c	1999/03/14 09:20:01	1.9
+++ vnconfig.c	1999/05/08 12:42:21
@@ -196,7 +196,7 @@
 		if (argc < optind + 1)
 			usage();
 		vndisks[0].dev = argv[optind++];
-		vndisks[0].file = argv[optind++];
+		if (!size) vndisks[0].file = argv[optind++];
 		vndisks[0].flags = flags;
 		vndisks[0].size = size;
 		vndisks[0].autolabel = autolabel;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: iedowse 
State-Changed-When: Mon Mar 26 13:00:05 PST 2001 
State-Changed-Why:  
It seems that it is possible to specify a swap-backed vn device on 
the command line by simply omitting the regular-file name. e.g. 

vnconfig -e -S 10m /dev/vn0 

I'm not sure if this was fixed since the this PR was submitted; 
there was a comment added in revision 1.13 of vnconfig.c which 
helps to explain how the `file' field can end up as NULL. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=11608 
>Unformatted:
