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