From 26b58d7c3c08779e3512272b806f1318f51c2ff2 Mon Sep 17 00:00:00 2001 From: Asias He Date: Sat, 7 Apr 2012 20:07:29 +0800 Subject: [PATCH] kvm tools: Rename VIRTIO_P9 to VIRTIO_9P This makes the naming more consistent. Signed-off-by: Asias He Signed-off-by: Pekka Enberg --- tools/kvm/include/kvm/virtio-9p.h | 10 ++++----- tools/kvm/include/kvm/virtio-pci-dev.h | 4 ++-- tools/kvm/virtio/9p.c | 30 +++++++++++++------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/kvm/include/kvm/virtio-9p.h b/tools/kvm/include/kvm/virtio-9p.h index fdf676c413f7..cd2869a9d92b 100644 --- a/tools/kvm/include/kvm/virtio-9p.h +++ b/tools/kvm/include/kvm/virtio-9p.h @@ -10,10 +10,10 @@ #define NUM_VIRT_QUEUES 1 #define VIRTQUEUE_NUM 128 -#define VIRTIO_P9_DEFAULT_TAG "kvm_9p" -#define VIRTIO_P9_HDR_LEN (sizeof(u32)+sizeof(u8)+sizeof(u16)) -#define VIRTIO_P9_MAX_FID 256 -#define VIRTIO_P9_VERSION_DOTL "9P2000.L" +#define VIRTIO_9P_DEFAULT_TAG "kvm_9p" +#define VIRTIO_9P_HDR_LEN (sizeof(u32)+sizeof(u8)+sizeof(u16)) +#define VIRTIO_9P_MAX_FID 256 +#define VIRTIO_9P_VERSION_DOTL "9P2000.L" #define MAX_TAG_LEN 32 struct p9_msg { @@ -49,7 +49,7 @@ struct p9_dev { /* virtio queue */ struct virt_queue vqs[NUM_VIRT_QUEUES]; struct p9_dev_job jobs[NUM_VIRT_QUEUES]; - struct p9_fid fids[VIRTIO_P9_MAX_FID]; + struct p9_fid fids[VIRTIO_9P_MAX_FID]; char root_dir[PATH_MAX]; }; diff --git a/tools/kvm/include/kvm/virtio-pci-dev.h b/tools/kvm/include/kvm/virtio-pci-dev.h index e692bddd4c37..7ceb125b0a21 100644 --- a/tools/kvm/include/kvm/virtio-pci-dev.h +++ b/tools/kvm/include/kvm/virtio-pci-dev.h @@ -13,7 +13,7 @@ #define PCI_DEVICE_ID_VIRTIO_CONSOLE 0x1003 #define PCI_DEVICE_ID_VIRTIO_RNG 0x1004 #define PCI_DEVICE_ID_VIRTIO_BLN 0x1005 -#define PCI_DEVICE_ID_VIRTIO_P9 0x1009 +#define PCI_DEVICE_ID_VIRTIO_9P 0x1009 #define PCI_DEVICE_ID_VESA 0x2000 #define PCI_DEVICE_ID_PCI_SHMEM 0x0001 @@ -32,6 +32,6 @@ */ #define PCI_CLASS_RNG 0xff0000 #define PCI_CLASS_BLN 0xff0000 -#define PCI_CLASS_P9 0xff0000 +#define PCI_CLASS_9P 0xff0000 #endif /* VIRTIO_PCI_DEV_H_ */ diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index fd6cf54363c3..e054dff7e9e1 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -88,7 +88,7 @@ static void virtio_p9_error_reply(struct p9_dev *p9dev, { u16 tag; - pdu->write_offset = VIRTIO_P9_HDR_LEN; + pdu->write_offset = VIRTIO_9P_HDR_LEN; virtio_p9_pdu_writef(pdu, "d", err); *outlen = pdu->write_offset; @@ -111,7 +111,7 @@ static void virtio_p9_version(struct p9_dev *p9dev, * reply with the same msize the client sent us * Error out if the request is not for 9P2000.L */ - if (!strcmp(version, VIRTIO_P9_VERSION_DOTL)) + if (!strcmp(version, VIRTIO_9P_VERSION_DOTL)) virtio_p9_pdu_writef(pdu, "ds", msize, version); else virtio_p9_pdu_writef(pdu, "ds", msize, "unknown"); @@ -331,7 +331,7 @@ static void virtio_p9_walk(struct p9_dev *p9dev, new_fid->uid = p9dev->fids[fid_val].uid; } *outlen = pdu->write_offset; - pdu->write_offset = VIRTIO_P9_HDR_LEN; + pdu->write_offset = VIRTIO_9P_HDR_LEN; virtio_p9_pdu_writef(pdu, "d", nwqid); virtio_p9_set_reply_header(pdu, *outlen); return; @@ -358,7 +358,7 @@ static void virtio_p9_attach(struct p9_dev *p9dev, free(aname); /* Reset everything */ - for (i = 0; i < VIRTIO_P9_MAX_FID; i++) + for (i = 0; i < VIRTIO_9P_MAX_FID; i++) p9dev->fids[i].fid = P9_NOFID; if (lstat(p9dev->root_dir, &st) < 0) @@ -423,8 +423,8 @@ static void virtio_p9_read(struct p9_dev *p9dev, iov_base = pdu->in_iov[0].iov_base; iov_len = pdu->in_iov[0].iov_len; iov_cnt = pdu->in_iov_cnt; - pdu->in_iov[0].iov_base += VIRTIO_P9_HDR_LEN + sizeof(u32); - pdu->in_iov[0].iov_len -= VIRTIO_P9_HDR_LEN + sizeof(u32); + pdu->in_iov[0].iov_base += VIRTIO_9P_HDR_LEN + sizeof(u32); + pdu->in_iov[0].iov_len -= VIRTIO_9P_HDR_LEN + sizeof(u32); pdu->in_iov_cnt = virtio_p9_update_iov_cnt(pdu->in_iov, count, pdu->in_iov_cnt); @@ -440,7 +440,7 @@ static void virtio_p9_read(struct p9_dev *p9dev, pdu->in_iov[0].iov_len = iov_len; pdu->in_iov_cnt = iov_cnt; - pdu->write_offset = VIRTIO_P9_HDR_LEN; + pdu->write_offset = VIRTIO_9P_HDR_LEN; virtio_p9_pdu_writef(pdu, "d", rcount); *outlen = pdu->write_offset + rcount; virtio_p9_set_reply_header(pdu, *outlen); @@ -504,7 +504,7 @@ static void virtio_p9_readdir(struct p9_dev *p9dev, dent = readdir(fid->dir); } - pdu->write_offset = VIRTIO_P9_HDR_LEN; + pdu->write_offset = VIRTIO_9P_HDR_LEN; virtio_p9_pdu_writef(pdu, "d", rcount); *outlen = pdu->write_offset + rcount; virtio_p9_set_reply_header(pdu, *outlen); @@ -628,7 +628,7 @@ static void virtio_p9_setattr(struct p9_dev *p9dev, if (ret < 0) goto err_out; } - *outlen = VIRTIO_P9_HDR_LEN; + *outlen = VIRTIO_9P_HDR_LEN; virtio_p9_set_reply_header(pdu, *outlen); return; err_out: @@ -1018,7 +1018,7 @@ static void virtio_p9_renameat(struct p9_dev *p9dev, * Now fix path in other fids, if the renamed path is part of * that. */ - for (i = 0; i < VIRTIO_P9_MAX_FID; i++) { + for (i = 0; i < VIRTIO_9P_MAX_FID; i++) { if (p9dev->fids[i].fid != P9_NOFID && virtio_p9_ancestor(p9dev->fids[i].path, old_name)) { virtio_p9_fix_path(p9dev->fids[i].path, old_name, @@ -1113,8 +1113,8 @@ static struct p9_pdu *virtio_p9_pdu_init(struct kvm *kvm, struct virt_queue *vq) return NULL; /* skip the pdu header p9_msg */ - pdu->read_offset = VIRTIO_P9_HDR_LEN; - pdu->write_offset = VIRTIO_P9_HDR_LEN; + pdu->read_offset = VIRTIO_9P_HDR_LEN; + pdu->write_offset = VIRTIO_9P_HDR_LEN; pdu->queue_head = virt_queue__get_inout_iov(kvm, vq, pdu->in_iov, pdu->out_iov, &pdu->in_iov_cnt, @@ -1261,7 +1261,7 @@ int virtio_9p__init(struct kvm *kvm) list_for_each_entry(p9dev, &devs, list) { virtio_init(kvm, p9dev, &p9dev->vdev, &p9_dev_virtio_ops, - VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_P9, VIRTIO_ID_9P, PCI_CLASS_P9); + VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_9P, VIRTIO_ID_9P, PCI_CLASS_9P); } return 0; @@ -1278,7 +1278,7 @@ int virtio_9p__register(struct kvm *kvm, const char *root, const char *tag_name) return -ENOMEM; if (!tag_name) - tag_name = VIRTIO_P9_DEFAULT_TAG; + tag_name = VIRTIO_9P_DEFAULT_TAG; p9dev->config = calloc(1, sizeof(*p9dev->config) + strlen(tag_name) + 1); if (p9dev->config == NULL) { @@ -1292,7 +1292,7 @@ int virtio_9p__register(struct kvm *kvm, const char *root, const char *tag_name) * We prefix the full path in all fids, This allows us to get the * absolute path of an fid without playing with strings. */ - for (i = 0; i < VIRTIO_P9_MAX_FID; i++) { + for (i = 0; i < VIRTIO_9P_MAX_FID; i++) { strcpy(p9dev->fids[i].abs_path, root); p9dev->fids[i].path = p9dev->fids[i].abs_path + root_len; } -- 2.39.5