Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/util-linux/readprofile.c

    r902 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 *  readprofile.c - used to read /proc/profile
     
    45 *  Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it)
    56 *
    6  *   This program is free software; you can redistribute it and/or modify
    7  *   it under the terms of the GNU General Public License as published by
    8  *   the Free Software Foundation; either version 2 of the License, or
    9  *   (at your option) any later version.
    10  *
    11  *   This program is distributed in the hope that it will be useful,
    12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  *   GNU General Public License for more details.
    15  *
    16  *   You should have received a copy of the GNU General Public License
    17  *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
    198 */
    209
     
    4433 */
    4534
    46 #include <errno.h>
    47 #include <stdio.h>
    48 #include <fcntl.h>
    49 #include <stdlib.h>
    50 #include <unistd.h>
    51 #include <string.h>
    52 #include <sys/types.h>
    53 #include <sys/stat.h>
     35#include "libbb.h"
    5436#include <sys/utsname.h>
    5537
    56 #include "busybox.h"
    57 
    5838#define S_LEN 128
    5939
    6040/* These are the defaults */
    61 static const char defaultmap[]="/boot/System.map";
    62 static const char defaultpro[]="/proc/profile";
    63 
     41static const char defaultmap[] ALIGN1 = "/boot/System.map";
     42static const char defaultpro[] ALIGN1 = "/proc/profile";
     43
     44int readprofile_main(int argc, char **argv);
    6445int readprofile_main(int argc, char **argv)
    6546{
    6647    FILE *map;
    67     int proFd;
    68     const char *mapFile, *proFile, *mult=0;
    69     unsigned long len=0, indx=1;
    70     uint64_t add0=0;
     48    const char *mapFile, *proFile, *mult = 0;
     49    unsigned long indx = 1;
     50    size_t len;
     51    uint64_t add0 = 0;
    7152    unsigned int step;
    7253    unsigned int *buf, total, fn_len;
    73     unsigned long long fn_add, next_add;          /* current and next address */
     54    unsigned long long fn_add, next_add;     /* current and next address */
    7455    char fn_name[S_LEN], next_name[S_LEN];   /* current and next name */
     56    char mapline[S_LEN];
    7557    char mode[8];
    76     int c;
    77     int optAll=0, optInfo=0, optReset=0, optVerbose=0, optNative=0;
    78     int optBins=0, optSub=0;
    79     char mapline[S_LEN];
    80     int maplineno=1;
     58    int optAll = 0, optInfo = 0, optReset = 0;
     59    int optVerbose = 0, optNative = 0;
     60    int optBins = 0, optSub = 0;
     61    int maplineno = 1;
    8162    int header_printed;
    8263
     
    8667    mapFile = defaultmap;
    8768
    88     while ((c = getopt(argc, argv, "M:m:np:itvarVbs")) != -1) {
    89         switch(c) {
    90         case 'm':
    91             mapFile = optarg;
    92             break;
    93         case 'n':
    94             optNative++;
    95             break;
    96         case 'p':
    97             proFile = optarg;
    98             break;
    99         case 'a':
    100             optAll++;
    101             break;
    102         case 'b':
    103             optBins++;
    104             break;
    105         case 's':
    106             optSub++;
    107             break;
    108         case 'i':
    109             optInfo++;
    110             break;
    111         case 'M':
    112             mult = optarg;
    113             break;
    114         case 'r':
    115             optReset++;
    116             break;
    117         case 'v':
    118             optVerbose++;
    119             break;
    120         default:
    121             bb_show_usage();
    122         }
    123     }
     69    opt_complementary = "nn:aa:bb:ss:ii:rr:vv";
     70    getopt32(argv, "M:m:p:nabsirv",
     71            &mult, &mapFile, &proFile,
     72            &optNative, &optAll, &optBins, &optSub,
     73            &optInfo, &optReset, &optVerbose);
    12474
    12575    if (optReset || mult) {
     
    13181         */
    13282        if (mult) {
    133             multiplier = strtoul(mult, 0, 10);
     83            multiplier = xatoi_u(mult);
    13484            to_write = sizeof(int);
    13585        } else {
     
    13888        }
    13989
    140         fd = bb_xopen(defaultpro,O_WRONLY);
    141 
    142         if (write(fd, &multiplier, to_write) != to_write)
     90        fd = xopen(defaultpro, O_WRONLY);
     91
     92        if (full_write(fd, &multiplier, to_write) != to_write)
    14393            bb_perror_msg_and_die("error writing %s", defaultpro);
    14494
     
    150100     * Use an fd for the profiling buffer, to skip stdio overhead
    151101     */
    152 
    153     proFd = bb_xopen(proFile,O_RDONLY);
    154 
    155     if (((int)(len=lseek(proFd,0,SEEK_END)) < 0)
    156         || (lseek(proFd,0,SEEK_SET) < 0))
    157         bb_perror_msg_and_die(proFile);
    158 
    159     buf = xmalloc(len);
    160 
    161     if (read(proFd,buf,len) != len)
    162         bb_perror_msg_and_die(proFile);
    163 
    164     close(proFd);
    165 
     102    len = MAXINT(ssize_t);
     103    buf = xmalloc_open_read_close(proFile, &len);
    166104    if (!optNative) {
    167105        int entries = len/sizeof(*buf);
    168         int big = 0,small = 0,i;
     106        int big = 0, small = 0, i;
    169107        unsigned *p;
    170108
     
    176114        }
    177115        if (big > small) {
    178             bb_error_msg("Assuming reversed byte order. "
    179                 "Use -n to force native byte order.");
     116            bb_error_msg("assuming reversed byte order, "
     117                "use -n to force native byte order");
    180118            for (p = buf; p < buf+entries; p++)
    181119                for (i = 0; i < sizeof(*buf)/2; i++) {
     
    198136    total = 0;
    199137
    200     map = bb_xfopen(mapFile, "r");
    201 
    202     while (fgets(mapline,S_LEN,map)) {
    203         if (sscanf(mapline,"%llx %s %s",&fn_add,mode,fn_name) != 3)
     138    map = xfopen(mapFile, "r");
     139
     140    while (fgets(mapline, S_LEN, map)) {
     141        if (sscanf(mapline, "%llx %s %s", &fn_add, mode, fn_name) != 3)
    204142            bb_error_msg_and_die("%s(%i): wrong map line",
    205143                         mapFile, maplineno);
    206144
    207         if (!strcmp(fn_name,"_stext")) /* only elf works like this */ {
     145        if (!strcmp(fn_name, "_stext")) /* only elf works like this */ {
    208146            add0 = fn_add;
    209147            break;
     
    218156     * Main loop.
    219157     */
    220     while (fgets(mapline,S_LEN,map)) {
     158    while (fgets(mapline, S_LEN, map)) {
    221159        unsigned int this = 0;
    222160
    223         if (sscanf(mapline,"%llx %s %s",&next_add,mode,next_name) != 3)
     161        if (sscanf(mapline, "%llx %s %s", &next_add, mode, next_name) != 3)
    224162            bb_error_msg_and_die("%s(%i): wrong map line",
    225                          mapFile, maplineno);
     163                    mapFile, maplineno);
    226164
    227165        header_printed = 0;
     
    241179            if (optBins && (buf[indx] || optAll)) {
    242180                if (!header_printed) {
    243                     printf ("%s:\n", fn_name);
     181                    printf("%s:\n", fn_name);
    244182                    header_printed = 1;
    245183                }
    246                 printf ("\t%"PRIx64"\t%u\n", (indx - 1)*step + add0, buf[indx]);
     184                printf("\t%"PRIx64"\t%u\n", (indx - 1)*step + add0, buf[indx]);
    247185            }
    248186            this += buf[indx++];
     
    252190        if (optBins) {
    253191            if (optVerbose || this > 0)
    254                 printf ("  total\t\t\t\t%u\n", this);
     192                printf("  total\t\t\t\t%u\n", this);
    255193        } else if ((this || optAll) &&
    256194               (fn_len = next_add-fn_add) != 0) {
    257195            if (optVerbose)
    258196                printf("%016llx %-40s %6i %8.4f\n", fn_add,
    259                        fn_name,this,this/(double)fn_len);
     197                       fn_name, this, this/(double)fn_len);
    260198            else
    261199                printf("%6i %-40s %8.4f\n",
    262                        this,fn_name,this/(double)fn_len);
     200                       this, fn_name, this/(double)fn_len);
    263201            if (optSub) {
    264202                unsigned long long scan;
     
    277215
    278216        fn_add = next_add;
    279         strcpy(fn_name,next_name);
     217        strcpy(fn_name, next_name);
    280218
    281219        maplineno++;
     
    288226    if (optVerbose)
    289227        printf("%016x %-40s %6i %8.4f\n",
    290                0,"total",total,total/(double)(fn_add-add0));
     228               0, "total", total, total/(double)(fn_add-add0));
    291229    else
    292230        printf("%6i %-40s %8.4f\n",
    293                total,"total",total/(double)(fn_add-add0));
     231               total, "total", total/(double)(fn_add-add0));
    294232
    295233    fclose(map);
Note: See TracChangeset for help on using the changeset viewer.