diff --git a/HACKING b/HACKING
index 8ebbec774e..2df560a294 100644
--- 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 d24386264f..0a624f1592 100644
--- 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)$$)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 259fcc4ed3..38876d84d9 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -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
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 68886878e5..1a32d07438 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -506,7 +506,7 @@
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
+ applications. Instead of these APIs, use the macros from virfile.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 00e78ac7e0..481caba356 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 \
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dc579ef846..e6944e5263 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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"
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index ae479bfaf5..9f7ce048ce 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -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
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 036c61af35..04bfa22ae1 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -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
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index cc55b80d45..995f9a6a31 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -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
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 545efadf3d..73e16ed288 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -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
diff --git a/src/fdstream.c b/src/fdstream.c
index dd742e1980..d25b3f0dd5 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -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
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 98b125b4b7..938bb87e53 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -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;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 0f6035eda4..b74a4b1d55 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -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"
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d52a8b6958..381d90b592 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -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"
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 62eb28b031..b85f1fa434 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -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"
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 8e1860bccb..432b7f8502 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -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
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 346edef18c..7eda7ef276 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -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
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index afac8798db..80378d37e2 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -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"
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index 34e45013a1..f9ff20f64a 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -31,7 +31,7 @@
#include "virterror_internal.h"
#include "memory.h"
#include "logging.h"
-#include "files.h"
+#include "virfile.h"
#include
#define VIR_FROM_THIS VIR_FROM_NODEDEV
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index a53c56d036..cae2564fe2 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -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
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index c9b60da5ba..f87cfa1577 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -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"
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 561cc990d0..c60a97fcb9 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -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"
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index d24a5e3ecd..f0c6f577e4 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -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"
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 2489063a3c..e693e76977 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -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"
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 1421a5e003..3f36212597 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -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"
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ee706f9a86..938f113998 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 3d8aba4477..4a17a55563 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -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
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f9755a4c37..1a17f9955b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -33,7 +33,7 @@
#include "cpu/cpu.h"
#include "ignore-value.h"
#include "uuid.h"
-#include "files.h"
+#include "virfile.h"
#include
#include
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f4b454224e..0f02e293de 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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"
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0eae6613fc..20f0dafa02 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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"
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1803b9f5a9..9c1bde5345 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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"
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 016f8f0324..064c90f374 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a1fbe062a5..4c6081bb76 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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"
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 82b938c988..5418004dc4 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -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"
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 0ce907707c..7e88abaaa9 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -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"
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 35f18b9d51..731932c2ae 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -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"
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 6605aa3e15..71df951299 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -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"
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 02cdbb9122..59dc687d2e 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -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
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 6dfe8c9394..1d49ff6a2d 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -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"
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 50e19786b3..5e6145ff95 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -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
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 856d32f591..1e2feae8b1 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -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
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index f632edd55a..6243d1e9b2 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -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
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 16562156c8..058e00ce2f 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -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
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 7b8dc9746c..346e698050 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -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
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 5fe9a1f315..c622d2a3b3 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -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
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 2d48a9d47a..f2e1419992 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -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
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index da34547013..ae1e19f8ef 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -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
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 997b876686..9c353e394e 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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"
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a68cc0dff4..0e3bf5362b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -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
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 0122472c71..c4b6e7526c 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -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
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 0d6f71a93b..e1eedd4f38 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -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"
diff --git a/src/util/bridge.c b/src/util/bridge.c
index 0f4b6397f3..d63b2a0521 100644
--- a/src/util/bridge.c
+++ b/src/util/bridge.c
@@ -24,7 +24,7 @@
#if defined(WITH_BRIDGE)
# include "bridge.h"
-# include "files.h"
+# include "virfile.h"
# include
# include
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 9fe561d49f..f3ec80f99b 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -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
diff --git a/src/util/command.c b/src/util/command.c
index f8ee8b12f2..29ccaa4d7f 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -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"
diff --git a/src/util/conf.c b/src/util/conf.c
index 377f9cd31e..00045b54b4 100644
--- a/src/util/conf.c
+++ b/src/util/conf.c
@@ -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
diff --git a/src/util/dnsmasq.c b/src/util/dnsmasq.c
index 55db96b11f..d76cf65a21 100644
--- a/src/util/dnsmasq.c
+++ b/src/util/dnsmasq.c
@@ -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"
diff --git a/src/util/event_poll.c b/src/util/event_poll.c
index e2ae3a64e6..e8679b8e59 100644
--- a/src/util/event_poll.c
+++ b/src/util/event_poll.c
@@ -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/hooks.c b/src/util/hooks.c
index 30e20acc07..64adfcbda3 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -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"
diff --git a/src/util/interface.c b/src/util/interface.c
index 837ecce952..7b1a296888 100644
--- a/src/util/interface.c
+++ b/src/util/interface.c
@@ -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"
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 0368eba7fc..6a9f355c83 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -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"
diff --git a/src/util/logging.c b/src/util/logging.c
index d340f573eb..a63851043c 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -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
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 30343c8670..8386f3b814 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -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
diff --git a/src/util/pci.c b/src/util/pci.c
index e3f978c547..a79c164170 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -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
diff --git a/src/util/stats_linux.c b/src/util/stats_linux.c
index e728b7b1e9..72318e32b0 100644
--- a/src/util/stats_linux.c
+++ b/src/util/stats_linux.c
@@ -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
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index d4460d8c5a..68e82a9f2c 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -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
diff --git a/src/util/util.c b/src/util/util.c
index 910bb04be4..d83215ccc0 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -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"
diff --git a/src/util/uuid.c b/src/util/uuid.c
index 805c20f3ab..b4317dfe06 100644
--- a/src/util/uuid.c
+++ b/src/util/uuid.c
@@ -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
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index ebf31196a9..d0f9cc4d51 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -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/files.c b/src/util/virfile.c
similarity index 88%
rename from src/util/files.c
rename to src/util/virfile.c
index bef56b68cd..657692113b 100644
--- a/src/util/files.c
+++ b/src/util/virfile.c
@@ -1,5 +1,5 @@
/*
- * files.c: safer file handling
+ * virfile.c: safer file handling
*
* Copyright (C) 2010-2011 Red Hat, Inc.
* Copyright (C) 2010 IBM Corporation
@@ -26,9 +26,9 @@
#include
-#include "files.h"
+#include "virfile.h"
-int virClose(int *fdptr, bool preserve_errno)
+int virFileClose(int *fdptr, bool preserve_errno)
{
int saved_errno;
int rc = 0;
@@ -46,7 +46,7 @@ int virClose(int *fdptr, bool preserve_errno)
}
-int virFclose(FILE **file, bool preserve_errno)
+int virFileFclose(FILE **file, bool preserve_errno)
{
int saved_errno;
int rc = 0;
@@ -64,7 +64,7 @@ int virFclose(FILE **file, bool preserve_errno)
}
-FILE *virFdopen(int *fdptr, const char *mode)
+FILE *virFileFdopen(int *fdptr, const char *mode)
{
FILE *file = NULL;
diff --git a/src/util/files.h b/src/util/virfile.h
similarity index 70%
rename from src/util/files.h
rename to src/util/virfile.h
index 8b681eb2ad..d11f90257c 100644
--- a/src/util/files.h
+++ b/src/util/virfile.h
@@ -1,5 +1,5 @@
/*
- * files.h: safer file handling
+ * virfile.h: safer file handling
*
* Copyright (C) 2010-2011 Red Hat, Inc.
* Copyright (C) 2010 IBM Corporation
@@ -33,21 +33,21 @@
/* 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;
+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) virClose(&(FD), false)
-# define VIR_FCLOSE(FILE) virFclose(&(FILE), false)
+# 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) virFdopen(&(FD), MODE)
+# 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(virClose(&(FD), true))
-# define VIR_FORCE_FCLOSE(FILE) ignore_value(virFclose(&(FILE), true))
+# define VIR_FORCE_CLOSE(FD) ignore_value(virFileClose(&(FD), true))
+# define VIR_FORCE_FCLOSE(FILE) ignore_value(virFileFclose(&(FILE), true))
#endif /* __VIR_FILES_H */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 53bac798b8..f065728468 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -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. */
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 044784ef60..efefab4048 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -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"
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 7cec31066f..71f3d2284c 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -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"
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 1cb5455b42..0bb8098c4f 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -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
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 3b5df466f4..7e3ef77582 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -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
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 543dfb1224..9700471b2d 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -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
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 241dbc727d..20e54eaf15 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -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 */
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index dec84840be..b0e5cb1712 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -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
diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index d60d50581b..cba208a209 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -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) {
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 6757253526..9ab446c363 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -34,7 +34,7 @@
#include "util.h"
#include "memory.h"
#include "command.h"
-#include "files.h"
+#include "virfile.h"
#ifdef WIN32
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 71e2926df8..5abee9230f 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -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__) || \
diff --git a/tests/testutils.c b/tests/testutils.c
index ac5d298978..d9582afb9c 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -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;
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 1697ced30c..0c86b84e8a 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -31,7 +31,7 @@
#include "virterror_internal.h"
#include "memory.h"
#include "logging.h"
-#include "files.h"
+#include "virfile.h"
#include "rpc/virnetsocket.h"
diff --git a/tests/xencapstest.c b/tests/xencapstest.c
index 3f96cf2a31..9c1eba4d39 100644
--- a/tests/xencapstest.c
+++ b/tests/xencapstest.c
@@ -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,
diff --git a/tools/console.c b/tools/console.c
index 7ca95a3e1d..11087e5dcb 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -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"
diff --git a/tools/virsh.c b/tools/virsh.c
index e9294f8fa9..6cd6c8deaa 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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"