From nobody Sun May 11 21:16:34 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1719952431; cv=none; d=zohomail.com; s=zohoarc; b=my6xocJ5fOqDfy9VnnbztRanYsvSpA5YifClrXYOMAEBaa5L3B0pnWB6VGwRn/5UOzP7E9Nww83Y6O3E9lvEbk7Zd1S2Bl7pdBDWGiQDGkbR55B6CdiEe2Q8TPUgVH2K/cPPYuXis7TKlE7DNs8tnw2A0jVGTYh5cIggBeXi63o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719952431; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8Eny4dc4u4alXpsHdU13CSR0Mm+jD6T0BjGB+X7tlZ0=; b=IL+wiwg9yS0Ms+utUrmrcCutgjfSCFRw0oguIKFhVpN4iQmSYol4LH4jKzAkwRk+OrTiq87RJnddesXELEKpzc8tqB6o+6agu/njcGZg+MqFFR11Cdf/TxrKr8Yb+Z2QP8Xl0x3QlrfUxQcdrKgpA/tLM1KX7/Ey0h6xZcsWw2E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719952431679855.3209067150974; Tue, 2 Jul 2024 13:33:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOjyE-0008Ka-CF; Tue, 02 Jul 2024 16:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOjxx-0006Yo-66 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 16:19:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOjxr-0001DA-FB for qemu-devel@nongnu.org; Tue, 02 Jul 2024 16:19:04 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-267-GuReS-DXM-WHsepmW9cUjA-1; Tue, 02 Jul 2024 16:18:57 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3678fd1edf8so209374f8f.0 for ; Tue, 02 Jul 2024 13:18:57 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f5:eadd:8c31:db01:9d01:7604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af55aeasm207553605e9.17.2024.07.02.13.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 13:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719951538; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Eny4dc4u4alXpsHdU13CSR0Mm+jD6T0BjGB+X7tlZ0=; b=GABe7M/8fL2Y0PixuhryR5sLMPyHjr380SquBEOunQ3sOvIAQ743ugC7x9d4zkcYhJjfJK 5XlBcyA9XdO28CGmXrtqRSEw/4RtQxUFw/eGI/TroUULXZCq2sW/+jrtsisw5D9UcvxJMg zMOSf77MuZw26Qo4oAkY+kBMthEi6Sk= X-MC-Unique: GuReS-DXM-WHsepmW9cUjA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719951533; x=1720556333; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Eny4dc4u4alXpsHdU13CSR0Mm+jD6T0BjGB+X7tlZ0=; b=d2vEFDqRESoz3vvFLleVBa+vFXEbaG2f5J6yi7W2/Ai31BVTYSi9j7uiWp58gYA/ef AlNif7HbxWC345japcKlEi665KTbaDmb7fp+dMnthSsD6+fYKreos1gZhXNX6EMnbyCO gFTTqtSOwluq1PK6qottjXwDjErnY9vCCIyCkA3F530Q2ywQzPD0k3dIh2fgXwHlYPyR 7ZKAm1DxoTi1mZMog1oebFZjCmpaaxLMImVswNwY6FxJxlebJMkStzfBekKhFZvsHeoT 5UCLp5y0uIlQABbgIo/3sA/7QIkoebhQi28OO3/Klw0Bov4kPMQBKsRh5Y41iN+JvPvX 5odg== X-Gm-Message-State: AOJu0YwjDDOGffgOtU9483uoJYqJ97Tja7MGhCDp/cgOUd/qgxJEYUlC 5B877ly0vl2zJkz8zpMpPmRzuaea9UjeVtWqPun9b41+xVHKZhF3xt9gh+P5rMBdP4BgeZSfK8u 63CVHCzszwxT/UWh+hi0oa55MB7k7g0CuPIkIGvfeUZBaxu/Pdiekd0unXJcEYMyBfOgdWari2U sJXHm2dGHOcSThZ/6RwWlk9zRn1IFj0Q== X-Received: by 2002:a5d:64ca:0:b0:362:ff95:5697 with SMTP id ffacd0b85a97d-36760aa2b8cmr14059566f8f.28.1719951532887; Tue, 02 Jul 2024 13:18:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBQkU8GqFnvPWymycASQkkBf2P9Q5u0ww2Qi9YkMZGwHddPO3Q/ng7vH9kkJcpB9lvccYw1Q== X-Received: by 2002:a5d:64ca:0:b0:362:ff95:5697 with SMTP id ffacd0b85a97d-36760aa2b8cmr14059531f8f.28.1719951532334; Tue, 02 Jul 2024 13:18:52 -0700 (PDT) Date: Tue, 2 Jul 2024 16:18:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefano Garzarella , Stefan Hajnoczi , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Raphael Norwitz , Paolo Bonzini , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , Thomas Huth Subject: [PULL v2 55/88] contrib/vhost-user-blk: enable it on any POSIX system Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1719952432851100005 From: Stefano Garzarella Let's make the code more portable by adding defines from block/file-posix.c to support O_DIRECT in other systems (e.g. macOS). vhost-user-server.c is a dependency, let's enable it for any POSIX system. Acked-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Stefano Garzarella Message-Id: <20240618100511.145789-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-blk/vhost-user-blk.c | 14 ++++++++++++++ meson.build | 2 -- util/meson.build | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-b= lk/vhost-user-blk.c index 9492146855..a450337685 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -25,6 +25,20 @@ #include #endif =20 +/* OS X does not have O_DSYNC */ +#ifndef O_DSYNC +#ifdef O_SYNC +#define O_DSYNC O_SYNC +#elif defined(O_FSYNC) +#define O_DSYNC O_FSYNC +#endif +#endif + +/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */ +#ifndef O_DIRECT +#define O_DIRECT O_DSYNC +#endif + enum { VHOST_USER_BLK_MAX_QUEUES =3D 8, }; diff --git a/meson.build b/meson.build index 6c1a489cc0..a947b83c3f 100644 --- a/meson.build +++ b/meson.build @@ -2026,8 +2026,6 @@ has_statx =3D cc.has_header_symbol('sys/stat.h', 'STA= TX_BASIC_STATS', prefix: gnu_ has_statx_mnt_id =3D cc.has_header_symbol('sys/stat.h', 'STATX_MNT_ID', pr= efix: gnu_source_prefix) =20 have_vhost_user_blk_server =3D get_option('vhost_user_blk_server') \ - .require(host_os =3D=3D 'linux', - error_message: 'vhost_user_blk_server requires linux') \ .require(have_vhost_user, error_message: 'vhost_user_blk_server requires vhost-user suppo= rt') \ .disable_auto_if(not have_tools and not have_system) \ diff --git a/util/meson.build b/util/meson.build index 72b505df11..c414178ace 100644 --- a/util/meson.build +++ b/util/meson.build @@ -112,10 +112,12 @@ if have_block util_ss.add(files('filemonitor-stub.c')) endif if host_os =3D=3D 'linux' - util_ss.add(files('vhost-user-server.c'), vhost_user) util_ss.add(files('vfio-helpers.c')) util_ss.add(files('chardev_open.c')) endif + if host_os !=3D 'windows' + util_ss.add(files('vhost-user-server.c'), vhost_user) + endif util_ss.add(files('yank.c')) endif =20 --=20 MST