*参照元 [#t1639f62] #backlinks *説明 [#e7f5e4fe] -パス: [[linux-4.4.1/lib/bitmap.c]] -FIXME: これは何? --説明 **引数 [#xbb1bc1f] -unsigned long *bitmap -- -unsigned int bits -- -int order -- **返り値 [#l71c2335] -int -- **参考 [#m3f37584] *実装 [#ne3fa367] /** * bitmap_find_free_region - find a contiguous aligned mem region * @bitmap: array of unsigned longs corresponding to the bitmap * @bits: number of bits in the bitmap * @order: region size (log base 2 of number of bits) to find * * Find a region of free (zero) bits in a @bitmap of @bits bits and * allocate them (set them to one). Only consider regions of length * a power (@order) of two, aligned to that power of two, which * makes the search algorithm much faster. * * Return the bit offset in bitmap of the allocated region, * or -errno on failure. */ int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order) { unsigned int pos, end; /* scans bitmap by regions of size order */ for (pos = 0 ; (end = pos + (1U << order)) <= bits; pos = end) { if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) continue; __reg_op(bitmap, pos, order, REG_OP_ALLOC); return pos; } - --[[linux-4.4.1/REG_OP_ISFREE]] --[[linux-4.4.1/REG_OP_ALLOC]] --[[linux-4.4.1/__reg_op()]] return -ENOMEM; } EXPORT_SYMBOL(bitmap_find_free_region); - --[[linux-4.4.1/EXPORT_SYMBOL()]] *コメント [#i1b1d947]