[ale] Programming /proc
Bao C. Ha
baoha at sensoria.com
Thu Nov 15 13:06:45 EST 2001
Since /proc is a pseudo-filesystem, I look for it in
<linux/fs.h>.
struct file {
struct list_head f_list;
struct dentry *f_dentry;
struct vfsmount *f_vfsmnt;
struct file_operations *f_op;
atomic_t f_count;
unsigned int f_flags;
mode_t f_mode;
loff_t f_pos;
unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
struct fown_struct f_owner;
unsigned int f_uid, f_gid;
int f_error;
unsigned long f_version;
/* needed for tty driver, and maybe others */
void *private_data;
/* preallocated helper kiobuf to speedup O_DIRECT */
struct kiobuf *f_iobuf;
long f_iobuf_lock;
};
Bao
> -----Original Message-----
> From: Benjamin Dixon [mailto:beatle at arches.uga.edu]
> Sent: Wednesday, November 14, 2001 10:58 PM
> To: ale at ale.org
> Subject: [ale] Programming /proc
>
>
>
> Hi all,
>
> I'm trying to write a kernel module that has proc support but I don't
> fully understand the new calling procedures under 2.4. I have
> successfully
> set up my module code (easy enough) and now I want to let the
> user access
> some information using my output function which I register
> for "read" in a
> file_operations structure. So my function prototype looks like this:
>
> static ssize_t output(struct file *file, char *buffer, size_t len,
> loff_t *offset);
>
> My only problem is, I'm not entirely sure how to handle the
> *file. Does
> anyone know where that structure is defined? I've searched through the
> kernel, specifically includes, but can't find it. And more
> generally, does
> anyone know of a good resource for *2.4 kernel* /proc
> programming, its a
> bit different from 2.2 and previous kernels and I can't find
> any updated
> information. (BTW, I did find a procfs_example.c file in the
> Documentation
> directory but it doesn't tell me what I want to know, which
> is what those
> structures look like).
>
> Ben
>
>
> ---
> This message has been sent through the ALE general discussion list.
> See http://www.ale.org/mailing-lists.shtml for more info.
> Problems should be
> sent to listmaster at ale dot org.
>
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list