mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
hw/9pfs: Implement TFLUSH operation
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
parent
ce421a1961
commit
bccacf6c79
8 changed files with 439 additions and 265 deletions
|
@ -17,11 +17,15 @@
|
|||
#include "qemu-coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_readdir_r(V9fsState *s, V9fsFidState *fidp, struct dirent *dent,
|
||||
int v9fs_co_readdir_r(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent *dent,
|
||||
struct dirent **result)
|
||||
{
|
||||
int err;
|
||||
V9fsState *s = pdu->s;
|
||||
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;
|
||||
}
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
errno = 0;
|
||||
|
@ -35,10 +39,14 @@ int v9fs_co_readdir_r(V9fsState *s, V9fsFidState *fidp, struct dirent *dent,
|
|||
return err;
|
||||
}
|
||||
|
||||
off_t v9fs_co_telldir(V9fsState *s, V9fsFidState *fidp)
|
||||
off_t v9fs_co_telldir(V9fsPDU *pdu, V9fsFidState *fidp)
|
||||
{
|
||||
off_t err;
|
||||
V9fsState *s = pdu->s;
|
||||
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;
|
||||
}
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
err = s->ops->telldir(&s->ctx, fidp->fs.dir);
|
||||
|
@ -49,29 +57,41 @@ off_t v9fs_co_telldir(V9fsState *s, V9fsFidState *fidp)
|
|||
return err;
|
||||
}
|
||||
|
||||
void v9fs_co_seekdir(V9fsState *s, V9fsFidState *fidp, off_t offset)
|
||||
void v9fs_co_seekdir(V9fsPDU *pdu, V9fsFidState *fidp, off_t offset)
|
||||
{
|
||||
V9fsState *s = pdu->s;
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return;
|
||||
}
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
s->ops->seekdir(&s->ctx, fidp->fs.dir, offset);
|
||||
});
|
||||
}
|
||||
|
||||
void v9fs_co_rewinddir(V9fsState *s, V9fsFidState *fidp)
|
||||
void v9fs_co_rewinddir(V9fsPDU *pdu, V9fsFidState *fidp)
|
||||
{
|
||||
V9fsState *s = pdu->s;
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return;
|
||||
}
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
s->ops->rewinddir(&s->ctx, fidp->fs.dir);
|
||||
});
|
||||
}
|
||||
|
||||
int v9fs_co_mkdir(V9fsState *s, V9fsFidState *fidp, V9fsString *name,
|
||||
int v9fs_co_mkdir(V9fsPDU *pdu, V9fsFidState *fidp, V9fsString *name,
|
||||
mode_t mode, uid_t uid, gid_t gid, struct stat *stbuf)
|
||||
{
|
||||
int err;
|
||||
FsCred cred;
|
||||
V9fsPath path;
|
||||
V9fsState *s = pdu->s;
|
||||
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;;
|
||||
}
|
||||
cred_init(&cred);
|
||||
cred.fc_mode = mode;
|
||||
cred.fc_uid = uid;
|
||||
|
@ -98,10 +118,14 @@ int v9fs_co_mkdir(V9fsState *s, V9fsFidState *fidp, V9fsString *name,
|
|||
return err;
|
||||
}
|
||||
|
||||
int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
|
||||
int v9fs_co_opendir(V9fsPDU *pdu, V9fsFidState *fidp)
|
||||
{
|
||||
int err;
|
||||
V9fsState *s = pdu->s;
|
||||
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;;
|
||||
}
|
||||
v9fs_path_read_lock(s);
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
|
@ -116,16 +140,20 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
|
|||
if (!err) {
|
||||
total_open_fd++;
|
||||
if (total_open_fd > open_fd_hw) {
|
||||
v9fs_reclaim_fd(s);
|
||||
v9fs_reclaim_fd(pdu);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int v9fs_co_closedir(V9fsState *s, DIR *dir)
|
||||
int v9fs_co_closedir(V9fsPDU *pdu, DIR *dir)
|
||||
{
|
||||
int err;
|
||||
V9fsState *s = pdu->s;
|
||||
|
||||
if (v9fs_request_cancelled(pdu)) {
|
||||
return -EINTR;;
|
||||
}
|
||||
v9fs_co_run_in_worker(
|
||||
{
|
||||
err = s->ops->closedir(&s->ctx, dir);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue