1 /******************************************************************************
2 *******************************************************************************
4 ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5 ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
7 ** This copyrighted material is made available to anyone wishing to use,
8 ** modify, copy, or redistribute it subject to the terms and conditions
9 ** of the GNU General Public License v.2.
11 *******************************************************************************
12 ******************************************************************************/
14 #include <linux/kernel.h>
15 #include <linux/module.h>
16 #include <linux/configfs.h>
23 * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/nodeid
24 * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/weight
25 * /config/dlm/<cluster>/comms/<comm>/nodeid
26 * /config/dlm/<cluster>/comms/<comm>/local
27 * /config/dlm/<cluster>/comms/<comm>/addr
28 * The <cluster> level is useless, but I haven't figured out how to avoid it.
31 static struct config_group *space_list;
32 static struct config_group *comm_list;
33 static struct comm *local_comm;
44 static int make_cluster(struct config_group *, const char *,
45 struct config_group **);
46 static void drop_cluster(struct config_group *, struct config_item *);
47 static void release_cluster(struct config_item *);
48 static int make_space(struct config_group *, const char *,
49 struct config_group **);
50 static void drop_space(struct config_group *, struct config_item *);
51 static void release_space(struct config_item *);
52 static int make_comm(struct config_group *, const char *,
53 struct config_item **);
54 static void drop_comm(struct config_group *, struct config_item *);
55 static void release_comm(struct config_item *);
56 static int make_node(struct config_group *, const char *,
57 struct config_item **);
58 static void drop_node(struct config_group *, struct config_item *);
59 static void release_node(struct config_item *);
61 static ssize_t show_cluster(struct config_item *i, struct configfs_attribute *a,
63 static ssize_t store_cluster(struct config_item *i,
64 struct configfs_attribute *a,
65 const char *buf, size_t len);
66 static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a,
68 static ssize_t store_comm(struct config_item *i, struct configfs_attribute *a,
69 const char *buf, size_t len);
70 static ssize_t show_node(struct config_item *i, struct configfs_attribute *a,
72 static ssize_t store_node(struct config_item *i, struct configfs_attribute *a,
73 const char *buf, size_t len);
75 static ssize_t comm_nodeid_read(struct comm *cm, char *buf);
76 static ssize_t comm_nodeid_write(struct comm *cm, const char *buf, size_t len);
77 static ssize_t comm_local_read(struct comm *cm, char *buf);
78 static ssize_t comm_local_write(struct comm *cm, const char *buf, size_t len);
79 static ssize_t comm_addr_write(struct comm *cm, const char *buf, size_t len);
80 static ssize_t node_nodeid_read(struct node *nd, char *buf);
81 static ssize_t node_nodeid_write(struct node *nd, const char *buf, size_t len);
82 static ssize_t node_weight_read(struct node *nd, char *buf);
83 static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len);
86 struct config_group group;
87 unsigned int cl_tcp_port;
88 unsigned int cl_buffer_size;
89 unsigned int cl_rsbtbl_size;
90 unsigned int cl_lkbtbl_size;
91 unsigned int cl_dirtbl_size;
92 unsigned int cl_recover_timer;
93 unsigned int cl_toss_secs;
94 unsigned int cl_scan_secs;
95 unsigned int cl_log_debug;
96 unsigned int cl_protocol;
97 unsigned int cl_timewarn_cs;
101 CLUSTER_ATTR_TCP_PORT = 0,
102 CLUSTER_ATTR_BUFFER_SIZE,
103 CLUSTER_ATTR_RSBTBL_SIZE,
104 CLUSTER_ATTR_LKBTBL_SIZE,
105 CLUSTER_ATTR_DIRTBL_SIZE,
106 CLUSTER_ATTR_RECOVER_TIMER,
107 CLUSTER_ATTR_TOSS_SECS,
108 CLUSTER_ATTR_SCAN_SECS,
109 CLUSTER_ATTR_LOG_DEBUG,
110 CLUSTER_ATTR_PROTOCOL,
111 CLUSTER_ATTR_TIMEWARN_CS,
114 struct cluster_attribute {
115 struct configfs_attribute attr;
116 ssize_t (*show)(struct cluster *, char *);
117 ssize_t (*store)(struct cluster *, const char *, size_t);
120 static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field,
121 int *info_field, int check_zero,
122 const char *buf, size_t len)
126 if (!capable(CAP_SYS_ADMIN))
129 x = simple_strtoul(buf, NULL, 0);
131 if (check_zero && !x)
140 #define CLUSTER_ATTR(name, check_zero) \
141 static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len) \
143 return cluster_set(cl, &cl->cl_##name, &dlm_config.ci_##name, \
144 check_zero, buf, len); \
146 static ssize_t name##_read(struct cluster *cl, char *buf) \
148 return snprintf(buf, PAGE_SIZE, "%u\n", cl->cl_##name); \
150 static struct cluster_attribute cluster_attr_##name = \
151 __CONFIGFS_ATTR(name, 0644, name##_read, name##_write)
153 CLUSTER_ATTR(tcp_port, 1);
154 CLUSTER_ATTR(buffer_size, 1);
155 CLUSTER_ATTR(rsbtbl_size, 1);
156 CLUSTER_ATTR(lkbtbl_size, 1);
157 CLUSTER_ATTR(dirtbl_size, 1);
158 CLUSTER_ATTR(recover_timer, 1);
159 CLUSTER_ATTR(toss_secs, 1);
160 CLUSTER_ATTR(scan_secs, 1);
161 CLUSTER_ATTR(log_debug, 0);
162 CLUSTER_ATTR(protocol, 0);
163 CLUSTER_ATTR(timewarn_cs, 1);
165 static struct configfs_attribute *cluster_attrs[] = {
166 [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr,
167 [CLUSTER_ATTR_BUFFER_SIZE] = &cluster_attr_buffer_size.attr,
168 [CLUSTER_ATTR_RSBTBL_SIZE] = &cluster_attr_rsbtbl_size.attr,
169 [CLUSTER_ATTR_LKBTBL_SIZE] = &cluster_attr_lkbtbl_size.attr,
170 [CLUSTER_ATTR_DIRTBL_SIZE] = &cluster_attr_dirtbl_size.attr,
171 [CLUSTER_ATTR_RECOVER_TIMER] = &cluster_attr_recover_timer.attr,
172 [CLUSTER_ATTR_TOSS_SECS] = &cluster_attr_toss_secs.attr,
173 [CLUSTER_ATTR_SCAN_SECS] = &cluster_attr_scan_secs.attr,
174 [CLUSTER_ATTR_LOG_DEBUG] = &cluster_attr_log_debug.attr,
175 [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol.attr,
176 [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs.attr,
181 COMM_ATTR_NODEID = 0,
186 struct comm_attribute {
187 struct configfs_attribute attr;
188 ssize_t (*show)(struct comm *, char *);
189 ssize_t (*store)(struct comm *, const char *, size_t);
192 static struct comm_attribute comm_attr_nodeid = {
193 .attr = { .ca_owner = THIS_MODULE,
195 .ca_mode = S_IRUGO | S_IWUSR },
196 .show = comm_nodeid_read,
197 .store = comm_nodeid_write,
200 static struct comm_attribute comm_attr_local = {
201 .attr = { .ca_owner = THIS_MODULE,
203 .ca_mode = S_IRUGO | S_IWUSR },
204 .show = comm_local_read,
205 .store = comm_local_write,
208 static struct comm_attribute comm_attr_addr = {
209 .attr = { .ca_owner = THIS_MODULE,
211 .ca_mode = S_IRUGO | S_IWUSR },
212 .store = comm_addr_write,
215 static struct configfs_attribute *comm_attrs[] = {
216 [COMM_ATTR_NODEID] = &comm_attr_nodeid.attr,
217 [COMM_ATTR_LOCAL] = &comm_attr_local.attr,
218 [COMM_ATTR_ADDR] = &comm_attr_addr.attr,
223 NODE_ATTR_NODEID = 0,
227 struct node_attribute {
228 struct configfs_attribute attr;
229 ssize_t (*show)(struct node *, char *);
230 ssize_t (*store)(struct node *, const char *, size_t);
233 static struct node_attribute node_attr_nodeid = {
234 .attr = { .ca_owner = THIS_MODULE,
236 .ca_mode = S_IRUGO | S_IWUSR },
237 .show = node_nodeid_read,
238 .store = node_nodeid_write,
241 static struct node_attribute node_attr_weight = {
242 .attr = { .ca_owner = THIS_MODULE,
244 .ca_mode = S_IRUGO | S_IWUSR },
245 .show = node_weight_read,
246 .store = node_weight_write,
249 static struct configfs_attribute *node_attrs[] = {
250 [NODE_ATTR_NODEID] = &node_attr_nodeid.attr,
251 [NODE_ATTR_WEIGHT] = &node_attr_weight.attr,
256 struct configfs_subsystem subsys;
260 struct config_group ss_group;
264 struct config_group group;
265 struct list_head members;
266 struct mutex members_lock;
271 struct config_group cs_group;
275 struct config_item item;
279 struct sockaddr_storage *addr[DLM_MAX_ADDR_COUNT];
283 struct config_group ns_group;
287 struct config_item item;
288 struct list_head list; /* space->members */
294 static struct configfs_group_operations clusters_ops = {
295 .make_group = make_cluster,
296 .drop_item = drop_cluster,
299 static struct configfs_item_operations cluster_ops = {
300 .release = release_cluster,
301 .show_attribute = show_cluster,
302 .store_attribute = store_cluster,
305 static struct configfs_group_operations spaces_ops = {
306 .make_group = make_space,
307 .drop_item = drop_space,
310 static struct configfs_item_operations space_ops = {
311 .release = release_space,
314 static struct configfs_group_operations comms_ops = {
315 .make_item = make_comm,
316 .drop_item = drop_comm,
319 static struct configfs_item_operations comm_ops = {
320 .release = release_comm,
321 .show_attribute = show_comm,
322 .store_attribute = store_comm,
325 static struct configfs_group_operations nodes_ops = {
326 .make_item = make_node,
327 .drop_item = drop_node,
330 static struct configfs_item_operations node_ops = {
331 .release = release_node,
332 .show_attribute = show_node,
333 .store_attribute = store_node,
336 static struct config_item_type clusters_type = {
337 .ct_group_ops = &clusters_ops,
338 .ct_owner = THIS_MODULE,
341 static struct config_item_type cluster_type = {
342 .ct_item_ops = &cluster_ops,
343 .ct_attrs = cluster_attrs,
344 .ct_owner = THIS_MODULE,
347 static struct config_item_type spaces_type = {
348 .ct_group_ops = &spaces_ops,
349 .ct_owner = THIS_MODULE,
352 static struct config_item_type space_type = {
353 .ct_item_ops = &space_ops,
354 .ct_owner = THIS_MODULE,
357 static struct config_item_type comms_type = {
358 .ct_group_ops = &comms_ops,
359 .ct_owner = THIS_MODULE,
362 static struct config_item_type comm_type = {
363 .ct_item_ops = &comm_ops,
364 .ct_attrs = comm_attrs,
365 .ct_owner = THIS_MODULE,
368 static struct config_item_type nodes_type = {
369 .ct_group_ops = &nodes_ops,
370 .ct_owner = THIS_MODULE,
373 static struct config_item_type node_type = {
374 .ct_item_ops = &node_ops,
375 .ct_attrs = node_attrs,
376 .ct_owner = THIS_MODULE,
379 static struct cluster *to_cluster(struct config_item *i)
381 return i ? container_of(to_config_group(i), struct cluster, group):NULL;
384 static struct space *to_space(struct config_item *i)
386 return i ? container_of(to_config_group(i), struct space, group) : NULL;
389 static struct comm *to_comm(struct config_item *i)
391 return i ? container_of(i, struct comm, item) : NULL;
394 static struct node *to_node(struct config_item *i)
396 return i ? container_of(i, struct node, item) : NULL;
399 static int make_cluster(struct config_group *g, const char *name,
400 struct config_group **new_g)
402 struct cluster *cl = NULL;
403 struct spaces *sps = NULL;
404 struct comms *cms = NULL;
407 cl = kzalloc(sizeof(struct cluster), GFP_KERNEL);
408 gps = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL);
409 sps = kzalloc(sizeof(struct spaces), GFP_KERNEL);
410 cms = kzalloc(sizeof(struct comms), GFP_KERNEL);
412 if (!cl || !gps || !sps || !cms)
415 config_group_init_type_name(&cl->group, name, &cluster_type);
416 config_group_init_type_name(&sps->ss_group, "spaces", &spaces_type);
417 config_group_init_type_name(&cms->cs_group, "comms", &comms_type);
419 cl->group.default_groups = gps;
420 cl->group.default_groups[0] = &sps->ss_group;
421 cl->group.default_groups[1] = &cms->cs_group;
422 cl->group.default_groups[2] = NULL;
424 cl->cl_tcp_port = dlm_config.ci_tcp_port;
425 cl->cl_buffer_size = dlm_config.ci_buffer_size;
426 cl->cl_rsbtbl_size = dlm_config.ci_rsbtbl_size;
427 cl->cl_lkbtbl_size = dlm_config.ci_lkbtbl_size;
428 cl->cl_dirtbl_size = dlm_config.ci_dirtbl_size;
429 cl->cl_recover_timer = dlm_config.ci_recover_timer;
430 cl->cl_toss_secs = dlm_config.ci_toss_secs;
431 cl->cl_scan_secs = dlm_config.ci_scan_secs;
432 cl->cl_log_debug = dlm_config.ci_log_debug;
433 cl->cl_protocol = dlm_config.ci_protocol;
434 cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs;
436 space_list = &sps->ss_group;
437 comm_list = &cms->cs_group;
449 static void drop_cluster(struct config_group *g, struct config_item *i)
451 struct cluster *cl = to_cluster(i);
452 struct config_item *tmp;
455 for (j = 0; cl->group.default_groups[j]; j++) {
456 tmp = &cl->group.default_groups[j]->cg_item;
457 cl->group.default_groups[j] = NULL;
458 config_item_put(tmp);
467 static void release_cluster(struct config_item *i)
469 struct cluster *cl = to_cluster(i);
470 kfree(cl->group.default_groups);
474 static int make_space(struct config_group *g, const char *name,
475 struct config_group **new_g)
477 struct space *sp = NULL;
478 struct nodes *nds = NULL;
481 sp = kzalloc(sizeof(struct space), GFP_KERNEL);
482 gps = kcalloc(2, sizeof(struct config_group *), GFP_KERNEL);
483 nds = kzalloc(sizeof(struct nodes), GFP_KERNEL);
485 if (!sp || !gps || !nds)
488 config_group_init_type_name(&sp->group, name, &space_type);
489 config_group_init_type_name(&nds->ns_group, "nodes", &nodes_type);
491 sp->group.default_groups = gps;
492 sp->group.default_groups[0] = &nds->ns_group;
493 sp->group.default_groups[1] = NULL;
495 INIT_LIST_HEAD(&sp->members);
496 mutex_init(&sp->members_lock);
497 sp->members_count = 0;
508 static void drop_space(struct config_group *g, struct config_item *i)
510 struct space *sp = to_space(i);
511 struct config_item *tmp;
514 /* assert list_empty(&sp->members) */
516 for (j = 0; sp->group.default_groups[j]; j++) {
517 tmp = &sp->group.default_groups[j]->cg_item;
518 sp->group.default_groups[j] = NULL;
519 config_item_put(tmp);
525 static void release_space(struct config_item *i)
527 struct space *sp = to_space(i);
528 kfree(sp->group.default_groups);
532 static int make_comm(struct config_group *g, const char *name,
533 struct config_item **new_i)
537 cm = kzalloc(sizeof(struct comm), GFP_KERNEL);
541 config_item_init_type_name(&cm->item, name, &comm_type);
549 static void drop_comm(struct config_group *g, struct config_item *i)
551 struct comm *cm = to_comm(i);
552 if (local_comm == cm)
554 dlm_lowcomms_close(cm->nodeid);
555 while (cm->addr_count--)
556 kfree(cm->addr[cm->addr_count]);
560 static void release_comm(struct config_item *i)
562 struct comm *cm = to_comm(i);
566 static int make_node(struct config_group *g, const char *name,
567 struct config_item **new_i)
569 struct space *sp = to_space(g->cg_item.ci_parent);
572 nd = kzalloc(sizeof(struct node), GFP_KERNEL);
576 config_item_init_type_name(&nd->item, name, &node_type);
578 nd->weight = 1; /* default weight of 1 if none is set */
579 nd->new = 1; /* set to 0 once it's been read by dlm_nodeid_list() */
581 mutex_lock(&sp->members_lock);
582 list_add(&nd->list, &sp->members);
584 mutex_unlock(&sp->members_lock);
590 static void drop_node(struct config_group *g, struct config_item *i)
592 struct space *sp = to_space(g->cg_item.ci_parent);
593 struct node *nd = to_node(i);
595 mutex_lock(&sp->members_lock);
598 mutex_unlock(&sp->members_lock);
603 static void release_node(struct config_item *i)
605 struct node *nd = to_node(i);
609 static struct clusters clusters_root = {
614 .ci_type = &clusters_type,
620 int __init dlm_config_init(void)
622 config_group_init(&clusters_root.subsys.su_group);
623 mutex_init(&clusters_root.subsys.su_mutex);
624 return configfs_register_subsystem(&clusters_root.subsys);
627 void dlm_config_exit(void)
629 configfs_unregister_subsystem(&clusters_root.subsys);
633 * Functions for user space to read/write attributes
636 static ssize_t show_cluster(struct config_item *i, struct configfs_attribute *a,
639 struct cluster *cl = to_cluster(i);
640 struct cluster_attribute *cla =
641 container_of(a, struct cluster_attribute, attr);
642 return cla->show ? cla->show(cl, buf) : 0;
645 static ssize_t store_cluster(struct config_item *i,
646 struct configfs_attribute *a,
647 const char *buf, size_t len)
649 struct cluster *cl = to_cluster(i);
650 struct cluster_attribute *cla =
651 container_of(a, struct cluster_attribute, attr);
652 return cla->store ? cla->store(cl, buf, len) : -EINVAL;
655 static ssize_t show_comm(struct config_item *i, struct configfs_attribute *a,
658 struct comm *cm = to_comm(i);
659 struct comm_attribute *cma =
660 container_of(a, struct comm_attribute, attr);
661 return cma->show ? cma->show(cm, buf) : 0;
664 static ssize_t store_comm(struct config_item *i, struct configfs_attribute *a,
665 const char *buf, size_t len)
667 struct comm *cm = to_comm(i);
668 struct comm_attribute *cma =
669 container_of(a, struct comm_attribute, attr);
670 return cma->store ? cma->store(cm, buf, len) : -EINVAL;
673 static ssize_t comm_nodeid_read(struct comm *cm, char *buf)
675 return sprintf(buf, "%d\n", cm->nodeid);
678 static ssize_t comm_nodeid_write(struct comm *cm, const char *buf, size_t len)
680 cm->nodeid = simple_strtol(buf, NULL, 0);
684 static ssize_t comm_local_read(struct comm *cm, char *buf)
686 return sprintf(buf, "%d\n", cm->local);
689 static ssize_t comm_local_write(struct comm *cm, const char *buf, size_t len)
691 cm->local= simple_strtol(buf, NULL, 0);
692 if (cm->local && !local_comm)
697 static ssize_t comm_addr_write(struct comm *cm, const char *buf, size_t len)
699 struct sockaddr_storage *addr;
701 if (len != sizeof(struct sockaddr_storage))
704 if (cm->addr_count >= DLM_MAX_ADDR_COUNT)
707 addr = kzalloc(sizeof(*addr), GFP_KERNEL);
711 memcpy(addr, buf, len);
712 cm->addr[cm->addr_count++] = addr;
716 static ssize_t show_node(struct config_item *i, struct configfs_attribute *a,
719 struct node *nd = to_node(i);
720 struct node_attribute *nda =
721 container_of(a, struct node_attribute, attr);
722 return nda->show ? nda->show(nd, buf) : 0;
725 static ssize_t store_node(struct config_item *i, struct configfs_attribute *a,
726 const char *buf, size_t len)
728 struct node *nd = to_node(i);
729 struct node_attribute *nda =
730 container_of(a, struct node_attribute, attr);
731 return nda->store ? nda->store(nd, buf, len) : -EINVAL;
734 static ssize_t node_nodeid_read(struct node *nd, char *buf)
736 return sprintf(buf, "%d\n", nd->nodeid);
739 static ssize_t node_nodeid_write(struct node *nd, const char *buf, size_t len)
741 nd->nodeid = simple_strtol(buf, NULL, 0);
745 static ssize_t node_weight_read(struct node *nd, char *buf)
747 return sprintf(buf, "%d\n", nd->weight);
750 static ssize_t node_weight_write(struct node *nd, const char *buf, size_t len)
752 nd->weight = simple_strtol(buf, NULL, 0);
757 * Functions for the dlm to get the info that's been configured
760 static struct space *get_space(char *name)
762 struct config_item *i;
767 mutex_lock(&space_list->cg_subsys->su_mutex);
768 i = config_group_find_item(space_list, name);
769 mutex_unlock(&space_list->cg_subsys->su_mutex);
774 static void put_space(struct space *sp)
776 config_item_put(&sp->group.cg_item);
779 static struct comm *get_comm(int nodeid, struct sockaddr_storage *addr)
781 struct config_item *i;
782 struct comm *cm = NULL;
788 mutex_lock(&clusters_root.subsys.su_mutex);
790 list_for_each_entry(i, &comm_list->cg_children, ci_entry) {
794 if (cm->nodeid != nodeid)
800 if (!cm->addr_count ||
801 memcmp(cm->addr[0], addr, sizeof(*addr)))
808 mutex_unlock(&clusters_root.subsys.su_mutex);
815 static void put_comm(struct comm *cm)
817 config_item_put(&cm->item);
820 /* caller must free mem */
821 int dlm_nodeid_list(char *lsname, int **ids_out, int *ids_count_out,
822 int **new_out, int *new_count_out)
826 int i = 0, rv = 0, ids_count = 0, new_count = 0;
829 sp = get_space(lsname);
833 mutex_lock(&sp->members_lock);
834 if (!sp->members_count) {
836 printk(KERN_ERR "dlm: zero members_count\n");
840 ids_count = sp->members_count;
842 ids = kcalloc(ids_count, sizeof(int), GFP_KERNEL);
848 list_for_each_entry(nd, &sp->members, list) {
849 ids[i++] = nd->nodeid;
855 printk(KERN_ERR "dlm: bad nodeid count %d %d\n", ids_count, i);
860 new = kcalloc(new_count, sizeof(int), GFP_KERNEL);
868 list_for_each_entry(nd, &sp->members, list) {
870 new[i++] = nd->nodeid;
874 *new_count_out = new_count;
878 *ids_count_out = ids_count;
881 mutex_unlock(&sp->members_lock);
886 int dlm_node_weight(char *lsname, int nodeid)
892 sp = get_space(lsname);
896 mutex_lock(&sp->members_lock);
897 list_for_each_entry(nd, &sp->members, list) {
898 if (nd->nodeid != nodeid)
903 mutex_unlock(&sp->members_lock);
909 int dlm_nodeid_to_addr(int nodeid, struct sockaddr_storage *addr)
911 struct comm *cm = get_comm(nodeid, NULL);
916 memcpy(addr, cm->addr[0], sizeof(*addr));
921 int dlm_addr_to_nodeid(struct sockaddr_storage *addr, int *nodeid)
923 struct comm *cm = get_comm(0, addr);
926 *nodeid = cm->nodeid;
931 int dlm_our_nodeid(void)
933 return local_comm ? local_comm->nodeid : 0;
936 /* num 0 is first addr, num 1 is second addr */
937 int dlm_our_addr(struct sockaddr_storage *addr, int num)
941 if (num + 1 > local_comm->addr_count)
943 memcpy(addr, local_comm->addr[num], sizeof(*addr));
947 /* Config file defaults */
948 #define DEFAULT_TCP_PORT 21064
949 #define DEFAULT_BUFFER_SIZE 4096
950 #define DEFAULT_RSBTBL_SIZE 256
951 #define DEFAULT_LKBTBL_SIZE 1024
952 #define DEFAULT_DIRTBL_SIZE 512
953 #define DEFAULT_RECOVER_TIMER 5
954 #define DEFAULT_TOSS_SECS 10
955 #define DEFAULT_SCAN_SECS 5
956 #define DEFAULT_LOG_DEBUG 0
957 #define DEFAULT_PROTOCOL 0
958 #define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
960 struct dlm_config_info dlm_config = {
961 .ci_tcp_port = DEFAULT_TCP_PORT,
962 .ci_buffer_size = DEFAULT_BUFFER_SIZE,
963 .ci_rsbtbl_size = DEFAULT_RSBTBL_SIZE,
964 .ci_lkbtbl_size = DEFAULT_LKBTBL_SIZE,
965 .ci_dirtbl_size = DEFAULT_DIRTBL_SIZE,
966 .ci_recover_timer = DEFAULT_RECOVER_TIMER,
967 .ci_toss_secs = DEFAULT_TOSS_SECS,
968 .ci_scan_secs = DEFAULT_SCAN_SECS,
969 .ci_log_debug = DEFAULT_LOG_DEBUG,
970 .ci_protocol = DEFAULT_PROTOCOL,
971 .ci_timewarn_cs = DEFAULT_TIMEWARN_CS