]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
build: rename files.h to virfile.h
authorEric Blake <eblake@redhat.com>
Tue, 19 Jul 2011 18:32:58 +0000 (12:32 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 21 Jul 2011 16:34:51 +0000 (10:34 -0600)
In preparation for a future patch adding new virFile APIs.

* src/util/files.h, src/util/files.c: Move...
* src/util/virfile.h, src/util/virfile.c: ...here, and rename
functions to virFile prefix.  Macro names are intentionally
left alone.
* *.c: All '#include "files.h"' uses changed.
* src/Makefile.am (UTIL_SOURCES): Reflect rename.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
* src/libvirt_private.syms: Likewise.
* docs/hacking.html.in: Likewise.
* HACKING: Regenerate.

88 files changed:
HACKING
cfg.mk
daemon/libvirtd.c
docs/hacking.html.in
src/Makefile.am
src/conf/domain_conf.c
src/conf/network_conf.c
src/conf/nwfilter_conf.c
src/conf/storage_conf.c
src/conf/storage_encryption_conf.c
src/fdstream.c
src/libvirt_private.syms
src/libxl/libxl_conf.c
src/libxl/libxl_driver.c
src/locking/lock_driver_sanlock.c
src/lxc/lxc_container.c
src/lxc/lxc_controller.c
src/lxc/lxc_driver.c
src/node_device/node_device_linux_sysfs.c
src/nodeinfo.c
src/nwfilter/nwfilter_ebiptables_driver.c
src/openvz/openvz_conf.c
src/openvz/openvz_driver.c
src/phyp/phyp_driver.c
src/qemu/qemu_capabilities.c
src/qemu/qemu_command.c
src/qemu/qemu_conf.c
src/qemu/qemu_domain.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_migration.c
src/qemu/qemu_monitor.c
src/qemu/qemu_process.c
src/remote/remote_driver.c
src/rpc/virnetclient.c
src/rpc/virnetserver.c
src/rpc/virnetsocket.c
src/secret/secret_driver.c
src/security/security_apparmor.c
src/security/security_selinux.c
src/security/virt-aa-helper.c
src/storage/storage_backend.c
src/storage/storage_backend_fs.c
src/storage/storage_backend_iscsi.c
src/storage/storage_backend_logical.c
src/storage/storage_backend_mpath.c
src/storage/storage_backend_scsi.c
src/storage/storage_driver.c
src/test/test_driver.c
src/uml/uml_conf.c
src/uml/uml_driver.c
src/util/bridge.c
src/util/cgroup.c
src/util/command.c
src/util/conf.c
src/util/dnsmasq.c
src/util/event_poll.c
src/util/files.c [deleted file]
src/util/files.h [deleted file]
src/util/hooks.c
src/util/interface.c
src/util/iohelper.c
src/util/logging.c
src/util/macvtap.c
src/util/pci.c
src/util/stats_linux.c
src/util/storage_file.c
src/util/util.c
src/util/uuid.c
src/util/viraudit.c
src/util/virfile.c [new file with mode: 0644]
src/util/virfile.h [new file with mode: 0644]
src/vbox/vbox_tmpl.c
src/vmware/vmware_conf.c
src/vmware/vmware_driver.c
src/xen/block_stats.c
src/xen/xen_driver.c
src/xen/xen_hypervisor.c
src/xen/xen_inotify.c
src/xen/xend_internal.c
tests/commandhelper.c
tests/commandtest.c
tests/nodeinfotest.c
tests/testutils.c
tests/virnetsockettest.c
tests/xencapstest.c
tools/console.c
tools/virsh.c

diff --git a/HACKING b/HACKING
index 8ebbec774ec952a96c5e93a80b8e99550b1ad652..2df560a294e7fb61078b1a81534e766b516031a6 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -417,7 +417,7 @@ File handling
 Usage of the "fdopen()", "close()", "fclose()" APIs is deprecated in libvirt
 code base to help avoiding double-closing of files or file descriptors, which
 is particulary dangerous in a multi-threaded applications. Instead of these
-APIs, use the macros from files.h
+APIs, use the macros from virfile.h
 
 - Open a file from a file descriptor:
 
diff --git a/cfg.mk b/cfg.mk
index d24386264f1f2d6048d0c56bbad1b5b8da4fab88..0a624f1592b0bcc0f74ad07c42eea14e69e60ffc 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -689,7 +689,7 @@ exclude_file_name_regexp--sc_prohibit_asprintf = \
   ^(bootstrap.conf$$|src/util/util\.c$$|examples/domain-events/events-c/event-test\.c$$)
 
 exclude_file_name_regexp--sc_prohibit_close = \
-  (\.p[yl]$$|^docs/|^(src/util/files\.c|src/libvirt\.c)$$)
+  (\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c)$$)
 
 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
   (^tests/qemuhelpdata/|\.(gif|ico|png)$$)
index 259fcc4ed361e833b2eced10c749d279432437cf..38876d84d9a2716cbb739b445dfddb1c4cbe1065 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "libvirt_internal.h"
 #include "virterror_internal.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
