From patchwork Thu Oct 18 20:41:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Bryant X-Patchwork-Id: 192436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 029022C0096 for ; Fri, 19 Oct 2012 07:42:20 +1100 (EST) Received: from localhost ([::1]:42564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOwv4-0001om-Rs for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2012 16:42:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOwux-0001nn-Fa for qemu-devel@nongnu.org; Thu, 18 Oct 2012 16:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOwuw-0004tq-Gg for qemu-devel@nongnu.org; Thu, 18 Oct 2012 16:42:11 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:38322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOwuw-0004ti-A6 for qemu-devel@nongnu.org; Thu, 18 Oct 2012 16:42:10 -0400 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2012 14:42:08 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 18 Oct 2012 14:41:12 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id CABD919D806B for ; Thu, 18 Oct 2012 14:41:11 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9IKfBAs244736 for ; Thu, 18 Oct 2012 14:41:11 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9IKf9V6004263 for ; Thu, 18 Oct 2012 14:41:10 -0600 Received: from localhost ([9.80.110.233]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9IKf8P3004159; Thu, 18 Oct 2012 14:41:09 -0600 From: Corey Bryant To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2012 16:41:04 -0400 Message-Id: <1350592864-10408-1-git-send-email-coreyb@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.11.4 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12101820-5518-0000-0000-0000088CC11D X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.159 Cc: kwolf@redhat.com, peter.maydell@linaro.org, Corey Bryant Subject: [Qemu-devel] [PATCH] osdep: Less restrictive F_SEFL in qemu_dup_flags() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org qemu_dup_flags() currently limits the flags that can be set on the fcntl() F_SETFL call to those that we currently know can be set with fcntl() F_SETFL. The problem with this is that it will prevent use of new flags in the future without a code update. This patch relaxes the checking and lets fcntl() determine the flags it can set. Signed-off-by: Corey Bryant --- osdep.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/osdep.c b/osdep.c index 3b25297..c822a01 100644 --- a/osdep.c +++ b/osdep.c @@ -88,7 +88,6 @@ static int qemu_dup_flags(int fd, int flags) int ret; int serrno; int dup_flags; - int setfl_flags; #ifdef F_DUPFD_CLOEXEC ret = fcntl(fd, F_DUPFD_CLOEXEC, 0); @@ -113,16 +112,7 @@ static int qemu_dup_flags(int fd, int flags) } /* Set/unset flags that we can with fcntl */ - setfl_flags = O_APPEND | O_ASYNC | O_NONBLOCK; -#ifdef O_NOATIME - setfl_flags |= O_NOATIME; -#endif -#ifdef O_DIRECT - setfl_flags |= O_DIRECT; -#endif - dup_flags &= ~setfl_flags; - dup_flags |= (flags & setfl_flags); - if (fcntl(ret, F_SETFL, dup_flags) == -1) { + if (fcntl(ret, F_SETFL, flags) == -1) { goto fail; }