Commit Graph

53 Commits

Author SHA1 Message Date
Aneesh Kumar K.V 2289be19ae hw/9pfs: Move fid pathname tracking to seperate data type.
This enables us to add handles to track fids later. The
V9fsPath added is similar to V9fsString except that the
size include the NULL byte also.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 02cb7f3a25 hw/9pfs: Use read-write lock for protecting fid path.
On rename we take the write lock and this ensure path
doesn't change as we operate on them.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 70c18fc08b hw/9pfs: Make v9fs_string* functions non-static
We will use them later in other files

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 7834cf77be hw/9pfs: add 9P2000.L unlinkat operation
unlinkat - Remove a directory entry

size[4] Tunlinkat tag[2] dirfid[4] name[s] flag[4]
size[4] Runlinkat tag[2]

older Tremove have the below request format

size[4] Tremove tag[2] fid[4]

The remove message is used to remove a directory entry either file or directory
The remove opreation is actually a directory opertation and should ideally have
dirfid, if not we cannot represent the fid on server with anything other than
name. We will have to derive the directory name from fid in the Tremove request.

NOTE: The operation doesn't clunk the unlink fid.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 15:07:01 +05:30
Aneesh Kumar K.V 89bf65938a hw/9pfs: add 9P2000.L renameat operation
rename - change name of file or directory

size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s]
size[4] Rrenameat tag[2]

older Trename have the below request format

size[4] Trename tag[2] fid[4] newdirfid[4] name[s]

