Linux Kernel
3.7.1
|
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/scatterlist.h>
#include <linux/highmem.h>
#include <linux/kmemleak.h>
Go to the source code of this file.
int __sg_alloc_table | ( | struct sg_table * | table, |
unsigned int | nents, | ||
unsigned int | max_ents, | ||
gfp_t | gfp_mask, | ||
sg_alloc_fn * | alloc_fn | ||
) |
__sg_alloc_table - Allocate and initialize an sg table with given allocator : The sg table header to use : Number of entries in sg list : The maximum number of entries the allocator returns per call : GFP allocation mask : Allocator to use
Description: This function returns a long. The allocator is defined to return scatterlist chunks of maximum size . Thus if is bigger than , the scatterlists will be chained in units of .
Notes: If this function returns non-0 (eg failure), the caller must call __sg_free_table() to cleanup any leftover allocations.
Definition at line 243 of file scatterlist.c.
void __sg_free_table | ( | struct sg_table * | table, |
unsigned int | max_ents, | ||
sg_free_fn * | free_fn | ||
) |
__sg_free_table - Free a previously mapped sg table : The sg table header to use : The maximum number of entries per single scatterlist : Free function
Description: Free an sg table previously allocated and setup with __sg_alloc_table(). The value must be identical to that previously used with __sg_alloc_table().
Definition at line 176 of file scatterlist.c.
EXPORT_SYMBOL | ( | sg_next | ) |
EXPORT_SYMBOL | ( | sg_nents | ) |
EXPORT_SYMBOL | ( | sg_last | ) |
EXPORT_SYMBOL | ( | sg_init_table | ) |
EXPORT_SYMBOL | ( | sg_init_one | ) |
EXPORT_SYMBOL | ( | __sg_free_table | ) |
EXPORT_SYMBOL | ( | sg_free_table | ) |
EXPORT_SYMBOL | ( | __sg_alloc_table | ) |
EXPORT_SYMBOL | ( | sg_alloc_table | ) |
EXPORT_SYMBOL | ( | sg_alloc_table_from_pages | ) |
EXPORT_SYMBOL | ( | sg_miter_start | ) |
EXPORT_SYMBOL | ( | sg_miter_next | ) |
EXPORT_SYMBOL | ( | sg_miter_stop | ) |
EXPORT_SYMBOL | ( | sg_copy_from_buffer | ) |
EXPORT_SYMBOL | ( | sg_copy_to_buffer | ) |
sg_alloc_table - Allocate and initialize an sg table : The sg table header to use : Number of entries in sg list : GFP allocation mask
Description: Allocate and initialize an sg table. If @ is larger than SG_MAX_SINGLE_ALLOC a chained sg table will be setup.
Definition at line 319 of file scatterlist.c.
int sg_alloc_table_from_pages | ( | struct sg_table * | sgt, |
struct page ** | pages, | ||
unsigned int | n_pages, | ||
unsigned long | offset, | ||
unsigned long | size, | ||
gfp_t | gfp_mask | ||
) |
sg_alloc_table_from_pages - Allocate and initialize an sg table from an array of pages : The sg table header to use : Pointer to an array of page pointers : Number of pages in the pages array : Offset from start of the first page to the start of a buffer : Number of valid bytes in the buffer (after offset) : GFP allocation mask
Description: Allocate and initialize an sg table from a list of pages. Contiguous ranges of the pages are squashed into a single scatterlist node. A user may provide an offset at a start and a size of valid data in a buffer specified by the page array. The returned sg table is released by sg_free_table.
Returns: 0 on success, negative error on failure
Definition at line 352 of file scatterlist.c.
size_t sg_copy_from_buffer | ( | struct scatterlist * | sgl, |
unsigned int | nents, | ||
void * | buf, | ||
size_t | buflen | ||
) |
sg_copy_from_buffer - Copy from a linear buffer to an SG list : The SG list : Number of SG entries : Where to copy from : The number of bytes to copy
Returns the number of copied bytes.
Definition at line 572 of file scatterlist.c.
size_t sg_copy_to_buffer | ( | struct scatterlist * | sgl, |
unsigned int | nents, | ||
void * | buf, | ||
size_t | buflen | ||
) |
sg_copy_to_buffer - Copy from an SG list to a linear buffer : The SG list : Number of SG entries : Where to copy to : The number of bytes to copy
Returns the number of copied bytes.
Definition at line 589 of file scatterlist.c.
sg_free_table - Free a previously allocated sg table : The mapped sg table header
Definition at line 218 of file scatterlist.c.
sg_init_one - Initialize a single entry sg list : SG entry : Virtual address for IO : IO length
Definition at line 125 of file scatterlist.c.
void sg_init_table | ( | struct scatterlist * | sgl, |
unsigned int | nents | ||
) |
sg_init_table - Initialize SG table : The SG table : Number of entries in table
Notes: If this is part of a chained sg table, sg_mark_end() should be used only on the last table part.
Definition at line 104 of file scatterlist.c.
|
read |
sg_last - return the last scatterlist entry in a list : First entry in the scatterlist : Number of entries in the scatterlist
Description: Should only be used casually, it (currently) scans the entire list to get the last entry.
Note that the @ pointer passed in need not be the first one, the important bit is that @ denotes the number of entries that exist from
Definition at line 74 of file scatterlist.c.
bool sg_miter_next | ( | struct sg_mapping_iter * | miter | ) |
sg_miter_next - proceed mapping iterator to the next mapping : sg mapping iter to proceed
Description: Proceeds to the next mapping. should have been started using sg_miter_start(). On successful return, ->page, ->addr and ->length point to the current mapping.
Context: Preemption disabled if SG_MITER_ATOMIC. Preemption must stay disabled till is stopped. May sleep if !SG_MITER_ATOMIC.
Returns: true if contains the next mapping. false if end of sg list is reached.
Definition at line 438 of file scatterlist.c.
void sg_miter_start | ( | struct sg_mapping_iter * | miter, |
struct scatterlist * | sgl, | ||
unsigned int | nents, | ||
unsigned int | flags | ||
) |
sg_miter_start - start mapping iteration over a sg list : sg mapping iter to be started : sg list to iterate over : number of sg entries
Description: Starts mapping iterator .
Context: Don't care.
Definition at line 408 of file scatterlist.c.
void sg_miter_stop | ( | struct sg_mapping_iter * | miter | ) |
sg_miter_stop - stop mapping iteration : sg mapping iter to be stopped
Description: Stops mapping iterator . should have been started started using sg_miter_start(). A stopped iteration can be resumed by calling sg_miter_next() on it. This is useful when resources (kmap) need to be released during iteration.
Context: Preemption disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
Definition at line 489 of file scatterlist.c.
int sg_nents | ( | struct scatterlist * | sg | ) |
sg_nents - return total count of entries in scatterlist : The scatterlist
Description: Allows to know how many entries are in sg, taking into acount chaining as well
Definition at line 50 of file scatterlist.c.
|
read |