- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# drivers/block/core.c

Go to the documentation of this file.

    00001
    00041 #include <assert.h>
    00042 #include <debug.h>
    00043 #include <malloc.h>
    00044 #include <string.h>
    00045 #include <types.h>
    00046 #include <block/device.h>
    00047
    00056 struct block_request *block_alloc_request(struct block_device *bdev)
    00057 {
    00058         struct block_request    *req;
    00059
    00060         assert(bdev);
    00061         assert(bdev->alloc_req);
    00062
    00063         req = bdev->alloc_req(bdev);
    00064         if (likely(req))
    00065                 req->bdev = bdev;
    00066         else
    00067                 dbg_warning("block: failed to allocate request from dev %p\n",
    00068                                 bdev);
    00069
    00070         return req;
    00071 }
    00072
    00080 void block_free_request(struct block_device *bdev, struct block_request *req)
    00081 {
    00082         assert(bdev->free_req);
    00083
    00084         if (!req)
    00085                 return;
    00086
    00087         assert(bdev == req->bdev);
    00088
    00089         bdev->free_req(bdev, req);
    00090 }