Received: from eggs.gnu.org ([2001:4830:134:3::10]:52041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ1kv-00045h-5G for qemu-devel@nongnu.org; Fri, 01 Jul 2016 12:57:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJ1kq-0004Kz-VJ for qemu-devel@nongnu.org; Fri, 01 Jul 2016 12:57:28 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ1kq-0004Kv-Jx for qemu-devel@nongnu.org; Fri, 01 Jul 2016 12:57:24 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u61GriiV060280 for ; Fri, 1 Jul 2016 12:57:23 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 23wag11w7x-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 01 Jul 2016 12:57:23 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Jul 2016 17:57:20 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id DE3302190046 for ; Fri, 1 Jul 2016 17:56:47 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u61GvIHs24641832 for ; Fri, 1 Jul 2016 16:57:18 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u61GvHX7009829 for ; Fri, 1 Jul 2016 10:57:17 -0600 From: Greg Kurz Date: Fri, 1 Jul 2016 18:56:34 +0200 In-Reply-To: <1467392194-8589-1-git-send-email-groug@kaod.org> References: <1467392194-8589-1-git-send-email-groug@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Message-Id: <1467392194-8589-3-git-send-email-groug@kaod.org> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 2/2] 9p: synth: drop v9fs_ prefix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , "Aneesh Kumar K.V" , Greg Kurz To have shorter lines and be consistent with other fs devices. Acked-by: C=C3=A9dric Le Goater Signed-off-by: Greg Kurz --- hw/9pfs/9p-synth.c | 200 ++++++++++++++++++++++++++---------------------= ------ 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 73c8be816bbb..4b6d4e6a3f1c 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -21,19 +21,19 @@ #include "qemu/cutils.h" =20 /* Root node for synth file system */ -static V9fsSynthNode v9fs_synth_root =3D { +static V9fsSynthNode synth_root =3D { .name =3D "/", .actual_attr =3D { .mode =3D 0555 | S_IFDIR, .nlink =3D 1, }, - .attr =3D &v9fs_synth_root.actual_attr, + .attr =3D &synth_root.actual_attr, }; =20 -static QemuMutex v9fs_synth_mutex; -static int v9fs_synth_node_count; +static QemuMutex synth_mutex; +static int synth_node_count; /* set to 1 when the synth fs is ready */ -static int v9fs_synth_fs; +static int synth_fs; =20 static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode, const char *name, @@ -69,16 +69,16 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int = mode, int ret; V9fsSynthNode *node, *tmp; =20 - if (!v9fs_synth_fs) { + if (!synth_fs) { return EAGAIN; } if (!name || (strlen(name) >=3D NAME_MAX)) { return EINVAL; } if (!parent) { - parent =3D &v9fs_synth_root; + parent =3D &synth_root; } - qemu_mutex_lock(&v9fs_synth_mutex); + qemu_mutex_lock(&synth_mutex); QLIST_FOREACH(tmp, &parent->child, sibling) { if (!strcmp(tmp->name, name)) { ret =3D EEXIST; @@ -86,7 +86,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mo= de, } } /* Add the name */ - node =3D v9fs_add_dir_node(parent, mode, name, NULL, v9fs_synth_node= _count++); + node =3D v9fs_add_dir_node(parent, mode, name, NULL, synth_node_coun= t++); v9fs_add_dir_node(node, parent->attr->mode, "..", parent->attr, parent->attr->inode); v9fs_add_dir_node(node, node->attr->mode, ".", @@ -94,7 +94,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mo= de, *result =3D node; ret =3D 0; err_out: - qemu_mutex_unlock(&v9fs_synth_mutex); + qemu_mutex_unlock(&synth_mutex); return ret; } =20 @@ -105,17 +105,17 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent,= int mode, int ret; V9fsSynthNode *node, *tmp; =20 - if (!v9fs_synth_fs) { + if (!synth_fs) { return EAGAIN; } if (!name || (strlen(name) >=3D NAME_MAX)) { return EINVAL; } if (!parent) { - parent =3D &v9fs_synth_root; + parent =3D &synth_root; } =20 - qemu_mutex_lock(&v9fs_synth_mutex); + qemu_mutex_lock(&synth_mutex); QLIST_FOREACH(tmp, &parent->child, sibling) { if (!strcmp(tmp->name, name)) { ret =3D EEXIST; @@ -126,7 +126,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, i= nt mode, mode =3D ((mode & 0777) | S_IFREG); node =3D g_malloc0(sizeof(V9fsSynthNode)); node->attr =3D &node->actual_attr; - node->attr->inode =3D v9fs_synth_node_count++; + node->attr->inode =3D synth_node_count++; node->attr->nlink =3D 1; node->attr->read =3D read; node->attr->write =3D write; @@ -136,11 +136,11 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent,= int mode, QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); ret =3D 0; err_out: - qemu_mutex_unlock(&v9fs_synth_mutex); + qemu_mutex_unlock(&synth_mutex); return ret; } =20 -static void v9fs_synth_fill_statbuf(V9fsSynthNode *node, struct stat *st= buf) +static void synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf) { stbuf->st_dev =3D 0; stbuf->st_ino =3D node->attr->inode; @@ -157,24 +157,24 @@ static void v9fs_synth_fill_statbuf(V9fsSynthNode *= node, struct stat *stbuf) stbuf->st_ctime =3D 0; } =20 -static int v9fs_synth_lstat(FsContext *fs_ctx, +static int synth_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf) { V9fsSynthNode *node =3D *(V9fsSynthNode **)fs_path->data; =20 - v9fs_synth_fill_statbuf(node, stbuf); + synth_fill_statbuf(node, stbuf); return 0; } =20 -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) { V9fsSynthOpenState *synth_open =3D fs->private; - v9fs_synth_fill_statbuf(synth_open->node, stbuf); + synth_fill_statbuf(synth_open->node, stbuf); return 0; } =20 -static int v9fs_synth_opendir(FsContext *ctx, +static int synth_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open; @@ -187,7 +187,7 @@ static int v9fs_synth_opendir(FsContext *ctx, return 0; } =20 -static int v9fs_synth_closedir(FsContext *ctx, V9fsFidOpenState *fs) +static int synth_closedir(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open =3D fs->private; V9fsSynthNode *node =3D synth_open->node; @@ -198,24 +198,24 @@ static int v9fs_synth_closedir(FsContext *ctx, V9fs= FidOpenState *fs) return 0; } =20 -static off_t v9fs_synth_telldir(FsContext *ctx, V9fsFidOpenState *fs) +static off_t synth_telldir(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open =3D fs->private; return synth_open->offset; } =20 -static void v9fs_synth_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off= _t off) +static void synth_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t of= f) { V9fsSynthOpenState *synth_open =3D fs->private; synth_open->offset =3D off; } =20 -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); } =20 -static void v9fs_synth_direntry(V9fsSynthNode *node, +static void synth_direntry(V9fsSynthNode *node, struct dirent *entry, off_t off) { strcpy(entry->d_name, node->name); @@ -223,7 +223,7 @@ static void v9fs_synth_direntry(V9fsSynthNode *node, entry->d_off =3D off + 1; } =20 -static struct dirent *v9fs_synth_get_dentry(V9fsSynthNode *dir, +static struct dirent *synth_get_dentry(V9fsSynthNode *dir, struct dirent *entry, off_t = off) { int i =3D 0; @@ -242,23 +242,23 @@ static struct dirent *v9fs_synth_get_dentry(V9fsSyn= thNode *dir, /* end of directory */ return NULL; } - v9fs_synth_direntry(node, entry, off); + synth_direntry(node, entry, off); return entry; } =20 -static struct dirent *v9fs_synth_readdir(FsContext *ctx, V9fsFidOpenStat= e *fs) +static struct dirent *synth_readdir(FsContext *ctx, V9fsFidOpenState *fs= ) { struct dirent *entry; V9fsSynthOpenState *synth_open =3D fs->private; V9fsSynthNode *node =3D synth_open->node; - entry =3D v9fs_synth_get_dentry(node, &synth_open->dent, synth_open-= >offset); + entry =3D synth_get_dentry(node, &synth_open->dent, synth_open->offs= et); if (entry) { synth_open->offset++; } return entry; } =20 -static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path, +static int synth_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open; @@ -271,7 +271,7 @@ static int v9fs_synth_open(FsContext *ctx, V9fsPath *= fs_path, return 0; } =20 -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, FsCred *credp, V9fsFidOpenState *fs) { @@ -279,7 +279,7 @@ static int v9fs_synth_open2(FsContext *fs_ctx, V9fsPa= th *dir_path, return -1; } =20 -static int v9fs_synth_close(FsContext *ctx, V9fsFidOpenState *fs) +static int synth_close(FsContext *ctx, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open =3D fs->private; V9fsSynthNode *node =3D synth_open->node; @@ -290,7 +290,7 @@ static int v9fs_synth_close(FsContext *ctx, V9fsFidOp= enState *fs) return 0; } =20 -static ssize_t v9fs_synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs, +static ssize_t synth_pwritev(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { @@ -314,7 +314,7 @@ static ssize_t v9fs_synth_pwritev(FsContext *ctx, V9f= sFidOpenState *fs, return count; } =20 -static ssize_t v9fs_synth_preadv(FsContext *ctx, V9fsFidOpenState *fs, +static ssize_t synth_preadv(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { @@ -338,112 +338,112 @@ static ssize_t v9fs_synth_preadv(FsContext *ctx, = V9fsFidOpenState *fs, return count; } =20 -static int v9fs_synth_truncate(FsContext *ctx, V9fsPath *path, off_t off= set) +static int synth_truncate(FsContext *ctx, V9fsPath *path, off_t offset) { errno =3D ENOSYS; return -1; } =20 -static int v9fs_synth_chmod(FsContext *fs_ctx, V9fsPath *path, FsCred *c= redp) +static int synth_chmod(FsContext *fs_ctx, V9fsPath *path, FsCred *credp) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_mknod(FsContext *fs_ctx, V9fsPath *path, +static int synth_mknod(FsContext *fs_ctx, V9fsPath *path, const char *buf, FsCred *credp) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_mkdir(FsContext *fs_ctx, V9fsPath *path, +static int synth_mkdir(FsContext *fs_ctx, V9fsPath *path, const char *buf, FsCred *credp) { errno =3D EPERM; return -1; } =20 -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) { errno =3D ENOSYS; return -1; } =20 -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) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_link(FsContext *fs_ctx, V9fsPath *oldpath, +static int synth_link(FsContext *fs_ctx, V9fsPath *oldpath, V9fsPath *newpath, const char *buf) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_rename(FsContext *ctx, const char *oldpath, +static int synth_rename(FsContext *ctx, const char *oldpath, const char *newpath) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *c= redp) +static int synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_utimensat(FsContext *fs_ctx, V9fsPath *path, +static int synth_utimensat(FsContext *fs_ctx, V9fsPath *path, const struct timespec *buf) { errno =3D EPERM; return 0; } =20 -static int v9fs_synth_remove(FsContext *ctx, const char *path) +static int synth_remove(FsContext *ctx, const char *path) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_fsync(FsContext *ctx, int fid_type, +static int synth_fsync(FsContext *ctx, int fid_type, V9fsFidOpenState *fs, int datasync) { errno =3D ENOSYS; return 0; } =20 -static int v9fs_synth_statfs(FsContext *s, V9fsPath *fs_path, +static int synth_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { stbuf->f_type =3D 0xABCD; stbuf->f_bsize =3D 512; stbuf->f_blocks =3D 0; - stbuf->f_files =3D v9fs_synth_node_count; + stbuf->f_files =3D synth_node_count; stbuf->f_namelen =3D NAME_MAX; return 0; } =20 -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) { errno =3D ENOTSUP; return -1; } =20 -static ssize_t v9fs_synth_llistxattr(FsContext *ctx, V9fsPath *path, +static ssize_t synth_llistxattr(FsContext *ctx, V9fsPath *path, void *value, size_t size) { errno =3D ENOTSUP; return -1; } =20 -static int v9fs_synth_lsetxattr(FsContext *ctx, V9fsPath *path, +static int synth_lsetxattr(FsContext *ctx, V9fsPath *path, const char *name, void *value, size_t size, int flags) { @@ -451,14 +451,14 @@ static int v9fs_synth_lsetxattr(FsContext *ctx, V9f= sPath *path, return -1; } =20 -static int v9fs_synth_lremovexattr(FsContext *ctx, +static int synth_lremovexattr(FsContext *ctx, V9fsPath *path, const char *name) { errno =3D ENOTSUP; return -1; } =20 -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) { V9fsSynthNode *node; @@ -471,7 +471,7 @@ static int v9fs_synth_name_to_path(FsContext *ctx, V9= fsPath *dir_path, =20 } if (!dir_path) { - dir_node =3D &v9fs_synth_root; + dir_node =3D &synth_root; } else { dir_node =3D *(V9fsSynthNode **)dir_path->data; } @@ -500,7 +500,7 @@ out: return 0; } =20 -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 *new_name) { @@ -508,62 +508,62 @@ static int v9fs_synth_renameat(FsContext *ctx, V9fs= Path *olddir, return -1; } =20 -static int v9fs_synth_unlinkat(FsContext *ctx, V9fsPath *dir, +static int synth_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { errno =3D EPERM; return -1; } =20 -static int v9fs_synth_init(FsContext *ctx) +static int synth_init(FsContext *ctx) { - QLIST_INIT(&v9fs_synth_root.child); - qemu_mutex_init(&v9fs_synth_mutex); + QLIST_INIT(&synth_root.child); + qemu_mutex_init(&synth_mutex); =20 /* Add "." and ".." entries for root */ - v9fs_add_dir_node(&v9fs_synth_root, v9fs_synth_root.attr->mode, - "..", v9fs_synth_root.attr, v9fs_synth_root.attr->= inode); - v9fs_add_dir_node(&v9fs_synth_root, v9fs_synth_root.attr->mode, - ".", v9fs_synth_root.attr, v9fs_synth_root.attr->i= node); + v9fs_add_dir_node(&synth_root, synth_root.attr->mode, + "..", synth_root.attr, synth_root.attr->inode); + v9fs_add_dir_node(&synth_root, synth_root.attr->mode, + ".", synth_root.attr, synth_root.attr->inode); =20 /* Mark the subsystem is ready for use */ - v9fs_synth_fs =3D 1; + synth_fs =3D 1; return 0; } =20 FileOperations synth_ops =3D { - .init =3D v9fs_synth_init, - .lstat =3D v9fs_synth_lstat, - .readlink =3D v9fs_synth_readlink, - .close =3D v9fs_synth_close, - .closedir =3D v9fs_synth_closedir, - .open =3D v9fs_synth_open, - .opendir =3D v9fs_synth_opendir, - .rewinddir =3D v9fs_synth_rewinddir, - .telldir =3D v9fs_synth_telldir, - .readdir =3D v9fs_synth_readdir, - .seekdir =3D v9fs_synth_seekdir, - .preadv =3D v9fs_synth_preadv, - .pwritev =3D v9fs_synth_pwritev, - .chmod =3D v9fs_synth_chmod, - .mknod =3D v9fs_synth_mknod, - .mkdir =3D v9fs_synth_mkdir, - .fstat =3D v9fs_synth_fstat, - .open2 =3D v9fs_synth_open2, - .symlink =3D v9fs_synth_symlink, - .link =3D v9fs_synth_link, - .truncate =3D v9fs_synth_truncate, - .rename =3D v9fs_synth_rename, - .chown =3D v9fs_synth_chown, - .utimensat =3D v9fs_synth_utimensat, - .remove =3D v9fs_synth_remove, - .fsync =3D v9fs_synth_fsync, - .statfs =3D v9fs_synth_statfs, - .lgetxattr =3D v9fs_synth_lgetxattr, - .llistxattr =3D v9fs_synth_llistxattr, - .lsetxattr =3D v9fs_synth_lsetxattr, - .lremovexattr =3D v9fs_synth_lremovexattr, - .name_to_path =3D v9fs_synth_name_to_path, - .renameat =3D v9fs_synth_renameat, - .unlinkat =3D v9fs_synth_unlinkat, + .init =3D synth_init, + .lstat =3D synth_lstat, + .readlink =3D synth_readlink, + .close =3D synth_close, + .closedir =3D synth_closedir, + .open =3D synth_open, + .opendir =3D synth_opendir, + .rewinddir =3D synth_rewinddir, + .telldir =3D synth_telldir, + .readdir =3D synth_readdir, + .seekdir =3D synth_seekdir, + .preadv =3D synth_preadv, + .pwritev =3D synth_pwritev, + .chmod =3D synth_chmod, + .mknod =3D synth_mknod, + .mkdir =3D synth_mkdir, + .fstat =3D synth_fstat, + .open2 =3D synth_open2, + .symlink =3D synth_symlink, + .link =3D synth_link, + .truncate =3D synth_truncate, + .rename =3D synth_rename, + .chown =3D synth_chown, + .utimensat =3D synth_utimensat, + .remove =3D synth_remove, + .fsync =3D synth_fsync, + .statfs =3D synth_statfs, + .lgetxattr =3D synth_lgetxattr, + .llistxattr =3D synth_llistxattr, + .lsetxattr =3D synth_lsetxattr, + .lremovexattr =3D synth_lremovexattr, + .name_to_path =3D synth_name_to_path, + .renameat =3D synth_renameat, + .unlinkat =3D synth_unlinkat, }; --=20 2.5.5