X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fbyteq.h;h=d73e3684e47adafc5f209110d9247327320e3a15;hb=HEAD;hp=5fa51fd6598502760748a93bc166e59f0f93827b;hpb=1e3f34c7693bcabae8e443ac1b246680ef9b60e2;p=sliver-openvswitch.git diff --git a/lib/byteq.h b/lib/byteq.h index 5fa51fd65..d73e3684e 100644 --- a/lib/byteq.h +++ b/lib/byteq.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2009 Nicira, 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 *);