Only trivial fixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAld2ZGoACgkQAvw66wEB28LbNQCfbKhlgcwRvD/F1B5IFQErRkLf rBsAnR5QQhl8eJK+Dfdiy4H/mjKuXHyN =6o/q -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging Only trivial fixes. # gpg: Signature made Fri 01 Jul 2016 13:39:06 BST # gpg: using DSA key 0x02FC3AEB0101DBC2 # gpg: Good signature from "Greg Kurz <gkurz@fr.ibm.com>" # gpg: aka "Greg Kurz <groug@free.fr>" # gpg: aka "Greg Kurz <gkurz@linux.vnet.ibm.com>" # gpg: aka "Gregory Kurz (Groug) <groug@free.fr>" # gpg: aka "Gregory Kurz (Cimai Technology) <gkurz@cimai.com>" # gpg: aka "Gregory Kurz (Meiosys Technology) <gkurz@meiosys.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 2BD4 3B44 535E C0A7 9894 DBA2 02FC 3AEB 0101 DBC2 * remotes/gkurz/tags/for-upstream: 9p: synth: drop v9fs_ prefix 9p: don't include <sys/uio.h> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
96b39d8327
@ -14,7 +14,6 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <sys/uio.h>
|
|
||||||
|
|
||||||
#include "9p-iov-marshal.h"
|
#include "9p-iov-marshal.h"
|
||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <sys/uio.h>
|
|
||||||
|
|
||||||
#include "9p-marshal.h"
|
#include "9p-marshal.h"
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#define _FILEOP_H
|
#define _FILEOP_H
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
#define SM_LOCAL_MODE_BITS 0600
|
#define SM_LOCAL_MODE_BITS 0600
|
||||||
|
@ -21,19 +21,19 @@
|
|||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
|
|
||||||
/* Root node for synth file system */
|
/* Root node for synth file system */
|
||||||
static V9fsSynthNode v9fs_synth_root = {
|
static V9fsSynthNode synth_root = {
|
||||||
.name = "/",
|
.name = "/",
|
||||||
.actual_attr = {
|
.actual_attr = {
|
||||||
.mode = 0555 | S_IFDIR,
|
.mode = 0555 | S_IFDIR,
|
||||||
.nlink = 1,
|
.nlink = 1,
|
||||||
},
|
},
|
||||||
.attr = &v9fs_synth_root.actual_attr,
|
.attr = &synth_root.actual_attr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static QemuMutex v9fs_synth_mutex;
|
static QemuMutex synth_mutex;
|
||||||
static int v9fs_synth_node_count;
|
static int synth_node_count;
|
||||||
/* set to 1 when the synth fs is ready */
|
/* set to 1 when the synth fs is ready */
|
||||||
static int v9fs_synth_fs;
|
static int synth_fs;
|
||||||
|
|
||||||
static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode,
|
static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode,
|
||||||
const char *name,
|
const char *name,
|
||||||
@ -69,16 +69,16 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
|
|||||||
int ret;
|
int ret;
|
||||||
V9fsSynthNode *node, *tmp;
|
V9fsSynthNode *node, *tmp;
|
||||||
|
|
||||||
if (!v9fs_synth_fs) {
|
if (!synth_fs) {
|
||||||
return EAGAIN;
|
return EAGAIN;
|
||||||
}
|
}
|
||||||
if (!name || (strlen(name) >= NAME_MAX)) {
|
if (!name || (strlen(name) >= NAME_MAX)) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
parent = &v9fs_synth_root;
|
parent = &synth_root;
|
||||||
}
|
}
|
||||||
qemu_mutex_lock(&v9fs_synth_mutex);
|
qemu_mutex_lock(&synth_mutex);
|
||||||
QLIST_FOREACH(tmp, &parent->child, sibling) {
|
QLIST_FOREACH(tmp, &parent->child, sibling) {
|
||||||
if (!strcmp(tmp->name, name)) {
|
if (!strcmp(tmp->name, name)) {
|
||||||
ret = EEXIST;
|
ret = EEXIST;
|
||||||
@ -86,7 +86,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Add the name */
|
/* Add the name */
|
||||||
node = v9fs_add_dir_node(parent, mode, name, NULL, v9fs_synth_node_count++);
|
node = v9fs_add_dir_node(parent, mode, name, NULL, synth_node_count++);
|
||||||
v9fs_add_dir_node(node, parent->attr->mode, "..",
|
v9fs_add_dir_node(node, parent->attr->mode, "..",
|
||||||
parent->attr, parent->attr->inode);
|
parent->attr, parent->attr->inode);
|
||||||
v9fs_add_dir_node(node, node->attr->mode, ".",
|
v9fs_add_dir_node(node, node->attr->mode, ".",
|
||||||
@ -94,7 +94,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
|
|||||||
*result = node;
|
*result = node;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err_out:
|
err_out:
|
||||||
qemu_mutex_unlock(&v9fs_synth_mutex);
|
qemu_mutex_unlock(&synth_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,17 +105,17 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
|
|||||||
int ret;
|
int ret;
|
||||||
V9fsSynthNode *node, *tmp;
|
V9fsSynthNode *node, *tmp;
|
||||||
|
|
||||||
if (!v9fs_synth_fs) {
|
if (!synth_fs) {
|
||||||
return EAGAIN;
|
return EAGAIN;
|
||||||
}
|
}
|
||||||
if (!name || (strlen(name) >= NAME_MAX)) {
|
if (!name || (strlen(name) >= NAME_MAX)) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
parent = &v9fs_synth_root;
|
parent = &synth_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_mutex_lock(&v9fs_synth_mutex);
|
qemu_mutex_lock(&synth_mutex);
|
||||||
QLIST_FOREACH(tmp, &parent->child, sibling) {
|
QLIST_FOREACH(tmp, &parent->child, sibling) {
|
||||||
if (!strcmp(tmp->name, name)) {
|
if (!strcmp(tmp->name, name)) {
|
||||||
ret = EEXIST;
|
ret = EEXIST;
|
||||||
@ -126,7 +126,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
|
|||||||
mode = ((mode & 0777) | S_IFREG);
|
mode = ((mode & 0777) | S_IFREG);
|
||||||
node = g_malloc0(sizeof(V9fsSynthNode));
|
node = g_malloc0(sizeof(V9fsSynthNode));
|
||||||
node->attr = &node->actual_attr;
|
node->attr = &node->actual_attr;
|
||||||
node->attr->inode = v9fs_synth_node_count++;
|
node->attr->inode = synth_node_count++;
|
||||||
node->attr->nlink = 1;
|
node->attr->nlink = 1;
|
||||||
node->attr->read = read;
|
node->attr->read = read;
|
||||||
node->attr->write = write;
|
node->attr->write = write;
|
||||||
@ -136,11 +136,11 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
|
|||||||
QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling);
|
QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err_out:
|
err_out:
|
||||||
qemu_mutex_unlock(&v9fs_synth_mutex);
|
qemu_mutex_unlock(&synth_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void v9fs_synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf)
|
static void synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf)
|
||||||
{
|
{
|
||||||
stbuf->st_dev = 0;
|
stbuf->st_dev = 0;
|
||||||
stbuf->st_ino = node->attr->inode;
|
stbuf->st_ino = node->attr->inode;
|
||||||
@ -157,24 +157,24 @@ static void v9fs_synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf)
|
|||||||
stbuf->st_ctime = 0;
|
stbuf->st_ctime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_lstat(FsContext *fs_ctx,
|
static int synth_lstat(FsContext *fs_ctx,
|
||||||
V9fsPath *fs_path, struct stat *stbuf)
|
V9fsPath *fs_path, struct stat *stbuf)
|
||||||
{
|
{
|
||||||
V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data;
|
V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data;
|
||||||
|
|
||||||
v9fs_synth_fill_statbuf(node, stbuf);
|
synth_fill_statbuf(node, stbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_fstat(FsContext *fs_ctx, int fid_type,
|
static int synth_fstat(FsContext *fs_ctx, int fid_type,
|
||||||
V9fsFidOpenState *fs, struct stat *stbuf)
|
V9fsFidOpenState *fs, struct stat *stbuf)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open = fs->private;
|
V9fsSynthOpenState *synth_open = fs->private;
|
||||||
v9fs_synth_fill_statbuf(synth_open->node, stbuf);
|
synth_fill_statbuf(synth_open->node, stbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_opendir(FsContext *ctx,
|
static int synth_opendir(FsContext *ctx,
|
||||||
V9fsPath *fs_path, V9fsFidOpenState *fs)
|
V9fsPath *fs_path, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open;
|
V9fsSynthOpenState *synth_open;
|
||||||
@ -187,7 +187,7 @@ static int v9fs_synth_opendir(FsContext *ctx,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_closedir(FsContext *ctx, V9fsFidOpenState *fs)
|
static int synth_closedir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open = fs->private;
|
V9fsSynthOpenState *synth_open = fs->private;
|
||||||
V9fsSynthNode *node = synth_open->node;
|
V9fsSynthNode *node = synth_open->node;
|
||||||
@ -198,24 +198,24 @@ static int v9fs_synth_closedir(FsContext *ctx, V9fsFidOpenState *fs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static off_t v9fs_synth_telldir(FsContext *ctx, V9fsFidOpenState *fs)
|
static off_t synth_telldir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open = fs->private;
|
V9fsSynthOpenState *synth_open = fs->private;
|
||||||
return synth_open->offset;
|
return synth_open->offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void v9fs_synth_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
|
static void synth_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open = fs->private;
|
V9fsSynthOpenState *synth_open = fs->private;
|
||||||
synth_open->offset = off;
|
synth_open->offset = off;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void v9fs_synth_rewinddir(FsContext *ctx, V9fsFidOpenState *fs)
|
static void synth_rewinddir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
v9fs_synth_seekdir(ctx, fs, 0);
|
synth_seekdir(ctx, fs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void v9fs_synth_direntry(V9fsSynthNode *node,
|
static void synth_direntry(V9fsSynthNode *node,
|
||||||
struct dirent *entry, off_t off)
|
struct dirent *entry, off_t off)
|
||||||
{
|
{
|
||||||
strcpy(entry->d_name, node->name);
|
strcpy(entry->d_name, node->name);
|
||||||
@ -223,7 +223,7 @@ static void v9fs_synth_direntry(V9fsSynthNode *node,
|
|||||||
entry->d_off = off + 1;
|
entry->d_off = off + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dirent *v9fs_synth_get_dentry(V9fsSynthNode *dir,
|
static struct dirent *synth_get_dentry(V9fsSynthNode *dir,
|
||||||
struct dirent *entry, off_t off)
|
struct dirent *entry, off_t off)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -242,23 +242,23 @@ static struct dirent *v9fs_synth_get_dentry(V9fsSynthNode *dir,
|
|||||||
/* end of directory */
|
/* end of directory */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
v9fs_synth_direntry(node, entry, off);
|
synth_direntry(node, entry, off);
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct dirent *v9fs_synth_readdir(FsContext *ctx, V9fsFidOpenState *fs)
|
static struct dirent *synth_readdir(FsContext *ctx, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
V9fsSynthOpenState *synth_open = fs->private;
|
V9fsSynthOpenState *synth_open = fs->private;
|
||||||
V9fsSynthNode *node = synth_open->node;
|
V9fsSynthNode *node = synth_open->node;
|
||||||
entry = v9fs_synth_get_dentry(node, &synth_open->dent, synth_open->offset);
|
entry = synth_get_dentry(node, &synth_open->dent, synth_open->offset);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
synth_open->offset++;
|
synth_open->offset++;
|
||||||
}
|
}
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path,
|
static int synth_open(FsContext *ctx, V9fsPath *fs_path,
|
||||||
int flags, V9fsFidOpenState *fs)
|
int flags, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open;
|
V9fsSynthOpenState *synth_open;
|
||||||
@ -271,7 +271,7 @@ static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_open2(FsContext *fs_ctx, V9fsPath *dir_path,
|
static int synth_open2(FsContext *fs_ctx, V9fsPath *dir_path,
|
||||||
const char *name, int flags,
|
const char *name, int flags,
|
||||||
FsCred *credp, V9fsFidOpenState *fs)
|
FsCred *credp, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ static int v9fs_synth_open2(FsContext *fs_ctx, V9fsPath *dir_path,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_close(FsContext *ctx, V9fsFidOpenState *fs)
|
static int synth_close(FsContext *ctx, V9fsFidOpenState *fs)
|
||||||
{
|
{
|
||||||
V9fsSynthOpenState *synth_open = fs->private;
|
V9fsSynthOpenState *synth_open = fs->private;
|
||||||
V9fsSynthNode *node = synth_open->node;
|
V9fsSynthNode *node = synth_open->node;
|
||||||
@ -290,7 +290,7 @@ static int v9fs_synth_close(FsContext *ctx, V9fsFidOpenState *fs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t v9fs_synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
|
static ssize_t synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
|
||||||
const struct iovec *iov,
|
const struct iovec *iov,
|
||||||
int iovcnt, off_t offset)
|
int iovcnt, off_t offset)
|
||||||
{
|
{
|
||||||
@ -314,7 +314,7 @@ static ssize_t v9fs_synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t v9fs_synth_preadv(FsContext *ctx, V9fsFidOpenState *fs,
|
static ssize_t synth_preadv(FsContext *ctx, V9fsFidOpenState *fs,
|
||||||
const struct iovec *iov,
|
const struct iovec *iov,
|
||||||
int iovcnt, off_t offset)
|
int iovcnt, off_t offset)
|
||||||
{
|
{
|
||||||
@ -338,112 +338,112 @@ static ssize_t v9fs_synth_preadv(FsContext *ctx, V9fsFidOpenState *fs,
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_truncate(FsContext *ctx, V9fsPath *path, off_t offset)
|
static int synth_truncate(FsContext *ctx, V9fsPath *path, off_t offset)
|
||||||
{
|
{
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_chmod(FsContext *fs_ctx, V9fsPath *path, FsCred *credp)
|
static int synth_chmod(FsContext *fs_ctx, V9fsPath *path, FsCred *credp)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_mknod(FsContext *fs_ctx, V9fsPath *path,
|
static int synth_mknod(FsContext *fs_ctx, V9fsPath *path,
|
||||||
const char *buf, FsCred *credp)
|
const char *buf, FsCred *credp)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_mkdir(FsContext *fs_ctx, V9fsPath *path,
|
static int synth_mkdir(FsContext *fs_ctx, V9fsPath *path,
|
||||||
const char *buf, FsCred *credp)
|
const char *buf, FsCred *credp)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t v9fs_synth_readlink(FsContext *fs_ctx, V9fsPath *path,
|
static ssize_t synth_readlink(FsContext *fs_ctx, V9fsPath *path,
|
||||||
char *buf, size_t bufsz)
|
char *buf, size_t bufsz)
|
||||||
{
|
{
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_symlink(FsContext *fs_ctx, const char *oldpath,
|
static int synth_symlink(FsContext *fs_ctx, const char *oldpath,
|
||||||
V9fsPath *newpath, const char *buf, FsCred *credp)
|
V9fsPath *newpath, const char *buf, FsCred *credp)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_link(FsContext *fs_ctx, V9fsPath *oldpath,
|
static int synth_link(FsContext *fs_ctx, V9fsPath *oldpath,
|
||||||
V9fsPath *newpath, const char *buf)
|
V9fsPath *newpath, const char *buf)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_rename(FsContext *ctx, const char *oldpath,
|
static int synth_rename(FsContext *ctx, const char *oldpath,
|
||||||
const char *newpath)
|
const char *newpath)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp)
|
static int synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_utimensat(FsContext *fs_ctx, V9fsPath *path,
|
static int synth_utimensat(FsContext *fs_ctx, V9fsPath *path,
|
||||||
const struct timespec *buf)
|
const struct timespec *buf)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_remove(FsContext *ctx, const char *path)
|
static int synth_remove(FsContext *ctx, const char *path)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_fsync(FsContext *ctx, int fid_type,
|
static int synth_fsync(FsContext *ctx, int fid_type,
|
||||||
V9fsFidOpenState *fs, int datasync)
|
V9fsFidOpenState *fs, int datasync)
|
||||||
{
|
{
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_statfs(FsContext *s, V9fsPath *fs_path,
|
static int synth_statfs(FsContext *s, V9fsPath *fs_path,
|
||||||
struct statfs *stbuf)
|
struct statfs *stbuf)
|
||||||
{
|
{
|
||||||
stbuf->f_type = 0xABCD;
|
stbuf->f_type = 0xABCD;
|
||||||
stbuf->f_bsize = 512;
|
stbuf->f_bsize = 512;
|
||||||
stbuf->f_blocks = 0;
|
stbuf->f_blocks = 0;
|
||||||
stbuf->f_files = v9fs_synth_node_count;
|
stbuf->f_files = synth_node_count;
|
||||||
stbuf->f_namelen = NAME_MAX;
|
stbuf->f_namelen = NAME_MAX;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t v9fs_synth_lgetxattr(FsContext *ctx, V9fsPath *path,
|
static ssize_t synth_lgetxattr(FsContext *ctx, V9fsPath *path,
|
||||||
const char *name, void *value, size_t size)
|
const char *name, void *value, size_t size)
|
||||||
{
|
{
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t v9fs_synth_llistxattr(FsContext *ctx, V9fsPath *path,
|
static ssize_t synth_llistxattr(FsContext *ctx, V9fsPath *path,
|
||||||
void *value, size_t size)
|
void *value, size_t size)
|
||||||
{
|
{
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_lsetxattr(FsContext *ctx, V9fsPath *path,
|
static int synth_lsetxattr(FsContext *ctx, V9fsPath *path,
|
||||||
const char *name, void *value,
|
const char *name, void *value,
|
||||||
size_t size, int flags)
|
size_t size, int flags)
|
||||||
{
|
{
|
||||||
@ -451,14 +451,14 @@ static int v9fs_synth_lsetxattr(FsContext *ctx, V9fsPath *path,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_lremovexattr(FsContext *ctx,
|
static int synth_lremovexattr(FsContext *ctx,
|
||||||
V9fsPath *path, const char *name)
|
V9fsPath *path, const char *name)
|
||||||
{
|
{
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_name_to_path(FsContext *ctx, V9fsPath *dir_path,
|
static int synth_name_to_path(FsContext *ctx, V9fsPath *dir_path,
|
||||||
const char *name, V9fsPath *target)
|
const char *name, V9fsPath *target)
|
||||||
{
|
{
|
||||||
V9fsSynthNode *node;
|
V9fsSynthNode *node;
|
||||||
@ -471,7 +471,7 @@ static int v9fs_synth_name_to_path(FsContext *ctx, V9fsPath *dir_path,
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (!dir_path) {
|
if (!dir_path) {
|
||||||
dir_node = &v9fs_synth_root;
|
dir_node = &synth_root;
|
||||||
} else {
|
} else {
|
||||||
dir_node = *(V9fsSynthNode **)dir_path->data;
|
dir_node = *(V9fsSynthNode **)dir_path->data;
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_renameat(FsContext *ctx, V9fsPath *olddir,
|
static int synth_renameat(FsContext *ctx, V9fsPath *olddir,
|
||||||
const char *old_name, V9fsPath *newdir,
|
const char *old_name, V9fsPath *newdir,
|
||||||
const char *new_name)
|
const char *new_name)
|
||||||
{
|
{
|
||||||
@ -508,62 +508,62 @@ static int v9fs_synth_renameat(FsContext *ctx, V9fsPath *olddir,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_unlinkat(FsContext *ctx, V9fsPath *dir,
|
static int synth_unlinkat(FsContext *ctx, V9fsPath *dir,
|
||||||
const char *name, int flags)
|
const char *name, int flags)
|
||||||
{
|
{
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_synth_init(FsContext *ctx)
|
static int synth_init(FsContext *ctx)
|
||||||
{
|
{
|
||||||
QLIST_INIT(&v9fs_synth_root.child);
|
QLIST_INIT(&synth_root.child);
|
||||||
qemu_mutex_init(&v9fs_synth_mutex);
|
qemu_mutex_init(&synth_mutex);
|
||||||
|
|
||||||
/* Add "." and ".." entries for root */
|
/* Add "." and ".." entries for root */
|
||||||
v9fs_add_dir_node(&v9fs_synth_root, v9fs_synth_root.attr->mode,
|
v9fs_add_dir_node(&synth_root, synth_root.attr->mode,
|
||||||
"..", v9fs_synth_root.attr, v9fs_synth_root.attr->inode);
|
"..", synth_root.attr, synth_root.attr->inode);
|
||||||
v9fs_add_dir_node(&v9fs_synth_root, v9fs_synth_root.attr->mode,
|
v9fs_add_dir_node(&synth_root, synth_root.attr->mode,
|
||||||
".", v9fs_synth_root.attr, v9fs_synth_root.attr->inode);
|
".", synth_root.attr, synth_root.attr->inode);
|
||||||
|
|
||||||
/* Mark the subsystem is ready for use */
|
/* Mark the subsystem is ready for use */
|
||||||
v9fs_synth_fs = 1;
|
synth_fs = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOperations synth_ops = {
|
FileOperations synth_ops = {
|
||||||
.init = v9fs_synth_init,
|
.init = synth_init,
|
||||||
.lstat = v9fs_synth_lstat,
|
.lstat = synth_lstat,
|
||||||
.readlink = v9fs_synth_readlink,
|
.readlink = synth_readlink,
|
||||||
.close = v9fs_synth_close,
|
.close = synth_close,
|
||||||
.closedir = v9fs_synth_closedir,
|
.closedir = synth_closedir,
|
||||||
.open = v9fs_synth_open,
|
.open = synth_open,
|
||||||
.opendir = v9fs_synth_opendir,
|
.opendir = synth_opendir,
|
||||||
.rewinddir = v9fs_synth_rewinddir,
|
.rewinddir = synth_rewinddir,
|
||||||
.telldir = v9fs_synth_telldir,
|
.telldir = synth_telldir,
|
||||||
.readdir = v9fs_synth_readdir,
|
.readdir = synth_readdir,
|
||||||
.seekdir = v9fs_synth_seekdir,
|
.seekdir = synth_seekdir,
|
||||||
.preadv = v9fs_synth_preadv,
|
.preadv = synth_preadv,
|
||||||
.pwritev = v9fs_synth_pwritev,
|
.pwritev = synth_pwritev,
|
||||||
.chmod = v9fs_synth_chmod,
|
.chmod = synth_chmod,
|
||||||
.mknod = v9fs_synth_mknod,
|
.mknod = synth_mknod,
|
||||||
.mkdir = v9fs_synth_mkdir,
|
.mkdir = synth_mkdir,
|
||||||
.fstat = v9fs_synth_fstat,
|
.fstat = synth_fstat,
|
||||||
.open2 = v9fs_synth_open2,
|
.open2 = synth_open2,
|
||||||
.symlink = v9fs_synth_symlink,
|
.symlink = synth_symlink,
|
||||||
.link = v9fs_synth_link,
|
.link = synth_link,
|
||||||
.truncate = v9fs_synth_truncate,
|
.truncate = synth_truncate,
|
||||||
.rename = v9fs_synth_rename,
|
.rename = synth_rename,
|
||||||
.chown = v9fs_synth_chown,
|
.chown = synth_chown,
|
||||||
.utimensat = v9fs_synth_utimensat,
|
.utimensat = synth_utimensat,
|
||||||
.remove = v9fs_synth_remove,
|
.remove = synth_remove,
|
||||||
.fsync = v9fs_synth_fsync,
|
.fsync = synth_fsync,
|
||||||
.statfs = v9fs_synth_statfs,
|
.statfs = synth_statfs,
|
||||||
.lgetxattr = v9fs_synth_lgetxattr,
|
.lgetxattr = synth_lgetxattr,
|
||||||
.llistxattr = v9fs_synth_llistxattr,
|
.llistxattr = synth_llistxattr,
|
||||||
.lsetxattr = v9fs_synth_lsetxattr,
|
.lsetxattr = synth_lsetxattr,
|
||||||
.lremovexattr = v9fs_synth_lremovexattr,
|
.lremovexattr = synth_lremovexattr,
|
||||||
.name_to_path = v9fs_synth_name_to_path,
|
.name_to_path = synth_name_to_path,
|
||||||
.renameat = v9fs_synth_renameat,
|
.renameat = synth_renameat,
|
||||||
.unlinkat = v9fs_synth_unlinkat,
|
.unlinkat = synth_unlinkat,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user