Deleted Added
full compact
dt_ident.c (256281) dt_ident.c (268578)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

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

17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

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

17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright (c) 2013 by Delphix. All rights reserved.
26 * Copyright (c) 2013 Joyent, Inc. All rights reserved.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#if defined(sun)
30#include <sys/sysmacros.h>
31#endif
32#include <strings.h>

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

99 iskey ? "key" : "argument", i + 1,
100 dt_node_type_name(&isp->dis_args[i], n1,
101 sizeof (n1)),
102 iskey ? "key" : "argument",
103 dt_node_type_name(args, n2, sizeof (n2)));
104 }
105 }
106
27 */
28
29#pragma ident "%Z%%M% %I% %E% SMI"
30
31#if defined(sun)
32#include <sys/sysmacros.h>
33#endif
34#include <strings.h>

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

101 iskey ? "key" : "argument", i + 1,
102 dt_node_type_name(&isp->dis_args[i], n1,
103 sizeof (n1)),
104 iskey ? "key" : "argument",
105 dt_node_type_name(args, n2, sizeof (n2)));
106 }
107 }
108
107 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
109 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE);
108}
109
110/*
111 * Cook an associative array identifier. If this is the first time we are
112 * cooking this array, create its signature based on the argument list.
113 * Otherwise validate the argument list against the existing signature.
114 */
115static void

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

158
159 dt_node_type_propagate(args, &isp->dis_args[i]);
160 isp->dis_args[i].dn_list = &isp->dis_args[i + 1];
161 }
162
163 if (argc != 0)
164 isp->dis_args[argc - 1].dn_list = NULL;
165
110}
111
112/*
113 * Cook an associative array identifier. If this is the first time we are
114 * cooking this array, create its signature based on the argument list.
115 * Otherwise validate the argument list against the existing signature.
116 */
117static void

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

160
161 dt_node_type_propagate(args, &isp->dis_args[i]);
162 isp->dis_args[i].dn_list = &isp->dis_args[i + 1];
163 }
164
165 if (argc != 0)
166 isp->dis_args[argc - 1].dn_list = NULL;
167
166 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
168 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE);
167
168 } else {
169 dt_idcook_sign(dnp, idp, argc, args,
170 idp->di_kind == DT_IDENT_AGG ? "@" : "", "[ ]");
171 }
172}
173
174/*

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

299
300 if (dt_type_lookup(p1, &dtt) == -1) {
301 xyerror(D_UNKNOWN, "failed to resolve type of "
302 "%s arg#%d (%s): %s\n", idp->di_name, i + 1,
303 p1, dtrace_errmsg(dtp, dtrace_errno(dtp)));
304 }
305
306 dt_node_type_assign(&isp->dis_args[i],
169
170 } else {
171 dt_idcook_sign(dnp, idp, argc, args,
172 idp->di_kind == DT_IDENT_AGG ? "@" : "", "[ ]");
173 }
174}
175
176/*

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

301
302 if (dt_type_lookup(p1, &dtt) == -1) {
303 xyerror(D_UNKNOWN, "failed to resolve type of "
304 "%s arg#%d (%s): %s\n", idp->di_name, i + 1,
305 p1, dtrace_errmsg(dtp, dtrace_errno(dtp)));
306 }
307
308 dt_node_type_assign(&isp->dis_args[i],
307 dtt.dtt_ctfp, dtt.dtt_type);
309 dtt.dtt_ctfp, dtt.dtt_type, B_FALSE);
308 }
309 }
310
311 dt_idcook_sign(dnp, idp, argc, args, "", "( )");
312}
313
314/*
315 * Cook a reference to the dynamically typed args[] array. We verify that the

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

386 idp->di_flags | DT_IDFLG_ORPHAN, idp->di_id, idp->di_attr,
387 idp->di_vers, idp->di_ops, idp->di_iarg, idp->di_gen);
388
389 if (dnp->dn_ident == NULL)
390 longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
391
392 dt_node_type_assign(dnp,
393 prp->pr_argv[ap->dn_value].dtt_ctfp,
310 }
311 }
312
313 dt_idcook_sign(dnp, idp, argc, args, "", "( )");
314}
315
316/*
317 * Cook a reference to the dynamically typed args[] array. We verify that the

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

388 idp->di_flags | DT_IDFLG_ORPHAN, idp->di_id, idp->di_attr,
389 idp->di_vers, idp->di_ops, idp->di_iarg, idp->di_gen);
390
391 if (dnp->dn_ident == NULL)
392 longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
393
394 dt_node_type_assign(dnp,
395 prp->pr_argv[ap->dn_value].dtt_ctfp,
394 prp->pr_argv[ap->dn_value].dtt_type);
396 prp->pr_argv[ap->dn_value].dtt_type,
397 prp->pr_argv[ap->dn_value].dtt_flags & DTT_FL_USER ?
398 B_TRUE : B_FALSE);
395
396 } else if ((dxp = dt_xlator_lookup(dtp,
397 nnp, xnp, DT_XLATE_FUZZY)) != NULL || (
398 dxp = dt_xlator_lookup(dtp, dt_probe_tag(prp, ap->dn_value, &tag),
399 xnp, DT_XLATE_EXACT | DT_XLATE_EXTERN)) != NULL) {
400
401 xidp = dt_xlator_ident(dxp, xnp->dn_ctfp, xnp->dn_type);
402

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

414 * Propagate relevant members from the translator's internal
415 * dt_ident_t. This code must be kept in sync with the state
416 * that is initialized for idents in dt_xlator_create().
417 */
418 dnp->dn_ident->di_data = xidp->di_data;
419 dnp->dn_ident->di_ctfp = xidp->di_ctfp;
420 dnp->dn_ident->di_type = xidp->di_type;
421
399
400 } else if ((dxp = dt_xlator_lookup(dtp,
401 nnp, xnp, DT_XLATE_FUZZY)) != NULL || (
402 dxp = dt_xlator_lookup(dtp, dt_probe_tag(prp, ap->dn_value, &tag),
403 xnp, DT_XLATE_EXACT | DT_XLATE_EXTERN)) != NULL) {
404
405 xidp = dt_xlator_ident(dxp, xnp->dn_ctfp, xnp->dn_type);
406

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

418 * Propagate relevant members from the translator's internal
419 * dt_ident_t. This code must be kept in sync with the state
420 * that is initialized for idents in dt_xlator_create().
421 */
422 dnp->dn_ident->di_data = xidp->di_data;
423 dnp->dn_ident->di_ctfp = xidp->di_ctfp;
424 dnp->dn_ident->di_type = xidp->di_type;
425
422 dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
426 dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp),
427 B_FALSE);
423
424 } else {
425 xyerror(D_ARGS_XLATOR, "translator for %s[%lld] from %s to %s "
426 "is not defined\n", idp->di_name, (longlong_t)ap->dn_value,
427 dt_node_type_name(nnp, n1, sizeof (n1)),
428 dt_node_type_name(xnp, n2, sizeof (n2)));
429 }
430

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

