diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-12-19 12:03:10 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2006-12-19 12:03:10 +1100 |
commit | 3c097c9a5fef7a6aa231173cf970b8f6bb11cc82 (patch) | |
tree | 8ec011161373f994dc5399fc9ab38b1d9338aea7 /ctdb/tcp/tcp_init.c | |
parent | ee547a0f9aa1642110f4740eaecd552b7ea63539 (diff) | |
download | samba-3c097c9a5fef7a6aa231173cf970b8f6bb11cc82.tar.gz samba-3c097c9a5fef7a6aa231173cf970b8f6bb11cc82.tar.xz samba-3c097c9a5fef7a6aa231173cf970b8f6bb11cc82.zip |
added handling of partial packet reads
added transport level packet allocator, allowing the transport to
enforce alignment or special memory rules
(This used to be ctdb commit 50304a5c4d8d640732678eeed793857334ca5ec1)
Diffstat (limited to 'ctdb/tcp/tcp_init.c')
-rw-r--r-- | ctdb/tcp/tcp_init.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index b3378677035..fca6506676f 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -64,10 +64,24 @@ int ctdb_tcp_add_node(struct ctdb_node *node) } +/* + transport packet allocator - allows transport to control memory for packets +*/ +void *ctdb_tcp_allocate_pkt(struct ctdb_context *ctdb, size_t size) +{ + /* tcp transport needs to round to 8 byte alignment to ensure + that we can use a length header and 64 bit elements in + structures */ + size = (size+7) & ~7; + return talloc_size(ctdb, size); +} + + static const struct ctdb_methods ctdb_tcp_methods = { .start = ctdb_tcp_start, .add_node = ctdb_tcp_add_node, - .queue_pkt = ctdb_tcp_queue_pkt + .queue_pkt = ctdb_tcp_queue_pkt, + .allocate_pkt = ctdb_tcp_allocate_pkt }; /* |