Sfoglia il codice sorgente

ctl: rpc commands updated to use rpl_printf()

Daniel-Constantin Mierla 11 anni fa
parent
commit
f1878cdba8
2 ha cambiato i file con 8 aggiunte e 8 eliminazioni
  1. 5 5
      modules/ctl/binrpc_run.c
  2. 3 3
      modules/ctl/fifo_server.c

+ 5 - 5
modules/ctl/binrpc_run.c

@@ -116,7 +116,7 @@ static int rpc_send(struct binrpc_ctx* ctx);
 static int rpc_send_v(struct iovec_array *a);
 static int rpc_send_v(struct iovec_array *a);
 static int rpc_add(struct binrpc_ctx* ctx, char* fmt, ...);
 static int rpc_add(struct binrpc_ctx* ctx, char* fmt, ...);
 static int rpc_scan(struct binrpc_ctx* ctx, char* fmt, ...);
 static int rpc_scan(struct binrpc_ctx* ctx, char* fmt, ...);
-static int rpc_printf(struct binrpc_ctx* ctx, char* fmt, ...);
+static int rpc_rpl_printf(struct binrpc_ctx* ctx, char* fmt, ...);
 static int rpc_struct_add(struct rpc_struct_l* s, char* fmt, ...);
 static int rpc_struct_add(struct rpc_struct_l* s, char* fmt, ...);
 static int rpc_array_add(struct rpc_struct_l* s, char* fmt, ...);
 static int rpc_array_add(struct rpc_struct_l* s, char* fmt, ...);
 static int rpc_struct_scan(struct rpc_struct_l* s, char* fmt, ...);
 static int rpc_struct_scan(struct rpc_struct_l* s, char* fmt, ...);
@@ -134,7 +134,7 @@ void binrpc_callbacks_init(void)
 	binrpc_callbacks.send          = (rpc_send_f)rpc_send;
 	binrpc_callbacks.send          = (rpc_send_f)rpc_send;
 	binrpc_callbacks.add           = (rpc_add_f)rpc_add;
 	binrpc_callbacks.add           = (rpc_add_f)rpc_add;
 	binrpc_callbacks.scan          = (rpc_scan_f)rpc_scan;
 	binrpc_callbacks.scan          = (rpc_scan_f)rpc_scan;
-	binrpc_callbacks.printf        = (rpc_printf_f)rpc_printf;
+	binrpc_callbacks.rpl_printf    = (rpc_rpl_printf_f)rpc_rpl_printf;
 	binrpc_callbacks.struct_add    = (rpc_struct_add_f)rpc_struct_add;
 	binrpc_callbacks.struct_add    = (rpc_struct_add_f)rpc_struct_add;
 	binrpc_callbacks.array_add     = (rpc_struct_add_f)rpc_array_add;
 	binrpc_callbacks.array_add     = (rpc_struct_add_f)rpc_array_add;
 	binrpc_callbacks.struct_scan   = (rpc_struct_scan_f)rpc_struct_scan;
 	binrpc_callbacks.struct_scan   = (rpc_struct_scan_f)rpc_struct_scan;
@@ -1022,7 +1022,7 @@ error:
 
 
 #define RPC_PRINTF_BUF_SIZE	1024
 #define RPC_PRINTF_BUF_SIZE	1024
 /* returns  0 on success, -1 on error */
 /* returns  0 on success, -1 on error */
-static int rpc_printf(struct binrpc_ctx* ctx, char* fmt, ...)
+static int rpc_rpl_printf(struct binrpc_ctx* ctx, char* fmt, ...)
 {
 {
 	va_list ap;
 	va_list ap;
 	char* buf;
 	char* buf;
@@ -1035,12 +1035,12 @@ static int rpc_printf(struct binrpc_ctx* ctx, char* fmt, ...)
 	len=vsnprintf(buf, RPC_PRINTF_BUF_SIZE, fmt, ap);
 	len=vsnprintf(buf, RPC_PRINTF_BUF_SIZE, fmt, ap);
 	va_end(ap);
 	va_end(ap);
 	if ((len<0) || (len> RPC_PRINTF_BUF_SIZE)){
 	if ((len<0) || (len> RPC_PRINTF_BUF_SIZE)){
-		LOG(L_ERR, "ERROR: binrpc: rpc_printf: buffer size exceeded(%d)\n",
+		LOG(L_ERR, "ERROR: binrpc: rpc_rpl_printf: buffer size exceeded(%d)\n",
 				RPC_PRINTF_BUF_SIZE);
 				RPC_PRINTF_BUF_SIZE);
 		goto error;
 		goto error;
 	}
 	}
 	if ((err=binrpc_addstr(&ctx->out.pkt, buf, len))<0){
 	if ((err=binrpc_addstr(&ctx->out.pkt, buf, len))<0){
-		LOG(L_ERR, "ERROR: binrpc: rpc_printf: binrpc_addstr failed:"
+		LOG(L_ERR, "ERROR: binrpc: rpc_rpl_printf: binrpc_addstr failed:"
 					" %s (%d)\n", binrpc_error(err), err);
 					" %s (%d)\n", binrpc_error(err), err);
 		goto error;
 		goto error;
 	}
 	}

+ 3 - 3
modules/ctl/fifo_server.c

@@ -191,7 +191,7 @@ static int  rpc_send         (rpc_ctx_t* ctx);                                 /
 static void rpc_fault        (rpc_ctx_t* ctx,       int code, char* fmt, ...); /* Signal a failure to the client */
 static void rpc_fault        (rpc_ctx_t* ctx,       int code, char* fmt, ...); /* Signal a failure to the client */
 static int  rpc_add          (rpc_ctx_t* ctx,       char* fmt, ...);           /* Add a new piece of data to the result */
 static int  rpc_add          (rpc_ctx_t* ctx,       char* fmt, ...);           /* Add a new piece of data to the result */
 static int  rpc_scan         (rpc_ctx_t* ctx,       char* fmt, ...);           /* Retrieve request parameters */
 static int  rpc_scan         (rpc_ctx_t* ctx,       char* fmt, ...);           /* Retrieve request parameters */
-static int  rpc_printf       (rpc_ctx_t* ctx,       char* fmt, ...);           /* Add printf-like formated data to the result set */
+static int  rpc_rpl_printf   (rpc_ctx_t* ctx,       char* fmt, ...);           /* Add printf-like formated data to the result set */
 static int  rpc_struct_add   (struct text_chunk* s, char* fmt, ...);           /* Create a new structure */
 static int  rpc_struct_add   (struct text_chunk* s, char* fmt, ...);           /* Create a new structure */
 static int  rpc_struct_scan  (struct rpc_struct* s, char* fmt, ...);           /* Scan attributes of a structure */
 static int  rpc_struct_scan  (struct rpc_struct* s, char* fmt, ...);           /* Scan attributes of a structure */
 static int  rpc_struct_printf(struct text_chunk* s, char* name, char* fmt, ...);
 static int  rpc_struct_printf(struct text_chunk* s, char* name, char* fmt, ...);
@@ -910,7 +910,7 @@ int fifo_rpc_init()
 	func_param.fault = (rpc_fault_f)rpc_fault;
 	func_param.fault = (rpc_fault_f)rpc_fault;
 	func_param.add = (rpc_add_f)rpc_add;
 	func_param.add = (rpc_add_f)rpc_add;
 	func_param.scan = (rpc_scan_f)rpc_scan;
 	func_param.scan = (rpc_scan_f)rpc_scan;
-	func_param.printf = (rpc_printf_f)rpc_printf;
+	func_param.rpl_printf = (rpc_rpl_printf_f)rpc_rpl_printf;
 	func_param.struct_add = (rpc_struct_add_f)rpc_struct_add;
 	func_param.struct_add = (rpc_struct_add_f)rpc_struct_add;
 	/* use rpc_struct_add for array_add */
 	/* use rpc_struct_add for array_add */
 	func_param.array_add = (rpc_array_add_f)rpc_struct_add;
 	func_param.array_add = (rpc_array_add_f)rpc_struct_add;
@@ -1285,7 +1285,7 @@ static int rpc_struct_printf(struct text_chunk* c, char* name, char* fmt, ...)
 }
 }
 
 
 
 
-static int rpc_printf(rpc_ctx_t* ctx, char* fmt, ...)
+static int rpc_rpl_printf(rpc_ctx_t* ctx, char* fmt, ...)
 {
 {
 	int n, buf_size;
 	int n, buf_size;
 	char* buf;
 	char* buf;