index 68886878e5eb55568dcc93ec48333e95c7c04ba7..1a32d07438ba082a229c73ce6db8270b02ecf361 100644 (file)
       Usage of the <code>fdopen()</code>, <code>close()</code>, <code>fclose()</code>
       APIs is deprecated in libvirt code base to help avoiding double-closing of files
       or file descriptors, which is particulary dangerous in a multi-threaded
-      applications. Instead of these APIs, use the macros from files.h
+      applications. Instead of these APIs, use the macros from virfile.h
     </p>
 
    <ul>
index 00e78ac7e0fcc6dcee666486ab342c7df4ed7d4c..481caba356298fe4e2c4deae1eb7ed7903d4ec8c 100644 (file)
@@ -52,7 +52,6 @@ UTIL_SOURCES =                                                        \
                util/cgroup.c util/cgroup.h                     \
                util/event.c util/event.h                       \
                util/event_poll.c util/event_poll.h             \
-               util/files.c util/files.h                       \
                util/hash.c util/hash.h                         \
                util/hooks.c util/hooks.h                       \
                util/iptables.c util/iptables.h                 \
@@ -80,6 +79,7 @@ UTIL_SOURCES =                                                        \
                util/uuid.c util/uuid.h                         \
                util/util.c util/util.h                         \
                util/viraudit.c util/viraudit.h                 \
+               util/virfile.c util/virfile.h                   \
                util/xml.c util/xml.h                           \
                util/virterror.c util/virterror_internal.h      \
                util/virkeycode.c util/virkeycode.h             \
index dc579ef846fdd9d3c1c35cb24941e6209665bb93..e6944e526397d571b652f78844ac95264c0836d8 100644 (file)
@@ -46,7 +46,7 @@
 #include "nwfilter_conf.h"
 #include "ignore-value.h"
 #include "storage_file.h"
-#include "files.h"
+#include "virfile.h"
 #include "bitmap.h"
 #include "count-one-bits.h"
 
index ae479bfaf5b8dd5e5acd8c82f14864950cb07920..9f7ce048cec6d2f9264884de5b904796d2d00948 100644 (file)
@@ -41,7 +41,7 @@
 #include "util.h"
 #include "buf.h"
 #include "c-ctype.h"
-#include "files.h"
+#include "virfile.h"
 
 #define MAX_BRIDGE_ID 256
 #define VIR_FROM_THIS VIR_FROM_NETWORK
index 036c61af35e3d203a9add0cf8006b705ed0475e4..04bfa22ae1125b66a7e6bd24944ba7b07d702d38 100644 (file)
@@ -46,7 +46,7 @@
 #include "nwfilter_conf.h"
 #include "domain_conf.h"
 #include "c-ctype.h"
-#include "files.h"
+#include "virfile.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
index cc55b80d45f4423eeec7b8bea5d16e785f3828f2..995f9a6a314209b2b069385f74ac5a309cb56575 100644 (file)
@@ -43,7 +43,7 @@
 #include "buf.h"
 #include "util.h"
 #include "memory.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index 545efadf3d9158883574c9bb51e99e72ca80ea2b..73e16ed2881a74ce7d2375e12f2676991da7e013 100644 (file)
@@ -35,7 +35,7 @@
 #include "xml.h"
 #include "virterror_internal.h"
 #include "uuid.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index dd742e1980d33ff21f731baa8f36657f601169f1..d25b3f0dd551a7694d05e9102e5a725b39f95bfc 100644 (file)
@@ -38,7 +38,7 @@
 #include "logging.h"
 #include "memory.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "configmake.h"
 
 #define VIR_FROM_THIS VIR_FROM_STREAMS
index 98b125b4b7f608076afe5dd2492f265f548b0318..938bb87e53f464f4f8c7bd292e998d3719394667 100644 (file)
@@ -493,12 +493,6 @@ virFDStreamOpenFile;
 virFDStreamCreateFile;
 
 
-# files.h
-virClose;
-virFclose;
-virFdopen;
-
-
 # hash.h
 virHashAddEntry;
 virHashCreate;
@@ -1091,6 +1085,12 @@ virAuditOpen;
 virAuditSend;
 
 
+# virfile.h
+virFileClose;
+virFileFclose;
+virFileFdopen;
+
+
 # virterror_internal.h
 virDispatchError;
 virErrorMsg;
index 0f6035eda416b8044a33aecd89d636dfa58bb6ea..b74a4b1d55f8e3a44c781d1f782d8d3576231ca8 100644 (file)
@@ -34,7 +34,7 @@
 #include "logging.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
-#include "files.h"
+#include "virfile.h"
 #include "memory.h"
 #include "uuid.h"
 #include "capabilities.h"
index d52a8b69588195c411bd6ee4c32cf21c994a34d8..381d90b59243dd6273ecf884331e6272aa1c854b 100644 (file)
@@ -36,7 +36,7 @@
 #include "virterror_internal.h"
 #include "conf.h"
 #include "datatypes.h"
-#include "files.h"
+#include "virfile.h"
 #include "memory.h"
 #include "uuid.h"
 #include "command.h"
