Re: proc_register & proc_unregister

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

 



Denis Karpov wrote:
> 
> On Wed, Mar 21, 2001 at 04:31:31PM +0100, Giscard Wépiwé wrote:
> # Hallo everybody,
> # As it seems to be, proc_register und proc_unregister
> # are obsolete in kernel 2.4.x to create and delete a
> # /proc file entry.
> # Could someone tell me, what is the new alternative to
> # do it?
> # Thanks already for the help.
> 
> hi !
> below is code snippet (!typo proof :) that reguisters/unregisters proc
> entry MY_PROC_ENTRY_NAME right under /proc dir.
> hope that helps.

That example is not correct for kernel 2.4....  Attached is a message
from Al Viro describing procfs use.  Al Viro is the one who cleaned up
the procfs interface to be such, and these are now the recommend procfs
interface functions.

	Jeff


-- 
Jeff Garzik       | May you have warm words on a cold evening,
Building 1024     | a full mooon on a dark night,
MandrakeSoft      | and a smooth road all the way to your door.
--- Begin Message ---


On Sun, 10 Sep 2000, Arjan van de Ven wrote:

> Maybe you can find 5 minutes of time to write an example module that does
> nothing more than export 1 integer via proc, they way you want it. A lot
> of bad usages comes from "copying" other code, and having a "prefered"
> example hopefully helps a lot. 

Hey, 2.4 is already cleaned in that respect, so copying should be safe
these days...

Anyway, primer to procfs use:

To create a directory - proc_mkdir(path, from); from == NULL => from root.

To create a symlink - proc_symlink(path, from, contents) (ditto)

To create a special inode - proc_mknod(path, mode, from, dev) (ditto)

To create a regular file - create_proc_entry(path, mode, from) and set
->read_proc/->write_proc or ->get_info (as in old procfs).
Alternatively, use wrappers: create_proc_{read,info}_entry() (see
proc_fs.h).

To remove an entry - remove_proc_entry(path, from)

If you are in a module - set ->owner to THIS_MODULE.


--- End Message ---

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux