[libvirt] [PATCH 12/46] src/storage: use #pragma once in headers

Jonathon Jongsma jjongsma at redhat.com
Tue Jun 18 16:12:42 UTC 2019


Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 src/storage/storage_backend.h               | 13 ++++-----
 src/storage/storage_backend_disk.h          |  5 +---
 src/storage/storage_backend_fs.h            |  5 +---
 src/storage/storage_backend_gluster.h       |  5 +---
 src/storage/storage_backend_iscsi.h         |  5 +---
 src/storage/storage_backend_iscsi_direct.h  |  5 +---
 src/storage/storage_backend_logical.h       |  5 +---
 src/storage/storage_backend_mpath.h         |  5 +---
 src/storage/storage_backend_rbd.h           |  5 +---
 src/storage/storage_backend_scsi.h          |  5 +---
 src/storage/storage_backend_sheepdog.h      |  5 +---
 src/storage/storage_backend_sheepdog_priv.h |  7 ++---
 src/storage/storage_backend_vstorage.h      |  5 +---
 src/storage/storage_backend_zfs.h           |  5 +---
 src/storage/storage_driver.h                | 11 +++-----
 src/storage/storage_file_fs.h               |  5 +---
 src/storage/storage_file_gluster.h          |  5 +---
 src/storage/storage_util.h                  | 31 ++++++++++-----------
 18 files changed, 39 insertions(+), 93 deletions(-)

diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index c670c66287..86763a9e30 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -16,14 +16,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_H
-# define LIBVIRT_STORAGE_BACKEND_H
+#pragma once
 
-# include <sys/stat.h>
+#include <sys/stat.h>
 
-# include "internal.h"
-# include "virstorageobj.h"
-# include "storage_driver.h"
+#include "internal.h"
+#include "virstorageobj.h"
+#include "storage_driver.h"
 
 typedef char * (*virStorageBackendFindPoolSources)(const char *srcSpec,
                                                    unsigned int flags);
