Include/linux/stringify.h:
#ifndef __linux_stringify_h
#define __LINUX_STRINGIFY_H/
* Indirect stringification. Doing two levels allows the parameter to be a
* macro itself. For example, compile With-dfoo=bar, __stringify (FOO)
* converts to "bar".
* *
#define __STRINGIFY_1 (x ...) #x
#define __STRINGIFY (x. ) __stringify_1 (x)
#endif/ *!__linux_stringify_h * *
Look at the source code above,
__stringify (x ...) the actual expansion of this macro is: #x
The effect is actually to convert x directly into a string. The return value is the string, not the variable name.
Such as
#define __ATTR (_name,_mode,_show,_store) {/
. ATTR = {. Name = __stringify (_name),. Mode = _mode},/
. Show = _sh ow, /
. store = _store, /
}
Suppose we use __attr this way:
__attr (Var_name, 777, show_function, store_function)
The value that is actually copied to. Attr.name is "Var_name", not the value represented by the Var_name variable.