RFC: new utility, kmodpatch

Christoph Mallon christoph.mallon at gmx.de
Thu Jan 1 20:27:55 UTC 2009


Luigi Rizzo schrieb:
> In a nutshell, the kmodpatch utility can print or alter the content
> of device/quirk tables in kernel modules (I think Linux has some
> similar tool, though i don't remember the name -- or perhaps it is
> a feature of insmod ?).

This looks useful for experimentation.

> Feedback welcome.

Attached is a slightly cleaned up version of your tool. I style(9)ified 
it a bit, added const and static, removed unused stuff (asm("jmp 
foo")?), added error checks in some places, which were missing, and 
ensured that the table read in from file is NUL-terminated. I also 
marked one place with XXX, where I think there is an off-by-one error.

> DESCRIPTION
> [...]
>      A couple of real life examples:
> 
>      kmodpatch umass.ko - @0 0x4050 0x4a5 0x0101 0x4200
>          set the kernel to use flags UMASS_PROTO_SCSI | UMASS_PROTO_BBB and
>          quirks WRONG_CSWSIG | NO_SYNCHRONIZE_CACHE for a certain GSM phone
>          that implements the umass interface;
> 
>      kmodpatch uscanner.ko - @0 0x04b8 0x084a 0
>          let uscanner.ko recognise a newly introduced MFP scanner device.

I think, this should be moved into the EXAMPLES section.


Regards
	Christoph


PS: Hopefully you haven't forgotten my patch.


More information about the freebsd-current mailing list