index 62eb28b0312bf3b09c54acb6d27536b954de8187..b85f1fa434513abf520c2c2da78f6f0f01ea7795 100644 (file)
@@ -41,7 +41,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "md5.h"
 #include "conf.h"
 
index 8e1860bccbb62f0d8b0cd1c7ac16fff2f51614e3..432b7f8502333a5bf63961d4baffd47954b35f28 100644 (file)
@@ -53,7 +53,7 @@
 #include "memory.h"
 #include "veth.h"
 #include "uuid.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
index 346edef18c54943c0992cf88b0d0a93519e5e26f..7eda7ef2761dc604243fadee45c3cfd53e0bf077 100644 (file)
@@ -53,7 +53,7 @@
 #include "veth.h"
 #include "memory.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
index afac8798db84632634a8390e2acd13932af1e279..80378d37e220bb84701957833727fc812fd9d7f5 100644 (file)
@@ -49,7 +49,7 @@
 #include "uuid.h"
 #include "stats_linux.h"
 #include "hooks.h"
-#include "files.h"
+#include "virfile.h"
 #include "fdstream.h"
 #include "domain_audit.h"
 #include "domain_nwfilter.h"
index 34e45013a1a8fa61e9b6eacd9fd9116acc2da580..f9ff20f64a1788fd439c9ae2c58e0c8bdc725fca 100644 (file)
@@ -31,7 +31,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include <dirent.h>
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
index a53c56d03675a8b3431aa1b1c0f2ae6ca691860d..cae2564fe2c707edae00654db7436fdfd3a0c62b 100644 (file)
@@ -45,7 +45,7 @@
 #include "virterror_internal.h"
 #include "count-one-bits.h"
 #include "intprops.h"
-#include "files.h"
+#include "virfile.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_NONE
index c9b60da5ba80164416c77122d5f19ba3f3712e57..f87cfa15775f859cfab401ed4568a41a43f6b6c1 100644 (file)
@@ -38,7 +38,7 @@
 #include "nwfilter_conf.h"
 #include "nwfilter_gentech_driver.h"
 #include "nwfilter_ebiptables_driver.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 
index 561cc990d0df1360766a741a2598552f8584b78e..c60a97fcb9168afa63402434c07411cb47baa6a9 100644 (file)
@@ -50,7 +50,7 @@
 #include "memory.h"
 #include "util.h"
 #include "nodeinfo.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 #include "ignore-value.h"
 
index d24a5e3ecd948405bf1f91e1720c62c9922cec77..f0c6f577e4ee5cfaa9d1dfed5bbc01e6c00dc007 100644 (file)
@@ -55,7 +55,7 @@
 #include "nodeinfo.h"
 #include "memory.h"
 #include "bridge.h"
-#include "files.h"
+#include "virfile.h"
 #include "logging.h"
 #include "command.h"
 
index 2489063a3c1a27480014b46af4bb8d8eac8f8781..e693e769774c8575ecb89b819c7eaf2d8739efe1 100644 (file)
@@ -57,7 +57,7 @@
 #include "domain_conf.h"
 #include "storage_conf.h"
 #include "nodeinfo.h"
-#include "files.h"
+#include "virfile.h"
 #include "interface_conf.h"
 
 #include "phyp_driver.h"
index 1421a5e0031814591c2c2b3f8682043172fa79a7..3f36212597b6739a34ffda6f17be48db15a20d62 100644 (file)
@@ -28,7 +28,7 @@
 #include "logging.h"
 #include "virterror_internal.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "nodeinfo.h"
 #include "cpu/cpu.h"
 #include "domain_conf.h"
index ee706f9a869ac49ef933982b16e221eed4f15a04..938f113998f392852bbe1bf81d7312e0ddfaa5b6 100644 (file)
@@ -31,7 +31,7 @@
 #include "logging.h"
 #include "virterror_internal.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "uuid.h"
 #include "c-ctype.h"
 #include "domain_nwfilter.h"
index 3d8aba447718cf7f9519b5acc67e69671921b938..4a17a55563802cbdaa4da2d3955f361ea702ec03 100644 (file)
@@ -55,7 +55,7 @@
 #include "macvtap.h"
 #include "cpu/cpu.h"
 #include "domain_nwfilter.h"
-#include "files.h"
+#include "virfile.h"
 #include "configmake.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
index f9755a4c37077996889c4f51896635abd7fcda67..1a17f9955b5be120db5377bd0a50e4212db95623 100644 (file)
@@ -33,7 +33,7 @@
 #include "cpu/cpu.h"
 #include "ignore-value.h"
 #include "uuid.h"
-#include "files.h"
+#include "virfile.h"
 
 #include <sys/time.h>
 #include <fcntl.h>
index f4b454224e1e1b8897e21fe0342936d59a9d5934..0f02e293de09429253b3c8e74ae473bfa1016ce7 100644 (file)
@@ -82,7 +82,7 @@
 #include "domain_nwfilter.h"
 #include "hooks.h"
 #include "storage_file.h"
-#include "files.h"
+#include "virfile.h"
 #include "fdstream.h"
 #include "configmake.h"
 #include "threadpool.h"
index 0eae6613fc413dafd1e7236584788c8e84d9aa58..20f0dafa027d9c7a782a1a85e2450ef821a2b660 100644 (file)
@@ -36,7 +36,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "pci.h"
-#include "files.h"
+#include "virfile.h"
 #include "qemu_cgroup.h"
 #include "locking/domain_lock.h"
 
index 1803b9f5a934d121d9902b6f3cd0f1b3515b3e83..9c1bde5345c3876bb583ecad883d2593d4473a86 100644 (file)
@@ -37,7 +37,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "datatypes.h"
 #include "fdstream.h"
 #include "uuid.h"
index 016f8f0324519c3e817f315cc8ff92cfc0bf13e5..064c90f374acd72edce318916014e64ef91094bb 100644 (file)
@@ -35,7 +35,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
index a1fbe062a507489985966c7bfd76e2e461f4ac28..4c6081bb764e17bb74e8459262595b6c19a849ff 100644 (file)
@@ -48,7 +48,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "hooks.h"
-#include "files.h"
+#include "virfile.h"
 #include "util.h"
 #include "c-ctype.h"
 #include "nodeinfo.h"
index 82b938c9888a1db12dc7eb07c2e9c581886f7289..5418004dc4c8187c1492304432d0340789502994 100644 (file)
@@ -43,7 +43,7 @@
 #include "qemu_protocol.h"
 #include "memory.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 #include "intprops.h"
 
index 0ce907707ca47224091050d896edac4d072fd53a..7e88abaaa944a692df8dc37d805fb71ca3cbacbf 100644 (file)
@@ -31,7 +31,7 @@
 #include "virnetsocket.h"
 #include "memory.h"
 #include "threads.h"
-#include "files.h"
+#include "virfile.h"
 #include "logging.h"
 #include "util.h"
 #include "virterror_internal.h"
index 35f18b9d51179a6f106b288a88fc1e65fdaf04f9..731932c2aee913b266b0c09a7cf3d1e5814b4ea8 100644 (file)
@@ -34,7 +34,7 @@
 #include "threads.h"
 #include "threadpool.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "event.h"
 #if HAVE_AVAHI
 # include "virnetservermdns.h"
index 6605aa3e15bd99078309d3cdd0434511db3f8ee8..71df9512997037c5d74ecc14fa614eaebc576a0f 100644 (file)
@@ -38,7 +38,7 @@
 #include "memory.h"
 #include "virterror_internal.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "event.h"
 #include "threads.h"
 
index 02cdbb912286467399a8a250986f7a96145b7f5b..59dc687d2ed0f8c82f87d3b561088b4e99570423 100644 (file)
@@ -40,7 +40,7 @@
 #include "util.h"
 #include "uuid.h"
 #include "virterror_internal.h"
-#include "files.h"
+#include "virfile.h"
 #include "configmake.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECRET
index 6dfe8c93945d87d643dd5f6f3f7a1b16b08c507c..1d49ff6a2d670586b966038482ff03fb8e842d7a 100644 (file)
@@ -35,7 +35,7 @@
 #include "uuid.h"
 #include "pci.h"
 #include "hostusb.h"
-#include "files.h"
+#include "virfile.h"
 #include "configmake.h"
 #include "command.h"
 
index 50e19786b31b622a7aa93fa5fea730e197453540..5e6145ff9529aebaff6dc556409acf175ddd0214 100644 (file)
@@ -31,7 +31,7 @@
 #include "pci.h"
 #include "hostusb.h"
 #include "storage_file.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 
index 856d32f5912b811881be09c1a0c118f988a2401f..1e2feae8b1b3d9f5ff47f1161f7833c5b5fecd47 100644 (file)
@@ -40,7 +40,7 @@
 #include "uuid.h"
 #include "hostusb.h"
 #include "pci.h"
-#include "files.h"
+#include "virfile.h"
 #include "configmake.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
index f632edd55ac79cedef9166e9f81ced579c39c4a1..6243d1e9b2bc352287279a28d5111e5494dc8f4c 100644 (file)
@@ -56,7 +56,7 @@
 #include "storage_file.h"
 #include "storage_backend.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 #if WITH_STORAGE_LVM
index 16562156c8026cca1630148883b32eab8dc1ecc3..058e00ce2ff9a0615b25c3f7e6976140c732d53b 100644 (file)
@@ -44,7 +44,7 @@
 #include "command.h"
 #include "memory.h"
 #include "xml.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index 7b8dc9746cffaf52792ec2a5b339dbb758244065..346e698050012e844e6e2c86479b3409b6f1cbd6 100644 (file)
@@ -41,7 +41,7 @@
 #include "util.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
index 5fe9a1f3155281f0d64940884159c2a4ac2337c2..c622d2a3b32123965de049cece9e0b1268f49ba2 100644 (file)
@@ -37,7 +37,7 @@
 #include "command.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index 2d48a9d47a6de970296668765047285a6265d58f..f2e1419992581693f1f9cf9348048d8889ecfdc5 100644 (file)
