Received: from eggs.gnu.org ([2001:4830:134:3::10]:57599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkYIm-00040W-HD for qemu-devel@nongnu.org; Thu, 15 Sep 2016 11:10:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkYIg-0001IH-Pb for qemu-devel@nongnu.org; Thu, 15 Sep 2016 11:10:11 -0400 Received: from 7.mo177.mail-out.ovh.net ([46.105.61.149]:57288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkYIg-0001I1-9x for qemu-devel@nongnu.org; Thu, 15 Sep 2016 11:10:06 -0400 Received: from player699.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id D0EBCFFC9CF for ; Thu, 15 Sep 2016 17:10:03 +0200 (CEST) References: <147394943723.684.13967719989878111420.stgit@bahia> <147394944474.684.15195642749867813000.stgit@bahia> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <59a8cb4c-8e52-4a5b-cc4e-d3348ba3ef7c@kaod.org> Date: Thu, 15 Sep 2016 17:10:00 +0200 MIME-Version: 1.0 In-Reply-To: <147394944474.684.15195642749867813000.stgit@bahia> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/4] 9pfs: drop unused fmt strings in the proxy backend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz , qemu-devel@nongnu.org Cc: "Aneesh Kumar K.V" On 09/15/2016 04:24 PM, Greg Kurz wrote: > The v9fs_request() function doesn't use its fmt argument: it passes lit= eral > format strings to proxy_marshal() for all commands. >=20 > This patch simply drops the unused fmt argument and updates all callers > accordingly. Reviewed-by: C=C3=A9dric Le Goater > Signed-off-by: Greg Kurz > --- > hw/9pfs/9p-proxy.c | 67 +++++++++++++++++++++++---------------------= -------- > 1 file changed, 30 insertions(+), 37 deletions(-) >=20 > diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c > index f265501eac1d..52bbf4f1b37c 100644 > --- a/hw/9pfs/9p-proxy.c > +++ b/hw/9pfs/9p-proxy.c > @@ -292,12 +292,11 @@ static int v9fs_receive_status(V9fsProxy *proxy, > /* > * Proxy->header and proxy->request written to socket by QEMU process. > * This request read by proxy helper process > * returns 0 on success and -errno on error > */ > -static int v9fs_request(V9fsProxy *proxy, int type, > - void *response, const char *fmt, ...) > +static int v9fs_request(V9fsProxy *proxy, int type, void *response, ..= .) > { > dev_t rdev; > va_list ap; > int size =3D 0; > int retval =3D 0; > @@ -315,11 +314,11 @@ static int v9fs_request(V9fsProxy *proxy, int typ= e, > retval =3D -EIO; > goto err_out; > } > iovec =3D &proxy->out_iovec; > reply =3D &proxy->in_iovec; > - va_start(ap, fmt); > + va_start(ap, response); > switch (type) { > case T_OPEN: > path =3D va_arg(ap, V9fsString *); > flags =3D va_arg(ap, int); > retval =3D proxy_marshal(iovec, PROXY_HDR_SZ, "sd", path, flag= s); > @@ -603,11 +602,11 @@ close_error: > } > =20 > static int proxy_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct st= at *stbuf) > { > int retval; > - retval =3D v9fs_request(fs_ctx->private, T_LSTAT, stbuf, "s", fs_p= ath); > + retval =3D v9fs_request(fs_ctx->private, T_LSTAT, stbuf, fs_path); > if (retval < 0) { > errno =3D -retval; > return -1; > } > return retval; > @@ -615,12 +614,11 @@ static int proxy_lstat(FsContext *fs_ctx, V9fsPat= h *fs_path, struct stat *stbuf) > =20 > static ssize_t proxy_readlink(FsContext *fs_ctx, V9fsPath *fs_path, > char *buf, size_t bufsz) > { > int retval; > - retval =3D v9fs_request(fs_ctx->private, T_READLINK, buf, "sd", > - fs_path, bufsz); > + retval =3D v9fs_request(fs_ctx->private, T_READLINK, buf, fs_path,= bufsz); > if (retval < 0) { > errno =3D -retval; > return -1; > } > return strlen(buf); > @@ -637,11 +635,11 @@ static int proxy_closedir(FsContext *ctx, V9fsFid= OpenState *fs) > } > =20 > static int proxy_open(FsContext *ctx, V9fsPath *fs_path, > int flags, V9fsFidOpenState *fs) > { > - fs->fd =3D v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path,= flags); > + fs->fd =3D v9fs_request(ctx->private, T_OPEN, NULL, fs_path, flags= ); > if (fs->fd < 0) { > errno =3D -fs->fd; > fs->fd =3D -1; > } > return fs->fd; > @@ -651,11 +649,11 @@ static int proxy_opendir(FsContext *ctx, > V9fsPath *fs_path, V9fsFidOpenState *fs) > { > int serrno, fd; > =20 > fs->dir.stream =3D NULL; > - fd =3D v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, O_D= IRECTORY); > + fd =3D v9fs_request(ctx->private, T_OPEN, NULL, fs_path, O_DIRECTO= RY); > if (fd < 0) { > errno =3D -fd; > return -1; > } > fs->dir.stream =3D fdopendir(fd); > @@ -733,12 +731,12 @@ static ssize_t proxy_pwritev(FsContext *ctx, V9fs= FidOpenState *fs, > } > =20 > static int proxy_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *c= redp) > { > int retval; > - retval =3D v9fs_request(fs_ctx->private, T_CHMOD, NULL, "sd", > - fs_path, credp->fc_mode); > + retval =3D v9fs_request(fs_ctx->private, T_CHMOD, NULL, fs_path, > + credp->fc_mode); > if (retval < 0) { > errno =3D -retval; > } > return retval; > } > @@ -750,12 +748,12 @@ static int proxy_mknod(FsContext *fs_ctx, V9fsPat= h *dir_path, > V9fsString fullname; > =20 > v9fs_string_init(&fullname); > v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name); > =20 > - retval =3D v9fs_request(fs_ctx->private, T_MKNOD, NULL, "sdqdd", > - &fullname, credp->fc_mode, credp->fc_rdev, > + retval =3D v9fs_request(fs_ctx->private, T_MKNOD, NULL, &fullname, > + credp->fc_mode, credp->fc_rdev, > credp->fc_uid, credp->fc_gid); > v9fs_string_free(&fullname); > if (retval < 0) { > errno =3D -retval; > retval =3D -1; > @@ -770,11 +768,11 @@ static int proxy_mkdir(FsContext *fs_ctx, V9fsPat= h *dir_path, > V9fsString fullname; > =20 > v9fs_string_init(&fullname); > v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name); > =20 > - retval =3D v9fs_request(fs_ctx->private, T_MKDIR, NULL, "sddd", &f= ullname, > + retval =3D v9fs_request(fs_ctx->private, T_MKDIR, NULL, &fullname, > credp->fc_mode, credp->fc_uid, credp->fc_gid= ); > v9fs_string_free(&fullname); > if (retval < 0) { > errno =3D -retval; > retval =3D -1; > @@ -802,13 +800,12 @@ static int proxy_open2(FsContext *fs_ctx, V9fsPat= h *dir_path, const char *name, > V9fsString fullname; > =20 > v9fs_string_init(&fullname); > v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name); > =20 > - fs->fd =3D v9fs_request(fs_ctx->private, T_CREATE, NULL, "sdddd", > - &fullname, flags, credp->fc_mode, > - credp->fc_uid, credp->fc_gid); > + fs->fd =3D v9fs_request(fs_ctx->private, T_CREATE, NULL, &fullname= , flags, > + credp->fc_mode, credp->fc_uid, credp->fc_gid= ); > v9fs_string_free(&fullname); > if (fs->fd < 0) { > errno =3D -fs->fd; > fs->fd =3D -1; > } > @@ -825,12 +822,12 @@ static int proxy_symlink(FsContext *fs_ctx, const= char *oldpath, > v9fs_string_init(&target); > =20 > v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name); > v9fs_string_sprintf(&target, "%s", oldpath); > =20 > - retval =3D v9fs_request(fs_ctx->private, T_SYMLINK, NULL, "ssdd", > - &target, &fullname, credp->fc_uid, credp->fc= _gid); > + retval =3D v9fs_request(fs_ctx->private, T_SYMLINK, NULL, &target,= &fullname, > + credp->fc_uid, credp->fc_gid); > v9fs_string_free(&fullname); > v9fs_string_free(&target); > if (retval < 0) { > errno =3D -retval; > retval =3D -1; > @@ -845,11 +842,11 @@ static int proxy_link(FsContext *ctx, V9fsPath *o= ldpath, > V9fsString newpath; > =20 > v9fs_string_init(&newpath); > v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name); > =20 > - retval =3D v9fs_request(ctx->private, T_LINK, NULL, "ss", oldpath,= &newpath); > + retval =3D v9fs_request(ctx->private, T_LINK, NULL, oldpath, &newp= ath); > v9fs_string_free(&newpath); > if (retval < 0) { > errno =3D -retval; > retval =3D -1; > } > @@ -858,11 +855,11 @@ static int proxy_link(FsContext *ctx, V9fsPath *o= ldpath, > =20 > static int proxy_truncate(FsContext *ctx, V9fsPath *fs_path, off_t siz= e) > { > int retval; > =20 > - retval =3D v9fs_request(ctx->private, T_TRUNCATE, NULL, "sq", fs_p= ath, size); > + retval =3D v9fs_request(ctx->private, T_TRUNCATE, NULL, fs_path, s= ize); > if (retval < 0) { > errno =3D -retval; > return -1; > } > return 0; > @@ -877,12 +874,11 @@ static int proxy_rename(FsContext *ctx, const cha= r *oldpath, > v9fs_string_init(&oldname); > v9fs_string_init(&newname); > =20 > v9fs_string_sprintf(&oldname, "%s", oldpath); > v9fs_string_sprintf(&newname, "%s", newpath); > - retval =3D v9fs_request(ctx->private, T_RENAME, NULL, "ss", > - &oldname, &newname); > + retval =3D v9fs_request(ctx->private, T_RENAME, NULL, &oldname, &n= ewname); > v9fs_string_free(&oldname); > v9fs_string_free(&newname); > if (retval < 0) { > errno =3D -retval; > } > @@ -890,24 +886,23 @@ static int proxy_rename(FsContext *ctx, const cha= r *oldpath, > } > =20 > static int proxy_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *c= redp) > { > int retval; > - retval =3D v9fs_request(fs_ctx->private, T_CHOWN, NULL, "sdd", > - fs_path, credp->fc_uid, credp->fc_gid); > + retval =3D v9fs_request(fs_ctx->private, T_CHOWN, NULL, fs_path, > + credp->fc_uid, credp->fc_gid); > if (retval < 0) { > errno =3D -retval; > } > return retval; > } > =20 > static int proxy_utimensat(FsContext *s, V9fsPath *fs_path, > const struct timespec *buf) > { > int retval; > - retval =3D v9fs_request(s->private, T_UTIME, NULL, "sqqqq", > - fs_path, > + retval =3D v9fs_request(s->private, T_UTIME, NULL, fs_path, > buf[0].tv_sec, buf[0].tv_nsec, > buf[1].tv_sec, buf[1].tv_nsec); > if (retval < 0) { > errno =3D -retval; > } > @@ -918,11 +913,11 @@ static int proxy_remove(FsContext *ctx, const cha= r *path) > { > int retval; > V9fsString name; > v9fs_string_init(&name); > v9fs_string_sprintf(&name, "%s", path); > - retval =3D v9fs_request(ctx->private, T_REMOVE, NULL, "s", &name); > + retval =3D v9fs_request(ctx->private, T_REMOVE, NULL, &name); > v9fs_string_free(&name); > if (retval < 0) { > errno =3D -retval; > } > return retval; > @@ -947,11 +942,11 @@ static int proxy_fsync(FsContext *ctx, int fid_ty= pe, > } > =20 > static int proxy_statfs(FsContext *s, V9fsPath *fs_path, struct statfs= *stbuf) > { > int retval; > - retval =3D v9fs_request(s->private, T_STATFS, stbuf, "s", fs_path)= ; > + retval =3D v9fs_request(s->private, T_STATFS, stbuf, fs_path); > if (retval < 0) { > errno =3D -retval; > return -1; > } > return retval; > @@ -963,12 +958,12 @@ static ssize_t proxy_lgetxattr(FsContext *ctx, V9= fsPath *fs_path, > int retval; > V9fsString xname; > =20 > v9fs_string_init(&xname); > v9fs_string_sprintf(&xname, "%s", name); > - retval =3D v9fs_request(ctx->private, T_LGETXATTR, value, "dss", s= ize, > - fs_path, &xname); > + retval =3D v9fs_request(ctx->private, T_LGETXATTR, value, size, fs= _path, > + &xname); > v9fs_string_free(&xname); > if (retval < 0) { > errno =3D -retval; > } > return retval; > @@ -976,12 +971,11 @@ static ssize_t proxy_lgetxattr(FsContext *ctx, V9= fsPath *fs_path, > =20 > static ssize_t proxy_llistxattr(FsContext *ctx, V9fsPath *fs_path, > void *value, size_t size) > { > int retval; > - retval =3D v9fs_request(ctx->private, T_LLISTXATTR, value, "ds", s= ize, > - fs_path); > + retval =3D v9fs_request(ctx->private, T_LLISTXATTR, value, size, f= s_path); > if (retval < 0) { > errno =3D -retval; > } > return retval; > } > @@ -998,12 +992,12 @@ static int proxy_lsetxattr(FsContext *ctx, V9fsPa= th *fs_path, const char *name, > v9fs_string_init(&xvalue); > xvalue.size =3D size; > xvalue.data =3D g_malloc(size); > memcpy(xvalue.data, value, size); > =20 > - retval =3D v9fs_request(ctx->private, T_LSETXATTR, value, "sssdd", > - fs_path, &xname, &xvalue, size, flags); > + retval =3D v9fs_request(ctx->private, T_LSETXATTR, value, fs_path,= &xname, > + &xvalue, size, flags); > v9fs_string_free(&xname); > v9fs_string_free(&xvalue); > if (retval < 0) { > errno =3D -retval; > } > @@ -1016,12 +1010,11 @@ static int proxy_lremovexattr(FsContext *ctx, V= 9fsPath *fs_path, > int retval; > V9fsString xname; > =20 > v9fs_string_init(&xname); > v9fs_string_sprintf(&xname, "%s", name); > - retval =3D v9fs_request(ctx->private, T_LREMOVEXATTR, NULL, "ss", > - fs_path, &xname); > + retval =3D v9fs_request(ctx->private, T_LREMOVEXATTR, NULL, fs_pat= h, &xname); > v9fs_string_free(&xname); > if (retval < 0) { > errno =3D -retval; > } > return retval; > @@ -1084,11 +1077,11 @@ static int proxy_ioc_getversion(FsContext *fs_c= tx, V9fsPath *path, > */ > if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) { > errno =3D ENOTTY; > return -1; > } > - err =3D v9fs_request(fs_ctx->private, T_GETVERSION, st_gen, "s", p= ath); > + err =3D v9fs_request(fs_ctx->private, T_GETVERSION, st_gen, path); > if (err < 0) { > errno =3D -err; > err =3D -1; > } > return err; >=20 >=20