@@ -9,9 +9,8 @@
#include <asm/byteorder.h>
#include <libtwin/twin_png.h>
+#include <petitboot.h>
#include "petitboot-gui.h"
-#include "petitboot-paths.h"
-#include "message.h"
#define PBOOT_DEFAULT_ICON "tux.png"
@@ -25,11 +25,7 @@ AM_CFLAGS = \
-Wredundant-decls \
-Winline
-pkginclude_HEADERS = \
- message.h \
- parser.h \
- paths.h \
- petitboot-paths.h
+include_HEADERS = petitboot.h
petitboot_headers = \
params.h \
@@ -10,7 +10,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include "parser.h"
+#include "petitboot.h"
#include "params.h"
#define buf_size 1024
@@ -1,30 +0,0 @@
-
-#ifndef _MESSAGE_H
-#define _MESSAGE_H
-
-enum device_action {
- DEV_ACTION_ADD_DEVICE = 0,
- DEV_ACTION_ADD_OPTION = 1,
- DEV_ACTION_REMOVE_DEVICE = 2,
- DEV_ACTION_REMOVE_OPTION = 3
-};
-
-struct device {
- char *id;
- char *name;
- char *description;
- char *icon_file;
-};
-
-struct boot_option {
- char *id;
- char *name;
- char *description;
- char *icon_file;
- char *boot_image_file;
- char *initrd_file;
- char *boot_args;
-};
-
-
-#endif /* _MESSAGE_H */
@@ -1,12 +1,11 @@
-#include "parser.h"
-#include "params.h"
-#include "paths.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include "petitboot.h"
+#include "params.h"
+
const char *conf_filename = "/boot/petitboot.conf";
static struct boot_option *cur_opt;
@@ -1,9 +1,8 @@
-#include <petitboot-paths.h>
#include <stdlib.h>
#include <string.h>
-#include "parser.h"
+#include "petitboot.h"
extern struct parser native_parser;
extern struct parser yaboot_parser;
@@ -1,46 +0,0 @@
-
-#ifndef _PARSERS_H
-#define _PARSERS_H
-
-#include <stdarg.h>
-#include "message.h"
-
-struct parser {
- char *name;
- int priority;
- int (*parse)(const char *device);
- struct parser *next;
-};
-
-enum generic_icon_type {
- ICON_TYPE_DISK,
- ICON_TYPE_USB,
- ICON_TYPE_OPTICAL,
- ICON_TYPE_NETWORK,
- ICON_TYPE_UNKNOWN
-};
-
-#define streq(a,b) (!strcasecmp((a),(b)))
-
-/* general functions provided by parsers.c */
-void iterate_parsers(const char *devpath, const char *mountpoint);
-
-void free_device(struct device *dev);
-void free_boot_option(struct boot_option *opt);
-
-const char *generic_icon_file(enum generic_icon_type type);
-
-/* functions provided by udev-helper or the test wrapper */
-void pb_log(const char *fmt, ...);
-
-int mount_device(const char *dev_path);
-
-char *resolve_path(const char *path, const char *current_dev);
-const char *mountpoint_for_device(const char *dev_path);
-
-enum generic_icon_type guess_device_type(void);
-
-int add_device(const struct device *dev);
-int add_boot_option(const struct boot_option *opt);
-
-#endif /* _PARSERS_H */
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include "paths.h"
+#include "petitboot.h"
static char *mount_base;
@@ -1,53 +0,0 @@
-#ifndef PATHS_H
-#define PATHS_H
-
-/**
- * Given a string (eg /dev/sda1, sda1 or UUID=B8E53381CA9EA0E3), parse the
- * device path (eg /dev/sda1). Any device descriptions read from config files
- * should be parsed into the path first.
- *
- * The cur_dev is provided for some remapping situations. If NULL is provided,
- * no remapping will be done.
- *
- * Returns a newly-allocated string.
- */
-char *parse_device_path(const char *dev_str, const char *current_device);
-
-/**
- * Get the mountpoint for a device.
- */
-const char *mountpoint_for_device(const char *dev);
-
-/**
- * Resolve a path given in a config file, to a path in the local filesystem.
- * Paths may be of the form:
- * device:path (eg /dev/sda:/boot/vmlinux)
- *
- * or just a path:
- * /boot/vmlinux
- * - in this case, the current mountpoint is used.
- *
- * Returns a newly-allocated string containing a full path to the file in path
- */
-char *resolve_path(const char *path, const char *current_device);
-
-
-/**
- * Set the base directory for newly-created mountpoints
- */
-void set_mount_base(const char *path);
-
-/**
- * Utility function for joining two paths. Adds a / between a and b if
- * required.
- *
- * Returns a newly-allocated string.
- */
-char *join_paths(const char *a, const char *b);
-
-/**
- * encode a disk label (or uuid) for use in a symlink.
- */
-char *encode_label(const char *label);
-
-#endif /* PATHS_H */
@@ -1,24 +0,0 @@
-#ifndef _PATHS_H
-#define _PATHS_H
-
-#ifndef PREFIX
-#define PREFIX "/usr"
-#endif
-
-#ifndef PKG_SHARE_DIR
-#define PKG_SHARE_DIR PREFIX "/share/petitboot"
-#endif
-
-#ifndef TMP_DIR
-#define TMP_DIR "/var/tmp/mnt/"
-#endif
-
-#define PBOOT_DEVICE_SOCKET "/var/tmp/petitboot-dev"
-#define MOUNT_BIN "/bin/mount"
-#define UMOUNT_BIN "/bin/umount"
-#define BOOT_GAMEOS_BIN "/usr/bin/ps3-boot-game-os"
-
-/* at present, all default artwork strings are const. */
-#define artwork_pathname(s) (PKG_SHARE_DIR "/artwork/" s)
-
-#endif /* _PATHS_H */
@@ -0,0 +1,141 @@
+
+#ifndef _PETITBOOT_LIB_H
+#define _PETITBOOT_LIB_H
+
+/* default system paths */
+
+#ifndef PREFIX
+#define PREFIX "/usr"
+#endif
+
+#ifndef PKG_SHARE_DIR
+#define PKG_SHARE_DIR PREFIX "/share/petitboot"
+#endif
+
+#ifndef TMP_DIR
+#define TMP_DIR "/var/tmp/mnt/"
+#endif
+
+#define PBOOT_DEVICE_SOCKET "/var/tmp/petitboot-dev"
+#define MOUNT_BIN "/bin/mount"
+#define UMOUNT_BIN "/bin/umount"
+#define BOOT_GAMEOS_BIN "/usr/bin/ps3-boot-game-os"
+
+/* at present, all default artwork strings are const. */
+#define artwork_pathname(s) (PKG_SHARE_DIR "/artwork/" s)
+
+/* message interface */
+
+enum device_action {
+ DEV_ACTION_ADD_DEVICE = 0,
+ DEV_ACTION_ADD_OPTION = 1,
+ DEV_ACTION_REMOVE_DEVICE = 2,
+ DEV_ACTION_REMOVE_OPTION = 3
+};
+
+struct device {
+ char *id;
+ char *name;
+ char *description;
+ char *icon_file;
+};
+
+struct boot_option {
+ char *id;
+ char *name;
+ char *description;
+ char *icon_file;
+ char *boot_image_file;
+ char *initrd_file;
+ char *boot_args;
+};
+
+/* parser interface */
+
+struct parser {
+ char *name;
+ int priority;
+ int (*parse)(const char *device);
+ struct parser *next;
+};
+
+enum generic_icon_type {
+ ICON_TYPE_DISK,
+ ICON_TYPE_USB,
+ ICON_TYPE_OPTICAL,
+ ICON_TYPE_NETWORK,
+ ICON_TYPE_UNKNOWN
+};
+
+#define streq(a,b) (!strcasecmp((a),(b)))
+
+/* general functions provided by parsers.c */
+void iterate_parsers(const char *devpath, const char *mountpoint);
+
+void free_device(struct device *dev);
+void free_boot_option(struct boot_option *opt);
+
+const char *generic_icon_file(enum generic_icon_type type);
+
+/* functions provided by udev-helper or the test wrapper */
+void pb_log(const char *fmt, ...);
+
+int mount_device(const char *dev_path);
+
+enum generic_icon_type guess_device_type(void);
+
+int add_device(const struct device *dev);
+int add_boot_option(const struct boot_option *opt);
+
+/* path routines */
+
+/**
+ * Given a string (eg /dev/sda1, sda1 or UUID=B8E53381CA9EA0E3), parse the
+ * device path (eg /dev/sda1). Any device descriptions read from config files
+ * should be parsed into the path first.
+ *
+ * The cur_dev is provided for some remapping situations. If NULL is provided,
+ * no remapping will be done.
+ *
+ * Returns a newly-allocated string.
+ */
+char *parse_device_path(const char *dev_str, const char *current_device);
+
+/**
+ * Get the mountpoint for a device.
+ */
+const char *mountpoint_for_device(const char *dev);
+
+/**
+ * Resolve a path given in a config file, to a path in the local filesystem.
+ * Paths may be of the form:
+ * device:path (eg /dev/sda:/boot/vmlinux)
+ *
+ * or just a path:
+ * /boot/vmlinux
+ * - in this case, the current mountpoint is used.
+ *
+ * Returns a newly-allocated string containing a full path to the file in path
+ */
+char *resolve_path(const char *path, const char *current_device);
+
+
+/**
+ * Set the base directory for newly-created mountpoints
+ */
+void set_mount_base(const char *path);
+
+/**
+ * Utility function for joining two paths. Adds a / between a and b if
+ * required.
+ *
+ * Returns a newly-allocated string.
+ */
+char *join_paths(const char *a, const char *b);
+
+/**
+ * encode a disk label (or uuid) for use in a symlink.
+ */
+char *encode_label(const char *label);
+
+#endif /* _PETITBOOT_LIB_H */
@@ -1,9 +1,4 @@
-#include "parser.h"
-#include "params.h"
-#include "paths.h"
-#include "yaboot-cfg.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -14,6 +9,10 @@
#include <ctype.h>
#include <sys/param.h>
+#include "petitboot.h"
+#include "params.h"
+#include "yaboot-cfg.h"
+
static struct device *dev;
static char *devpath;
static char *defimage;
@@ -21,8 +21,8 @@
#include <libtwin/twin_png.h>
#include <libtwin/twin_jpeg.h>
+#include <petitboot.h>
#include "petitboot-gui.h"
-#include "petitboot-paths.h"
#ifdef _USE_X11
#include <libtwin/twin_x11.h>
@@ -19,9 +19,7 @@
#include <linux/cdrom.h>
#include <sys/ioctl.h>
-#include "parser.h"
-#include "paths.h"
-#include "petitboot-paths.h"
+#include <petitboot.h>
/* Define below to operate without the frontend */
#undef USE_FAKE_SOCKET
@@ -6,8 +6,7 @@
#include <unistd.h>
#include <string.h>
-#include "parser.h"
-#include "paths.h"
+#include <petitboot.h>
void pb_log(const char *fmt, ...)
{