modify the kernel and compiled but got "dereferencing pointer to incomplete type" err
Hi,
I modified the write() function in linux kernel as follows:
static ssize_t write(struct file *file, const char __user *userbuf,
size_t bytes, loff_t *off)
{ struct bin_buffer *bb = file->private_data;
struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
int uid=dentry->d_inode->i_uid;
loff_t offs = *off;
int count = min_t(size_t, bytes, PAGE_SIZE);
char *temp;
...
if ((current_euid()!=uid)&&(dentry->d_inode.i_iflag==1)offs=size;/*I added the line where happened*/
...
}
Because I want to know the current user id when doing write function,I used current_euid() to access the current user id.I also included the definition file for current_euid() as follows:
#include <linux/cred.h>
But when I compiled the kernel, I got such error,
"fs/sysfs/bin.c: In function ‘write’:
fs/sysfs/bin.c:175: error: dereferencing pointer to incomplete type
"
The definition for current_euid() is in linux/cred.h as follows:
#define current_euid() (current_cred_xxx(euid))
I don't know how to fix the problem or is there any other way to access current user id in write function?
Thank you.
Last edited by kindlike; 01-09-2010 at 03:43 PM.
|