[PATCH] Remove duplicate protocol definitions
Martin Schwenke
martin at meltin.net
Mon Nov 2 22:13:26 UTC 2015
On Mon, 2 Nov 2015 15:37:38 +1100, Amitay Isaacs <amitay at gmail.com>
wrote:
> Hi,
>
> Recently I introduced a new protocol/ sub-directory in CTDB that abstracts
> all the protocol structures and marshaling routines. The new
> protocol/protocol.h defines the existing CTDB protocol elements. This is
> essentially duplicates many of the structures defined in ctdb_protocol.h.
>
> Here is a patch-set that gets rid of duplicate structure definitions. In
> order to do that, all the existing structures in ctdb_protocol.h are
> renamed to their new counterpart in protocol/protocol.h.
>
>
> https://git.samba.org/?p=amitay/samba.git;a=shortlog;h=refs/heads/ctdb-protocol
>
> (Patchset is large and therefore not attached.)
>
> There are two cases where a structure from ctdb_protocol.h does not match
> the corresponding new definition from protocol/protocol.h.
>
> 1. The top level protocol structures (e.g. ctdb_req_call) in
> ctdb_protocol.h include the protocol header element. Even though this
> makes the code easier, it creates structures with overlapping protocol
> elements.
>
> 2. Many of the control protocol structures include array elements. The
> corresponding structure definitions in ctdb_protocol.h represent this array
> elements as they would appear on the wire. This makes the coding
> error-prone (requiring the use of offsetof() to correctly calculate
> structure sizes). The new definitions clearly mark those array elements as
> such and do not force the wire format.
>
> Both these types of structures are suffixed with "_old" to indicate
> remnants of old protocol implementation.
>
> Review/comments and push appreciated.
Reviewed-by: Martin Schwenke <martin at meltin.net>
Pushed...
peace & happiness,
martin
More information about the samba-technical
mailing list