some /proc understandings
From: linux lover
Date: Wed Mar 02 2005 - 01:18:45 EST
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
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/