summaryrefslogtreecommitdiff
path: root/hw/9pfs
AgeCommit message (Collapse)AuthorFilesLines
2016-03-22util: move declarations out of qemu-common.hVeronia Bahaa4-0/+4
Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22include/qemu/osdep.h: Don't include qapi/error.hMarkus Armbruster1-0/+1
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the Error typedef. Since then, we've moved to include qemu/osdep.h everywhere. Its file comment explains: "To avoid getting into possible circular include dependencies, this file should not include any other QEMU headers, with the exceptions of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which are doing a similar job to this file and are under similar constraints." qapi/error.h doesn't do a similar job, and it doesn't adhere to similar constraints: it includes qapi-types.h. That's in excess of 100KiB of crap most .c files don't actually need. Add the typedef to qemu/typedefs.h, and include that instead of qapi/error.h. Include qapi/error.h in .c files that need it and don't get it now. Include qapi-types.h in qom/object.h for uint16List. Update scripts/clean-includes accordingly. Update it further to match reality: replace config.h by config-target.h, add sysemu/os-posix.h, sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h comment quoted above similarly. This reduces the number of objects depending on qapi/error.h from "all of them" to less than a third. Unfortunately, the number depending on qapi-types.h shrinks only a little. More work is needed for that one. Signed-off-by: Markus Armbruster <armbru@redhat.com> [Fix compilation without the spice devel packages. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-02-23all: Clean up includesPeter Maydell2-5/+0
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-02-06virtio: move allocation to virtqueue_pop/vring_popPaolo Bonzini3-9/+12
The return code of virtqueue_pop/vring_pop is unused except to check for errors or 0. We can thus easily move allocation inside the functions and just return a pointer to the VirtQueueElement. The advantage is that we will be able to allocate only the space that is needed for the actual size of the s/g list instead of the full VIRTQUEUE_MAX_SIZE items. Currently VirtQueueElement takes about 48K of memory, and this kind of allocation puts a lot of stress on malloc. By cutting the size by two or three orders of magnitude, malloc can use much more efficient algorithms. The patch is pretty large, but changes to each device are testable more or less independently. Splitting it would mostly add churn. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-01-299pfs: Clean up includesPeter Maydell13-4/+13
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453832250-766-18-git-send-email-peter.maydell@linaro.org
2016-01-29virtio: Clean up includesPeter Maydell1-0/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453832250-766-15-git-send-email-peter.maydell@linaro.org
2016-01-229pfs: use error_report() instead of fprintf(stderr)Greg Kurz4-16/+18
Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
2016-01-129pfs: introduce V9fsVirtioStateWei Liu4-38/+69
V9fsState now only contains generic fields. Introduce V9fsVirtioState for virtio transport. Change virtio-pci and virtio-ccw to use V9fsVirtioState. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: factor out v9fs_device_{,un}realize_commonWei Liu3-83/+104
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p.c to 9p.cWei Liu2-1/+1
Now that file only contains generic code. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio_9p_set_fd_limit to use v9fs_ prefixWei Liu1-1/+1
It's not virtio specific. Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2016-01-089pfs: move handle_9p_output and make it static functionWei Liu3-34/+34
It's only used in virtio device. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: export pdu_{submit,alloc,free}Wei Liu2-3/+6
They will be used in later patches. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: factor out virtio_9p_push_and_notifyWei Liu3-7/+14
The new function resides in virtio specific file. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: break out 9p.h from virtio-9p.hWei Liu9-325/+333
Move out generic definitions from virtio-9p.h to 9p.h. Fix header inclusions. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: break out virtio_init_iov_from_pduWei Liu3-7/+15
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: factor out pdu_push_and_notifyWei Liu1-5/+12
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: factor out virtio_pdu_{,un}marshalWei Liu3-4/+21
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: make pdu_{,un}marshal proper functionsWei Liu2-4/+28
Factor out v9fs_iov_v{,un}marshal. Implement pdu_{,un}marshal with those functions. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: PDU processing functions should start pdu_ prefixWei Liu1-44/+44
This matches naming convention of pdu_marshal and pdu_unmarshal. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: PDU processing functions don't need to take V9fsState as argumentWei Liu2-53/+46
V9fsState can be referenced by pdu->s. Initialise that in device realization function. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-08fsdev: rename virtio-9p-marshal.{c,h} to 9p-iov-marshal.{c,h}Wei Liu2-5/+5
And rename v9fs_marshal to v9fs_iov_marshal, v9fs_unmarshal to v9fs_iov_unmarshal. The rationale behind this change is that, this marshalling interface is used both by virtio and proxy helper. Renaming files and functions to reflect the true nature of this interface. Xen transport is going to have its own marshalling interface. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: remove dead codeWei Liu1-68/+0
Some structures in virtio-9p.h have been unused since 2011 when relevant functions switched to use coroutines. The declaration of pdu_packunpack and function do_pdu_unpack are useless. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: merge hw/virtio/virtio-9p.h into hw/9pfs/virtio-9p.hWei Liu2-2/+7
The deleted file only contained V9fsConf which wasn't virtio specific. Merge that to the general header of 9pfs. Fixed header inclusions as I went along. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-xattr{,-user}.{c,h} to 9p-xattr{,-user}.{c,h}Wei Liu10-17/+15
These three files are not virtio specific. Rename them to generic names. Fix comments and header inclusion in various files. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-synth.{c,h} to 9p-synth.{c,h}Wei Liu3-5/+5
These two files are not virtio specific. Rename them to use generic names. Fix includes in various C files. Change define guards and comments in header files. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-proxy.{c,h} to 9p-proxy.{c,h}Wei Liu3-7/+6
Those two files are not virtio specific. Rename them to use generic names. Fix includes in various C files. Change define guards and comments in header files. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-posix-acl.c to 9p-posix-acl.cWei Liu2-3/+2
This file is not virtio specific. Rename it to use generic name. Fix comment and remove unneeded inclusion of virtio.h. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-local.c to 9p-local.cWei Liu2-3/+2
This file is not virtio specific. Rename it to use generic name. Fix comment and remove unneeded inclusion of virtio.h. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-handle.c to 9p-handle.cWei Liu2-3/+2
This file is not virtio specific. Rename it to use generic name. Fix comment and remove unneeded inclusion of virtio.h. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-089pfs: rename virtio-9p-coth.{c,h} to coth.{c,h}Wei Liu9-12/+12
Those two files are not virtio specific. Rename them to use generic names. Fix includes in various C files. Change define guards and comments in header files. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2015-12-23virtio-9p: use accessor to get thread_poolGreg Kurz1-1/+1
The aio_context_new() function does not allocate a thread pool. This is deferred to the first call to the aio_get_thread_pool() accessor. It is hence forbidden to access the thread_pool field directly, as it may be NULL. The accessor *must* be used always. Fixes: ebac1202c95a4f1b76b6ef3f0f63926fa76e753e Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Tested-by: Michael Tokarev <mjt@tls.msk.ru> Cc: qemu-stable@nongnu.org Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
2015-12-10virtio-9p-device: add minimal unrealize handlerGreg Kurz1-0/+12
Since commit 4652f1640e029e1f2433fa77ba6af285 "virtio-9p: add savevm handlers", if the user hot-unplugs a quiescent 9p device and live migrates, the source QEMU crashes before migration completetion... This happens because virtio-9p devices have a realize handler which calls virtio_init() and register_savevm(). Both calls store pointers to the device internals, that get dereferenced during migration even if the device got unplugged. This patch simply adds an unrealize handler to perform minimal cleanup and avoid the crash. Hot unplug of non-quiescent 9p devices is still not supported in QEMU, and not supported by linux guests either. Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 20151208155457.27775.69441.stgit@bahia.huguette.org [PMM: rewrapped long lines in commit message] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-30virtio-9p: use QEMU thread poolPaolo Bonzini3-68/+15
The QEMU thread pool already has a mechanism to invoke callbacks in the main thread. It does not need an EventNotifier and it is more efficient too. Use it instead of GAsyncQueue + GThreadPool + glue. As a side effect, it silences Coverity's complaint about an unchecked return value for event_notifier_init. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com> (removed no more needed #include <glib.h> from virtio-9p-coth.h) Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
2015-11-12virtio-9p: add savem handlersGreg Kurz1-0/+11
We don't support migration of mounted 9p shares. This is handled by a migration blocker. One would expect, however, to be able to migrate if the share is unmounted. Unfortunately virtio-9p-device does not register savevm handlers at all ! Migration succeeds and leaves the guest with a dangling device... This patch simply registers migration handlers for virtio-9p-device. Whether migration is possible or not still depends on the migration blocker. Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-20coroutine: move into libqemuutil.a libraryDaniel P. Berrange7-7/+7
The coroutine files are currently referenced by the block-obj-y variable. The coroutine functionality though is already used by more than just the block code. eg migration code uses coroutine yield. In the future the I/O channel code will also use the coroutine yield functionality. Since the coroutine code is nicely self-contained it can be easily built as part of the libqemuutil.a library, making it widely available. The headers are also moved into include/qemu, instead of the include/block directory, since they are now part of the util codebase, and the impl was never in the block/ directory either. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-07-27virtio: get_features() can failJason Wang1-1/+2
Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2015-07-27virtio-9p: fix any_layoutMichael S. Tsirkin1-6/+17
virtio pci allows any device to have a modern interface, this in turn requires ANY_LAYOUT support. Fix up ANY_LAYOUT for virtio-9p. Reported-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com>
2015-06-22qerror: Move #include out of qerror.hMarkus Armbruster1-0/+1
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
2015-06-10virtio-9p-device: move qdev properties into virtio-9p-device.cShannon Zhao2-5/+2
As only one place in virtio-9p-device.c uses DEFINE_VIRTIO_9P_PROPERTIES, there is no need to expose it. Inline it into virtio-9p-device.c to avoid wrongly use. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-01virtio: make features 64bit wideGerd Hoffmann1-1/+1
Make features 64bit wide everywhere. On migration a full 64bit guest_features field is sent if one of the high bits is set, in addition to the lower 32bit guest_features field which must stay for compatibility reasons. That way we send the lower 32 feature bits twice, but the code is simpler because we don't have to split and compose the 64bit features into two 32bit fields. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-03-199pfs: Fix warnings from SparseStefan Weil4-7/+8
Sparse report: 9pfs/virtio-9p.c:1953:9: warning: returning void-valued expression 9pfs/virtio-9p-handle.c:143:5: warning: returning void-valued expression 9pfs/virtio-9p-handle.c:160:5: warning: returning void-valued expression 9pfs/virtio-9p-local.c:384:5: warning: returning void-valued expression 9pfs/virtio-9p-local.c:415:5: warning: returning void-valued expression 9pfs/virtio-9p-proxy.c:672:5: warning: returning void-valued expression 9pfs/virtio-9p-proxy.c:689:5: warning: returning void-valued expression Cc: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-03-16virtio: Fix memory leaks reported by CoverityStefan Weil1-20/+8
All four leaks are similar, so fix them in one patch. Success path was not doing memory free. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2015-03-16virtfs-proxy: Fix possible overflowShannon Zhao1-0/+4
It's detected by coverity. The socket name specified should fit in the sockadd_un.sun_path. If not abort. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2015-03-13hw/9pfs/virtio-9p-posix-acl: Fix out-of-bounds accessShannon Zhao1-1/+1
It's detected by coverity. Fix out-of-bounds access of the function mp_dacl_listxattr. Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2015-03-129pfs-proxy: tiny cleanups in proxy_pwritev and proxy_preadvMichael Tokarev1-10/+8
Don't compare syscall return with -1, use "<0" condition. Don't introduce useless local variables when we already have similar variable Rename local variable to be consistent with other usages Finally make the two methods, read and write, to be similar to each other Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2015-03-129pfs-local: simplify/optimize local_mapped_attr_path()Michael Tokarev1-13/+11
Omit one unnecessary memory allocation for components of the path and create the resulting path directly given lengths of the components. Do not use basename(3) because there are 2 versions of this function which differs when argument ends with slash character, use strrchr() instead so we have consistent result. This also makes sure the function will do the right thing in corner cases (eg, empty pathname is given), when basename(3) return entirely another string. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2015-03-109pfs: remove useless returnMichael Tokarev1-1/+0
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-02-26virtio: feature bit manipulation helpersCornelia Huck1-1/+1
Add virtio_{add,clear}_feature helper functions for manipulating a feature bits variable. This has some benefits over open coding: - add check that the bit is in a sane range - make it obvious at a glance what is going on - have a central point to change when we want to extend feature bits Convert existing code manipulating features to use the new helpers. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26virtio-9p: use standard headersMichael S. Tsirkin1-16/+1
Drop code duplicated from standard headers. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>