From c26b4e856f1783260f529fefba4f49a3efbef89d Mon Sep 17 00:00:00 2001 From: mlelstv Date: Sun, 7 Oct 2018 11:51:26 +0000 Subject: Add flag to enforce file I/O even when bmap/strategy would be possible. This makes it easier to compare both modes, it also allows coherent operation between vnd device and image file. --- sys/dev/vnd.c | 8 +++++--- sys/dev/vndvar.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 38439695cf3..327dc2213ec 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.266 2018/10/05 09:51:55 hannken Exp $ */ +/* $NetBSD: vnd.c,v 1.267 2018/10/07 11:51:26 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.266 2018/10/05 09:51:55 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.267 2018/10/07 11:51:26 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_vnd.h" @@ -1243,6 +1243,8 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) fflags = FREAD; if ((vio->vnd_flags & VNDIOF_READONLY) == 0) fflags |= FWRITE; + if ((vio->vnd_flags & VNDIOF_FILEIO) != 0) + vnd->sc_flags |= VNF_USE_VN_RDWR; error = pathbuf_copyin(vio->vnd_file, &pb); if (error) { goto unlock_and_exit; @@ -1266,7 +1268,7 @@ vndioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) /* If using a compressed file, initialize its info */ /* (or abort with an error if kernel has no compression) */ - if (vio->vnd_flags & VNF_COMP) { + if (vio->vnd_flags & VNDIOF_COMP) { #ifdef VND_COMPRESSION struct vnd_comp_header *ch; int i; diff --git a/sys/dev/vndvar.h b/sys/dev/vndvar.h index 52ef1d48623..59f916af027 100644 --- a/sys/dev/vndvar.h +++ b/sys/dev/vndvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: vndvar.h,v 1.37 2018/09/20 07:18:38 mlelstv Exp $ */ +/* $NetBSD: vndvar.h,v 1.38 2018/10/07 11:51:26 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -98,6 +98,8 @@ struct vnd_ioctl { #define VNDIOF_HASGEOM 0x01 /* use specified geometry */ #define VNDIOF_READONLY 0x02 /* as read-only device */ #define VNDIOF_FORCE 0x04 /* force close */ +#define VNDIOF_FILEIO 0x08 /* have to use read/write */ +#define VNDIOF_COMP 0x0400 /* must stay the same as VNF_COMP */ #ifdef _KERNEL -- cgit