(Cross-posted to PLUG since most of this e-mail isn't a newbie issue
anymore)
On Wed, 9 May 2001 at 19:52, jon wrote:
> paano ba mag-kabit ng device ng naka-on ang computer? ginawa ko sa
> cd-rom ayaw bumukas, tapos nung ni-reset ko, ok na lahat.
I do not think most IDE controllers supports hot swapping (additional or
removal of devices while the system is running). AFAIK SCSI supports this
in general. Also, certain IDE controllers like the 3Ware Escalade IDE RAID
controllers support hot swapping. (Of course someone please correct me if
I'm wrong on the first two assertions).
> pahabol, paano ba gumawa ng link na parang lsmod, na link sa insmod
> pero lsmod != insmod di ba?
I presume you're interested in coming up with someting like:
-rwxr-xr-x 1 root root 50108 Feb 17 10:16 depmod
-rwxr-xr-x 1 root root 85564 Feb 17 10:16 insmod
lrwxrwxrwx 1 root root 6 Feb 26 21:03 lsmod -> insmod
lrwxrwxrwx 1 root root 6 Feb 26 21:03 rmmod -> insmod
with the two symlinks lsmod and rmmod invoking a modified action in the
original insmod binary. At first I didn't get your question, then I looked
at the *mod files in /sbin and found this particularly intriguing setup.
Yes, you're right, lsmod and insmod are not the same, in terms of
function, anyway. As far as the filesystem sees it, however, lsmod and
rmmod are simply soft links to the insmod binary. I even tried creating my
own softlinks:
----------[ Begin Shell View ]----------
jijo@kalapati:~$ ln -s /sbin/insmod lsmod
jijo@kalapati:~$ ./lsmod
Module Size Used by
ppp_deflate 39840 0 (autoclean)
bsd_comp 4256 0 (autoclean)
ppp_async 6064 1 (autoclean)
ppp_generic 15776 3 (autoclean) [ppp_deflate bsd_comp
ppp_async]
slhc 4640 1 (autoclean) [ppp_generic]
nls_iso8859-1 2880 0 (autoclean)
nls_cp437 4384 0 (autoclean)
vfat 10608 0 (autoclean)
fat 30560 0 (autoclean) [vfat]
opl3 11408 0 (unused)
opl3sa2 7712 0
ad1848 16864 0 [opl3sa2]
mpu401 18912 0 [opl3sa2]
ltmodem 361408 1
jijo@kalapati:~$ mv lsmod rmmod
jijo@kalapati:~$ ./rmmod
Usage:
rmmod [-aehrsvV] module ...
-a, --all Remove all unused modules
-e, --persist Save persistent data, do not unload module
-r, --stacks Remove stacks, starting at the named module
-s, --syslog Use syslog for error messages
-h, --help Print this message
-v, --verbose Be verbose
-V, --version Print the release version number
----------[ End Shell View ]----------
Unfortunately /sbin/insmod is a binary and I don't have the source on
hand, but it looks like this is a "trick" (although technically it's not).
It's nothing special with the softlink. On the other hand, the binary
seems to have been designed in such a way that it looks at the name of the
command executed to see which function within the program is to be
executed.
Either that or this is indeed a trick that the kernel has a hand in.
I tried something crazy:
----------[ Begin Shell View ]----------
jijo@kalapati:~$ mv rmmod wahmod
jijo@kalapati:~$ ./wahmod
The insmod/modprobe/rmmod/ksyms/lsmod/kallsyms combined binary does not
have a recognisable name, the name must contain one of insmod, modprobe,
rmmod, ksyms, lsmod or kallsyms.
----------[ End Shell View ]----------
So now we know it's called a "combined binary". Perhaps someone's got some
techie answer to this. Interesting trivial thingie, for me at least. :)
--> Jijo
---
Linux, MS-DOS, and Windows NT ...
... also known as the Good, the Bad, and the Ugly
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]
To subscribe to the Linux Newbies' List: send "subscribe" in the body to
[EMAIL PROTECTED]