[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Crash-utility] [PATCH 0/2] The new API about ikconfig.



Hi,

I would like to suggest new ikconfig's API from defs.h.

The get_kernel_config("config name without CONFIG_ prefix", &val)
will return one of target kernel configurations.
If val == NULL, return value is poinited whether config is valid or not.
 IKCONFIG_N: kernel config is not set (not valid).
 IKCONFIG_Y: kernel config is set y (valid).
 IKCONFIG_M: kernel config is set m (valid).
 IKCONFIG_STR: kernel config is values or strings, etc (valid).

API require CONFIG_IKCONFIG=y. Otherwise user is warned.

I think it is useful for such as extension module developers
to write kernel config switch code.

Although ifdef or symbol APIs can be used instead,
I believe using this API can write more impressive or flexible code
about kernel config depended parts (over my senses...).

Thanks,
Toshi.
-----------------------------------------------------------

Example usage: Resolve RADIX_TREE_MAP_SHIFT from config depends.

[ code of kernel-2.6.35 ]

#define RADIX_TREE_MAP_SHIFT    (CONFIG_BASE_SMALL ? 4 : 6)

[ code of crash utility or extension modules ]

static int radix_tree_map_shift = 6;
#define RADIX_TREE_MAP_SHIFT     radix_tree_map_shift

int _init(void)
{
        read_in_kernel_config(IKCFG_SETUP);

        if (get_kernel_config("BASE_SMALL", NULL) == IKCONFIG_Y)
                radix_tree_map_shift = 4;

        return 0;
}

int int _fini(void)
{
        read_in_kernel_config(IKCFG_FREE);

        return 0;
}

Toshikazu Nakayama (2):
  new ikconfig API.
  dump_kernel_table()

 crash-5.1.1/defs.h   |   13 ++++
 crash-5.1.1/kernel.c |  166 +++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 178 insertions(+), 1 deletions(-)

-- 
1.7.4.rc2

Attachment: 0001-new-ikconfig-API~1.patch
Description: Binary data

Attachment: 0002-dump_kernel_table.patch
Description: Binary data


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]