Deleted Added
full compact
parse.y (225832) parse.y (226463)
1%{
2/*-
3 * Copyright (c) 2009-2010 The FreeBSD Foundation
4 * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>
5 * All rights reserved.
6 *
7 * This software was developed by Pawel Jakub Dawidek under sponsorship from
8 * the FreeBSD Foundation.

--- 14 unchanged lines hidden (view full) ---

23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
1%{
2/*-
3 * Copyright (c) 2009-2010 The FreeBSD Foundation
4 * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>
5 * All rights reserved.
6 *
7 * This software was developed by Pawel Jakub Dawidek under sponsorship from
8 * the FreeBSD Foundation.

--- 14 unchanged lines hidden (view full) ---

23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sbin/hastd/parse.y 225832 2011-09-28 13:19:47Z pjd $
31 * $FreeBSD: head/sbin/hastd/parse.y 226463 2011-10-17 12:22:09Z pjd $
32 */
33
34#include <sys/param.h> /* MAXHOSTNAMELEN */
35#include <sys/queue.h>
36#include <sys/socket.h>
37#include <sys/sysctl.h>
38
39#include <arpa/inet.h>

--- 15 unchanged lines hidden (view full) ---

55extern FILE *yyin;
56extern char *yytext;
57
58static struct hastd_config *lconfig;
59static struct hast_resource *curres;
60static bool mynode, hadmynode;
61
62static char depth0_control[HAST_ADDRSIZE];
32 */
33
34#include <sys/param.h> /* MAXHOSTNAMELEN */
35#include <sys/queue.h>
36#include <sys/socket.h>
37#include <sys/sysctl.h>
38
39#include <arpa/inet.h>

--- 15 unchanged lines hidden (view full) ---

55extern FILE *yyin;
56extern char *yytext;
57
58static struct hastd_config *lconfig;
59static struct hast_resource *curres;
60static bool mynode, hadmynode;
61
62static char depth0_control[HAST_ADDRSIZE];
63static char depth0_pidfile[PATH_MAX];
63static char depth0_listen_tcp4[HAST_ADDRSIZE];
64static char depth0_listen_tcp6[HAST_ADDRSIZE];
65static TAILQ_HEAD(, hastd_listen) depth0_listen;
66static int depth0_replication;
67static int depth0_checksum;
68static int depth0_compression;
69static int depth0_timeout;
70static char depth0_exec[PATH_MAX];

--- 117 unchanged lines hidden (view full) ---

188 depth = 0;
189 lineno = 0;
190
191 depth0_timeout = HAST_TIMEOUT;
192 depth0_replication = HAST_REPLICATION_FULLSYNC;
193 depth0_checksum = HAST_CHECKSUM_NONE;
194 depth0_compression = HAST_COMPRESSION_HOLE;
195 strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
64static char depth0_listen_tcp4[HAST_ADDRSIZE];
65static char depth0_listen_tcp6[HAST_ADDRSIZE];
66static TAILQ_HEAD(, hastd_listen) depth0_listen;
67static int depth0_replication;
68static int depth0_checksum;
69static int depth0_compression;
70static int depth0_timeout;
71static char depth0_exec[PATH_MAX];

--- 117 unchanged lines hidden (view full) ---

189 depth = 0;
190 lineno = 0;
191
192 depth0_timeout = HAST_TIMEOUT;
193 depth0_replication = HAST_REPLICATION_FULLSYNC;
194 depth0_checksum = HAST_CHECKSUM_NONE;
195 depth0_compression = HAST_COMPRESSION_HOLE;
196 strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
197 strlcpy(depth0_pidfile, HASTD_PIDFILE, sizeof(depth0_pidfile));
196 TAILQ_INIT(&depth0_listen);
197 strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4,
198 sizeof(depth0_listen_tcp4));
199 strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6,
200 sizeof(depth0_listen_tcp6));
201 depth0_exec[0] = '\0';
202 depth0_metaflush = 1;
203

--- 29 unchanged lines hidden (view full) ---

233
234 /*
235 * Let's see if everything is set up.
236 */
237 if (lconfig->hc_controladdr[0] == '\0') {
238 strlcpy(lconfig->hc_controladdr, depth0_control,
239 sizeof(lconfig->hc_controladdr));
240 }
198 TAILQ_INIT(&depth0_listen);
199 strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4,
200 sizeof(depth0_listen_tcp4));
201 strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6,
202 sizeof(depth0_listen_tcp6));
203 depth0_exec[0] = '\0';
204 depth0_metaflush = 1;
205

--- 29 unchanged lines hidden (view full) ---

