req.h revision b6b07507d11e2bea02bbba193ba367ea479a2fcf
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync/* $Id$ */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync/** @file
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * IPRT - Internal RTReq header.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync/*
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * Copyright (C) 2006-2011 Oracle Corporation
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync *
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * available from http://www.virtualbox.org. This file is free software;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * you can redistribute it and/or modify it under the terms of the GNU
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * General Public License (GPL) as published by the Free Software
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync *
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * The contents of this file may alternatively be used under the terms
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * of the Common Development and Distribution License Version 1.0
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * VirtualBox OSE distribution, in which case the provisions of the
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * CDDL are applicable instead of those of the GPL.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync *
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * You may elect to license modified versions of this file under the
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * terms and conditions of either the GPL or the CDDL or both.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync#ifndef ___internal_req_h
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync#define ___internal_req_h
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync#include <iprt/types.h>
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsyncRT_C_DECLS_BEGIN
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync/**
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * Internal queue instance.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsynctypedef struct RTREQQUEUEINT
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync{
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** @todo magic */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** Head of the request queue. Atomic. */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync volatile PRTREQ pReqs;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** The last index used during alloc/free. */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync volatile uint32_t iReqFree;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** Number of free request packets. */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync volatile uint32_t cReqFree;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** Array of pointers to lists of free request packets. Atomic. */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync volatile PRTREQ apReqFree[9];
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** Requester event sem.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync * The request can use this event semaphore to wait/poll for new requests.
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync RTSEMEVENT EventSem;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync /** Set if busy (pending or processing requests). */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync bool volatile fBusy;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync} RTREQQUEUEINT;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync/** Pointer to an internal queue instance. */
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsynctypedef RTREQQUEUEINT *PRTREQQUEUEINT;
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsyncRT_C_DECLS_END
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync#endif
b6b07507d11e2bea02bbba193ba367ea479a2fcfvboxsync