函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\livepatch\core.c Create Date:2022-07-27 11:30:03
首页 Copyright©Brick

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
static int klp_find_callback(void *data, const char *name,
                 struct module *mod, unsigned long addr)
{
    struct klp_find_arg *args = data;
 
    if ((mod && !args->objname) || (!mod && args->objname))
        return 0;
 
    if (strcmp(args->name, name))
        return 0;
 
    if (args->objname && strcmp(args->objname, mod->name))
        return 0;
 
    args->addr = addr;
    args->count++;
 
    /*
     * Finish the search when the symbol is found for the desired position
     * or the position is not defined for a non-unique symbol.
     */
    if ((args->pos && (args->count == args->pos)) ||
        (!args->pos && (args->count > 1)))
        return 1;
 
    return 0;
}