Commit 2e806f08 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Change the VCL_BYTES to be "long long" rather than double.

parent bd535f51
......@@ -474,8 +474,8 @@ VRT_ban_string(VRT_CTX, const char *str)
VAV_Free(av);
}
ssize_t
VRT_CacheReqBody(VRT_CTX, size_t maxsize)
VCL_BYTES
VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
......
......@@ -79,9 +79,10 @@ typedef struct storage *sml_alloc_f(const struct stevedore *, size_t size);
typedef void sml_free_f(struct storage *);
/* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
#define VRTSTVVAR(nm,vt,ct,def) \
typedef ct stv_var_##nm(const struct stevedore *);
#include "tbl/vrt_stv_var.h"
#undef VRTSTVTYPE
#undef VRTSTVVAR
/*--------------------------------------------------------------------*/
......@@ -112,7 +113,7 @@ struct stevedore {
/* Only if LRU is used */
struct lru *lru;
#define VRTSTVVAR(nm, vtype, ctype, dval) storage_var_##ctype *var_##nm;
#define VRTSTVVAR(nm, vtype, ctype, dval) stv_var_##nm *var_##nm;
#include "tbl/vrt_stv_var.h"
#undef VRTSTVVAR
......
......@@ -38,6 +38,7 @@
#include "storage/storage.h"
#include "storage/storage_simple.h"
#include "vrt.h"
#include "vnum.h"
struct sma_sc {
......@@ -147,7 +148,7 @@ sma_free(struct storage *s)
free(sma);
}
static double
static VCL_BYTES __match_proto__(stv_var_used_space)
sma_used_space(const struct stevedore *st)
{
struct sma_sc *sma_sc;
......@@ -156,7 +157,7 @@ sma_used_space(const struct stevedore *st)
return (sma_sc->sma_alloc);
}
static double
static VCL_BYTES __match_proto__(stv_var_free_space)
sma_free_space(const struct stevedore *st)
{
struct sma_sc *sma_sc;
......
......@@ -31,8 +31,6 @@
* NB: When this file is changed, lib/libvcc/generate.py *MUST* be rerun.
*/
#include <sys/types.h>
/***********************************************************************
* Major and minor VRT API versions.
*
......@@ -40,6 +38,9 @@
* Whenever something is deleted or changed in a way which is not
* binary/load-time compatible, increment MAJOR version
*
*
* 4.0:
* VCL_BYTES changed to long long
* 3.2:
* vrt_backend grew .proxy_header field
* vrt_ctx grew .sp field.
......@@ -52,9 +53,9 @@
*
*/
#define VRT_MAJOR_VERSION 3U
#define VRT_MAJOR_VERSION 4U
#define VRT_MINOR_VERSION 2U
#define VRT_MINOR_VERSION 0U
/***********************************************************************/
......@@ -83,7 +84,7 @@ typedef const struct vrt_acl * VCL_ACL;
typedef const struct director * VCL_BACKEND;
typedef const struct vmod_priv * VCL_BLOB;
typedef unsigned VCL_BOOL;
typedef double VCL_BYTES;
typedef long long VCL_BYTES;
typedef double VCL_DURATION;
typedef const char * VCL_ENUM;
typedef const struct gethdr_s * VCL_HEADER;
......@@ -268,7 +269,7 @@ int VRT_acl_match(VRT_CTX, VCL_ACL, VCL_IP);
/* req related */
ssize_t VRT_CacheReqBody(VRT_CTX, size_t maxsize);
VCL_BYTES VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize);
/* Regexp related */
void VRT_re_init(void **, const char *);
......
......@@ -812,7 +812,7 @@ vcl_fixed_token(const char *p, const char **q)
continue
if len(j) == 2:
fo.write("\t\tM2('%s', %s);\n" %
(j[1], emit[j]))
(j[1], emit[j]))
elif len(j) == 1:
fo.write("\t\tM1();\n")
need_ret = False
......@@ -987,8 +987,8 @@ fo.write("#endif\n")
fo.write("\n#ifdef VCL_MET_MAC\n")
for i in ll:
fo.write("VCL_MET_MAC(%s, %s, %s," % (i[0].lower(), i[0].upper(),
i[1]))
fo.write("VCL_MET_MAC(%s, %s, %s," %
(i[0].lower(), i[0].upper(), i[1]))
p = " (\n\t"
for j in sorted(i[2]):
fo.write("%s(1U << VCL_RET_%s)" % (p, j.upper()))
......@@ -1035,8 +1035,7 @@ def tbl40(a, b):
fo.write("\n/* VCL Methods */\n")
n = 1
for i in returns:
fo.write(tbl40("#define VCL_MET_%s" % i[0].upper(),
"(1U << %d)\n" % n))
fo.write(tbl40("#define VCL_MET_%s" % i[0].upper(), "(1U << %d)\n" % n))
n += 1
fo.write("\n" + tbl40("#define VCL_MET_MAX", "%d\n" % n))
......@@ -1152,8 +1151,7 @@ def one_var(nm, spec):
else:
fo.write('\t "VRT_r_%s(ctx)",\n' % cnam)
if nm == i[0]:
fh.write("VCL_" + typ +
" VRT_r_%s(VRT_CTX);\n" % cnam)
fh.write("VCL_" + typ + " VRT_r_%s(VRT_CTX);\n" % cnam)
restrict(fo, spec[2])
if len(spec[3]) == 0:
......@@ -1240,38 +1238,12 @@ fo = open(join(buildroot, "include/tbl/vrt_stv_var.h"), "w")
file_header(fo)
fo.write("""
#ifndef VRTSTVTYPE
#define VRTSTVTYPE(ct)
#define VRTSTVTYPEX
#endif
#ifndef VRTSTVVAR
#define VRTSTVVAR(nm, vtype, ctype, dval)
#define VRTSTVVARX
#endif
""")
x = dict()
for i in stv_variables:
ct = vcltypes[i[1]]
if not ct in x:
fo.write("VRTSTVTYPE(" + ct + ")\n")
x[ct] = 1
fo.write("VRTSTVVAR(" + i[0] + ",\t" + i[1] + ",\t")
fo.write(ct + ",\t" + i[2] + ")")
fo.write("\n")
fo.write("""
#ifdef VRTSTVTYPEX
#undef VRTSTVTYPEX
#undef VRTSTVTYPE
#endif
#ifdef VRTSTVVARX
#undef VRTSTVVARX
#undef VRTSTVVAR
#endif
""")
fo.close()
#######################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment