帮我解说一下struct file这个结构体,谢谢. linux中的?

来源:百度知道 编辑:UC知道 时间:2024/09/13 01:19:05
请结合此函数进行解释:

static int s3c2410_dcm_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
{
switch(cmd){

/*********write da 0 with (*arg) ************/
case DCM_IOCTRL_SETPWM:
return dcm_setpwm((int)arg);
}
return 0;
}

struct file结构体定义在/linux/include/linux/fs.h(Linux 2.6.11内核)中,其原型是:
struct file {
/*
* fu_list becomes invalid after file_free is called and queued via
* fu_rcuhead for RCU freeing
*/
union {
struct list_head fu_list;
struct rcu_head fu_rcuhead;
} f_u;
struct path f_path;
#define f_dentry f_path.dentry
#define f_vfsmnt f_path.mnt
const struct file_operations *f_op;
atomic_t f_count;
unsigned int f_flags;
mode_t f_mode;
loff_t f_pos;
struct fown_struct f_owner;
unsigned int f_uid, f_gid;
struct file_ra_state f_ra;
unsigned long f_version;
#ifdef CONFIG_SECURITY
void