summaryrefslogtreecommitdiffstats
path: root/helper/helper.h
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-08-19 14:23:11 +0100
committerRichard Jones <rjones@redhat.com>2010-08-24 13:17:41 +0100
commit15c230a50d78435716b701a68709b3576118f27b (patch)
tree4ff6266efb85a72f550408ab9ef2878c71e5f8a9 /helper/helper.h
parent2d2846007d62696185bf367724a65ae8d626fbc2 (diff)
downloadfebootstrap-15c230a50d78435716b701a68709b3576118f27b.tar.gz
febootstrap-15c230a50d78435716b701a68709b3576118f27b.tar.xz
febootstrap-15c230a50d78435716b701a68709b3576118f27b.zip
Refactor cpio code into separate file.
We create a 'writer' abstraction and (currently) a single implementation of this which can write cpio files. All cpio-related code is moved out of 'appliance.c' into 'cpio.c'. 'appliance.c' becomes a generic appliance builder. This commit should not change the semantics of the program.
Diffstat (limited to 'helper/helper.h')
-rw-r--r--helper/helper.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/helper/helper.h b/helper/helper.h
index 50d4f33..9bb637a 100644
--- a/helper/helper.h
+++ b/helper/helper.h
@@ -19,12 +19,36 @@
#ifndef FEBOOTSTRAP_SUPERMIN_HELPER_H
#define FEBOOTSTRAP_SUPERMIN_HELPER_H
+#include <sys/stat.h>
+#include "fts_.h"
+
+struct writer {
+ /* Start a new appliance, finish one off. */
+ void (*wr_start) (const char *appliance);
+ void (*wr_end) (void);
+
+ /* Append the named host file to the appliance being built. The
+ * wr_file_stat form is used where we have already stat'd this file,
+ * to avoid having to stat it a second time. The wr_fts_entry form
+ * is used where the caller has an FTSENT.
+ */
+ void (*wr_file) (const char *filename);
+ void (*wr_file_stat) (const char *filename, const struct stat *);
+ void (*wr_fts_entry) (FTSENT *entry);
+
+ /* Append the contents of cpio file to the appliance being built. */
+ void (*wr_cpio_file) (const char *cpio_file);
+};
+
/* main.c */
extern struct timeval start_t;
extern int verbose;
/* appliance.c */
-extern void create_appliance (char **inputs, int nr_inputs, const char *whitelist, const char *modpath, const char *appliance);
+extern void create_appliance (char **inputs, int nr_inputs, const char *whitelist, const char *modpath, const char *appliance, struct writer *writer);
+
+/* cpio.c */
+extern struct writer cpio_writer;
/* kernel.c */
extern const char *create_kernel (const char *hostcpu, const char *kernel);