From owner-freebsd-current@FreeBSD.ORG Thu Jan 1 20:27:55 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63326106564A for ; Thu, 1 Jan 2009 20:27:55 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id A79C98FC17 for ; Thu, 1 Jan 2009 20:27:54 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 01 Jan 2009 20:01:11 -0000 Received: from p54A3CB57.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.203.87] by mail.gmx.net (mp005) with SMTP; 01 Jan 2009 21:01:11 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+IahVy0qWIis6GK9r4/tioy2yEr9qeMEagR49wdQ OmmeeLI9m2qRcO Message-ID: <495D2106.2090403@gmx.de> Date: Thu, 01 Jan 2009 21:01:10 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.18 (X11/20081124) MIME-Version: 1.0 To: Luigi Rizzo References: <20090101183026.GA15385@onelab2.iet.unipi.it> In-Reply-To: <20090101183026.GA15385@onelab2.iet.unipi.it> Content-Type: multipart/mixed; boundary="------------040209030708000900040003" X-Y-GMX-Trusted: 0 X-FuHaFi: 0.5 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: current@freebsd.org Subject: Re: RFC: new utility, kmodpatch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jan 2009 20:27:55 -0000 This is a multi-part message in MIME format. --------------040209030708000900040003 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------040209030708000900040003--