The rename message is used to change the name of a file, possibly moving it
to a new directory. The rename opreation is actually a directory opertation
and should ideally have olddirfid, if not we cannot represent the fid on server
with anything other than name. We will have to derive the old directory name
from fid in the Trename request.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:46:03 +05:30
Aneesh Kumar K.V 10e72295bd hw/9pfs: Fix memleaks in some 9p operation
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:46:00 +05:30
Aneesh Kumar K.V 25427ec143 hw/9pfs: Initialize rest of qid field to zero.
Since qid is allocated out of stack we need to intialize
the field to zero. Otherwise we will send wrong qid value
to client.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:45:55 +05:30
Aneesh Kumar K.V 407fee0f02 hw/9pfs: Update the fidp path before opendir
We need to update the fidp path before opendir. Since we don't
use the fid returned by mkdir, earlier code should not have
much issue. We do a double v9fs_string_copy here. The later patch
cleanup the entire function.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:45:53 +05:30
Aneesh Kumar K.V b9cb88b056 hw/9pfs: mark directories also as un-reclaimable on unlink
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-25 20:16:42 +05:30
Aneesh Kumar K.V 95f65511c3 hw/9pfs: Add directory reclaim support
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-25 20:16:42 +05:30
Aneesh Kumar K.V 9b54ffaab2 hw/9pfs: Use v9fs_do_close instead of close
we should use the local abstraction instead of
directly calling close.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-25 20:16:42 +05:30
Aneesh Kumar K.V 7a46274529 hw/9pfs: Add file descriptor reclaim support
[M. Mohan Kumar <mohan@in.ibm.com> removed some unused variables]

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-25 20:16:41 +05:30
Aneesh Kumar K.V 84dfb926e5 hw/9pfs: Add reference counting for fid
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-25 20:16:41 +05:30
Harsh Prateek Bora 5f524c1ebc use readdir_r instead of readdir for reentrancy
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:52 +05:30
Aneesh Kumar K.V d208a0e005 hw/9pfs: Update v9fs_read to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:50 +05:30
Aneesh Kumar K.V 8c158561a0 hw/9pfs: Update v9fs_attach to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:46 +05:30
Aneesh Kumar K.V b81d685e21 hw/9pfs: Update v9fs_wstat to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:42 +05:30
Aneesh Kumar K.V d7a9049119 hw/9pfs: Update v9fs_write to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:40 +05:30
Venkateswararao Jujjuri (JV) ffd668764c 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>
2011-08-22 09:44:35 +05:30
Venkateswararao Jujjuri 3fa2a8d1cd hw/9pfs: Update v9fs_symlink 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>
2011-08-22 09:44:29 +05:30
Venkateswararao Jujjuri baaa86d9f5 hw/9pfs: Update v9fs_create 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>
2011-08-22 09:44:22 +05:30
Aneesh Kumar K.V 4e9ad44498 hw/9pfs: Update v9fs_fsync to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:21 +05:30
Aneesh Kumar K.V c540ee5187 hw/9pfs: Update v9fs_clunk to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:16 +05:30
Aneesh Kumar K.V 3cc19c0c60 hw/9pfs: Update v9fs_walk to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:23:22 +05:30
Aneesh Kumar K.V d8e0c29e40 hw/9pfs: Update v9fs_stat to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:22:37 +05:30
Venkateswararao Jujjuri 36f8981f01 hw/9pfs: Update v9fs_lcreate 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>
2011-08-22 09:21:42 +05:30
Aneesh Kumar K.V 857bc158d4 hw/9pfs: Update v9fs_open to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:19:53 +05:30
Aneesh Kumar K.V e4e414a427 hw/9pfs: Update v9fs_getlock to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:18:58 +05:30
Aneesh Kumar K.V 0c27bf2a45 hw/9pfs: Update v9fs_lock to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:14:04 +05:30
Anthony Liguori 7267c0947d 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>
2011-08-20 23:01:08 -05:00
Aneesh Kumar K.V 930b1e173b hw/9pfs: Update vfs_rename to use coroutines
I guess TRENAME 9p operation needs an update. The 9p op should
more similar renameat. Otherwise anything other than path cannot track
the fid.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:51:21 +05:30
Venkateswararao Jujjuri ae1ef571fc hw/9pfs: Update v9fs_remove 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>
2011-08-08 23:50:27 +05:30
Venkateswararao Jujjuri e84861f75e 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>
2011-08-08 23:46:42 +05:30
Aneesh Kumar K.V 1b733fed7f hw/9pfs: Update v9fs_mknod to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:59 +05:30
Aneesh Kumar K.V f10ff58d01 hw/9pfs: Update v9fs_xattrcreate to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:58 +05:30
Aneesh Kumar K.V 670185a641 hw/9pfs: Update v9fs_xattrwalk to coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:58 +05:30
Aneesh Kumar K.V 65c05f9a54 hw/9pfs: Update v9fs_setattr to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:58 +05:30
Aneesh Kumar K.V 8db21ce73a hw/9pfs: Update v9fs_getattr to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:58 +05:30
Aneesh Kumar K.V 88a4763e88 hw/9pfs: Update v9fs_statfs to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:58 +05:30
Aneesh Kumar K.V 5e4eaa79cf hw/9pfs: Update v9fs_readdir to use coroutines
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:57 +05:30
Venkateswararao Jujjuri 7a5ca31eb4 hw/9pfs: Update v9fs_readlink to use coroutine
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:39:23 +05:30
Venkateswararao Jujjuri (JV) ff06030f66 [virtio-9p] Change all pdu handlers to coroutines.
This patch changes the top level handlers to coroutines and sets the base.
It will be followed up with series of patches to convert all filesystem
calls to threaded coroutines pushing all blocking clals in VirtFS out
of vcpu threads.

Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 13:05:09 +05:30
Anthony Liguori 93e0597ef9 Merge remote-tracking branch 'jvrao/for-anthony' into staging 2011-06-08 12:15:43 -05:00
Stefan Weil 9694b5d11a virtio-9p: Remove statement without effect (fix warning from cppcheck)
cppcheck report:
virtio-9p.c:197: warning: Redundant assignment of "flags" to itself

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Reviewed-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-06-03 23:39:28 +02:00
Aneesh Kumar K.V 5c3234c6c0 hw/9pfs: Don't crash when we get a request with not supported 9p operation
Return EOPNOTSUPP as error

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
2011-06-01 10:25:27 -07:00
Stefan Weil 873c321393 virtio-9p: Use relative includes for files in hw
Commit 353ac78d49 moved the files
without fixing the include paths. It used a modified CFLAGS
to add hw to the include search path, but this breaks builds
where the user wants to set special CFLAGS. Long include paths
also increase compilation time.

Therefore this patch removes the special CFLAGS for virtio
and fixes the include statements by using relative include paths.

v2: Remove special CFLAGS.
v3: Update needed for latest QEMU.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
2011-06-01 10:25:03 -07:00
Aneesh Kumar K.V f4f61d272e virtio-9p: Move device specific code to virtio-9p-device
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
2011-06-01 10:24:50 -07:00
Aneesh Kumar K.V 9fe1ebebd0 virtio-9p: Move 9p device registration into virtio-9p.c
This patch move the 9p device registration into its own file

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
2011-06-01 10:23:58 -07:00
Malahal Naineni 936532a492 [virtio-9p] Stop renaming files with similar name!
v9fs_complete_rename() mistakenly renames files with similar name
as we don't check if the matched name is really an offspring.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
2011-06-01 10:23:33 -07:00
Harsh Prateek Bora 4f8dee2dec v9fs_walk: As per 9p2000 RFC, MAXWELEM >= nwnames >= 0.
The nwnames field in TWALK message is assumed to be >=0 and <= MAXWELEM
which is defined as macro P9_MAXWELEM (16) in virtio-9p.h as per 9p2000
RFC. Appropriate changes are required in V9fsWalkState and v9fs_walk.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2011-04-27 08:27:25 -07:00