Lines Matching refs:cm
78 static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf);
79 static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf,
81 static ssize_t comm_local_read(struct dlm_comm *cm, char *buf);
82 static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf,
84 static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf,
86 static ssize_t comm_addr_list_read(struct dlm_comm *cm, char *buf);
587 struct dlm_comm *cm; in make_comm() local
589 cm = kzalloc(sizeof(struct dlm_comm), GFP_NOFS); in make_comm()
590 if (!cm) in make_comm()
593 config_item_init_type_name(&cm->item, name, &comm_type); in make_comm()
595 cm->seq = dlm_comm_count++; in make_comm()
596 if (!cm->seq) in make_comm()
597 cm->seq = dlm_comm_count++; in make_comm()
599 cm->nodeid = -1; in make_comm()
600 cm->local = 0; in make_comm()
601 cm->addr_count = 0; in make_comm()
602 return &cm->item; in make_comm()
607 struct dlm_comm *cm = config_item_to_comm(i); in drop_comm() local
608 if (local_comm == cm) in drop_comm()
610 dlm_lowcomms_close(cm->nodeid); in drop_comm()
611 while (cm->addr_count--) in drop_comm()
612 kfree(cm->addr[cm->addr_count]); in drop_comm()
618 struct dlm_comm *cm = config_item_to_comm(i); in release_comm() local
619 kfree(cm); in release_comm()
712 struct dlm_comm *cm = config_item_to_comm(i); in show_comm() local
715 return cma->show ? cma->show(cm, buf) : 0; in show_comm()
721 struct dlm_comm *cm = config_item_to_comm(i); in store_comm() local
724 return cma->store ? cma->store(cm, buf, len) : -EINVAL; in store_comm()
727 static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf) in comm_nodeid_read() argument
729 return sprintf(buf, "%d\n", cm->nodeid); in comm_nodeid_read()
732 static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf, in comm_nodeid_write() argument
735 int rc = kstrtoint(buf, 0, &cm->nodeid); in comm_nodeid_write()
742 static ssize_t comm_local_read(struct dlm_comm *cm, char *buf) in comm_local_read() argument
744 return sprintf(buf, "%d\n", cm->local); in comm_local_read()
747 static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf, in comm_local_write() argument
750 int rc = kstrtoint(buf, 0, &cm->local); in comm_local_write()
754 if (cm->local && !local_comm) in comm_local_write()
755 local_comm = cm; in comm_local_write()
759 static ssize_t comm_addr_write(struct dlm_comm *cm, const char *buf, size_t len) in comm_addr_write() argument
767 if (cm->addr_count >= DLM_MAX_ADDR_COUNT) in comm_addr_write()
776 rv = dlm_lowcomms_addr(cm->nodeid, addr, len); in comm_addr_write()
782 cm->addr[cm->addr_count++] = addr; in comm_addr_write()
786 static ssize_t comm_addr_list_read(struct dlm_comm *cm, char *buf) in comm_addr_list_read() argument
803 for (i = 0; i < cm->addr_count; i++) { in comm_addr_list_read()
804 addr = cm->addr[i]; in comm_addr_list_read()
907 struct dlm_comm *cm = NULL; in get_comm() local
916 cm = config_item_to_comm(i); in get_comm()
918 if (cm->nodeid != nodeid) in get_comm()
927 cm = NULL; in get_comm()
928 return cm; in get_comm()
931 static void put_comm(struct dlm_comm *cm) in put_comm() argument
933 config_item_put(&cm->item); in put_comm()
986 struct dlm_comm *cm = get_comm(nodeid); in dlm_comm_seq() local
987 if (!cm) in dlm_comm_seq()
989 *seq = cm->seq; in dlm_comm_seq()
990 put_comm(cm); in dlm_comm_seq()