Lines Matching defs:table

40  * Define structures for a path-to-usage lookup table.
70 info_table_t *table;
83 static void free_table(info_table_t *table, size_t table_len);
164 * Free a table of RCM resource names.
323 * First a lookup table is built to map lists of RCM usage to
325 * the lookup table is used for each node to find matching
332 info_table_t *table;
336 /* Build a lookup table, mapping paths to usage information */
337 if ((rv = build_table(info, &table, &table_len)) != 0) {
338 log_err("Cannot build RCM lookup table (%s)\n", strerror(rv));
342 /* Stop if no valid entries were inserted in table */
343 if ((table == NULL) || (table_len == 0)) {
350 arg.table = table;
356 /* Done with the table */
357 free_table(table, table_len);
468 /* Check the lookup table for associated usage */
470 if ((slot = bsearch(&lookup, arg->table, arg->table_len,
513 * Build a lookup table that will be used to map paths to their
522 info_table_t *table;
532 /* Count the RCM info tuples to determine the table's size */
537 /* If the table would be empty, then do nothing */
541 /* Allocate the lookup table */
542 table = (info_table_t *)calloc(table_len, sizeof (info_table_t));
543 if (table == NULL)
547 * Fill in the lookup table. Fill one slot in the table
570 * current slot in the table, then initialize the next
571 * slot in the table.
575 slot = &table[table_len];
577 log_err("Cannot build info table slot.\n");
578 free_table(table, table_len);
590 log_err("Cannot allocate info table entry.\n");
591 free_table(table, table_len);
602 log_err("Cannot build info table entry.\n");
603 free_table(table, table_len);
609 /* Check if valid entries were inserted in table */
611 free(table);
615 /* Sort the lookup table by hotplug path */
616 qsort(table, table_len, sizeof (info_table_t), compare_info);
619 *tablep = table;
627 * Destroy a lookup table.
630 free_table(info_table_t *table, size_t table_len)
635 if (table != NULL) {
637 if (table[index].path != NULL)
638 free(table[index].path);
639 while (table[index].entries != NULL) {
640 entry = table[index].entries;
641 table[index].entries = entry->next;
649 free(table);
692 * Compare two slots in the lookup table that maps paths to usage.