From nobody Mon Feb 9 16:02:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560876108; cv=none; d=zoho.com; s=zohoarc; b=KEkrABl9Nc6n4bJVSh8tgIGfAXV1mscundUMRt9CWjbYu78nCWlyvfCl+0HlS+/MIlwot33dJ1/IKWWHZINhMRbztnsUqMA48K1QwJaJu/aTgBVF2fYIPN+B+trTfh8Wd1aqwnhn39hz06N7Lm7sSL2v8g8UXWUyjCqruPr0cOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560876108; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JNsTIF4auCy1HNZzOKjUx9OkdmLq0vdOv8ehqsA19ME=; b=GHOz2uGqzu1kwJsLHwuL+UeOZNdWT80G9+kWwHyYXQFjX/MXYM2s5H72w26DCApbso3RIzxQT9HY2j90zWW2Bi7IuJGB7LcUOj9Aht+S3sz2TaXdtXj4r9BiK+MNtjYRDktLiG+5aXv1RNkeSRc9ecu6viLPJljPlnBDYTGExv0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560876108582715.8222077160937; Tue, 18 Jun 2019 09:41:48 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id C9240C053B34; Tue, 18 Jun 2019 16:41:46 +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 A05C57D933; Tue, 18 Jun 2019 16:41:46 +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 5F1AB206D8; Tue, 18 Jun 2019 16:41:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IGDUga024251 for ; Tue, 18 Jun 2019 12:13:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id DD5B784EF; Tue, 18 Jun 2019 16:13:30 +0000 (UTC) Received: from aegolius.redhat.com (ovpn-117-198.phx2.redhat.com [10.3.117.198]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC1FC60FAB for ; Tue, 18 Jun 2019 16:13:30 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 11:12:50 -0500 Message-Id: <20190618161316.1722-21-jjongsma@redhat.com> In-Reply-To: <20190618161316.1722-1-jjongsma@redhat.com> References: <20190618161316.1722-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/46] util: file: use #pragma once in headers 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 18 Jun 2019 16:41:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jonathon Jongsma Reviewed-by: J=C3=A1n Tomko --- src/util/virfile.h | 61 ++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/src/util/virfile.h b/src/util/virfile.h index 641960e2ca..094c92e2b9 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -22,15 +22,14 @@ * */ =20 -#ifndef LIBVIRT_VIRFILE_H -# define LIBVIRT_VIRFILE_H +#pragma once =20 -# include +#include =20 -# include "internal.h" -# include "virbitmap.h" -# include "virstoragefile.h" -# include "virautoclean.h" +#include "internal.h" +#include "virbitmap.h" +#include "virstoragefile.h" +#include "virautoclean.h" =20 typedef enum { VIR_FILE_CLOSE_PRESERVE_ERRNO =3D 1 << 0, @@ -59,25 +58,25 @@ static inline void virForceCloseHelper(int *fd) =20 /* For use on normal paths; caller must check return value, and failure sets errno per close. */ -# define VIR_CLOSE(FD) virFileClose(&(FD), 0) -# define VIR_FCLOSE(FILE) virFileFclose(&(FILE), false) +#define VIR_CLOSE(FD) virFileClose(&(FD), 0) +#define VIR_FCLOSE(FILE) virFileFclose(&(FILE), false) =20 /* Wrapper around fdopen that consumes fd on success. */ -# define VIR_FDOPEN(FD, MODE) virFileFdopen(&(FD), MODE) +#define VIR_FDOPEN(FD, MODE) virFileFdopen(&(FD), MODE) =20 /* For use on cleanup paths; errno is unaffected by close, and no return value to worry about. */ -# define VIR_FORCE_CLOSE(FD) virForceCloseHelper(&(FD)) -# define VIR_FORCE_FCLOSE(FILE) ignore_value(virFileFclose(&(FILE), true)) +#define VIR_FORCE_CLOSE(FD) virForceCloseHelper(&(FD)) +#define VIR_FORCE_FCLOSE(FILE) ignore_value(virFileFclose(&(FILE), true)) =20 /* Similar VIR_FORCE_CLOSE() but ignores EBADF errors since they are expec= ted * during mass close after fork(). */ -# define VIR_MASS_CLOSE(FD) \ +#define VIR_MASS_CLOSE(FD) \ ignore_value(virFileClose(&(FD), \ VIR_FILE_CLOSE_PRESERVE_ERRNO | \ VIR_FILE_CLOSE_IGNORE_EBADF)) =20 -# define VIR_LOG_CLOSE(FD) \ +#define VIR_LOG_CLOSE(FD) \ ignore_value(virFileClose(&(FD), \ VIR_FILE_CLOSE_PRESERVE_ERRNO | \ VIR_FILE_CLOSE_DONT_LOG)) @@ -89,7 +88,7 @@ static inline void virForceCloseHelper(int *fd) * when the fd goes out of scope. It's used to eliminate VIR_FORCE_CLOSE * in cleanup sections. */ -# define VIR_AUTOCLOSE __attribute__((cleanup(virForceCloseHelper))) int +#define VIR_AUTOCLOSE __attribute__((cleanup(virForceCloseHelper))) int =20 =20 /* Opaque type for managing a wrapper around a fd. */ @@ -268,7 +267,7 @@ int virDirRead(DIR *dirp, struct dirent **ent, const ch= ar *dirname) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; void virDirClose(DIR **dirp) ATTRIBUTE_NONNULL(1); -# define VIR_DIR_CLOSE(dir) virDirClose(&(dir)) +#define VIR_DIR_CLOSE(dir) virDirClose(&(dir)) =20 int virFileMakePath(const char *path) ATTRIBUTE_RETURN_CHECK; int virFileMakePathWithMode(const char *path, @@ -280,26 +279,26 @@ char *virFileBuildPath(const char *dir, const char *ext) ATTRIBUTE_RETURN_CHECK; =20 =20 -# ifdef WIN32 +#ifdef WIN32 /* On Win32, the canonical directory separator is the backslash, and * the search path separator is the semicolon. Note that also the * (forward) slash works as directory separator. */ -# define VIR_FILE_DIR_SEPARATOR '\\' -# define VIR_FILE_DIR_SEPARATOR_S "\\" -# define VIR_FILE_IS_DIR_SEPARATOR(c) ((c) =3D=3D VIR_FILE_DIR_SEPARATOR = || (c) =3D=3D '/') -# define VIR_FILE_PATH_SEPARATOR ';' -# define VIR_FILE_PATH_SEPARATOR_S ";" +# define VIR_FILE_DIR_SEPARATOR '\\' +# define VIR_FILE_DIR_SEPARATOR_S "\\" +# define VIR_FILE_IS_DIR_SEPARATOR(c) ((c) =3D=3D VIR_FILE_DIR_SEPARATOR |= | (c) =3D=3D '/') +# define VIR_FILE_PATH_SEPARATOR ';' +# define VIR_FILE_PATH_SEPARATOR_S ";" =20 -# else /* !WIN32 */ +#else /* !WIN32 */ =20 -# define VIR_FILE_DIR_SEPARATOR '/' -# define VIR_FILE_DIR_SEPARATOR_S "/" -# define VIR_FILE_IS_DIR_SEPARATOR(c) ((c) =3D=3D VIR_FILE_DIR_SEPARATOR) -# define VIR_FILE_PATH_SEPARATOR ':' -# define VIR_FILE_PATH_SEPARATOR_S ":" +# define VIR_FILE_DIR_SEPARATOR '/' +# define VIR_FILE_DIR_SEPARATOR_S "/" +# define VIR_FILE_IS_DIR_SEPARATOR(c) ((c) =3D=3D VIR_FILE_DIR_SEPARATOR) +# define VIR_FILE_PATH_SEPARATOR ':' +# define VIR_FILE_PATH_SEPARATOR_S ":" =20 -# endif /* !WIN32 */ +#endif /* !WIN32 */ =20 bool virFileIsAbsPath(const char *path); int virFileAbsPath(const char *path, @@ -314,7 +313,7 @@ int virFileOpenTty(int *ttymaster, char *virFileFindMountPoint(const char *type); =20 /* NB: this should be combined with virFileBuildPath */ -# define virBuildPath(path, ...) \ +#define virBuildPath(path, ...) \ virBuildPathInternal(path, __VA_ARGS__, NULL) int virBuildPathInternal(char **path, ...) ATTRIBUTE_SENTINEL; =20 @@ -392,5 +391,3 @@ int virFileSetXAttr(const char *path, int virFileRemoveXAttr(const char *path, const char *name) ATTRIBUTE_NOINLINE; - -#endif /* LIBVIRT_VIRFILE_H */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list