Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/eeprom Finish ANSIfication. Drop extra spaces from ...



details:   https://anonhg.NetBSD.org/src/rev/a6c27218112c
branches:  trunk
changeset: 787768:a6c27218112c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Jul 02 11:59:46 2013 +0000

description:
Finish ANSIfication. Drop extra spaces from __P removal. Add more
static. Add more const. Use __dead for usage().

diffstat:

 usr.sbin/eeprom/defs.h         |   50 ++++++---------
 usr.sbin/eeprom/eehandlers.c   |  128 +++++++++++++++++-----------------------
 usr.sbin/eeprom/main.c         |   24 +++----
 usr.sbin/eeprom/ofhandlers.c   |   37 ++++-------
 usr.sbin/eeprom/ophandlers.c   |   25 +++----
 usr.sbin/eeprom/prephandlers.c |   12 +-
 6 files changed, 113 insertions(+), 163 deletions(-)

diffs (truncated from 697 to 300 lines):

diff -r b43df8afd4e7 -r a6c27218112c usr.sbin/eeprom/defs.h
--- a/usr.sbin/eeprom/defs.h    Tue Jul 02 09:35:48 2013 +0000
+++ b/usr.sbin/eeprom/defs.h    Tue Jul 02 11:59:46 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.14 2013/03/15 20:22:44 nakayama Exp $       */
+/*     $NetBSD: defs.h,v 1.15 2013/07/02 11:59:46 joerg Exp $  */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 struct keytabent {
        const char *kt_keyword;         /* keyword for this entry */
        u_int   kt_offset;              /* offset into prom of value */
-       void    (*kt_handler) (struct keytabent *, char *);
+       void    (*kt_handler) (const struct keytabent *, char *);
                                        /* handler function for this entry */
 };
 
