Skip to contentSkip to conversation

dereferencing module-internal pointer in scripts/mod/file2alias.c

DISCUSSION Dominik Brodowski 2 participants 2 messages Mar 8, 2005 – Mar 16, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

Is there any feasible way to dereference a pointer inside __mod_*_device_table which points to a string?

e.g.:

include/linux/mod_devicetable.h:

struct pcmcia_device_id {
	...
	const char * prod_id;
	...
}

drivers/some/driver.c:

static struct pcmcia_device_id some_ids[] = {
	{.prod_id = "some device string", ...},
	...
}

MODULE_DEVICE_TABLE(some_ids);

scripts/mod/file2alias.c:

do_pcmcia_entry (..., struct pcmcia_device_id *id, ...)

{
	const char *tmp = id->prod_id + SOME_MAGIC_VALUE;
}

Thanks,
Dominik

#1 lore raw
Quoted 4 lines · Dominik Brodowski

Hi,

Is there any feasible way to dereference a pointer inside __mod_*_device_table which points to a string?

No, because we would basically need to perform relocations to do so. That is why arrays are used in the current structures.

Rusty.

Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman