genode/os/include/nic/packet_allocator.h
Stefan Kalkowski 746011ee28 blk_cache: fix deadlock in allocator hierarchy
This commit generalizes the bit array in 'base/util/bit_array.h',
so that it can be used in a statically, when the array size is known
at compile time, or dynamically. It uses the dynamic approach of the
bit array for a more generalized version of the packet allocator,
formerly only used by NIC session clients. The more generic packet
allocator is used by the block cache to circumvent the allocation
deadlock described in issue #1059.

Fixes #1059
2014-02-25 14:58:06 +01:00

43 lines
964 B
C++

/*
* \brief Fast-bitmap allocator for NIC-session packet streams
* \author Sebastian Sumpf
* \date 2012-07-30
*
* This allocator can be used with a nic session. It is *not* required though.
*/
/*
* Copyright (C) 2012-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__NIC__PACKET_ALLOCATOR__
#define _INCLUDE__NIC__PACKET_ALLOCATOR__
#include <os/packet_allocator.h>
namespace Nic {
/**
* Packet allocator used for packet streaming in nic sessions.
*/
class Packet_allocator : public Genode::Packet_allocator
{
public:
enum { DEFAULT_PACKET_SIZE = 1600 };
/**
* Constructor
*
* \param md_alloc Meta-data allocator
*/
Packet_allocator(Genode::Allocator *md_alloc)
: Genode::Packet_allocator(md_alloc, DEFAULT_PACKET_SIZE) {}
};
};
#endif /* _INCLUDE__NIC__PACKET_ALLOCATOR__ */