remove dup function

This commit is contained in:
christos 2016-10-19 01:31:05 +00:00
parent 95c12ccdf1
commit 82c75ae659
1 changed files with 2 additions and 32 deletions

View File

@ -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);