Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fdisk staticfy. __dead.



details:   https://anonhg.NetBSD.org/src/rev/f9921fb8b5fc
branches:  trunk
changeset: 768801:f9921fb8b5fc
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Aug 27 17:16:01 2011 +0000

description:
staticfy. __dead.

diffstat:

 sbin/fdisk/fdisk.c |  230 ++++++++++++++++++++++++++--------------------------
 1 files changed, 115 insertions(+), 115 deletions(-)

diffs (truncated from 565 to 300 lines):

diff -r f21e7013eaaf -r f9921fb8b5fc sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Sat Aug 27 17:10:05 2011 +0000
+++ b/sbin/fdisk/fdisk.c        Sat Aug 27 17:16:01 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdisk.c,v 1.131 2011/05/08 14:22:16 pgoyette Exp $ */
+/*     $NetBSD: fdisk.c,v 1.132 2011/08/27 17:16:01 joerg Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.131 2011/05/08 14:22:16 pgoyette Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.132 2011/08/27 17:16:01 joerg Exp $");
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -140,14 +140,14 @@
 #define LBUF 100
 static char lbuf[LBUF];
 
-const char *disk = _PATH_DEFDISK;
+static const char *disk = _PATH_DEFDISK;
 
-struct disklabel disklabel;            /* disk parameters */
+static struct disklabel disklabel;             /* disk parameters */
 
-struct mbr_sector mboot;
+static struct mbr_sector mboot;
 
-const char *boot_dir = DEFAULT_BOOTDIR;
-char *boot_path = 0;                   /* name of file we actually opened */
+static const char *boot_dir = DEFAULT_BOOTDIR;
+static char *boot_path = NULL;                 /* name of file we actually opened */
 
 #ifdef BOOTSEL
 #define BOOTSEL_OPTIONS        "B"
@@ -191,15 +191,15 @@
  */
 
 /* Disks reported geometry and overall size from device driver */
-unsigned int cylinders, sectors, heads;
-daddr_t disksectors;
+static unsigned int cylinders, sectors, heads;
+static daddr_t disksectors;
 #define cylindersectors (heads * sectors)
 
 /* Geometry from the BIOS */
-unsigned int dos_cylinders;
-unsigned int dos_heads;
-unsigned int dos_sectors;
-daddr_t dos_disksectors;
+static unsigned int dos_cylinders;
+static unsigned int dos_heads;
+static unsigned int dos_sectors;
+static daddr_t dos_disksectors;
 #define dos_cylindersectors (dos_heads * dos_sectors)
 #define dos_totalsectors (dos_heads * dos_sectors * dos_cylinders)
 
@@ -212,96 +212,96 @@
 #define MAXCYL         1024    /* Usual limit is 1023 */
 #define        MAXHEAD         256     /* Usual limit is 255 */
 #define        MAXSECTOR       63
-int partition = -1;
+static int partition = -1;
 
 /* Alignment of partition, and offset if first sector unusable */
-unsigned int ptn_alignment;    /* default dos_cylindersectors */
-unsigned int ptn_0_offset;     /* default dos_sectors */
+static unsigned int ptn_alignment;     /* default dos_cylindersectors */
+static unsigned int ptn_0_offset;      /* default dos_sectors */
 
-int fd = -1, wfd = -1, *rfd = &fd;
-char *disk_file = NULL;
-char *disk_type = NULL;
+static int fd = -1, wfd = -1, *rfd = &fd;
+static char *disk_file = NULL;
+static char *disk_type = NULL;
 
