[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
some /proc understandings
Hello,
1) I want to know how much can i write to
/proc entry file?? Is there any limitation on file
size???
2)Also how can i call /proc entry files
proc_read_myfile function on that file by another
kernel module call? What parameters i require to pass
and how? Say i have read functions as
struct myfile_data_t {
char value[8];
};
struct proc_dir_entry *myfile_file;
struct myfile_data_t myfile_data;
int proc_read_myfile(char *page, char **start, off_t
off, int count, int *eof, void *data)
{
int len;
/* cast the void pointer of data to myfile_data_t*/
struct myfile_data_t *myfile_data=(struct
myfile_data_t *)data;
/* use sprintf to fill the page array with a string */
len = sprintf(page, "%s", myfile_data->value);
return len;
}
Then can it possible that i can call proc_read_myfile
from another kernel module?? Instead read file from
user level call?
3) Also Is following code valid of creating /proc
files with different file name created by passing
function cr_proc(fname)?
struct proc_dir_entry *entnew;
int cr_proc(char *fname)
{
if ((entnew1 = create_proc_entry(fname,
S_IRUGO | S_IWUSR, NULL)) == NULL)
return -EACCES;
entnew1->proc_fops = &proc_file_operations;
}
static struct file_operations proc_file_operations = {
open: proc_open,
release: proc_release,
read: proc_read,
write: proc_write,
};
What will happen if dynamic file names are going
to use same all above 4 functions???
regards,
linux_lover
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/