MCPcopy Create free account
hub / github.com/coreboot/coreboot / cbfs_module_redraw

Function cbfs_module_redraw

payloads/coreinfo/cbfs_module.c:110–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110static int cbfs_module_redraw(WINDOW * win)
111{
112 struct cbfile *f;
113 int i, row, frow;
114
115 print_module_title(win, "CBFS Listing");
116
117 if (!header) {
118 mvwprintw(win, 11, 61 / 2, "Bad or missing CBFS header");
119 return 0;
120 }
121
122 /* Draw a line down the middle. */
123 for (i = 2; i < 21; i++)
124 mvwaddch(win, i, 30, ACS_VLINE);
125
126 /* Draw the names down the left side. */
127 for (frow = 0; frow < FILES_VISIBLE; frow++) {
128 row = 2 + frow;
129 i = start_row + frow;
130 if (i >= filecount)
131 break;
132 if (i == selected)
133 wattrset(win, COLOR_PAIR(3) | A_BOLD);
134 else
135 wattrset(win, COLOR_PAIR(2));
136
137 if (strlen(filenames[i]) == 0) {
138 if (findfile(filenames[i])->type == COMPONENT_NULL)
139 mvwprintw(win, row, 1, "<free space>");
140 else
141 mvwprintw(win, row, 1, "<unnamed>");
142 } else {
143 mvwprintw(win, row, 1, "%.25s", filenames[i]);
144 }
145 /* show scroll arrows */
146 if (frow == 0 && start_row > 0) {
147 wattrset(win, COLOR_PAIR(2));
148 mvwaddch(win, row, 28, ACS_UARROW);
149 }
150 if (frow == FILES_VISIBLE - 1 && i != filecount - 1) {
151 wattrset(win, COLOR_PAIR(2));
152 mvwaddch(win, row, 28, ACS_DARROW);
153 }
154 }
155
156 f = findfile(filenames[selected]);
157 if (!f) {
158 mvwprintw(win, 11, 32, "ERROR: CBFS component not found");
159 return 0;
160 }
161
162 wattrset(win, COLOR_PAIR(2));
163
164 /* Draw the file information */
165 row = 2;
166 /* mvwprintw(win, row++, 32, "Offset: 0x%x", f->offset); *//* FIXME */
167 mvwprintw(win, row, 32, "Type: ");

Callers

nothing calls this directly

Calls 6

print_module_titleFunction · 0.85
mvwaddchFunction · 0.85
wattrsetFunction · 0.85
strlenFunction · 0.85
findfileFunction · 0.85
mvwprintwFunction · 0.50

Tested by

no test coverage detected