Author: mm
Date: Sun Sep  9 20:26:19 2012
New Revision: 240288
URL: http://svn.freebsd.org/changeset/base/240288

Log:
  MFC r230454 (pjd):
  Use provided name when allocating ksid domain. It isn't really used
  on FreeBSD, but should fix a panic when pool is imported from another OS
  that is using this.
  
  MFC r240162 (mm):
  Make r230454 more readable and vendor-like.
  
  PR:           kern/171380
  Approved by:  re (kib)

Modified:
  releng/9.1/sys/cddl/compat/opensolaris/sys/sid.h
Directory Properties:
  releng/9.1/sys/   (props changed)

Modified: releng/9.1/sys/cddl/compat/opensolaris/sys/sid.h
==============================================================================
--- releng/9.1/sys/cddl/compat/opensolaris/sys/sid.h    Sun Sep  9 20:13:11 
2012        (r240287)
+++ releng/9.1/sys/cddl/compat/opensolaris/sys/sid.h    Sun Sep  9 20:26:19 
2012        (r240288)
@@ -30,7 +30,8 @@
 #define        _OPENSOLARIS_SYS_SID_H_
 
 typedef struct ksiddomain {
-       char    kd_name[16];    /* Domain part of SID */
+       char    *kd_name;       /* Domain part of SID */
+       uint_t  kd_len;
 } ksiddomain_t;
 typedef void   ksid_t;
 
@@ -38,9 +39,13 @@ static __inline ksiddomain_t *
 ksid_lookupdomain(const char *domain)
 {
        ksiddomain_t *kd;
+       size_t len;
 
+       len = strlen(domain) + 1;
        kd = kmem_alloc(sizeof(*kd), KM_SLEEP);
-       strlcpy(kd->kd_name, "FreeBSD", sizeof(kd->kd_name));
+       kd->kd_len = (uint_t)len;
+       kd->kd_name = kmem_alloc(len, KM_SLEEP);
+       strcpy(kd->kd_name, domain);
        return (kd);
 }
 
@@ -48,6 +53,7 @@ static __inline void
 ksiddomain_rele(ksiddomain_t *kd)
 {
 
+       kmem_free(kd->kd_name, kd->kd_len);
        kmem_free(kd, sizeof(*kd));
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to