aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-10-25 17:50:43 +0000
committerMark Johnston <markj@FreeBSD.org>2024-10-25 17:50:43 +0000
commitb9500cbd38967686a801b1ed3ab1dd5b5b5571fb (patch)
tree9dff31297fe1eb0be5c8c1b3643ffc39af9a1552
parentf86e328d324d4d67ab4db4a89ef6239c8978bb87 (diff)
downloadsrc-b9500cbd3896.tar.gz
src-b9500cbd3896.zip
virtio_p9fs: Fix some style issues
- Remove superfluous newlines. - Use bool literals. - Replace an unneeded SYSINIT with static initialization. No functional change intended. Sponsored by: Klara, Inc.
-rw-r--r--sys/dev/virtio/p9fs/virtio_p9fs.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c
index 3600e0ea09c9..cdcd9c125dbb 100644
--- a/sys/dev/virtio/p9fs/virtio_p9fs.c
+++ b/sys/dev/virtio/p9fs/virtio_p9fs.c
@@ -74,30 +74,20 @@ struct vt9p_softc {
};
/* Global channel list, Each channel will correspond to a mount point */
-static STAILQ_HEAD( ,vt9p_softc) global_chan_list;
+static STAILQ_HEAD( ,vt9p_softc) global_chan_list =
+ STAILQ_HEAD_INITIALIZER(global_chan_list);
struct mtx global_chan_list_mtx;
+MTX_SYSINIT(global_chan_list_mtx, &global_chan_list_mtx, "9pglobal", MTX_DEF);
static struct virtio_feature_desc virtio_9p_feature_desc[] = {
{ VIRTIO_9PNET_F_MOUNT_TAG, "9PMountTag" },
{ 0, NULL }
};
-static void
-global_chan_list_init(void)
-{
-
- mtx_init(&global_chan_list_mtx, "9pglobal",
- NULL, MTX_DEF);
- STAILQ_INIT(&global_chan_list);
-}
-SYSINIT(global_chan_list_init, SI_SUB_KLD, SI_ORDER_FIRST,
- global_chan_list_init, NULL);
-
/* We don't currently allow canceling of virtio requests */
static int
vt9p_cancel(void *handle, struct p9_req_t *req)
{
-
return (1);
}
@@ -108,7 +98,6 @@ SYSCTL_NODE(_vfs, OID_AUTO, 9p, CTLFLAG_RW, 0, "9P File System Protocol");
* ack from the host, before exiting
*/
static unsigned int vt9p_ackmaxidle = 120;
-
SYSCTL_UINT(_vfs_9p, OID_AUTO, ackmaxidle, CTLFLAG_RW, &vt9p_ackmaxidle, 0,
"Maximum time request thread waits for ack from host");
@@ -369,20 +358,16 @@ vt9p_attach(device_t dev)
/* We expect one virtqueue, for requests. */
error = vt9p_alloc_virtqueue(chan);
-
if (error != 0) {
P9_DEBUG(ERROR, "%s: Allocating the virtqueue failed \n", __func__);
goto out;
}
-
error = virtio_setup_intr(dev, INTR_TYPE_MISC|INTR_MPSAFE);
-
if (error != 0) {
P9_DEBUG(ERROR, "%s: Cannot setup virtqueue interrupt\n", __func__);
goto out;
}
error = virtqueue_enable_intr(chan->vt9p_vq);
-
if (error != 0) {
P9_DEBUG(ERROR, "%s: Cannot enable virtqueue interrupt\n", __func__);
goto out;
@@ -436,7 +421,7 @@ vt9p_create(const char *mount_tag, void **handlep)
/* If we dont have one, for now bail out.*/
if (chan) {
*handlep = (void *)chan;
- chan->busy = TRUE;
+ chan->busy = true;
} else {
P9_DEBUG(TRANS, "%s: No Global channel with mount_tag=%s\n",
__func__, mount_tag);
@@ -450,7 +435,8 @@ static void
vt9p_close(void *handle)
{
struct vt9p_softc *chan = handle;
- chan->busy = FALSE;
+
+ chan->busy = false;
}
static struct p9_trans_module vt9p_trans = {