aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-registry
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mds-registry/registry.c4
-rw-r--r--src/mds-registry/slave.c7
-rw-r--r--src/mds-registry/slave.h40
3 files changed, 36 insertions, 15 deletions
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index 53b905b..334d97d 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -134,6 +134,7 @@ static int handle_close_message(void)
* @param client The ID of the client that implements the server-side of the protocol
* @return Non-zero on error
*/
+__attribute__((nonnull))
static int registry_action_add(int has_key, char* command, size_t command_key, uint64_t client)
{
int saved_errno;
@@ -221,6 +222,7 @@ static void registry_action_remove(size_t command_key, uint64_t client)
* @param wait_set Table to fill with missing protocols if `action == 0`
* @return Non-zero on error
*/
+__attribute__((nonnull))
static int registry_action_act(char* command, int action, uint64_t client, hash_table_t* wait_set)
{
size_t command_key = (size_t)(void*)command;
@@ -268,6 +270,7 @@ static int registry_action_act(char* command, int action, uint64_t client, hash_
* @return Zero on success -1 on error or interruption,
* `errno` will be set accordingly
*/
+__attribute__((nonnull))
static int registry_action(size_t length, int action, const char* recv_client_id, const char* recv_message_id)
{
char* payload = received.payload;
@@ -343,6 +346,7 @@ static int registry_action(size_t length, int action, const char* recv_client_id
* @return Zero on success, -1 on error or interruption,
* `errno` will be set accordingly
*/
+__attribute__((nonnull))
static int list_registry(const char* recv_client_id, const char* recv_message_id)
{
size_t ptr = 0, i;
diff --git a/src/mds-registry/slave.c b/src/mds-registry/slave.c
index a2f4005..7376b0c 100644
--- a/src/mds-registry/slave.c
+++ b/src/mds-registry/slave.c
@@ -38,6 +38,7 @@
* @param slave The slave
* @return Non-zero, `errno` will be set accordingly
*/
+__attribute__((nonnull))
static int slave_notify_client(slave_t* slave)
{
char buf[sizeof("To: %s\nIn response to: %s\nMessage ID: %" PRIu32 "\nOrigin command: register\n\n")
@@ -167,7 +168,8 @@ int start_created_slave(slave_t* restrict slave)
* @param recv_message_id The ID of the message that triggered the waiting
* @return Non-zero on error
*/
-int start_slave(hash_table_t* restrict wait_set, const char* restrict recv_client_id, const char* restrict recv_message_id)
+int start_slave(hash_table_t* restrict wait_set, const char* restrict recv_client_id,
+ const char* restrict recv_message_id)
{
slave_t* slave = slave_create(wait_set, recv_client_id, recv_message_id);
size_t slave_address, i;
@@ -273,7 +275,8 @@ int advance_slaves(char* command)
* @param recv_message_id The ID of the message that triggered the waiting
* @return The slave, `NULL` on error, `errno` will be set accordingly
*/
-slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv_client_id, const char* restrict recv_message_id)
+slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv_client_id,
+ const char* restrict recv_message_id)
{
slave_t* restrict rc = NULL;
int saved_errno;
diff --git a/src/mds-registry/slave.h b/src/mds-registry/slave.h
index 59183ea..1213aaa 100644
--- a/src/mds-registry/slave.h
+++ b/src/mds-registry/slave.h
@@ -87,6 +87,15 @@ typedef struct slave
/**
+ * Start a slave thread with an already created slave
+ *
+ * @param slave The slave
+ * @return Non-zero on error, `errno` will be set accordingly
+ */
+__attribute__((nonnull))
+int start_created_slave(slave_t* restrict slave);
+
+/**
* Start a slave thread
*
* @param wait_set Set of protocols for which to wait that they become available
@@ -94,15 +103,9 @@ typedef struct slave
* @param recv_message_id The ID of the message that triggered the waiting
* @return Non-zero on error
*/
-int start_slave(hash_table_t* restrict wait_set, const char* restrict recv_client_id, const char* restrict recv_message_id);
-
-/**
- * Start a slave thread with an already created slave
- *
- * @param slave The slave
- * @return Non-zero on error, `errno` will be set accordingly
- */
-int start_created_slave(slave_t* restrict slave);
+__attribute__((nonnull))
+int start_slave(hash_table_t* restrict wait_set, const char* restrict recv_client_id,
+ const char* restrict recv_message_id);
/**
* Close all slaves associated with a client
@@ -117,14 +120,20 @@ void close_slaves(uint64_t client);
* @param command The protocol
* @return Non-zero on error, `ernno`will be set accordingly
*/
+__attribute__((nonnull))
int advance_slaves(char* command);
/**
* Create a slave
*
- * @return The slave
+ * @param wait_set Set of protocols for which to wait that they become available
+ * @param recv_client_id The ID of the waiting client
+ * @param recv_message_id The ID of the message that triggered the waiting
+ * @return The slave, `NULL` on error, `errno` will be set accordingly
*/
-slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv_client_id, const char* restrict recv_message_id);
+__attribute__((nonnull))
+slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv_client_id,
+ const char* restrict recv_message_id);
/**
@@ -132,6 +141,7 @@ slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv
*
* @param this Memory slot in which to store the new slave information
*/
+__attribute__((nonnull))
void slave_initialise(slave_t* restrict this);
/**
@@ -147,7 +157,8 @@ void slave_destroy(slave_t* restrict this);
* @param this The slave information
* @return The number of bytes to allocate to the output buffer
*/
-size_t slave_marshal_size(const slave_t* restrict this) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t slave_marshal_size(const slave_t* restrict this);
/**
* Marshals slave information
@@ -156,6 +167,7 @@ size_t slave_marshal_size(const slave_t* restrict this) __attribute__((pure));
* @param data Output buffer for the marshalled data
* @return The number of bytes that have been written (everything will be written)
*/
+__attribute__((nonnull))
size_t slave_marshal(const slave_t* restrict this, char* restrict data);
/**
@@ -166,6 +178,7 @@ size_t slave_marshal(const slave_t* restrict this, char* restrict data);
* @return Zero on error, `errno` will be set accordingly, otherwise the
* number of read bytes. Destroy the slave information on error.
*/
+__attribute__((nonnull))
size_t slave_unmarshal(slave_t* restrict this, char* restrict data);
/**
@@ -174,7 +187,8 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data);
* @param data In buffer with the marshalled data
* @return The number of read bytes
*/
-size_t slave_unmarshal_skip(char* restrict data) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t slave_unmarshal_skip(char* restrict data);
#endif