Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/scatterlist.h
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
static inline void | static inline void | ||||
sg_init_table(struct scatterlist *sg, unsigned int nents) | sg_init_table(struct scatterlist *sg, unsigned int nents) | ||||
{ | { | ||||
bzero(sg, sizeof(*sg) * nents); | bzero(sg, sizeof(*sg) * nents); | ||||
sg_mark_end(&sg[nents - 1]); | sg_mark_end(&sg[nents - 1]); | ||||
} | } | ||||
static inline void | |||||
sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen) | |||||
{ | |||||
sg_init_table(sg, 1); | |||||
sg_set_buf(sg, buf, buflen); | |||||
} | |||||
static struct scatterlist * | static struct scatterlist * | ||||
sg_kmalloc(unsigned int nents, gfp_t gfp_mask) | sg_kmalloc(unsigned int nents, gfp_t gfp_mask) | ||||
{ | { | ||||
if (nents == SG_MAX_SINGLE_ALLOC) { | if (nents == SG_MAX_SINGLE_ALLOC) { | ||||
return ((void *)__get_free_page(gfp_mask)); | return ((void *)__get_free_page(gfp_mask)); | ||||
} else | } else | ||||
return (kmalloc(nents * sizeof(struct scatterlist), gfp_mask)); | return (kmalloc(nents * sizeof(struct scatterlist), gfp_mask)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 403 Lines • Show Last 20 Lines |