-int a_flag;            /* set active partition */
-int i_flag;            /* init bootcode */
-int u_flag;            /* update partition data */
-int v_flag;            /* more verbose */
-int sh_flag;           /* Output data as shell defines */
-int f_flag;            /* force --not interactive */
-int s_flag;            /* set id,offset,size */
-int b_flag;            /* Set cyl, heads, secs (as c/h/s) */
-int B_flag;            /* Edit/install bootselect code */
-int E_flag;            /* extended partition number */
-int b_cyl, b_head, b_sec;  /* b_flag values. */
+static int a_flag;             /* set active partition */
+static int i_flag;             /* init bootcode */
+static int u_flag;             /* update partition data */
+static int v_flag;             /* more verbose */
+static int sh_flag;            /* Output data as shell defines */
+static int f_flag;             /* force --not interactive */
+static int s_flag;             /* set id,offset,size */
+static int b_flag;             /* Set cyl, heads, secs (as c/h/s) */
+static int B_flag;             /* Edit/install bootselect code */
+static int E_flag;             /* extended partition number */
+static int b_cyl, b_head, b_sec;  /* b_flag values. */
 
 #if !HAVE_NBTOOL_CONFIG_H
-int F_flag = 0;
+static int F_flag = 0;
 #else
 /* Tool - force 'file' mode to avoid unsupported functions and ioctls */
-int F_flag = 1;
+static int F_flag = 1;
 #endif
 
-struct gpt_hdr gpt1, gpt2;     /* GUID partition tables */
+static struct gpt_hdr gpt1, gpt2;      /* GUID partition tables */
 
-struct mbr_sector bootcode[8192 / sizeof (struct mbr_sector)];
-int bootsize;          /* actual size of bootcode */
-int boot_installed;    /* 1 if we've copied code into the mbr */
+static struct mbr_sector bootcode[8192 / sizeof (struct mbr_sector)];
+static int bootsize;           /* actual size of bootcode */
+static int boot_installed;     /* 1 if we've copied code into the mbr */
 
 #if (defined(__i386__) || defined(__x86_64__)) && !HAVE_NBTOOL_CONFIG_H
 #define USE_DISKLIST
-struct disklist *dl;
+static struct disklist *dl;
 #endif
 
 
 #define KNOWN_SYSIDS   (sizeof(mbr_ptypes)/sizeof(mbr_ptypes[0]))
 
-void   usage(void);
-void   print_s0(int);
-void   print_part(struct mbr_sector *, int, daddr_t);
-void   print_mbr_partition(struct mbr_sector *, int, daddr_t, daddr_t, int);
-void   print_pbr(daddr_t, int, uint8_t);
-int    is_all_zero(const unsigned char *, size_t);
-void   printvis(int, const char *, const char *, size_t);
-int    read_boot(const char *, void *, size_t, int);
-void   init_sector0(int);
-void   intuit_translated_geometry(void);
-void   get_bios_geometry(void);
-void   get_extended_ptn(void);
-static void get_ptn_alignmemt(void);
+__dead static void     usage(void);
+static void    print_s0(int);
+static void    print_part(struct mbr_sector *, int, daddr_t);
+static void    print_mbr_partition(struct mbr_sector *, int, daddr_t, daddr_t, int);
+static void    print_pbr(daddr_t, int, uint8_t);
+static int     is_all_zero(const unsigned char *, size_t);
+static void    printvis(int, const char *, const char *, size_t);
+static int     read_boot(const char *, void *, size_t, int);
+static void    init_sector0(int);
+static void    intuit_translated_geometry(void);
+static void    get_bios_geometry(void);
+static void    get_extended_ptn(void);
+static static void get_ptn_alignmemt(void);
 #if defined(USE_DISKLIST)
-void   get_diskname(const char *, char *, size_t);
+static void    get_diskname(const char *, char *, size_t);
 #endif
