Since all the usage of augeas is done in OCaml parts (via ocaml-augeas),
drop all the C code using the C augeas library.
---
daemon/Makefile.am | 2 -
daemon/augeas.c | 91 ---------------------------------------------
daemon/cleanups.c | 11 ------
daemon/daemon.h | 34 -----------------
daemon/lvm-filter.c | 2 -
docs/C_SOURCE_FILES | 1 -
po/POTFILES | 1 -
7 files changed, 142 deletions(-)
delete mode 100644 daemon/augeas.c
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 220b934a3..f20dc8584 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -85,7 +85,6 @@ guestfsd_SOURCES = \
acl.c \
actions.h \
available.c \
- augeas.c \
base64.c \
blkdiscard.c \
blkid.c \
@@ -256,7 +255,6 @@ guestfsd_CPPFLAGS = \
guestfsd_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(RPC_CFLAGS) \
- $(AUGEAS_CFLAGS) \
$(HIVEX_CFLAGS) \
$(SD_JOURNAL_CFLAGS) \
$(JANSSON_CFLAGS) \
diff --git a/daemon/augeas.c b/daemon/augeas.c
deleted file mode 100644
index d0c6f19a2..000000000
--- a/daemon/augeas.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* libguestfs - the guestfsd daemon
- * Copyright (C) 2009 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <augeas.h>
-
-#include "daemon.h"
-#include "actions.h"
-#include "optgroups.h"
-
-#define FPRINTF_AUGEAS_ERROR(aug,fs,...) \
- do { \
- const int code = aug_error (aug); \
- if (code == AUG_ENOMEM) \
- reply_with_error (fs ": augeas out of memory", ##__VA_ARGS__); \
- else { \
- const char *aug_err_message = aug_error_message (aug); \
- const char *aug_err_minor = aug_error_minor_message (aug); \
- const char *aug_err_details = aug_error_details (aug); \
- fprintf (stderr, fs ": %s%s%s%s%s", ##__VA_ARGS__, \
- aug_err_message, \
- aug_err_minor ? ": " : "", aug_err_minor ? aug_err_minor :
"", \
- aug_err_details ? ": " : "", aug_err_details ?
aug_err_details : ""); \
- } \
- } while (0)
-
-int augeas_version;
-
-void
-aug_read_version (void)
-{
- CLEANUP_AUG_CLOSE augeas *ah = NULL;
- int r;
- const char *str;
- int major = 0, minor = 0, patch = 0;
-
- if (augeas_version != 0)
- return;
-
- /* Optimization: do not load the files nor the lenses, since we are
- * only interested in the version.
- */
- ah = aug_init ("/", NULL, AUG_NO_ERR_CLOSE | AUG_NO_LOAD | AUG_NO_STDINC);
- if (!ah) {
- FPRINTF_AUGEAS_ERROR (ah, "augeas initialization failed");
- return;
- }
-
- if (aug_error (ah) != AUG_NOERROR) {
- FPRINTF_AUGEAS_ERROR (ah, "aug_init");
- return;
- }
-
- r = aug_get (ah, "/augeas/version", &str);
- if (r != 1) {
- FPRINTF_AUGEAS_ERROR (ah, "aug_get");
- return;
- }
-
- r = sscanf (str, "%d.%d.%d", &major, &minor, &patch);
- if (r != 2 && r != 3) {
- fprintf (stderr, "cannot match the version string in '%s'\n",
str);
- return;
- }
-
- if (verbose)
- fprintf (stderr, "augeas version: %d.%d.%d\n", major, minor, patch);
-
- augeas_version = (major << 16) | (minor << 8) | patch;
-}
diff --git a/daemon/cleanups.c b/daemon/cleanups.c
index b4767178a..0a22d38ef 100644
--- a/daemon/cleanups.c
+++ b/daemon/cleanups.c
@@ -22,19 +22,8 @@
#include <stdlib.h>
#include <unistd.h>
-#include <augeas.h>
-
#include "daemon.h"
-void
-cleanup_aug_close (void *ptr)
-{
- augeas *aug = * (augeas **) ptr;
-
- if (aug != NULL)
- aug_close (aug);
-}
-
void
cleanup_free_stringsbuf (void *ptr)
{
diff --git a/daemon/daemon.h b/daemon/daemon.h
index c6cccea75..da9317bc8 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -100,14 +100,11 @@ extern void cleanup_free_mountable (mountable_t *mountable);
/* These functions are used internally by the CLEANUP_* macros.
* Don't call them directly.
*/
-extern void cleanup_aug_close (void *ptr);
extern void cleanup_free_stringsbuf (void *ptr);
#ifdef HAVE_ATTRIBUTE_CLEANUP
-#define CLEANUP_AUG_CLOSE __attribute__((cleanup(cleanup_aug_close)))
#define CLEANUP_FREE_STRINGSBUF __attribute__((cleanup(cleanup_free_stringsbuf)))
#else
-#define CLEANUP_AUG_CLOSE
#define CLEANUP_FREE_STRINGSBUF
#endif
@@ -254,20 +251,6 @@ extern int lv_canonical (const char *device, char **ret);
/* zero.c */
extern void wipe_device_before_mkfs (const char *device);
-/* augeas.c */
-extern void aug_read_version (void);
-
-/* The version of augeas, saved as:
- * (MAJOR << 16) | (MINOR << 8) | PATCH
- */
-extern int augeas_version;
-static inline int
-augeas_is_version (int major, int minor, int patch)
-{
- aug_read_version (); /* Lazy version reading. */
- return augeas_version >= ((major << 16) | (minor << 8) | patch);
-}
-
/* hivex.c */
extern void hivex_finalize (void);
@@ -374,21 +357,4 @@ extern int upload_to_fd (int fd, const char *filename);
} \
while (0)
-/* Calls reply_with_error, but includes the Augeas error details. */
-#define AUGEAS_ERROR(fs,...) \
- do { \
- const int code = aug_error (aug); \
- if (code == AUG_ENOMEM) \
- reply_with_error (fs ": augeas out of memory", ##__VA_ARGS__); \
- else { \
- const char *message = aug_error_message (aug); \
- const char *minor = aug_error_minor_message (aug); \
- const char *details = aug_error_details (aug); \
- reply_with_error (fs ": %s%s%s%s%s", ##__VA_ARGS__, \
- message, \
- minor ? ": " : "", minor ? minor :
"", \
- details ? ": " : "", details ? details :
""); \
- } \
- } while (0)
-
#endif /* GUESTFSD_DAEMON_H */
diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
index c6dd35156..bd9600a26 100644
--- a/daemon/lvm-filter.c
+++ b/daemon/lvm-filter.c
@@ -28,8 +28,6 @@
#include <sys/stat.h>
#include <sys/wait.h>
-#include <augeas.h>
-
#include "c-ctype.h"
#include "ignore-value.h"
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index 26446d4de..8b084ec32 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -66,7 +66,6 @@ customize/perl_edit-c.c
daemon/9p.c
daemon/acl.c
daemon/actions.h
-daemon/augeas.c
daemon/available.c
daemon/base64.c
daemon/blkdiscard.c
diff --git a/po/POTFILES b/po/POTFILES
index fa826bc18..2c157ec46 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -49,7 +49,6 @@ customize/crypt-c.c
customize/perl_edit-c.c
daemon/9p.c
daemon/acl.c
-daemon/augeas.c
daemon/available.c
daemon/base64.c
daemon/blkdiscard.c
--
2.24.1