@@ -84,7 +84,7 @@
  */
 struct extabent {
        const char *ex_keyword;         /* keyword for this entry */
-       void    (*ex_handler) (struct extabent *,
+       void    (*ex_handler) (const struct extabent *,
                    struct opiocdesc *, char *);
                                        /* handler function for this entry */
 };
@@ -93,7 +93,7 @@
 #ifdef USE_OPENFIRM
 struct extabent {
        const char *ex_keyword;         /* keyword for this entry */
-       void    (*ex_handler) (struct extabent *,
+       void    (*ex_handler) (const struct extabent *,
                    struct ofiocdesc *, char *);
                                        /* handler function for this entry */
 };
@@ -102,7 +102,7 @@
 #ifdef USE_PREPNVRAM
 struct extabent {
        const char *ex_keyword;         /* keyword for this entry */
-       void    (*ex_handler) (struct extabent *,
+       void    (*ex_handler) (const struct extabent *,
                    struct pnviocdesc *, char *);
                                        /* handler function for this entry */
 };
@@ -110,37 +110,25 @@
 
 
 /* Sun 3/4 EEPROM handlers. */
-void   ee_action (char *, char *);
-void   ee_dump (void);
-void   ee_hwupdate (struct keytabent *, char *);
-void   ee_num8 (struct keytabent *, char *);
-void   ee_num16 (struct keytabent *, char *);
-void   ee_screensize (struct keytabent *, char *);
-void   ee_truefalse (struct keytabent *, char *);
-void   ee_bootdev (struct keytabent *, char *);
-void   ee_kbdtype (struct keytabent *, char *);
-void   ee_constype (struct keytabent *, char *);
-void   ee_diagpath (struct keytabent *, char *);
-void   ee_banner (struct keytabent *, char *);
-void   ee_notsupp (struct keytabent *, char *);
+void   ee_action(char *, char *);
+void   ee_dump(void);
 
 /* Sun 3/4 EEPROM checksum routines. */
-u_char ee_checksum (u_char *, size_t);
-void   ee_updatechecksums (void);
-void   ee_verifychecksums (void);
+void   ee_updatechecksums(void);
+void   ee_verifychecksums(void);
 
 /* Sparc Openprom handlers. */
-char   *op_handler (char *, char *);
-void   op_action (char *, char *);
-void   op_dump (void);
-int    check_for_openprom (void);
+char   *op_handler(char *, char *);
+void   op_action(char *, char *);
+void   op_dump(void);
+int    check_for_openprom(void);
 
 /* OpenFirmware handlers. */
-char   *of_handler (char *, char *);
-void   of_action (char *, char *);
-void   of_dump (void);
+char   *of_handler(char *, char *);
+void   of_action(char *, char *);
+void   of_dump(void);
 
 /* PReP nvram handlers. */
-char   *prep_handler (char *, char *);
-void   prep_action (char *, char *);
-void   prep_dump (void);
+char   *prep_handler(char *, char *);
+void   prep_action(char *, char *);
+void   prep_dump(void);
diff -r b43df8afd4e7 -r a6c27218112c usr.sbin/eeprom/eehandlers.c
--- a/usr.sbin/eeprom/eehandlers.c      Tue Jul 02 09:35:48 2013 +0000
+++ b/usr.sbin/eeprom/eehandlers.c      Tue Jul 02 11:59:46 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eehandlers.c,v 1.17 2013/03/15 20:22:44 nakayama Exp $ */
+/*     $NetBSD: eehandlers.c,v 1.18 2013/07/02 11:59:46 joerg Exp $    */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -56,10 +56,23 @@
 
 static char err_str[BUFSIZE];
 
-static void badval (struct keytabent *, char *);
-static int doio (struct keytabent *, u_char *, ssize_t, int);
+static void badval(const struct keytabent *, char *);
+static int doio(const struct keytabent *, u_char *, ssize_t, int);
 
-struct keytabent eekeytab[] = {
+static u_char ee_checksum(u_char *, size_t);
+static void ee_hwupdate(const struct keytabent *, char *);
+static void ee_num8(const struct keytabent *, char *);
+static void ee_num16(const struct keytabent *, char *);
+static void ee_screensize(const struct keytabent *, char *);
+static void ee_truefalse(const struct keytabent *, char *);
+static void ee_bootdev(const struct keytabent *, char *);
+static void ee_kbdtype(const struct keytabent *, char *);
+static void ee_constype(const struct keytabent *, char *);
+static void ee_diagpath(const struct keytabent *, char *);
+static void ee_banner(const struct keytabent *, char *);
+static void ee_notsupp(const struct keytabent *, char *);
+
+static const struct    keytabent eekeytab[] = {
        { "hwupdate",           0x10,   ee_hwupdate },
        { "memsize",            0x14,   ee_num8 },
        { "memtest",            0x15,   ee_num8 },
@@ -108,10 +121,9 @@
 }
 
 void
-ee_action(keyword, arg)
-       char *keyword, *arg;
+ee_action(char *keyword, char *arg)
 {
-       struct keytabent *ktent;
+       const struct keytabent *ktent;
 
        for (ktent = eekeytab; ktent->kt_keyword != NULL; ++ktent) {
                if (strcmp(ktent->kt_keyword, keyword) == 0) {
@@ -125,18 +137,16 @@
 }
 
 void
-ee_dump()
+ee_dump(void)
 {
-       struct keytabent *ktent;
+       const struct keytabent *ktent;
 
        for (ktent = eekeytab; ktent->kt_keyword != NULL; ++ktent)
                (*ktent->kt_handler)(ktent, NULL);
 }
 
-void
-ee_hwupdate(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_hwupdate(const struct keytabent *ktent, char *arg)
 {
        uint32_t hwtime;
        time_t t;
@@ -175,10 +185,8 @@
        printf("\n");
 }
 
-void
-ee_num8(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_num8(const struct keytabent *ktent, char *arg)
 {
        u_char num8 = 0;
        u_int num32;
@@ -201,10 +209,8 @@
        printf("%s=%d\n", ktent->kt_keyword, num8);
 }
 
-void
-ee_num16(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_num16(const struct keytabent *ktent, char *arg)
 {
        u_int16_t num16 = 0;
        u_int num32;
@@ -227,7 +233,7 @@
        printf("%s=%d\n", ktent->kt_keyword, num16);
 }
 
-static struct strvaltabent scrsizetab[] = {
+static const struct strvaltabent scrsizetab[] = {
        { "1152x900",           EE_SCR_1152X900 },
        { "1024x1024",          EE_SCR_1024X1024 },
        { "1600x1280",          EE_SCR_1600X1280 },
@@ -235,12 +241,10 @@
        { NULL,                 0 },
 };
 
-void
-ee_screensize(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_screensize(const struct keytabent *ktent, char *arg)
 {
-       struct strvaltabent *svp;
+       const struct strvaltabent *svp;
        u_char scsize;
 
        if (arg) {
@@ -269,18 +273,16 @@
        printf("%s=%s\n", ktent->kt_keyword, svp->sv_str);
 }
 
-static struct strvaltabent truthtab[] = {
+static const struct strvaltabent truthtab[] = {
        { "true",               EE_TRUE },
        { "false",              EE_FALSE },
        { NULL,                 0 },
 };
 
-void
-ee_truefalse(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_truefalse(const struct keytabent *ktent, char *arg)
 {
-       struct strvaltabent *svp;
+       const struct strvaltabent *svp;
        u_char truth;
 
        if (arg) {
@@ -309,10 +311,8 @@
        printf("%s=%s\n", ktent->kt_keyword, svp->sv_str);
 }
 
-void
-ee_bootdev(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_bootdev(const struct keytabent *ktent, char *arg)
 {
        u_char dev[5];
        int i;
@@ -381,10 +381,8 @@
             dev[1], dev[2], dev[3], dev[4]);
 }
 
-void
-ee_kbdtype(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_kbdtype(const struct keytabent *ktent, char *arg)
 {
        u_char kbd = 0;
        u_int kbd2;
@@ -407,7 +405,7 @@
        printf("%s=%d (%s)\n", ktent->kt_keyword, kbd, kbd ? "other" : "Sun");
 }
 
-static struct strvaltabent constab[] = {
+static const struct strvaltabent constab[] = {
        { "b&w",                EE_CONS_BW },
        { "ttya",               EE_CONS_TTYA },
        { "ttyb",               EE_CONS_TTYB },
@@ -416,12 +414,10 @@
        { NULL,                 0 },
 };
 
-void
-ee_constype(ktent, arg)
-       struct keytabent *ktent;
-       char *arg;
+static void
+ee_constype(const struct keytabent *ktent, char *arg)
 {
-       struct strvaltabent *svp;
+       const struct strvaltabent *svp;
        u_char cons;
 
        if (arg) {
@@ -451,10 +447,8 @@
                
 }
 
-void
-ee_diagpath(ktent, arg)



Home | Main Index | Thread Index | Old Index