Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/perfused Fast backward code to 1989 and use ANSI C ...



details:   https://anonhg.NetBSD.org/src/rev/eb0e2b0ebde9
branches:  trunk
changeset: 769056:eb0e2b0ebde9
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Aug 30 20:17:00 2011 +0000

description:
Fast backward code to 1989 and use ANSI C consistently. Use __dead.

diffstat:

 usr.sbin/perfused/debug.c    |   6 +--
 usr.sbin/perfused/msg.c      |  84 ++++++++++++-------------------------------
 usr.sbin/perfused/perfused.c |  31 ++++------------
 usr.sbin/perfused/perfused.h |   6 +-
 4 files changed, 36 insertions(+), 91 deletions(-)

diffs (truncated from 340 to 300 lines):

diff -r 85b8a8db2a45 -r eb0e2b0ebde9 usr.sbin/perfused/debug.c
--- a/usr.sbin/perfused/debug.c Tue Aug 30 20:08:38 2011 +0000
+++ b/usr.sbin/perfused/debug.c Tue Aug 30 20:17:00 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: debug.c,v 1.3 2010/09/15 01:51:44 manu Exp $ */
+/*  $NetBSD: debug.c,v 1.4 2011/08/30 20:17:00 joerg Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -35,9 +35,7 @@
 
 #ifdef PERFUSE_DEBUG
 void
-perfuse_hexdump(addr, len)
-       char *addr;
-       size_t len;
+perfuse_hexdump(const char *addr, size_t len)
 {
        unsigned int i, j, k;
 
diff -r 85b8a8db2a45 -r eb0e2b0ebde9 usr.sbin/perfused/msg.c
--- a/usr.sbin/perfused/msg.c   Tue Aug 30 20:08:38 2011 +0000
+++ b/usr.sbin/perfused/msg.c   Tue Aug 30 20:17:00 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: msg.c,v 1.15 2011/08/09 07:00:13 manu Exp $ */
+/*  $NetBSD: msg.c,v 1.16 2011/08/30 20:17:01 joerg Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -111,10 +111,7 @@
 
 
 void *
-perfuse_recv_early(fd, sockcred, sockcred_len)
-       int fd;
-       struct sockcred *sockcred;
-       size_t sockcred_len;
+perfuse_recv_early(int fd, struct sockcred *sockcred, size_t sockcred_len)
 {
        struct fuse_out_header foh;
        size_t len;
@@ -169,12 +166,8 @@
 
 
 perfuse_msg_t *
-perfuse_new_pb (pu, opc, opcode, payload_len, cred)
-       struct puffs_usermount *pu;
-       puffs_cookie_t opc;
-       int opcode;
-       size_t payload_len;
-       const struct puffs_cred *cred;
+perfuse_new_pb (struct puffs_usermount *pu, puffs_cookie_t opc, int opcode,
+    size_t payload_len, const struct puffs_cred *cred)
 {
        struct puffs_framebuf *pb;
        struct fuse_in_header *fih;
@@ -236,11 +229,8 @@
  * This xchg_pb_inloop() variant allow early communication.
  */
 static int
-xchg_pb_early(pu, pb, fd, reply)
-       struct puffs_usermount *pu;
-       struct puffs_framebuf *pb;
-       int fd;
-       enum perfuse_xchg_pb_reply reply;
+xchg_pb_early(struct puffs_usermount *pu, struct puffs_framebuf *pb, int fd,
+    enum perfuse_xchg_pb_reply reply)
 {
        int done;
        int error;
@@ -268,11 +258,8 @@
 }
 
 static int
-xchg_pb_inloop(pu, pb, fd, reply)
-       struct puffs_usermount *pu;
-       struct puffs_framebuf *pb;
-       int fd;
-       enum perfuse_xchg_pb_reply reply;
+xchg_pb_inloop(struct puffs_usermount *pu, struct puffs_framebuf *pb, int fd,
+    enum perfuse_xchg_pb_reply reply)
 {
        struct puffs_cc *pcc;
        int error;
@@ -288,11 +275,8 @@
 }
 
 int
