mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
e42fc0d4f5
Add an input queue where we keep received pdus we have not yet processed This allows us to perform SYNC calls from an ASYNC callback (This used to be ctdb commit c111e98d3ad7bd3d09f4081e9bb1443d3722672f)
42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
#ifndef _LIBCTDB_IO_ELEM_H
|
|
#define _LIBCTDB_IO_ELEM_H
|
|
#include <stdbool.h>
|
|
|
|
/* Packets are of form: <u32 length><data>. */
|
|
|
|
/* Create a new queue element of at least len bytes (for reading or writing).
|
|
* Len may be rounded up for alignment. */
|
|
struct io_elem *new_io_elem(size_t len);
|
|
|
|
/* Free a queue element. */
|
|
void free_io_elem(struct io_elem *io);
|
|
|
|
/* If finished, this returns the request header, otherwise NULL. */
|
|
bool io_elem_finished(const struct io_elem *io);
|
|
|
|
/* Reset an io_elem to the start. */
|
|
void io_elem_reset(struct io_elem *io);
|
|
|
|
/* Access to raw data: if len is non-NULL it is filled in. */
|
|
void *io_elem_data(const struct io_elem *io, size_t *len);
|
|
|
|
/* Initialise the struct ctdb_req_header at the front of the I/O. */
|
|
void io_elem_init_req_header(struct io_elem *io,
|
|
uint32_t operation,
|
|
uint32_t destnode,
|
|
uint32_t reqid);
|
|
|
|
/* Returns -1 if we hit an error. Otherwise bytes read. */
|
|
int read_io_elem(int fd, struct io_elem *io);
|
|
|
|
/* Returns -1 if we hit an error. Otherwise bytes written. */
|
|
int write_io_elem(int fd, struct io_elem *io);
|
|
|
|
/* Queues a received io element for later processing */
|
|
void io_elem_queue(struct ctdb_connection *ctdb, struct io_elem *io);
|
|
|
|
/* Removes an element from the queue */
|
|
void io_elem_dequeue(struct ctdb_connection *ctdb, struct io_elem *io);
|
|
|
|
#endif /* _LIBCTDB_IO_ELEM_H */
|