@@ -128,5 +127,3 @@ int virStorageBackendRegister(virStorageBackendPtr backend);
 
 virCapsPtr
 virStorageBackendGetCapabilities(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_H */
diff --git a/src/storage/storage_backend_disk.h b/src/storage/storage_backend_disk.h
index 71c3bcaa2b..caa6dfba43 100644
--- a/src/storage/storage_backend_disk.h
+++ b/src/storage/storage_backend_disk.h
@@ -19,9 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_DISK_H
-# define LIBVIRT_STORAGE_BACKEND_DISK_H
+#pragma once
 
 int virStorageBackendDiskRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_DISK_H */
diff --git a/src/storage/storage_backend_fs.h b/src/storage/storage_backend_fs.h
index 638c16a01e..41cfa1edb0 100644
--- a/src/storage/storage_backend_fs.h
+++ b/src/storage/storage_backend_fs.h
@@ -19,9 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_FS_H
-# define LIBVIRT_STORAGE_BACKEND_FS_H
+#pragma once
 
 int virStorageBackendFsRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_FS_H */
diff --git a/src/storage/storage_backend_gluster.h b/src/storage/storage_backend_gluster.h
index 586d6e94dd..348f118fb3 100644
--- a/src/storage/storage_backend_gluster.h
+++ b/src/storage/storage_backend_gluster.h
@@ -19,9 +19,6 @@
  *
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_GLUSTER_H
-# define LIBVIRT_STORAGE_BACKEND_GLUSTER_H
+#pragma once
 
 int virStorageBackendGlusterRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_GLUSTER_H */
diff --git a/src/storage/storage_backend_iscsi.h b/src/storage/storage_backend_iscsi.h
index 4b04d1b81d..4a5b23864e 100644
--- a/src/storage/storage_backend_iscsi.h
+++ b/src/storage/storage_backend_iscsi.h
@@ -19,9 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_ISCSI_H
-# define LIBVIRT_STORAGE_BACKEND_ISCSI_H
+#pragma once
 
 int virStorageBackendISCSIRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_ISCSI_H */
diff --git a/src/storage/storage_backend_iscsi_direct.h b/src/storage/storage_backend_iscsi_direct.h
index 07c8acad9d..b9c025aff7 100644
--- a/src/storage/storage_backend_iscsi_direct.h
+++ b/src/storage/storage_backend_iscsi_direct.h
@@ -14,9 +14,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_ISCSI_DIRECT_H
-# define LIBVIRT_STORAGE_BACKEND_ISCSI_DIRECT_H
+#pragma once
 
 int virStorageBackendISCSIDirectRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_ISCSI_DIRECT_H */
diff --git a/src/storage/storage_backend_logical.h b/src/storage/storage_backend_logical.h
index 79374c6ca3..60c8a44f23 100644
--- a/src/storage/storage_backend_logical.h
+++ b/src/storage/storage_backend_logical.h
@@ -19,9 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_LOGICAL_H
-# define LIBVIRT_STORAGE_BACKEND_LOGICAL_H
+#pragma once
 
 int virStorageBackendLogicalRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_LOGICAL_H */
diff --git a/src/storage/storage_backend_mpath.h b/src/storage/storage_backend_mpath.h
index 39afa99964..a797db6dcd 100644
--- a/src/storage/storage_backend_mpath.h
+++ b/src/storage/storage_backend_mpath.h
@@ -19,9 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_MPATH_H
-# define LIBVIRT_STORAGE_BACKEND_MPATH_H
+#pragma once
 
 int virStorageBackendMpathRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_MPATH_H */
diff --git a/src/storage/storage_backend_rbd.h b/src/storage/storage_backend_rbd.h
index 1b53d3c65c..e1cfaa0e95 100644
--- a/src/storage/storage_backend_rbd.h
+++ b/src/storage/storage_backend_rbd.h
@@ -18,9 +18,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_RBD_H
-# define LIBVIRT_STORAGE_BACKEND_RBD_H
+#pragma once
 
 int virStorageBackendRBDRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_RBD_H */
diff --git a/src/storage/storage_backend_scsi.h b/src/storage/storage_backend_scsi.h
index 7daa2221db..6c05c15ffc 100644
--- a/src/storage/storage_backend_scsi.h
+++ b/src/storage/storage_backend_scsi.h
@@ -19,9 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_SCSI_H
-# define LIBVIRT_STORAGE_BACKEND_SCSI_H
+#pragma once
 
 int virStorageBackendSCSIRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_SCSI_H */
diff --git a/src/storage/storage_backend_sheepdog.h b/src/storage/storage_backend_sheepdog.h
index e09ad14d1e..e1fde6373b 100644
--- a/src/storage/storage_backend_sheepdog.h
+++ b/src/storage/storage_backend_sheepdog.h
@@ -20,9 +20,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_SHEEPDOG_H
-# define LIBVIRT_STORAGE_BACKEND_SHEEPDOG_H
+#pragma once
 
 int virStorageBackendSheepdogRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_SHEEPDOG_H */
diff --git a/src/storage/storage_backend_sheepdog_priv.h b/src/storage/storage_backend_sheepdog_priv.h
index 9f28835934..07a35d1d70 100644
--- a/src/storage/storage_backend_sheepdog_priv.h
+++ b/src/storage/storage_backend_sheepdog_priv.h
@@ -20,14 +20,11 @@
 # error "storage_backend_sheepdog_priv.h may only be included by storage_backend_sheepdog.c or test suites"
 #endif /* LIBVIRT_STORAGE_BACKEND_SHEEPDOG_PRIV_H_ALLOW */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_SHEEPDOG_PRIV_H
-# define LIBVIRT_STORAGE_BACKEND_SHEEPDOG_PRIV_H
+#pragma once
 
-# include "conf/storage_conf.h"
+#include "conf/storage_conf.h"
 
 int virStorageBackendSheepdogParseNodeInfo(virStoragePoolDefPtr pool,
                                            char *output);
 int virStorageBackendSheepdogParseVdiList(virStorageVolDefPtr vol,
                                           char *output);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_SHEEPDOG_PRIV_H */
diff --git a/src/storage/storage_backend_vstorage.h b/src/storage/storage_backend_vstorage.h
index e6f5f821fa..387867f48b 100644
--- a/src/storage/storage_backend_vstorage.h
+++ b/src/storage/storage_backend_vstorage.h
@@ -18,9 +18,6 @@
  *
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_VSTORAGE_H
-# define LIBVIRT_STORAGE_BACKEND_VSTORAGE_H
+#pragma once
 
 int virStorageBackendVstorageRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_VSTORAGE_H */
diff --git a/src/storage/storage_backend_zfs.h b/src/storage/storage_backend_zfs.h
index 98388c5fca..28cd680922 100644
--- a/src/storage/storage_backend_zfs.h
+++ b/src/storage/storage_backend_zfs.h
@@ -19,9 +19,6 @@
  *
  */
 
-#ifndef LIBVIRT_STORAGE_BACKEND_ZFS_H
-# define LIBVIRT_STORAGE_BACKEND_ZFS_H
+#pragma once
 
 int virStorageBackendZFSRegister(void);
-
-#endif /* LIBVIRT_STORAGE_BACKEND_ZFS_H */
diff --git a/src/storage/storage_driver.h b/src/storage/storage_driver.h
index 75632adee5..64b3d8bbf8 100644
--- a/src/storage/storage_driver.h
+++ b/src/storage/storage_driver.h
@@ -19,13 +19,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_DRIVER_H
-# define LIBVIRT_STORAGE_DRIVER_H
+#pragma once
 
-# include <sys/stat.h>
+#include <sys/stat.h>
 
-# include "domain_conf.h"
-# include "virstorageobj.h"
+#include "domain_conf.h"
+#include "virstorageobj.h"
 
 virStoragePoolObjPtr virStoragePoolObjFindPoolByUUID(const unsigned char *uuid)
     ATTRIBUTE_NONNULL(1);
@@ -41,5 +40,3 @@ char *virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr obj,
 
 int storageRegister(void);
 int storageRegisterAll(void);
-
-#endif /* LIBVIRT_STORAGE_DRIVER_H */
diff --git a/src/storage/storage_file_fs.h b/src/storage/storage_file_fs.h
index c51c875bc2..86a625232d 100644
--- a/src/storage/storage_file_fs.h
+++ b/src/storage/storage_file_fs.h
@@ -18,9 +18,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_FILE_FS_H
-# define LIBVIRT_STORAGE_FILE_FS_H
+#pragma once
 
 int virStorageFileFsRegister(void);
-
-#endif /* LIBVIRT_STORAGE_FILE_FS_H */
diff --git a/src/storage/storage_file_gluster.h b/src/storage/storage_file_gluster.h
index 3e46cd1c1e..1feaf3a8b9 100644
--- a/src/storage/storage_file_gluster.h
+++ b/src/storage/storage_file_gluster.h
@@ -19,9 +19,6 @@
  *
  */
 
-#ifndef LIBVIRT_STORAGE_FILE_GLUSTER_H
-# define LIBVIRT_STORAGE_FILE_GLUSTER_H
+#pragma once
 
 int virStorageFileGlusterRegister(void);
-
-#endif /* LIBVIRT_STORAGE_FILE_GLUSTER_H */
diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
index 8b44b54a3b..6df5928d9b 100644
--- a/src/storage/storage_util.h
+++ b/src/storage/storage_util.h
@@ -16,15 +16,14 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_STORAGE_UTIL_H
-# define LIBVIRT_STORAGE_UTIL_H
+#pragma once
 
-# include <sys/stat.h>
+#include <sys/stat.h>
 
-# include "internal.h"
-# include "vircommand.h"
-# include "storage_driver.h"
-# include "storage_backend.h"
+#include "internal.h"
+#include "vircommand.h"
+#include "storage_driver.h"
+#include "storage_backend.h"
 
 /* Storage Pool Namespace options to share w/ storage_backend_fs.c and
  * the virStorageBackendFileSystemMountCmd method */
@@ -138,21 +137,21 @@ enum {
     VIR_STORAGE_VOL_READ_NOERROR    = 1 << 0, /* ignore *read errors */
 };
 
-# define VIR_STORAGE_VOL_OPEN_DEFAULT (VIR_STORAGE_VOL_OPEN_REG      |\
-                                       VIR_STORAGE_VOL_OPEN_BLOCK)
+#define VIR_STORAGE_VOL_OPEN_DEFAULT (VIR_STORAGE_VOL_OPEN_REG      |\
+                                      VIR_STORAGE_VOL_OPEN_BLOCK)
 