-perfuse_xchg_pb(pu, pm, expected_len, reply)
-       struct puffs_usermount *pu;
-       perfuse_msg_t *pm;
-       size_t expected_len;
-       enum perfuse_xchg_pb_reply reply;
+perfuse_xchg_pb(struct puffs_usermount *pu, perfuse_msg_t *pm,
+    size_t expected_len, enum perfuse_xchg_pb_reply reply)
 {
        struct puffs_framebuf *pb = (struct puffs_framebuf *)(void *)pm;
        int fd;
@@ -378,8 +362,7 @@
 
 
 struct fuse_in_header *
-perfuse_get_inhdr(pm)
-       perfuse_msg_t *pm;
+perfuse_get_inhdr(perfuse_msg_t *pm)
 {
        struct puffs_framebuf *pb;
        struct fuse_in_header *fih;
@@ -399,8 +382,7 @@
 }
 
 struct fuse_out_header *
-perfuse_get_outhdr(pm)
-       perfuse_msg_t *pm;
+perfuse_get_outhdr(perfuse_msg_t *pm)
 {
        struct puffs_framebuf *pb;
        struct fuse_out_header *foh;
@@ -420,8 +402,7 @@
 }
 
 char *
-perfuse_get_inpayload(pm)
-       perfuse_msg_t *pm;
+perfuse_get_inpayload(perfuse_msg_t *pm)
 {
        struct puffs_framebuf *pb;
        struct fuse_in_header *fih;
@@ -448,8 +429,7 @@
 }
 
 char *
-perfuse_get_outpayload(pm)
-       perfuse_msg_t *pm;
+perfuse_get_outpayload(perfuse_msg_t *pm)
 {
        struct puffs_framebuf *pb;
        struct fuse_out_header *foh;
@@ -490,11 +470,8 @@
 
 /* ARGSUSED0 */
 int
-perfuse_readframe(pu, pufbuf, fd, done)
-       struct puffs_usermount *pu;
-       struct puffs_framebuf *pufbuf;
-       int fd;
-       int *done;
+perfuse_readframe(struct puffs_usermount *pu, struct puffs_framebuf *pufbuf,
+    int fd, int *done)
 {
        struct fuse_out_header foh;
        size_t len;
@@ -583,11 +560,8 @@
 
 /* ARGSUSED0 */
 int
-perfuse_writeframe(pu, pufbuf, fd, done)
-       struct puffs_usermount *pu;
-       struct puffs_framebuf *pufbuf;
-       int fd;
-       int *done;
+perfuse_writeframe(struct puffs_usermount *pu, struct puffs_framebuf *pufbuf,
+    int fd, int *done)
 {
        size_t len;
        ssize_t written;
@@ -632,11 +606,8 @@
 
 /* ARGSUSED0 */
 int
-perfuse_cmpframe(pu, pb1, pb2, match)
-       struct puffs_usermount *pu;
-       struct puffs_framebuf *pb1;
-       struct puffs_framebuf *pb2;
-       int *match;
+perfuse_cmpframe(struct puffs_usermount *pu, struct puffs_framebuf *pb1,
+    struct puffs_framebuf *pb2, int *match)
 {
        struct fuse_in_header *fih;
        struct fuse_out_header *foh;
@@ -657,9 +628,7 @@
 
 /* ARGSUSED0 */
 void
-perfuse_gotframe(pu, pb)
-       struct puffs_usermount *pu;
-       struct puffs_framebuf *pb;
+perfuse_gotframe(struct puffs_usermount *pu, struct puffs_framebuf *pb)
 {
        struct fuse_out_header *foh;
        size_t len;
@@ -677,10 +646,7 @@
 }
 
 void
-perfuse_fdnotify(pu, fd, what)
-       struct puffs_usermount *pu;
-       int fd;
-       int what;
+perfuse_fdnotify(struct puffs_usermount *pu, int fd, int what)
 {
        if (fd != (int)(long)perfuse_getspecific(pu))
                DERRX(EX_SOFTWARE, "%s: unexpected notification for fd = %d",
@@ -700,14 +666,10 @@
                DPRINTF("Exit");
        
        exit(0);
-       
-       /* NOTREACHED */
-       return;
 }
 
 void
-perfuse_umount(pu)
-       struct puffs_usermount *pu;
+perfuse_umount(struct puffs_usermount *pu)
 {
        int fd;
 
diff -r 85b8a8db2a45 -r eb0e2b0ebde9 usr.sbin/perfused/perfused.c
--- a/usr.sbin/perfused/perfused.c      Tue Aug 30 20:08:38 2011 +0000
+++ b/usr.sbin/perfused/perfused.c      Tue Aug 30 20:17:00 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfused.c,v 1.13 2011/05/30 14:50:08 manu Exp $ */
+/*  $NetBSD: perfused.c,v 1.14 2011/08/30 20:17:01 joerg Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -56,7 +56,6 @@
 static void siginfo_handler(int);
 static int parse_options(int, char **);
 static void get_mount_info(int, struct perfuse_mount_info *, int);
-int main(int, char **);
 
 /*
  * Flags for new_mount()
@@ -67,10 +66,7 @@
 
 
 static int
-access_mount(mnt, uid, ro)
-       const char *mnt;
-       uid_t uid;
-       int ro;
+access_mount(const char *mnt, uid_t uid, int ro)
 {
        struct stat st;
        mode_t mode;
@@ -95,10 +91,7 @@
 }
 
 static void
-get_mount_info(fd, pmi, sock_type)
-       int fd;
-       struct perfuse_mount_info *pmi;
-       int sock_type;
+get_mount_info(int fd, struct perfuse_mount_info *pmi, int sock_type)
 {
        struct perfuse_mount_out *pmo;
        struct sockcred cred;
@@ -199,9 +192,7 @@
 }
 
 static void
-new_mount(fd, pmnt_flags)
-       int fd;
-       int pmnt_flags;
+new_mount(int fd, int pmnt_flags)
 {
        struct puffs_usermount *pu;
        struct perfuse_mount_info pmi;
@@ -288,8 +279,7 @@
 }
 
 static int 
-parse_debug(optstr)
-       char *optstr;
+parse_debug(char *optstr)
 {
        int retval = PDF_SYSLOG;
        char *opt;
@@ -327,8 +317,7 @@
 
 /* ARGSUSED0 */
 static void
-siginfo_handler(sig)
-       int sig;
+siginfo_handler(int sig)
 {
        static int old_flags = 0;
        int swap;
@@ -343,9 +332,7 @@
 }
 
 static int
-parse_options(argc, argv)
-       int argc;
-       char **argv;
+parse_options(int argc, char **argv)
 {



Home | Main Index | Thread Index | Old Index