@@ -35,7 +35,7 @@
 #include "storage_backend.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index da3454701370438814706a13329514ddb2ad380c..ae1e19f8ef522fbade8cad6778510527aad380ff 100644 (file)
@@ -32,7 +32,7 @@
 #include "storage_backend_scsi.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
index 997b876686015424aeb96179d604f6130d955143..9c353e394e9b992e4c395a5ab92bfc01518be2c5 100644 (file)
@@ -45,7 +45,7 @@
 #include "memory.h"
 #include "storage_backend.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "fdstream.h"
 #include "configmake.h"
 
index a68cc0dff4405ed129e2099b7eef897f94e825c9..0e3bf5362bfc1f198ad2f17949bb678282c842d3 100644 (file)
@@ -49,7 +49,7 @@
 #include "xml.h"
 #include "threads.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_TEST
 
index 0122472c71e51735612087575e53d415f44584ae..c4b6e7526cb399a48160a2941294b2be2788d27c 100644 (file)
@@ -47,7 +47,7 @@
 #include "bridge.h"
 #include "logging.h"
 #include "domain_nwfilter.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 #define VIR_FROM_THIS VIR_FROM_UML
index 0d6f71a93b3c6fb39e1cd880869fc52abf18b025..e1eedd4f3857498e7fb74448f3d6b056d7ae59c5 100644 (file)
@@ -59,7 +59,7 @@
 #include "datatypes.h"
 #include "logging.h"
 #include "domain_nwfilter.h"
-#include "files.h"
+#include "virfile.h"
 #include "fdstream.h"
 #include "configmake.h"
 
index 0f4b6397f3f84ec28f5f54046777b2f42d50b848..d63b2a0521dc2ef07454368888f765517c245d02 100644 (file)
@@ -24,7 +24,7 @@
 #if defined(WITH_BRIDGE)
 
 # include "bridge.h"
-# include "files.h"
+# include "virfile.h"
 
 # include <stdlib.h>
 # include <stdio.h>
index 9fe561d49fb5247ad98929f2b8bbe365d1c8c989..f3ec80f99b46531279dfafaeb4abe254827294c7 100644 (file)
@@ -31,7 +31,7 @@
 #include "memory.h"
 #include "cgroup.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "hash.h"
 
 #define CGROUP_MAX_VAL 512
index f8ee8b12f2b7900c88ea0bca7c9e67426dd314d7..29ccaa4d7feafe7f8b91640614b8ea21466622c1 100644 (file)
@@ -38,7 +38,7 @@
 #include "virterror_internal.h"
 #include "util.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 #include "buf.h"
 #include "ignore-value.h"
 #include "verify.h"
index 377f9cd31e4bff8f2fca555ae9e01d43229b8a91..00045b54b4a1da3015593c905061e6b6d1e14aea 100644 (file)
@@ -24,7 +24,7 @@
 #include "util.h"
 #include "c-ctype.h"
 #include "memory.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_CONF
 
index 55db96b11f583551bed2049a2a4be02b38bbffed..d76cf65a21e5dde3efc28ae712618d4e1d7a818d 100644 (file)
@@ -44,7 +44,7 @@
 #include "memory.h"
 #include "virterror_internal.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_NETWORK
 #define DNSMASQ_HOSTSFILE_SUFFIX "hostsfile"
index e2ae3a64e6394c78af8e817d71ad30830d55e42d..e8679b8e59b6971ae9349b17b92e8d137d7dca4f 100644 (file)
@@ -36,7 +36,7 @@
 #include "event_poll.h"
 #include "memory.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "ignore-value.h"
 #include "virterror_internal.h"
 
