summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in2
-rw-r--r--source3/include/ctdb_packet.h (renamed from source3/include/packet.h)36
-rw-r--r--source3/lib/ctdb_packet.c (renamed from source3/lib/packet.c)47
-rw-r--r--source3/lib/ctdbd_conn.c58
-rwxr-xr-xsource3/wscript_build2
5 files changed, 72 insertions, 73 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 9746a21508..6893e01f2c 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -438,7 +438,7 @@ CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \
LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \
lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \
- lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o \
+ lib/messages_ctdbd.o lib/ctdb_packet.o lib/ctdbd_conn.o \
lib/interfaces.o lib/memcache.o \
lib/talloc_dict.o \
lib/serverid.o \
diff --git a/source3/include/packet.h b/source3/include/ctdb_packet.h
index c96a8017f8..267a98825f 100644
--- a/source3/include/packet.h
+++ b/source3/include/ctdb_packet.h
@@ -1,6 +1,6 @@
-/*
+/*
Unix SMB/CIFS implementation.
- Packet handling
+ CTDB Packet handling
Copyright (C) Volker Lendecke 2007
This program is free software; you can redistribute it and/or modify
@@ -18,35 +18,35 @@
*/
/*
- * A packet context is a wrapper around a bidirectional file descriptor,
+ * A ctdb_packet context is a wrapper around a bidirectional file descriptor,
* hiding the handling of individual requests.
*/
-struct packet_context;
+struct ctdb_packet_context;
/*
- * Initialize a packet context. The fd is given to the packet context, meaning
- * that it is automatically closed when the packet context is freed.
+ * Initialize a ctdb_packet context. The fd is given to the ctdb_packet context, meaning
+ * that it is automatically closed when the ctdb_packet context is freed.
*/
-struct packet_context *packet_init(TALLOC_CTX *mem_ctx, int fd);
+struct ctdb_packet_context *ctdb_packet_init(TALLOC_CTX *mem_ctx, int fd);
/*
* Pull data from the fd
*/
-NTSTATUS packet_fd_read(struct packet_context *ctx);
+NTSTATUS ctdb_packet_fd_read(struct ctdb_packet_context *ctx);
/*
* Sync read, wait for the next chunk
*/
-NTSTATUS packet_fd_read_sync(struct packet_context *ctx, int timeout);
+NTSTATUS ctdb_packet_fd_read_sync(struct ctdb_packet_context *ctx, int timeout);
/*
- * Handle an incoming packet:
+ * Handle an incoming ctdb_packet:
* Return False if none is available
* Otherwise return True and store the callback result in *status
* Callback must either talloc_move or talloc_free buf
*/
-bool packet_handler(struct packet_context *ctx,
+bool ctdb_packet_handler(struct ctdb_packet_context *ctx,
bool (*full_req)(const uint8_t *buf,
size_t available,
size_t *length,
@@ -59,27 +59,27 @@ bool packet_handler(struct packet_context *ctx,
/*
* How many bytes of outgoing data do we have pending?
*/
-size_t packet_outgoing_bytes(struct packet_context *ctx);
+size_t ctdb_packet_outgoing_bytes(struct ctdb_packet_context *ctx);
/*
* Push data to the fd
*/
-NTSTATUS packet_fd_write(struct packet_context *ctx);
+NTSTATUS ctdb_packet_fd_write(struct ctdb_packet_context *ctx);
/*
* Sync flush all outgoing bytes
*/
-NTSTATUS packet_flush(struct packet_context *ctx);
+NTSTATUS ctdb_packet_flush(struct ctdb_packet_context *ctx);
/*
* Send a list of DATA_BLOBs
*
- * Example: packet_send(ctx, 2, data_blob_const(&size, sizeof(size)),
+ * Example: ctdb_packet_send(ctx, 2, data_blob_const(&size, sizeof(size)),
* data_blob_const(buf, size));
*/
-NTSTATUS packet_send(struct packet_context *ctx, int num_blobs, ...);
+NTSTATUS ctdb_packet_send(struct ctdb_packet_context *ctx, int num_blobs, ...);
/*
- * Get the packet context's file descriptor
+ * Get the ctdb_packet context's file descriptor
*/
-int packet_get_fd(struct packet_context *ctx);
+int ctdb_packet_get_fd(struct ctdb_packet_context *ctx);
diff --git a/source3/lib/packet.c b/source3/lib/ctdb_packet.c
index 133983d3d4..772fcec421 100644
--- a/source3/lib/packet.c
+++ b/source3/lib/ctdb_packet.c
@@ -1,6 +1,6 @@
-/*
+/*
Unix SMB/CIFS implementation.
- Packet handling
+ CTDB Packet handling
Copyright (C) Volker Lendecke 2007
This program is free software; you can redistribute it and/or modify
@@ -21,9 +21,9 @@
#include "../lib/util/select.h"
#include "system/filesys.h"
#include "system/select.h"
-#include "packet.h"
+#include "ctdb_packet.h"
-struct packet_context {
+struct ctdb_packet_context {
int fd;
DATA_BLOB in, out;
};
@@ -31,32 +31,32 @@ struct packet_context {
/*
* Close the underlying fd
*/
-static int packet_context_destructor(struct packet_context *ctx)
+static int ctdb_packet_context_destructor(struct ctdb_packet_context *ctx)
{
return close(ctx->fd);
}
/*
- * Initialize a packet context. The fd is given to the packet context, meaning
- * that it is automatically closed when the packet context is freed.
+ * Initialize a ctdb_packet context. The fd is given to the ctdb_packet context, meaning
+ * that it is automatically closed when the ctdb_packet context is freed.
*/
-struct packet_context *packet_init(TALLOC_CTX *mem_ctx, int fd)
+struct ctdb_packet_context *ctdb_packet_init(TALLOC_CTX *mem_ctx, int fd)
{
- struct packet_context *result;
+ struct ctdb_packet_context *result;
- if (!(result = TALLOC_ZERO_P(mem_ctx, struct packet_context))) {
+ if (!(result = TALLOC_ZERO_P(mem_ctx, struct ctdb_packet_context))) {
return NULL;
}
result->fd = fd;
- talloc_set_destructor(result, packet_context_destructor);
+ talloc_set_destructor(result, ctdb_packet_context_destructor);
return result;
}
/*
* Pull data from the fd
*/
-NTSTATUS packet_fd_read(struct packet_context *ctx)
+NTSTATUS ctdb_packet_fd_read(struct ctdb_packet_context *ctx)
{
int res, available;
size_t new_size;
@@ -105,7 +105,7 @@ NTSTATUS packet_fd_read(struct packet_context *ctx)
return NT_STATUS_OK;
}
-NTSTATUS packet_fd_read_sync(struct packet_context *ctx, int timeout)
+NTSTATUS ctdb_packet_fd_read_sync(struct ctdb_packet_context *ctx, int timeout)
{
int res, revents;
@@ -124,10 +124,10 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx, int timeout)
return NT_STATUS_IO_TIMEOUT;
}
- return packet_fd_read(ctx);
+ return ctdb_packet_fd_read(ctx);
}
-bool packet_handler(struct packet_context *ctx,
+bool ctdb_packet_handler(struct ctdb_packet_context *ctx,
bool (*full_req)(const uint8_t *buf,
size_t available,
size_t *length,
@@ -171,7 +171,7 @@ bool packet_handler(struct packet_context *ctx,
/*
* How many bytes of outgoing data do we have pending?
*/
-size_t packet_outgoing_bytes(struct packet_context *ctx)
+size_t ctdb_packet_outgoing_bytes(struct ctdb_packet_context *ctx)
{
return ctx->out.length;
}
@@ -179,7 +179,7 @@ size_t packet_outgoing_bytes(struct packet_context *ctx)
/*
* Push data to the fd
*/
-NTSTATUS packet_fd_write(struct packet_context *ctx)
+NTSTATUS ctdb_packet_fd_write(struct ctdb_packet_context *ctx)
{
ssize_t sent;
@@ -200,10 +200,10 @@ NTSTATUS packet_fd_write(struct packet_context *ctx)
/*
* Sync flush all outgoing bytes
*/
-NTSTATUS packet_flush(struct packet_context *ctx)
+NTSTATUS ctdb_packet_flush(struct ctdb_packet_context *ctx)
{
while (ctx->out.length != 0) {
- NTSTATUS status = packet_fd_write(ctx);
+ NTSTATUS status = ctdb_packet_fd_write(ctx);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -214,10 +214,10 @@ NTSTATUS packet_flush(struct packet_context *ctx)
/*
* Send a list of DATA_BLOBs
*
- * Example: packet_send(ctx, 2, data_blob_const(&size, sizeof(size)),
+ * Example: ctdb_packet_send(ctx, 2, data_blob_const(&size, sizeof(size)),
* data_blob_const(buf, size));
*/
-NTSTATUS packet_send(struct packet_context *ctx, int num_blobs, ...)
+NTSTATUS ctdb_packet_send(struct ctdb_packet_context *ctx, int num_blobs, ...)
{
va_list ap;
int i;
@@ -266,10 +266,9 @@ NTSTATUS packet_send(struct packet_context *ctx, int num_blobs, ...)
}
/*
- * Get the packet context's file descriptor
+ * Get the ctdb_packet context's file descriptor
*/
-int packet_get_fd(struct packet_context *ctx)
+int ctdb_packet_get_fd(struct ctdb_packet_context *ctx)
{
return ctx->fd;
}
-
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index a81691a8c9..0b053ecb70 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -23,7 +23,7 @@
#ifdef CLUSTER_SUPPORT
#include "ctdbd_conn.h"
-#include "packet.h"
+#include "ctdb_packet.h"
#include "messages.h"
/* paths to these include files come from --with-ctdb= in configure */
@@ -35,7 +35,7 @@ struct ctdbd_connection {
uint32 reqid;
uint32 our_vnn;
uint64 rand_srvid;
- struct packet_context *pkt;
+ struct ctdb_packet_context *pkt;
struct fd_event *fde;
void (*release_ip_handler)(const char *ip_addr, void *private_data);
@@ -168,9 +168,9 @@ uint32 ctdbd_vnn(const struct ctdbd_connection *conn)
*/
static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx,
- struct packet_context **presult)
+ struct ctdb_packet_context **presult)
{
- struct packet_context *result;
+ struct ctdb_packet_context *result;
const char *sockname = lp_ctdbd_socket();
struct sockaddr_un addr;
int fd;
@@ -196,7 +196,7 @@ static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx,
return map_nt_error_from_unix(errno);
}
- if (!(result = packet_init(mem_ctx, fd))) {
+ if (!(result = ctdb_packet_init(mem_ctx, fd))) {
close(fd);
return NT_STATUS_NO_MEMORY;
}
@@ -271,7 +271,7 @@ struct req_pull_state {
};
/*
- * Pull a ctdb request out of the incoming packet queue
+ * Pull a ctdb request out of the incoming ctdb_packet queue
*/
static NTSTATUS ctdb_req_pull(uint8_t *buf, size_t length,
@@ -329,14 +329,14 @@ static struct messaging_rec *ctdb_pull_messaging_rec(TALLOC_CTX *mem_ctx,
return result;
}
-static NTSTATUS ctdb_packet_fd_read_sync(struct packet_context *ctx)
+static NTSTATUS ctdb_packet_fd_read_sync(struct ctdb_packet_context *ctx)
{
int timeout = lp_ctdb_timeout();
if (timeout == 0) {
timeout = -1;
}
- return packet_fd_read_sync(ctx, timeout);
+ return ctdb_packet_fd_read_sync(ctx, timeout);
}
/*
@@ -364,7 +364,7 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32 reqid,
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("packet_fd_read failed: %s\n", nt_errstr(status)));
+ DEBUG(0, ("ctdb_packet_fd_read failed: %s\n", nt_errstr(status)));
cluster_fatal("ctdbd died\n");
}
@@ -373,7 +373,7 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32 reqid,
ZERO_STRUCT(state);
state.mem_ctx = mem_ctx;
- if (!packet_handler(conn->pkt, ctdb_req_complete, ctdb_req_pull,
+ if (!ctdb_packet_handler(conn->pkt, ctdb_req_complete, ctdb_req_pull,
&state, &status)) {
/*
* Not enough data
@@ -383,7 +383,7 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32 reqid,
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("Could not read packet: %s\n", nt_errstr(status)));
+ DEBUG(0, ("Could not read ctdb_packet: %s\n", nt_errstr(status)));
cluster_fatal("ctdbd died\n");
}
@@ -583,7 +583,7 @@ struct messaging_context *ctdb_conn_msg_ctx(struct ctdbd_connection *conn)
int ctdbd_conn_get_fd(struct ctdbd_connection *conn)
{
- return packet_get_fd(conn->pkt);
+ return ctdb_packet_get_fd(conn->pkt);
}
/*
@@ -674,14 +674,14 @@ static void ctdbd_socket_handler(struct event_context *event_ctx,
NTSTATUS status;
- status = packet_fd_read(conn->pkt);
+ status = ctdb_packet_fd_read(conn->pkt);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("packet_fd_read failed: %s\n", nt_errstr(status)));
cluster_fatal("ctdbd died\n");
}
- while (packet_handler(conn->pkt, ctdb_req_complete,
+ while (ctdb_packet_handler(conn->pkt, ctdb_req_complete,
ctdb_handle_message, conn, &status)) {
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("could not handle incoming message: %s\n",
@@ -701,7 +701,7 @@ NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
SMB_ASSERT(conn->fde == NULL);
if (!(conn->fde = event_add_fd(msg_ctx->event_ctx, conn,
- packet_get_fd(conn->pkt),
+ ctdb_packet_get_fd(conn->pkt),
EVENT_FD_READ,
ctdbd_socket_handler,
conn))) {
@@ -758,17 +758,17 @@ NTSTATUS ctdbd_messaging_send(struct ctdbd_connection *conn,
DEBUG(10, ("ctdbd_messaging_send: Sending ctdb packet\n"));
ctdb_packet_dump(&r.hdr);
- status = packet_send(
+ status = ctdb_packet_send(
conn->pkt, 2,
data_blob_const(&r, offsetof(struct ctdb_req_message, data)),
blob);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("packet_send failed: %s\n", nt_errstr(status)));
+ DEBUG(0, ("ctdb_packet_send failed: %s\n", nt_errstr(status)));
goto fail;
}
- status = packet_flush(conn->pkt);
+ status = ctdb_packet_flush(conn->pkt);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("write to ctdbd failed: %s\n", nt_errstr(status)));
@@ -823,17 +823,17 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
DEBUG(10, ("ctdbd_control: Sending ctdb packet\n"));
ctdb_packet_dump(&req.hdr);
- status = packet_send(
+ status = ctdb_packet_send(
conn->pkt, 2,
data_blob_const(&req, offsetof(struct ctdb_req_control, data)),
data_blob_const(data.dptr, data.dsize));
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3, ("packet_send failed: %s\n", nt_errstr(status)));
+ DEBUG(3, ("ctdb_packet_send failed: %s\n", nt_errstr(status)));
goto fail;
}
- status = packet_flush(conn->pkt);
+ status = ctdb_packet_flush(conn->pkt);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("write to ctdbd failed: %s\n", nt_errstr(status)));
@@ -1005,17 +1005,17 @@ NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32 db_id,
DEBUG(10, ("ctdbd_migrate: Sending ctdb packet\n"));
ctdb_packet_dump(&req.hdr);
- status = packet_send(
+ status = ctdb_packet_send(
conn->pkt, 2,
data_blob_const(&req, offsetof(struct ctdb_req_call, data)),
data_blob_const(key.dptr, key.dsize));
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3, ("packet_send failed: %s\n", nt_errstr(status)));
+ DEBUG(3, ("ctdb_packet_send failed: %s\n", nt_errstr(status)));
return status;
}
- status = packet_flush(conn->pkt);
+ status = ctdb_packet_flush(conn->pkt);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("write to ctdbd failed: %s\n", nt_errstr(status)));
@@ -1064,17 +1064,17 @@ NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id,
req.db_id = db_id;
req.keylen = key.dsize;
- status = packet_send(
+ status = ctdb_packet_send(
conn->pkt, 2,
data_blob_const(&req, offsetof(struct ctdb_req_call, data)),
data_blob_const(key.dptr, key.dsize));
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3, ("packet_send failed: %s\n", nt_errstr(status)));
+ DEBUG(3, ("ctdb_packet_send failed: %s\n", nt_errstr(status)));
return status;
}
- status = packet_flush(conn->pkt);
+ status = ctdb_packet_flush(conn->pkt);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("write to ctdbd failed: %s\n", nt_errstr(status)));
@@ -1235,7 +1235,7 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
status = NT_STATUS_OK;
- if (packet_handler(conn->pkt, ctdb_req_complete,
+ if (ctdb_packet_handler(conn->pkt, ctdb_req_complete,
ctdb_traverse_handler, &state, &status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
@@ -1268,7 +1268,7 @@ NTSTATUS ctdbd_traverse(uint32 db_id,
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("packet_fd_read_sync failed: %s\n", nt_errstr(status)));
+ DEBUG(0, ("ctdb_packet_fd_read_sync failed: %s\n", nt_errstr(status)));
cluster_fatal("ctdbd died\n");
}
}
diff --git a/source3/wscript_build b/source3/wscript_build
index 0a12bfc5d4..83cc39ebe7 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -59,7 +59,7 @@ REG_PARSE_PRS_SRC = '''registry/reg_parse_prs.c'''
LIB_SRC = '''
lib/messages.c lib/messages_local.c
- lib/messages_ctdbd.c lib/packet.c lib/ctdbd_conn.c
+ lib/messages_ctdbd.c lib/ctdb_packet.c lib/ctdbd_conn.c
lib/interfaces.c lib/memcache.c
lib/talloc_dict.c
lib/util_sconn.c