int geo_cmp(geoid_t g0, geoid_t g1) { int rv; /* Compare the common fields */ rv = MODULE_CMP(geo_module(g0), geo_module(g1)); if (rv != 0) return rv; rv = geo_slab(g0) - geo_slab(g1); if (rv != 0) return rv; /* Within a slab, sort by type */ rv = geo_type(g0) - geo_type(g1); if (rv != 0) return rv; switch(geo_type(g0)) { case GEO_TYPE_CPU: rv = g0.cpu.slice - g1.cpu.slice; break; case GEO_TYPE_IOCARD: rv = g0.pcicard.bus - g1.pcicard.bus; if (rv) break; rv = SLOTNUM_GETSLOT(g0.pcicard.slot) - SLOTNUM_GETSLOT(g1.pcicard.slot); break; case GEO_TYPE_MEM: rv = g0.mem.membus - g1.mem.membus; if (rv) break; rv = g0.mem.memslot - g1.mem.memslot; break; default: rv = 0; } return rv; }
/* Add inventory information to the widget vertex * Right now (module,slot,revision) is being * added as inventory information. */ static void xwidget_inventory_add(vertex_hdl_t widgetv, lboard_t *board, struct xwidget_hwid_s hwid) { if (!board) return; /* Donot add inventory information for the baseio * on a speedo with an xbox. It has already been * taken care of in SN00_vmc. * Speedo with xbox's baseio comes in at slot io1 (widget 9) */ device_inventory_add(widgetv,INV_IOBD,board->brd_type, geo_module(board->brd_geoid), SLOTNUM_GETSLOT(board->brd_slot), hwid.rev_num); }