Lines Matching full:desc

140 	image_desc_t *desc;  in new_image_desc()  local
142 desc = xzalloc(sizeof(*desc), in new_image_desc()
144 memcpy(&desc->uuid, uuid, sizeof(uuid_t)); in new_image_desc()
145 desc->name = xstrdup(name, in new_image_desc()
147 desc->cmdline_name = xstrdup(cmdline_name, in new_image_desc()
149 desc->action = DO_UNSPEC; in new_image_desc()
150 return desc; in new_image_desc()
153 static void set_image_desc_action(image_desc_t *desc, int action, in set_image_desc_action() argument
156 assert(desc != NULL); in set_image_desc_action()
158 if (desc->action_arg != (char *)DO_UNSPEC) in set_image_desc_action()
159 free(desc->action_arg); in set_image_desc_action()
160 desc->action = action; in set_image_desc_action()
161 desc->action_arg = NULL; in set_image_desc_action()
163 desc->action_arg = xstrdup(arg, in set_image_desc_action()
167 static void free_image_desc(image_desc_t *desc) in free_image_desc() argument
169 free(desc->name); in free_image_desc()
170 free(desc->cmdline_name); in free_image_desc()
171 free(desc->action_arg); in free_image_desc()
172 if (desc->image) { in free_image_desc()
173 free(desc->image->buffer); in free_image_desc()
174 free(desc->image); in free_image_desc()
176 free(desc); in free_image_desc()
179 static void add_image_desc(image_desc_t *desc) in add_image_desc() argument
187 *p = desc; in add_image_desc()
193 image_desc_t *desc = image_desc_head, *tmp; in free_image_descs() local
195 while (desc != NULL) { in free_image_descs()
196 tmp = desc->next; in free_image_descs()
197 free_image_desc(desc); in free_image_descs()
198 desc = tmp; in free_image_descs()
211 image_desc_t *desc; in fill_image_descs() local
213 desc = new_image_desc(&toc_entry->uuid, in fill_image_descs()
216 add_image_desc(desc); in fill_image_descs()
222 image_desc_t *desc; in lookup_image_desc_from_uuid() local
224 for (desc = image_desc_head; desc != NULL; desc = desc->next) in lookup_image_desc_from_uuid()
225 if (memcmp(&desc->uuid, uuid, sizeof(uuid_t)) == 0) in lookup_image_desc_from_uuid()
226 return desc; in lookup_image_desc_from_uuid()
232 image_desc_t *desc; in lookup_image_desc_from_opt() local
234 for (desc = image_desc_head; desc != NULL; desc = desc->next) in lookup_image_desc_from_opt()
235 if (strcmp(desc->cmdline_name, opt) == 0) in lookup_image_desc_from_opt()
236 return desc; in lookup_image_desc_from_opt()
319 image_desc_t *desc; in parse_fip() local
346 desc = lookup_image_desc_from_uuid(&toc_entry->uuid); in parse_fip()
347 if (desc == NULL) { in parse_fip()
353 desc = new_image_desc(&toc_entry->uuid, name, "blob"); in parse_fip()
354 desc->action = DO_UNPACK; in parse_fip()
355 desc->action_arg = xstrdup(filename, in parse_fip()
357 add_image_desc(desc); in parse_fip()
360 assert(desc->image == NULL); in parse_fip()
361 desc->image = image; in parse_fip()
429 image_desc_t *desc; in fill_common_opts() local
431 for (desc = image_desc_head; desc != NULL; desc = desc->next) in fill_common_opts()
432 opts = add_opt(opts, nr_opts, desc->cmdline_name, has_arg, in fill_common_opts()
447 image_desc_t *desc; in info_cmd() local
465 for (desc = image_desc_head; desc != NULL; desc = desc->next) { in info_cmd()
466 image_t *image = desc->image; in info_cmd()
471 desc->name, in info_cmd()
474 desc->cmdline_name); in info_cmd()
499 image_desc_t *desc; in pack_images() local
506 for (desc = image_desc_head; desc != NULL; desc = desc->next) in pack_images()
507 if (desc->image != NULL) in pack_images()
525 for (desc = image_desc_head; desc != NULL; desc = desc->next) { in pack_images()
526 image_t *image = desc->image; in pack_images()
558 for (desc = image_desc_head; desc != NULL; desc = desc->next) { in pack_images()
559 image_t *image = desc->image; in pack_images()
590 image_desc_t *desc; in update_fip() local
593 for (desc = image_desc_head; desc != NULL; desc = desc->next) { in update_fip()
596 if (desc->action != DO_PACK) in update_fip()
599 image = read_image_from_file(&desc->uuid, in update_fip()
600 desc->action_arg); in update_fip()
601 if (desc->image != NULL) { in update_fip()
604 desc->cmdline_name, in update_fip()
605 desc->action_arg); in update_fip()
607 free(desc->image); in update_fip()
608 desc->image = image; in update_fip()
612 desc->action_arg); in update_fip()
613 desc->image = image; in update_fip()
690 image_desc_t *desc; in create_cmd() local
692 desc = lookup_image_desc_from_opt(opts[opt_index].name); in create_cmd()
693 set_image_desc_action(desc, DO_PACK, optarg); in create_cmd()
706 image_desc_t *desc; in create_cmd() local
715 desc = lookup_image_desc_from_uuid(&uuid); in create_cmd()
716 if (desc == NULL) { in create_cmd()
718 desc = new_image_desc(&uuid, name, "blob"); in create_cmd()
719 add_image_desc(desc); in create_cmd()
721 set_image_desc_action(desc, DO_PACK, filename); in create_cmd()
789 image_desc_t *desc; in update_cmd() local
791 desc = lookup_image_desc_from_opt(opts[opt_index].name); in update_cmd()
792 set_image_desc_action(desc, DO_PACK, optarg); in update_cmd()
803 image_desc_t *desc; in update_cmd() local
812 desc = lookup_image_desc_from_uuid(&uuid); in update_cmd()
813 if (desc == NULL) { in update_cmd()
815 desc = new_image_desc(&uuid, name, "blob"); in update_cmd()
816 add_image_desc(desc); in update_cmd()
818 set_image_desc_action(desc, DO_PACK, filename); in update_cmd()
878 image_desc_t *desc; in unpack_cmd() local
900 image_desc_t *desc; in unpack_cmd() local
902 desc = lookup_image_desc_from_opt(opts[opt_index].name); in unpack_cmd()
903 set_image_desc_action(desc, DO_UNPACK, optarg); in unpack_cmd()
911 image_desc_t *desc; in unpack_cmd() local
920 desc = lookup_image_desc_from_uuid(&uuid); in unpack_cmd()
921 if (desc == NULL) { in unpack_cmd()
923 desc = new_image_desc(&uuid, name, "blob"); in unpack_cmd()
924 add_image_desc(desc); in unpack_cmd()
926 set_image_desc_action(desc, DO_UNPACK, filename); in unpack_cmd()
954 for (desc = image_desc_head; desc != NULL; desc = desc->next) { in unpack_cmd()
956 image_t *image = desc->image; in unpack_cmd()
958 if (!unpack_all && desc->action != DO_UNPACK) in unpack_cmd()
962 if (desc->action_arg == NULL) in unpack_cmd()
964 desc->cmdline_name); in unpack_cmd()
967 desc->action_arg); in unpack_cmd()
1015 image_desc_t *desc; in remove_cmd() local
1038 image_desc_t *desc; in remove_cmd() local
1040 desc = lookup_image_desc_from_opt(opts[opt_index].name); in remove_cmd()
1041 set_image_desc_action(desc, DO_REMOVE, NULL); in remove_cmd()
1050 image_desc_t *desc; in remove_cmd() local
1058 desc = lookup_image_desc_from_uuid(&uuid); in remove_cmd()
1059 if (desc == NULL) { in remove_cmd()
1061 desc = new_image_desc(&uuid, name, "blob"); in remove_cmd()
1062 add_image_desc(desc); in remove_cmd()
1064 set_image_desc_action(desc, DO_REMOVE, NULL); in remove_cmd()
1093 for (desc = image_desc_head; desc != NULL; desc = desc->next) { in remove_cmd()
1094 if (desc->action != DO_REMOVE) in remove_cmd()
1097 if (desc->image != NULL) { in remove_cmd()
1100 desc->cmdline_name); in remove_cmd()
1101 free(desc->image); in remove_cmd()
1102 desc->image = NULL; in remove_cmd()
1105 desc->cmdline_name, argv[0]); in remove_cmd()