PERFORCE change 122631 for review

Andrew Turner andrew at FreeBSD.org
Sun Jul 1 10:36:23 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=122631

Change 122631 by andrew at andrew_hermies on 2007/07/01 10:35:48

	Add a stub callback for all valid requests
	Make the list_updates callback print it's arguments

Affected files ...

.. //depot/projects/soc2007/andrew-update/backend/facund-be.c#10 edit

Differences ...

==== //depot/projects/soc2007/andrew-update/backend/facund-be.c#10 (text+ko) ====

@@ -62,6 +62,16 @@
 
 static struct facund_response *facund_call_ping(const char *,
     struct facund_object *);
+static struct facund_response *facund_call_list_updates(const char *,
+    struct facund_object *);
+static struct facund_response *facund_call_list_installed(const char *,
+    struct facund_object *);
+static struct facund_response *facund_call_install_patches(const char *,
+    struct facund_object *);
+static struct facund_response *facund_call_rollback_patches(const char *,
+    struct facund_object *);
+static struct facund_response *facund_call_restart_services(const char *,
+    struct facund_object *);
 
 /*
  * Looks for updates on the system with a root of basedir
@@ -275,6 +285,63 @@
 	return resp;
 }
 
+static struct facund_response *
+facund_call_list_updates(const char *id __unused, struct facund_object *obj __unused)
+{
+	const struct facund_object *cur;
+	unsigned int pos;
+
+	if (obj == NULL) {
+		/* TODO: Don't use magic numbers */
+		return facund_response_new(id, 1, "No data sent", NULL);
+	}
+
+	switch (facund_object_get_type(obj)) {
+	case FACUND_STRING:
+		facund_object_print(obj);
+		break;
+	case FACUND_ARRAY:
+		for (pos = 0, cur = facund_object_get_array_item(obj, pos);
+		    cur != NULL; pos++) {
+			facund_object_print(__DECONST(struct facund_object *, cur));
+		}
+		break;
+	default:
+		return facund_response_new(id, 1, "Bad data sent", NULL);
+		break;
+	}
+	printf("STUB: %s\n", __func__);
+	return NULL;
+}
+
+static struct facund_response *
+facund_call_list_installed(const char *id __unused, struct facund_object *obj __unused)
+{
+	printf("STUB: %s\n", __func__);
+	return NULL;
+}
+
+static struct facund_response *
+facund_call_install_patches(const char *id __unused, struct facund_object *obj __unused)
+{
+	printf("STUB: %s\n", __func__);
+	return NULL;
+}
+
+static struct facund_response *
+facund_call_rollback_patches(const char *id __unused, struct facund_object *obj __unused)
+{
+	printf("STUB: %s\n", __func__);
+	return NULL;
+}
+
+static struct facund_response *
+facund_call_restart_services(const char *id __unused, struct facund_object *obj __unused)
+{
+	printf("STUB: %s\n", __func__);
+	return NULL;
+}
+
 int
 main(int argc __unused, char *argv[] __unused)
 {
@@ -341,6 +408,11 @@
 
 	/* Add the callbacks for each call */
 	facund_server_add_call("ping", facund_call_ping);
+	facund_server_add_call("list_updates", facund_call_list_updates);
+	facund_server_add_call("list_installed", facund_call_list_installed);
+	facund_server_add_call("install_patches", facund_call_install_patches);
+	facund_server_add_call("rollback_patches",facund_call_rollback_patches);
+	facund_server_add_call("restart_services",facund_call_restart_services);
 
 	pthread_create(&update_thread, NULL, look_for_updates, base_dirs);
 	pthread_create(&comms_thread, NULL, do_communication, conn);


More information about the p4-projects mailing list