@@ -54,19 +54,26 @@ static int show_warning = 1;
5454 warning(fmt, ##__VA_ARGS__); \
5555 } while (0)
5656
57- static void init_input_buf (const char * buf , unsigned long long size )
57+ /**
58+ * init_input_buf - init buffer for parsing
59+ * @buf: buffer to parse
60+ * @size: the size of the buffer
61+ *
62+ * Initializes the internal buffer that tep_read_token() will parse.
63+ */
64+ __hidden void init_input_buf (const char * buf , unsigned long long size )
5865{
5966 input_buf = buf ;
6067 input_buf_siz = size ;
6168 input_buf_ptr = 0 ;
6269}
6370
64- const char * tep_get_input_buf (void )
71+ __hidden const char * get_input_buf (void )
6572{
6673 return input_buf ;
6774}
6875
69- unsigned long long tep_get_input_buf_ptr (void )
76+ __hidden unsigned long long get_input_buf_ptr (void )
7077{
7178 return input_buf_ptr ;
7279}
@@ -100,26 +107,13 @@ process_defined_func(struct trace_seq *s, void *data, int size,
100107
101108static void free_func_handle (struct tep_function_handler * func );
102109
103- /**
104- * tep_buffer_init - init buffer for parsing
105- * @buf: buffer to parse
106- * @size: the size of the buffer
107- *
108- * For use with tep_read_token(), this initializes the internal
109- * buffer that tep_read_token() will parse.
110- */
111- void tep_buffer_init (const char * buf , unsigned long long size )
112- {
113- init_input_buf (buf , size );
114- }
115-
116110void breakpoint (void )
117111{
118112 static int x ;
119113 x ++ ;
120114}
121115
122- struct tep_print_arg * alloc_arg (void )
116+ static struct tep_print_arg * alloc_arg (void )
123117{
124118 return calloc (1 , sizeof (struct tep_print_arg ));
125119}
@@ -962,22 +956,17 @@ static int __read_char(void)
962956 return input_buf [input_buf_ptr ++ ];
963957}
964958
965- static int __peek_char (void )
966- {
967- if (input_buf_ptr >= input_buf_siz )
968- return -1 ;
969-
970- return input_buf [input_buf_ptr ];
971- }
972-
973959/**
974- * tep_peek_char - peek at the next character that will be read
960+ * peek_char - peek at the next character that will be read
975961 *
976962 * Returns the next character read, or -1 if end of buffer.
977963 */
978- int tep_peek_char (void )
964+ __hidden int peek_char (void )
979965{
980- return __peek_char ();
966+ if (input_buf_ptr >= input_buf_siz )
967+ return -1 ;
968+
969+ return input_buf [input_buf_ptr ];
981970}
982971
983972static int extend_token (char * * tok , char * buf , int size )
@@ -1033,7 +1022,7 @@ static enum tep_event_type __read_token(char **tok)
10331022 case TEP_EVENT_OP :
10341023 switch (ch ) {
10351024 case '-' :
1036- next_ch = __peek_char ();
1025+ next_ch = peek_char ();
10371026 if (next_ch == '>' ) {
10381027 buf [i ++ ] = __read_char ();
10391028 break ;
@@ -1045,7 +1034,7 @@ static enum tep_event_type __read_token(char **tok)
10451034 case '>' :
10461035 case '<' :
10471036 last_ch = ch ;
1048- ch = __peek_char ();
1037+ ch = peek_char ();
10491038 if (ch != last_ch )
10501039 goto test_equal ;
10511040 buf [i ++ ] = __read_char ();
@@ -1068,7 +1057,7 @@ static enum tep_event_type __read_token(char **tok)
10681057 return type ;
10691058
10701059 test_equal :
1071- ch = __peek_char ();
1060+ ch = peek_char ();
10721061 if (ch == '=' )
10731062 buf [i ++ ] = __read_char ();
10741063 goto out ;
@@ -1122,7 +1111,7 @@ static enum tep_event_type __read_token(char **tok)
11221111 break ;
11231112 }
11241113
1125- while (get_type (__peek_char ()) == type ) {
1114+ while (get_type (peek_char ()) == type ) {
11261115 if (i == (BUFSIZ - 1 )) {
11271116 buf [i ] = 0 ;
11281117 tok_size += BUFSIZ ;
@@ -1191,13 +1180,26 @@ static enum tep_event_type force_token(const char *str, char **tok)
11911180 return type ;
11921181}
11931182
1194- static void free_token (char * tok )
1183+ /**
1184+ * free_token - free a token returned by tep_read_token
1185+ * @token: the token to free
1186+ */
1187+ __hidden void free_token (char * tok )
11951188{
11961189 if (tok )
11971190 free (tok );
11981191}
11991192
1200- static enum tep_event_type read_token (char * * tok )
1193+ /**
1194+ * read_token - access to utilities to use the tep parser
1195+ * @tok: The token to return
1196+ *
1197+ * This will parse tokens from the string given by
1198+ * tep_init_data().
1199+ *
1200+ * Returns the token type.
1201+ */
1202+ __hidden enum tep_event_type read_token (char * * tok )
12011203{
12021204 enum tep_event_type type ;
12031205
@@ -1214,29 +1216,6 @@ static enum tep_event_type read_token(char **tok)
12141216 return TEP_EVENT_NONE ;
12151217}
12161218
1217- /**
1218- * tep_read_token - access to utilities to use the tep parser
1219- * @tok: The token to return
1220- *
1221- * This will parse tokens from the string given by
1222- * tep_init_data().
1223- *
1224- * Returns the token type.
1225- */
1226- enum tep_event_type tep_read_token (char * * tok )
1227- {
1228- return read_token (tok );
1229- }
1230-
1231- /**
1232- * tep_free_token - free a token returned by tep_read_token
1233- * @token: the token to free
1234- */
1235- void tep_free_token (char * token )
1236- {
1237- free_token (token );
1238- }
1239-
12401219/* no newline */
12411220static enum tep_event_type read_token_item (char * * tok )
12421221{
@@ -3459,12 +3438,12 @@ unsigned long long tep_read_number(struct tep_handle *tep,
34593438 case 1 :
34603439 return * (unsigned char * )ptr ;
34613440 case 2 :
3462- return tep_data2host2 (tep , * (unsigned short * )ptr );
3441+ return data2host2 (tep , * (unsigned short * )ptr );
34633442 case 4 :
3464- return tep_data2host4 (tep , * (unsigned int * )ptr );
3443+ return data2host4 (tep , * (unsigned int * )ptr );
34653444 case 8 :
34663445 memcpy (& val , (ptr ), sizeof (unsigned long long ));
3467- return tep_data2host8 (tep , val );
3446+ return data2host8 (tep , val );
34683447 default :
34693448 /* BUG! */
34703449 return 0 ;
@@ -4190,7 +4169,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
41904169 f = tep_find_any_field (event , arg -> string .string );
41914170 arg -> string .offset = f -> offset ;
41924171 }
4193- str_offset = tep_data2host4 (tep , * (unsigned int * )(data + arg -> string .offset ));
4172+ str_offset = data2host4 (tep , * (unsigned int * )(data + arg -> string .offset ));
41944173 str_offset &= 0xffff ;
41954174 print_str_to_seq (s , format , len_arg , ((char * )data ) + str_offset );
41964175 break ;
@@ -4208,7 +4187,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
42084187 f = tep_find_any_field (event , arg -> bitmask .bitmask );
42094188 arg -> bitmask .offset = f -> offset ;
42104189 }
4211- bitmask_offset = tep_data2host4 (tep , * (unsigned int * )(data + arg -> bitmask .offset ));
4190+ bitmask_offset = data2host4 (tep , * (unsigned int * )(data + arg -> bitmask .offset ));
42124191 bitmask_size = bitmask_offset >> 16 ;
42134192 bitmask_offset &= 0xffff ;
42144193 print_bitmask_to_seq (tep , s , format , len_arg ,
@@ -6750,7 +6729,7 @@ static int find_event_handle(struct tep_handle *tep, struct tep_event *event)
67506729}
67516730
67526731/**
6753- * __tep_parse_format - parse the event format
6732+ * parse_format - parse the event format
67546733 * @buf: the buffer storing the event format string
67556734 * @size: the size of @buf
67566735 * @sys: the system the event belongs to
@@ -6762,9 +6741,9 @@ static int find_event_handle(struct tep_handle *tep, struct tep_event *event)
67626741 *
67636742 * /sys/kernel/debug/tracing/events/.../.../format
67646743 */
6765- enum tep_errno __tep_parse_format (struct tep_event * * eventp ,
6766- struct tep_handle * tep , const char * buf ,
6767- unsigned long size , const char * sys )
6744+ static enum tep_errno parse_format (struct tep_event * * eventp ,
6745+ struct tep_handle * tep , const char * buf ,
6746+ unsigned long size , const char * sys )
67686747{
67696748 struct tep_event * event ;
67706749 int ret ;
@@ -6879,7 +6858,7 @@ __parse_event(struct tep_handle *tep,
68796858 const char * buf , unsigned long size ,
68806859 const char * sys )
68816860{
6882- int ret = __tep_parse_format (eventp , tep , buf , size , sys );
6861+ int ret = parse_format (eventp , tep , buf , size , sys );
68836862 struct tep_event * event = * eventp ;
68846863
68856864 if (event == NULL )
@@ -6897,7 +6876,7 @@ __parse_event(struct tep_handle *tep,
68976876 return 0 ;
68986877
68996878event_add_failed :
6900- tep_free_event (event );
6879+ free_tep_event (event );
69016880 return ret ;
69026881}
69036882
@@ -7490,7 +7469,7 @@ int tep_get_ref(struct tep_handle *tep)
74907469 return 0 ;
74917470}
74927471
7493- void tep_free_format_field (struct tep_format_field * field )
7472+ __hidden void free_tep_format_field (struct tep_format_field * field )
74947473{
74957474 free (field -> type );
74967475 if (field -> alias != field -> name )
@@ -7505,7 +7484,7 @@ static void free_format_fields(struct tep_format_field *field)
75057484
75067485 while (field ) {
75077486 next = field -> next ;
7508- tep_free_format_field (field );
7487+ free_tep_format_field (field );
75097488 field = next ;
75107489 }
75117490}
@@ -7516,7 +7495,7 @@ static void free_formats(struct tep_format *format)
75167495 free_format_fields (format -> fields );
75177496}
75187497
7519- void tep_free_event (struct tep_event * event )
7498+ __hidden void free_tep_event (struct tep_event * event )
75207499{
75217500 free (event -> name );
75227501 free (event -> system );
@@ -7602,7 +7581,7 @@ void tep_free(struct tep_handle *tep)
76027581 }
76037582
76047583 for (i = 0 ; i < tep -> nr_events ; i ++ )
7605- tep_free_event (tep -> events [i ]);
7584+ free_tep_event (tep -> events [i ]);
76067585
76077586 while (tep -> handlers ) {
76087587 handle = tep -> handlers ;
@@ -7613,7 +7592,7 @@ void tep_free(struct tep_handle *tep)
76137592 free (tep -> events );
76147593 free (tep -> sort_events );
76157594 free (tep -> func_resolver );
7616- tep_free_plugin_paths (tep );
7595+ free_tep_plugin_paths (tep );
76177596
76187597 free (tep );
76197598}
0 commit comments