e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** @file
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * IPRT - Handle Tables.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/*
506922036e4604028e862309a96bb403eee83a48vboxsync * Copyright (C) 2008-2013 Oracle Corporation
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * available from http://www.virtualbox.org. This file is free software;
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * General Public License (GPL) as published by the Free Software
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * The contents of this file may alternatively be used under the terms
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * of the Common Development and Distribution License Version 1.0
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * VirtualBox OSE distribution, in which case the provisions of the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * CDDL are applicable instead of those of the GPL.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * You may elect to license modified versions of this file under the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * terms and conditions of either the GPL or the CDDL or both.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync#ifndef ___iprt_handletable_h
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync#define ___iprt_handletable_h
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync#include <iprt/cdefs.h>
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync#include <iprt/types.h>
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsyncRT_C_DECLS_BEGIN
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** @defgroup grp_rt_handletable RTHandleTable - Handle Tables
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @ingroup grp_rt
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @{
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Callback for retaining an object during the lookup and free calls.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * This callback is executed when a handle is being looked up in one
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * way or another from behind the handle table lock. This allows you
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * to increase the reference (or some equivalent thing) during the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * handle lookup and thereby eliminate any race with anyone trying
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * to free the handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Note that there is no counterpart to this callback, so if you make
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * use of this you'll have to release the object manually of course.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Another use of this callback is to do some extra access checking.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Use the return code to indicate whether the lookup should fail
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * or not (no object is returned on faliure, naturally).
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns IPRT status code for the lookup (the caller won't see this).
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle table handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvObj The object which has been looked up.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvCtx The context argument if the handle table was created with the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * RTHANDLETABLE_FLAGS_CONTEXT set. Otherwise NULL.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvUser The user context argument specified when creating the table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsynctypedef DECLCALLBACK(int) FNRTHANDLETABLERETAIN(RTHANDLETABLE hHandleTable, void *pvObj, void *pvCtx, void *pvUser);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** Pointer to a FNHANDLETABLERETAIN. */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsynctypedef FNRTHANDLETABLERETAIN *PFNRTHANDLETABLERETAIN;
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Callback for deleting a left over object during RTHandleTableDestroy.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle table handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param h The handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvObj The object.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvCtx The context argument if the handle table was created with the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * RTHANDLETABLE_FLAGS_CONTEXT set. Otherwise NULL.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvUser The user context argument specified when creating the table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsynctypedef DECLCALLBACK(void) FNRTHANDLETABLEDELETE(RTHANDLETABLE hHandleTable, uint32_t h, void *pvObj, void *pvCtx, void *pvUser);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** Pointer to a FNRTHANDLETABLEDELETE. */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsynctypedef FNRTHANDLETABLEDELETE *PFNRTHANDLETABLEDELETE;
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** @name RTHandleTableCreateEx flags
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @{ */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** Whether the handle table entries takes a context or not.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * This can be useful for associating a handle with for instance a process or
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * similar in order to prevent anyone but the owner from using the handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Setting this means you will have to use the WithCtx functions to do the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * handle management. */
506922036e4604028e862309a96bb403eee83a48vboxsync#define RTHANDLETABLE_FLAGS_CONTEXT RT_BIT_32(0)
506922036e4604028e862309a96bb403eee83a48vboxsync/** Whether the handle table should take care of the serialization (IRQ unsafe).
c8dfb9c4df92b82e92a48d90d984cfd7b6339111vboxsync * If not specified the caller will have to take care of that. */
506922036e4604028e862309a96bb403eee83a48vboxsync#define RTHANDLETABLE_FLAGS_LOCKED RT_BIT_32(1)
506922036e4604028e862309a96bb403eee83a48vboxsync/** Like RTHANDLETABLE_FLAGS_LOCKED, except it's IRQ safe.
506922036e4604028e862309a96bb403eee83a48vboxsync * A side-effect is that callbacks may be called with IRQs disabled. */
506922036e4604028e862309a96bb403eee83a48vboxsync#define RTHANDLETABLE_FLAGS_LOCKED_IRQ_SAFE RT_BIT_32(2)
09034c53c75eab7ea04021a749b98e7f78fae85avboxsync/** The mask of valid flags. */
506922036e4604028e862309a96bb403eee83a48vboxsync#define RTHANDLETABLE_FLAGS_MASK UINT32_C(0x00000007)
c8dfb9c4df92b82e92a48d90d984cfd7b6339111vboxsync/** @} */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Creates a handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * The handle table translates a 32-bit handle into an object pointer,
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * optionally calling you back so you can retain the object without
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * racing RTHandleTableFree.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns IPRT status code and on success a handle table handle will be stored at the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * location phHandleTable points at.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
88acfa6629a7976c0583c1712d2b5b22a87a5121vboxsync * @param phHandleTable Where to store the handle table handle on success.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param fFlags Flags, see RTHANDLETABLE_FLAGS_*.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param uBase The handle base value. This is the value of the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * first handle to be returned.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param cMax The max number of handles. When exceeded the RTHandleTableAlloc
09034c53c75eab7ea04021a749b98e7f78fae85avboxsync * or RTHandleTableAllocWithCtx calls will fail. Note that this
09034c53c75eab7ea04021a749b98e7f78fae85avboxsync * number will be rounded up to a multiple of the sub-table size,
09034c53c75eab7ea04021a749b98e7f78fae85avboxsync * or if it's too close to UINT32_MAX it will be rounded down.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pfnRetain Optional retain callback that will be called from behind the
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * lock (if any) during lookup.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvUser The user argument to the retain callback.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(int) RTHandleTableCreateEx(PRTHANDLETABLE phHandleTable, uint32_t fFlags, uint32_t uBase, uint32_t cMax,
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync PFNRTHANDLETABLERETAIN pfnRetain, void *pvUser);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * A simplified version of the RTHandleTableCreateEx API.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
09034c53c75eab7ea04021a749b98e7f78fae85avboxsync * It assumes a max of about 64K handles with 1 being the base. The table
09034c53c75eab7ea04021a749b98e7f78fae85avboxsync * access will serialized (RTHANDLETABLE_FLAGS_LOCKED).
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns IPRT status code and *phHandleTable.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
88acfa6629a7976c0583c1712d2b5b22a87a5121vboxsync * @param phHandleTable Where to store the handle table handle on success.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
4d0b8f024a4654c1f61c8c4b7e16320719f7fea4vboxsyncRTDECL(int) RTHandleTableCreate(PRTHANDLETABLE phHandleTable);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Destroys a handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * If any entries are still in used the pfnDelete callback will be invoked
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * on each of them (if specfied) to allow to you clean things up.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns IPRT status code
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pfnDelete Function to be called back on each handle still in use. Optional.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvUser The user argument to pfnDelete.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(int) RTHandleTableDestroy(RTHANDLETABLE hHandleTable, PFNRTHANDLETABLEDELETE pfnDelete, void *pvUser);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Allocates a handle from the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns IPRT status code, almost any.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @retval VINF_SUCCESS on success.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @retval VERR_NO_MEMORY if we failed to extend the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @retval VERR_NO_MORE_HANDLES if we're out of handles.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvObj The object to associate with the new handle.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * This must be aligned on a 4 byte boundary.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param ph Where to return the handle on success.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @remarks Do not call this if RTHANDLETABLE_FLAGS_CONTEXT was used during creation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(int) RTHandleTableAlloc(RTHANDLETABLE hHandleTable, void *pvObj, uint32_t *ph);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Looks up a handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns The object pointer on success. NULL on failure.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param h The handle to lookup.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @remarks Do not call this if RTHANDLETABLE_FLAGS_CONTEXT was used during creation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(void *) RTHandleTableLookup(RTHANDLETABLE hHandleTable, uint32_t h);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Looks up and frees a handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns The object pointer on success. NULL on failure.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param h The handle to lookup.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @remarks Do not call this if RTHANDLETABLE_FLAGS_CONTEXT was used during creation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(void *) RTHandleTableFree(RTHANDLETABLE hHandleTable, uint32_t h);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Allocates a handle from the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns IPRT status code, almost any.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @retval VINF_SUCCESS on success.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @retval VERR_NO_MEMORY if we failed to extend the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @retval VERR_NO_MORE_HANDLES if we're out of handles.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvObj The object to associate with the new handle.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * This must be aligned on a 4 byte boundary.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvCtx The context to associate with the new handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param ph Where to return the handle on success.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @remarks Call this if RTHANDLETABLE_FLAGS_CONTEXT was used during creation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(int) RTHandleTableAllocWithCtx(RTHANDLETABLE hHandleTable, void *pvObj, void *pvCtx, uint32_t *ph);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Looks up a handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns The object pointer on success. NULL on failure.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param h The handle to lookup.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvCtx The handle context, this must match what was given on allocation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @remarks Call this if RTHANDLETABLE_FLAGS_CONTEXT was used during creation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(void *) RTHandleTableLookupWithCtx(RTHANDLETABLE hHandleTable, uint32_t h, void *pvCtx);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/**
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * Looks up and frees a handle.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @returns The object pointer on success. NULL on failure.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param hHandleTable The handle to the handle table.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param h The handle to lookup.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @param pvCtx The handle context, this must match what was given on allocation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync *
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync * @remarks Call this if RTHANDLETABLE_FLAGS_CONTEXT was used during creation.
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsyncRTDECL(void *) RTHandleTableFreeWithCtx(RTHANDLETABLE hHandleTable, uint32_t h, void *pvCtx);
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync/** @} */
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsyncRT_C_DECLS_END
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync#endif
e87df5a63825a4aed74b06f10229ee463b26f5c1vboxsync