Module Name: src
Committed By: maxv
Date: Sun Mar 29 09:46:14 UTC 2020
Modified Files:
src/sys/dev/usb: vhci.c
Log Message:
store the request buffer in the vxfer instead of the packet, clearer
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/usb/vhci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/vhci.c
diff -u src/sys/dev/usb/vhci.c:1.12 src/sys/dev/usb/vhci.c:1.13
--- src/sys/dev/usb/vhci.c:1.12 Tue Mar 24 17:20:55 2020
+++ src/sys/dev/usb/vhci.c Sun Mar 29 09:46:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vhci.c,v 1.12 2020/03/24 17:20:55 maxv Exp $ */
+/* $NetBSD: vhci.c,v 1.13 2020/03/29 09:46:14 maxv Exp $ */
/*
* Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.12 2020/03/24 17:20:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vhci.c,v 1.13 2020/03/29 09:46:14 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -173,8 +173,6 @@ static const struct usbd_pipe_methods vh
* +------------------------------------------------+
*/
-struct vhci_xfer;
-
typedef struct {
int type;
#define VHCI_REQ_CTRL 0
@@ -184,6 +182,8 @@ typedef struct {
} u;
} vhci_request_t;
+struct vhci_xfer;
+
typedef struct vhci_packet {
/* General. */
TAILQ_ENTRY(vhci_packet) portlist;
@@ -192,9 +192,6 @@ typedef struct vhci_packet {
bool utoh;
uint8_t addr;
- /* For a request packet, the storage goes there. */
- vhci_request_t reqbuf;
-
/* Exposed for FD operations. */
uint8_t *buf;
size_t size;
@@ -230,6 +227,9 @@ typedef struct vhci_xfer {
size_t npkts;
vhci_packet_list_t pkts;
+ /* Header storage. */
+ vhci_request_t reqbuf;
+
/* Used for G/C. */
TAILQ_ENTRY(vhci_xfer) freelist;
} vhci_xfer_t;
@@ -286,15 +286,15 @@ vhci_pkt_ctrl_create(vhci_port_t *port,
req->vxfer = vxfer;
req->utoh = false;
req->addr = addr;
- req->buf = (uint8_t *)&req->reqbuf;
- req->size = sizeof(req->reqbuf);
+ req->buf = (uint8_t *)&vxfer->reqbuf;
+ req->size = sizeof(vxfer->reqbuf);
req->cursor = 0;
npkts++;
/* Init the request buffer. */
- memset(&req->reqbuf, 0, sizeof(req->reqbuf));
- req->reqbuf.type = VHCI_REQ_CTRL;
- memcpy(&req->reqbuf.u.ctrl, &xfer->ux_request,
+ memset(&vxfer->reqbuf, 0, sizeof(vxfer->reqbuf));
+ vxfer->reqbuf.type = VHCI_REQ_CTRL;
+ memcpy(&vxfer->reqbuf.u.ctrl, &xfer->ux_request,
sizeof(xfer->ux_request));
/* Data packet. */