Lines Matching refs:field

716 		free(arg->field.name);
719 free_arg(arg->flags.field);
724 free_arg(arg->symbol.field);
728 free_arg(arg->hex.field);
1199 static int field_is_string(struct format_field *field)
1201 if ((field->flags & FIELD_IS_ARRAY) &&
1202 (strstr(field->type, "char") || strstr(field->type, "u8") ||
1203 strstr(field->type, "s8")))
1209 static int field_is_dynamic(struct format_field *field)
1211 if (strncmp(field->type, "__data_loc", 10) == 0)
1217 static int field_is_long(struct format_field *field)
1220 if (strstr(field->type, "long"))
1256 struct format_field *field = NULL;
1273 if (test_type_token(type, token, EVENT_ITEM, "field"))
1297 field = calloc(1, sizeof(*field));
1298 if (!field)
1301 field->event = event;
1316 field->flags |= FIELD_IS_POINTER;
1318 if (field->type) {
1320 new_type = realloc(field->type,
1321 strlen(field->type) +
1327 field->type = new_type;
1328 strcat(field->type, " ");
1329 strcat(field->type, last_token);
1332 field->type = last_token;
1340 if (!field->type) {
1344 field->name = last_token;
1355 field->flags |= FIELD_IS_ARRAY;
1360 field->arraylen = strtoul(token, NULL, 0);
1362 field->arraylen = 0;
1384 field->arraylen = strtoul(token, NULL, 0);
1412 new_type = realloc(field->type,
1413 strlen(field->type) +
1414 strlen(field->name) +
1420 field->type = new_type;
1421 strcat(field->type, " ");
1422 strcat(field->type, field->name);
1423 size_dynamic = type_size(field->name);
1424 free_token(field->name);
1425 strcat(field->type, brackets);
1426 field->name = token;
1430 new_type = realloc(field->type,
1431 strlen(field->type) +
1437 field->type = new_type;
1438 strcat(field->type, brackets);
1443 if (field_is_string(field))
1444 field->flags |= FIELD_IS_STRING;
1445 if (field_is_dynamic(field))
1446 field->flags |= FIELD_IS_DYNAMIC;
1447 if (field_is_long(field))
1448 field->flags |= FIELD_IS_LONG;
1462 field->offset = strtoul(token, NULL, 0);
1476 field->size = strtoul(token, NULL, 0);
1497 field->flags |= FIELD_IS_SIGNED;
1509 if (field->flags & FIELD_IS_ARRAY) {
1510 if (field->arraylen)
1511 field->elementsize = field->size / field->arraylen;
1512 else if (field->flags & FIELD_IS_DYNAMIC)
1513 field->elementsize = size_dynamic;
1514 else if (field->flags & FIELD_IS_STRING)
1515 field->elementsize = 1;
1516 else if (field->flags & FIELD_IS_LONG)
1517 field->elementsize = event->pevent ?
1521 field->elementsize = field->size;
1523 *fields = field;
1524 fields = &field->next;
1533 if (field) {
1534 free(field->type);
1535 free(field->name);
1536 free(field);
1931 char *field;
1939 field = token;
1942 arg->field.name = field;
1945 arg->field.field = pevent_find_any_field(event, arg->field.name);
1946 arg->field.field->flags |= FIELD_IS_FLAG;
1949 arg->field.field = pevent_find_any_field(event, arg->field.name);
1950 arg->field.field->flags |= FIELD_IS_SYMBOLIC;
2265 struct print_flag_sym *field;
2291 field = calloc(1, sizeof(*field));
2292 if (!field)
2298 field->value = strdup(value);
2299 if (field->value == NULL)
2315 field->str = strdup(value);
2316 if (field->str == NULL)
2321 *list = field;
2322 list = &field->next;
2332 free_flag_sym(field);
2344 struct print_arg *field;
2351 field = alloc_arg();
2352 if (!field) {
2357 type = process_arg(event, field, &token);
2361 type = process_op(event, field, &token);
2367 arg->flags.field = field;
2387 free_arg(field);
2397 struct print_arg *field;
2404 field = alloc_arg();
2405 if (!field) {
2410 type = process_arg(event, field, &token);
2414 arg->symbol.field = field;
2425 free_arg(field);
2435 struct print_arg *field;
2442 field = alloc_arg();
2443 if (!field) {
2448 type = process_arg(event, field, &token);
2453 arg->hex.field = field;
2457 field = alloc_arg();
2458 if (!field) {
2464 type = process_arg(event, field, &token);
2469 arg->hex.size = field;
2476 free_arg(field);
2485 struct format_field *field;
2493 * The item within the parenthesis is another field that holds
2501 /* Find the field */
2503 field = pevent_find_field(event, token);
2504 if (!field)
2507 arg->dynarray.field = field;
2960 * pevent_find_common_field - return a common field by event
2962 * @name: the name of the common field to return
2964 * Returns a common field from the event by the given @name.
2965 * This only searchs the common fields and not all field.
2982 * pevent_find_field - find a non-common field
2984 * @name: the name of the non-common field
2986 * Returns a non-common field by the given @name.
3004 * pevent_find_any_field - find any field by name
3006 * @name: the name of the field
3008 * Returns a field by the given @name.
3009 * This searchs the common field names first, then
3052 * @field: a handle to the field
3056 * Reads raw data according to a field offset and size,
3061 int pevent_read_number_field(struct format_field *field, const void *data,
3064 if (!field)
3066 switch (field->size) {
3071 *value = pevent_read_number(field->event->pevent,
3072 data + field->offset, field->size);
3083 struct format_field *field;
3095 field = pevent_find_common_field(event, type);
3096 if (!field)
3099 *offset = field->offset;
3100 *size = field->size;
3247 if (!arg->field.field) {
3248 arg->field.field = pevent_find_any_field(event, arg->field.name);
3249 if (!arg->field.field)
3254 val = pevent_read_number(pevent, data + arg->field.field->offset,
3255 arg->field.field->size);
3296 data + larg->dynarray.field->offset,
3297 larg->dynarray.field->size);
3298 if (larg->dynarray.field->elementsize)
3299 field_size = larg->dynarray.field->elementsize;
3302 * in the top half of the field, and the offset
3303 * is in the bottom half of the 32 bit field.
3309 if (!larg->field.field) {
3310 larg->field.field =
3311 pevent_find_any_field(event, larg->field.name);
3312 if (!larg->field.field) {
3317 field_size = larg->field.field->elementsize;
3318 offset = larg->field.field->offset +
3319 right * larg->field.field->elementsize;
3431 do_warning("%s: field %s not found", __func__, arg->field.name);
3490 struct format_field *field;
3506 field = arg->field.field;
3507 if (!field) {
3508 field = pevent_find_any_field(event, arg->field.name);
3509 if (!field) {
3510 str = arg->field.name;
3513 arg->field.field = field;
3516 len = field->size ? : size - field->offset;
3523 if (!(field->flags & FIELD_IS_ARRAY) &&
3524 field->size == pevent->long_size) {
3525 addr = *(unsigned long *)(data + field->offset);
3534 memcpy(str, data + field->offset, len);
3540 val = eval_num_arg(data, size, event, arg->flags.field);
3558 val = eval_num_arg(data, size, event, arg->symbol.field);
3568 field = arg->hex.field->field.field;
3569 if (!field) {
3570 str = arg->hex.field->field.name;
3571 field = pevent_find_any_field(event, str);
3572 if (!field)
3574 arg->hex.field->field.field = field;
3576 hex = data + field->offset;
3629 do_warning("%s: field %s not found", __func__, arg->field.name);
3730 struct format_field *field, *ip_field;
3737 field = pevent->bprint_buf_field;
3740 if (!field) {
3741 field = pevent_find_field(event, "buf");
3742 if (!field) {
3743 do_warning("can't find buffer field for binary printk");
3748 do_warning("can't find ip field for binary printk");
3751 pevent->bprint_buf_field = field;
3775 for (ptr = fmt + 6, bptr = data + field->offset;
3882 struct format_field *field;
3887 field = pevent->bprint_fmt_field;
3889 if (!field) {
3890 field = pevent_find_field(event, "fmt");
3891 if (!field) {
3892 do_warning("can't find format field for binary printk");
3895 pevent->bprint_fmt_field = field;
3898 addr = pevent_read_number(pevent, data + field->offset, field->size);
3944 if (!arg->field.field) {
3945 arg->field.field =
3946 pevent_find_any_field(event, arg->field.name);
3947 if (!arg->field.field) {
3948 do_warning("%s: field %s not found",
3949 __func__, arg->field.name);
3953 if (arg->field.field->size != 6) {
3957 buf = data + arg->field.field->offset;
3975 struct format_field *field;
3979 field = event->format.fields;
3980 while (field) {
3981 trace_seq_printf(s, " %s=", field->name);
3982 if (field->flags & FIELD_IS_ARRAY) {
3983 offset = field->offset;
3984 len = field->size;
3985 if (field->flags & FIELD_IS_DYNAMIC) {
3991 if (field->flags & FIELD_IS_STRING &&
4003 field->flags &= ~FIELD_IS_STRING;
4006 val = pevent_read_number(event->pevent, data + field->offset,
4007 field->size);
4008 if (field->flags & FIELD_IS_POINTER) {
4010 } else if (field->flags & FIELD_IS_SIGNED) {
4011 switch (field->size) {
4014 * If field is long then print it in hex.
4017 if (field->flags & FIELD_IS_LONG)
4032 if (field->flags & FIELD_IS_LONG)
4038 field = field->next;
4605 struct format_field *field;
4612 for (field = list; field; field = field->next) {
4613 fields[i++] = field;
4659 static void print_fields(struct trace_seq *s, struct print_flag_sym *field)
4661 trace_seq_printf(s, "{ %s, %s }", field->value, field->str);
4662 if (field->next) {
4664 print_fields(s, field->next);
4682 printf("REC->%s", args->field.name);
4686 print_args(args->flags.field);
4696 print_args(args->symbol.field);
4706 print_args(args->hex.field);
4740 static void parse_header_field(const char *field,
4751 if (read_expected(EVENT_ITEM, "field") < 0)
4762 * If this is not a mandatory field, then test it first.
4765 if (read_expected(EVENT_ITEM, field) < 0)
4770 if (strcmp(token, field) != 0)
5007 struct format_field *field;
5012 for (field = event->format.fields; field; field = field->next) {
5019 arg->field.name = strdup(field->name);
5020 if (!arg->field.name) {
5025 arg->field.field = field;
5153 int get_field_val(struct trace_seq *s, struct format_field *field,
5157 if (!field) {
5163 if (pevent_read_number_field(field, record->data, val)) {
5173 * pevent_get_field_raw - return the raw pointer into the data field
5175 * @event: the event that the field is for
5176 * @name: The name of the field
5177 * @record: The record with the field name.
5178 * @len: place to store the field length.
5181 * Returns a pointer into record->data of the field and places
5182 * the length of the field in @len.
5190 struct format_field *field;
5198 field = pevent_find_field(event, name);
5200 if (!field) {
5210 offset = field->offset;
5211 if (field->flags & FIELD_IS_DYNAMIC) {
5213 data + offset, field->size);
5217 *len = field->size;
5223 * pevent_get_field_val - find a field and return its value
5225 * @event: the event that the field is for
5226 * @name: The name of the field
5227 * @record: The record with the field name.
5228 * @val: place to store the value of the field.
5231 * Returns 0 on success -1 on field not found.
5237 struct format_field *field;
5242 field = pevent_find_field(event, name);
5244 return get_field_val(s, field, name, record, val, err);
5248 * pevent_get_common_field_val - find a common field and return its value
5250 * @event: the event that the field is for
5251 * @name: The name of the field
5252 * @record: The record with the field name.
5253 * @val: place to store the value of the field.
5256 * Returns 0 on success -1 on field not found.
5262 struct format_field *field;
5267 field = pevent_find_common_field(event, name);
5269 return get_field_val(s, field, name, record, val, err);
5273 * pevent_get_any_field_val - find a any field and return its value
5275 * @event: the event that the field is for
5276 * @name: The name of the field
5277 * @record: The record with the field name.
5278 * @val: place to store the value of the field.
5281 * Returns 0 on success -1 on field not found.
5287 struct format_field *field;
5292 field = pevent_find_any_field(event, name);
5294 return get_field_val(s, field, name, record, val, err);
5298 * pevent_print_num_field - print a field and a format
5300 * @fmt: The printf format to print the field with.
5301 * @event: the event that the field is for
5302 * @name: The name of the field
5303 * @record: The record with the field name.
5306 * Returns: 0 on success, -1 field not found, or 1 if buffer is full.
5312 struct format_field *field = pevent_find_field(event, name);
5315 if (!field)
5318 if (pevent_read_number_field(field, record->data, &val))
5531 static void free_format_fields(struct format_field *field)
5535 while (field) {
5536 next = field->next;
5537 free(field->type);
5538 free(field->name);
5539 free(field);
5540 field = next;