Messages in this thread | | | From | Neil Brown <> | Date | Fri, 1 Sep 2006 12:02:52 +1000 | Subject | RFC - sysctl or module parameters. |
| |
There are so many ways to feed configuration parameters into the kernel these days. There is sysctl. There is sysfs. And there are module paramters. (procfs? who said procfs? I certainly didn't).
I have a module - let's call it 'lockd'. I want to make it configurable - say to be able to identify peers by IP address (as it currently does) or host name (good for multi homed peers, if you trust them).
And I want Jo Sysadmin to be able to set some simple configuration setting somewhere and have it 'just work'.
Options: - I could make it a module parameter: use_hostnames, and tell Jo to put options lockd use_hostnames=yes in /etc/modprobe.d/lockd if that is what (s)he wants. But that won't work if the module is compiled in (will it?).
- I could make a sysctl /proc/sys/fs/nfs/nsm_use_hostnames at tell Jo to put fs.nfs.nsm_use_hostnames=1 if /etc/sysctl.conf if desired. But that wouldn't work if lockd is a module that is loaded after "/usr/sbin/sysctl -p" has been run.
- I could do both and tell Jo to make both changes, just in case, but that is rather ugly, though that is what we currently do for nlm_udpport, nlm_tcpport, nlm_timeout, nlm_grace_period.
It occurs to me that since we have /sys/module/X/parameters, it wouldn't be too hard to have some functionality, possibly in modprobe, that looked for all the 'options' lines in modprobe config files, checked to see if the modules was loaded, and then imposed those options that could be imposed.
Thus we could just have a module option, just add module config information to /etc/modprobe.d and run modprobe --apply-option-to-active-modules at the same time as "sysctl -p" and it would all 'just work' whether the module were compiled in to not.
Is that a reasonable idea?
(I'll probably add both a sysctl and a mod param for my current problem, but I'd love it if there were a better approach possible in the future).
Thanks, NeilBrown - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |