Hi,
Now that I've disallowed swapping to vnd's the purpose
of vnd (vs svnd) is suspect, it serves no purpose other
then providing a different way of doing what svnd does
(which imo, isn't even better).
So, nuke vnds (keep svnds though!).
This will make svndXn the same as vndXn etc. The idea is
that in a few releases we'll simply remove the svnd0 notes.
comments/ok ?
Index: dev/vnd.c
===
RCS file: /home/thib/cvs/src/sys/dev/vnd.c,v
retrieving revision 1.108
diff -u -p -r1.108 vnd.c
--- dev/vnd.c 2 Apr 2011 15:24:03 - 1.108
+++ dev/vnd.c 3 Apr 2011 18:29:52 -
@@ -33,25 +33,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * from: Utah $Hdr: vn.c 1.13 94/04/02$
- *
- * @(#)vn.c8.6 (Berkeley) 4/1/94
*/
/*
- * Vnode disk driver.
- *
- * Block/character interface to a vnode. Allows one to treat a file
- * as a disk (e.g. build a filesystem in it, mount it, etc.).
- *
- * NOTE 1: This uses either the VOP_BMAP/VOP_STRATEGY interface to the
- * vnode or simple VOP_READ/VOP_WRITE. The former is suitable for swapping
- * as it doesn't distort the local buffer cache. The latter is good for
- * building disk images as it keeps the cache consistent after the block
- * device is closed.
+ * There is a security issue involved with this driver.
*
- * NOTE 2: There is a security issue involved with this driver.
* Once mounted all access to the contents of the mapped file via
* the special file is controlled by the permissions on the special
* file, the protection of the mapped file is ignored (effectively,
@@ -102,12 +88,8 @@ int vnddebug = 0x00;
* DISKUNIT(), but with the minor masked off.
*/
#definevndunit(x) DISKUNIT(makedev(major(x), minor(x) 0x7ff))
-#definevndsimple(x)(minor(x) 0x800)
-
-/* same as MAKEDISKDEV, preserving the vndsimple() property */
#defineVNDLABELDEV(dev)\
- makedev(major(dev), DISKMINOR(vndunit(dev), RAW_PART) | \
- (vndsimple(dev) ? 0x800 : 0))
+ makedev(major(dev), DISKMINOR(vndunit(dev), RAW_PART))
struct vndbuf {
struct buf vb_buf;
@@ -145,7 +127,6 @@ struct vnd_softc {
#defineVNF_LABELLING 0x0100
#defineVNF_WLABEL 0x0200
#defineVNF_HAVELABEL 0x0400
-#defineVNF_SIMPLE 0x1000
#defineVNF_READONLY0x2000
#defineVNDRW(v)((v)-sc_flags VNF_READONLY ? FREAD :
FREAD|FWRITE)
@@ -157,7 +138,6 @@ int numvnd = 0;
void vndattach(int);
void vndclear(struct vnd_softc *);
-void vndstart(struct vnd_softc *, struct buf *);
intvndsetcred(struct vnd_softc *, struct ucred *);
void vndiodone(struct buf *);
void vndshutdown(void);
@@ -232,12 +212,6 @@ vndopen(dev_t dev, int flags, int mode,
if ((error = vndlock(sc)) != 0)
return (error);
- if (!vndsimple(dev) sc-sc_vp != NULL
- (sc-sc_vp-v_type != VREG || sc-sc_keyctx != NULL)) {
- error = EINVAL;
- goto bad;
- }
-
if ((flags FWRITE) (sc-sc_flags VNF_READONLY)) {
error = EROFS;
goto bad;
@@ -252,20 +226,11 @@ vndopen(dev_t dev, int flags, int mode,
part = DISKPART(dev);
pmask = 1 part;
- /*
-* If any partition is open, all succeeding openings must be of the
-* same type or read-only.
-*/
- if (sc-sc_dk.dk_openmask) {
- if (((sc-sc_flags VNF_SIMPLE) != 0) !=
- (vndsimple(dev) != 0) (flags FWRITE)) {
- error = EBUSY;
- goto bad;
- }
- } else if (vndsimple(dev))
- sc-sc_flags |= VNF_SIMPLE;
- else
- sc-sc_flags = ~VNF_SIMPLE;
+ /* XXX: OK ?*/
+ if (sc-sc_dk.dk_openmask (flags FWRITE)) {
+ error = EBUSY;
+ goto bad;
+ }
/* Check that the partition exists. */
if (part != RAW_PART
@@ -360,30 +325,13 @@ vndclose(dev_t dev, int flags, int mode,
return (0);
}
-/*
- * Two methods are used, the traditional buffercache bypassing and the
- * newer, cache-coherent on unmount, one.
- *
- * Former method:
- * Break the request into bsize pieces and submit using VOP_BMAP/VOP_STRATEGY.
- * Note that this driver can only be used for swapping over NFS on the hp
- * since nfs_strategy on the vax cannot handle u-areas and page tables.
- *
- * Latter method:
- * Repack the buffer into an uio structure and use VOP_READ/VOP_WRITE to
- * access the underlying file.
- */
void
vndstrategy(struct buf *bp)
{
int unit = vndunit(bp-b_dev);
struct vnd_softc *vnd = vnd_softc[unit];
- struct vndbuf *nbp;
- int bsize;
off_t bn;
- caddr_t addr;
-