-int    change_part(int, int, int, daddr_t, daddr_t, char *);
-void   print_geometry(void);
-int    first_active(void);
-void   change_active(int);
-void   change_bios_geometry(void);
-void   dos(int, unsigned char *, unsigned char *, unsigned char *);
-int    open_disk(int);
-int    read_disk(daddr_t, void *);
-int    write_disk(daddr_t, void *);
-int    get_params(void);
-int    read_s0(daddr_t, struct mbr_sector *);
-int    write_mbr(void);
-int    read_gpt(daddr_t, struct gpt_hdr *);
-int    delete_gpt(struct gpt_hdr *);
-int    yesno(const char *, ...);
-int64_t        decimal(const char *, int64_t, int, int64_t, int64_t);
+static int     change_part(int, int, int, daddr_t, daddr_t, char *);
+static void    print_geometry(void);
+static int     first_active(void);
+static void    change_active(int);
+static void    change_bios_geometry(void);
+static void    dos(int, unsigned char *, unsigned char *, unsigned char *);
+static int     open_disk(int);
+static int     read_disk(daddr_t, void *);
+static int     write_disk(daddr_t, void *);
+static int     get_params(void);
+static int     read_s0(daddr_t, struct mbr_sector *);
+static int     write_mbr(void);
+static int     read_gpt(daddr_t, struct gpt_hdr *);
+static int     delete_gpt(struct gpt_hdr *);
+static int     yesno(const char *, ...);
+static int64_t decimal(const char *, int64_t, int, int64_t, int64_t);
 #define DEC_SEC                1               /* asking for a sector number */
 #define        DEC_RND         2               /* round to end of first track */
 #define        DEC_RND_0       4               /* convert 0 to size of a track */
 #define DEC_RND_DOWN   8               /* subtract 1 track */
 #define DEC_RND_DOWN_2 16              /* subtract 2 tracks */
-void   string(const char *, int, char *);
-int    ptn_id(const char *, int *);
-int    type_match(const void *, const void *);
-const char *get_type(int);
-int    get_mapping(int, unsigned int *, unsigned int *, unsigned int *, unsigned long *);
+static void    string(const char *, int, char *);
+static int     ptn_id(const char *, int *);
+static int     type_match(const void *, const void *);
+static const char *get_type(int);
+static int     get_mapping(int, unsigned int *, unsigned int *, unsigned int *, unsigned long *);
 #ifdef BOOTSEL
-daddr_t        configure_bootsel(daddr_t);
-void   install_bootsel(int);
-daddr_t        get_default_boot(void);
-void   set_default_boot(daddr_t);
+static daddr_t configure_bootsel(daddr_t);
+static void    install_bootsel(int);
+static daddr_t get_default_boot(void);
+static void    set_default_boot(daddr_t);
 #endif
 
 static void
@@ -595,7 +595,7 @@
        exit(0);
 }
 
-void
+static void
 usage(void)
 {
        int indent = 7 + (int)strlen(getprogname()) + 1;
@@ -632,7 +632,7 @@
        return offset;
 }
 
-void
+static void
 print_s0(int which)
 {
        int part;
@@ -708,7 +708,7 @@
        }
 }
 
-void
+static void
 print_part(struct mbr_sector *boot, int part, daddr_t offset)
 {
        struct mbr_partition *partp;
@@ -768,7 +768,7 @@
        printf("/%lu/%lu", head, sect + 1);
 }
 
-void
+static void
 print_mbr_partition(struct mbr_sector *boot, int part,
     daddr_t offset, daddr_t exoffset, int indent)
 {
@@ -868,7 +868,7 @@
 }
 
 /* Print a line with a label and a vis-encoded string */
-void
+static void
 printvis(int indent, const char *label, const char *buf, size_t size)
 {
        char *visbuf;
@@ -883,7 +883,7 @@
 }
 
 /* Check whether a buffer contains all bytes zero */
-int
+static int
 is_all_zero(const unsigned char *p, size_t size)
 {
 
@@ -910,7 +910,7 @@
  * two bytes is a layering violation, but it can be very useful in
  * diagnosing boot failures.
  */
-void
+static void
 print_pbr(daddr_t sector, int indent, uint8_t part_type)
 {
        struct mbr_sector pboot;
@@ -991,7 +991,7 @@
 #undef PBR_ERROR
 }
 
-int
+static int
 read_boot(const char *name, void *buf, size_t len, int err_exit)
 {
        int bfd, ret;
@@ -1045,7 +1045,7 @@
        return 0;
 }
 
-void
+static void
 init_sector0(int zappart)
 {



Home | Main Index | Thread Index | Old Index