Hi.

This patch cleans up the coding style.

Thanks
Ken'ichi Ohmichi

diff -puN makedumpfile.org/makedumpfile.c makedumpfile/makedumpfile.c
--- makedumpfile.org/makedumpfile.c     2006-10-11 13:04:47.000000000 +0900
+++ makedumpfile/makedumpfile.c 2006-10-11 13:04:09.000000000 +0900
@@ -184,14 +184,16 @@ check_release(struct DumpInfo *info)
                ERRMSG("Can't get the symbol of system_utsname.\n");
                return FALSE;
        }
-       if (!readmem(info, sym_system_utsname, &system_utsname, sizeof(struct 
utsname))) {
+       if (!readmem(info, sym_system_utsname, &system_utsname,
+           sizeof(struct utsname))) {
                ERRMSG("Can't get the address of system_utsname.\n");
                return FALSE;
        }
 
        if (info->flag_read_config) {
                if (strcmp(system_utsname.release, info->release)) {
-                       ERRMSG("%s doesn't suit the dump_mem.\n", 
info->name_configfile);
+                       ERRMSG("%s doesn't suit the dump_mem.\n",
+                           info->name_configfile);
                        retcd = WRONG_RELEASE;
                        return FALSE;
                }
@@ -323,7 +325,7 @@ open_config_file(struct DumpInfo *info, 
 
        if ((file_configfile = fopen(info->name_configfile, mode)) == NULL) {
                ERRMSG("Can't open the config file(%s). %s\n",
-               info->name_configfile, strerror(errno));
+                   info->name_configfile, strerror(errno));
                return FALSE;
        }
        info->file_configfile = file_configfile;
@@ -557,9 +559,8 @@ get_elf_info(struct DumpInfo *info)
         *   If the page_size of 1st-kernel is different from the one of
         *   capture(2nd)-kernel, the problem will happen.
         */
-       if (!info->page_size) {
-               info->page_size = sysconf(_SC_PAGE_SIZE);
-       }
+       info->page_size = sysconf(_SC_PAGE_SIZE);
+
        info->max_mapnr = get_max_mapnr(info);
        tmp = 2*divideup(info->max_mapnr, BITPERBYTE);
        tmp = divideup(tmp, info->page_size);
@@ -670,29 +671,29 @@ is_kvaddr(unsigned long addr)
        return (addr >= (unsigned long)(KVBASE));
 }
 
-static int process_attribute(Dwarf_Attribute *attr, void *cb_data)
+static int
+process_attribute(Dwarf_Attribute *attr, void *cb_data)
 {
        struct dwarf_values *args = cb_data;
+       Dwarf_Op *expr;
+       size_t expcnt;
 
        switch (attr->code) {
-               case DW_AT_data_member_location: {
-                       Dwarf_Op *expr;
-                       size_t expcnt;
-
-                       dwarf_getlocation (attr, &expr, &expcnt);
-                       if (dwarf_info.member_offset == NOT_FOUND_STRUCTURE)
-                               dwarf_info.member_offset = expr[0].number;
-                       *args->found_map |= DWARF_INFO_FOUND_LOCATION;
-                       break;
-               }
-               default:
-                       break;
+       case DW_AT_data_member_location:
+               dwarf_getlocation (attr, &expr, &expcnt);
+               if (dwarf_info.member_offset == NOT_FOUND_STRUCTURE)
+                       dwarf_info.member_offset = expr[0].number;
+               *args->found_map |= DWARF_INFO_FOUND_LOCATION;
+               break;
+       default:
+               break;
        }
 
        return 0;
 }
 
-static int process_children(Dwarf_Die *die, uint32_t *found_map)
+static int
+process_children(Dwarf_Die *die, uint32_t *found_map)
 {
        Dwarf_Die child;
        Dwarf_Die *walker;
@@ -705,26 +706,26 @@ static int process_children(Dwarf_Die *d
        
        while (rc == 0) {
                name = dwarf_diename(walker);
-               if (dwarf_info.cmd == DWARF_INFO_GET_MEMBER_OFFSET &&
-                       (dwarf_tag(walker) == DW_TAG_member) &&
-                       (name) && (!strcmp(name, dwarf_info.member_name))) {
+               if ((dwarf_info.cmd == DWARF_INFO_GET_MEMBER_OFFSET)
+                   && (dwarf_tag(walker) == DW_TAG_member)
+                   && (name) && (!strcmp(name, dwarf_info.member_name))) {
                        /*
                         * get the attirbutes of this die to record the
-                        *location of the symbol
+                        * location of the symbol
                         */
                        *found_map |= DWARF_INFO_FOUND_MEMBER;
                }
-               if (dwarf_info.cmd == DWARF_INFO_GET_NOT_NAMED_UNION_OFFSET &&
-                       (dwarf_tag(walker) == DW_TAG_member) &&
-                       (!name)) {
+               if ((dwarf_info.cmd == DWARF_INFO_GET_NOT_NAMED_UNION_OFFSET)
+                   && (dwarf_tag(walker) == DW_TAG_member)
+                   && (!name)) {
                        *found_map |= DWARF_INFO_FOUND_MEMBER;
                }
                if (*found_map & DWARF_INFO_FOUND_MEMBER) {
                        args.die = walker;
                        args.found_map = found_map;
                        dwarf_getattrs(walker, process_attribute, &args, 0);
-                       if ((*found_map & DWARF_INFO_FOUND_ALL) ==
-                               DWARF_INFO_FOUND_ALL)
+                       if ((*found_map & DWARF_INFO_FOUND_ALL)
+                           == DWARF_INFO_FOUND_ALL)
                                return TRUE;
                }
 
@@ -738,7 +739,8 @@ static int process_children(Dwarf_Die *d
        return TRUE;
 }
 
-static void search_die_tree(Dwarf *dwarfd, Dwarf_Die *die, uint32_t *found_map)
+static void
+search_die_tree(Dwarf *dwarfd, Dwarf_Die *die, uint32_t *found_map)
 {
        Dwarf_Die child; 
        int tag;
@@ -761,8 +763,8 @@ static void search_die_tree(Dwarf *dwarf
 next_tag:
        tag = dwarf_tag(die);
        name = dwarf_diename(die);
-       if ((tag == DW_TAG_structure_type) &&
-          (name) && (!strcmp(name, dwarf_info.struct_name))) {
+       if ((tag == DW_TAG_structure_type)
+           && (name) && (!strcmp(name, dwarf_info.struct_name))) {
                /*
                 * this is our structure
                 * process the children
@@ -833,7 +835,7 @@ get_debug_info(void)
                        continue;
 
                while (dwarf_nextcu(dwarfd, off, &next_off, &header_size,
-                                  &abbrev_offset, &address_size, &offset_size) 
== 0) {
+                   &abbrev_offset, &address_size, &offset_size) == 0) {
                        off += header_size;
                        if (dwarf_offdie(dwarfd, off, &cu_die) == NULL)
                                goto out_close_dwarf;
@@ -920,8 +922,7 @@ get_structure_info(struct DumpInfo *info
         * Get offsets of the pglist_data's members.
         */
        SIZE_INIT(pglist_data, "pglist_data");
-       OFFSET_INIT(pglist_data.node_zones, "pglist_data",
-           "node_zones");
+       OFFSET_INIT(pglist_data.node_zones, "pglist_data", "node_zones");
 
        /*
         * Get offsets of the zone's members.
@@ -1752,7 +1753,9 @@ unsigned long
 next_online_pgdat(struct DumpInfo *info, int node)
 {
        unsigned long pgdat;
-       /* node_data must be an array. */
+       /*
+        * node_data must be an array.
+        */
        if (SYMBOL(node_data) == NOT_FOUND_SYMBOL)
                goto pgdat2;
        if (!readmem(info, SYMBOL(node_data) + (node * sizeof(void *)),
@@ -1765,7 +1768,9 @@ next_online_pgdat(struct DumpInfo *info,
        return pgdat;
 
 pgdat2:
-       /* pgdat_list must be an array. */
+       /*
+        * pgdat_list must be an array.
+        */
        if (SYMBOL(pgdat_list) == NOT_FOUND_SYMBOL)
                goto pgdat3;
        if (!readmem(info, SYMBOL(pgdat_list) + (node * sizeof(void *)),
@@ -1845,11 +1850,8 @@ reset_bitmap_of_free_pages(struct DumpIn
                pfn, free_pages;
 
        for (order = MAX_ORDER - 1; order >= 0; --order) {
-               /* head = &zone->free_area[order].free_list; */
                head = node_zones + OFFSET(zone.free_area)
                        + SIZE(free_area) * order + OFFSET(free_area.free_list);
-               /* for (previous = head, curr = head->next;
-                   curr != head; previous=curr, curr = curr->next) { */
                previous = head;
                if (!readmem(info, head + OFFSET(list_head.next), &curr,
                    sizeof curr)) {
@@ -1857,13 +1859,11 @@ reset_bitmap_of_free_pages(struct DumpIn
                        return FALSE;
                }
                for (;curr != head;) {
-                       /* start_pfn = page_to_pfn(list_entry(curr, struct 
page, lru)); */
                        curr_page = curr - OFFSET(page.lru);
                        start_pfn = page_to_pfn(info, curr_page);
                        if (start_pfn == ULONG_MAX)
                                return FALSE;
 
-                       /* if (previous != curr->prev) */
                        if (!readmem(info, curr + OFFSET(list_head.prev),
                            &curr_prev, sizeof curr_prev)) {
                                ERRMSG("Can't get prev list_head.\n");
@@ -1910,7 +1910,10 @@ dump_memory_nodes(struct DumpInfo *info)
        unsigned long   node_zones, spanned_pages, pgdat;
 
        vt->nr_zones = MAX_NR_ZONES;
-       /* In case that (vt->flags & NODES_ONLINE) is 1. */
+
+       /*
+        * In case that (vt->flags & NODES_ONLINE) is 1.
+        */
        if ((node = next_online_node(0)) < 0) {
                ERRMSG("Can't get next online node.\n");
                return FALSE;
@@ -1964,7 +1967,6 @@ dump_memory_nodes(struct DumpInfo *info)
 int
 _exclude_free_page(struct DumpInfo *info)
 {
-       /* vt->flags |= ZONES; */
        if ((vt->numnodes = get_nodes_online(info))) {
                vt->flags |= NODES_ONLINE;
        } else {
@@ -3150,8 +3152,7 @@ main(int argc, char *argv[])
                        goto out;
                }
                if ((argc != optind + 2)
-                   || ((info->flag_compress == 1)
-                   && (info->flag_elf_dumpfile == 1))
+                   || (info->flag_compress && info->flag_elf_dumpfile)
                    || info->flag_vmlinux) {
                        ERRMSG("Commandline parameter is invalid.\n");
                        print_usage();
_
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to