Changeset 278ac72 in mainline for uspace/srv/loc/category.c
- Timestamp:
- 2011-08-16T15:35:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30c78c0
- Parents:
- 16dc887
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/loc/category.c
r16dc887 r278ac72 54 54 list_append(&cat->cat_list, &cdir->categories); 55 55 } 56 57 /** Get list of categories. */ 58 int categ_dir_get_categories(categ_dir_t *cdir, category_id_t *id_buf, 59 size_t buf_size, size_t *act_size) 60 { 61 size_t act_cnt; 62 size_t buf_cnt; 63 64 assert(fibril_mutex_is_locked(&cdir->mutex)); 65 66 buf_cnt = buf_size / sizeof(category_id_t); 67 68 act_cnt = list_count(&cdir->categories); 69 *act_size = act_cnt * sizeof(category_id_t); 70 71 if (buf_size % sizeof(category_id_t) != 0) 72 return EINVAL; 73 74 size_t pos = 0; 75 list_foreach(cdir->categories, item) { 76 category_t *cat = 77 list_get_instance(item, category_t, cat_list); 78 79 if (pos < buf_cnt) 80 id_buf[pos] = cat->id; 81 pos++; 82 } 83 84 return EOK; 85 } 86 56 87 57 88 /** Initialize category structure. */
Note:
See TracChangeset
for help on using the changeset viewer.