On Mon, Jun 28, 2004 at 20:49:06 +0530, Siddhartha Jain wrote: > >> Also, what would be the place to place a function that reads a file at > >> kernel initialization? And where should the file be placed - > >/etc or /boot? > > > >Nowhere. Kernel must not read configuration files. You should have an > >interface (proc file, device or netlink socket) and feed the data by > >user-land utility. > > Ok, I wrote a small module that creates a file in /proc. I still have some > questions though. > > I want each line of the file to contain a source and destination directory. > Lets call the conf file foo. > > So, do I make the module read /etc/foo and create the /proc/foo file or > should a userland process write the contents /etc/foo to /proc/foo? You should cat /etc/foo >/proc/foo And then on the kernel side, you need the "write" method of the /proc/foo take the lines and convert them to whatever internal structures you need. The thing about proc file is to avoid reading files from kernel. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>
Attachment:
signature.asc
Description: Digital signature