A non-static vlog_rate_limit is not actually going to rate-limit anything.
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
CLEANFILES += distfiles
+# Check that "struct vlog_ratelimit" is always declared "static".
+ALL_LOCAL += rate-limit-check
+rate-limit-check:
+ @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
+ git --no-pager grep -n -E '^[ ]+struct vlog_rate_limit.*=' $(srcdir); \
+ then \
+ echo "See above for list of violations of the rule that "; \
+ echo "'struct vlog_rate_limit' must always be 'static'"; \
+ exit 1; \
+ fi
+
dist-hook: $(DIST_HOOKS)
all-local: $(ALL_LOCAL)
clean-local: $(CLEAN_LOCAL)
/*
- * Copyright (c) 2009, 2010 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (!error) {
dp_netdev_port_input(dp, port, &packet);
} else if (error != EAGAIN && error != EOPNOTSUPP) {
- struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
VLOG_ERR_RL(&rl, "error receiving data from %s: %s",
netdev_get_name(port->netdev), strerror(error));
}
/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
lookup_ip(const char *host_name, struct in_addr *addr)
{
if (!inet_aton(host_name, addr)) {
- struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
VLOG_ERR_RL(&rl, "\"%s\" is not a valid IP address", host_name);
return ENOENT;
}
int error;
socklen_t len = sizeof(error);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
- struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 10);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 10);
error = errno;
VLOG_ERR_RL(&rl, "getsockopt(SO_ERROR): %s", strerror(error));
}
/*
- * Copyright (c) 2009, 2010 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011 Nicira Networks.
* Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
*
* Licensed under the Apache License, Version 2.0 (the "License");
ctx->recurse--;
}
} else {
- struct vlog_rate_limit recurse_rl = VLOG_RATE_LIMIT_INIT(1, 1);
+ static struct vlog_rate_limit recurse_rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_ERR_RL(&recurse_rl, "NXAST_RESUBMIT recursed over %d times",
MAX_RESUBMIT_RECURSION);
-/* Copyright (c) 2008, 2009, 2010 Nicira Networks
+/* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (sscanf(line, "%d %d "ETH_ADDR_SCAN_FMT" %d",
&port, &vlan, ETH_ADDR_SCAN_ARGS(mac), &age)
!= 2 + ETH_ADDR_SCAN_COUNT + 1) {
- struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_INFO_RL(&rl, "fdb/show output has invalid format: %s", line);
continue;
}