I'm working on kernel linux 2.6.34.14.
I added (in include/linux/fs.h) in struct file a pointer to a struct defined before, in this way:
struct session{
char *session_buffer;
loff_t session_dimension;
};
struct file {
struct session *sess_punt;
}
After that, I need to allocate my struct in open.c and do that in dentry_open (fs/open.c).
With this code I want to say: if there is a particular flag when open is called, then allocate the struct and the buffer in the struct.
if(f->f_flags & O_SESSION){
f->sess_punt = kmalloc(sizeof(struct session), GFP_KERNEL);
f->sess_punt -> session_buffer = kmalloc(MAX_BUFFER_SIZE, GFP_KERNEL);
//f->sess_punt -> session_dimension = 0;
}
else f->sess_punt = NULL;
The problem is the following:
I compile the new kernel and everything is fine. I try to entry in that kernel but I receive the message "kernel panic - not syncing: attempted to kill init".
Why?Where am I wrong?