Lines Matching +full:com +full:- +full:seq
1 // SPDX-License-Identifier: GPL-2.0
14 // 02110-1301, USA.
19 * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
21 * Uses gcc-internal data definitions.
22 * Based on the gcov-kernel patch by:
23 * Hubertus Franke <frankeh@us.ibm.com>
24 * Nigel Hinds <nhinds@us.ibm.com>
25 * Rajan Ravindran <rajancr@us.ibm.com>
26 * Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
88 while (ptr > path + 1 && *(ptr - 1) == '/')
89 --ptr;
90 *ptr-- = '\0';
93 while (ptr > path && *(ptr - 1) != '/')
94 --ptr;
99 * __gcov_init is called by gcc-generated constructor code for each object
100 * file compiled with -fprofile-arcs.
127 * These functions may be referenced by gcc-generated profiling code but serve
180 * struct gcov_node - represents a debugfs entry
236 gcov_seq_start(struct seq_file *seq, off_t *pos) in gcov_seq_start() argument
240 gcov_iter_start(seq->private); in gcov_seq_start()
242 if (gcov_iter_next(seq->private)) in gcov_seq_start()
245 return seq->private; in gcov_seq_start()
250 gcov_seq_next(struct seq_file *seq, void *data, off_t *pos) in gcov_seq_next() argument
263 gcov_seq_show(struct seq_file *seq, void *data) in gcov_seq_show() argument
267 if (gcov_iter_write(iter, seq->buf)) in gcov_seq_show()
268 return (-EINVAL); in gcov_seq_show()
273 gcov_seq_stop(struct seq_file *seq, void *data) in gcov_seq_stop() argument
293 if (node->num_loaded > 0) in get_node_info()
294 return (node->loaded_info[0]); in get_node_info()
296 return (node->unloaded_info); in get_node_info()
309 if (node->unloaded_info) in get_accumulated_info()
310 info = gcov_info_dup(node->unloaded_info); in get_accumulated_info()
312 info = gcov_info_dup(node->loaded_info[i++]); in get_accumulated_info()
315 for (; i < node->num_loaded; i++) in get_accumulated_info()
316 gcov_info_add(info, node->loaded_info[i]); in get_accumulated_info()
328 struct gcov_node *node = inode->i_private; in gcov_seq_open()
330 struct seq_file *seq; in gcov_seq_open() local
332 int rc = -ENOMEM; in gcov_seq_open()
349 seq = file->private_data; in gcov_seq_open()
350 seq->private = iter; in gcov_seq_open()
371 struct seq_file *seq; in gcov_seq_release() local
373 seq = file->private_data; in gcov_seq_release()
374 iter = seq->private; in gcov_seq_release()
410 if (node->unloaded_info) in reset_node()
411 gcov_info_reset(node->unloaded_info); in reset_node()
412 for (i = 0; i < node->num_loaded; i++) in reset_node()
413 gcov_info_reset(node->loaded_info[i]); in reset_node()
424 if (node->num_loaded > 0) in gcov_stats_reset()
426 else if (LIST_EMPTY(&node->children)) { in gcov_stats_reset()
442 struct seq_file *seq; in gcov_seq_write() local
446 seq = file->private_data; in gcov_seq_write()
447 info = gcov_iter_get_info(seq->private); in gcov_seq_write()
452 if (node->num_loaded == 0) in gcov_seq_write()
507 if (ext->dir == SRC_TREE) in get_link_target()
508 result = link_target(srctree, rel, ext->ext); in get_link_target()
510 result = link_target(objtree, rel, ext->ext); in get_link_target()
513 result = link_target(NULL, filename, ext->ext); in get_link_target()
523 * for filename skewing caused by the mod-versioning mechanism.
528 if (strncmp(basename, SKEW_PREFIX, sizeof(SKEW_PREFIX) - 1) == 0) in deskew()
529 return (basename + sizeof(SKEW_PREFIX) - 1); in deskew()
547 node->links = malloc((num*sizeof(struct dentry *)), M_GCOV, M_NOWAIT|M_ZERO); in add_links()
548 if (node->links == NULL) in add_links()
559 node->links[i] = debugfs_create_symlink(deskew(path_basename), in add_links()
561 if (!node->links[i]) in add_links()
569 while (i-- > 0) in add_links()
570 debugfs_remove(node->links[i]); in add_links()
571 free(node->links, M_GCOV); in add_links()
572 node->links = NULL; in add_links()
588 LIST_INIT(&node->children); in init_node()
589 if (node->loaded_info) { in init_node()
590 node->loaded_info[0] = info; in init_node()
591 node->num_loaded = 1; in init_node()
593 node->parent = parent; in init_node()
595 strcpy(node->name, name); in init_node()
611 node->loaded_info = malloc(sizeof(struct gcov_info *), M_GCOV, M_NOWAIT|M_ZERO); in new_node()
612 if (!node->loaded_info) in new_node()
618 node->dentry = debugfs_create_file(deskew(node->name), 0600, in new_node()
619 parent->dentry, node, &gcov_data_fops); in new_node()
621 node->dentry = debugfs_create_dir(node->name, parent->dentry); in new_node()
622 if (!node->dentry) { in new_node()
628 add_links(node, parent->dentry); in new_node()
629 LIST_INSERT_HEAD(&parent->children, node, children_entry); in new_node()
645 if (node->links == NULL) in remove_links()
648 debugfs_remove(node->links[i]); in remove_links()
649 free(node->links, M_GCOV); in remove_links()
650 node->links = NULL; in remove_links()
662 debugfs_remove(node->dentry); in release_node()
664 free(node->loaded_info, M_GCOV); in release_node()
665 if (node->unloaded_info) in release_node()
666 gcov_info_free(node->unloaded_info); in release_node()
676 while ((node != &root_node) && LIST_EMPTY(&node->children)) { in remove_node()
677 parent = node->parent; in remove_node()
692 LIST_FOREACH(node, &parent->children, children_entry) { in get_child_by_name()
693 if (strcmp(node->name, name) == 0) in get_child_by_name()
725 if (!parent->parent) in add_node()
727 parent = parent->parent; in add_node()
759 int num = node->num_loaded; in add_info()
772 memcpy(loaded_info, node->loaded_info, in add_info()
781 if (!gcov_info_is_compatible(node->unloaded_info, info)) { in add_info()
785 gcov_info_free(node->unloaded_info); in add_info()
786 node->unloaded_info = NULL; in add_info()
793 if (!gcov_info_is_compatible(node->loaded_info[0], info)) { in add_info()
801 free(node->loaded_info, M_GCOV); in add_info()
802 node->loaded_info = loaded_info; in add_info()
803 node->num_loaded = num + 1; in add_info()
814 for (i = 0; i < node->num_loaded; i++) { in get_info_index()
815 if (node->loaded_info[i] == info) in get_info_index()
827 if (node->unloaded_info) in save_info()
828 gcov_info_add(node->unloaded_info, info); in save_info()
830 node->unloaded_info = gcov_info_dup(info); in save_info()
831 if (!node->unloaded_info) { in save_info()
857 node->loaded_info[i] = node->loaded_info[node->num_loaded - 1]; in remove_info()
858 node->num_loaded--; in remove_info()
859 if (node->num_loaded > 0) in remove_info()
862 free(node->loaded_info, M_GCOV); in remove_info()
863 node->loaded_info = NULL; in remove_info()
864 node->num_loaded = 0; in remove_info()
865 if (!node->unloaded_info) in remove_info()
871 * -fprofile-arcs is loaded/unloaded.
900 * gcov_enable_events - enable event reporting through gcov_event()
902 * Turn on reporting of profiling data load/unload-events through the