Module programming - /proc fs related query .

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

 



hi all,
              i'am new to module programming and was reading lkmpg .I
read some stuff
              relating to the /proc filesystem.i have some doubts here.

1) struct proc_dir_entry {
 ....
        ....
 struct file_operations * proc_fops;
 ....
 void *data;
 read_proc_t *read_proc;
 write_proc_t *write_proc;
 .....
 .....
   };

1)  Now why do we need read_proc and write_proc here ? proc_fops can be
initialise to read,write ...etc function to read and write from  the
proc file right ? then why read_proc and write_proc ? I'am sure ive
missed something here ..

2)  I initialise read_proc as below .
    struct proc_dir_entry *temp_proc_file;
    temp_proc_file->read_proc = procfile_read;


    int procfile_read(char *buffer,
                  char **buffer_location,
                  off_t offset,
                  int buffer_length,
                  int zero) {

   what does char **buffer_location and char *buffer mean here ?
   i tried :

            *buffer_location = my_buffer;  /* as given in the example */

            it works fine when i do a cat /proc/myfile - it displays
whatever is
            there in my_buffer (i.e set by me ).

            But where is **buffer_location actually ? and please let me
know what char *buffer means up there .

   Hope i was clear. Thanks for u r time.

cheers,
Amith


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux