Index: sys/compat/linuxkpi/common/include/linux/idr.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/idr.h +++ sys/compat/linuxkpi/common/include/linux/idr.h @@ -140,6 +140,11 @@ return (ida_simple_get(ida, 0, max, gfp)); } +static inline int ida_alloc(struct ida *ida, gfp_t gfp) +{ + return (ida_alloc_max(ida, ~0u, gfp)); +} + static inline bool ida_is_empty(struct ida *ida) { Index: sys/compat/linuxkpi/common/include/linux/kernel.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/kernel.h +++ sys/compat/linuxkpi/common/include/linux/kernel.h @@ -105,7 +105,7 @@ } #define BUILD_BUG() do { CTASSERT(0); } while (0) -#define BUILD_BUG_ON(x) _O_CTASSERT(!(x)) +#define BUILD_BUG_ON(x) do { _O_CTASSERT(!(x)) } while (0) #define BUILD_BUG_ON_MSG(x, msg) BUILD_BUG_ON(x) #define BUILD_BUG_ON_NOT_POWER_OF_2(x) BUILD_BUG_ON(!powerof2(x)) #define BUILD_BUG_ON_INVALID(expr) while (0) { (void)(expr); } Index: sys/compat/linuxkpi/common/include/linux/mm.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/mm.h +++ sys/compat/linuxkpi/common/include/linux/mm.h @@ -294,4 +294,6 @@ void lkpi_unmap_mapping_range(void *obj, loff_t const holebegin __unused, loff_t const holelen, int even_cows __unused); +#define PAGE_ALIGNED(p) __is_aligned(p, PAGE_SIZE) + #endif /* _LINUX_MM_H_ */ Index: sys/compat/linuxkpi/common/include/linux/scatterlist.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/scatterlist.h +++ sys/compat/linuxkpi/common/include/linux/scatterlist.h @@ -182,6 +182,13 @@ 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 * sg_kmalloc(unsigned int nents, gfp_t gfp_mask) {