Lines Matching full:section
73 static int check_file_status(struct pt_section *section, int fd) in check_file_status() argument
79 if (!section) in check_file_status()
86 status = section->status; in check_file_status()
99 int pt_sec_posix_map(struct pt_section *section, int fd) in pt_sec_posix_map() argument
107 if (!section) in pt_sec_posix_map()
110 offset = section->offset; in pt_sec_posix_map()
111 size = section->size; in pt_sec_posix_map()
122 /* The section is supposed to fit into the file so we shouldn't in pt_sec_posix_map()
125 if (size < section->size) in pt_sec_posix_map()
150 section->mapping = mapping; in pt_sec_posix_map()
151 section->unmap = pt_sec_posix_unmap; in pt_sec_posix_map()
152 section->read = pt_sec_posix_read; in pt_sec_posix_map()
153 section->memsize = pt_sec_posix_memsize; in pt_sec_posix_map()
162 static int pt_sec_posix_map_success(struct pt_section *section) in pt_sec_posix_map_success() argument
167 if (!section) in pt_sec_posix_map_success()
170 mcount = section->mcount + 1; in pt_sec_posix_map_success()
172 (void) pt_section_unlock(section); in pt_sec_posix_map_success()
176 section->mcount = mcount; in pt_sec_posix_map_success()
178 errcode = pt_section_unlock(section); in pt_sec_posix_map_success()
182 status = pt_section_on_map(section); in pt_sec_posix_map_success()
184 /* We had to release the section lock for pt_section_on_map() so in pt_sec_posix_map_success()
185 * @section may have meanwhile been mapped by other threads. in pt_sec_posix_map_success()
191 (void) pt_section_unmap(section); in pt_sec_posix_map_success()
198 int pt_section_map(struct pt_section *section) in pt_section_map() argument
204 if (!section) in pt_section_map()
207 errcode = pt_section_lock(section); in pt_section_map()
211 if (section->mcount) in pt_section_map()
212 return pt_sec_posix_map_success(section); in pt_section_map()
214 if (section->mapping) in pt_section_map()
217 filename = section->filename; in pt_section_map()
226 errcode = check_file_status(section, fd); in pt_section_map()
230 /* We close the file on success. This does not unmap the section. */ in pt_section_map()
231 errcode = pt_sec_posix_map(section, fd); in pt_section_map()
235 return pt_sec_posix_map_success(section); in pt_section_map()
248 * the section is unmapped. in pt_section_map()
250 errcode = pt_sec_file_map(section, file); in pt_section_map()
252 return pt_sec_posix_map_success(section); in pt_section_map()
261 (void) pt_section_unlock(section); in pt_section_map()
265 int pt_sec_posix_unmap(struct pt_section *section) in pt_sec_posix_unmap() argument
269 if (!section) in pt_sec_posix_unmap()
272 mapping = section->mapping; in pt_sec_posix_unmap()
273 if (!mapping || !section->unmap || !section->read || !section->memsize) in pt_sec_posix_unmap()
276 section->mapping = NULL; in pt_sec_posix_unmap()
277 section->unmap = NULL; in pt_sec_posix_unmap()
278 section->read = NULL; in pt_sec_posix_unmap()
279 section->memsize = NULL; in pt_sec_posix_unmap()
287 int pt_sec_posix_read(const struct pt_section *section, uint8_t *buffer, in pt_sec_posix_read() argument
293 if (!buffer || !section) in pt_sec_posix_read()
296 mapping = section->mapping; in pt_sec_posix_read()
301 * lies within the section's boundaries. in pt_sec_posix_read()
303 * And we checked that the entire section was mapped. There's no need in pt_sec_posix_read()
312 int pt_sec_posix_memsize(const struct pt_section *section, uint64_t *size) in pt_sec_posix_memsize() argument
317 if (!section || !size) in pt_sec_posix_memsize()
320 mapping = section->mapping; in pt_sec_posix_memsize()