summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/vnd.c36
-rw-r--r--sys/dev/vndioctl.h16
2 files changed, 46 insertions, 6 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 948303ecede..8ac0a7aca04 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.159 2016/10/08 05:52:06 guenther Exp $ */
+/* $OpenBSD: vnd.c,v 1.160 2016/11/12 10:59:37 jca Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -305,11 +305,11 @@ vndstrategy(struct buf *bp)
bp->b_bcount = ((origbcount + secsize - 1) & ~(secsize - 1));
#ifdef DIAGNOSTIC
if (bp->b_bcount != origbcount) {
- struct proc *curp = curproc;
+ struct process *curpr = curproc->p_p;
printf("%s: sloppy %s from proc %d (%s): "
"blkno %lld bcount %ld\n", sc->sc_dev.dv_xname,
(bp->b_flags & B_READ) ? "read" : "write",
- curp->p_p->ps_pid, curp->p_comm,
+ curpr->ps_pid, curpr->ps_comm,
(long long)bp->b_blkno, origbcount);
}
#endif
@@ -396,6 +396,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
struct vnd_softc *sc;
struct vnd_ioctl *vio;
struct vnd_user *vnu;
+ struct vnd_user60 *vnu60;
struct vattr vattr;
struct nameidata nd;
int error, part, pmask;
@@ -544,6 +545,35 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
disk_unlock(&sc->sc_dk);
break;
+ /* XXX kill after 6.1 */
+ case VNDIOCGET60:
+ vnu60 = (struct vnd_user60 *)addr;
+
+ if (vnu60->vnu60_unit == -1)
+ vnu60->vnu60_unit = unit;
+ if (vnu60->vnu60_unit >= numvnd)
+ return (ENXIO);
+ if (vnu60->vnu60_unit < 0)
+ return (EINVAL);
+
+ sc = &vnd_softc[vnu60->vnu60_unit];
+
+ if (sc->sc_flags & VNF_INITED) {
+ error = VOP_GETATTR(sc->sc_vp, &vattr, p->p_ucred, p);
+ if (error)
+ return (error);
+
+ strlcpy(vnu60->vnu60_file, sc->sc_file,
+ sizeof(vnu60->vnu60_file));
+ vnu60->vnu60_dev = vattr.va_fsid;
+ vnu60->vnu60_ino = vattr.va_fileid;
+ } else {
+ vnu60->vnu60_dev = 0;
+ vnu60->vnu60_ino = 0;
+ }
+
+ break;
+
case VNDIOCGET:
vnu = (struct vnd_user *)addr;
diff --git a/sys/dev/vndioctl.h b/sys/dev/vndioctl.h
index f792977efa0..5e9d197105b 100644
--- a/sys/dev/vndioctl.h
+++ b/sys/dev/vndioctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vndioctl.h,v 1.8 2008/09/03 23:24:25 krw Exp $ */
+/* $OpenBSD: vndioctl.h,v 1.9 2016/11/12 10:59:37 jca Exp $ */
/* $NetBSD: vndioctl.h,v 1.5 1995/01/25 04:46:30 cgd Exp $ */
/*
@@ -42,7 +42,7 @@
#ifndef _SYS_VNDIOCTL_H_
#define _SYS_VNDIOCTL_H_
-#define VNDNLEN 90
+#define VNDNLEN 1024 /* PATH_MAX */
/*
* Ioctl definitions for file (vnode) disk pseudo-device.
@@ -67,6 +67,14 @@ struct vnd_user {
ino_t vnu_ino; /* vnd inode */
};
+/* XXX kill after 6.1 */
+struct vnd_user60 {
+ char vnu60_file[90]; /* vnd file */
+ int vnu60_unit; /* vnd unit */
+ dev_t vnu60_dev; /* vnd device */
+ ino_t vnu60_ino; /* vnd inode */
+};
+
/*
* Before you can use a unit, it must be configured with VNDIOCSET.
* The configuration persists across opens and closes of the device;
@@ -75,6 +83,8 @@ struct vnd_user {
*/
#define VNDIOCSET _IOWR('F', 0, struct vnd_ioctl) /* enable disk */
#define VNDIOCCLR _IOW('F', 1, struct vnd_ioctl) /* disable disk */
-#define VNDIOCGET _IOWR('F', 2, struct vnd_user) /* get disk info */
+/* XXX kill after 6.1 */
+#define VNDIOCGET60 _IOWR('F', 2, struct vnd_user60) /* get disk info */
+#define VNDIOCGET _IOWR('F', 3, struct vnd_user) /* get disk info */
#endif /* !_SYS_VNDIOCTL_H_ */