From patchwork Mon Jun 27 09:41:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 9200219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D156760752 for ; Mon, 27 Jun 2016 09:46:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C13862856D for ; Mon, 27 Jun 2016 09:46:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B35D928570; Mon, 27 Jun 2016 09:46:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B16B2856D for ; Mon, 27 Jun 2016 09:46:27 +0000 (UTC) Received: from localhost ([::1]:57516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHT7b-00062c-0M for patchwork-qemu-devel@patchwork.kernel.org; Mon, 27 Jun 2016 05:46:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHT3F-00087x-Vs for qemu-devel@nongnu.org; Mon, 27 Jun 2016 05:42:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHT3B-00051q-QD for qemu-devel@nongnu.org; Mon, 27 Jun 2016 05:41:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHT3B-00051V-GF for qemu-devel@nongnu.org; Mon, 27 Jun 2016 05:41:53 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5R9dJ5o071735 for ; Mon, 27 Jun 2016 05:41:52 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 23sm9dfyqa-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 27 Jun 2016 05:41:52 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 27 Jun 2016 03:41:52 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 27 Jun 2016 03:41:49 -0600 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: groug@kaod.org Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 972773E40044; Mon, 27 Jun 2016 03:41:48 -0600 (MDT) Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5R9fmU365994834; Mon, 27 Jun 2016 02:41:48 -0700 Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71C55BE040; Mon, 27 Jun 2016 03:41:48 -0600 (MDT) Received: from bahia.lan (unknown [9.164.189.130]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id 0A6DBBE038; Mon, 27 Jun 2016 03:41:46 -0600 (MDT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Mon, 27 Jun 2016 11:41:45 +0200 In-Reply-To: <146702045511.5764.17551224268217330628.stgit@bahia.lan> References: <146702045511.5764.17551224268217330628.stgit@bahia.lan> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16062709-0004-0000-0000-00000FC71426 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062709-0005-0000-0000-000076897CE3 Message-Id: <146702050570.5764.13291536303403737397.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-06-27_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606270110 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 06/13] oslib: support futimens() if available X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Van Hensbergen , v9fs-developer@lists.sourceforge.net, "Aneesh Kumar K.V" , Greg Kurz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Greg Kurz --- hw/9pfs/9p-handle.c | 7 +------ include/sysemu/os-posix.h | 1 + util/oslib-posix.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c index e48e48a7145d..197c2c7efbb5 100644 --- a/hw/9pfs/9p-handle.c +++ b/hw/9pfs/9p-handle.c @@ -388,7 +388,6 @@ static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path, const struct timespec *buf) { int ret; -#ifdef CONFIG_UTIMENSAT int fd; struct handle_data *data = (struct handle_data *)ctx->private; @@ -396,12 +395,8 @@ static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path, if (fd < 0) { return fd; } - ret = futimens(fd, buf); + ret = qemu_futimens(fd, buf); close(fd); -#else - ret = -1; - errno = ENOSYS; -#endif return ret; } diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 9c7dfdfbec69..c2b2288bb3bf 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -57,6 +57,7 @@ typedef struct timeval qemu_timeval; #endif typedef struct timespec qemu_timespec; int qemu_utimens(const char *path, const qemu_timespec *times); +int qemu_futimens(int fd, const qemu_timespec *times); bool is_daemonized(void); diff --git a/util/oslib-posix.c b/util/oslib-posix.c index e2e1d4d39f59..3c9de4ad1d71 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -187,6 +187,16 @@ int qemu_pipe(int pipefd[2]) return ret; } +int qemu_futimens(int fd, const struct timespec *times) +{ +#ifdef CONFIG_UTIMENSAT + return futimens(fd, times); +#else + errno = ENOSYS; + return -1; +#endif +} + int qemu_utimens(const char *path, const struct timespec *times) { struct timeval tv[2], tv_now;