Skip to content

Commit be9f613

Browse files
committed
scripts/kallsyms: rename local variables in read_symbol()
I will use 'sym' for the point to struce sym_entry in the next commit. Rename 'sym', 'stype' to 'name', 'type', which are more intuitive. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 5f2fb52 commit be9f613

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

scripts/kallsyms.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,43 +176,43 @@ static void check_symbol_range(const char *sym, unsigned long long addr,
176176

177177
static int read_symbol(FILE *in, struct sym_entry *s)
178178
{
179-
char sym[500], stype;
179+
char name[500], type;
180180
int rc;
181181

182-
rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, sym);
182+
rc = fscanf(in, "%llx %c %499s\n", &s->addr, &type, name);
183183
if (rc != 3) {
184-
if (rc != EOF && fgets(sym, 500, in) == NULL)
184+
if (rc != EOF && fgets(name, 500, in) == NULL)
185185
fprintf(stderr, "Read error or end of file.\n");
186186
return -1;
187187
}
188-
if (strlen(sym) >= KSYM_NAME_LEN) {
188+
if (strlen(name) >= KSYM_NAME_LEN) {
189189
fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n"
190190
"Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
191-
sym, strlen(sym), KSYM_NAME_LEN);
191+
name, strlen(name), KSYM_NAME_LEN);
192192
return -1;
193193
}
194194

195-
if (is_ignored_symbol(sym, stype))
195+
if (is_ignored_symbol(name, type))
196196
return -1;
197197

198198
/* Ignore most absolute/undefined (?) symbols. */
199-
if (strcmp(sym, "_text") == 0)
199+
if (strcmp(name, "_text") == 0)
200200
_text = s->addr;
201201

202-
check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges));
203-
check_symbol_range(sym, s->addr, &percpu_range, 1);
202+
check_symbol_range(name, s->addr, text_ranges, ARRAY_SIZE(text_ranges));
203+
check_symbol_range(name, s->addr, &percpu_range, 1);
204204

205205
/* include the type field in the symbol name, so that it gets
206206
* compressed together */
207-
s->len = strlen(sym) + 1;
207+
s->len = strlen(name) + 1;
208208
s->sym = malloc(s->len + 1);
209209
if (!s->sym) {
210210
fprintf(stderr, "kallsyms failure: "
211211
"unable to allocate required amount of memory\n");
212212
exit(EXIT_FAILURE);
213213
}
214-
strcpy(sym_name(s), sym);
215-
s->sym[0] = stype;
214+
strcpy(sym_name(s), name);
215+
s->sym[0] = type;
216216

217217
s->percpu_absolute = 0;
218218

0 commit comments

Comments
 (0)