ssize_t len;
buf->data = g_malloc(PATH_MAX);
- qemu_co_rwlock_rdlock(&s->rename_lock);
-
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
len = s->ops->readlink(&s->ctx, path,
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
if (err) {
g_free(buf->data);
buf->data = NULL;
{
int err;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->statfs(&s->ctx, path, stbuf);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
cred_init(&cred);
cred.fc_mode = mode;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->chmod(&s->ctx, path, &cred);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
{
int err;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->utimensat(&s->ctx, path, times);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
cred_init(&cred);
cred.fc_uid = uid;
cred.fc_gid = gid;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->chown(&s->ctx, path, &cred);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
{
int err;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->truncate(&s->ctx, path, size);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
cred.fc_gid = gid;
cred.fc_mode = mode;
cred.fc_rdev = dev;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->mknod(&s->ctx, &fidp->path, name->data, &cred);
v9fs_path_free(&path);
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
{
int err;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->remove(&s->ctx, path->data);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
{
int err;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->unlinkat(&s->ctx, path, name->data, flags);
err = -errno;
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
cred.fc_uid = dfidp->uid;
cred.fc_gid = gid;
cred.fc_mode = 0777;
- qemu_co_rwlock_rdlock(&s->rename_lock);
+ v9fs_path_read_lock(s);
v9fs_co_run_in_worker(
{
err = s->ops->symlink(&s->ctx, oldpath, &dfidp->path,
v9fs_path_free(&path);
}
});
- qemu_co_rwlock_unlock(&s->rename_lock);
+ v9fs_path_unlock(s);
return err;
}
const char *name, V9fsPath *path)
{
int err;
- err = s->ops->name_to_path(&s->ctx, dirpath, name, path);
- if (err < 0) {
- err = -errno;
+
+ if (s->ctx.flags & PATHNAME_FSCONTEXT) {
+ err = s->ops->name_to_path(&s->ctx, dirpath, name, path);
+ if (err < 0) {
+ err = -errno;
+ }
+ } else {
+ v9fs_co_run_in_worker(
+ {
+ err = s->ops->name_to_path(&s->ctx, dirpath, name, path);
+ if (err < 0) {
+ err = -errno;
+ }
+ });
}
return err;
}