FreeBSD kernel kern code
subr_sglist.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/bio.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/sglist.h>
#include <sys/uio.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <sys/ktr.h>
Include dependency graph for subr_sglist.c:

Go to the source code of this file.

Data Structures

struct  sgsave
 

Macros

#define SGLIST_SAVE(sg, sgsave)
 
#define SGLIST_RESTORE(sg, sgsave)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_SGLIST,"sglist","scatter/gather lists")
 
static __inline int _sglist_append_range (struct sglist *sg, struct sglist_seg **ssp, vm_paddr_t paddr, size_t len)
 
static __inline int _sglist_append_buf (struct sglist *sg, void *buf, size_t len, pmap_t pmap, size_t *donep)
 
int sglist_count (void *buf, size_t len)
 
struct sglist * sglist_alloc (int nsegs, int mflags)
 
void sglist_free (struct sglist *sg)
 
int sglist_append (struct sglist *sg, void *buf, size_t len)
 
int sglist_append_bio (struct sglist *sg, struct bio *bp)
 
int sglist_append_phys (struct sglist *sg, vm_paddr_t paddr, size_t len)
 
int sglist_append_mbuf (struct sglist *sg, struct mbuf *m0)
 
int sglist_append_user (struct sglist *sg, void *buf, size_t len, struct thread *td)
 
int sglist_append_uio (struct sglist *sg, struct uio *uio)
 
int sglist_consume_uio (struct sglist *sg, struct uio *uio, size_t resid)
 
struct sglist * sglist_build (void *buf, size_t len, int mflags)
 
struct sglist * sglist_clone (struct sglist *sg, int mflags)
 
size_t sglist_length (struct sglist *sg)
 
int sglist_split (struct sglist *original, struct sglist **head, size_t length, int mflags)
 
int sglist_join (struct sglist *first, struct sglist *second)
 
int sglist_slice (struct sglist *original, struct sglist **slice, size_t offset, size_t length, int mflags)
 

Macro Definition Documentation

#define SGLIST_RESTORE (   sg,
  sgsave 
)
Value:
do { \
(sg)->sg_nseg = (sgsave).sg_nseg; \
if ((sgsave).sg_nseg > 0) \
(sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len = (sgsave).ss_len; \
} while (0)

Definition at line 72 of file subr_sglist.c.

Referenced by sglist_append(), sglist_append_bio(), sglist_append_mbuf(), sglist_append_phys(), sglist_append_uio(), and sglist_append_user().

#define SGLIST_SAVE (   sg,
  sgsave 
)
Value:
do { \
(sgsave).sg_nseg = (sg)->sg_nseg; \
if ((sgsave).sg_nseg > 0) \
(sgsave).ss_len = (sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len; \
else \
(sgsave).ss_len = 0; \
} while (0)

Definition at line 64 of file subr_sglist.c.

Referenced by sglist_append(), sglist_append_bio(), sglist_append_mbuf(), sglist_append_phys(), sglist_append_uio(), and sglist_append_user().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static __inline int _sglist_append_buf ( struct sglist *  sg,
void *  buf,
size_t  len,
pmap_t  pmap,
size_t *  donep 
)
static

Definition at line 109 of file subr_sglist.c.

References _sglist_append_range().

Referenced by sglist_append(), sglist_append_uio(), sglist_append_user(), and sglist_consume_uio().

Here is the call graph for this function:

Here is the caller graph for this function:

static __inline int _sglist_append_range ( struct sglist *  sg,
struct sglist_seg **  ssp,
vm_paddr_t  paddr,
size_t  len 
)
static

Definition at line 84 of file subr_sglist.c.

Referenced by _sglist_append_buf(), and sglist_append_phys().

Here is the caller graph for this function:

static MALLOC_DEFINE ( M_SGLIST  ,
"sglist"  ,
"scatter/gather lists"   
)
static
struct sglist* sglist_alloc ( int  nsegs,
int  mflags 
)

Definition at line 200 of file subr_sglist.c.

References malloc().

Referenced by sglist_build(), sglist_clone(), sglist_slice(), and sglist_split().

Here is the call graph for this function:

Here is the caller graph for this function:

int sglist_append ( struct sglist *  sg,
void *  buf,
size_t  len 
)

Definition at line 229 of file subr_sglist.c.

References _sglist_append_buf(), SGLIST_RESTORE, and SGLIST_SAVE.

Referenced by sglist_append_bio(), sglist_append_mbuf(), and sglist_build().

Here is the call graph for this function:

Here is the caller graph for this function:

int sglist_append_bio ( struct sglist *  sg,
struct bio *  bp 
)

Definition at line 250 of file subr_sglist.c.

References sglist_append(), sglist_append_phys(), SGLIST_RESTORE, and SGLIST_SAVE.

Here is the call graph for this function:

int sglist_append_mbuf ( struct sglist *  sg,
struct mbuf *  m0 
)

Definition at line 317 of file subr_sglist.c.

References sglist_append(), SGLIST_RESTORE, and SGLIST_SAVE.

Here is the call graph for this function:

int sglist_append_phys ( struct sglist *  sg,
vm_paddr_t  paddr,
size_t  len 
)

Definition at line 286 of file subr_sglist.c.

References _sglist_append_range(), SGLIST_RESTORE, SGLIST_SAVE, and sgsave::ss_len.

Referenced by sglist_append_bio().

Here is the call graph for this function:

Here is the caller graph for this function:

int sglist_append_uio ( struct sglist *  sg,
struct uio *  uio 
)

Definition at line 367 of file subr_sglist.c.

References _sglist_append_buf(), SGLIST_RESTORE, and SGLIST_SAVE.

Here is the call graph for this function:

int sglist_append_user ( struct sglist *  sg,
void *  buf,
size_t  len,
struct thread *  td 
)

Definition at line 346 of file subr_sglist.c.

References _sglist_append_buf(), SGLIST_RESTORE, and SGLIST_SAVE.

Here is the call graph for this function:

struct sglist* sglist_build ( void *  buf,
size_t  len,
int  mflags 
)

Definition at line 465 of file subr_sglist.c.

References sglist_alloc(), sglist_append(), sglist_count(), and sglist_free().

Here is the call graph for this function:

struct sglist* sglist_clone ( struct sglist *  sg,
int  mflags 
)

Definition at line 488 of file subr_sglist.c.

References sglist_alloc().

Here is the call graph for this function:

int sglist_consume_uio ( struct sglist *  sg,
struct uio *  uio,
size_t  resid 
)

Definition at line 415 of file subr_sglist.c.

References _sglist_append_buf().

Here is the call graph for this function:

int sglist_count ( void *  buf,
size_t  len 
)

Definition at line 170 of file subr_sglist.c.

Referenced by sglist_build().

Here is the caller graph for this function:

void sglist_free ( struct sglist *  sg)

Definition at line 216 of file subr_sglist.c.

References free().

Referenced by sglist_build().

Here is the call graph for this function:

Here is the caller graph for this function:

int sglist_join ( struct sglist *  first,
struct sglist *  second 
)

Definition at line 615 of file subr_sglist.c.

size_t sglist_length ( struct sglist *  sg)

Definition at line 508 of file subr_sglist.c.

int sglist_slice ( struct sglist *  original,
struct sglist **  slice,
size_t  offset,
size_t  length,
int  mflags 
)

Definition at line 668 of file subr_sglist.c.

References count, and sglist_alloc().

Here is the call graph for this function:

int sglist_split ( struct sglist *  original,
struct sglist **  head,
size_t  length,
int  mflags 
)

Definition at line 537 of file subr_sglist.c.

References count, and sglist_alloc().

Here is the call graph for this function: