Skip to content

Commit

Permalink
Fix typos in offset_table and missing "help -o" items
Browse files Browse the repository at this point in the history
A few of zram related members in the offset_table have typos and
irregular naming rule, also they are not present in the "help -o"
output.  Let's fix these.

Signed-off-by: Kazuhito Hagio <[email protected]>
  • Loading branch information
k-hagio committed Nov 27, 2023
1 parent 38acd02 commit d65e5d3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
8 changes: 4 additions & 4 deletions defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2112,13 +2112,13 @@ struct offset_table { /* stash of commonly-used offsets */
long bpf_prog_aux_name;
long page_private;
long swap_info_struct_bdev;
long zram_mempoll;
long zram_mem_pool;
long zram_compressor;
long zram_table_flag;
long zspoll_size_class;
long zram_table_entry_flags;
long zs_pool_size_class;
long size_class_size;
long gendisk_private_data;
long zram_table_entry;
long zram_table_entry; /* unused; but cannot remove */
long module_core_size_rw;
long module_core_size_rx;
long module_init_size_rw;
Expand Down
24 changes: 12 additions & 12 deletions diskdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -2765,15 +2765,15 @@ zram_init(void)
{
long zram_flag_shift;

MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
MEMBER_OFFSET_INIT(zram_mem_pool, "zram", "mem_pool");
MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
if (INVALID_MEMBER(zram_compressor))
MEMBER_OFFSET_INIT(zram_comp_algs, "zram", "comp_algs");
MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
if (INVALID_MEMBER(zram_table_flag))
MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "value");
MEMBER_OFFSET_INIT(zram_table_entry_flags, "zram_table_entry", "flags");
if (INVALID_MEMBER(zram_table_entry_flags))
MEMBER_OFFSET_INIT(zram_table_entry_flags, "zram_table_entry", "value");
STRUCT_SIZE_INIT(zram_table_entry, "zram_table_entry");
MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(zs_pool_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");
MEMBER_OFFSET_INIT(zspage_huge, "zspage", "huge");

Expand Down Expand Up @@ -2826,7 +2826,7 @@ zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
if (zs_magic != ZSPAGE_MAGIC)
error(FATAL, "zspage magic incorrect: %x\n", zs_magic);

class = pool + OFFSET(zspoll_size_class);
class = pool + OFFSET(zs_pool_size_class);
class += (class_idx * sizeof(void *));
readmem(class, KVADDR, &class, sizeof(void *), "size_class", FAULT_ON_ERROR);
readmem(class + OFFSET(size_class_size), KVADDR,
Expand Down Expand Up @@ -2987,9 +2987,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
ulong zram, zram_table_entry, sector, index, entry, flags, size,
outsize, off;

if (INVALID_MEMBER(zram_mempoll)) {
if (INVALID_MEMBER(zram_mem_pool)) {
zram_init();
if (INVALID_MEMBER(zram_mempoll)) {
if (INVALID_MEMBER(zram_mem_pool)) {
error(WARNING,
"Some pages are swapped out to zram. "
"Please run mod -s zram.\n");
Expand All @@ -3013,8 +3013,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
readmem(zram, KVADDR, &zram_table_entry,
sizeof(void *), "zram_table_entry", FAULT_ON_ERROR);
zram_table_entry += (index * SIZE(zram_table_entry));
readmem(zram_table_entry + OFFSET(zram_table_flag), KVADDR, &flags,
sizeof(void *), "zram_table_flag", FAULT_ON_ERROR);
readmem(zram_table_entry + OFFSET(zram_table_entry_flags), KVADDR, &flags,
sizeof(void *), "zram_table_entry.flags", FAULT_ON_ERROR);
if (VALID_MEMBER(zram_compressor))
readmem(zram + OFFSET(zram_compressor), KVADDR, name, sizeof(name),
"zram compressor", FAULT_ON_ERROR);
Expand Down Expand Up @@ -3072,8 +3072,8 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
goto out;
}

readmem(zram + OFFSET(zram_mempoll), KVADDR, &zram,
sizeof(void *), "zram_mempoll", FAULT_ON_ERROR);
readmem(zram + OFFSET(zram_mem_pool), KVADDR, &zram,
sizeof(void *), "zram.mem_pool", FAULT_ON_ERROR);

obj_addr = zram_object_addr(zram, entry, zram_buf);
if (obj_addr == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ vm_init(void)
"swap_info_struct", "old_block_size");
MEMBER_OFFSET_INIT(swap_info_struct_bdev, "swap_info_struct", "bdev");

MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(zs_pool_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");

MEMBER_OFFSET_INIT(block_device_bd_inode, "block_device", "bd_inode");
Expand Down
12 changes: 12 additions & 0 deletions symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -10304,6 +10304,7 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(page_active));
fprintf(fp, " page_compound_head: %ld\n",
OFFSET(page_compound_head));
fprintf(fp, " page_private: %ld\n", OFFSET(page_private));

fprintf(fp, " trace_print_flags_mask: %ld\n",
OFFSET(trace_print_flags_mask));
Expand All @@ -10330,6 +10331,7 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(swap_info_struct_inuse_pages));
fprintf(fp, "swap_info_struct_old_block_size: %ld\n",
OFFSET(swap_info_struct_old_block_size));
fprintf(fp, " swap_info_struct_bdev: %ld\n", OFFSET(swap_info_struct_bdev));
fprintf(fp, " block_device_bd_inode: %ld\n",
OFFSET(block_device_bd_inode));
fprintf(fp, " block_device_bd_list: %ld\n",
Expand Down Expand Up @@ -11359,6 +11361,8 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(gendisk_part0));
fprintf(fp, " gendisk_queue: %ld\n",
OFFSET(gendisk_queue));
fprintf(fp, " gendisk_private_data: %ld\n", OFFSET(gendisk_private_data));

fprintf(fp, " hd_struct_dev: %ld\n",
OFFSET(hd_struct_dev));
fprintf(fp, " hd_struct_dkstats: %ld\n",
Expand Down Expand Up @@ -11765,6 +11769,14 @@ dump_offset_table(char *spec, ulong makestruct)
fprintf(fp, " maple_metadata_end: %ld\n", OFFSET(maple_metadata_end));
fprintf(fp, " maple_metadata_gap: %ld\n", OFFSET(maple_metadata_gap));

fprintf(fp, " zram_mem_pool: %ld\n", OFFSET(zram_mem_pool));
fprintf(fp, " zram_compressor: %ld\n", OFFSET(zram_compressor));
fprintf(fp, " zram_comp_algs: %ld\n", OFFSET(zram_comp_algs));
fprintf(fp, " zram_table_entry_flags: %ld\n", OFFSET(zram_table_entry_flags));
fprintf(fp, " zs_pool_size_class: %ld\n", OFFSET(zs_pool_size_class));
fprintf(fp, " size_class_size: %ld\n", OFFSET(size_class_size));
fprintf(fp, " zspage_huge: %ld\n", OFFSET(zspage_huge));

fprintf(fp, "\n size_table:\n");
fprintf(fp, " page: %ld\n", SIZE(page));
fprintf(fp, " page_flags: %ld\n", SIZE(page_flags));
Expand Down

0 comments on commit d65e5d3

Please sign in to comment.