svn commit: r288823 - stable/10/usr.sbin/ctld

Alexander Motin mav at FreeBSD.org
Mon Oct 5 11:51:14 UTC 2015


Author: mav
Date: Mon Oct  5 11:51:13 2015
New Revision: 288823
URL: https://svnweb.freebsd.org/changeset/base/288823

Log:
  MFC r288486, r288488: Set default block size for CD to expected 2048 bytes.

Modified:
  stable/10/usr.sbin/ctld/ctl.conf.5
  stable/10/usr.sbin/ctld/ctld.c
  stable/10/usr.sbin/ctld/ctld.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctl.conf.5
==============================================================================
--- stable/10/usr.sbin/ctld/ctl.conf.5	Mon Oct  5 11:49:56 2015	(r288822)
+++ stable/10/usr.sbin/ctld/ctl.conf.5	Mon Oct  5 11:51:13 2015	(r288823)
@@ -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

Modified: stable/10/usr.sbin/ctld/ctld.c
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.c	Mon Oct  5 11:49:56 2015	(r288822)
+++ stable/10/usr.sbin/ctld/ctld.c	Mon Oct  5 11:51:13 2015	(r288823)
@@ -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);

Modified: stable/10/usr.sbin/ctld/ctld.h
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.h	Mon Oct  5 11:49:56 2015	(r288822)
+++ stable/10/usr.sbin/ctld/ctld.h	Mon Oct  5 11:51:13 2015	(r288823)
@@ -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


More information about the svn-src-stable-10 mailing list