Lines Matching refs:map
30 struct uid_gid_map *map);
276 map_id_range_down_max(unsigned extents, struct uid_gid_map *map, u32 id, u32 count) in map_id_range_down_max() argument
284 return bsearch(&key, map->forward, extents, in map_id_range_down_max()
294 map_id_range_down_base(unsigned extents, struct uid_gid_map *map, u32 id, u32 count) in map_id_range_down_base() argument
303 first = map->extent[idx].first; in map_id_range_down_base()
304 last = first + map->extent[idx].count - 1; in map_id_range_down_base()
307 return &map->extent[idx]; in map_id_range_down_base()
312 static u32 map_id_range_down(struct uid_gid_map *map, u32 id, u32 count) in map_id_range_down() argument
315 unsigned extents = map->nr_extents; in map_id_range_down()
319 extent = map_id_range_down_base(extents, map, id, count); in map_id_range_down()
321 extent = map_id_range_down_max(extents, map, id, count); in map_id_range_down()
332 static u32 map_id_down(struct uid_gid_map *map, u32 id) in map_id_down() argument
334 return map_id_range_down(map, id, 1); in map_id_down()
343 map_id_up_base(unsigned extents, struct uid_gid_map *map, u32 id) in map_id_up_base() argument
350 first = map->extent[idx].lower_first; in map_id_up_base()
351 last = first + map->extent[idx].count - 1; in map_id_up_base()
353 return &map->extent[idx]; in map_id_up_base()
363 map_id_up_max(unsigned extents, struct uid_gid_map *map, u32 id) in map_id_up_max() argument
371 return bsearch(&key, map->reverse, extents, in map_id_up_max()
375 static u32 map_id_up(struct uid_gid_map *map, u32 id) in map_id_up() argument
378 unsigned extents = map->nr_extents; in map_id_up()
382 extent = map_id_up_base(extents, map, id); in map_id_up()
384 extent = map_id_up_max(extents, map, id); in map_id_up()
663 struct uid_gid_map *map) in m_start() argument
666 unsigned extents = map->nr_extents; in m_start()
673 return &map->extent[pos]; in m_start()
675 return &map->forward[pos]; in m_start()
775 static int insert_extent(struct uid_gid_map *map, struct uid_gid_extent *extent) in insert_extent() argument
779 if (map->nr_extents == UID_GID_MAP_MAX_BASE_EXTENTS) { in insert_extent()
792 memcpy(forward, map->extent, in insert_extent()
793 map->nr_extents * sizeof(map->extent[0])); in insert_extent()
795 map->forward = forward; in insert_extent()
796 map->reverse = NULL; in insert_extent()
799 if (map->nr_extents < UID_GID_MAP_MAX_BASE_EXTENTS) in insert_extent()
800 dest = &map->extent[map->nr_extents]; in insert_extent()
802 dest = &map->forward[map->nr_extents]; in insert_extent()
805 map->nr_extents++; in insert_extent()
843 static int sort_idmaps(struct uid_gid_map *map) in sort_idmaps() argument
845 if (map->nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) in sort_idmaps()
849 sort(map->forward, map->nr_extents, sizeof(struct uid_gid_extent), in sort_idmaps()
853 map->reverse = kmemdup(map->forward, in sort_idmaps()
854 map->nr_extents * sizeof(struct uid_gid_extent), in sort_idmaps()
856 if (!map->reverse) in sort_idmaps()
860 sort(map->reverse, map->nr_extents, sizeof(struct uid_gid_extent), in sort_idmaps()
923 struct uid_gid_map *map, in map_write() argument
968 if (map->nr_extents != 0) in map_write()
1083 memcpy(map->extent, new_map.extent, in map_write()
1086 map->forward = new_map.forward; in map_write()
1087 map->reverse = new_map.reverse; in map_write()
1090 map->nr_extents = new_map.nr_extents; in map_write()
1098 map->forward = NULL; in map_write()
1099 map->reverse = NULL; in map_write()
1100 map->nr_extents = 0; in map_write()