235
236 /*
237 * Let's see if everything is set up.
238 */
239 if (lconfig->hc_controladdr[0] == '\0') {
240 strlcpy(lconfig->hc_controladdr, depth0_control,
241 sizeof(lconfig->hc_controladdr));
242 }
243 if (lconfig->hc_pidfile[0] == '\0') {
244 strlcpy(lconfig->hc_pidfile, depth0_pidfile,
245 sizeof(lconfig->hc_pidfile));
246 }
241 if (!TAILQ_EMPTY(&depth0_listen))
242 TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next);
243 if (TAILQ_EMPTY(&lconfig->hc_listen)) {
244 struct hastd_listen *lst;
245
246 if (family_supported(AF_INET)) {
247 lst = calloc(1, sizeof(*lst));
248 if (lst == NULL) {

--- 111 unchanged lines hidden (view full) ---

360 while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) {
361 TAILQ_REMOVE(&config->hc_resources, res, hr_next);
362 free(res);
363 }
364 free(config);
365}
366%}
367
247 if (!TAILQ_EMPTY(&depth0_listen))
248 TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next);
249 if (TAILQ_EMPTY(&lconfig->hc_listen)) {
250 struct hastd_listen *lst;
251
252 if (family_supported(AF_INET)) {
253 lst = calloc(1, sizeof(*lst));
254 if (lst == NULL) {

--- 111 unchanged lines hidden (view full) ---

366 while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) {
367 TAILQ_REMOVE(&config->hc_resources, res, hr_next);
368 free(res);
369 }
370 free(config);
371}
372%}
373
368%token CONTROL LISTEN PORT REPLICATION CHECKSUM COMPRESSION METAFLUSH
374%token CONTROL PIDFILE LISTEN PORT REPLICATION CHECKSUM COMPRESSION METAFLUSH
369%token TIMEOUT EXEC EXTENTSIZE RESOURCE NAME LOCAL REMOTE SOURCE ON OFF
370%token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF
371%token NUM STR OB CB
372
373%type <str> remote_str
374%type <num> replication_type
375%type <num> checksum_type
376%type <num> compression_type

--- 13 unchanged lines hidden (view full) ---

390statements:
391 |
392 statements statement
393 ;
394
395statement:
396 control_statement
397 |
375%token TIMEOUT EXEC EXTENTSIZE RESOURCE NAME LOCAL REMOTE SOURCE ON OFF
376%token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF
377%token NUM STR OB CB
378
379%type <str> remote_str
380%type <num> replication_type
381%type <num> checksum_type
382%type <num> compression_type

--- 13 unchanged lines hidden (view full) ---

396statements:
397 |
398 statements statement
399 ;
400
401statement:
402 control_statement
403 |
404 pidfile_statement
405 |
398 listen_statement
399 |
400 replication_statement
401 |
402 checksum_statement
403 |
404 compression_statement
405 |

--- 33 unchanged lines hidden (view full) ---

439 break;
440 default:
441 PJDLOG_ABORT("control at wrong depth level");
442 }
443 free($2);
444 }
445 ;
446
406 listen_statement
407 |
408 replication_statement
409 |
410 checksum_statement
411 |
412 compression_statement
413 |

--- 33 unchanged lines hidden (view full) ---

447 break;
448 default:
449 PJDLOG_ABORT("control at wrong depth level");
450 }
451 free($2);
452 }
453 ;
454
455pidfile_statement: PIDFILE STR
456 {
457 switch (depth) {
458 case 0:
459 if (strlcpy(depth0_pidfile, $2,
460 sizeof(depth0_pidfile)) >=
461 sizeof(depth0_pidfile)) {
462 pjdlog_error("pidfile argument is too long.");
463 free($2);
464 return (1);
465 }
466 break;
467 case 1:
468 if (!mynode)
469 break;
470 if (strlcpy(lconfig->hc_pidfile, $2,
471 sizeof(lconfig->hc_pidfile)) >=
472 sizeof(lconfig->hc_pidfile)) {
473 pjdlog_error("pidfile argument is too long.");
474 free($2);
475 return (1);
476 }
477 break;
478 default:
479 PJDLOG_ABORT("pidfile at wrong depth level");
480 }
481 free($2);
482 }
483 ;
484
447listen_statement: LISTEN STR
448 {
449 struct hastd_listen *lst;
450
451 lst = calloc(1, sizeof(*lst));
452 if (lst == NULL) {
453 pjdlog_error("Unable to allocate memory for listen address.");
454 free($2);

--- 198 unchanged lines hidden (view full) ---

653node_entries:
654 |
655 node_entries node_entry
656 ;
657
658node_entry:
659 control_statement
660 |
485listen_statement: LISTEN STR
486 {
487 struct hastd_listen *lst;
488
489 lst = calloc(1, sizeof(*lst));
490 if (lst == NULL) {
491 pjdlog_error("Unable to allocate memory for listen address.");
492 free($2);

--- 198 unchanged lines hidden (view full) ---

691node_entries:
692 |
693 node_entries node_entry
694 ;
695
696node_entry:
697 control_statement
698 |
699 pidfile_statement
700 |
661 listen_statement
662 ;
663
664resource_statement: RESOURCE resource_start OB resource_entries CB
665 {
666 if (curres != NULL) {
667 /*
668 * There must be section for this node, at least with

--- 299 unchanged lines hidden ---
701 listen_statement
702 ;
703
704resource_statement: RESOURCE resource_start OB resource_entries CB
705 {
706 if (curres != NULL) {
707 /*
708 * There must be section for this node, at least with

--- 299 unchanged lines hidden ---