Module Name: src Committed By: christos Date: Wed Oct 19 01:31:05 UTC 2016
Modified Files: src/usr.sbin/perfused: msg.c Log Message: remove dup function To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/perfused/msg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/perfused/msg.c diff -u src/usr.sbin/perfused/msg.c:1.23 src/usr.sbin/perfused/msg.c:1.24 --- src/usr.sbin/perfused/msg.c:1.23 Tue Oct 18 11:06:17 2016 +++ src/usr.sbin/perfused/msg.c Tue Oct 18 21:31:05 2016 @@ -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 @@ perfused_open_sock(void) * 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);