diff --git a/src/util/files.c b/src/util/files.c
deleted file mode 100644 (file)
index bef56b6..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * files.c: safer file handling
- *
- * Copyright (C) 2010-2011 Red Hat, Inc.
- * Copyright (C) 2010 IBM Corporation
- * Copyright (C) 2010 Stefan Berger
- * Copyright (C) 2010 Eric Blake
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- *
- */
-
-#include <config.h>
-
-#include <unistd.h>
-
-#include "files.h"
-
-int virClose(int *fdptr, bool preserve_errno)
-{
-    int saved_errno;
-    int rc = 0;
-
-    if (*fdptr >= 0) {
-        if (preserve_errno)
-            saved_errno = errno;
-        rc = close(*fdptr);
-        *fdptr = -1;
-        if (preserve_errno)
-            errno = saved_errno;
-    }
-
-    return rc;
-}
-
-
-int virFclose(FILE **file, bool preserve_errno)
-{
-    int saved_errno;
-    int rc = 0;
-
-    if (*file) {
-        if (preserve_errno)
-            saved_errno = errno;
-        rc = fclose(*file);
-        *file = NULL;
-        if (preserve_errno)
-            errno = saved_errno;
-    }
-
-    return rc;
-}
-
-
-FILE *virFdopen(int *fdptr, const char *mode)
-{
-    FILE *file = NULL;
-
-    if (*fdptr >= 0) {
-        file = fdopen(*fdptr, mode);
-        if (file)
-            *fdptr = -1;
-    } else {
-        errno = EBADF;
-    }
-
-    return file;
-}
diff --git a/src/util/files.h b/src/util/files.h
deleted file mode 100644 (file)
index 8b681eb..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * files.h: safer file handling
- *
- * Copyright (C) 2010-2011 Red Hat, Inc.
- * Copyright (C) 2010 IBM Corporation
- * Copyright (C) 2010 Stefan Berger
- * Copyright (C) 2010 Eric Blake
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
- *
- */
-
-
-#ifndef __VIR_FILES_H_
-# define __VIR_FILES_H_
-
-# include <stdio.h>
-
-# include "internal.h"
-# include "ignore-value.h"
-
-
-/* Don't call these directly - use the macros below */
-int virClose(int *fdptr, bool preserve_errno) ATTRIBUTE_RETURN_CHECK;
-int virFclose(FILE **file, bool preserve_errno) ATTRIBUTE_RETURN_CHECK;
-FILE *virFdopen(int *fdptr, const char *mode) ATTRIBUTE_RETURN_CHECK;
-
-/* For use on normal paths; caller must check return value,
-   and failure sets errno per close. */
-# define VIR_CLOSE(FD) virClose(&(FD), false)
-# define VIR_FCLOSE(FILE) virFclose(&(FILE), false)
-
-/* Wrapper around fdopen that consumes fd on success. */
-# define VIR_FDOPEN(FD, MODE) virFdopen(&(FD), MODE)
-
-/* For use on cleanup paths; errno is unaffected by close,
-   and no return value to worry about. */
-# define VIR_FORCE_CLOSE(FD) ignore_value(virClose(&(FD), true))
-# define VIR_FORCE_FCLOSE(FILE) ignore_value(virFclose(&(FILE), true))
-
-#endif /* __VIR_FILES_H */
index 30e20acc070bec1ba2ba4122cd4e371fd4f4f966..64adfcbda39a45cf10b195fff24580bb37fd01fa 100644 (file)
@@ -35,7 +35,7 @@
 #include "util.h"
 #include "logging.h"
 #include "memory.h"
-#include "files.h"
+#include "virfile.h"
 #include "configmake.h"
 #include "command.h"
 
index 837ecce9523f54ad82199548e57e67c07ee6474e..7b1a2968884399e4f298a9196ebd3012f6affdd3 100644 (file)
@@ -41,7 +41,7 @@
 #include "util.h"
 #include "interface.h"
 #include "virterror_internal.h"
-#include "files.h"
+#include "virfile.h"
 #include "memory.h"
 #include "netlink.h"
 
index 0368eba7fcf72d2421b940c865630d6c836054c4..6a9f355c834ac234ac95937a0068028eb22d207c 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "util.h"
 #include "threads.h"
-#include "files.h"
+#include "virfile.h"
 #include "memory.h"
 #include "virterror_internal.h"
 #include "configmake.h"
index d340f573eba6441c1c3b09047fa24e8ff9aaf660..a63851043c5a4ce7ca4f319ddcdf404b138a1a47 100644 (file)
@@ -42,7 +42,7 @@
 #include "util.h"
 #include "buf.h"
 #include "threads.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
