---
grubby.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
diff --git a/grubby.c b/grubby.c
index fe8317d..71edce7 100644
--- a/grubby.c
+++ b/grubby.c
@@ -124,11 +124,100 @@ struct keywordTypes {
};
struct configFileInfo;
+struct grubConfig;
typedef const char *(*findConfigFunc)(struct configFileInfo *);
typedef const int (*writeLineFunc)(struct configFileInfo *,
struct singleLine *line);
+static const char *grubFindConfig(struct configFileInfo *cfi);
+static const char *grub2FindConfig(struct configFileInfo *cfi);
+static char *grub2ExtractTitle(struct singleLine * line);
+static int argMatch(const char * one, const char * two);
+static int sizeOfSingleLine(struct singleLine * line);
+static void removeLine(struct singleEntry * entry, struct singleLine * line);
+static void printEntry(struct singleEntry * entry);
+static void notSuitablePrintf(struct singleEntry * entry, const char *fmt, ...);
+static char * findBootPrefix(void);
+
+static int suitableImage(struct singleEntry * entry,
+ const char * bootPrefix,
+ int skipRemoved,
+ int flags);
+
+static void markRemovedImage(struct grubConfig * cfg,
+ const char * image,
+ const char * prefix);
+
+static void setFallbackImage(struct grubConfig * config,
+ int hasNew);
+
+static void setDefaultImage(struct grubConfig * config,
+ int hasNew,
+ const char * defaultKernelPath,
+ int newIsDefault,
+ const char * prefix,
+ int flags);
+
+static int updateActualImage(struct grubConfig * cfg,
+ const char * image,
+ const char * prefix,
+ const char * addArgs,
+ const char * removeArgs,
+ int multibootArgs);
+
+static int updateImage(struct grubConfig * cfg,
+ const char * image,
+ const char * prefix,
+ const char * addArgs,
+ const char * removeArgs,
+ const char * addMBArgs,
+ const char * removeMBArgs);
+
+static int updateInitrd(struct grubConfig * cfg,
+ const char * image,
+ const char * prefix,
+ const char * initrd);
+
+static struct singleEntry * findTemplate(struct grubConfig * cfg,
+ const char * prefix,
+ int * indexPtr,
+ int skipRemoved,
+ int flags);
+
+static int addNewKernel(struct grubConfig * config,
+ struct singleEntry * template,
+ const char * prefix,
+ char * newKernelPath,
+ char * newKernelTitle,
+ char * newKernelArgs,
+ char * newKernelInitrd,
+ char ** extraInitrds,
+ int extraInitrdCount,
+ char * newMBKernel,
+ char * newMBKernelArgs);
+
+static int checkDeviceBootloader(const char * device,
+ const unsigned char * boot);
+
+static int checkForLilo(struct grubConfig * config);
+static int checkForGrub(struct grubConfig * config);
+static int checkForGrub2(struct grubConfig * config);
+static int checkLiloOnRaid(char * mdDev,
+ const unsigned char * boot);
+
+static void displayEntry(struct singleEntry * entry,
+ const char * prefix,
+ int index);
+
+static int displayInfo(struct grubConfig * config,
+ char * kernel,
+ const char * prefix);
+
+static void dumpSysconfigGrub(void);
+static int parseSysconfigGrub(int * lbaPtr,
+ char ** bootPtr);
+
struct configFileInfo {
char * defaultConfig;
findConfigFunc findConfig;