[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Linux-cluster] Re: [RFC] Transport independent Cluster service



To further explain the simplicity of writing a cluster service using
this framework  you can look at the below  attached icstest service.

with this calling ics_test_print(char *string) will cause the string
to be printed on node 3.

-aneesh

Attachment: icstest.svc
Description: Binary data

#include <linux/cluster.h>
#include <cluster/nsc.h>
#include <cluster/config.h>
#include <cluster/ics/ics_private.h>


#include <cluster/gen/ics_icstest_macros_gen.h>
#include <cluster/gen/ics_icstest_protos_gen.h>

int rics_print(clusternode_t node, int *rval,
		char *name, int namelen)
{
	printk("Printing the message-> %s\n", name);
	return 0;
}

int __ics_test_print(clusternode_t node, char *string)
{
	int ret;
	if (node == this_node) {
		rics_print(node, &ret, string, strlen(string)+1);
	} else {
		RICS_PRINT(node, &ret, string, strlen(string)+1);
	}
	return ret;
}

int ics_test_print(char *string)
{
	return __ics_test_print(3, string);
}

/*
 *	ICSSIG client/server stub routines.
 *	Copyright 2001 Compaq Computer Corporation
 *
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License as
 *	published by the Free Software Foundation; either version 2 of
 *	the License, or (at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE
 *	or NON INFRINGEMENT.  See the GNU General Public License for more
 *	details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *	Questions/Comments/Bugfixes to ci-linux-devel lists sourceforge net
 *
 */
#include <cluster/icsgen.h>

cluster_svc_t cluster_icstest_svc;

/*
 * Include prototypes, client and server stubs generated by icsgen.
 */
#include <cluster/gen/ics_icstest_protos_gen.h>
#include <cluster/gen/icscli_icstest_gen.c>
#include <cluster/gen/icssvr_icstest_gen.c>

/*
 * Include the server tables and service registration generated by icsgen.
 */
#include <cluster/gen/icssvr_icstest_tables_gen.c>

/*
 * Register ICSSIG components with CI.
 */
static int __init ci_init_icstest(void)
{
	/* Register ICSSIG cluster service */
	return register_cluster_svc(&cluster_icstest_svc,
				    ics_default_chan,
				    ics_icstest_svc_init);
}

/* XXX: There is currently no option to compile this as a module. */
module_init(ci_init_icstest)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]