From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53730 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oby7b-00052T-Lr for qemu-devel@nongnu.org; Thu, 22 Jul 2010 11:55:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oby7Y-0001c3-CH for qemu-devel@nongnu.org; Thu, 22 Jul 2010 11:55:43 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:60587) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oby7Y-0001bo-6Y for qemu-devel@nongnu.org; Thu, 22 Jul 2010 11:55:40 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o6MFk02x017678 for ; Thu, 22 Jul 2010 09:46:00 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6MFtOY9121520 for ; Thu, 22 Jul 2010 09:55:25 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o6MFtNS0032400 for ; Thu, 22 Jul 2010 09:55:23 -0600 From: "Venkateswararao Jujjuri (JV)" Date: Thu, 22 Jul 2010 08:57:55 -0700 Message-Id: <1279814291-8301-9-git-send-email-jvrao@linux.vnet.ibm.com> In-Reply-To: <1279814291-8301-1-git-send-email-jvrao@linux.vnet.ibm.com> References: <1279814291-8301-1-git-send-email-jvrao@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH-V3 08/24] [virtio-9p] Make v9fs_do_utimensat accept timespec structures instead of v9stat. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, Sripathi Kodi , Venkateswararao Jujjuri From: Sripathi Kodi Currently v9fs_do_utimensat takes a V9fsStat argument and builds timespec structures. It sets tv_nsec values to 0 by default. Instead of this it should take struct timespec[2] and pass it down to the system directly. This will make it more generic and useful elsewhere. Signed-off-by: Sripathi Kodi Signed-off-by: Venkateswararao Jujjuri --- hw/virtio-9p.c | 37 ++++++++++++++++++------------------- 1 files changed, 18 insertions(+), 19 deletions(-) diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index bb59c0c..e4754b8 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -237,25 +237,10 @@ static int v9fs_do_chown(V9fsState *s, V9fsString *path, uid_t uid, gid_t gid) return s->ops->chown(&s->ctx, path->data, &cred); } -static int v9fs_do_utimensat(V9fsState *s, V9fsString *path, V9fsStat v9stat) +static int v9fs_do_utimensat(V9fsState *s, V9fsString *path, + const struct timespec times[2]) { - struct timespec ts[2]; - - if (v9stat.atime != -1) { - ts[0].tv_sec = v9stat.atime; - ts[0].tv_nsec = 0; - } else { - ts[0].tv_nsec = UTIME_OMIT; - } - - if (v9stat.mtime != -1) { - ts[1].tv_sec = v9stat.mtime; - ts[1].tv_nsec = 0; - } else { - ts[1].tv_nsec = UTIME_OMIT; - } - - return s->ops->utimensat(&s->ctx, path->data, ts); + return s->ops->utimensat(&s->ctx, path->data, times); } static int v9fs_do_remove(V9fsState *s, V9fsString *path) @@ -2342,7 +2327,21 @@ static void v9fs_wstat_post_chmod(V9fsState *s, V9fsWstatState *vs, int err) } if (vs->v9stat.mtime != -1 || vs->v9stat.atime != -1) { - if (v9fs_do_utimensat(s, &vs->fidp->path, vs->v9stat)) { + struct timespec times[2]; + if (vs->v9stat.atime != -1) { + times[0].tv_sec = vs->v9stat.atime; + times[0].tv_nsec = 0; + } else { + times[0].tv_nsec = UTIME_OMIT; + } + if (vs->v9stat.mtime != -1) { + times[1].tv_sec = vs->v9stat.mtime; + times[1].tv_nsec = 0; + } else { + times[1].tv_nsec = UTIME_OMIT; + } + + if (v9fs_do_utimensat(s, &vs->fidp->path, times)) { err = -errno; } } -- 1.6.5.2