01. kmalloc 宣告記憶體

01. kmalloc 宣告記憶體

宣告記憶體的使用方法

[php]
/* Buffer to store data */
char *memory_buffer;
int memory_init(void) {
/* Allocating memory for the buffer */
memory_buffer = kmalloc(1, GFP_KERNEL);
if (!memory_buffer)
result = -ENOMEM;
}else{
result = 0;
}
return result;
}
[/php]

Linux Driver
CH01 簡介CH02 註冊CH03 記憶體CH04 硬體函數CH05 USB