lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] RFC: PBUF_FLAG_* must be orthogonal


From: Leon Woestenberg
Subject: [lwip-users] RFC: PBUF_FLAG_* must be orthogonal
Date: Mon, 31 Mar 2003 22:06:58 +0200

Hello,

The PBUF_FLAG_* constants are only used within pbuf.c.

However, the defines are not really orthogonal bit flags at this time, but
actually are used as "pbuf types", each value a different type.

In order to optimize the code base for all different cases, I propose the
change of the PBUF_FLAG_* meaning as follows:

PBUF_FLAG_ROM: payload is in ROM (otherwise, pbuf is in RAM)
PBUF_FLAG_REF: payload is referenced externally (if not set, payload is
internal to pbuf)
PBUF_FLAG_POOL: pbuf is from pool (otherwise, dynamically allocated)

Now, depending on the argument given to pbuf_alloc():

PBUF_RAM type pbuf has flag 0.
PBUF_ROM type pbuf has flags PBUF_FLAG_ROM | PBUF_FLAG_REF
PBUF_REF type pbuf has flags
PBUF_FLAG_REF
PBUF_POOL type pbuf has flags PBUF_FLAG_POOL.

but more combinations are possible:

PBUF_FLAG_POOL | PBUF_FLAG_REF
PBUF_FLAG_POOL | PBUF_FLAG_REF | PBUF_FLAG_ROM

which allows for an improved pbuf pool system.

As said, changing the flag implementation will not affect other modules, as
they
are pbuf internal.

Regards,

Leon.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]