From the linux kernel scripts/mod/modpost.c:
static int is_vmlinux(const char *modname)
{
const char *myname;
myname = strrchr(modname, '/');
if (myname)
myname++;
else
myname = modname;
return (strcmp(myname, "vmlinux") == 0) ||
(strcmp(myname, "vmlinux.o") == 0);
}
How I understand:
This is defining the pointer to type of char and the const modifier. This pointer cannot be changed. But on the next lines we change the pointer.
Is it correct? Looks like no. :(
Why in this code use const? What doing here const? Can we write it without const?