Lines Matching defs:itb

197 static int idm_itextbuf_add_nvpair(nvpair_t *nvp, idm_textbuf_t *itb);
200 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
203 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
206 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
209 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
212 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
215 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
218 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb);
220 static void textbuf_memcpy(idm_textbuf_t *itb, void *mem, int mem_len);
222 static void textbuf_strcpy(idm_textbuf_t *itb, char *str);
224 static void textbuf_append_char(idm_textbuf_t *itb, char c);
226 static void textbuf_terminate_kvpair(idm_textbuf_t *itb);
742 idm_textbuf_t itb;
744 bzero(&itb, sizeof (itb));
754 if ((rc = idm_itextbuf_add_nvpair(nvp, &itb)) != 0) {
760 *textbuf = itb.itb_mem;
761 *textbuflen = itb.itb_mem_len;
762 *validlen = itb.itb_offset;
769 idm_textbuf_t *itb)
797 rc = idm_itextbuf_add_string(nvp, ikvx, itb);
800 rc = idm_itextbuf_add_boolean(nvp, ikvx, itb);
805 rc = idm_itextbuf_add_binary(nvp, ikvx, itb);
808 rc = idm_itextbuf_add_large_numerical(nvp, ikvx, itb);
811 rc = idm_itextbuf_add_numerical(nvp, ikvx, itb);
814 rc = idm_itextbuf_add_numeric_range(nvp, ikvx, itb);
817 rc = idm_itextbuf_add_list_of_values(nvp, ikvx, itb);
830 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
838 textbuf_strcpy(itb, key_name);
841 textbuf_append_char(itb, '=');
846 textbuf_strcpy(itb, value);
849 textbuf_terminate_kvpair(itb);
858 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
866 textbuf_strcpy(itb, key_name);
869 textbuf_append_char(itb, '=');
874 textbuf_strcpy(itb, value ? "Yes" : "No");
877 textbuf_terminate_kvpair(itb);
885 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
895 textbuf_strcpy(itb, key_name);
898 textbuf_append_char(itb, '=');
904 textbuf_strcpy(itb, "0x");
910 textbuf_append_char(itb, idm_hex_to_ascii[(n >> 4) & 0xf]);
911 textbuf_append_char(itb, idm_hex_to_ascii[n & 0xf]);
915 textbuf_terminate_kvpair(itb);
923 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
932 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
941 textbuf_strcpy(itb, key_name);
944 textbuf_append_char(itb, '=');
950 textbuf_strcpy(itb, str);
953 textbuf_terminate_kvpair(itb);
961 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
970 const idm_kv_xlate_t *ikvx, idm_textbuf_t *itb)
979 textbuf_strcpy(itb, key_name);
982 textbuf_append_char(itb, '=');
989 textbuf_strcpy(itb, vchoice_string);
993 textbuf_append_char(itb, ',');
998 textbuf_terminate_kvpair(itb);
1005 textbuf_makeroom(idm_textbuf_t *itb, int size)
1010 if (itb->itb_mem == NULL) {
1011 itb->itb_mem_len = MAX(TEXTBUF_CHUNKSIZE, size);
1012 itb->itb_mem = kmem_alloc(itb->itb_mem_len, KM_SLEEP);
1013 } else if ((itb->itb_offset + size) > itb->itb_mem_len) {
1014 new_mem_len = itb->itb_mem_len + MAX(TEXTBUF_CHUNKSIZE, size);
1016 bcopy(itb->itb_mem, new_mem, itb->itb_mem_len);
1017 kmem_free(itb->itb_mem, itb->itb_mem_len);
1018 itb->itb_mem = new_mem;
1019 itb->itb_mem_len = new_mem_len;
1024 textbuf_memcpy(idm_textbuf_t *itb, void *mem, int mem_len)
1026 textbuf_makeroom(itb, mem_len);
1027 (void) memcpy(itb->itb_mem + itb->itb_offset, mem, mem_len);
1028 itb->itb_offset += mem_len;
1032 textbuf_strcpy(idm_textbuf_t *itb, char *str)
1034 textbuf_memcpy(itb, str, strlen(str));
1038 textbuf_append_char(idm_textbuf_t *itb, char c)
1040 textbuf_makeroom(itb, sizeof (char));
1041 *(itb->itb_mem + itb->itb_offset) = c;
1042 itb->itb_offset++;
1046 textbuf_terminate_kvpair(idm_textbuf_t *itb)
1048 textbuf_append_char(itb, '\0');
1324 idm_textbuf_t itb;
1327 bzero(&itb, sizeof (itb));
1328 rv = idm_itextbuf_add_nvpair(nvp, &itb);
1331 str = kmem_alloc(itb.itb_mem_len, KM_SLEEP);
1332 len = idm_strcspn(itb.itb_mem, "=");
1333 if (len > strlen(itb.itb_mem)) {
1334 kmem_free(itb.itb_mem, itb.itb_mem_len);
1337 (void) strcpy(str, &itb.itb_mem[len+1]);
1339 kmem_free(itb.itb_mem, itb.itb_mem_len);
1350 idm_textbuf_t *itb;
1358 itb = kmem_zalloc(sizeof (idm_textbuf_t), KM_SLEEP);
1359 ASSERT(itb != NULL);
1360 itb->itb_mem = textbuf;
1361 itb->itb_mem_len = textbuflen;
1362 itb->itb_offset = validlen;
1363 return ((void *)itb);
1377 idm_textbuf_t *itb = arg;
1381 ASSERT(itb != NULL);
1386 if (itb->itb_offset <= max_xfer_len) {
1390 bcopy((uint8_t *)itb->itb_mem, pdu->isp_data,
1391 (size_t)itb->itb_offset);
1392 pdu->isp_datalen = itb->itb_offset;
1398 start_ptr = itb->itb_mem;
1399 end_ptr = &itb->itb_mem[max_xfer_len - 1];
1404 len = (uintptr_t)&itb->itb_mem[itb->itb_offset] -
1422 if (end_ptr + 1 <= &itb->itb_mem[itb->itb_offset]) {
1444 idm_textbuf_t *itb = arg;
1445 ASSERT(itb != NULL);
1446 kmem_free(itb->itb_mem, itb->itb_mem_len);
1447 kmem_free(itb, sizeof (idm_textbuf_t));