Date: Wed, 14 Nov 2007 02:45:24 GMT From: Zhouyi ZHOU <zhouzhouyi@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 129047 for review Message-ID: <200711140245.lAE2jOH1095758@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=129047 Change 129047 by zhouzhouyi@zhouzhouyi_mactest on 2007/11/14 02:44:25 Reformat the log adapting the MAC Framework change Affected files ... .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactestparser.tab.c#3 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactestparser.y#4 edit .. //depot/projects/soc2007/zhouzhouyi_mactest_soc/sys/security/mac_test/mac_test.c#11 edit Differences ... ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactestparser.tab.c#3 (text+ko) ==== @@ -52,14 +52,12 @@ enum yytokentype { PID = 258, IDENTIFIER = 259, - NUM = 260, - MAC_TEST = 261 + NUM = 260 }; #endif #define PID 258 #define IDENTIFIER 259 #define NUM 260 -#define MAC_TEST 261 @@ -114,8 +112,8 @@ #line 34 "mactestparser.y" typedef union {long itype; char * namestring; struct mactestlog_record * mtpipetype; struct labelstrings * lstype; struct modes_or_flags * mftype;} yystype; -/* Line 188 of /usr/local/share/bison/yacc.c. */ -#line 119 "mactestparser.tab.c" +/* Line 193 of /usr/local/share/bison/yacc.c. */ +#line 117 "mactestparser.tab.c" # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif @@ -136,7 +134,7 @@ /* Line 213 of /usr/local/share/bison/yacc.c. */ -#line 140 "mactestparser.tab.c" +#line 138 "mactestparser.tab.c" #if ! defined (yyoverflow) || YYERROR_VERBOSE @@ -234,20 +232,20 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 -#define YYLAST 31 +#define YYLAST 18 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 11 +#define YYNTOKENS 9 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 11 +#define YYNNTS 8 /* YYNRULES -- Number of rules. */ -#define YYNRULES 23 +#define YYNRULES 15 /* YYNRULES -- Number of states. */ -#define YYNSTATES 33 +#define YYNSTATES 22 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 261 +#define YYMAXUTOK 260 #define YYTRANSLATE(X) \ ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) @@ -256,12 +254,12 @@ static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 7, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 9, 2, - 2, 7, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 8, 2, + 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -281,7 +279,7 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6 + 5 }; #if YYDEBUG @@ -289,30 +287,25 @@ YYRHS. */ static const unsigned char yyprhs[] = { - 0, 0, 3, 4, 6, 8, 11, 14, 20, 27, - 34, 36, 38, 41, 44, 47, 50, 53, 56, 59, - 62, 65, 67, 69 + 0, 0, 3, 4, 6, 8, 11, 14, 20, 21, + 30, 32, 34, 37, 40, 42 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { - 12, 0, -1, -1, 13, -1, 14, -1, 13, 14, - -1, 13, 1, -1, 3, 7, 21, 15, 8, -1, - 3, 7, 21, 15, 16, 8, -1, 3, 7, 21, - 15, 17, 8, -1, 8, -1, 20, -1, 15, 19, - -1, 15, 1, -1, 9, 19, -1, 16, 19, -1, - 16, 1, -1, 18, 16, -1, 10, 19, -1, 18, - 19, -1, 18, 1, -1, 4, -1, 6, -1, 5, - -1 + 10, 0, -1, -1, 11, -1, 12, -1, 11, 12, + -1, 11, 1, -1, 3, 6, 16, 15, 7, -1, + -1, 3, 6, 16, 15, 13, 8, 14, 7, -1, + 7, -1, 15, -1, 14, 15, -1, 14, 1, -1, + 4, -1, 5, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned char yyrline[] = { - 0, 53, 53, 55, 59, 61, 62, 65, 67, 69, - 71, 74, 76, 77, 80, 82, 83, 86, 90, 92, - 93, 96, 99, 102 + 0, 48, 48, 50, 54, 56, 57, 60, 62, 62, + 64, 67, 69, 70, 75, 78 }; #endif @@ -321,11 +314,9 @@ First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "PID", "IDENTIFIER", "NUM", "MAC_TEST", - "'='", "'\\n'", "':'", "'#'", "$accept", "program", - "mactestlog_records", "mactestlog_record", "hook_elements", - "label_elements", "modflag_and_label_elements", "modflag_elements", - "identifier", "mac_test", "pid", 0 + "$end", "error", "$undefined", "PID", "IDENTIFIER", "NUM", "'='", "'\\n'", + "':'", "$accept", "program", "mactestlog_records", "mactestlog_record", + "@1", "label_elements", "identifier", "pid", 0 }; #endif @@ -334,25 +325,22 @@ token YYLEX-NUM. */ static const unsigned short yytoknum[] = { - 0, 256, 257, 258, 259, 260, 261, 61, 10, 58, - 35 + 0, 256, 257, 258, 259, 260, 61, 10, 58 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 11, 12, 12, 13, 13, 13, 14, 14, 14, - 14, 15, 15, 15, 16, 16, 16, 17, 18, 18, - 18, 19, 20, 21 + 0, 9, 10, 10, 11, 11, 11, 12, 13, 12, + 12, 14, 14, 14, 15, 16 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { - 0, 2, 0, 1, 1, 2, 2, 5, 6, 6, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 1, 1, 1 + 0, 2, 0, 1, 1, 2, 2, 5, 0, 8, + 1, 1, 2, 2, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -361,65 +349,56 @@ static const unsigned char yydefact[] = { 2, 0, 10, 0, 0, 4, 0, 1, 6, 5, - 23, 0, 22, 0, 11, 13, 21, 7, 0, 0, - 0, 0, 0, 12, 14, 18, 16, 8, 15, 9, - 20, 0, 19 + 15, 0, 14, 8, 7, 0, 0, 0, 11, 13, + 9, 12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { - -1, 3, 4, 5, 13, 20, 21, 22, 28, 14, - 11 + -1, 3, 4, 5, 15, 17, 13, 11 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -9 +#define YYPACT_NINF -6 static const yysigned_char yypact[] = { - -2, -5, -9, 4, 12, -9, 23, -9, -9, -9, - -9, 11, -9, -1, -9, -9, -9, -9, 18, 18, - 17, 19, 15, -9, -9, -9, -9, -9, -9, -9, - -9, 22, -9 + 3, -2, -6, 9, 0, -6, 8, -6, -6, -6, + -6, 10, -6, 11, -6, 7, 10, 1, -6, -6, + -6, -6 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { - -9, -9, -9, 25, -9, 9, -9, -9, -8, -9, - -9 + -6, -6, -6, 12, -6, -6, -5, -6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, parse error. */ -#define YYTABLE_NINF -18 +#define YYTABLE_NINF -4 static const yysigned_char yytable[] = { - 15, 1, 6, 16, 7, 23, 2, 17, 18, 19, - 24, 25, -3, 8, 32, 1, 30, 12, 26, 16, - 2, 16, 16, 26, 18, 27, 16, 29, 10, 9, - -17, 31 + -3, 8, 19, 1, 6, 12, 1, 2, 20, 7, + 2, 18, 21, 10, 12, 16, 9, 0, 14 }; -static const unsigned char yycheck[] = +static const yysigned_char yycheck[] = { - 1, 3, 7, 4, 0, 13, 8, 8, 9, 10, - 18, 19, 0, 1, 22, 3, 1, 6, 1, 4, - 8, 4, 4, 1, 9, 8, 4, 8, 5, 4, - 8, 22 + 0, 1, 1, 3, 6, 4, 3, 7, 7, 0, + 7, 16, 17, 5, 4, 8, 4, -1, 7 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 3, 8, 12, 13, 14, 7, 0, 1, 14, - 5, 21, 6, 15, 20, 1, 4, 8, 9, 10, - 16, 17, 18, 19, 19, 19, 1, 8, 19, 8, - 1, 16, 19 + 0, 3, 7, 10, 11, 12, 6, 0, 1, 12, + 5, 16, 4, 15, 7, 13, 8, 14, 15, 1, + 7, 15 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -970,79 +949,53 @@ switch (yyn) { case 4: -#line 60 "mactestparser.y" +#line 55 "mactestparser.y" {inserttail_mactestlog_record_chain(yyvsp[0].mtpipetype);} break; case 5: -#line 61 "mactestparser.y" +#line 56 "mactestparser.y" {inserttail_mactestlog_record_chain(yyvsp[0].mtpipetype);} break; case 7: -#line 66 "mactestparser.y" +#line 61 "mactestparser.y" {yyval.mtpipetype = new_mactestlog_record(strdup(yyvsp[-1].namestring), yyvsp[-2].itype);} break; case 8: -#line 67 "mactestparser.y" - { - yyval.mtpipetype = new_mactestlog_record(stringsave, yyvsp[-3].itype);stringsave = 0;} +#line 62 "mactestparser.y" + {stringsave = strdup(yyvsp[0].namestring);} break; case 9: -#line 69 "mactestparser.y" +#line 62 "mactestparser.y" { - yyval.mtpipetype = new_mactestlog_record(stringsave, yyvsp[-3].itype);stringsave = 0;} + yyval.mtpipetype = new_mactestlog_record(stringsave, yyvsp[-5].itype);stringsave = 0;} break; case 10: -#line 71 "mactestparser.y" +#line 64 "mactestparser.y" {yyval.mtpipetype = 0;} break; case 11: -#line 75 "mactestparser.y" - {stringsave = strdup(yyvsp[0].namestring);} +#line 68 "mactestparser.y" + { new_labelstrings(strdup(yyvsp[0].namestring));} break; case 12: -#line 76 "mactestparser.y" - {} +#line 69 "mactestparser.y" + { new_labelstrings(strdup(yyvsp[0].namestring));} break; case 14: -#line 81 "mactestparser.y" - { new_labelstrings(strdup(yyvsp[0].namestring));} +#line 76 "mactestparser.y" + {} break; case 15: -#line 82 "mactestparser.y" - { new_labelstrings(strdup(yyvsp[0].namestring));} - break; - - case 18: -#line 91 "mactestparser.y" - { new_modes_or_flags(strdup(yyvsp[0].namestring));} - break; - - case 19: -#line 92 "mactestparser.y" - { new_modes_or_flags(strdup(yyvsp[0].namestring));} - break; - - case 21: -#line 97 "mactestparser.y" - {} - break; - - case 22: -#line 100 "mactestparser.y" - {} - break; - - case 23: -#line 103 "mactestparser.y" +#line 79 "mactestparser.y" {} break; @@ -1050,7 +1003,7 @@ } /* Line 1016 of /usr/local/share/bison/yacc.c. */ -#line 1054 "mactestparser.tab.c" +#line 1007 "mactestparser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -1269,7 +1222,7 @@ } -#line 108 "mactestparser.y" +#line 84 "mactestparser.y" int @@ -1370,8 +1323,6 @@ if (!strcmp(buf, "=")) return '='; - if (!strncmp(buf, "mac_test", 8)) - return MAC_TEST; return IDENTIFIER; } @@ -1391,7 +1342,6 @@ new->labelstring = labelstring; new->next = 0; new->prev = 0; - if (labelstring_chain == 0){ labelstring_chain = new; return; ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactestparser.y#4 (text+ko) ==== @@ -37,15 +37,10 @@ %token PID %token IDENTIFIER %token NUM -%token MAC_TEST %type <namestring> identifier -%type <namestring> mac_test %type <mtpipetype> mactestlog_records %type <mtpipetype> mactestlog_record -%type <namestring> hook_elements %type <itype> label_elements -%type <itype> modflag_elements -%type <itype> modflag_and_label_elements %type <itype> pid %% /* Grammar rules and actions follow. */ @@ -63,42 +58,23 @@ ; mactestlog_record: - PID '=' pid hook_elements '\n' {$$ = new_mactestlog_record(strdup($4), $3);} - |PID '=' pid hook_elements label_elements '\n' { + PID '=' pid identifier '\n' {$$ = new_mactestlog_record(strdup($4), $3);} + |PID '=' pid identifier {stringsave = strdup($4);} ':' label_elements '\n' { $$ = new_mactestlog_record(stringsave, $3);stringsave = 0;} - |PID '=' pid hook_elements modflag_and_label_elements '\n' { - $$ = new_mactestlog_record(stringsave, $3);stringsave = 0;} |'\n' {$$ = 0;} ; -hook_elements: - mac_test {stringsave = strdup($1);} - |hook_elements identifier {} - |hook_elements error - ; - label_elements: - ':' identifier { new_labelstrings(strdup($2));} + identifier { new_labelstrings(strdup($1));} |label_elements identifier { new_labelstrings(strdup($2));} |label_elements error ; -modflag_and_label_elements: - modflag_elements label_elements - ; -modflag_elements: - '#' identifier { new_modes_or_flags(strdup($2));} - |modflag_elements identifier { new_modes_or_flags(strdup($2));} - |modflag_elements error - ; identifier: IDENTIFIER {} ; -mac_test: - MAC_TEST {} - ; pid: NUM {} ; @@ -205,8 +181,6 @@ if (!strcmp(buf, "=")) return '='; - if (!strncmp(buf, "mac_test", 8)) - return MAC_TEST; return IDENTIFIER; } @@ -226,7 +200,6 @@ new->labelstring = labelstring; new->next = 0; new->prev = 0; - if (labelstring_chain == 0){ labelstring_chain = new; return; ==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/sys/security/mac_test/mac_test.c#11 (text+ko) ==== @@ -118,14 +118,18 @@ char *currentchar; \ char *element1; \ char *buffer1; \ + char *submitbuffer; \ + int havelabel = 0; \ int error; \ struct thread *td1 = curthread; \ volatile int badmem = 0; \ error = 0; \ - buffer = malloc(1024, M_MAC_TEST_LOG, M_NOWAIT); \ + buffer = malloc(2048, M_MAC_TEST_LOG, M_NOWAIT); \ if (!buffer) \ badmem = 1; \ + bzero(buffer, 2048); \ element1 = buffer + 512; buffer1 = element1 + 256; \ + submitbuffer = buffer + 1024; \ /*element1 and buffer1 will not be used if badmem == 1*/ \ currentchar = buffer; @@ -137,10 +141,13 @@ #define COUNTER_INC(variable) do { \ atomic_add_int(&counter_##variable, 1); \ if (!badmem) { \ - strcpy(currentchar, #variable); \ - currentchar += strlen(currentchar); \ - sprintf(currentchar, "#pid = %d\n", td1->td_proc->p_pid);\ - mac_test_log_submit(buffer, strlen(buffer)); \ + if (havelabel) \ + sprintf(submitbuffer,"pid = %d %s:%s\n", \ + td1->td_proc->p_pid, #variable, buffer);\ + else \ + sprintf(submitbuffer,"pid = %d %s\n", \ + td1->td_proc->p_pid, #variable); \ + mac_test_log_submit(submitbuffer, strlen(submitbuffer));\ free(buffer, M_MAC_TEST_LOG); \ } \ } while (0) @@ -167,6 +174,7 @@ strcpy(buffer1,"NULL"); \ sprintf(currentchar, "%s ", buffer1); \ currentchar += strlen(currentchar); \ + havelabel = 1; \ } \ } while (0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711140245.lAE2jOH1095758>