|
version 1.3, 2001/08/13 05:51:45
|
version 1.4, 2001/08/13 06:01:31
|
|
|
|
| #include <linux/delay.h> | #include <linux/delay.h> |
| #include <linux/errno.h> | #include <linux/errno.h> |
| #include <linux/malloc.h> | #include <linux/malloc.h> |
| |
#include <linux/vmalloc.h> |
| #include <linux/types.h> | #include <linux/types.h> |
| #include <linux/fs.h> | #include <linux/fs.h> |
| #include <linux/poll.h> | #include <linux/poll.h> |
|
|
|
| | |
| /* figure out how much of a buffer this should be and allocate the buffer */ | /* figure out how much of a buffer this should be and allocate the buffer */ |
| einfo->size = 1024 * minor; | einfo->size = 1024 * minor; |
| if ((einfo->data = kmalloc(sizeof(char)*einfo->size, GFP_KERNEL))==NULL) |
if ((einfo->data = (char *) vmalloc(sizeof(char) * einfo->size)) == NULL) |
| goto data_malloc_failed; | goto data_malloc_failed; |
| | |
| /* init the rest of the structure */ | /* init the rest of the structure */ |
|
|
|
| return 0; | return 0; |
| | |
| other_failure: /* if we check for other errors later, jump here */ | other_failure: /* if we check for other errors later, jump here */ |
| kfree(einfo->data); |
vfree(einfo->data); |
| data_malloc_failed: | data_malloc_failed: |
| kfree(einfo); | kfree(einfo); |
| struct_malloc_failed: | struct_malloc_failed: |
|
|
|
| if (emlog_debug) | if (emlog_debug) |
| printk("freeing resources associated with inode %d\n", einfo->i_ino); | printk("freeing resources associated with inode %d\n", einfo->i_ino); |
| | |
| kfree(einfo->data); |
vfree(einfo->data); |
| | |
| /* now delete the 'einfo' structure from the linked list. 'ptr' is | /* now delete the 'einfo' structure from the linked list. 'ptr' is |
| * the pointer that needs to be changed... which is either the list | * the pointer that needs to be changed... which is either the list |