Deleted Added
full compact
kernel.c (263713) kernel.c (263723)
1/*-
2 * Copyright (c) 2003, 2004 Silicon Graphics International Corp.
3 * Copyright (c) 1997-2007 Kenneth D. Merry
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

--- 18 unchanged lines hidden (view full) ---

27 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGES.
34 *
1/*-
2 * Copyright (c) 2003, 2004 Silicon Graphics International Corp.
3 * Copyright (c) 1997-2007 Kenneth D. Merry
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

--- 18 unchanged lines hidden (view full) ---

27 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGES.
34 *
35 * $FreeBSD: stable/10/usr.sbin/ctld/kernel.c 263713 2014-03-25 11:41:10Z trasz $
35 * $FreeBSD: stable/10/usr.sbin/ctld/kernel.c 263723 2014-03-25 12:10:30Z trasz $
36 */
37
38#include <sys/ioctl.h>
39#include <sys/types.h>
40#include <sys/stat.h>
41#include <sys/param.h>
42#include <sys/linker.h>
43#include <sys/queue.h>

--- 303 unchanged lines hidden (view full) ---

347 }
348 }
349
350 cl = lun_find(targ, lun->cfiscsi_lun);
351 if (cl != NULL) {
352 log_warnx("found CTL lun %ju, backing lun %d, target "
353 "%s, also backed by CTL lun %d; ignoring",
354 (uintmax_t) lun->lun_id, cl->l_lun,
36 */
37
38#include <sys/ioctl.h>
39#include <sys/types.h>
40#include <sys/stat.h>
41#include <sys/param.h>
42#include <sys/linker.h>
43#include <sys/queue.h>

--- 303 unchanged lines hidden (view full) ---

347 }
348 }
349
350 cl = lun_find(targ, lun->cfiscsi_lun);
351 if (cl != NULL) {
352 log_warnx("found CTL lun %ju, backing lun %d, target "
353 "%s, also backed by CTL lun %d; ignoring",
354 (uintmax_t) lun->lun_id, cl->l_lun,
355 cl->l_target->t_iqn, cl->l_ctl_lun);
355 cl->l_target->t_name, cl->l_ctl_lun);
356 continue;
357 }
358
359 log_debugx("found CTL lun %ju, backing lun %d, target %s",
360 (uintmax_t)lun->lun_id, lun->cfiscsi_lun, lun->cfiscsi_target);
361
362 cl = lun_new(targ, lun->cfiscsi_lun);
363 if (cl == NULL) {

--- 13 unchanged lines hidden (view full) ---

377 lun_set_path(cl, nv->value);
378 continue;
379 }
380 lo = lun_option_new(cl, nv->name, nv->value);
381 if (lo == NULL)
382 log_warnx("unable to add CTL lun option %s "
383 "for CTL lun %ju for lun %d, target %s",
384 nv->name, (uintmax_t) lun->lun_id,
356 continue;
357 }
358
359 log_debugx("found CTL lun %ju, backing lun %d, target %s",
360 (uintmax_t)lun->lun_id, lun->cfiscsi_lun, lun->cfiscsi_target);
361
362 cl = lun_new(targ, lun->cfiscsi_lun);
363 if (cl == NULL) {

--- 13 unchanged lines hidden (view full) ---

377 lun_set_path(cl, nv->value);
378 continue;
379 }
380 lo = lun_option_new(cl, nv->name, nv->value);
381 if (lo == NULL)
382 log_warnx("unable to add CTL lun option %s "
383 "for CTL lun %ju for lun %d, target %s",
384 nv->name, (uintmax_t) lun->lun_id,
385 cl->l_lun, cl->l_target->t_iqn);
385 cl->l_lun, cl->l_target->t_name);
386 }
387 }
388
389 return (conf);
390}
391
392int
393kernel_lun_add(struct lun *lun)

--- 35 unchanged lines hidden (view full) ---

