[master] 766dee0 Drop long broken umem code
Federico G. Schwindt
fgsch at lodoss.net
Mon Jan 16 14:18:05 CET 2017
commit 766dee06e1eba0309453a1c6e1115975b46eed8b
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Mon Jan 16 13:01:42 2017 +0000
Drop long broken umem code
This can be reintroduced at a later time when someone feels like
fixing / rewritting it.
Related to #2147.
diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index b812cc7..edc23f4 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -101,7 +101,6 @@ varnishd_SOURCES = \
storage/storage_persistent_silo.c \
storage/storage_persistent_subr.c \
storage/storage_simple.c \
- storage/storage_umem.c \
waiter/mgt_waiter.c \
waiter/cache_waiter.c \
waiter/cache_waiter_epoll.c \
@@ -157,7 +156,7 @@ varnishd_LDADD = \
@SAN_LDFLAGS@ \
@JEMALLOC_LDADD@ \
@PCRE_LIBS@ \
- ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${RT_LIBS} ${LIBM} ${UMEM_LIBS}
+ ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${RT_LIBS} ${LIBM}
noinst_PROGRAMS = vhp_gen_hufdec
vhp_gen_hufdec_SOURCES = hpack/vhp_gen_hufdec.c
diff --git a/bin/varnishd/Makefile.phk b/bin/varnishd/Makefile.phk
index 54f058a..28d8e85 100644
--- a/bin/varnishd/Makefile.phk
+++ b/bin/varnishd/Makefile.phk
@@ -89,7 +89,6 @@ PROG_SRC += storage/storage_persistent.c
PROG_SRC += storage/storage_persistent_silo.c
PROG_SRC += storage/storage_persistent_subr.c
PROG_SRC += storage/storage_simple.c
-PROG_SRC += storage/storage_umem.c
PROG_SRC += waiter/cache_waiter.c
PROG_SRC += waiter/cache_waiter_epoll.c
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index af8a521..0090655 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -117,9 +117,6 @@ usage(void)
fprintf(stderr, FMT,
"-s [name=]kind[,options]", "Backend storage specification");
fprintf(stderr, FMT, "", " -s malloc[,<size>]");
-#ifdef HAVE_LIBUMEM
- fprintf(stderr, FMT, "", " -s umem");
-#endif
fprintf(stderr, FMT, "", " -s file,<dir_or_file>");
fprintf(stderr, FMT, "", " -s file,<dir_or_file>,<size>");
fprintf(stderr, FMT, "",
diff --git a/bin/varnishd/storage/mgt_stevedore.c b/bin/varnishd/storage/mgt_stevedore.c
index c0cb743..304b3bd 100644
--- a/bin/varnishd/storage/mgt_stevedore.c
+++ b/bin/varnishd/storage/mgt_stevedore.c
@@ -125,9 +125,6 @@ static const struct choice STV_choice[] = {
{ "malloc", &sma_stevedore },
{ "deprecated_persistent", &smp_stevedore },
{ "persistent", &smp_fake_stevedore },
-#if defined(HAVE_LIBUMEM) && 0
- { "umem", &smu_stevedore },
-#endif
{ NULL, NULL }
};
diff --git a/bin/varnishd/storage/storage_umem.c b/bin/varnishd/storage/storage_umem.c
deleted file mode 100644
index edc798f..0000000
--- a/bin/varnishd/storage/storage_umem.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*-
- * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2011 Varnish Software AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Storage method based on umem_alloc(3MALLOC)
- */
-
-//lint -e{766}
-#include "config.h"
-
-#if defined(HAVE_LIBUMEM) && 0
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <umem.h>
-
-#include "cache/cache.h"
-#include "cache/cache_obj.h"
-#include "storage/storage.h"
-#include "storage/storage_simple.h"
-
-static size_t smu_max = SIZE_MAX;
-static MTX smu_mtx;
-
-struct smu {
- struct storage s;
- size_t sz;
-};
-
-static struct storage *
-smu_alloc(const struct stevedore *st, size_t size)
-{
- struct smu *smu;
-
- Lck_Lock(&smu_mtx);
- VSC_C_main->sma_nreq++;
- if (VSC_C_main->sma_nbytes + size > smu_max)
- size = 0;
- else {
- VSC_C_main->sma_nobj++;
- VSC_C_main->sma_nbytes += size;
- VSC_C_main->sma_balloc += size;
- }
- Lck_Unlock(&smu_mtx);
-
- if (size == 0)
- return (NULL);
-
- smu = umem_zalloc(sizeof *smu, UMEM_DEFAULT);
- if (smu == NULL)
- return (NULL);
- smu->sz = size;
- smu->s.priv = smu;
- smu->s.ptr = umem_alloc(size, UMEM_DEFAULT);
- XXXAN(smu->s.ptr);
- smu->s.len = 0;
- smu->s.space = size;
- smu->s.fd = -1;
- smu->s.stevedore = st;
- smu->s.magic = STORAGE_MAGIC;
- return (&smu->s);
-}
-
-static void
-smu_free(struct storage *s)
-{
- struct smu *smu;
-
- CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC);
- smu = s->priv;
- assert(smu->sz == smu->s.space);
- Lck_Lock(&smu_mtx);
- VSC_C_main->sma_nobj--;
- VSC_C_main->sma_nbytes -= smu->sz;
- VSC_C_main->sma_bfree += smu->sz;
- Lck_Unlock(&smu_mtx);
- umem_free(smu->s.ptr, smu->s.space);
- umem_free(smu, sizeof *smu);
-}
-
-static void
-smu_trim(const struct storage *s, size_t size)
-{
- struct smu *smu;
- void *p;
-
- CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC);
- smu = s->priv;
- assert(smu->sz == smu->s.space);
- if ((p = umem_alloc(size, UMEM_DEFAULT)) != NULL) {
- memcpy(p, smu->s.ptr, size);
- umem_free(smu->s.ptr, smu->s.space);
- Lck_Lock(&smu_mtx);
- VSC_C_main->sma_nbytes -= (smu->sz - size);
- VSC_C_main->sma_bfree += smu->sz - size;
- smu->sz = size;
- Lck_Unlock(&smu_mtx);
- smu->s.ptr = p;
- smu->s.space = size;
- }
-}
-
-static void
-smu_init(struct stevedore *parent, int ac, char * const *av)
-{
- const char *e;
- uintmax_t u;
-
- (void)parent;
-
- AZ(av[ac]);
- if (ac > 1)
- ARGV_ERR("(-sumem) too many arguments\n");
-
- if (ac == 0 || *av[0] == '\0')
- return;
-
- e = VNUM_2bytes(av[0], &u, 0);
- if (e != NULL)
- ARGV_ERR("(-sumem) size \"%s\": %s\n", av[0], e);
- if ((u != (uintmax_t)(size_t)u))
- ARGV_ERR("(-sumem) size \"%s\": too big\n", av[0]);
- smu_max = u;
-}
-
-static void
-smu_open(const struct stevedore *st)
-{
- (void)st;
- AZ(pthread_mutex_init(&smu_mtx, NULL));
-}
-
-const struct stevedore smu_stevedore = {
- .magic = STEVEDORE_MAGIC,
- .name = "umem",
- .init = smu_init,
- .open = smu_open,
- .alloc = smu_alloc,
- .free = smu_free,
- .trim = smu_trim,
- .allocobj = SML_allocobj,
- .panic = SML_panic,
- .methods = &SML_methods,
-};
-
-#endif /* HAVE_UMEM_H */
diff --git a/config.phk b/config.phk
index 7058ced..ae7bc93 100644
--- a/config.phk
+++ b/config.phk
@@ -71,8 +71,7 @@ if true ; then
sys/filio.h \
sys/mount.h \
sys/statvfs.h \
- sys/vfs.h \
- umem.h
+ sys/vfs.h
do
if [ -f /usr/include/$i ] ; then
n=`echo $i | tr '[a-z/.]' '[A-Z__]'`
@@ -299,7 +298,6 @@ exit 0
# SO_SNDTIMEO_WORKS +
# VCC_CC +
# HAVE_EPOLL_CTL -
-# HAVE_LIBUMEM -
# USE_PCRE_JIT -
# _FILE_OFFSET_BITS -
#
diff --git a/configure.ac b/configure.ac
index 10baf91..f4d8ec3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,9 +81,6 @@ if test "x$ax_cv_curses" != xyes; then
AC_MSG_ERROR([requires an X/Open-compatible Curses library])
fi
-# Userland slab allocator from Solaris, ported to other systems
-AC_CHECK_HEADERS([umem.h], [_VARNISH_CHECK_LIB(umem, umem_alloc)])
-
# XXX: This _may_ be for OS/X
AC_CHECK_LIBM
AC_SUBST(LIBM)
More information about the varnish-commit
mailing list