Monkey-patching libahci

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a Thecus N5550 NAS with an ICH10R AHCI controller.  5 of the AHCI
ports are used for "data" drives, and each of these has an activity LED
which is driven by one of the ICH GPIOs.  (The other AHCI port is used
by the internal SATA DOM.)

In order to make the LEDs actually blink, I am wrapping libahci's
qc_issue function to blink the LED that corresponds to a given command's
port (if any):


https://github.com/ipilcher/n5550/blob/master/modules/n5550_ahci_leds.c#L177

I "hook in" the wrapper function by ensuring that my module is loaded
immediately after libahci (via modprobe configuration) and directly
modifying ahci_ops.qc_issue.  I do everything I can think of to make
sure that no other libahci users are loaded while I'm making the
changes.


https://github.com/ipilcher/n5550/blob/master/modules/n5550_ahci_leds.c#L207

I also prevent my module from being unloaded when any other libahci
users are loaded.  The module keeps an additional reference to itself,
which is released when the hook is successfully disabled via sysfs.


https://github.com/ipilcher/n5550/blob/master/modules/n5550_ahci_leds.c#L79

This definitely works, and it allows me to use pre-packaged kernels on
this system (ELRepo kernel-lt on CentOS 6 and hopefully the CentOSPlus
kernel on CentOS 7), but it sure does feel ugly and hackish.

Short of patching and rebuilding the libahci or ahci modules, is there a
better way to do this?  (Keeping in mind that I'm not worried about
supporting any other hardware configuration.)

Thanks!

-- 
========================================================================
Ian Pilcher                                         arequipeno@xxxxxxxxx
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux