changeset 121:652b13a0e764

client: respond to NOP RPC with status 0 Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> Signed-off-by: Steve Dougherty <steve@asksteved.com> Signed-off-by: Joshua Kahn <josh@joshuak.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 17 Oct 2015 20:36:16 -0400
parents ba786304afb3
children 52772d293239
files src/client/CMakeLists.txt src/client/cmd_nop.c src/client/cmds.h src/client/main.c
diffstat 4 files changed, 62 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/client/CMakeLists.txt	Sat Oct 17 20:13:39 2015 -0400
+++ b/src/client/CMakeLists.txt	Sat Oct 17 20:36:16 2015 -0400
@@ -22,6 +22,7 @@
 
 add_executable(nomad-client
 	main.c
+	cmd_nop.c
 )
 
 target_link_libraries(nomad-client
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/client/cmd_nop.c	Sat Oct 17 20:36:16 2015 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "cmds.h"
+
+int cmd_nop(void)
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/client/cmds.h	Sat Oct 17 20:36:16 2015 -0400
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __NOMAD_CLIENT_CMDS_H
+#define __NOMAD_CLIENT_CMDS_H
+
+int cmd_nop(void);
+
+#endif
--- a/src/client/main.c	Sat Oct 17 20:13:39 2015 -0400
+++ b/src/client/main.c	Sat Oct 17 20:36:16 2015 -0400
@@ -30,6 +30,8 @@
 #include <nomad/connsvc.h>
 #include <nomad/rpc_fs.h>
 
+#include "cmds.h"
+
 #define CLIENT_DAEMON_PORT	2323
 
 #define MAP_ERRNO(errno)		\
@@ -67,6 +69,7 @@
 {
 	struct rpc_header_req cmd;
 	bool ok = false;
+	int ret;
 	XDR xdr;
 
 	xdrfd_create(&xdr, fd, XDR_DECODE);
@@ -78,7 +81,8 @@
 
 	switch (cmd.opcode) {
 		case NRPC_NOP:
-			ok = true;
+			ret = cmd_nop();
+			ok = send_response(&xdr, fd, ret);
 			break;
 		default:
 			send_response(&xdr, fd, ENOTSUP);