429 } else {
430 lo = lun_option_new(lun, "file", lun->l_path);
431 assert(lo != NULL);
432 }
433 }
434
435 lo = lun_option_find(lun, "cfiscsi_target");
436 if (lo != NULL) {
386 }
387 }
388
389 return (conf);
390}
391
392int
393kernel_lun_add(struct lun *lun)

--- 35 unchanged lines hidden (view full) ---

429 } else {
430 lo = lun_option_new(lun, "file", lun->l_path);
431 assert(lo != NULL);
432 }
433 }
434
435 lo = lun_option_find(lun, "cfiscsi_target");
436 if (lo != NULL) {
437 lun_option_set(lo, lun->l_target->t_iqn);
437 lun_option_set(lo, lun->l_target->t_name);
438 } else {
439 lo = lun_option_new(lun, "cfiscsi_target",
438 } else {
439 lo = lun_option_new(lun, "cfiscsi_target",
440 lun->l_target->t_iqn);
440 lun->l_target->t_name);
441 assert(lo != NULL);
442 }
443
444 if (lun->l_target->t_alias != NULL) {
445 lo = lun_option_find(lun, "cfiscsi_target_alias");
446 if (lo != NULL) {
447 lun_option_set(lo, lun->l_target->t_alias);
448 } else {

--- 144 unchanged lines hidden (view full) ---

593 conn->conn_initiator_name, sizeof(req.data.handoff.initiator_name));
594 strlcpy(req.data.handoff.initiator_addr,
595 conn->conn_initiator_addr, sizeof(req.data.handoff.initiator_addr));
596 if (conn->conn_initiator_alias != NULL) {
597 strlcpy(req.data.handoff.initiator_alias,
598 conn->conn_initiator_alias, sizeof(req.data.handoff.initiator_alias));
599 }
600 strlcpy(req.data.handoff.target_name,
441 assert(lo != NULL);
442 }
443
444 if (lun->l_target->t_alias != NULL) {
445 lo = lun_option_find(lun, "cfiscsi_target_alias");
446 if (lo != NULL) {
447 lun_option_set(lo, lun->l_target->t_alias);
448 } else {

--- 144 unchanged lines hidden (view full) ---

593 conn->conn_initiator_name, sizeof(req.data.handoff.initiator_name));
594 strlcpy(req.data.handoff.initiator_addr,
595 conn->conn_initiator_addr, sizeof(req.data.handoff.initiator_addr));
596 if (conn->conn_initiator_alias != NULL) {
597 strlcpy(req.data.handoff.initiator_alias,
598 conn->conn_initiator_alias, sizeof(req.data.handoff.initiator_alias));
599 }
600 strlcpy(req.data.handoff.target_name,
601 conn->conn_target->t_iqn, sizeof(req.data.handoff.target_name));
601 conn->conn_target->t_name, sizeof(req.data.handoff.target_name));
602 req.data.handoff.socket = conn->conn_socket;
603 req.data.handoff.portal_group_tag =
604 conn->conn_portal->p_portal_group->pg_tag;
605 if (conn->conn_header_digest == CONN_DIGEST_CRC32C)
606 req.data.handoff.header_digest = CTL_ISCSI_DIGEST_CRC32C;
607 if (conn->conn_data_digest == CONN_DIGEST_CRC32C)
608 req.data.handoff.data_digest = CTL_ISCSI_DIGEST_CRC32C;
609 req.data.handoff.cmdsn = conn->conn_cmdsn;

--- 190 unchanged lines hidden ---
602 req.data.handoff.socket = conn->conn_socket;
603 req.data.handoff.portal_group_tag =
604 conn->conn_portal->p_portal_group->pg_tag;
605 if (conn->conn_header_digest == CONN_DIGEST_CRC32C)
606 req.data.handoff.header_digest = CTL_ISCSI_DIGEST_CRC32C;
607 if (conn->conn_data_digest == CONN_DIGEST_CRC32C)
608 req.data.handoff.data_digest = CTL_ISCSI_DIGEST_CRC32C;
609 req.data.handoff.cmdsn = conn->conn_cmdsn;

--- 190 unchanged lines hidden ---