Author: asomers
Date: Tue Sep 12 19:36:24 2017
New Revision: 323503
URL: https://svnweb.freebsd.org/changeset/base/323503

Log:
  Remove spaces from CTL devices' default serial numbers
  
  It's awkward to have spaces in CAM device serial numbers. That leads to
  such things as device nodes named "/dev/diskid/MYSERIAL%20%20%201". Better
  to replace the spaces with "0"s. This change only affects the default
  serial numbers for users who don't provide their own.
  
  Reviewed by:  ken, mav
  MFC after:    Never
  Relnotes:     Yes
  Sponsored by: Spectra Logic Corp
  Differential Revision:        https://reviews.freebsd.org/D12263

Modified:
  head/UPDATING
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_backend_ramdisk.c

Modified: head/UPDATING
==============================================================================
--- head/UPDATING       Tue Sep 12 19:20:24 2017        (r323502)
+++ head/UPDATING       Tue Sep 12 19:36:24 2017        (r323503)
@@ -52,6 +52,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 ****************************** SPECIAL WARNING: ******************************
 
 20170912:
+       The default serial number format for CTL LUNs has changed.  This will
+       affect users who use /dev/diskid/* device nodes, or whose FibreChannel
+       or iSCSI clients care about their LUNs' serial numbers.  Users who
+       require serial number stability should hardcode serial numbers in
+       /etc/ctl.conf .
+
+20170912:
        For 32-bit arm compiled for hard-float support, soft-floating point
        binaries now always get their shared libraries from
        LD_SOFT_LIBRARY_PATH (in the past, this was only used if

Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c        Tue Sep 12 19:20:24 2017        
(r323502)
+++ head/sys/cam/ctl/ctl_backend_block.c        Tue Sep 12 19:36:24 2017        
(r323503)
@@ -2324,7 +2324,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, 
        cbe_lun->be = &ctl_be_block_driver;
 
        if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) {
-               snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d",
+               snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%04d",
                         softc->num_luns);
                strncpy((char *)cbe_lun->serial_num, tmpstr,
                        MIN(sizeof(cbe_lun->serial_num), sizeof(tmpstr)));
@@ -2338,7 +2338,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, 
                        sizeof(params->serial_num)));
        }
        if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) {
-               snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns);
+               snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%04d", 
softc->num_luns);
                strncpy((char *)cbe_lun->device_id, tmpstr,
                        MIN(sizeof(cbe_lun->device_id), sizeof(tmpstr)));
 

Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_ramdisk.c      Tue Sep 12 19:20:24 2017        
(r323502)
+++ head/sys/cam/ctl/ctl_backend_ramdisk.c      Tue Sep 12 19:36:24 2017        
(r323503)
@@ -1096,7 +1096,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc
        cbe_lun->lun_config_status = ctl_backend_ramdisk_lun_config_status;
        cbe_lun->be = &ctl_be_ramdisk_driver;
        if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) {
-               snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d",
+               snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%04d",
                         softc->num_luns);
                strncpy((char *)cbe_lun->serial_num, tmpstr,
                        MIN(sizeof(cbe_lun->serial_num), sizeof(tmpstr)));
@@ -1110,7 +1110,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc
                            sizeof(params->serial_num)));
        }
        if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) {
-               snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns);
+               snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%04d", 
softc->num_luns);
                strncpy((char *)cbe_lun->device_id, tmpstr,
                        MIN(sizeof(cbe_lun->device_id), sizeof(tmpstr)));
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to