1 /* febootstrap-supermin-helper reimplementation in C.
2 * Copyright (C) 2009-2010 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef FEBOOTSTRAP_SUPERMIN_HELPER_H
20 #define FEBOOTSTRAP_SUPERMIN_HELPER_H
26 /* Start building a new appliance.
27 * 'appliance' is the output appliance.
28 * 'initrd' is the mini-initrd to create (only used for ext2 output).
29 * 'modpath' is the kernel module path.
31 void (*wr_start) (const char *hostcpu, const char *appliance,
32 const char *modpath, const char *initrd);
34 /* Finish off the appliance. */
35 void (*wr_end) (void);
37 /* Append the named host file to the appliance being built. The
38 * wr_file_stat form is used where we have already stat'd this file,
39 * to avoid having to stat it a second time. The wr_fts_entry form
40 * is used where the caller has an FTSENT.
42 void (*wr_file) (const char *filename);
43 void (*wr_file_stat) (const char *filename, const struct stat *);
44 void (*wr_fts_entry) (FTSENT *entry);
46 /* Append the contents of cpio file to the appliance being built. */
47 void (*wr_cpio_file) (const char *cpio_file);
51 extern struct timeval start_t;
55 extern void create_appliance (const char *hostcpu, char **inputs, int nr_inputs, const char *whitelist, const char *modpath, const char *initrd, const char *appliance, struct writer *writer);
58 extern struct writer checksum_writer;
61 extern struct writer cpio_writer;
64 extern struct writer ext2_writer;
67 extern const char *create_kernel (const char *hostcpu, const char *kernel);
70 extern void print_timestamped_message (const char *fs, ...);
71 extern int64_t timeval_diff (const struct timeval *x, const struct timeval *y);
72 extern int reverse_filevercmp (const void *p1, const void *p2);
73 extern void add_string (char ***argv, size_t *n_used, size_t *n_alloc, const char *str);
74 extern size_t count_strings (char *const *argv);
75 extern char **read_dir (const char *name);
76 extern char **filter (char **strings, int (*)(const char *));
77 extern char **filter_fnmatch (char **strings, const char *patt, int flags);
78 extern char **filter_notmatching_substring (char **strings, const char *sub);
79 extern void sort (char **strings, int (*compare) (const void *, const void *));
80 extern int isdir (const char *path);
81 extern char **load_file (const char *filename);
83 #endif /* FEBOOTSTRAP_SUPERMIN_HELPER_H */