-# define VIR_STORAGE_VOL_FS_OPEN_FLAGS    (VIR_STORAGE_VOL_OPEN_DEFAULT | \
-                                           VIR_STORAGE_VOL_OPEN_DIR)
-# define VIR_STORAGE_VOL_FS_PROBE_FLAGS   (VIR_STORAGE_VOL_FS_OPEN_FLAGS | \
-                                           VIR_STORAGE_VOL_OPEN_NOERROR)
+#define VIR_STORAGE_VOL_FS_OPEN_FLAGS    (VIR_STORAGE_VOL_OPEN_DEFAULT | \
+                                          VIR_STORAGE_VOL_OPEN_DIR)
+#define VIR_STORAGE_VOL_FS_PROBE_FLAGS   (VIR_STORAGE_VOL_FS_OPEN_FLAGS | \
+                                          VIR_STORAGE_VOL_OPEN_NOERROR)
 
 int virStorageBackendVolOpen(const char *path, struct stat *sb,
                              unsigned int flags)
     ATTRIBUTE_RETURN_CHECK
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
-# define VIR_STORAGE_DEFAULT_POOL_PERM_MODE 0711
-# define VIR_STORAGE_DEFAULT_VOL_PERM_MODE  0600
+#define VIR_STORAGE_DEFAULT_POOL_PERM_MODE 0711
+#define VIR_STORAGE_DEFAULT_VOL_PERM_MODE  0600
 
 int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
                                    bool withBlockVolFormat,
@@ -203,5 +202,3 @@ virCommandPtr
 virStorageBackendLogicalChangeCmd(const char *cmdstr,
                                   virStoragePoolDefPtr def,
                                   bool on);
-
-#endif /* LIBVIRT_STORAGE_UTIL_H */
-- 
2.20.1




More information about the libvir-list mailing list