460 if (dt_type_lookup("uint64_t", &dtt) == -1) {
461 xyerror(D_UNKNOWN, "failed to resolve type of %s: %s\n",
462 idp->di_name, dtrace_errmsg(dtp, dtrace_errno(dtp)));
463 }
464
465 idp->di_ctfp = dtt.dtt_ctfp;
466 idp->di_type = dtt.dtt_type;
467
428
429 } else {
430 xyerror(D_ARGS_XLATOR, "translator for %s[%lld] from %s to %s "
431 "is not defined\n", idp->di_name, (longlong_t)ap->dn_value,
432 dt_node_type_name(nnp, n1, sizeof (n1)),
433 dt_node_type_name(xnp, n2, sizeof (n2)));
434 }
435

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

465 if (dt_type_lookup("uint64_t", &dtt) == -1) {
466 xyerror(D_UNKNOWN, "failed to resolve type of %s: %s\n",
467 idp->di_name, dtrace_errmsg(dtp, dtrace_errno(dtp)));
468 }
469
470 idp->di_ctfp = dtt.dtt_ctfp;
471 idp->di_type = dtt.dtt_type;
472
468 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
473 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE);
469}
470
471/*ARGSUSED*/
472static void
473dt_idcook_type(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
474{
475 if (idp->di_type == CTF_ERR) {
476 dtrace_hdl_t *dtp = yypcb->pcb_hdl;

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

482 (const char *)idp->di_iarg, idp->di_name,
483 dtrace_errmsg(dtp, dtrace_errno(dtp)));
484 }
485
486 idp->di_ctfp = dtt.dtt_ctfp;
487 idp->di_type = dtt.dtt_type;
488 }
489
474}
475
476/*ARGSUSED*/
477static void
478dt_idcook_type(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
479{
480 if (idp->di_type == CTF_ERR) {
481 dtrace_hdl_t *dtp = yypcb->pcb_hdl;

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

487 (const char *)idp->di_iarg, idp->di_name,
488 dtrace_errmsg(dtp, dtrace_errno(dtp)));
489 }
490
491 idp->di_ctfp = dtt.dtt_ctfp;
492 idp->di_type = dtt.dtt_type;
493 }
494
490 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
495 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE);
491}
492
493/*ARGSUSED*/
494static void
495dt_idcook_thaw(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
496{
497 if (idp->di_ctfp != NULL && idp->di_type != CTF_ERR)
496}
497
498/*ARGSUSED*/
499static void
500dt_idcook_thaw(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
501{
502 if (idp->di_ctfp != NULL && idp->di_type != CTF_ERR)
498 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
503 dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type, B_FALSE);
499}
500
501static void
502dt_idcook_inline(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
503{
504 if (idp->di_kind == DT_IDENT_ARRAY)
505 dt_idcook_assc(dnp, idp, argc, args);
506 else

--- 541 unchanged lines hidden ---
504}
505
506static void
507dt_idcook_inline(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
508{
509 if (idp->di_kind == DT_IDENT_ARRAY)
510 dt_idcook_assc(dnp, idp, argc, args);
511 else

--- 541 unchanged lines hidden ---