Lines Matching refs:image

109 void pt_image_init(struct pt_image *image, const char *name)
111 if (!image)
114 memset(image, 0, sizeof(*image));
116 image->name = dupstr(name);
119 void pt_image_fini(struct pt_image *image)
121 if (!image)
124 pt_section_list_free_tail(image->sections);
125 free(image->name);
127 memset(image, 0, sizeof(*image));
132 struct pt_image *image;
134 image = malloc(sizeof(*image));
135 if (image)
136 pt_image_init(image, name);
138 return image;
141 void pt_image_free(struct pt_image *image)
143 pt_image_fini(image);
144 free(image);
147 const char *pt_image_name(const struct pt_image *image)
149 if (!image)
152 return image->name;
155 int pt_image_add(struct pt_image *image, struct pt_section *section,
162 if (!image || !section)
177 list = &(image->sections);
267 int pt_image_remove(struct pt_image *image, struct pt_section *section,
272 if (!image || !section)
275 for (list = &image->sections; *list; list = &((*list)->next)) {
307 int pt_image_add_file(struct pt_image *image, const char *filename,
315 if (!image || !filename)
327 errcode = pt_image_add(image, section, &asid, vaddr, 0);
333 /* The image list got its own reference; let's drop ours. */
341 int pt_image_copy(struct pt_image *image, const struct pt_image *src)
346 if (!image || !src)
349 /* There is nothing to do if we copy an image to itself.
354 if (image == src)
361 errcode = pt_image_add(image, list->section.section,
372 int pt_image_remove_by_filename(struct pt_image *image, const char *filename,
379 if (!image || !filename)
387 for (list = &image->sections; *list;) {
422 int pt_image_remove_by_asid(struct pt_image *image,
429 if (!image)
437 for (list = &image->sections; *list;) {
464 int pt_image_set_callback(struct pt_image *image,
467 if (!image)
470 image->readmem.callback = callback;
471 image->readmem.context = context;
476 static int pt_image_read_callback(struct pt_image *image, int *isid,
482 if (!image || !isid)
485 callback = image->readmem.callback;
491 return callback(buffer, size, asid, addr, image->readmem.context);
535 static int pt_image_fetch_section(struct pt_image *image,
540 if (!image)
543 start = &image->sections;
574 int pt_image_read(struct pt_image *image, int *isid, uint8_t *buffer,
582 if (!image || !isid)
585 errcode = pt_image_fetch_section(image, asid, addr);
590 return pt_image_read_callback(image, isid, buffer, size, asid,
594 slist = image->sections;
617 return pt_image_read_callback(image, isid, buffer, size, asid,
624 int pt_image_add_cached(struct pt_image *image,
633 if (!image || !iscache)
644 status = pt_image_add(image, section, &asid, vaddr, isid);
656 int pt_image_find(struct pt_image *image, struct pt_mapped_section *usec,
664 if (!image || !usec)
667 errcode = pt_image_fetch_section(image, asid, vaddr);
671 slist = image->sections;
687 int pt_image_validate(const struct pt_image *image,
695 if (!image || !usec)
711 slist = image->sections;