Lines Matching refs:image

49 void opd_delete_image(struct opd_image * image)
51 verbprintf(vmisc, "Deleting image: name %s app_name %s, kernel %d, "
53 image->name, image->app_name, image->kernel,
54 image->tid, image->tgid, (int)image->ref_count);
56 if (image->ref_count <= 0) {
57 printf("image->ref_count < 0 for image: name %s app_name %s, "
59 image->name, image->app_name, image->kernel,
60 image->tid, image->tgid, image->ref_count);
64 if (--image->ref_count != 0)
67 if (image->name)
68 free(image->name);
69 if (image->app_name)
70 free(image->app_name);
71 list_del(&image->hash_next);
72 opd_close_image_samples_files(image);
73 free(image);
87 struct opd_image * image =
89 image_cb(image);
96 * opd_hash_image - hash an image
97 * @param hash hash of image name
113 * opd_new_image - create an image sample file
114 * @param app_name the application name where belongs this image
115 * @param name name of the image to add
116 * @param kernel is the image a kernel/module image
120 * image at funtion entry is uninitialised
122 * image structure if appropriate.
124 * Initialise an opd_image struct for the image image
126 * the image is fully initialized.
133 struct opd_image * image;
135 verbprintf(vmisc, "Creating image: %s %s, kernel %d, tid %d, "
138 image = xmalloc(sizeof(struct opd_image));
140 list_init(&image->hash_next);
141 image->name = xstrdup(name);
142 image->kernel = kernel;
143 image->tid = tid;
144 image->tgid = tgid;
145 image->ref_count = 0;
146 image->app_name = app_name ? xstrdup(app_name) : NULL;
147 image->mtime = op_get_mtime(image->name);
149 image->ignored = 1;
151 image->ignored = is_image_ignored(app_name);
152 if (image->ignored)
153 image->ignored = is_image_ignored(name);
155 memset(image->sfiles, '\0', NR_CPUS * sizeof(struct opd_24_sfile **));
158 list_add(&image->hash_next, &opd_images[hash_image]);
162 return image;
167 * is_same_image - check for identical image
168 * @param image image to compare
169 * @param name name of image
170 * @param app_name image must belong to this application name
174 * on entry caller have checked than strcmp(image->name, name) == 0
175 * return 0 if the couple (name, app_name) refers to same image
177 static int is_same_image(struct opd_image const * image, char const * app_name,
181 * identical image we will open/mmap multiple time the same samples
186 if (image->tid != tid || image->tgid != tgid)
194 if (image->app_name == NULL && app_name == NULL)
197 if (image->app_name != NULL && app_name != NULL &&
198 !strcmp(image->app_name, app_name))
201 /* /proc parsed image come with a non null app_name but notification
204 if (image->app_name && !app_name && !strcmp(image->app_name, image->name))
212 * opd_find_image - find an image
213 * @param name name of image to find
214 * @param hash hash of image to find
215 * @param app_name the application name where belongs this image
219 * Returns the image pointer for the file specified by name, or %NULL.
225 struct opd_image * image = 0;
233 image = list_entry(pos, struct opd_image, hash_next);
235 if (!strcmp(image->name, name)) {
236 if (!is_same_image(image, app_name, tid, tgid))
245 return image;
252 struct opd_image * image;
253 if ((image = opd_find_image(name, app_name, tid, tgid)) == NULL)
254 image = opd_new_image(name, app_name, kernel, tid, tgid);
256 return image;