--- trunk/mkinitrd-magellan/grubby/grubby.c 2010/12/15 21:16:32 1177 +++ trunk/grubby/grubby.c 2012/02/17 23:14:54 1692 @@ -139,19 +139,15 @@ }; struct configFileInfo grubConfigType = { - "/boot/grub/grub.conf", /* defaultConfig */ - grubKeywords, /* keywords */ - 1, /* defaultIsIndex */ - 1, /* defaultSupportSaved */ - LT_TITLE, /* entrySeparator */ - 1, /* needsBootPrefix */ - 0, /* argsInQuotes */ - 0, /* maxTitleLength */ - 0, /* titleBracketed */ - 1, /* mbHyperFirst */ - 1, /* mbInitRdIsModule */ - 0, /* mbConcatArgs */ - 1, /* mbAllowExtraInitRds */ + .defaultConfig = "/boot/grub/grub.conf", + .keywords = grubKeywords, + .defaultIsIndex = 1, + .defaultSupportSaved = 1, + .entrySeparator = LT_TITLE, + .needsBootPrefix = 1, + .mbHyperFirst = 1, + .mbInitRdIsModule = 1, + .mbAllowExtraInitRds = 1, }; struct keywordTypes yabootKeywords[] = { @@ -249,99 +245,56 @@ }; int useextlinuxmenu; struct configFileInfo eliloConfigType = { - "/boot/efi/EFI/redhat/elilo.conf", /* defaultConfig */ - eliloKeywords, /* keywords */ - 0, /* defaultIsIndex */ - 0, /* defaultSupportSaved */ - LT_KERNEL, /* entrySeparator */ - 1, /* needsBootPrefix */ - 1, /* argsInQuotes */ - 0, /* maxTitleLength */ - 0, /* titleBracketed */ - 0, /* mbHyperFirst */ - 0, /* mbInitRdIsModule */ - 1, /* mbConcatArgs */ - 0, /* mbAllowExtraInitRds */ + .defaultConfig = "/boot/efi/EFI/redhat/elilo.conf", + .keywords = eliloKeywords, + .entrySeparator = LT_KERNEL, + .needsBootPrefix = 1, + .argsInQuotes = 1, + .mbConcatArgs = 1, }; struct configFileInfo liloConfigType = { - "/etc/lilo.conf", /* defaultConfig */ - liloKeywords, /* keywords */ - 0, /* defaultIsIndex */ - 0, /* defaultSupportSaved */ - LT_KERNEL, /* entrySeparator */ - 0, /* needsBootPrefix */ - 1, /* argsInQuotes */ - 15, /* maxTitleLength */ - 0, /* titleBracketed */ - 0, /* mbHyperFirst */ - 0, /* mbInitRdIsModule */ - 0, /* mbConcatArgs */ - 0, /* mbAllowExtraInitRds */ + .defaultConfig = "/etc/lilo.conf", + .keywords = liloKeywords, + .entrySeparator = LT_KERNEL, + .argsInQuotes = 1, + .maxTitleLength = 15, }; struct configFileInfo yabootConfigType = { - "/etc/yaboot.conf", /* defaultConfig */ - yabootKeywords, /* keywords */ - 0, /* defaultIsIndex */ - 0, /* defaultSupportSaved */ - LT_KERNEL, /* entrySeparator */ - 1, /* needsBootPrefix */ - 1, /* argsInQuotes */ - 15, /* maxTitleLength */ - 0, /* titleBracketed */ - 0, /* mbHyperFirst */ - 0, /* mbInitRdIsModule */ - 0, /* mbConcatArgs */ - 1, /* mbAllowExtraInitRds */ + .defaultConfig = "/etc/yaboot.conf", + .keywords = yabootKeywords, + .entrySeparator = LT_KERNEL, + .needsBootPrefix = 1, + .argsInQuotes = 1, + .maxTitleLength = 15, + .mbAllowExtraInitRds = 1, }; struct configFileInfo siloConfigType = { - "/etc/silo.conf", /* defaultConfig */ - siloKeywords, /* keywords */ - 0, /* defaultIsIndex */ - 0, /* defaultSupportSaved */ - LT_KERNEL, /* entrySeparator */ - 1, /* needsBootPrefix */ - 1, /* argsInQuotes */ - 15, /* maxTitleLength */ - 0, /* titleBracketed */ - 0, /* mbHyperFirst */ - 0, /* mbInitRdIsModule */ - 0, /* mbConcatArgs */ - 0, /* mbAllowExtraInitRds */ + .defaultConfig = "/etc/silo.conf", + .keywords = siloKeywords, + .entrySeparator = LT_KERNEL, + .needsBootPrefix = 1, + .argsInQuotes = 1, + .maxTitleLength = 15, }; struct configFileInfo ziplConfigType = { - "/etc/zipl.conf", /* defaultConfig */ - ziplKeywords, /* keywords */ - 0, /* defaultIsIndex */ - 0, /* defaultSupportSaved */ - LT_TITLE, /* entrySeparator */ - 0, /* needsBootPrefix */ - 1, /* argsInQuotes */ - 0, /* maxTitleLength */ - 1, /* titleBracketed */ - 0, /* mbHyperFirst */ - 0, /* mbInitRdIsModule */ - 0, /* mbConcatArgs */ - 0, /* mbAllowExtraInitRds */ + .defaultConfig = "/etc/zipl.conf", + .keywords = ziplKeywords, + .entrySeparator = LT_TITLE, + .argsInQuotes = 1, + .titleBracketed = 1, }; struct configFileInfo extlinuxConfigType = { - "/boot/extlinux/extlinux.conf", /* defaultConfig */ - extlinuxKeywords, /* keywords */ - 0, /* defaultIsIndex */ - 0, /* defaultSupportSaved */ - LT_TITLE, /* entrySeparator */ - 1, /* needsBootPrefix */ - 0, /* argsInQuotes */ - 255, /* maxTitleLength */ - 0, /* titleBracketed */ - 0, /* mbHyperFirst */ - 0, /* mbInitRdIsModule */ - 0, /* mbConcatArgs */ - 1, /* mbAllowExtraInitRds */ + .defaultConfig = "/boot/extlinux/extlinux.conf", + .keywords = extlinuxKeywords, + .entrySeparator = LT_TITLE, + .needsBootPrefix = 1, + .maxTitleLength = 255, + .mbAllowExtraInitRds = 1, }; struct grubConfig { @@ -1979,7 +1932,7 @@ const char ** arg; int useKernelArgs, useRoot; int firstElement; - int *usedElements, *usedArgs; + int *usedElements; int doreplace; if (!image) return 0; @@ -2014,9 +1967,6 @@ useRoot = (getKeywordByType(LT_ROOT, cfg->cfi) && !multibootArgs); - for (k = 0, arg = newArgs; *arg; arg++, k++) ; - usedArgs = calloc(k, sizeof(*usedArgs)); - for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) { if (multibootArgs && !entry->multiboot) @@ -2092,7 +2042,6 @@ usedElements = calloc(line->numElements, sizeof(*usedElements)); for (k = 0, arg = newArgs; *arg; arg++, k++) { - if (usedArgs[k]) continue; doreplace = 1; for (i = firstElement; i < line->numElements; i++) { @@ -2107,7 +2056,6 @@ continue; if (!argMatch(line->elements[i].item, *arg)) { usedElements[i]=1; - usedArgs[k]=1; break; } } @@ -2177,7 +2125,6 @@ } } - free(usedArgs); free(newArgs); free(oldArgs);