hw/9pfs: Add fs driver specific details to fscontext

Add a new context flag PATHNAME_FSCONTEXT and indicate whether
the fs driver track fid using path names. Also add a private
pointer that help us to track fs driver specific values in there

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
Aneesh Kumar K.V 2011-08-02 11:35:54 +05:30
parent 0174fe73e6
commit 532decb715
9 changed files with 105 additions and 52 deletions

View file

@ -21,7 +21,7 @@ int v9fs_co_lstat(V9fsState *s, V9fsPath *path, struct stat *stbuf)
{
int err;
qemu_co_rwlock_rdlock(&s->rename_lock);
v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->lstat(&s->ctx, path, stbuf);
@ -29,7 +29,7 @@ int v9fs_co_lstat(V9fsState *s, V9fsPath *path, struct stat *stbuf)
err = -errno;
}
});
qemu_co_rwlock_unlock(&s->rename_lock);
v9fs_path_unlock(s);
return err;
}
@ -51,7 +51,7 @@ int v9fs_co_open(V9fsState *s, V9fsFidState *fidp, int flags)
{
int err;
qemu_co_rwlock_rdlock(&s->rename_lock);
v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
fidp->fs.fd = s->ops->open(&s->ctx, &fidp->path, flags);
@ -61,7 +61,7 @@ int v9fs_co_open(V9fsState *s, V9fsFidState *fidp, int flags)
err = 0;
}
});
qemu_co_rwlock_unlock(&s->rename_lock);
v9fs_path_unlock(s);
if (!err) {
total_open_fd++;
if (total_open_fd > open_fd_hw) {
@ -88,7 +88,7 @@ int v9fs_co_open2(V9fsState *s, V9fsFidState *fidp, V9fsString *name, gid_t gid,
* don't change. Read lock is fine because this fid cannot
* be used by any other operation.
*/
qemu_co_rwlock_rdlock(&s->rename_lock);
v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
fidp->fs.fd = s->ops->open2(&s->ctx, &fidp->path,
@ -112,7 +112,7 @@ int v9fs_co_open2(V9fsState *s, V9fsFidState *fidp, V9fsString *name, gid_t gid,
v9fs_path_free(&path);
}
});
qemu_co_rwlock_unlock(&s->rename_lock);
v9fs_path_unlock(s);
if (!err) {
total_open_fd++;
if (total_open_fd > open_fd_hw) {
@ -160,7 +160,7 @@ int v9fs_co_link(V9fsState *s, V9fsFidState *oldfid,
{
int err;
qemu_co_rwlock_rdlock(&s->rename_lock);
v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->link(&s->ctx, &oldfid->path,
@ -169,7 +169,7 @@ int v9fs_co_link(V9fsState *s, V9fsFidState *oldfid,
err = -errno;
}
});
qemu_co_rwlock_unlock(&s->rename_lock);
v9fs_path_unlock(s);
return err;
}