svn commit: r287933 - head/sys/cam/ctl
Alexander Motin
mav at FreeBSD.org
Thu Sep 17 20:36:35 UTC 2015
Author: mav
Date: Thu Sep 17 20:36:34 2015
New Revision: 287933
URL: https://svnweb.freebsd.org/changeset/base/287933
Log:
Replicate port->init_devid to HA peer.
Modified:
head/sys/cam/ctl/ctl.c
head/sys/cam/ctl/ctl_io.h
Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c Thu Sep 17 20:33:52 2015 (r287932)
+++ head/sys/cam/ctl/ctl.c Thu Sep 17 20:36:34 2015 (r287933)
@@ -611,6 +611,8 @@ ctl_isc_announce_port(struct ctl_port *p
i += port->port_devid->len;
if (port->target_devid)
i += port->target_devid->len;
+ if (port->init_devid)
+ i += port->init_devid->len;
msg = malloc(i, M_CTL, M_WAITOK);
bzero(&msg->port, sizeof(msg->port));
msg->hdr.msg_type = CTL_MSG_PORT_SYNC;
@@ -641,6 +643,12 @@ ctl_isc_announce_port(struct ctl_port *p
msg->port.target_devid_len);
i += msg->port.target_devid_len;
}
+ if (port->init_devid) {
+ msg->port.init_devid_len = port->init_devid->len;
+ memcpy(&msg->port.data[i], port->init_devid->data,
+ msg->port.init_devid_len);
+ i += msg->port.init_devid_len;
+ }
ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg->port, sizeof(msg->port) + i,
M_WAITOK);
free(msg, M_CTL);
@@ -865,8 +873,23 @@ ctl_isc_port_sync(struct ctl_softc *soft
port->target_devid->len = msg->port.target_devid_len;
i += msg->port.target_devid_len;
} else {
- free(port->port_devid, M_CTL);
- port->port_devid = NULL;
+ free(port->target_devid, M_CTL);
+ port->target_devid = NULL;
+ }
+ if (msg->port.init_devid_len != 0) {
+ if (port->init_devid == NULL ||
+ port->init_devid->len != msg->port.init_devid_len) {
+ free(port->init_devid, M_CTL);
+ port->init_devid = malloc(sizeof(struct ctl_devid) +
+ msg->port.init_devid_len, M_CTL, M_WAITOK);
+ }
+ memcpy(port->init_devid->data, &msg->port.data[i],
+ msg->port.init_devid_len);
+ port->init_devid->len = msg->port.init_devid_len;
+ i += msg->port.init_devid_len;
+ } else {
+ free(port->init_devid, M_CTL);
+ port->init_devid = NULL;
}
if (new) {
if (ctl_port_register(port) != 0) {
Modified: head/sys/cam/ctl/ctl_io.h
==============================================================================
--- head/sys/cam/ctl/ctl_io.h Thu Sep 17 20:33:52 2015 (r287932)
+++ head/sys/cam/ctl/ctl_io.h Thu Sep 17 20:36:34 2015 (r287933)
@@ -479,6 +479,7 @@ struct ctl_ha_msg_port {
int lun_map_len;
int port_devid_len;
int target_devid_len;
+ int init_devid_len;
uint8_t data[];
};
More information about the svn-src-head
mailing list