Lines Matching refs:table

48 	smbios_test_table_t *table;  in smbios_test_table_init()  local
54 table = umem_zalloc(sizeof (smbios_test_table_t), UMEM_DEFAULT); in smbios_test_table_init()
55 if (table == NULL) { in smbios_test_table_init()
59 table->stt_data = umem_zalloc(SMBIOS_TEST_ALLOC_SIZE, UMEM_DEFAULT); in smbios_test_table_init()
60 if (table->stt_data == NULL) { in smbios_test_table_init()
61 umem_free(table, sizeof (smbios_test_table_t)); in smbios_test_table_init()
64 table->stt_buflen = SMBIOS_TEST_ALLOC_SIZE; in smbios_test_table_init()
65 table->stt_type = type; in smbios_test_table_init()
66 table->stt_version = version; in smbios_test_table_init()
67 table->stt_nextid = 1; in smbios_test_table_init()
69 return (table); in smbios_test_table_init()
73 smbios_test_table_append_common(smbios_test_table_t *table, const void *buf, in smbios_test_table_append_common() argument
78 if (SIZE_MAX - table->stt_offset < len) in smbios_test_table_append_common()
81 if (len + table->stt_offset >= table->stt_buflen) { in smbios_test_table_append_common()
83 size_t newlen = table->stt_buflen + SMBIOS_TEST_ALLOC_SIZE; in smbios_test_table_append_common()
85 while (len + table->stt_offset >= newlen) { in smbios_test_table_append_common()
95 (void) memcpy(newbuf, table->stt_data, table->stt_buflen); in smbios_test_table_append_common()
96 umem_free(table->stt_data, table->stt_buflen); in smbios_test_table_append_common()
97 table->stt_data = newbuf; in smbios_test_table_append_common()
98 table->stt_buflen = newlen; in smbios_test_table_append_common()
101 start = (void *)((uintptr_t)table->stt_data + table->stt_offset); in smbios_test_table_append_common()
103 table->stt_offset += len; in smbios_test_table_append_common()
109 smbios_test_table_append_raw(smbios_test_table_t *table, const void *buf, in smbios_test_table_append_raw() argument
112 (void) smbios_test_table_append_common(table, buf, len); in smbios_test_table_append_raw()
116 smbios_test_table_append_string(smbios_test_table_t *table, const char *str) in smbios_test_table_append_string() argument
119 (void) smbios_test_table_append_common(table, str, len); in smbios_test_table_append_string()
123 smbios_test_table_str_fini(smbios_test_table_t *table) in smbios_test_table_str_fini() argument
127 smbios_test_table_append_raw(table, &endstring, sizeof (endstring)); in smbios_test_table_str_fini()
131 smbios_test_table_append(smbios_test_table_t *table, const void *buf, in smbios_test_table_append() argument
137 hdr = smbios_test_table_append_common(table, buf, len); in smbios_test_table_append()
138 table->stt_nents++; in smbios_test_table_append()
140 id = table->stt_nextid; in smbios_test_table_append()
141 hdr->smbh_hdl = htole16(table->stt_nextid); in smbios_test_table_append()
142 table->stt_nextid++; in smbios_test_table_append()
148 smbios_test_table_append_eot(smbios_test_table_t *table) in smbios_test_table_append_eot() argument
156 (void) smbios_test_table_append(table, &eot, sizeof (eot)); in smbios_test_table_append_eot()
157 (void) smbios_test_table_append_raw(table, &endstring, in smbios_test_table_append_eot()
159 smbios_test_table_append_raw(table, &endstring, in smbios_test_table_append_eot()
161 smbios_test_table_append_raw(table, &endstring, in smbios_test_table_append_eot()
183 smbios_test_table_snapshot(smbios_test_table_t *table, smbios_entry_t **entryp, in smbios_test_table_snapshot() argument
188 switch (table->stt_type) { in smbios_test_table_snapshot()
190 ent30 = &table->stt_entry.ep30; in smbios_test_table_snapshot()
196 ent30->smbe_major = (table->stt_version >> 8) & 0xff; in smbios_test_table_snapshot()
197 ent30->smbe_minor = table->stt_version & 0xff; in smbios_test_table_snapshot()
201 ent30->smbe_stlen = htole32(table->stt_offset); in smbios_test_table_snapshot()
211 *entryp = &table->stt_entry; in smbios_test_table_snapshot()
212 *bufp = table->stt_data; in smbios_test_table_snapshot()
213 *lenp = table->stt_offset; in smbios_test_table_snapshot()
217 smbios_test_table_fini(smbios_test_table_t *table) in smbios_test_table_fini() argument
219 if (table == NULL) { in smbios_test_table_fini()
223 if (table->stt_data != NULL) { in smbios_test_table_fini()
224 umem_free(table->stt_data, table->stt_buflen); in smbios_test_table_fini()
227 umem_free(table, sizeof (smbios_test_table_t)); in smbios_test_table_fini()
644 smbios_test_table_t *table = NULL; in smbios_test_run_one() local
652 table = smbios_test_table_init(test->st_entry, test->st_tvers); in smbios_test_run_one()
653 if (!test->st_mktable(table)) { in smbios_test_run_one()
657 smbios_test_table_snapshot(table, &entry, &buf, &len); in smbios_test_run_one()
705 if (table != NULL) { in smbios_test_run_one()
706 smbios_test_table_fini(table); in smbios_test_run_one()