hw/9pfs: Add yeild support for clunk related coroutine

This include lsetxattr, lremovexattr, closedir and close.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
Aneesh Kumar K.V 2011-05-07 21:09:24 +05:30
parent 3cc19c0c60
commit bed4352c4f
4 changed files with 71 additions and 0 deletions

View File

@ -99,3 +99,19 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
}); });
return err; return err;
} }
int v9fs_co_closedir(V9fsState *s, V9fsFidState *fidp)
{
int err;
DIR *dir;
dir = fidp->fs.dir;
v9fs_co_run_in_worker(
{
err = s->ops->closedir(&s->ctx, dir);
if (err < 0) {
err = -errno;
}
});
return err;
}

View File

@ -81,3 +81,19 @@ int v9fs_co_open2(V9fsState *s, V9fsFidState *fidp, char *fullname, gid_t gid,
}); });
return err; return err;
} }
int v9fs_co_close(V9fsState *s, V9fsFidState *fidp)
{
int fd;
int err;
fd = fidp->fs.fd;
v9fs_co_run_in_worker(
{
err = s->ops->close(&s->ctx, fd);
if (err < 0) {
err = -errno;
}
});
return err;
}

View File

@ -48,3 +48,37 @@ int v9fs_co_lgetxattr(V9fsState *s, V9fsString *path,
}); });
return err; return err;
} }
int v9fs_co_lsetxattr(V9fsState *s, V9fsString *path,
V9fsString *xattr_name, void *value,
size_t size, int flags)
{
int err;
v9fs_co_run_in_worker(
{
err = s->ops->lsetxattr(&s->ctx, path->data,
xattr_name->data, value,
size, flags);
if (err < 0) {
err = -errno;
}
});
return err;
}
int v9fs_co_lremovexattr(V9fsState *s, V9fsString *path,
V9fsString *xattr_name)
{
int err;
v9fs_co_run_in_worker(
{
err = s->ops->lremovexattr(&s->ctx, path->data,
xattr_name->data);
if (err < 0) {
err = -errno;
}
});
return err;
}

View File

@ -80,4 +80,9 @@ extern int v9fs_co_fstat(V9fsState *, int, struct stat *);
extern int v9fs_co_opendir(V9fsState *, V9fsFidState *); extern int v9fs_co_opendir(V9fsState *, V9fsFidState *);
extern int v9fs_co_open(V9fsState *, V9fsFidState *, int); extern int v9fs_co_open(V9fsState *, V9fsFidState *, int);
extern int v9fs_co_open2(V9fsState *, V9fsFidState *, char *, gid_t, int, int); extern int v9fs_co_open2(V9fsState *, V9fsFidState *, char *, gid_t, int, int);
extern int v9fs_co_lsetxattr(V9fsState *, V9fsString *, V9fsString *,
void *, size_t, int);
extern int v9fs_co_lremovexattr(V9fsState *, V9fsString *, V9fsString *);
extern int v9fs_co_closedir(V9fsState *, V9fsFidState *);
extern int v9fs_co_close(V9fsState *, V9fsFidState *);
#endif #endif