Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP


3352         src += 14;      /* Past /dev/zvol/dsk/ */
3353         if (*src == '/')
3354                 src++;  /* or /dev/zvol/rdsk/ */
3355         p = (char *)kmem_alloc(strlen(src) + 1, KM_SLEEP);
3356         (void) strcpy(p, src);
3357         return (p);
3358 }
3359 
3360 /*
3361  * this function creates a local metadata zvol property
3362  */
3363 sbd_status_t
3364 sbd_create_zfs_meta_object(sbd_lu_t *sl)
3365 {
3366         /*
3367          * -allocate 1/2 the property size, the zfs property
3368          *  is 8k in size and stored as ascii hex string, all
3369          *  we needed is 4k buffer to store the binary data.
3370          * -initialize reader/write lock
3371          */
3372         if ((sl->sl_zfs_meta = kmem_zalloc(ZAP_MAXVALUELEN / 2, KM_SLEEP))
3373             == NULL)
3374                 return (SBD_FAILURE);
3375         rw_init(&sl->sl_zfs_meta_lock, NULL, RW_DRIVER, NULL);
3376         return (SBD_SUCCESS);
3377 }
3378 
3379 char
3380 sbd_ctoi(char c)
3381 {
3382         if ((c >= '0') && (c <= '9'))
3383                 c -= '0';
3384         else if ((c >= 'A') && (c <= 'F'))
3385                 c = c - 'A' + 10;
3386         else if ((c >= 'a') && (c <= 'f'))
3387                 c = c - 'a' + 10;
3388         else
3389                 c = -1;
3390         return (c);
3391 }
3392 
3393 /*
3394  * read zvol property and convert to binary




3352         src += 14;      /* Past /dev/zvol/dsk/ */
3353         if (*src == '/')
3354                 src++;  /* or /dev/zvol/rdsk/ */
3355         p = (char *)kmem_alloc(strlen(src) + 1, KM_SLEEP);
3356         (void) strcpy(p, src);
3357         return (p);
3358 }
3359 
3360 /*
3361  * this function creates a local metadata zvol property
3362  */
3363 sbd_status_t
3364 sbd_create_zfs_meta_object(sbd_lu_t *sl)
3365 {
3366         /*
3367          * -allocate 1/2 the property size, the zfs property
3368          *  is 8k in size and stored as ascii hex string, all
3369          *  we needed is 4k buffer to store the binary data.
3370          * -initialize reader/write lock
3371          */
3372         sl->sl_zfs_meta = kmem_zalloc(ZAP_MAXVALUELEN / 2, KM_SLEEP);


3373         rw_init(&sl->sl_zfs_meta_lock, NULL, RW_DRIVER, NULL);
3374         return (SBD_SUCCESS);
3375 }
3376 
3377 char
3378 sbd_ctoi(char c)
3379 {
3380         if ((c >= '0') && (c <= '9'))
3381                 c -= '0';
3382         else if ((c >= 'A') && (c <= 'F'))
3383                 c = c - 'A' + 10;
3384         else if ((c >= 'a') && (c <= 'f'))
3385                 c = c - 'a' + 10;
3386         else
3387                 c = -1;
3388         return (c);
3389 }
3390 
3391 /*
3392  * read zvol property and convert to binary