Deleted Added
full compact
ctl_backend_ramdisk.c (275892) ctl_backend_ramdisk.c (276237)
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Edward Tomasz Napierala
7 * under sponsorship from the FreeBSD Foundation.
8 *

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

35 */
36/*
37 * CAM Target Layer backend for a "fake" ramdisk.
38 *
39 * Author: Ken Merry <ken@FreeBSD.org>
40 */
41
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003, 2008 Silicon Graphics International Corp.
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by Edward Tomasz Napierala
7 * under sponsorship from the FreeBSD Foundation.
8 *

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

35 */
36/*
37 * CAM Target Layer backend for a "fake" ramdisk.
38 *
39 * Author: Ken Merry <ken@FreeBSD.org>
40 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c 275892 2014-12-18 08:38:07Z mav $");
43__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c 276237 2014-12-26 09:44:32Z mav $");
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/condvar.h>
49#include <sys/types.h>
50#include <sys/lock.h>
51#include <sys/mutex.h>

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

565 params->lun_size_bytes, blocksize);
566 goto bailout_error;
567 }
568
569 be_lun->size_blocks = params->lun_size_bytes / blocksize;
570 be_lun->size_bytes = be_lun->size_blocks * blocksize;
571
572 be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1;
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/condvar.h>
49#include <sys/types.h>
50#include <sys/lock.h>
51#include <sys/mutex.h>

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

565 params->lun_size_bytes, blocksize);
566 goto bailout_error;
567 }
568
569 be_lun->size_blocks = params->lun_size_bytes / blocksize;
570 be_lun->size_bytes = be_lun->size_blocks * blocksize;
571
572 be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1;
573 be_lun->ctl_be_lun.atomicblock = UINT32_MAX;
574 be_lun->ctl_be_lun.opttxferlen = softc->rd_size / blocksize;
573 } else {
574 be_lun->ctl_be_lun.maxlba = 0;
575 blocksize = 0;
576 be_lun->size_bytes = 0;
577 be_lun->size_blocks = 0;
578 }
579
580 be_lun->ctl_be_lun.blocksize = blocksize;

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

591 value = ctl_get_opt(&be_lun->ctl_be_lun.options, "unmap");
592 if (value != NULL && strcmp(value, "on") == 0)
593 unmap = 1;
594
595 be_lun->flags = CTL_BE_RAMDISK_LUN_UNCONFIGURED;
596 be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY;
597 if (unmap)
598 be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP;
575 } else {
576 be_lun->ctl_be_lun.maxlba = 0;
577 blocksize = 0;
578 be_lun->size_bytes = 0;
579 be_lun->size_blocks = 0;
580 }
581
582 be_lun->ctl_be_lun.blocksize = blocksize;

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

593 value = ctl_get_opt(&be_lun->ctl_be_lun.options, "unmap");
594 if (value != NULL && strcmp(value, "on") == 0)
595 unmap = 1;
596
597 be_lun->flags = CTL_BE_RAMDISK_LUN_UNCONFIGURED;
598 be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY;
599 if (unmap)
600 be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP;
599 be_lun->ctl_be_lun.atomicblock = UINT32_MAX;
600 be_lun->ctl_be_lun.be_lun = be_lun;
601
602 if (params->flags & CTL_LUN_FLAG_ID_REQ) {
603 be_lun->ctl_be_lun.req_lun_id = params->req_lun_id;
604 be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_ID_REQ;
605 } else
606 be_lun->ctl_be_lun.req_lun_id = 0;
607

--- 390 unchanged lines hidden ---
601 be_lun->ctl_be_lun.be_lun = be_lun;
602
603 if (params->flags & CTL_LUN_FLAG_ID_REQ) {
604 be_lun->ctl_be_lun.req_lun_id = params->req_lun_id;
605 be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_ID_REQ;
606 } else
607 be_lun->ctl_be_lun.req_lun_id = 0;
608

--- 390 unchanged lines hidden ---