amd64/174388: [9.1-RELEASE] Build world problem with yyparser.
Marcelo Araujo
araujo at FreeBSD.org
Wed Dec 12 11:50:00 UTC 2012
>Number: 174388
>Category: amd64
>Synopsis: [9.1-RELEASE] Build world problem with yyparser.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-amd64
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Dec 12 11:50:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Marcelo Araujo
>Release: FreeBSD 9.1-RC1
>Organization:
FreeBSD
>Environment:
FreeBSD Araujo 9.1-RC1 FreeBSD 9.1-RC1 #0: Thu Aug 9 09:41:50 PDT 2012 root at build9x64.pcbsd.org:/usr/obj/builds/amd64/pcbsd-build90/fbsd-source/9.1/sys/GENERIC amd64
>Description:
There are bunch of updates related with yyparse that were added on HEAD but were forgotten to MFC'd to STABLE for some reason and those updates are not part of 9.1-RELEASE.
When you try to build WORLD using CLANG, you will see a lot of issues related with yyparse.
Here is my /etc/make.conf
added by use.perl 2012-10-03 21:06:29
PERL_VERSION=5.14.2
.if !defined(CC) || ${CC} == "cc"
CC=clang
.endif
.if !defined(CXX) || ${CXX} == "c++"
CXX=clang++
.endif
.if !defined(CPP) || ${CPP} == "cpp"
CPP=clang-cpp
.endif
NO_WERROR=
WERROR=
NO_FSCHG=
>How-To-Repeat:
Just try to make the buildworld using CLANG.
>Fix:
Here attached there is a patch, all updates comes from HEAD, and it works properly.
Patch attached with submission follows:
Index: usr.bin/mklocale/extern.h
===================================================================
--- usr.bin/mklocale/extern.h (revision 243938)
+++ usr.bin/mklocale/extern.h (working copy)
@@ -33,4 +33,3 @@
*/
int yylex(void);
-int yyparse(void);
Index: usr.bin/ar/acpyacc.y
===================================================================
--- usr.bin/ar/acpyacc.y (revision 243938)
+++ usr.bin/ar/acpyacc.y (working copy)
@@ -54,7 +54,6 @@
extern int yylex(void);
-extern int yyparse(void);
static void yyerror(const char *);
static void arscp_addlib(char *archive, struct list *list);
Index: usr.bin/bc/bc.y
===================================================================
--- usr.bin/bc/bc.y (revision 243938)
+++ usr.bin/bc/bc.y (working copy)
@@ -69,7 +69,6 @@
ssize_t index;
};
-int yyparse(void);
int yywrap(void);
int fileindex;
Index: usr.bin/find/getdate.y
===================================================================
--- usr.bin/find/getdate.y (revision 243938)
+++ usr.bin/find/getdate.y (working copy)
@@ -60,11 +60,9 @@
#include <time.h>
-#define yyparse getdate_yyparse
#define yylex getdate_yylex
#define yyerror getdate_yyerror
-static int yyparse(void);
static int yylex(void);
static int yyerror(const char *);
Index: usr.bin/mkcsmapper/ldef.h
===================================================================
--- usr.bin/mkcsmapper/ldef.h (revision 243938)
+++ usr.bin/mkcsmapper/ldef.h (working copy)
@@ -39,4 +39,3 @@
extern int line_number;
extern int yyerror(const char *);
extern int yylex(void);
-extern int yyparse(void);
Index: usr.sbin/fifolog/lib/getdate.y
===================================================================
--- usr.sbin/fifolog/lib/getdate.y (revision 243938)
+++ usr.sbin/fifolog/lib/getdate.y (working copy)
@@ -24,11 +24,9 @@
#include "libfifolog.h"
-#define yyparse getdate_yyparse
#define yylex getdate_yylex
#define yyerror getdate_yyerror
-static int yyparse(void);
static int yylex(void);
static int yyerror(const char *);
Index: usr.sbin/jail/jailp.h
===================================================================
--- usr.sbin/jail/jailp.h (revision 243938)
+++ usr.sbin/jail/jailp.h (working copy)
@@ -222,7 +222,6 @@
extern void yyerror(const char *);
extern int yylex(void);
-extern int yyparse(void);
extern struct cfjails cfjails;
extern struct cfjails ready;
Index: usr.sbin/jail/config.c
===================================================================
--- usr.sbin/jail/config.c (revision 243938)
+++ usr.sbin/jail/config.c (working copy)
@@ -52,6 +52,8 @@
extern FILE *yyin;
extern int yynerrs;
+extern int yyparse(void);
+
struct cfjails cfjails = TAILQ_HEAD_INITIALIZER(cfjails);
static void free_param(struct cfparams *pp, struct cfparam *p);
Index: usr.sbin/bluetooth/hcsecd/parser.y
===================================================================
--- usr.sbin/bluetooth/hcsecd/parser.y (revision 243938)
+++ usr.sbin/bluetooth/hcsecd/parser.y (working copy)
@@ -36,6 +36,7 @@
#include <errno.h>
#include <limits.h>
#include <stdio.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <syslog.h>
Index: usr.sbin/bluetooth/bthidd/parser.y
===================================================================
--- usr.sbin/bluetooth/bthidd/parser.y (revision 243938)
+++ usr.sbin/bluetooth/bthidd/parser.y (working copy)
@@ -39,6 +39,7 @@
#include <errno.h>
#include <limits.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <usbhid.h>
Index: usr.sbin/config/config.h
===================================================================
--- usr.sbin/config/config.h (revision 243938)
+++ usr.sbin/config/config.h (working copy)
@@ -171,7 +171,6 @@
char *raisestr(char *);
void remember(const char *);
void moveifchanged(const char *, const char *);
-int yyparse(void);
int yylex(void);
void options(void);
void makefile(void);
Index: usr.sbin/config/main.c
===================================================================
--- usr.sbin/config/main.c (revision 243938)
+++ usr.sbin/config/main.c (working copy)
@@ -91,6 +91,7 @@
static void cleanheaders(char *);
static void kernconfdump(const char *);
static void checkversion(void);
+extern int yyparse(void);
struct hdr_list {
char *h_name;
Index: lib/libc/net/nsparser.y
===================================================================
--- lib/libc/net/nsparser.y (revision 243938)
+++ lib/libc/net/nsparser.y (working copy)
@@ -44,6 +44,7 @@
#define _NS_PRIVATE
#include <nsswitch.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include "un-namespace.h"
Index: bin/expr/expr.y
===================================================================
--- bin/expr/expr.y (revision 243938)
+++ bin/expr/expr.y (working copy)
@@ -74,7 +74,6 @@
void to_string(struct val *);
int yyerror(const char *);
int yylex(void);
-int yyparse(void);
%}
Index: sbin/devd/parse.y
===================================================================
--- sbin/devd/parse.y (revision 243938)
+++ sbin/devd/parse.y (working copy)
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#include <sys/cdefs.h>
#include "devd.h"
#include <stdio.h>
#include <string.h>
Index: sbin/hastd/parse.y
===================================================================
--- sbin/hastd/parse.y (revision 243938)
+++ sbin/hastd/parse.y (working copy)
@@ -77,296 +77,9 @@
extern void yyrestart(FILE *);
-static int
-isitme(const char *name)
-{
- char buf[MAXHOSTNAMELEN];
- char *pos;
- size_t bufsize;
-
- /*
- * First check if the given name matches our full hostname.
- */
- if (gethostname(buf, sizeof(buf)) < 0) {
- pjdlog_errno(LOG_ERR, "gethostname() failed");
- return (-1);
- }
- if (strcmp(buf, name) == 0)
- return (1);
-
- /*
- * Now check if it matches first part of the host name.
- */
- pos = strchr(buf, '.');
- if (pos != NULL && (size_t)(pos - buf) == strlen(name) &&
- strncmp(buf, name, pos - buf) == 0) {
- return (1);
- }
-
- /*
- * At the end check if name is equal to our host's UUID.
- */
- bufsize = sizeof(buf);
- if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) {
- pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed");
- return (-1);
- }
- if (strcasecmp(buf, name) == 0)
- return (1);
-
- /*
- * Looks like this isn't about us.
- */
- return (0);
-}
-
-static bool
-family_supported(int family)
-{
- int sock;
-
- sock = socket(family, SOCK_STREAM, 0);
- if (sock == -1 && errno == EPROTONOSUPPORT)
- return (false);
- if (sock >= 0)
- (void)close(sock);
- return (true);
-}
-
-static int
-node_names(char **namesp)
-{
- static char names[MAXHOSTNAMELEN * 3];
- char buf[MAXHOSTNAMELEN];
- char *pos;
- size_t bufsize;
-
- if (gethostname(buf, sizeof(buf)) < 0) {
- pjdlog_errno(LOG_ERR, "gethostname() failed");
- return (-1);
- }
-
- /* First component of the host name. */
- pos = strchr(buf, '.');
- if (pos != NULL && pos != buf) {
- (void)strlcpy(names, buf, MIN((size_t)(pos - buf + 1),
- sizeof(names)));
- (void)strlcat(names, ", ", sizeof(names));
- }
-
- /* Full host name. */
- (void)strlcat(names, buf, sizeof(names));
- (void)strlcat(names, ", ", sizeof(names));
-
- /* Host UUID. */
- bufsize = sizeof(buf);
- if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) {
- pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed");
- return (-1);
- }
- (void)strlcat(names, buf, sizeof(names));
-
- *namesp = names;
-
- return (0);
-}
-
-void
-yyerror(const char *str)
-{
-
- pjdlog_error("Unable to parse configuration file at line %d near '%s': %s",
- lineno, yytext, str);
-}
-
-struct hastd_config *
-yy_config_parse(const char *config, bool exitonerror)
-{
- int ret;
-
- curres = NULL;
- mynode = false;
- depth = 0;
- lineno = 0;
-
- depth0_timeout = HAST_TIMEOUT;
- depth0_replication = HAST_REPLICATION_FULLSYNC;
- depth0_checksum = HAST_CHECKSUM_NONE;
- depth0_compression = HAST_COMPRESSION_HOLE;
- strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
- strlcpy(depth0_pidfile, HASTD_PIDFILE, sizeof(depth0_pidfile));
- TAILQ_INIT(&depth0_listen);
- strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4,
- sizeof(depth0_listen_tcp4));
- strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6,
- sizeof(depth0_listen_tcp6));
- depth0_exec[0] = '\0';
- depth0_metaflush = 1;
-
- lconfig = calloc(1, sizeof(*lconfig));
- if (lconfig == NULL) {
- pjdlog_error("Unable to allocate memory for configuration.");
- if (exitonerror)
- exit(EX_TEMPFAIL);
- return (NULL);
- }
-
- TAILQ_INIT(&lconfig->hc_listen);
- TAILQ_INIT(&lconfig->hc_resources);
-
- yyin = fopen(config, "r");
- if (yyin == NULL) {
- pjdlog_errno(LOG_ERR, "Unable to open configuration file %s",
- config);
- yy_config_free(lconfig);
- if (exitonerror)
- exit(EX_OSFILE);
- return (NULL);
- }
- yyrestart(yyin);
- ret = yyparse();
- fclose(yyin);
- if (ret != 0) {
- yy_config_free(lconfig);
- if (exitonerror)
- exit(EX_CONFIG);
- return (NULL);
- }
-
- /*
- * Let's see if everything is set up.
- */
- if (lconfig->hc_controladdr[0] == '\0') {
- strlcpy(lconfig->hc_controladdr, depth0_control,
- sizeof(lconfig->hc_controladdr));
- }
- if (lconfig->hc_pidfile[0] == '\0') {
- strlcpy(lconfig->hc_pidfile, depth0_pidfile,
- sizeof(lconfig->hc_pidfile));
- }
- if (!TAILQ_EMPTY(&depth0_listen))
- TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next);
- if (TAILQ_EMPTY(&lconfig->hc_listen)) {
- struct hastd_listen *lst;
-
- if (family_supported(AF_INET)) {
- lst = calloc(1, sizeof(*lst));
- if (lst == NULL) {
- pjdlog_error("Unable to allocate memory for listen address.");
- yy_config_free(lconfig);
- if (exitonerror)
- exit(EX_TEMPFAIL);
- return (NULL);
- }
- (void)strlcpy(lst->hl_addr, depth0_listen_tcp4,
- sizeof(lst->hl_addr));
- TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
- } else {
- pjdlog_debug(1,
- "No IPv4 support in the kernel, not listening on IPv4 address.");
- }
- if (family_supported(AF_INET6)) {
- lst = calloc(1, sizeof(*lst));
- if (lst == NULL) {
- pjdlog_error("Unable to allocate memory for listen address.");
- yy_config_free(lconfig);
- if (exitonerror)
- exit(EX_TEMPFAIL);
- return (NULL);
- }
- (void)strlcpy(lst->hl_addr, depth0_listen_tcp6,
- sizeof(lst->hl_addr));
- TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
- } else {
- pjdlog_debug(1,
- "No IPv6 support in the kernel, not listening on IPv6 address.");
- }
- if (TAILQ_EMPTY(&lconfig->hc_listen)) {
- pjdlog_error("No address to listen on.");
- yy_config_free(lconfig);
- if (exitonerror)
- exit(EX_TEMPFAIL);
- return (NULL);
- }
- }
- TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) {
- PJDLOG_ASSERT(curres->hr_provname[0] != '\0');
- PJDLOG_ASSERT(curres->hr_localpath[0] != '\0');
- PJDLOG_ASSERT(curres->hr_remoteaddr[0] != '\0');
-
- if (curres->hr_replication == -1) {
- /*
- * Replication is not set at resource-level.
- * Use global or default setting.
- */
- curres->hr_replication = depth0_replication;
- }
- if (curres->hr_replication == HAST_REPLICATION_MEMSYNC) {
- pjdlog_warning("Replication mode \"%s\" is not implemented, falling back to \"%s\".",
- "memsync", "fullsync");
- curres->hr_replication = HAST_REPLICATION_FULLSYNC;
- }
- if (curres->hr_checksum == -1) {
- /*
- * Checksum is not set at resource-level.
- * Use global or default setting.
- */
- curres->hr_checksum = depth0_checksum;
- }
- if (curres->hr_compression == -1) {
- /*
- * Compression is not set at resource-level.
- * Use global or default setting.
- */
- curres->hr_compression = depth0_compression;
- }
- if (curres->hr_timeout == -1) {
- /*
- * Timeout is not set at resource-level.
- * Use global or default setting.
- */
- curres->hr_timeout = depth0_timeout;
- }
- if (curres->hr_exec[0] == '\0') {
- /*
- * Exec is not set at resource-level.
- * Use global or default setting.
- */
- strlcpy(curres->hr_exec, depth0_exec,
- sizeof(curres->hr_exec));
- }
- if (curres->hr_metaflush == -1) {
- /*
- * Metaflush is not set at resource-level.
- * Use global or default setting.
- */
- curres->hr_metaflush = depth0_metaflush;
- }
- }
-
- return (lconfig);
-}
-
-void
-yy_config_free(struct hastd_config *config)
-{
- struct hastd_listen *lst;
- struct hast_resource *res;
-
- while ((lst = TAILQ_FIRST(&depth0_listen)) != NULL) {
- TAILQ_REMOVE(&depth0_listen, lst, hl_next);
- free(lst);
- }
- while ((lst = TAILQ_FIRST(&config->hc_listen)) != NULL) {
- TAILQ_REMOVE(&config->hc_listen, lst, hl_next);
- free(lst);
- }
- while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) {
- TAILQ_REMOVE(&config->hc_resources, res, hr_next);
- free(res);
- }
- free(config);
-}
+static int isitme(const char *name);
+static bool family_supported(int family);
+static int node_names(char **namesp);
%}
%token CONTROL PIDFILE LISTEN REPLICATION CHECKSUM COMPRESSION METAFLUSH
@@ -1004,3 +717,296 @@
free($2);
}
;
+
+%%
+
+static int
+isitme(const char *name)
+{
+ char buf[MAXHOSTNAMELEN];
+ char *pos;
+ size_t bufsize;
+
+ /*
+ * First check if the given name matches our full hostname.
+ */
+ if (gethostname(buf, sizeof(buf)) < 0) {
+ pjdlog_errno(LOG_ERR, "gethostname() failed");
+ return (-1);
+ }
+ if (strcmp(buf, name) == 0)
+ return (1);
+
+ /*
+ * Now check if it matches first part of the host name.
+ */
+ pos = strchr(buf, '.');
+ if (pos != NULL && (size_t)(pos - buf) == strlen(name) &&
+ strncmp(buf, name, pos - buf) == 0) {
+ return (1);
+ }
+
+ /*
+ * At the end check if name is equal to our host's UUID.
+ */
+ bufsize = sizeof(buf);
+ if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) {
+ pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed");
+ return (-1);
+ }
+ if (strcasecmp(buf, name) == 0)
+ return (1);
+
+ /*
+ * Looks like this isn't about us.
+ */
+ return (0);
+}
+
+static bool
+family_supported(int family)
+{
+ int sock;
+
+ sock = socket(family, SOCK_STREAM, 0);
+ if (sock == -1 && errno == EPROTONOSUPPORT)
+ return (false);
+ if (sock >= 0)
+ (void)close(sock);
+ return (true);
+}
+
+static int
+node_names(char **namesp)
+{
+ static char names[MAXHOSTNAMELEN * 3];
+ char buf[MAXHOSTNAMELEN];
+ char *pos;
+ size_t bufsize;
+
+ if (gethostname(buf, sizeof(buf)) < 0) {
+ pjdlog_errno(LOG_ERR, "gethostname() failed");
+ return (-1);
+ }
+
+ /* First component of the host name. */
+ pos = strchr(buf, '.');
+ if (pos != NULL && pos != buf) {
+ (void)strlcpy(names, buf, MIN((size_t)(pos - buf + 1),
+ sizeof(names)));
+ (void)strlcat(names, ", ", sizeof(names));
+ }
+
+ /* Full host name. */
+ (void)strlcat(names, buf, sizeof(names));
+ (void)strlcat(names, ", ", sizeof(names));
+
+ /* Host UUID. */
+ bufsize = sizeof(buf);
+ if (sysctlbyname("kern.hostuuid", buf, &bufsize, NULL, 0) < 0) {
+ pjdlog_errno(LOG_ERR, "sysctlbyname(kern.hostuuid) failed");
+ return (-1);
+ }
+ (void)strlcat(names, buf, sizeof(names));
+
+ *namesp = names;
+
+ return (0);
+}
+
+void
+yyerror(const char *str)
+{
+
+ pjdlog_error("Unable to parse configuration file at line %d near '%s': %s",
+ lineno, yytext, str);
+}
+
+struct hastd_config *
+yy_config_parse(const char *config, bool exitonerror)
+{
+ int ret;
+
+ curres = NULL;
+ mynode = false;
+ depth = 0;
+ lineno = 0;
+
+ depth0_timeout = HAST_TIMEOUT;
+ depth0_replication = HAST_REPLICATION_FULLSYNC;
+ depth0_checksum = HAST_CHECKSUM_NONE;
+ depth0_compression = HAST_COMPRESSION_HOLE;
+ strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
+ strlcpy(depth0_pidfile, HASTD_PIDFILE, sizeof(depth0_pidfile));
+ TAILQ_INIT(&depth0_listen);
+ strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4,
+ sizeof(depth0_listen_tcp4));
+ strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6,
+ sizeof(depth0_listen_tcp6));
+ depth0_exec[0] = '\0';
+ depth0_metaflush = 1;
+
+ lconfig = calloc(1, sizeof(*lconfig));
+ if (lconfig == NULL) {
+ pjdlog_error("Unable to allocate memory for configuration.");
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
+
+ TAILQ_INIT(&lconfig->hc_listen);
+ TAILQ_INIT(&lconfig->hc_resources);
+
+ yyin = fopen(config, "r");
+ if (yyin == NULL) {
+ pjdlog_errno(LOG_ERR, "Unable to open configuration file %s",
+ config);
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_OSFILE);
+ return (NULL);
+ }
+ yyrestart(yyin);
+ ret = yyparse();
+ fclose(yyin);
+ if (ret != 0) {
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_CONFIG);
+ return (NULL);
+ }
+
+ /*
+ * Let's see if everything is set up.
+ */
+ if (lconfig->hc_controladdr[0] == '\0') {
+ strlcpy(lconfig->hc_controladdr, depth0_control,
+ sizeof(lconfig->hc_controladdr));
+ }
+ if (lconfig->hc_pidfile[0] == '\0') {
+ strlcpy(lconfig->hc_pidfile, depth0_pidfile,
+ sizeof(lconfig->hc_pidfile));
+ }
+ if (!TAILQ_EMPTY(&depth0_listen))
+ TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next);
+ if (TAILQ_EMPTY(&lconfig->hc_listen)) {
+ struct hastd_listen *lst;
+
+ if (family_supported(AF_INET)) {
+ lst = calloc(1, sizeof(*lst));
+ if (lst == NULL) {
+ pjdlog_error("Unable to allocate memory for listen address.");
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
+ (void)strlcpy(lst->hl_addr, depth0_listen_tcp4,
+ sizeof(lst->hl_addr));
+ TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
+ } else {
+ pjdlog_debug(1,
+ "No IPv4 support in the kernel, not listening on IPv4 address.");
+ }
+ if (family_supported(AF_INET6)) {
+ lst = calloc(1, sizeof(*lst));
+ if (lst == NULL) {
+ pjdlog_error("Unable to allocate memory for listen address.");
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
+ (void)strlcpy(lst->hl_addr, depth0_listen_tcp6,
+ sizeof(lst->hl_addr));
+ TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
+ } else {
+ pjdlog_debug(1,
+ "No IPv6 support in the kernel, not listening on IPv6 address.");
+ }
+ if (TAILQ_EMPTY(&lconfig->hc_listen)) {
+ pjdlog_error("No address to listen on.");
+ yy_config_free(lconfig);
+ if (exitonerror)
+ exit(EX_TEMPFAIL);
+ return (NULL);
+ }
+ }
+ TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) {
+ PJDLOG_ASSERT(curres->hr_provname[0] != '\0');
+ PJDLOG_ASSERT(curres->hr_localpath[0] != '\0');
+ PJDLOG_ASSERT(curres->hr_remoteaddr[0] != '\0');
+
+ if (curres->hr_replication == -1) {
+ /*
+ * Replication is not set at resource-level.
+ * Use global or default setting.
+ */
+ curres->hr_replication = depth0_replication;
+ }
+ if (curres->hr_replication == HAST_REPLICATION_MEMSYNC) {
+ pjdlog_warning("Replication mode \"%s\" is not implemented, falling back to \"%s\".",
+ "memsync", "fullsync");
+ curres->hr_replication = HAST_REPLICATION_FULLSYNC;
+ }
+ if (curres->hr_checksum == -1) {
+ /*
+ * Checksum is not set at resource-level.
+ * Use global or default setting.
+ */
+ curres->hr_checksum = depth0_checksum;
+ }
+ if (curres->hr_compression == -1) {
+ /*
+ * Compression is not set at resource-level.
+ * Use global or default setting.
+ */
+ curres->hr_compression = depth0_compression;
+ }
+ if (curres->hr_timeout == -1) {
+ /*
+ * Timeout is not set at resource-level.
+ * Use global or default setting.
+ */
+ curres->hr_timeout = depth0_timeout;
+ }
+ if (curres->hr_exec[0] == '\0') {
+ /*
+ * Exec is not set at resource-level.
+ * Use global or default setting.
+ */
+ strlcpy(curres->hr_exec, depth0_exec,
+ sizeof(curres->hr_exec));
+ }
+ if (curres->hr_metaflush == -1) {
+ /*
+ * Metaflush is not set at resource-level.
+ * Use global or default setting.
+ */
+ curres->hr_metaflush = depth0_metaflush;
+ }
+ }
+
+ return (lconfig);
+}
+
+void
+yy_config_free(struct hastd_config *config)
+{
+ struct hastd_listen *lst;
+ struct hast_resource *res;
+
+ while ((lst = TAILQ_FIRST(&depth0_listen)) != NULL) {
+ TAILQ_REMOVE(&depth0_listen, lst, hl_next);
+ free(lst);
+ }
+ while ((lst = TAILQ_FIRST(&config->hc_listen)) != NULL) {
+ TAILQ_REMOVE(&config->hc_listen, lst, hl_next);
+ free(lst);
+ }
+ while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) {
+ TAILQ_REMOVE(&config->hc_resources, res, hr_next);
+ free(res);
+ }
+ free(config);
+}
Index: sbin/hastd/hast.h
===================================================================
--- sbin/hastd/hast.h (revision 243938)
+++ sbin/hastd/hast.h (working copy)
@@ -244,6 +244,5 @@
void yyerror(const char *);
int yylex(void);
-int yyparse(void);
#endif /* !_HAST_H_ */
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-amd64
mailing list