Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/perfused remove dup function



details:   https://anonhg.NetBSD.org/src/rev/aa91f0b97074
branches:  trunk
changeset: 818594:aa91f0b97074
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 19 01:31:05 2016 +0000

description:
remove dup function

diffstat:

 usr.sbin/perfused/msg.c |  34 ++--------------------------------
 1 files changed, 2 insertions(+), 32 deletions(-)

diffs (60 lines):

diff -r f45cced5445a -r aa91f0b97074 usr.sbin/perfused/msg.c
--- a/usr.sbin/perfused/msg.c   Wed Oct 19 01:30:35 2016 +0000
+++ b/usr.sbin/perfused/msg.c   Wed Oct 19 01:31:05 2016 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: msg.c,v 1.23 2016/10/18 15:06:17 manu Exp $ */
+/*  $NetBSD: msg.c,v 1.24 2016/10/19 01:31:05 christos Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -43,41 +43,11 @@
 
 #include "perfused.h"
 
-static uint32_t bufvar_from_env(const char const *, const uint32_t);
 static int xchg_pb_inloop(struct puffs_usermount *a, struct puffs_framebuf *,
        int, enum perfuse_xchg_pb_reply);
 static int xchg_pb_early(struct puffs_usermount *a, struct puffs_framebuf *,
        int, enum perfuse_xchg_pb_reply);
 
-static uint32_t 
-bufvar_from_env(name, defval)
-       const char *name;
-       const uint32_t defval;
-{
-       char valstr[1024];
-       uint32_t retval = defval;
-
-       if (getenv_r(name, valstr, sizeof(valstr)) != -1) {
-               long int val;
-               char *ep;
-
-               errno = 0;
-               val = (int)strtol(valstr, &ep, 10);
-               if (*valstr == '\0' || *ep != '\0')
-                       DWARNX("bad %s value \"%s\"", name, valstr);
-               else if (errno != 0)
-                       DWARN("bad %s value \"%s\"", name, valstr);
-               else if (val <= 0L ||
-                        (unsigned long int)val > (unsigned long int)UINT32_MAX)
-                       DWARNX("%s value %ld out of "
-                              "uint32_t bounds", name, val);
-               else
-                       retval = val;
-       }
-
-       return retval;
-}
-
 int
 perfused_open_sock(void)
 {
@@ -111,7 +81,7 @@
         * Set a buffer lentgh large enough so that a few FUSE packets
         * will fit. 
         */
-       opt = bufvar_from_env("PERFUSE_BUFSIZE", 16 * FUSE_BUFSIZE);
+       opt = perfuse_bufvar_from_env("PERFUSE_BUFSIZE", 16 * FUSE_BUFSIZE);
        if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt)) != 0)
                DWARN("%s: setsockopt SO_SNDBUF = %d failed", __func__, opt);
 



Home | Main Index | Thread Index | Old Index