17cdc0497Smrg/*
27cdc0497Smrg * Copyright 2018 Advanced Micro Devices, Inc.
37cdc0497Smrg *
47cdc0497Smrg * Permission is hereby granted, free of charge, to any person obtaining a
57cdc0497Smrg * copy of this software and associated documentation files (the "Software"),
67cdc0497Smrg * to deal in the Software without restriction, including without limitation
77cdc0497Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87cdc0497Smrg * and/or sell copies of the Software, and to permit persons to whom the
97cdc0497Smrg * Software is furnished to do so, subject to the following conditions:
107cdc0497Smrg *
117cdc0497Smrg * The above copyright notice and this permission notice shall be included in
127cdc0497Smrg * all copies or substantial portions of the Software.
137cdc0497Smrg *
147cdc0497Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
157cdc0497Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167cdc0497Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
177cdc0497Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
187cdc0497Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
197cdc0497Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
207cdc0497Smrg * OTHER DEALINGS IN THE SOFTWARE.
217cdc0497Smrg *
227cdc0497Smrg */
237cdc0497Smrg
247cdc0497Smrg#ifndef _HANDLE_TABLE_H_
257cdc0497Smrg#define _HANDLE_TABLE_H_
267cdc0497Smrg
277cdc0497Smrg#include <stdint.h>
287cdc0497Smrg#include "libdrm_macros.h"
297cdc0497Smrg
307cdc0497Smrgstruct handle_table {
317cdc0497Smrg	uint32_t	max_key;
327cdc0497Smrg	void		**values;
337cdc0497Smrg};
347cdc0497Smrg
357cdc0497Smrgdrm_private int handle_table_insert(struct handle_table *table, uint32_t key,
367cdc0497Smrg				    void *value);
377cdc0497Smrgdrm_private void handle_table_remove(struct handle_table *table, uint32_t key);
387cdc0497Smrgdrm_private void *handle_table_lookup(struct handle_table *table, uint32_t key);
397cdc0497Smrgdrm_private void handle_table_fini(struct handle_table *table);
407cdc0497Smrg
417cdc0497Smrg#endif /* _HANDLE_TABLE_H_ */
42