hw/9pfs: Fix segfault with 9p2000.u
When guest tries to chmod a block or char device file over 9pfs,the qemu process segfaults. With 9p2000.u protocol we use wstat tochange mode bits and client don't send extension information forchmod. We need to check for size field to check whether extension...
hw/9pfs: use O_NOFOLLOW for mapped readlink operation
With mapped security models like mapped-xattr and mapped-file, we save thesymlink target as file contents. Now if we ever expose a normal directorywith mapped security model and find real symlinks in export path, never...
hw/9pfs: Use O_NOFOLLOW when opening files on server
9p server should never follow a symlink. So use O_NOFOLLOW with all opensyscall
Tested-by: "M. Mohan Kumar" <mohan@in.ibm.com>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs: Be robust against paths without FS_IOC_GETVERSION
9P optionally uses the FS_IOC_GETVERSION ioctl to get information abouta file's version (sometimes called generation number).
The code checks for supported filesystems at mount time, but some paths...
remove double semicolons
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
virtio: remove the function pointer.
This remove the function pointer in VirtIODevice, and use onlyVirtioDeviceClass function pointer.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>Message-id: 1366791683-5350-5-git-send-email-fred.konrad@greensocs.com...
virtio-9p: add the virtio-9p device.
Create virtio-9p-device which extends virtio-device, so it can be connected onvirtio-bus.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>Message-id: 1366708123-19626-2-git-send-email-fred.konrad@greensocs.com...
virtio-9p-pci: switch to the new API.
Here the virtio-9p-pci is modified for the new API. The devicevirtio-9p-pci extends virtio-pci. It creates and connects avirtio-9p-device during the init. The properties are not changed.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>...
virtio-9p: cleanup: init function.
This remove old init function as it is no longer needed.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>Message-id: 1366708123-19626-4-git-send-email-fred.konrad@greensocs.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-9p: cleanup: QOM casts.
As the virtio-9p-pci is switched to the new API, we can use QOM casts.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>Message-id: 1366708123-19626-5-git-send-email-fred.konrad@greensocs.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-9p: Fix virtio-9p no longer building after hw-dirs branch merge
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Message-id: 1365495755-10902-1-git-send-email-hdegoede@redhat.comCc: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification.Right now there are many catch-all headers in include/hw/ARCH dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
virtio-9p: remove PCI dependencies from hw/9pfs/
Also move the 9p.h file to 9pfs/virtio-9p-device.h, for consistencywith the corresponding .c file.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw: move qdev-monitor.o to toplevel directory
qdev-monitor.c is the only "core qdev" file that is not used inuser-mode emulation, and it does not define anything that is usedby hardware models. Remove it from the hw/ directory andremove hw/qdev-monitor.h from hw/qdev.h too; this requires...
error: Strip trailing '\n' from error string arguments (again)
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep comingback. Tracked down with this Coccinelle semantic patch:
r expression err, eno, cls, fmt; position p; @@ (...
r
qemu/9p: Don't ignore error in fid clunk
We use the clunk request to do the actual xattr operation. So don'tignore the error value for fid clunk.
Security model "none" don't support posix acl. Without this patchguest won't get EOPNOTSUPP error on setxattr("system.posix_acl_access")...
g_malloc(0) and g_malloc0(0) return NULL; simplify
Once upon a time, it was decided that qemu_malloc(0) should abort.Switching to glib retired that bright idea. Some code that was addedto cope with it (e.g. in commits 702ef63, b76b6e9) is still around....
g_strdup(NULL) returns NULL; simplify
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/9pfs: Fix unchecked strdup() by converting to g_strdup()
Note: the allocation in virtio_9p_init() is still leaked. To be fixedin a followup commit.
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pci,virtio
This further optimizes MSIX handling in virtio-pci.Also included is pci cleanup by Paolo, and pci deviceassignment fix by Alex.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
Make all static TypeInfos const
Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register alltypes natively through QEMU Object Model), TypeInfo as used inthe common, non-iterative pattern is no longer amended with informationand should therefore be const....
virtio-9p: use symbolic constant, add to pci-ids.txt
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
misc: move include files to include/qemu/
migration: move include files to include/migration/
janitor: add guards to headers
block: move include files to include/block/
janitor: do not include qemu-char everywhere
Touching char/char.h basically causes the whole of QEMU tobe rebuilt. Avoid this, it is usually unnecessary.
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
Remove libhw
The entries for libhw* are no longer needed in .gitignore.
There is also no longer a difference between common-obj-y andhw-obj-y, so one of those two macros is sufficient.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
hw/9pfs: avoid buffer overrun
v9fs_add_dir_node and qemu_v9fs_synth_add_file used strncpyto form node->name, which requires NUL-termination, butstrncpy does not ensure NUL-termination.Use pstrcpy, which does.
Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>...
virtio-9p: avoid unwarranted uses of strncpy
In all of these cases, the uses of strncpy were unnecessary, sinceat each point of use we know that the NUL-terminated source bytesfit in the destination buffer. Use memcpy in place of strncpy.
hw/9pfs: Fix assert when disabling migration
For 9p we can get the attach request multiple times for thesame export. So don't adding migration blocker for everyattach request.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Merge remote-tracking branch 'mjt/mjt-iov2' into staging
consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent
qemu_iovec_concat() is currently a wrapper forqemu_iovec_copy(), use the former (with extra"0" arg) in a few places where it is used.
Change skip argument of qemu_iovec_copy() from...
build: convert libhw to nested Makefile.objs
After this patch, the libhw* directories will have a hierarchythat mimics the source tree. This is useful because we do havea couple of files there that are in the top source directory.
build: move per-target hw/ objects to nested Makefile.objs
This completes the move to nested Makefiles for virtio and a fewother files that were not part of obj-TARGET-y, but still werecompiled separately for each target.
hw/9pfs: Endian fixes for virtfs
This patch fixes several endian bugs in virtfs.
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
Merge remote-tracking branch 'aneesh/for-upstream' into staging
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and thenrebased it into a single step which avoids repeatedly touching every file inthe tree.
The first step was a sed-based addition of the parent type to the subclass...
hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode
When 2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903 added support forthe 'readonly' flag against 9p filesystems, it also made QEMUadd the O_NOATIME flag as a side-effect.
The O_NOATIME flag, however, may only be set by the file owner,...
hw/9pfs: Preserve S_ISGID
In passthrough security model in local fs driver, after a file creationchown and chmod are done to set the file credentials and mode as requestedby 9p client. But if there was a request to create a file with S_ISGIDbit, doing chown on that file resets the S_ISGID bit. So first call...
hw/9pfs: Fix crash when mounting with synthfs
Some Fsdriver backend don't have fs_root. So check for that inmigrate message.
pci: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: prepare source tree for code conversion
These are various small stylistic changes which help make things moreconsistent such that the automated conversion script can be simpler.
It's not necessary to agree or disagree with these style changes because all...
hw/9pfs: Add new security model mapped-file.
This enable us to do passthrough equivalent security model on NFS directory.NFS server mostly do root squashing and don't support xattr. Hence we cannotuse 'passthrough' or 'mapped' security model
Also added "mapped-xattr" security to indicate earlier "mapped" security model...
virtio-9p-proxy: Fix typo causing compile failure on 32 bit hosts
Fix a compile failure on 32 bit hosts (integer constant is too largefor 'unsigned long' type) by correcting a typo where the mask usedfor filling in the second f_fsid word had too many 'F's in it....
hw/9pfs: Add support to use named socket for proxy FS
Add option to use named socket for communicating between proxy helperand qemu proxy FS. Access to socket can be given by using command lineoptions -u and -g.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>...
hw/9pfs: Proxy getversion
Add proxy getversion to get generation number
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs: xattr interfaces in proxy filesystem driver
Add xattr support for proxy FS
hw/9pfs: File ownership and others
Add file ownership interfaces like chmod/chown, utime update, rename,remove and truncating files for proxy FS
hw/9pfs: Add stat/readlink/statfs for proxy FS
hw/9pfs: Create other filesystem objects
Add interfaces to create filesystem objects like directory,device nodes, symbolic links, links for proxy filesytem driver
hw/9pfs: Open and create files
Add interfaces to open and create files for proxy file system driver.
hw/9pfs: File system helper process for qemu 9p proxy FS
Provide root privilege access to QEMU 9p proxy filesystem using socketcommunication.
Proxy helper is started by root user as:~ # virtfs-proxy-helper -f|--fd <socket descriptor> -p|--path <path-to-share>...
hw/9pfs: Add new proxy filesystem driver
Add new proxy filesystem driver to add root privilege to qemu process.It needs a helper process to be started by root user.
Following command line can be used to utilize proxy filesystem driver-virtfs proxy,id=<id>,mount_tag=<tag>,socket_fd=<socket-fd>...
hw/9pfs: Add validation to {un}marshal code
hw/9pfs: Move opt validation to FsDriver callback
This remove all conditional code from common code path andmake opt validation a FSDriver callback.
hw/9pfs: Move pdu_marshal/unmarshal code to a seperate file
Move p9 marshaling/unmarshaling code to a separate file so thatproxy filesytem driver can use these calls. Also made marshalingcode generic to accept "struct iovec" instead of V9fsPDU.
hw/9pfs: Use the correct signed type for different variables
hw/9pfs: iattr_valid flags are kernel internal flags map them to 9p values.
Kernel internal values can change, add protocol values for these constant anduse them.
hw/9pfs: replace iovec manipulation with QEMUIOVector
The v9fs_read() and v9fs_write() functions rely on iovec[] manipulationcode should be replaced with QEMUIOVector to avoid duplicating code.In the future it may be possible to make the code even more concise by...
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
fix spelling in hw sub directory
Correct obvious spelling errors in qemu/hw directory.
hw/9pfs: use migration blockers to prevent live migration when virtfs export path is mounted
Now when you try to migrate with VirtFS export path mounted, you get a proper QMP error:
(qemu) migrate tcp:localhost:4444Migration is disabled when VirtFS export path '/tmp/' is mounted in the guest using mount_tag 'v_tmp'...
hw/9pfs: Reset server state during TVERSION
As per the 9p rfc, during TVERSION its necessary to clean all the activefids, so that we start the session from a clean state. Its also needed inscenarios where the guest is booting off 9p, and boot fails, and client...
hw/9pfs: Add qdev.reset callback for virtio-9p-pci device
Add the device reset callback
hw/9pfs: Use the correct file descriptor in Fsdriver Callback
Fsdriver callback that operate on file descriptor need todifferentiate between directory fd and file fd.
Based on the original patch from Sassan Panahinejad <sassan@sassan.me.uk>
hw/9pfs: Improve portability to older systems
handle fs driver require a set of newly added syscalls. Don'tCompile handle FS driver if those syscalls are not available.Instead of adding #ifdef for all those syscalls we check foropen by handle syscall. If that is available then rest of the...
9pfs: improve portability to older systems
I guess we can also make sure we don't call local_ioc_getversion atall.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Small requirements on "new" features have percolated to virtio-9p-local.c.In particular, the utimensat wrapper actually only supports dirfd = AT_FDCWDand flags = AT_SYMLINK_NOFOLLOW in the fallback code. Remove the arguments...
9p: pass dotl flags to the unlinkat method
AT_REMOVEDIR is not defined on all systems. Pass the raw flags from the9p protocol, which are always there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9p: allow compiling the dummy virtio-9p-handle.c code on Linux
Avoid a conflict on the definition of struct file_handle byusing a replacement name.
configure: fix detection for xattr.h on modern distributions
Modern distributions place xattr.h in /usr/include/sys, and foldlibattr.so into libc. They also don't have an ENOATTR.
Make configure detect this, and add a qemu-xattr.h file thatdirects the #include to the right place....
hw/9pfs: use g_vasprintf() instead of rolling our own
Markus Armbruster <armbru@redhat.com> sent fixes for va_list varargissues in v9fs_string_alloc_printf(). It turns out the functionduplicates g_vasprintf() and can therefore be eliminated entirely....
hw/9pfs: Add synthetic file system support using 9p
This patch create a synthetic file system with mount tagv_synth when -virtfs_synth command line option is specifiedin qemu. The synthetic file system can be mounted in guestusing 9p using the below command line...
hw/9pfs: Replace rwlocks with RCU variants of interfaces.
Use QLIST_INSERT_HEAD_RCU and rcu_read_lock/unlock instead of rwlocks.Use v9fs_synth_mutex as a write-only mutex to handle concurrent writers.
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>...
hw/9pfs: Read-only support for 9p export
A new fsdev parameter "readonly" is introduced to control accessing 9p export."readonly" can be used to specify the access type. By default "rw" accessis given to 9p export.
hw/9pfs: Abstract open state of fid to V9fsFidOpenState
To implement synthetic file system in Qemu we may not reallyrequire file descriptor and Dir *. Make generic code useV9fsFidOpenState instead.
hw/9pfs: Fix error handling in local_mknod
Update local_chown to remove unnecessary if loop
hw/9pfs: Make VirtFS tracing work correctly
this patch fix multiple issues with VirtFS tracing.a) Add tracepoint to the correct code path. We handle error in complete_pdub) Fix indentation in python scriptc) Fix variable naming issue in python script...
hw/9pfs: Add open flag mapping
Some of the flags are OS/arch dependent we need to use9P defined value on wire,
Based on the original patch from Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
hw/9pfs: Add st_gen support in getattr reply
This patch use file system specific ioctl for getting i_generationvalue. Not all file system support the ioctl. So we add an exportspecific extended operation and assign right callback for thefile system that support i_generation ioctl...
hw/9pfs: Add st_gen support for handle based fs driver
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs: Introduce tracing for 9p pdu handlers
Plan is to replace the existing debug infrastructure with Qemu tracinginfrastructure so that user can dynamically enable/disable trace events andtherefore a meaningful trace log can be generated which can be further...
hw/9pfs: Remove virtio-9p-debug.* infra to be replaced by Qemu Tracing.
Removing the existing debug infrastrucure as proposed to be replaced byQemu Tracing infrastructure.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>...
hw/9pfs: Use fs driver specific lstat
Use file system driver specific lstat instead of generic lstat.
hw/9pfs: Use export_flag for indicating whether fs driver use path names.
This allows us to remove another member from the struct
hw/9pfs: Rename fstype to fsdriver to make it consistent across VirtFS code
hw/9pfs: Use export flag for indicating security model
This helps to remove some of the structure members
hw/9pfs: Fix build error on platform that don't support futimens
Also don't do glibc version check to find handle support. Insteaddo handle syscall support in configure.
virtio-9p: Use 9P specific Lock constants
Use 9P specific lock constants instead of arch specific lock constants.
hw/9pfs: Ensure an error is reported to user if 9pfs mount tag is too long
If the 9pfs mount tag is longer than MAX_TAG_LEN bytes, rather thansilently truncating the tag which will likely break the guest OS,report an immediate error and exit QEMU
hw/9pfs: Use ioeventfd for 9p
With ioeventfd:[root@qemu-img-64 storage]# dd if=/dev/zero of=/storage/testx bs=8k count=131072 oflag=direct131072+0 records in131072+0 records out1073741824 bytes (1.1 GB) copied, 26.767 s, 40.1 MB/s
Without:[root@qemu-img-64 storage]# dd if=/dev/zero of=/storage/testx bs=8k count=131072 oflag=direct...
hw/9pfs: Add new virtfs option writeout=immediate skip host page cache
writeout=immediate implies the after pwritev we do a sync_file_range.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs: Add handle based fs driver
hw/9pfs: Add fs driver specific details to fscontext
Add a new context flag PATHNAME_FSCONTEXT and indicate whetherthe fs driver track fid using path names. Also add a privatepointer that help us to track fs driver specific values in there
hw/9pfs: Avoid unnecessary get_fid in v9fs_clunk
hw/9pfs: Implement TFLUSH operation