libcman.c | libcman.c | |||
---|---|---|---|---|
skipping to change at line 84 | skipping to change at line 84 | |||
} | } | |||
else { | else { | |||
return h->reply_status; | return h->reply_status; | |||
} | } | |||
} | } | |||
static void copy_node(cman_node_t *unode, struct cl_cluster_node *knode) | static void copy_node(cman_node_t *unode, struct cl_cluster_node *knode) | |||
{ | { | |||
unode->cn_nodeid = knode->node_id; | unode->cn_nodeid = knode->node_id; | |||
unode->cn_member = knode->state == NODESTATE_MEMBER?1:0; | unode->cn_member = knode->state == NODESTATE_MEMBER?1:0; | |||
strcpy(unode->cn_name, knode->name); | strncpy(unode->cn_name, knode->name, sizeof(unode->cn_name) - 1); | |||
unode->cn_incarnation = knode->incarnation; | unode->cn_incarnation = knode->incarnation; | |||
unode->cn_jointime = knode->jointime; | unode->cn_jointime = knode->jointime; | |||
memset(&unode->cn_address, 0, sizeof(unode->cn_address)); | memset(&unode->cn_address, 0, sizeof(unode->cn_address)); | |||
memcpy(&unode->cn_address.cna_address, knode->addr, knode->addrlen); | memcpy(&unode->cn_address.cna_address, knode->addr, knode->addrlen); | |||
unode->cn_address.cna_addrlen = knode->addrlen; | unode->cn_address.cna_addrlen = knode->addrlen; | |||
} | } | |||
/* Add to a list. saved_message *m is the head of the list in the cman_hand le */ | /* Add to a list. saved_message *m is the head of the list in the cman_hand le */ | |||
static void add_to_waitlist(struct saved_message **m, struct sock_header *m sg) | static void add_to_waitlist(struct saved_message **m, struct sock_header *m sg) | |||
skipping to change at line 233 | skipping to change at line 233 | |||
iovptr->iov_base = (char *)iovptr->iov_base + len; | iovptr->iov_base = (char *)iovptr->iov_base + len; | |||
iovptr->iov_len -= len; | iovptr->iov_len -= len; | |||
} | } | |||
return byte_cnt; | return byte_cnt; | |||
} | } | |||
static int send_message(struct cman_handle *h, int msgtype, const void *inb uf, int inlen) | static int send_message(struct cman_handle *h, int msgtype, const void *inb uf, int inlen) | |||
{ | { | |||
struct sock_header header; | struct sock_header header; | |||
size_t len; | int len; | |||
struct iovec iov[2]; | struct iovec iov[2]; | |||
size_t iovlen = 1; | size_t iovlen = 1; | |||
header.magic = CMAN_MAGIC; | header.magic = CMAN_MAGIC; | |||
header.version = CMAN_VERSION; | header.version = CMAN_VERSION; | |||
header.command = msgtype; | header.command = msgtype; | |||
header.flags = 0; | header.flags = 0; | |||
header.length = sizeof(header) + inlen; | header.length = sizeof(header) + inlen; | |||
iov[0].iov_len = sizeof(header); | iov[0].iov_len = sizeof(header); | |||
skipping to change at line 295 | skipping to change at line 295 | |||
h->fd = socket(PF_UNIX, SOCK_STREAM, 0); | h->fd = socket(PF_UNIX, SOCK_STREAM, 0); | |||
if (h->fd == -1) | if (h->fd == -1) | |||
{ | { | |||
int saved_errno = errno; | int saved_errno = errno; | |||
free(h); | free(h); | |||
errno = saved_errno; | errno = saved_errno; | |||
return NULL; | return NULL; | |||
} | } | |||
fcntl(h->fd, F_SETFD, 1); /* Set close-on-exec */ | fcntl(h->fd, F_SETFD, FD_CLOEXEC); /* Set close-on-exec */ | |||
memset(&sockaddr, 0, sizeof(sockaddr)); | memset(&sockaddr, 0, sizeof(sockaddr)); | |||
memcpy(sockaddr.sun_path, name, namelen); | memcpy(sockaddr.sun_path, name, namelen); | |||
sockaddr.sun_family = AF_UNIX; | sockaddr.sun_family = AF_UNIX; | |||
if (connect(h->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)) < 0) | if (connect(h->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)) < 0) | |||
{ | { | |||
int saved_errno = errno; | int saved_errno = errno; | |||
close(h->fd); | close(h->fd); | |||
free(h); | free(h); | |||
errno = saved_errno; | errno = saved_errno; | |||
skipping to change at line 319 | skipping to change at line 319 | |||
/* Get a handle on /dev/zero too. This is always active so we | /* Get a handle on /dev/zero too. This is always active so we | |||
can return it from cman_get_fd() if we have cached messages */ | can return it from cman_get_fd() if we have cached messages */ | |||
h->zero_fd = open("/dev/zero", O_RDONLY); | h->zero_fd = open("/dev/zero", O_RDONLY); | |||
if (h->zero_fd < 0) | if (h->zero_fd < 0) | |||
{ | { | |||
int saved_errno = errno; | int saved_errno = errno; | |||
close(h->fd); | close(h->fd); | |||
free(h); | free(h); | |||
h = NULL; | h = NULL; | |||
errno = saved_errno; | errno = saved_errno; | |||
} | } else | |||
fcntl(h->zero_fd, F_SETFD, 1); /* Set close-on-exec */ | fcntl(h->zero_fd, F_SETFD, FD_CLOEXEC); /* Set close-on-exec | |||
*/ | ||||
return (cman_handle_t)h; | return (cman_handle_t)h; | |||
} | } | |||
cman_handle_t cman_admin_init(void *privdata) | cman_handle_t cman_admin_init(void *privdata) | |||
{ | { | |||
return open_socket(ADMIN_SOCKNAME, sizeof(ADMIN_SOCKNAME), privdata) ; | return open_socket(ADMIN_SOCKNAME, sizeof(ADMIN_SOCKNAME), privdata) ; | |||
} | } | |||
cman_handle_t cman_init(void *privdata) | cman_handle_t cman_init(void *privdata) | |||
skipping to change at line 466 | skipping to change at line 466 | |||
/* First, drain any waiting queues */ | /* First, drain any waiting queues */ | |||
if (h->saved_reply_msg && !(flags & CMAN_DISPATCH_IGNORE_REP LY)) | if (h->saved_reply_msg && !(flags & CMAN_DISPATCH_IGNORE_REP LY)) | |||
{ | { | |||
struct saved_message *smsg = h->saved_reply_msg; | struct saved_message *smsg = h->saved_reply_msg; | |||
res = process_cman_message(h, flags, smsg->msg); | res = process_cman_message(h, flags, smsg->msg); | |||
h->saved_reply_msg = smsg->next; | h->saved_reply_msg = smsg->next; | |||
len = smsg->msg->length; | len = smsg->msg->length; | |||
free(smsg->msg); | free(smsg->msg); | |||
free(smsg); | free(smsg); | |||
if (res || (flags & CMAN_DISPATCH_ONE)) | if (res || (flags & CMAN_DISPATCH_TYPE_MASK) == CMAN _DISPATCH_ONE) | |||
break; | break; | |||
else | else | |||
continue; | continue; | |||
} | } | |||
if (h->saved_data_msg && !(flags & CMAN_DISPATCH_IGNORE_DATA )) | if (h->saved_data_msg && !(flags & CMAN_DISPATCH_IGNORE_DATA )) | |||
{ | { | |||
struct saved_message *smsg = h->saved_data_msg; | struct saved_message *smsg = h->saved_data_msg; | |||
res = process_cman_message(h, flags, smsg->msg); | res = process_cman_message(h, flags, smsg->msg); | |||
h->saved_data_msg = smsg->next; | h->saved_data_msg = smsg->next; | |||
len = smsg->msg->length; | len = smsg->msg->length; | |||
free(smsg->msg); | free(smsg->msg); | |||
free(smsg); | free(smsg); | |||
if (res || (flags & CMAN_DISPATCH_ONE)) | if (res || (flags & CMAN_DISPATCH_TYPE_MASK) == CMAN _DISPATCH_ONE) | |||
break; | break; | |||
else | else | |||
continue; | continue; | |||
} | } | |||
if (h->saved_event_msg && !(flags & CMAN_DISPATCH_IGNORE_EVE NT)) | if (h->saved_event_msg && !(flags & CMAN_DISPATCH_IGNORE_EVE NT)) | |||
{ | { | |||
struct saved_message *smsg = h->saved_event_msg; | struct saved_message *smsg = h->saved_event_msg; | |||
res = process_cman_message(h, flags, smsg->msg); | res = process_cman_message(h, flags, smsg->msg); | |||
h->saved_event_msg = smsg->next; | h->saved_event_msg = smsg->next; | |||
len = smsg->msg->length; | len = smsg->msg->length; | |||
free(smsg->msg); | free(smsg->msg); | |||
free(smsg); | free(smsg); | |||
if (res || (flags & CMAN_DISPATCH_ONE)) | if (res || (flags & CMAN_DISPATCH_TYPE_MASK) == CMAN _DISPATCH_ONE) | |||
break; | break; | |||
else | else | |||
continue; | continue; | |||
} | } | |||
/* Now look for new messages */ | /* Now look for new messages */ | |||
len = recv(h->fd, buf, sizeof(struct sock_header), recv_flag s); | len = recv(h->fd, buf, sizeof(struct sock_header), recv_flag s); | |||
if (len == 0) { | if (len == 0) { | |||
errno = EHOSTDOWN; | errno = EHOSTDOWN; | |||
skipping to change at line 532 | skipping to change at line 532 | |||
return -1; | return -1; | |||
memcpy(bufptr, buf, sizeof(*header)); | memcpy(bufptr, buf, sizeof(*header)); | |||
header = (struct sock_header *)bufptr; | header = (struct sock_header *)bufptr; | |||
} | } | |||
/* Read the rest */ | /* Read the rest */ | |||
while (offset < header->length) | while (offset < header->length) | |||
{ | { | |||
len = read(h->fd, bufptr+offset, header->length-offs et); | len = read(h->fd, bufptr+offset, header->length-offs et); | |||
if (len == 0) { | if (len == 0) { | |||
if (bufptr != buf) | ||||
free(bufptr); | ||||
errno = EHOSTDOWN; | errno = EHOSTDOWN; | |||
return -1; | return -1; | |||
} | } | |||
if (len < 0 && | if (len < 0 && | |||
(errno == EINTR || errno == EAGAIN)) | (errno == EINTR || errno == EAGAIN)) { | |||
if (bufptr != buf) | ||||
free(bufptr); | ||||
return 0; | return 0; | |||
} | ||||
if (len < 0) | if (len < 0) { | |||
if (bufptr != buf) | ||||
free(bufptr); | ||||
return -1; | return -1; | |||
} | ||||
offset += len; | offset += len; | |||
} | } | |||
res = process_cman_message(h, flags, header); | res = process_cman_message(h, flags, header); | |||
if (bufptr != buf) | if (bufptr != buf) | |||
free(bufptr); | free(bufptr); | |||
if (res) | if (res) | |||
break; | break; | |||
skipping to change at line 669 | skipping to change at line 677 | |||
return 0; | return 0; | |||
} | } | |||
int cman_get_node(cman_handle_t handle, int nodeid, cman_node_t *node) | int cman_get_node(cman_handle_t handle, int nodeid, cman_node_t *node) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
struct cl_cluster_node cman_node; | struct cl_cluster_node cman_node; | |||
int status; | int status; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if (!node || strlen(node->cn_name) > sizeof(cman_node.name)) | if (!node || strlen(node->cn_name) >= sizeof(cman_node.name)) | |||
{ | { | |||
errno = EINVAL; | errno = EINVAL; | |||
return -1; | return -1; | |||
} | } | |||
cman_node.node_id = nodeid; | cman_node.node_id = nodeid; | |||
strcpy(cman_node.name, node->cn_name); | strncpy(cman_node.name, node->cn_name, sizeof(cman_node.name) - 1); | |||
status = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(struct cl _cluster_node), | status = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(struct cl _cluster_node), | |||
&cman_node, sizeof(struct cl_cluster_node)); | &cman_node, sizeof(struct cl_cluster_node)); | |||
if (status < 0) | if (status < 0) | |||
return -1; | return -1; | |||
copy_node(node, &cman_node); | copy_node(node, &cman_node); | |||
return 0; | return 0; | |||
} | } | |||
skipping to change at line 893 | skipping to change at line 901 | |||
h->data_callback = NULL; | h->data_callback = NULL; | |||
return 0; | return 0; | |||
} | } | |||
int cman_barrier_register(cman_handle_t handle, const char *name, int flags , int nodes) | int cman_barrier_register(cman_handle_t handle, const char *name, int flags , int nodes) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
struct cl_barrier_info binfo; | struct cl_barrier_info binfo; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if (strlen(name) > MAX_BARRIER_NAME_LEN) | if (strlen(name) >= MAX_BARRIER_NAME_LEN) | |||
{ | { | |||
errno = EINVAL; | errno = EINVAL; | |||
return -1; | return -1; | |||
} | } | |||
binfo.cmd = BARRIER_CMD_REGISTER; | binfo.cmd = BARRIER_CMD_REGISTER; | |||
strcpy(binfo.name, name); | strncpy(binfo.name, name, sizeof(binfo.name) - 1); | |||
binfo.arg = nodes; | binfo.arg = nodes; | |||
binfo.flags = flags; | binfo.flags = flags; | |||
return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | |||
} | } | |||
int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int arg) | int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int arg) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
struct cl_barrier_info binfo; | struct cl_barrier_info binfo; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if (strlen(name) > MAX_BARRIER_NAME_LEN) | if (strlen(name) >= MAX_BARRIER_NAME_LEN) | |||
{ | { | |||
errno = EINVAL; | errno = EINVAL; | |||
return -1; | return -1; | |||
} | } | |||
binfo.cmd = BARRIER_CMD_CHANGE; | binfo.cmd = BARRIER_CMD_CHANGE; | |||
strcpy(binfo.name, name); | strncpy(binfo.name, name, sizeof(binfo.name) - 1); | |||
binfo.arg = arg; | binfo.arg = arg; | |||
binfo.flags = flags; | binfo.flags = flags; | |||
return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | |||
} | } | |||
int cman_barrier_wait(cman_handle_t handle, const char *name) | int cman_barrier_wait(cman_handle_t handle, const char *name) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
struct cl_barrier_info binfo; | struct cl_barrier_info binfo; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if (strlen(name) > MAX_BARRIER_NAME_LEN) | if (strlen(name) >= MAX_BARRIER_NAME_LEN) | |||
{ | { | |||
errno = EINVAL; | errno = EINVAL; | |||
return -1; | return -1; | |||
} | } | |||
binfo.cmd = BARRIER_CMD_WAIT; | binfo.cmd = BARRIER_CMD_WAIT; | |||
strcpy(binfo.name, name); | strncpy(binfo.name, name, sizeof(binfo.name) - 1); | |||
return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | |||
} | } | |||
int cman_barrier_delete(cman_handle_t handle, const char *name) | int cman_barrier_delete(cman_handle_t handle, const char *name) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
struct cl_barrier_info binfo; | struct cl_barrier_info binfo; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if (strlen(name) > MAX_BARRIER_NAME_LEN) | if (strlen(name) >= MAX_BARRIER_NAME_LEN) | |||
{ | { | |||
errno = EINVAL; | errno = EINVAL; | |||
return -1; | return -1; | |||
} | } | |||
binfo.cmd = BARRIER_CMD_DELETE; | binfo.cmd = BARRIER_CMD_DELETE; | |||
strcpy(binfo.name, name); | strncpy(binfo.name, name, sizeof(binfo.name) - 1); | |||
return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0 ); | |||
} | } | |||
int cman_shutdown(cman_handle_t handle, int flags) | int cman_shutdown(cman_handle_t handle, int flags) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
return info_call(h, CMAN_CMD_TRY_SHUTDOWN, &flags, sizeof(int), NULL , 0); | return info_call(h, CMAN_CMD_TRY_SHUTDOWN, &flags, sizeof(int), NULL , 0); | |||
skipping to change at line 1005 | skipping to change at line 1013 | |||
} | } | |||
static int cman_set_quorum_device(cman_handle_t handle, | static int cman_set_quorum_device(cman_handle_t handle, | |||
int ops, | int ops, | |||
char *name, int votes) | char *name, int votes) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
char buf[strlen(name)+1 + sizeof(int)]; | char buf[strlen(name)+1 + sizeof(int)]; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if ((!name) || (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN) || (vote | ||||
s < 0)) | ||||
{ | ||||
errno = EINVAL; | ||||
return -1; | ||||
} | ||||
memcpy(buf, &votes, sizeof(int)); | memcpy(buf, &votes, sizeof(int)); | |||
strcpy(buf+sizeof(int), name); | strncpy(buf+sizeof(int), name, strlen(name)+1 + sizeof(int) - 1); | |||
return info_call(h, ops, buf, strlen(name)+1+sizeof(int), NULL, 0); | return info_call(h, ops, buf, strlen(name)+1+sizeof(int), NULL, 0); | |||
} | } | |||
int cman_register_quorum_device(cman_handle_t handle, char *name, int votes ) | int cman_register_quorum_device(cman_handle_t handle, char *name, int votes ) | |||
{ | { | |||
if ((!name) || (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN) || (vote | ||||
s < 0)) | ||||
{ | ||||
errno = EINVAL; | ||||
return -1; | ||||
} | ||||
return cman_set_quorum_device(handle, CMAN_CMD_REG_QUORUMDEV, name, votes); | return cman_set_quorum_device(handle, CMAN_CMD_REG_QUORUMDEV, name, votes); | |||
} | } | |||
int cman_unregister_quorum_device(cman_handle_t handle) | int cman_unregister_quorum_device(cman_handle_t handle) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
return info_call(h, CMAN_CMD_UNREG_QUORUMDEV, NULL, 0, NULL, 0); | return info_call(h, CMAN_CMD_UNREG_QUORUMDEV, NULL, 0, NULL, 0); | |||
} | } | |||
skipping to change at line 1047 | skipping to change at line 1054 | |||
int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *inf o) | int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *inf o) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
int ret; | int ret; | |||
struct cl_cluster_node cman_node; | struct cl_cluster_node cman_node; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
cman_node.node_id = CLUSTER_GETNODE_QUORUMDEV; | cman_node.node_id = CLUSTER_GETNODE_QUORUMDEV; | |||
ret = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(cman_node), &cman_node, sizeof(cman_node)); | ret = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(cman_node), &cman_node, sizeof(cman_node)); | |||
if (!ret) { | if (!ret) { | |||
strcpy(info->qi_name, cman_node.name); | strncpy(info->qi_name, cman_node.name, sizeof(info->qi_name) - 1); | |||
info->qi_state = cman_node.state; | info->qi_state = cman_node.state; | |||
info->qi_votes = cman_node.votes; | info->qi_votes = cman_node.votes; | |||
} | } | |||
return ret; | return ret; | |||
} | } | |||
int cman_update_quorum_device(cman_handle_t handle, char *name, int votes) | int cman_update_quorum_device(cman_handle_t handle, char *name, int votes) | |||
{ | { | |||
if ((!name) || (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN) || (vote | ||||
s < 0)) | ||||
{ | ||||
errno = EINVAL; | ||||
return -1; | ||||
} | ||||
return cman_set_quorum_device(handle, CMAN_CMD_UPDATE_QUORUMDEV, nam e, votes); | return cman_set_quorum_device(handle, CMAN_CMD_UPDATE_QUORUMDEV, nam e, votes); | |||
} | } | |||
int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *time, in t *fenced, char *agent) | int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *time, in t *fenced, char *agent) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
int ret; | int ret; | |||
struct cl_fence_info f; | struct cl_fence_info f; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
ret = info_call(h, CMAN_CMD_GET_FENCE_INFO, &nodeid, sizeof(int), &f , sizeof(f)); | ret = info_call(h, CMAN_CMD_GET_FENCE_INFO, &nodeid, sizeof(int), &f , sizeof(f)); | |||
if (!ret) { | if (!ret) { | |||
*time = f.fence_time; | *time = f.fence_time; | |||
if (agent) | if (agent) | |||
strcpy(agent, f.fence_agent); | strncpy(agent, f.fence_agent, sizeof(f.fence_agent) - 1); | |||
*fenced = ((f.flags & FENCE_FLAGS_FENCED) != 0); | *fenced = ((f.flags & FENCE_FLAGS_FENCED) != 0); | |||
} | } | |||
return ret; | return ret; | |||
} | } | |||
int cman_get_node_addrs(cman_handle_t handle, int nodeid, int max_addrs, in t *num_addrs, struct cman_node_address *addrs) | int cman_get_node_addrs(cman_handle_t handle, int nodeid, int max_addrs, in t *num_addrs, struct cman_node_address *addrs) | |||
{ | { | |||
struct cman_handle *h = (struct cman_handle *)handle; | struct cman_handle *h = (struct cman_handle *)handle; | |||
int ret; | int ret; | |||
char buf[sizeof(struct cl_get_node_addrs) + sizeof(struct cl_node_ad drs)*max_addrs]; | char buf[sizeof(struct cl_get_node_addrs) + sizeof(struct cl_node_ad drs)*max_addrs]; | |||
skipping to change at line 1114 | skipping to change at line 1126 | |||
struct cl_fence_info f; | struct cl_fence_info f; | |||
VALIDATE_HANDLE(h); | VALIDATE_HANDLE(h); | |||
if (strlen(agent) >= MAX_FENCE_AGENT_NAME_LEN) { | if (strlen(agent) >= MAX_FENCE_AGENT_NAME_LEN) { | |||
errno = EINVAL; | errno = EINVAL; | |||
return -1; | return -1; | |||
} | } | |||
f.nodeid = nodeid; | f.nodeid = nodeid; | |||
f.fence_time = time; | f.fence_time = time; | |||
strcpy(f.fence_agent, agent); | strncpy(f.fence_agent, agent, sizeof(f.fence_agent) - 1); | |||
return info_call(h, CMAN_CMD_UPDATE_FENCE_INFO, &f, sizeof(f), NULL, 0); | return info_call(h, CMAN_CMD_UPDATE_FENCE_INFO, &f, sizeof(f), NULL, 0); | |||
} | } | |||
End of changes. 29 change blocks. | ||||
31 lines changed or deleted | 45 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |