-
Notifications
You must be signed in to change notification settings - Fork 3
/
parser_gram.y
4894 lines (4185 loc) · 112 KB
/
parser_gram.y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Portions Copyright 2008 Denis Cheng
*/
%{
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#include <locale.h>
#include <sys/utsname.h>
#include <sys/statvfs.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/wait.h>
#ifdef HAVE_LIBTECLA
#include <libtecla.h>
#endif
#include "parsertypes.h"
#include "filebench.h"
#include "utils.h"
#include "stats.h"
#include "vars.h"
#include "eventgen.h"
#ifdef HAVE_LIBTECLA
#include "auto_comp.h"
#endif
#include "multi_client_sync.h"
/* yacc and lex externals */
extern FILE *yyin;
extern int yydebug;
extern void yyerror(char *s);
extern int yylex(void);
/* GetLine resource object */
#ifdef HAVE_LIBTECLA
static GetLine *gl;
#endif
/* executable name to execute worker processes later */
char *execname;
static int dofile = DOFILE_FALSE;
static FILE *parentscript;
static char *fbbasepath = FILEBENCHDIR;
static char cwd[MAXPATHLEN];
static pidlist_t *pidlist;
static int filecreate_done;
/* utilities */
static cmd_t *alloc_cmd(void);
static attr_t *alloc_attr(void);
static attr_t *alloc_lvar_attr(var_t *var);
static attr_t *get_attr(cmd_t *cmd, int64_t name);
static attr_t *get_attr_fileset(cmd_t *cmd, int64_t name);
static attr_t *get_attr_integer(cmd_t *cmd, int64_t name);
static attr_t *get_attr_bool(cmd_t *cmd, int64_t name);
static void get_attr_lvars(cmd_t *cmd, flowop_t *flowop);
static list_t *alloc_list();
static probtabent_t *alloc_probtabent(void);
static void add_lvar_to_list(var_t *newlvar, var_t **lvar_list);
/* Info Commands */
static void parser_list(cmd_t *);
static void parser_flowop_list(cmd_t *);
/* Define Commands */
static void parser_proc_define(cmd_t *);
static void parser_thread_define(cmd_t *, procflow_t *, int instances);
static void parser_flowop_define(cmd_t *, threadflow_t *, flowop_t **, int);
static void parser_file_define(cmd_t *);
static void parser_fileset_define(cmd_t *);
static void parser_posset_define(cmd_t *);
static void parser_randvar_define(cmd_t *);
static void parser_randvar_set(cmd_t *);
static void parser_composite_flowop_define(cmd_t *);
/* Create Commands */
static void parser_proc_create(cmd_t *);
static void parser_fileset_create(cmd_t *);
/* set commands */
static void parser_set_integer(cmd_t *cmd);
static void parser_set_var(cmd_t *cmd);
static void parser_set_var_op_int(cmd_t *cmd);
static void parser_set_int_op_var(cmd_t *cmd);
static void parser_set_var_op_var(cmd_t *cmd);
/* Shutdown Commands */
static void parser_proc_shutdown(cmd_t *);
static void parser_filebench_shutdown(cmd_t *cmd);
static void parser_fileset_shutdown(cmd_t *cmd);
/* Other Commands */
static void parser_echo(cmd_t *cmd);
static void parser_foreach_integer(cmd_t *cmd);
static void parser_foreach_string(cmd_t *cmd);
static void parser_fscheck(cmd_t *cmd);
static void parser_fsflush(cmd_t *cmd);
static void parser_log(cmd_t *cmd);
static void parser_statscmd(cmd_t *cmd);
static void parser_statsdump(cmd_t *cmd);
static void parser_statsxmldump(cmd_t *cmd);
static void parser_statsmultidump(cmd_t *cmd);
static void parser_usage(cmd_t *cmd);
static void parser_vars(cmd_t *cmd);
static void parser_printvars(cmd_t *cmd);
static void parser_system(cmd_t *cmd);
static void parser_statssnap(cmd_t *cmd);
static void parser_directory(cmd_t *cmd);
static void parser_eventgen(cmd_t *cmd);
static void parser_enable_mc(cmd_t *cmd);
static void parser_domultisync(cmd_t *cmd);
static void parser_run(cmd_t *cmd);
static void parser_run_variable(cmd_t *cmd);
static void parser_sleep(cmd_t *cmd);
static void parser_sleep_variable(cmd_t *cmd);
static void parser_warmup(cmd_t *cmd);
static void parser_warmup_variable(cmd_t *cmd);
static void parser_help(cmd_t *cmd);
static void arg_parse(const char *command);
static void parser_abort(int arg);
static void parser_version(cmd_t *cmd);
static void parser_osprof_enable(cmd_t *cmd);
static void parser_osprof_disable(cmd_t *cmd);
%}
%union {
int64_t ival;
unsigned char bval;
char * sval;
fs_u val;
avd_t avd;
cmd_t *cmd;
attr_t *attr;
list_t *list;
probtabent_t *rndtb;
}
%start commands
%token FSC_LIST FSC_DEFINE FSC_EXEC FSC_QUIT FSC_DEBUG FSC_CREATE
%token FSC_SLEEP FSC_STATS FSC_FOREACH FSC_SET FSC_SHUTDOWN FSC_LOG
%token FSC_SYSTEM FSC_FLOWOP FSC_EVENTGEN FSC_ECHO FSC_LOAD FSC_RUN
%token FSC_WARMUP FSC_NOUSESTATS FSC_FSCHECK FSC_FSFLUSH
%token FSC_USAGE FSC_HELP FSC_VARS FSC_VERSION FSC_ENABLE FSC_DOMULTISYNC
%token FSV_STRING FSV_VAL_INT FSV_VAL_BOOLEAN FSV_VARIABLE FSV_WHITESTRING
%token FSV_RANDUNI FSV_RANDTAB FSV_RANDVAR FSV_URAND FSV_RAND48
%token FST_INT FST_BOOLEAN
%token FSE_FILE FSE_PROC FSE_THREAD FSE_CLEAR FSE_ALL FSE_SNAP FSE_DUMP
%token FSE_DIRECTORY FSE_COMMAND FSE_FILESET FSE_POSSET FSE_XMLDUMP FSE_RAND FSE_MODE
%token FSE_MULTI FSE_MULTIDUMP
%token FSK_SEPLST FSK_OPENLST FSK_CLOSELST FSK_ASSIGN FSK_IN FSK_QUOTE
%token FSK_DIRSEPLST FSK_PLUS FSK_MINUS FSK_MULTIPLY FSK_DIVIDE
%token FSA_SIZE FSA_PREALLOC FSA_PARALLOC FSA_PATH FSA_REUSE
%token FSA_PROCESS FSA_MEMSIZE FSA_RATE FSA_CACHED FSA_READONLY FSA_TRUSTTREE
%token FSA_IOSIZE FSA_FILE FSA_POSSET FSA_WSS FSA_NAME FSA_RANDOM FSA_INSTANCES
%token FSA_DSYNC FSA_TARGET FSA_ITERS FSA_NICE FSA_VALUE FSA_BLOCKING
%token FSA_HIGHWATER FSA_DIRECTIO FSA_DIRWIDTH FSA_FD FSA_SRCFD FSA_ROTATEFD
%token FSA_NAMELENGTH FSA_FILESIZE FSA_ENTRIES FSA_FILESIZEGAMMA FSA_DIRDEPTHRV
%token FSA_DIRGAMMA FSA_USEISM FSA_TYPE FSA_RANDTABLE FSA_RANDSRC FSA_RANDROUND
%token FSA_LEAFDIRS FSA_INDEXED FSA_FSTYPE
%token FSA_RANDSEED FSA_RANDGAMMA FSA_RANDMEAN FSA_RANDMIN FSA_RANDMAX FSA_MASTER
%token FSA_CLIENT
%token FSS_TYPE FSS_SEED FSS_GAMMA FSS_MEAN FSS_MIN FSS_SRC FSS_ROUND
%token FSV_SET_LOCAL_VAR FSA_LVAR_ASSIGN
%token FSA_ALLDONE FSA_FIRSTDONE FSA_TIMEOUT
%token FSC_OSPROF_ENABLE FSC_OSPROF_DISABLE
%token FSA_NOREADAHEAD
%token FSA_IOPRIO
%token FSA_WRITEONLY
%type <ival> FSV_VAL_INT
%type <bval> FSV_VAL_BOOLEAN
%type <sval> FSV_STRING
%type <sval> FSV_WHITESTRING
%type <sval> FSV_VARIABLE
%type <sval> FSV_RANDVAR
%type <sval> FSK_ASSIGN
%type <sval> FSV_SET_LOCAL_VAR
%type <ival> FSC_LIST FSC_DEFINE FSC_SET FSC_LOAD FSC_RUN FSC_ENABLE
%type <ival> FSC_DOMULTISYNC
%type <ival> FSE_FILE FSE_PROC FSE_THREAD FSE_CLEAR FSC_HELP FSC_VERSION
%type <sval> name
%type <ival> entity
%type <val> value
%type <cmd> command inner_commands load_command run_command list_command
%type <cmd> proc_define_command files_define_command posset_define_command randvar_define_command
%type <cmd> fo_define_command debug_command create_command
%type <cmd> sleep_command stats_command set_command shutdown_command
%type <cmd> foreach_command log_command system_command flowop_command
%type <cmd> eventgen_command quit_command flowop_list thread_list
%type <cmd> thread echo_command usage_command help_command vars_command
%type <cmd> version_command enable_command multisync_command
%type <cmd> warmup_command fscheck_command fsflush_command
%type <cmd> set_integer_command set_other_command
%type <cmd> osprof_enable_command osprof_disable_command
%type <attr> files_attr_op files_attr_ops posset_attr_ops posset_attr_op pt_attr_op pt_attr_ops
%type <attr> fo_attr_op fo_attr_ops ev_attr_op ev_attr_ops
%type <attr> randvar_attr_op randvar_attr_ops randvar_attr_typop
%type <attr> randvar_attr_srcop attr_value attr_list_value
%type <attr> comp_lvar_def comp_attr_op comp_attr_ops
%type <attr> enable_multi_ops enable_multi_op multisync_op
%type <attr> fscheck_attr_op
%type <list> integer_seplist string_seplist string_list var_string_list
%type <list> var_string whitevar_string whitevar_string_list
%type <ival> attrs_define_file attrs_define_thread attrs_flowop
%type <ival> attrs_define_fileset attrs_define_posset attrs_define_proc attrs_eventgen attrs_define_comp
%type <ival> files_attr_name posset_attr_name pt_attr_name fo_attr_name ev_attr_name
%type <ival> randvar_attr_name FSA_TYPE randtype_name randvar_attr_param
%type <ival> randsrc_name FSA_RANDSRC randvar_attr_tsp em_attr_name
%type <ival> FSS_TYPE FSS_SEED FSS_GAMMA FSS_MEAN FSS_MIN FSS_SRC
%type <ival> fscheck_attr_name FSA_FSTYPE binary_op
%type <rndtb> probtabentry_list probtabentry
%type <avd> var_int_val
%%
commands: commands command
{
if ($2->cmd != NULL)
$2->cmd($2);
free($2);
}
| commands error
{
if (dofile == DOFILE_TRUE)
YYABORT;
}
|;
inner_commands: command
{
filebench_log(LOG_DEBUG_IMPL, "inner_command %zx", $1);
$$ = $1;
}
| inner_commands command
{
cmd_t *list = NULL;
cmd_t *list_end = NULL;
/* Find end of list */
for (list = $1; list != NULL;
list = list->cmd_next)
list_end = list;
list_end->cmd_next = $2;
filebench_log(LOG_DEBUG_IMPL,
"inner_commands adding cmd %zx to list %zx", $2, $1);
$$ = $1;
};
command:
proc_define_command
| files_define_command
| posset_define_command
| randvar_define_command
| fo_define_command
| debug_command
| eventgen_command
| create_command
| echo_command
| usage_command
| vars_command
| foreach_command
| fscheck_command
| fsflush_command
| help_command
| list_command
| load_command
| log_command
| run_command
| set_command
| shutdown_command
| sleep_command
| warmup_command
| stats_command
| system_command
| version_command
| osprof_enable_command
| osprof_disable_command
| enable_command
| multisync_command
| quit_command;
foreach_command: FSC_FOREACH
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
filebench_log(LOG_DEBUG_IMPL, "foreach_command %zx", $$);
}
| foreach_command FSV_VARIABLE FSK_IN integer_seplist FSK_OPENLST inner_commands FSK_CLOSELST
{
cmd_t *inner_cmd;
list_t *list;
$$ = $1;
$$->cmd_list = $6;
$$->cmd_tgt1 = $2;
$$->cmd_param_list = $4;
$$->cmd = parser_foreach_integer;
for (list = $$->cmd_param_list; list != NULL;
list = list->list_next) {
for (inner_cmd = $$->cmd_list;
inner_cmd != NULL;
inner_cmd = inner_cmd->cmd_next) {
filebench_log(LOG_DEBUG_IMPL,
"packing foreach: %zx %s=%llu, cmd %zx",
$$, $$->cmd_tgt1,
(u_longlong_t)avd_get_int(list->list_integer),
inner_cmd);
}
}
}| foreach_command FSV_VARIABLE FSK_IN string_seplist FSK_OPENLST inner_commands FSK_CLOSELST
{
cmd_t *inner_cmd;
list_t *list;
$$ = $1;
$$->cmd_list = $6;
$$->cmd_tgt1 = $2;
$$->cmd_param_list = $4;
$$->cmd = parser_foreach_string;
for (list = $$->cmd_param_list; list != NULL;
list = list->list_next) {
for (inner_cmd = $$->cmd_list;
inner_cmd != NULL;
inner_cmd = inner_cmd->cmd_next) {
filebench_log(LOG_DEBUG_IMPL,
"packing foreach: %zx %s=%s, cmd %zx",
$$,
$$->cmd_tgt1,
*list->list_string, inner_cmd);
}
}
};
integer_seplist: FSV_VAL_INT
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_integer = avd_int_alloc($1);
}
| integer_seplist FSK_SEPLST FSV_VAL_INT
{
list_t *list = NULL;
list_t *list_end = NULL;
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_integer = avd_int_alloc($3);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
};
string_seplist: FSK_QUOTE FSV_WHITESTRING FSK_QUOTE
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
}
| string_seplist FSK_SEPLST FSK_QUOTE FSV_WHITESTRING FSK_QUOTE
{
list_t *list = NULL;
list_t *list_end = NULL;
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($4);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
};
eventgen_command: FSC_EVENTGEN
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_eventgen;
}
| eventgen_command ev_attr_ops
{
$1->cmd_attr_list = $2;
};
system_command: FSC_SYSTEM whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $2;
$$->cmd = parser_system;
};
echo_command: FSC_ECHO whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $2;
$$->cmd = parser_echo;
};
version_command: FSC_VERSION
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_version;
};
osprof_enable_command: FSC_OSPROF_ENABLE
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_osprof_enable;
};
osprof_disable_command: FSC_OSPROF_DISABLE
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_osprof_disable;
};
usage_command: FSC_USAGE whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $2;
$$->cmd = parser_usage;
};
vars_command: FSC_VARS
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_printvars;
};
enable_command: FSC_ENABLE FSE_MULTI
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_enable_mc;
}
| enable_command enable_multi_ops
{
$1->cmd_attr_list = $2;
};
multisync_command: FSC_DOMULTISYNC multisync_op
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_domultisync;
$$->cmd_attr_list = $2;
}
string_list: FSV_VARIABLE
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($1);
}
| string_list FSK_SEPLST FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($3);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
};
var_string: FSV_VARIABLE
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($1);
}
| FSV_STRING
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($1);
};
var_string_list: var_string
{
$$ = $1;
}| var_string FSV_STRING
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add string */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| var_string FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
} |var_string_list FSV_STRING
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add string */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| var_string_list FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
};
whitevar_string: FSK_QUOTE FSV_VARIABLE
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
}
| FSK_QUOTE FSV_WHITESTRING
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
};
whitevar_string_list: whitevar_string FSV_WHITESTRING
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add string */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string FSV_RANDVAR randvar_attr_tsp
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
$$->list_integer = avd_int_alloc($3);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSV_WHITESTRING
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add string */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSV_RANDVAR randvar_attr_tsp
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
$$->list_integer = avd_int_alloc($3);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSK_QUOTE
{
$$ = $1;
}| whitevar_string FSK_QUOTE
{
$$ = $1;
};
list_command: FSC_LIST
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_list;
}
| list_command FSC_FLOWOP
{
$1->cmd = &parser_flowop_list;
};
fscheck_command: FSC_FSCHECK fscheck_attr_op
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_fscheck;
$$->cmd_attr_list = $2;
}
| fscheck_command fscheck_attr_op
{
$1->cmd_attr_list->attr_next = $2;
};
fsflush_command: FSC_FSFLUSH fscheck_attr_op
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_fsflush;
$$->cmd_attr_list = $2;
};
log_command: FSC_LOG whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_log;
$$->cmd_param_list = $2;
};
debug_command: FSC_DEBUG FSV_VAL_INT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = NULL;
filebench_shm->shm_debug_level = $2;
if (filebench_shm->shm_debug_level > 9)
yydebug = 1;
};
set_command:
set_integer_command
| set_other_command;
set_integer_command: FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_VAL_INT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_tgt1 = $2;
$$->cmd_qty = $4;
if (parentscript) {
parser_vars($$);
}
$$->cmd = parser_set_integer;
}| FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_VARIABLE
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
var_assign_var($2, $4);
$$->cmd_tgt1 = $2;
$$->cmd_tgt2 = $4;
if (parentscript) {
parser_vars($$);
}
$$->cmd = parser_set_var;
}
| set_integer_command binary_op FSV_VAL_INT
{
if ($1->cmd == parser_set_integer) {
switch ($2) {
case FSK_PLUS:
var_assign_integer($1->cmd_tgt1, $1->cmd_qty + $3);
break;
case FSK_MINUS:
var_assign_integer($1->cmd_tgt1, $1->cmd_qty - $3);
break;
case FSK_MULTIPLY:
var_assign_integer($1->cmd_tgt1, $1->cmd_qty * $3);
break;
case FSK_DIVIDE:
var_assign_integer($1->cmd_tgt1, $1->cmd_qty / $3);
break;
}
$$->cmd = NULL;
} else {
$1->cmd_qty = $3;
$1->cmd_subtype = $2;
$1->cmd = parser_set_var_op_int;
}
}
| set_integer_command binary_op FSV_VARIABLE
{
$1->cmd_tgt3 = $3;
$1->cmd_subtype = $2;
if ($1->cmd == parser_set_integer) {
$$->cmd = parser_set_int_op_var;
} else {
$1->cmd = parser_set_var_op_var;
}
};
set_other_command: FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_VAL_BOOLEAN
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
var_assign_boolean($2, $4);
if (parentscript) {
$$->cmd_tgt1 = $2;
parser_vars($$);
}
$$->cmd = NULL;
}
| FSC_SET FSV_VARIABLE FSK_ASSIGN FSK_QUOTE FSV_WHITESTRING FSK_QUOTE
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
var_assign_string($2, $5);
if (parentscript) {
$$->cmd_tgt1 = $2;
parser_vars($$);
}
$$->cmd = NULL;
}| FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_STRING
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
var_assign_string($2, $4);
if (parentscript) {
$$->cmd_tgt1 = $2;
parser_vars($$);
}
$$->cmd = NULL;
} | FSC_SET FSE_MODE FSC_QUIT FSA_TIMEOUT
{
filebench_shm->shm_rmode = FILEBENCH_MODE_TIMEOUT;
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = NULL;
} | FSC_SET FSE_MODE FSC_QUIT FSA_ALLDONE
{
filebench_shm->shm_rmode = FILEBENCH_MODE_QALLDONE;
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = NULL;
} | FSC_SET FSE_MODE FSC_QUIT FSA_FIRSTDONE
{
filebench_shm->shm_rmode = FILEBENCH_MODE_Q1STDONE;
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = NULL;
} | FSC_SET FSE_MODE FSC_NOUSESTATS
{
filebench_shm->shm_mmode |= FILEBENCH_MODE_NOUSAGE;
filebench_log(LOG_INFO, "disabling CPU usage statistics");
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = NULL;
} | FSC_SET FSV_RANDVAR FSS_TYPE FSK_ASSIGN randvar_attr_typop
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_randvar_set;
$$->cmd_tgt1 = $2;
$$->cmd_qty = FSS_TYPE;
$$->cmd_attr_list = $5;
} | FSC_SET FSV_RANDVAR FSS_SRC FSK_ASSIGN randvar_attr_srcop
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_randvar_set;
$$->cmd_tgt1 = $2;
$$->cmd_qty = FSS_SRC;
$$->cmd_attr_list = $5;
} | FSC_SET FSV_RANDVAR randvar_attr_param FSK_ASSIGN attr_value
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_randvar_set;
$$->cmd_tgt1 = $2;
$$->cmd_qty = $3;
$$->cmd_attr_list = $5;
};
stats_command: FSC_STATS FSE_SNAP
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = (void (*)(struct cmd *))&parser_statssnap;
break;
}
| FSC_STATS FSE_CLEAR
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = (void (*)(struct cmd *))&stats_clear;
}
| FSC_STATS FSE_DIRECTORY var_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $3;
$$->cmd = (void (*)(struct cmd *))&parser_directory;
}
| FSC_STATS FSE_COMMAND whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $3;
$$->cmd = parser_statscmd;
}| FSC_STATS FSE_DUMP whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $3;
$$->cmd = parser_statsdump;
}| FSC_STATS FSE_XMLDUMP whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;