[NCLUG] Can anyone please help newbie kernel programmer ?

Gabriel L Somlo somlo at CS.ColoState.EDU
Mon Feb 26 13:20:21 MST 2001


Hi,

I'm trying to write a module that inserts  a read-only and a read-write
file into the /proc directory.

The example I've found works, but appears to use deprecated functions:

	- uses the "get_info" entry in the proc_dir_entry structure for
	  the read-only file

	- creates  open, release, read and write functions that are placed
	  into a file_operations structure inside an inode_operations
	  structure that is referenced in the ops member of the
	  proc_dir_entry when both reads and writes to the proc file must
	  be supported.

There's nothing wrong with these, except that I've noticed that since
kernel versions 2.2.x the struct proc_dir_entry in
	/usr/include/linux/proc_fs.h
now has some new members: read_proc, write_proc, etc.

I'm new at this, and therefore not particularly adept at reading kernel
code, but it looks to me as if read_proc is used instead of get_info to
supply information to processes reading the proc file. I haven't been able
to find anything conclusive on write_proc yet.

My questions, therefore, are:

	- Is read_proc intended to replace get_info as the function  that
	  gets called when the proc_file is read ?

	- is the  read_proc / write_proc duo intended to replace the
	  open/close/read/write  file_operations within inode_operations
	  mechanism that gets placed into the proc_dir_entry for
	  read-write access to the proc file ?


Any ideas and pointers much appreciated,

	Gabriel




More information about the NCLUG mailing list