Changeset 4087a33 in mainline
- Timestamp:
- 2010-11-21T16:57:53Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ee648a, 1fe9bf6
- Parents:
- 3f8c1f7
- Location:
- uspace/srv/devman
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
r3f8c1f7 r4087a33 117 117 printf(NAME": the '%s' driver was added to the list of available " 118 118 "drivers.\n", drv->name); 119 120 printf(NAME ": match ids:"); 121 link_t *cur; 122 for (cur = drv->match_ids.ids.next; cur != &drv->match_ids.ids; cur = cur->next) { 123 match_id_t *match_id = list_get_instance(cur, match_id_t, link); 124 printf(" %d:%s", match_id->score, match_id->id); 125 } 126 printf("\n"); 119 127 } 120 128 -
uspace/srv/devman/match.c
r3f8c1f7 r4087a33 43 43 return 0; 44 44 45 /* 46 * Find first matching pair. 47 */ 45 48 link_t *drv_link = drv->match_ids.ids.next; 46 link_t *dev_link = dev->match_ids.ids.next; 47 48 match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link); 49 match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link); 50 51 int score_next_drv = 0; 52 int score_next_dev = 0; 53 54 do { 55 match_id_t *tmp_ma_id; 56 57 if (str_cmp(drv_id->id, dev_id->id) == 0) { 58 /* 59 * We found a match. 60 * Return the score of the match. 61 */ 62 return drv_id->score * dev_id->score; 49 while (drv_link != drv_head) { 50 link_t *dev_link = dev->match_ids.ids.next; 51 while (dev_link != dev_head) { 52 match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link); 53 match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link); 54 55 if (str_cmp(drv_id->id, dev_id->id) == 0) { 56 /* 57 * We found a match. 58 * Return the score of the match. 59 */ 60 return drv_id->score * dev_id->score; 61 } 62 63 dev_link = dev_link->next; 63 64 } 64 65 /* 66 * Compute the next score we get, if we advance in the driver's 67 * list of match ids. 68 */ 69 if (drv_link->next != drv_head) { 70 tmp_ma_id = list_get_instance(drv_link->next, 71 match_id_t, link); 72 score_next_drv = dev_id->score * tmp_ma_id->score; 73 } else { 74 score_next_drv = 0; 75 } 76 77 /* 78 * Compute the next score we get, if we advance in the device's 79 * list of match ids. 80 */ 81 if (dev_link->next != dev_head) { 82 tmp_ma_id = list_get_instance(dev_link->next, 83 match_id_t, link); 84 score_next_dev = drv_id->score * tmp_ma_id->score; 85 } else { 86 score_next_dev = 0; 87 } 88 89 /* 90 * Advance in one of the two lists, so we get the next highest 91 * score. 92 */ 93 if (score_next_drv > score_next_dev) { 94 drv_link = drv_link->next; 95 drv_id = list_get_instance(drv_link, match_id_t, link); 96 } else { 97 dev_link = dev_link->next; 98 dev_id = list_get_instance(dev_link, match_id_t, link); 99 } 100 101 } while (drv_link->next != drv_head && dev_link->next != dev_head); 65 drv_link = drv_link->next; 66 } 102 67 103 68 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.