index 30343c8670ef44dd9868e2360919f4d3398131b3..8386f3b814a6248391e2fa38bc0e97b58dc3eec4 100644 (file)
@@ -64,7 +64,7 @@ VIR_ENUM_IMPL(virMacvtapMode, VIR_MACVTAP_MODE_LAST,
 # include "interface.h"
 # include "virterror_internal.h"
 # include "uuid.h"
-# include "files.h"
+# include "virfile.h"
 # include "netlink.h"
 
 # define VIR_FROM_THIS VIR_FROM_NET
index e3f978c54762b4a72bb31090b2b6087f08d6d47a..a79c1641706608da8194ac88c6d6b70c444ce04a 100644 (file)
@@ -37,7 +37,7 @@
 #include "memory.h"
 #include "command.h"
 #include "virterror_internal.h"
-#include "files.h"
+#include "virfile.h"
 
 /* avoid compilation breakage on some systems */
 #ifndef MODPROBE
index e728b7b1e9fc5fdc1042595bc44ca5eeb7c6fb94..72318e32b0c0c7acf64013723181e85327bf0bc5 100644 (file)
@@ -25,7 +25,7 @@
 # include "util.h"
 # include "stats_linux.h"
 # include "memory.h"
-# include "files.h"
+# include "virfile.h"
 
 # define VIR_FROM_THIS VIR_FROM_STATS_LINUX
 
index d4460d8c5acf0542d2db1b9d15ea598f8d2b91d5..68e82a9f2ccacc40aabe29fcda72eb009f271c23 100644 (file)
@@ -37,7 +37,7 @@
 #include "memory.h"
 #include "virterror_internal.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index 910bb04be4d428f4fa64acdf29a6c6ad1f7bec84..d83215ccc0fe0f28fa041886b567a033107e5b80 100644 (file)
@@ -73,7 +73,7 @@
 #include "memory.h"
 #include "threads.h"
 #include "verify.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 #include "nonblocking.h"
 #include "passfd.h"
index 805c20f3abd66cb8faafa239bed359518b16ca9f..b4317dfe0682e6a3aefc166df7ba88d18cb1326b 100644 (file)
@@ -39,7 +39,7 @@
 #include "virterror_internal.h"
 #include "logging.h"
 #include "memory.h"
-#include "files.h"
+#include "virfile.h"
 
 #ifndef ENODATA
 # define ENODATA EIO
index ebf31196a94350dd0971ac5d824f7a16703e9640..d0f9cc4d51d044ed7acdc47a12be445f9f29b1a7 100644 (file)
@@ -31,7 +31,7 @@
 #include "logging.h"
 #include "viraudit.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 #include "memory.h"
 
 /* Provide the macros in case the header file is old.
diff --git a/src/util/virfile.c b/src/util/virfile.c
new file mode 100644 (file)
index 0000000..6576921
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * virfile.c: safer file handling
+ *
+ * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010 IBM Corporation
+ * Copyright (C) 2010 Stefan Berger
+ * Copyright (C) 2010 Eric Blake
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "virfile.h"
+
+int virFileClose(int *fdptr, bool preserve_errno)
+{
+    int saved_errno;
+    int rc = 0;
+
+    if (*fdptr >= 0) {
+        if (preserve_errno)
+            saved_errno = errno;
+        rc = close(*fdptr);
+        *fdptr = -1;
+        if (preserve_errno)
+            errno = saved_errno;
+    }
+
+    return rc;
+}
+
+
+int virFileFclose(FILE **file, bool preserve_errno)
+{
+    int saved_errno;
+    int rc = 0;
+
+    if (*file) {
+        if (preserve_errno)
+            saved_errno = errno;
+        rc = fclose(*file);
+        *file = NULL;
+        if (preserve_errno)
+            errno = saved_errno;
+    }
+
+    return rc;
+}
+
+
+FILE *virFileFdopen(int *fdptr, const char *mode)
+{
+    FILE *file = NULL;
+
+    if (*fdptr >= 0) {
+        file = fdopen(*fdptr, mode);
+        if (file)
+            *fdptr = -1;
+    } else {
+        errno = EBADF;
+    }
+
+    return file;
+}
diff --git a/src/util/virfile.h b/src/util/virfile.h
new file mode 100644 (file)
index 0000000..d11f902
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * virfile.h: safer file handling
+ *
+ * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010 IBM Corporation
+ * Copyright (C) 2010 Stefan Berger
+ * Copyright (C) 2010 Eric Blake
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+
+#ifndef __VIR_FILES_H_
+# define __VIR_FILES_H_
+
+# include <stdio.h>
+
+# include "internal.h"
+# include "ignore-value.h"
+
+
+/* Don't call these directly - use the macros below */
+int virFileClose(int *fdptr, bool preserve_errno) ATTRIBUTE_RETURN_CHECK;
+int virFileFclose(FILE **file, bool preserve_errno) ATTRIBUTE_RETURN_CHECK;
+FILE *virFileFdopen(int *fdptr, const char *mode) ATTRIBUTE_RETURN_CHECK;
+
+/* For use on normal paths; caller must check return value,
+   and failure sets errno per close. */
+# define VIR_CLOSE(FD) virFileClose(&(FD), false)
+# define VIR_FCLOSE(FILE) virFileFclose(&(FILE), false)
+
+/* Wrapper around fdopen that consumes fd on success. */
+# define VIR_FDOPEN(FD, MODE) virFileFdopen(&(FD), MODE)
+
+/* For use on cleanup paths; errno is unaffected by close,
+   and no return value to worry about. */
+# define VIR_FORCE_CLOSE(FD) ignore_value(virFileClose(&(FD), true))
+# define VIR_FORCE_FCLOSE(FILE) ignore_value(virFileFclose(&(FILE), true))
+
+#endif /* __VIR_FILES_H */
index 53bac798b8318f0ffcd0c66c7d0df2e4647eb127..f0657284688ebbdcebd99deef0ad8b6aefeb164e 100644 (file)
@@ -54,7 +54,7 @@
 #include "logging.h"
 #include "vbox_driver.h"
 #include "configmake.h"
-#include "files.h"
+#include "virfile.h"
 #include "fdstream.h"
 
 /* This one changes from version to version. */
index 044784ef608559342c2b5c87b4c653f6fb6e3579..efefab40486fdd990a6a89725b91e93c0ce44907 100644 (file)
@@ -29,7 +29,7 @@
 #include "dirname.h"
 #include "memory.h"
 #include "nodeinfo.h"
-#include "files.h"
+#include "virfile.h"
 #include "uuid.h"
 #include "virterror_internal.h"
 #include "vmx.h"
index 7cec31066f07bd384c9eab0224497950e17fc97f..71f3d2284c8e5f1652fc015b563cfccfe8808278 100644 (file)
@@ -26,7 +26,7 @@
 #include "internal.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
-#include "files.h"
+#include "virfile.h"
 #include "memory.h"
 #include "uuid.h"
 #include "command.h"
index 1cb5455b4257260f0a3a6dc03224d60619d72abb..0bb8098c4f851c11ff2dc7f1c57387684b6ae41e 100644 (file)
@@ -27,7 +27,7 @@
 # include "util.h"
 # include "block_stats.h"
 # include "memory.h"
-# include "files.h"
+# include "virfile.h"
 
 # define VIR_FROM_THIS VIR_FROM_STATS_LINUX
 
index 3b5df466f4c3fb596c739156c95233d11060440f..7e3ef775823d84c010a9e794c99e9d1835c5820a 100644 (file)
@@ -49,7 +49,7 @@
 #include "pci.h"
 #include "uuid.h"
 #include "fdstream.h"
-#include "files.h"
+#include "virfile.h"
 #include "command.h"
 
 #define VIR_FROM_THIS VIR_FROM_XEN
index 543dfb1224efea081f9657bf0c518f1dd24fae88..9700471b2d6600f7ae82e95ff82947e3e1ff7e67 100644 (file)
@@ -65,7 +65,7 @@
 #include "buf.h"
 #include "capabilities.h"
 #include "memory.h"
-#include "files.h"
+#include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_XEN
 
index 241dbc727d458a4a0ef3922e0155ead806f17d4a..20e54eaf156d0777005bc9405698e9dc7487484a 100644 (file)
@@ -38,7 +38,7 @@
 #include "xend_internal.h"
 #include "logging.h"
 #include "uuid.h"
-#include "files.h"
+#include "virfile.h"
 
 #include "xm_internal.h" /* for xenXMDomainConfigParse */
 
index dec84840bec7d63a7bfa9666d95e0fee5859b2e9..b0e5cb1712519d659890f7d426c9db6a8e2bdf34 100644 (file)
@@ -45,7 +45,7 @@
 #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
 #include "memory.h"
 #include "count-one-bits.h"
-#include "files.h"
+#include "virfile.h"
 
 /* required for cpumap_t */
 #include <xen/dom0_ops.h>
index d60d50581be86dec4dfd53a3203b1a2ab7ac562f..cba208a2096705f1b7bab2639bd99288d6e26cf0 100644 (file)
@@ -29,7 +29,7 @@
 #include "internal.h"
 #include "util.h"
 #include "memory.h"
-#include "files.h"
+#include "virfile.h"
 
 
 static int envsort(const void *a, const void *b) {
index 67572535268cd9526c4ac7b4949b610af5d104db..9ab446c3630f6d971aa38d16a9af93817f059d58 100644 (file)
@@ -34,7 +34,7 @@
 #include "util.h"
 #include "memory.h"
 #include "command.h"
-#include "files.h"
+#include "virfile.h"
 
 #ifdef WIN32
 
index 71e2926df8d5c66457c4e226a6da62732cadeabf..5abee9230f6e448f9d0c285bfbcc8940aed7a23c 100644 (file)
@@ -9,7 +9,7 @@
 #include "internal.h"
 #include "nodeinfo.h"
 #include "util.h"
-#include "files.h"
+#include "virfile.h"
 
 #if ! (defined __linux__  &&  (defined(__x86_64__) || \
                                defined(__amd64__)  || \
index ac5d298978cf5f940048bba071be8856caaf6e44..d9582afb9c282ef29280356e891b05f12fca7902 100644 (file)
@@ -47,7 +47,7 @@
     ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \
       ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0)
 
-#include "files.h"
+#include "virfile.h"
 
 static unsigned int testDebug = -1;
 static unsigned int testVerbose = -1;
index 1697ced30c1a610d051b5a8edc511e167b31f668..0c86b84e8a230df35e44786fe83f3d7b5d0a3eb7 100644 (file)
@@ -31,7 +31,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "logging.h"
-#include "files.h"
+#include "virfile.h"
 
 #include "rpc/virnetsocket.h"
 
index 3f96cf2a3188658411199ed3f69aba152846abe9..9c1eba4d39769122c29c3185dd883a58047371af 100644 (file)
@@ -9,7 +9,7 @@
 #include "xml.h"
 #include "testutils.h"
 #include "xen/xen_hypervisor.h"
-#include "files.h"
+#include "virfile.h"
 
 static int
 testCompareFiles(const char *hostmachine, const char *xml_rel,
index 7ca95a3e1da44f8cd2a1e59130fefd04c6654a40..11087e5dcbfb3a6d7d56410207a17cfd0306e5c9 100644 (file)
@@ -39,7 +39,7 @@
 # include "console.h"
 # include "logging.h"
 # include "util.h"
-# include "files.h"
+# include "virfile.h"
 # include "memory.h"
 # include "virterror_internal.h"
 
index e9294f8fa91107dca52c0c9200912bbda318d2b6..6cd6c8deaafe907d3213a11487df55c24bcf819e 100644 (file)
@@ -52,7 +52,7 @@
 #include "memory.h"
 #include "xml.h"
 #include "libvirt/libvirt-qemu.h"
-#include "files.h"
+#include "virfile.h"
 #include "event_poll.h"
 #include "configmake.h"
 #include "threads.h"