Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 906997 Details for
Bug 1094489
add support for btrfs in grub2 on /boot
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
v2.1 add compile time enabled debugging code for btrfs
0003-v2.1-add-compile-time-enabled-debugging-code-for-btr.patch (text/plain), 13.63 KB, created by
Gene Czarcinski
on 2014-06-10 04:06:47 UTC
(
hide
)
Description:
v2.1 add compile time enabled debugging code for btrfs
Filename:
MIME Type:
Creator:
Gene Czarcinski
Created:
2014-06-10 04:06:47 UTC
Size:
13.63 KB
patch
obsolete
>From b26a172535e54b15d4cea7a64154a3e67636e980 Mon Sep 17 00:00:00 2001 >From: Gene Czarcinski <gczarcinski@gmail.com> >Date: Mon, 9 Jun 2014 20:48:32 -0400 >Subject: [PATCH 3/5] v2.1 add compile-time enabled debugging code for btrfs >Content-Type: text/plain; charset="utf-8" >Content-Transfer-Encoding: 8bit > >This patch add a "bunch" of debugging code supporting the >implementation of btrfs support. This code will only produce >output if DEBUG is enabled. >--- > grubby.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 88 insertions(+), 3 deletions(-) > >diff --git a/grubby.c b/grubby.c >index 04cd100..06e7dfd 100644 >--- a/grubby.c >+++ b/grubby.c >@@ -1395,7 +1395,14 @@ static struct grubConfig * readConfig(const char * inName, > entry->lines = line; > else > last->next = line; >- dbgPrintf("readConfig added %s to %p\n", getKeyByType(line->type, cfi), entry); >+ if ((line->numElements == 0) && (line->type == LT_WHITESPACE)) { >+ dbgPrintf("readConfig added %s to %p, comment='%s'\n", >+ getKeyByType(line->type, cfi), entry, >+ line->indent ? line->indent : ""); >+ } else { >+ dbgPrintf("readConfig added %s to %p\n", >+ getKeyByType(line->type, cfi), entry); >+ } > > /* we could have seen this outside of an entry... if so, we > * ignore it like any other line we don't grok */ >@@ -1406,7 +1413,16 @@ static struct grubConfig * readConfig(const char * inName, > cfg->theLines = line; > else > last->next = line; >- dbgPrintf("readConfig added %s to cfg\n", getKeyByType(line->type, cfi)); >+ if ((line->numElements == 0) && (line->type == LT_WHITESPACE)) { >+ dbgPrintf("readConfig added %s to cfg, comment='%s'\n", >+ getKeyByType(line->type, cfi), >+ line->indent ? line->indent : ""); >+ } else { >+ dbgPrintf("readConfig added %s to cfg ... 0:'%s' 1:'%s'\n", >+ getKeyByType(line->type, cfi), >+ (line->numElements > 0) ? line->elements[0].item : "", >+ (line->numElements > 1) ? line->elements[1].item : ""); >+ } > } > > last = line; >@@ -1501,6 +1517,7 @@ static void writeDefault(FILE * out, char * indent, > struct singleLine * line; > int i; > >+ dbgPrintf("writeDefault() entered\n"); > if (!cfg->defaultImage && cfg->flags == GRUB_CONFIG_NO_DEFAULT) return; > > if (cfg->defaultImage == DEFAULT_SAVED) >@@ -1556,6 +1573,7 @@ static void writeDefault(FILE * out, char * indent, > } > } > } >+ dbgPrintf("writeDefault() done\n"); > } > > static int writeConfig(struct grubConfig * cfg, char * outName, >@@ -1568,6 +1586,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName, > struct stat sb; > int i; > >+ dbgPrintf("writeConfig() to outName='%s'\n", outName); > if (!strcmp(outName, "-")) { > out = stdout; > tmpOutName = NULL; >@@ -1619,6 +1638,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName, > > line = cfg->theLines; > struct keywordTypes *defaultKw = getKeywordByType(LT_DEFAULT, cfg->cfi); >+ dbgPrintf("writeConfig(): outputting the new config file\n"); > while (line) { > if (line->type == LT_SET_VARIABLE && defaultKw && > line->numElements == 3 && >@@ -1648,6 +1668,7 @@ static int writeConfig(struct grubConfig * cfg, char * outName, > } > > if (needs & MAIN_DEFAULT) { >+ dbgPrintf("writeconfig() doing main default\n"); > writeDefault(out, cfg->primaryIndent, "=", cfg); > needs &= ~MAIN_DEFAULT; > } >@@ -1669,7 +1690,9 @@ static int writeConfig(struct grubConfig * cfg, char * outName, > } > } > >+ dbgPrintf("writeConfig() done\n"); > if (tmpOutName) { >+ dbgPrintf("writeConfig() renaming '%s' to '%s'\n", tmpOutName, outName); > if (rename(tmpOutName, outName)) { > fprintf(stderr, _("grubby: error moving %s to %s: %s\n"), > tmpOutName, outName, strerror(errno)); >@@ -1794,6 +1817,26 @@ void printEntry(struct singleEntry * entry, FILE *f) { > } > } > >+#if DEBUG >+void printEntries(struct grubConfig *cfg) { >+ struct singleEntry * entry; >+ int index = 0; >+ >+ entry = cfg->entries; >+ while (entry) { >+ if (!entry->skip) { >+ fprintf(stderr,"-------- entry=%i --------\n", index); >+ printEntry(entry, stderr); >+ fprintf(stderr,"-----end entry=%i --------\n", index); >+ index++; >+ } >+ else >+ fprintf(stderr,"-----skipping entry %i -----\n", index); >+ entry = entry->next; >+ } >+} >+#endif >+ > void notSuitablePrintf(struct singleEntry * entry, int okay, const char *fmt, ...) > { > static int once; >@@ -2935,6 +2978,7 @@ struct singleLine * addLine(struct singleEntry * entry, > /* NB: This function shouldn't allocate items on the heap, rather on the > * stack since it calls addLineTmpl which will make copies. > */ >+ dbgPrintf("addLine(): type=%i 0x%x\n", type, type); > if (type == LT_TITLE && cfi->titleBracketed) { > /* we're doing a bracketed title (zipl) */ > tmpl.type = type; >@@ -3852,11 +3896,15 @@ static char * getInitrdVal(struct grubConfig * config, > > prefixLen = strlen(prefix); > totalSize = strlen(newKernelInitrd) - prefixLen + 1 /* \0 */; >+ dbgPrintf("getInitrdVal() prefixlen=%i totalsize=%i, newKernelInitrd='%s'\n", >+ (int)prefixLen, (int)totalSize, >+ newKernelInitrd); > > for (i = 0; i < extraInitrdCount; i++) { > totalSize += sizeof(separatorChar); > totalSize += strlen(extraInitrds[i]) - prefixLen; > } >+ dbgPrintf("... totalSize with extra initrd %i\n", (int)totalSize); > > initrdVal = end = malloc(totalSize); > >@@ -3936,12 +3984,17 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > if (newDevTreePath && getKeywordByType(LT_DEVTREE, config->cfi)) > needs |= NEED_DEVTREE; > >+ dbgPrintf("addNewKernel(): needs=0x%x\n", needs); > if (template) { > for (masterLine = template->lines; > masterLine && (tmplLine = lineDup(masterLine)); > lineFree(tmplLine), masterLine = masterLine->next) > { >- dbgPrintf("addNewKernel processing %d\n", tmplLine->type); >+ dbgPrintf("addNewKernel processing %d, 0x%x '%s', needs=0x%x, operand='%s'\n", >+ tmplLine->type, tmplLine->type, >+ tmplLine->numElements ? tmplLine->elements[0].item : "", >+ needs, >+ tmplLine->numElements>1 ? tmplLine->elements[1].item : ""); > > /* skip comments */ > chptr = tmplLine->indent; >@@ -3950,6 +4003,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > > if (iskernel(tmplLine->type) && tmplLine->numElements >= 2) { > if (!template->multiboot && (needs & NEED_MB)) { >+ dbgPrintf("addNewKernel: multiboot template\n"); > /* it's not a multiboot template and this is the kernel > * line. Try to be intelligent about inserting the > * hypervisor at the same time. >@@ -3978,17 +4032,22 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > free(tmplLine->elements[0].item); > tmplLine->elements[0].item = strdup(mbm_kw->key); > } >+ dbgPrintf("addNewKernel processing #1, new kernel path='%s'\n", >+ newKernelPath); > newLine = addLineTmpl(new, tmplLine, newLine, > newKernelPath + strlen(prefix), config->cfi); > needs &= ~NEED_KERNEL; > } > if (needs & NEED_MB) { /* !mbHyperFirst */ >+ dbgPrintf("addNewKernel processing #2\n"); > newLine = addLine(new, config->cfi, LT_HYPER, > config->secondaryIndent, > newMBKernel + strlen(prefix)); > needs &= ~NEED_MB; > } > } else if (needs & NEED_KERNEL) { >+ dbgPrintf("addNewKernel processing #3, new kernel path='%s'\n", >+ newKernelPath); > newLine = addLineTmpl(new, tmplLine, newLine, > newKernelPath + strlen(prefix), config->cfi); > needs &= ~NEED_KERNEL; >@@ -3999,6 +4058,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > } else if (tmplLine->type == LT_HYPER && > tmplLine->numElements >= 2) { > if (needs & NEED_MB) { >+ dbgPrintf("addNewKernel processing #4 (LT_HYPER)\n"); > newLine = addLineTmpl(new, tmplLine, newLine, > newMBKernel + strlen(prefix), config->cfi); > needs &= ~NEED_MB; >@@ -4008,6 +4068,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > tmplLine->numElements >= 2) { > if (new->multiboot) { > if (needs & NEED_KERNEL) { >+ dbgPrintf("addNewKernel processing #5\n"); > newLine = addLineTmpl(new, tmplLine, newLine, > newKernelPath + > strlen(prefix), config->cfi); >@@ -4018,6 +4079,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > initrdVal = getInitrdVal(config, prefix, tmplLine, > newKernelInitrd, extraInitrds, > extraInitrdCount); >+ dbgPrintf("addNewKernel processing #6\n"); > newLine = addLineTmpl(new, tmplLine, newLine, > initrdVal, config->cfi); > free(initrdVal); >@@ -4032,6 +4094,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > tmplLine->elements[0].item = > strdup(getKeywordByType(tmplLine->type, > config->cfi)->key); >+ dbgPrintf("addNewKernel processing #7\n"); > newLine = addLineTmpl(new, tmplLine, newLine, > newKernelPath + strlen(prefix), > config->cfi); >@@ -4047,6 +4110,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > strdup(getKeywordByType(tmplLine->type, > config->cfi)->key); > initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); >+ dbgPrintf("addNewKernel processing #8\n"); > newLine = addLineTmpl(new, tmplLine, newLine, initrdVal, config->cfi); > free(initrdVal); > needs &= ~NEED_INITRD; >@@ -4064,6 +4128,8 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > char *initrdVal; > > initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); >+ dbgPrintf("addNewKernel processing #9, MBMODULE='%s'\n", >+ initrdVal); > newLine = addLine(new, config->cfi, LT_MBMODULE, > config->secondaryIndent, > initrdVal); >@@ -4073,6 +4139,8 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > } else if (needs & NEED_INITRD) { > char *initrdVal, *newInitrdVal = NULL; > initrdVal = getInitrdVal(config, prefix, tmplLine, newKernelInitrd, extraInitrds, extraInitrdCount); >+ dbgPrintf("addNewKernel processing #10, initrdVal='%s', svPrefix='%s'\n", >+ initrdVal, svPrefix ? svPrefix : ""); > if (svPrefix) { > newInitrdVal = alloca(strlen(svPrefix) + strlen(initrdVal)); > strcpy(newInitrdVal, svPrefix); >@@ -4092,18 +4160,21 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > strcpy(nkt, "'"); > strcat(nkt, newKernelTitle); > strcat(nkt, "'"); >+ dbgPrintf("addNewKernel processing #11, new='%s'\n", nkt); > newLine = addLineTmpl(new, tmplLine, newLine, nkt, config->cfi); > free(nkt); > needs &= ~NEED_TITLE; > } else if (tmplLine->type == LT_TITLE && > (needs & NEED_TITLE)) { > if (tmplLine->numElements >= 2) { >+ dbgPrintf("addNewKernel processing #12\n"); > newLine = addLineTmpl(new, tmplLine, newLine, > newKernelTitle, config->cfi); > needs &= ~NEED_TITLE; > } else if (tmplLine->numElements == 1 && > config->cfi->titleBracketed) { > /* addLineTmpl doesn't handle titleBracketed */ >+ dbgPrintf("addNewKernel processing #13\n"); > newLine = addLine(new, config->cfi, LT_TITLE, > tmplLine->indent, newKernelTitle); > needs &= ~NEED_TITLE; >@@ -4121,6 +4192,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > strcpy(newTitle, prefix); > strcat(newTitle, newKernelTitle); > strcat(newTitle, "'"); >+ dbgPrintf("addNewKernel processing #14\n"); > newLine = addLine(new, config->cfi, LT_ECHO, > tmplLine->indent, newTitle); > free(newTitle); >@@ -4154,6 +4226,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > /* don't have a template, so start the entry with the > * appropriate starting line > */ >+ dbgPrintf("addNewKernel processing no template, create something anyway\n"); > switch (config->cfi->entryStart) { > case LT_KERNEL: > case LT_KERNEL_EFI: >@@ -4225,6 +4298,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > removeLine(new, endLine); > needs |= NEED_END; > } >+ dbgPrintf("addNewKernel(): done loop, needs=0x%x\n", needs); > > /* add the remainder of the lines, i.e. those that either > * weren't present in the template, or in the case of no template, >@@ -4243,6 +4317,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > needs &= ~NEED_MB; > } > if (needs & NEED_KERNEL) { >+ dbgPrintf("addNewKernel processing #15\n"); > newLine = addLine(new, config->cfi, > (new->multiboot && getKeywordByType(LT_MBMODULE, > config->cfi)) >@@ -4293,6 +4368,12 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, > if (updateImage(config, "0", prefix, newKernelArgs, NULL, > newMBKernelArgs, NULL)) return 1; > >+#if DEBUG >+ fprintf(stderr,"--end of addNewKernel()-----\n"); >+ printEntry(new, stderr); >+ fprintf(stderr,"--end of addNewKernel()-----\n"); >+#endif >+ > return 0; > } > >@@ -4467,6 +4548,7 @@ int main(int argc, const char ** argv) { > strncat(saved_command_line, j == argc -1 ? "" : " ", 1); > } > >+ dbgPrintf("---> Begin grubby execution <------------------------------------\n"); > optCon = poptGetContext("grubby", argc, argv, options, 0); > poptReadDefaultConfig(optCon, 1); > >@@ -4815,6 +4897,9 @@ int main(int argc, const char ** argv) { > "Not writing out new config.\n")); > return 1; > } >+#if DEBUG >+ printEntries(config); >+#endif > > if (!outputFile) > outputFile = (char *)grubConfig; >-- >1.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1094489
:
892670
|
892671
|
893044
|
893046
|
903279
|
903280
|
903281
|
903283
|
906996
| 906997 |
906998
|
907052