14 #include <linux/kernel.h>
15 #include <linux/module.h>
17 #include <linux/slab.h>
19 #include <linux/in6.h>
68 const char *
buf,
size_t len);
72 const char *
buf,
size_t len);
76 const char *
buf,
size_t len);
139 const char *
buf,
size_t len)
148 .ca_name =
"cluster_name",
150 .show = cluster_cluster_name_read,
151 .store = cluster_cluster_name_write,
155 int *info_field,
int check_zero,
156 const char *
buf,
size_t len)
165 if (check_zero && !x)
174 #define CLUSTER_ATTR(name, check_zero) \
175 static ssize_t name##_write(struct dlm_cluster *cl, const char *buf, size_t len) \
177 return cluster_set(cl, &cl->cl_##name, &dlm_config.ci_##name, \
178 check_zero, buf, len); \
180 static ssize_t name##_read(struct dlm_cluster *cl, char *buf) \
182 return snprintf(buf, PAGE_SIZE, "%u\n", cl->cl_##name); \
184 static struct cluster_attribute cluster_attr_##name = \
185 __CONFIGFS_ATTR(name, 0644, name##_read, name##_write)
234 .show = comm_nodeid_read,
235 .store = comm_nodeid_write,
242 .show = comm_local_read,
243 .store = comm_local_write,
250 .store = comm_addr_write,
255 .ca_name =
"addr_list",
257 .show = comm_addr_list_read,
283 .show = node_nodeid_read,
284 .store = node_nodeid_write,
291 .show = node_weight_read,
292 .store = node_weight_write,
343 .make_group = make_cluster,
344 .drop_item = drop_cluster,
348 .release = release_cluster,
349 .show_attribute = show_cluster,
350 .store_attribute = store_cluster,
354 .make_group = make_space,
355 .drop_item = drop_space,
359 .release = release_space,
363 .make_item = make_comm,
364 .drop_item = drop_comm,
368 .release = release_comm,
369 .show_attribute = show_comm,
370 .store_attribute = store_comm,
374 .make_item = make_node,
375 .drop_item = drop_node,
379 .release = release_node,
380 .show_attribute = show_node,
381 .store_attribute = store_node,
385 .ct_group_ops = &clusters_ops,
390 .ct_item_ops = &cluster_ops,
391 .ct_attrs = cluster_attrs,
396 .ct_group_ops = &spaces_ops,
401 .ct_item_ops = &space_ops,
406 .ct_group_ops = &comms_ops,
411 .ct_item_ops = &comm_ops,
412 .ct_attrs = comm_attrs,
417 .ct_group_ops = &nodes_ops,
423 .ct_attrs = node_attrs,
462 if (!cl || !gps || !sps || !cms)
469 cl->
group.default_groups = gps;
503 struct dlm_cluster *cl = config_item_to_cluster(i);
507 for (j = 0; cl->
group.default_groups[
j]; j++) {
508 tmp = &cl->
group.default_groups[
j]->cg_item;
521 struct dlm_cluster *cl = config_item_to_cluster(i);
536 if (!sp || !gps || !nds)
542 sp->
group.default_groups = gps;
560 struct dlm_space *sp = config_item_to_space(i);
566 for (j = 0; sp->
group.default_groups[
j]; j++) {
567 tmp = &sp->
group.default_groups[
j]->cg_item;
577 struct dlm_space *sp = config_item_to_space(i);
592 cm->
seq = dlm_comm_count++;
594 cm->
seq = dlm_comm_count++;
604 struct dlm_comm *cm = config_item_to_comm(i);
605 if (local_comm == cm)
615 struct dlm_comm *cm = config_item_to_comm(i);
644 struct dlm_node *nd = config_item_to_node(i);
656 struct dlm_node *nd = config_item_to_node(i);
665 .ci_type = &clusters_type,
690 struct dlm_cluster *cl = config_item_to_cluster(i);
693 return cla->
show ? cla->
show(cl, buf) : 0;
698 const char *buf,
size_t len)
700 struct dlm_cluster *cl = config_item_to_cluster(i);
709 struct dlm_comm *cm = config_item_to_comm(i);
712 return cma->
show ? cma->
show(cm, buf) : 0;
716 const char *buf,
size_t len)
718 struct dlm_comm *cm = config_item_to_comm(i);
745 if (cm->
local && !local_comm)
750 static ssize_t comm_addr_write(
struct dlm_comm *cm,
const char *buf,
size_t len)
761 addr = kzalloc(
sizeof(*addr),
GFP_NOFS);
787 char buf0[
sizeof(
"AF_INET6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255\n")];
797 switch(addr->ss_family) {
807 s =
sprintf(buf0,
"%s\n",
"<UNKNOWN>");
818 return 4096 - allowance;
824 struct dlm_node *nd = config_item_to_node(i);
827 return nda->
show ? nda->
show(nd, buf) : 0;
831 const char *buf,
size_t len)
833 struct dlm_node *nd = config_item_to_node(i);
870 static struct dlm_space *get_space(
char *name)
881 return config_item_to_space(i);
884 static void put_space(
struct dlm_space *sp)
901 cm = config_item_to_comm(i);
916 static void put_comm(
struct dlm_comm *cm)
930 sp = get_space(lsname);
971 struct dlm_comm *cm = get_comm(nodeid);
981 return local_comm ? local_comm->
nodeid : 0;
991 memcpy(addr, local_comm->
addr[num],
sizeof(*addr));
996 #define DEFAULT_TCP_PORT 21064
997 #define DEFAULT_BUFFER_SIZE 4096
998 #define DEFAULT_RSBTBL_SIZE 1024
999 #define DEFAULT_RECOVER_TIMER 5
1000 #define DEFAULT_TOSS_SECS 10
1001 #define DEFAULT_SCAN_SECS 5
1002 #define DEFAULT_LOG_DEBUG 0
1003 #define DEFAULT_PROTOCOL 0
1004 #define DEFAULT_TIMEWARN_CS 500
1005 #define DEFAULT_WAITWARN_US 0
1006 #define DEFAULT_NEW_RSB_COUNT 128
1007 #define DEFAULT_RECOVER_CALLBACKS 0
1008 #define DEFAULT_CLUSTER_NAME ""