Actions
Feature #4636
open026: Gendisk alloc,del,add,put
Status:
New
Priority:
Normal
Assignee:
-
Start date:
12/12/2013
Due date:
% Done:
0%
Estimated time:
Published in build:
Description
Releasing resources of gendisk interface¶
DESCRIPTION¶
The resources of gendisk interface should be released correctly. Otherwise it may lead to memory leaks and other errors caused by accessing nonexistent elements of gendisk.
For functions `alloc_disk`, `add_disk` it is required to use corresponding `put_disk`, `del_disk`.
EXAMPLE¶
Correct usage example:
struct gendisk* gd; int init_module() { ... gd=alloc_disk(32 /*the number of minor devices*/); //further initialization of gendisk gd->first_minor=0; ... } void module_exit() { ... //finishing work of gendisk and releasing resources del_gendisk(gd); //switch off object interface put_disk(gd); //free memory }
Actions