summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-10-05 11:51:13 +0000
committermav <mav@FreeBSD.org>2015-10-05 11:51:13 +0000
commit5a4270f056c37efa6156c7709315b08e5e636b2e (patch)
tree77d5c3f465cb32cbddf9fdfabe318a1a1ba35b98 /usr.sbin
parent2e00d51f56744d6052da2e4998423bdefdbf414a (diff)
downloadFreeBSD-src-5a4270f056c37efa6156c7709315b08e5e636b2e.zip
FreeBSD-src-5a4270f056c37efa6156c7709315b08e5e636b2e.tar.gz
MFC r288486, r288488: Set default block size for CD to expected 2048 bytes.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ctld/ctl.conf.52
-rw-r--r--usr.sbin/ctld/ctld.c5
-rw-r--r--usr.sbin/ctld/ctld.h1
3 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5
index ce8df67a..2fcc908 100644
--- a/usr.sbin/ctld/ctl.conf.5
+++ b/usr.sbin/ctld/ctl.conf.5
@@ -364,7 +364,7 @@ testing.
The default backend is block.
.It Ic blocksize Ar size
The blocksize visible to the initiator.
-The default blocksize is 512.
+The default blocksize is 512 for disks, and 2048 for CD/DVDs.
.It Ic ctl-lun Ar lun_id
Global numeric identifier to use for a given LUN inside CTL.
By default CTL allocates those IDs dynamically, but explicit specification
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index 741a713..90c7db8 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -1644,7 +1644,10 @@ conf_verify_lun(struct lun *lun)
}
}
if (lun->l_blocksize == 0) {
- lun_set_blocksize(lun, DEFAULT_BLOCKSIZE);
+ if (lun->l_device_type == 5)
+ lun_set_blocksize(lun, DEFAULT_CD_BLOCKSIZE);
+ else
+ lun_set_blocksize(lun, DEFAULT_BLOCKSIZE);
} else if (lun->l_blocksize < 0) {
log_warnx("invalid blocksize for lun \"%s\"; "
"must be larger than 0", lun->l_name);
diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h
index 3e26237..ef85e43 100644
--- a/usr.sbin/ctld/ctld.h
+++ b/usr.sbin/ctld/ctld.h
@@ -43,6 +43,7 @@
#define DEFAULT_CONFIG_PATH "/etc/ctl.conf"
#define DEFAULT_PIDFILE "/var/run/ctld.pid"
#define DEFAULT_BLOCKSIZE 512
+#define DEFAULT_CD_BLOCKSIZE 2048
#define MAX_LUNS 1024
#define MAX_NAME_LEN 223
OpenPOWER on IntegriCloud