From nobody Sat Feb 7 08:23:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1580217307787347.4176930420422; Tue, 28 Jan 2020 05:15:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-rA6M4AINPuGMwBjkDpKUKQ-1; Tue, 28 Jan 2020 08:14:22 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A37C18A6EC0; Tue, 28 Jan 2020 13:14:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4092187054; Tue, 28 Jan 2020 13:14:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EED9285E41; Tue, 28 Jan 2020 13:14:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00SDEGgY019653 for ; Tue, 28 Jan 2020 08:14:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id F206E106F95E; Tue, 28 Jan 2020 13:14:15 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11A811000330; Tue, 28 Jan 2020 13:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580217305; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dodf3oiSYaY5vFGe5VR4qWHSaRsEypu04Sd+EOHuCN4=; b=NarLjlSV2/HKGbr/7YwcoiDJgb1tY+3SlKSChU42jgDF77prhhKI3bNPd5ZXsFx/3cH/WH BqH/onEmXegDxCuJUHq99X+oJ29d1GB5/6f/vA+onklpcVcg3fmEZkiaaNELfuCM2DncKI nSjNTA33CGJn/wj6uZNoFgkYOlsVh30= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 43/56] util: conditionalize FD stream to exclude WIN32 Date: Tue, 28 Jan 2020 13:11:24 +0000 Message-Id: <20200128131137.1762449-44-berrange@redhat.com> In-Reply-To: <20200128131137.1762449-1-berrange@redhat.com> References: <20200128131137.1762449-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: rA6M4AINPuGMwBjkDpKUKQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Almost none of the virFDStream code will actually work on WIN32 builds, nor is it used except for in the virtualbox driver for screenshots. It is simpler to wrap it all in a '#ifndef WIN32'. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Pavel Hrdina --- src/util/virfdstream.c | 122 +++++++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 29 deletions(-) diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index c094876dee..05ac63c281 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -25,8 +25,8 @@ #include #include #include -#include #ifndef WIN32 +# include # include #endif =20 @@ -47,6 +47,7 @@ =20 VIR_LOG_INIT("fdstream"); =20 +#ifndef WIN32 typedef enum { VIR_FDSTREAM_MSG_TYPE_DATA, VIR_FDSTREAM_MSG_TYPE_HOLE, @@ -1159,7 +1160,6 @@ int virFDStreamOpen(virStreamPtr st, } =20 =20 -#ifndef WIN32 int virFDStreamConnectUNIX(virStreamPtr st, const char *path, bool abstract) @@ -1209,16 +1209,7 @@ int virFDStreamConnectUNIX(virStreamPtr st, VIR_FORCE_CLOSE(fd); return -1; } -#else -int virFDStreamConnectUNIX(virStreamPtr st G_GNUC_UNUSED, - const char *path G_GNUC_UNUSED, - bool abstract G_GNUC_UNUSED) -{ - virReportSystemError(ENOSYS, "%s", - _("UNIX domain sockets are not supported on this = platform")); - return -1; -} -#endif + =20 static int virFDStreamOpenFileInternal(virStreamPtr st, @@ -1240,9 +1231,6 @@ virFDStreamOpenFileInternal(virStreamPtr st, st, path, oflags, offset, length, mode); =20 oflags |=3D O_NOCTTY; -#ifdef O_BINARY - oflags |=3D O_BINARY; -#endif =20 if (oflags & O_CREAT) fd =3D open(path, oflags, mode); @@ -1362,7 +1350,6 @@ int virFDStreamCreateFile(virStreamPtr st, false, false); } =20 -#ifndef WIN32 int virFDStreamOpenPTY(virStreamPtr st, const char *path, unsigned long long offset, @@ -1402,19 +1389,6 @@ int virFDStreamOpenPTY(virStreamPtr st, virFDStreamClose(st); return -1; } -#else /* WIN32 */ -int virFDStreamOpenPTY(virStreamPtr st, - const char *path, - unsigned long long offset, - unsigned long long length, - int oflags) -{ - return virFDStreamOpenFileInternal(st, path, - offset, length, - oflags | O_CREAT, 0, - false, false); -} -#endif /* WIN32 */ =20 int virFDStreamOpenBlockDevice(virStreamPtr st, const char *path, @@ -1447,3 +1421,93 @@ int virFDStreamSetInternalCloseCb(virStreamPtr st, virObjectUnlock(fdst); return 0; } + +#else /* WIN32 */ + +int +virFDStreamOpen(virStreamPtr st G_GNUC_UNUSED, + int fd G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + + +int +virFDStreamConnectUNIX(virStreamPtr st G_GNUC_UNUSED, + const char *path G_GNUC_UNUSED, + bool abstract G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + + +int +virFDStreamOpenFile(virStreamPtr st G_GNUC_UNUSED, + const char *path G_GNUC_UNUSED, + unsigned long long offset G_GNUC_UNUSED, + unsigned long long length G_GNUC_UNUSED, + int oflags G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + + +int +virFDStreamCreateFile(virStreamPtr st G_GNUC_UNUSED, + const char *path G_GNUC_UNUSED, + unsigned long long offset G_GNUC_UNUSED, + unsigned long long length G_GNUC_UNUSED, + int oflags G_GNUC_UNUSED, + mode_t mode G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + + +int +virFDStreamOpenPTY(virStreamPtr st G_GNUC_UNUSED, + const char *path G_GNUC_UNUSED, + unsigned long long offset G_GNUC_UNUSED, + unsigned long long length G_GNUC_UNUSED, + int oflags G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + + +int +virFDStreamOpenBlockDevice(virStreamPtr st G_GNUC_UNUSED, + const char *path G_GNUC_UNUSED, + unsigned long long offset G_GNUC_UNUSED, + unsigned long long length G_GNUC_UNUSED, + bool sparse G_GNUC_UNUSED, + int oflags G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + + +int +virFDStreamSetInternalCloseCb(virStreamPtr st G_GNUC_UNUSED, + virFDStreamInternalCloseCb cb G_GNUC_UNUSED, + void *opaque G_GNUC_UNUSED, + virFDStreamInternalCloseCbFreeOpaque fcb G_G= NUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("File streams are not supported on this platfor= m")); + return -1; +} + +#endif /* WIN32 */ --=20 2.24.1