hw/9pfs: Create other filesystem objects
Add interfaces to create filesystem objects like directory,device nodes, symbolic links, links for proxy filesytem driver
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: 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.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
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.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>...
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: Make v9fs_string* functions non-static
We will use them later in other files
hw/9pfs: Use read-write lock for protecting fid path.
On rename we take the write lock and this ensure pathdoesn't change as we operate on them.
hw/9pfs: Move fid pathname tracking to seperate data type.
This enables us to add handles to track fids later. TheV9fsPath added is similar to V9fsString except that thesize include the NULL byte also.
hw/9pfs: Add init callback to fs driver
This call back can be used to do fs driver specific initialization.
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
Merge remote-tracking branch 'aneesh/for-upstream-4' into staging
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Don't use g_thread_get_initialized.
Initialize glib threads unconditionally in main() insteadof using g_thread_get_initialized in the 9p code.
Fixes a build failure on RHEL-5, which ships glib 2.12.g_thread_get_initialized was added in 2.20.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
hw/9pfs: add 9P2000.L unlinkat operation
unlinkat - Remove a directory entry
size4 Tunlinkat tag2 dirfid4 name[s] flag4size4 Runlinkat tag2
older Tremove have the below request format
size4 Tremove tag2 fid4
The remove message is used to remove a directory entry either file or directory...
hw/9pfs: add 9P2000.L renameat operation
rename - change name of file or directory
size4 Trenameat tag2 olddirfid4 oldname[s] newdirfid4 newname[s]size4 Rrenameat tag2
older Trename have the below request format
size4 Trename tag2 fid4 newdirfid4 name[s]...
hw/9pfs: Fix memleaks in some 9p operation
hw/9pfs: Initialize rest of qid field to zero.
Since qid is allocated out of stack we need to intializethe field to zero. Otherwise we will send wrong qid valueto client.
hw/9pfs: Update the fidp path before opendir
We need to update the fidp path before opendir. Since we don'tuse the fid returned by mkdir, earlier code should not havemuch issue. We do a double v9fs_string_copy here. The later patchcleanup the entire function....
virtio-9p: Fix syntax error in debug code
This error was reported by cppcheck:
qemu/hw/9pfs/virtio-9p-debug.c:342:error: Invalid number of character ({) when these macros are defined:'DEBUG_DATA'.
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>...
Merge remote-tracking branch 'aneesh/for-upstream-3' into staging
Use new macro QEMU_PACKED for packed structures
Most changes were made using these commands:
git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'...
hw/9pfs: Use v9fs_do_close instead of close
we should use the local abstraction instead ofdirectly calling close.
hw/9pfs: Add directory reclaim support
hw/9pfs: mark directories also as un-reclaimable on unlink
hw/9pfs: Add reference counting for fid
hw/9pfs: Add file descriptor reclaim support
[M. Mohan Kumar <mohan@in.ibm.com> removed some unused variables]
hw/9pfs: init fid list properly
use readdir_r instead of readdir for reentrancy
hw/9pfs: Update v9fs_read to use coroutines
hw/9pfs: Add yield support for preadv coroutine
hw/9pfs: Update v9fs_attach to use coroutines
hw/9pfs: Update v9fs_wstat to use coroutines
hw/9pfs: Update v9fs_write to use coroutines
hw/9pfs: Add yield support for pwritev coroutine
hw/9pfs: Update v9fs_link to use coroutines
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs: Add yield support for link coroutine
hw/9pfs: Update v9fs_symlink to use coroutines
hw/9pfs: Add yield support for symlin coroutine
hw/9pfs: Update v9fs_create to use coroutines
hw/9pfs: Update v9fs_fsync to use coroutines
hw/9pfs: Add yield support for fsync coroutine
hw/9pfs: Update v9fs_clunk to use coroutines
hw/9pfs: Add yeild support for clunk related coroutine
This include lsetxattr, lremovexattr, closedir and close.
hw/9pfs: Update v9fs_walk to use coroutines
hw/9pfs: Update v9fs_stat to use coroutines
hw/9pfs: Add yield support for open2 coroutine
hw/9pfs: Update v9fs_lcreate to use coroutines
hw/9pfs: Add yield support for open and opendir coroutine
hw/9pfs: Update v9fs_open to use coroutines
hw/9pfs: Update v9fs_getlock to use coroutines
hw/9pfs: Add yeild support for fstat coroutine
hw/9pfs: Update v9fs_lock to use coroutines
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/9pfs: Add yeild support to rename coroutine
hw/9pfs: Update vfs_rename to use coroutines
I guess TRENAME 9p operation needs an update. The 9p op shouldmore similar renameat. Otherwise anything other than path cannot trackthe fid.
hw/9pfs: Update v9fs_remove to use coroutines
hw/9pfs: Add yield support for remove
hw/9pfs: Update mkdir to use coroutines
Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com>Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
hw/9pfs: Add yield support for mkdir coroutine