<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Reviewed-by: Eugene Loh <a class="moz-txt-link-rfc2396E" href="mailto:eugene.loh@oracle.com">&lt;eugene.loh@oracle.com&gt;</a><br>
    </p>
    <div class="moz-cite-prefix">On 01/14/2021 08:30 AM, Kris Van Hees
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:202101141630.10EGUF9f011592@aserv0121.oracle.com">
      <pre wrap="">DIFOs could be flagged as containing destructive operations using the
specific dtdo_destructive field in dtrace_difo_t.  There is a need for
other flags to be associated with DIFOs, so the dtdo_destructive field
is being changed into a dtdo_flags field.  DTDOFLG_* constants in
difo_defines.h provide the flags that can be set and checked for.

Signed-off-by: Kris Van Hees <a class="moz-txt-link-rfc2396E" href="mailto:kris.van.hees@oracle.com" moz-do-not-send="true">&lt;kris.van.hees@oracle.com&gt;</a>
---
 include/dtrace/difo.h         | 2 +-
 include/dtrace/difo_defines.h | 5 +++++
 libdtrace/dt_as.c             | 4 ++--
 libdtrace/dt_cc.c             | 7 ++++---
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/include/dtrace/difo.h b/include/dtrace/difo.h
index 4190bc93..173d0701 100644
--- a/include/dtrace/difo.h
+++ b/include/dtrace/difo.h
@@ -41,7 +41,7 @@ typedef struct dtrace_difo {
         uint_t dtdo_varlen;                        /* length of variable table */
         uint_t dtdo_reclen;                        /* length of trace record */
         uint_t dtdo_refcnt;                        /* owner reference count */
-        uint_t dtdo_destructive;                /* invokes destructive subroutines */
+        uint_t dtdo_flags;                        /* flags (destructive, ...) */
         struct dof_relodesc *dtdo_breltab;        /* BPF relocations */
         struct dof_relodesc *dtdo_kreltab;        /* kernel relocations */
         struct dof_relodesc *dtdo_ureltab;        /* user relocations */
diff --git a/include/dtrace/difo_defines.h b/include/dtrace/difo_defines.h
index b5a0f7a7..cb057182 100644
--- a/include/dtrace/difo_defines.h
+++ b/include/dtrace/difo_defines.h
@@ -17,4 +17,9 @@
 
 struct dtrace_difo;
 
+/*
+ * DIFO flags.
+ */
+#define DIFOFLG_DESTRUCTIVE                1        /* Uses destructive ops */
+
 #endif /* _DTRACE_DIFO_DEFINES_H */
diff --git a/libdtrace/dt_as.c b/libdtrace/dt_as.c
index 86d83298..528714fd 100644
--- a/libdtrace/dt_as.c
+++ b/libdtrace/dt_as.c
@@ -331,7 +331,7 @@ fail:
         /*
          * Make a second pass through the instructions, relocating each branch
          * target (a label ID) to the relative location of the label and noting
-         * any instruction-specific DIFO flags such as dtdo_destructive.
+         * any instruction-specific flags such as DIFOFLG_DESTRUCTIVE.
          */
         for (i = 0; i &lt; dp-&gt;dtdo_len; i++) {
                 struct bpf_insn instr = dp-&gt;dtdo_buf[i];
@@ -352,7 +352,7 @@ fail:
                 if (op == DIF_OP_CALL) {
                         if (DIF_INSTR_SUBR(instr) == DIF_SUBR_COPYOUT ||
                             DIF_INSTR_SUBR(instr) == DIF_SUBR_COPYOUTSTR)
-                                dp-&gt;dtdo_destructive = 1;
+                                dp-&gt;dtdo_flags |= DIFOFLG_DESTRUCTIVE;
                         continue;
                 }
 #endif
diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
index 0f8f7af9..e8865c45 100644
--- a/libdtrace/dt_cc.c
+++ b/libdtrace/dt_cc.c
@@ -135,13 +135,14 @@ dt_stmt_create(dtrace_hdl_t *dtp, dtrace_ecbdesc_t *edp,
 #ifdef FIXME
 /*
  * Utility function to determine if a given action description is destructive.
- * The dtdo_destructive bit is set for us by the DIF assembler (see dt_as.c).
+ * The DIFOFLG_DESTRUCTIVE bit is set for us by the DIF assembler (see dt_as.c).
  */
 static int
 dt_action_destructive(const dtrace_actdesc_t *ap)
 {
-        return (DTRACEACT_ISDESTRUCTIVE(ap-&gt;dtad_kind) || (ap-&gt;dtad_kind ==
-            DTRACEACT_DIFEXPR &amp;&amp; ap-&gt;dtad_difo-&gt;dtdo_destructive));
+        return (DTRACEACT_ISDESTRUCTIVE(ap-&gt;dtad_kind) ||
+                (ap-&gt;dtad_kind == DTRACEACT_DIFEXPR &amp;&amp;
+                 (ap-&gt;dtad_difo-&gt;dtdo_flags &amp; DIFOFLG_DESTRUCTIVE)));
 }
 #endif
 
<div class="moz-txt-sig">-- 
2.28.0


_______________________________________________
DTrace-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:DTrace-devel@oss.oracle.com" moz-do-not-send="true">DTrace-devel@oss.oracle.com</a>
<a class="moz-txt-link-freetext" href="https://oss.oracle.com/mailman/listinfo/dtrace-devel" moz-do-not-send="true">https://oss.oracle.com/mailman/listinfo/dtrace-devel</a>
</div></pre>
    </blockquote>
    <br>
  </body>
</html>