X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fbyteq.h;h=d73e3684e47adafc5f209110d9247327320e3a15;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=84d8696fea3135e401956ba9970badb95afe7402;hpb=a4af00400a835eb87569ba40e21874c05e872c0f;p=sliver-openvswitch.git diff --git a/lib/byteq.h b/lib/byteq.h index 84d8696fe..d73e3684e 100644 --- a/lib/byteq.h +++ b/lib/byteq.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2009 Nicira Networks, Inc. +/* Copyright (c) 2008, 2009, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,17 +20,15 @@ #include #include -/* Maximum number of bytes in a byteq. */ -#define BYTEQ_SIZE 512 - /* General-purpose circular queue of bytes. */ struct byteq { - uint8_t buffer[BYTEQ_SIZE]; /* Circular queue. */ + uint8_t *buffer; /* Circular queue. */ + unsigned int size; /* Number of bytes allocated for 'buffer'. */ unsigned int head; /* Head of queue. */ unsigned int tail; /* Chases the head. */ }; -void byteq_init(struct byteq *); +void byteq_init(struct byteq *, uint8_t *buffer, size_t size); int byteq_used(const struct byteq *); int byteq_avail(const struct byteq *); bool byteq_is_empty(const struct byteq *);