[DTrace-devel] [PATCH 2/4] Eliminate DT_VERS_LATEST
Kris Van Hees
kris.van.hees at oracle.com
Fri Feb 28 03:19:23 UTC 2025
On Thu, Feb 27, 2025 at 11:57:29AM -0500, Kris Van Hees wrote:
> There is some overlap with the patch that follows this one, and that got me
> thinking a bit more...
>
> I think that we should rework all this a little bit, and have dt_version.h be
> the sole source of version number data. We can put macros in there that
> provide all the version information (strings and codes), and use that to
> populate everything else, I think. That way we reduce the places where changes
> need to be made (somewhat).
>
> Let me muse on that a little and I'll follow-up with another email soon with
> a example of what I am envisioing.
See the patch I just posted:
[PATCH] Refactor the versioning handling system
I think it might accomplish the same thing, i.e. consolidating the places where
changes are needed for new versions? I was going to just do some prototype of
a possible solution but that one didn't work out (it needed to expose too much
of the version handling to other code), and then I came up with this idea.
Open to suggestions/feedback/...
> On Thu, Feb 27, 2025 at 11:40:45AM -0500, Kris Van Hees via DTrace-devel wrote:
> > On Sat, Feb 08, 2025 at 02:06:20PM -0500, eugene.loh at oracle.com wrote:
> > > From: Eugene Loh <eugene.loh at oracle.com>
> > >
> > > Updating the DTrace version number requires too many distinct
> > > changes. Eliminate DT_VERS_LATEST, since it can be determined
> > > on the fly.
> > >
> > > Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> > > ---
> > > libdtrace/dt_open.c | 3 ++-
> > > libdtrace/dt_version.h | 14 +++++---------
> > > 2 files changed, 7 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/libdtrace/dt_open.c b/libdtrace/dt_open.c
> > > index a02058871..b4d160359 100644
> > > --- a/libdtrace/dt_open.c
> > > +++ b/libdtrace/dt_open.c
> > > @@ -721,7 +721,8 @@ dt_vopen(int version, int flags, int *errp,
> > > dtp->dt_proc_fd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
> > > if (dt_aggregate_init(dtp) == -1)
> > > return set_open_errno(dtp, errp, dtrace_errno(dtp));
> > > - dtp->dt_vmax = DT_VERS_LATEST;
> > > + for (i = 0; _dtrace_versions[i] != 0; i++)
> > > + dtp->dt_vmax = _dtrace_versions[i];
> >
> > dtp->dt_vmax = _dtrace_versions[ARRAY_SIZE(_dtrace_versions) - 2];
> >
> > (-2 to account for the 0 sentinel value)
> >
> > But this will only be accurate if you also add 2.0.1 to the _dtrace_versions
> > array, and then you should probably add 2.0.2 to it also for accuracy.
> >
> > > dtp->dt_cpp_path = strdup(_dtrace_defcpp);
> > > dtp->dt_cpp_argv = malloc(sizeof(char *));
> > > dtp->dt_cpp_argc = 1;
> > > diff --git a/libdtrace/dt_version.h b/libdtrace/dt_version.h
> > > index 3fd1b3d1e..bef3243e9 100644
> > > --- a/libdtrace/dt_version.h
> > > +++ b/libdtrace/dt_version.h
> > > @@ -38,18 +38,15 @@ extern "C" {
> > > *
> > > * These #defines are used in identifier tables to fill in the version fields
> > > * associated with each identifier. The DT_VERS_* macros declare the encoded
> > > - * integer values of all versions used so far. DT_VERS_LATEST must correspond
> > > - * to the latest version value among all versions exported by the D compiler.
> > > - * DT_VERS_STRING must be an ASCII string that contains DT_VERS_LATEST within
> > > - * it along with any suffixes (e.g. Beta).
> > > + * integer values of all versions used so far. DT_VERS_STRING must be an ASCII
> > > + * string that contains the latest version within it along with any suffixes
> > > + * (e.g. Beta). You must update DT_VERS_STRING when adding a new version,
> > > + * and then add the new version to the _dtrace_versions[] array declared in
> > > + * dt_open.c.
> > > *
> > > * Refer to the Solaris Dynamic Tracing Guide Versioning chapter for an
> > > * explanation of these DTrace features and their values.
> > > *
> > > - * You must update DT_VERS_LATEST and DT_VERS_STRING when adding a new version,
> > > - * and then add the new version to the _dtrace_versions[] array declared in
> > > - * dt_open.c..
> > > - *
> > > * NOTE: Although the DTrace versioning scheme supports the labeling and
> > > * introduction of incompatible changes (e.g. dropping an interface in a
> > > * major release), the libdtrace code does not currently support this.
> > > @@ -85,7 +82,6 @@ extern "C" {
> > > #define DT_VERS_2_0 DT_VERSION_NUMBER(2, 0, 0)
> > > #define DT_VERS_2_0_1 DT_VERSION_NUMBER(2, 0, 1)
> > >
> > > -#define DT_VERS_LATEST DT_VERS_2_0_1
> > > #define DT_VERS_STRING "Oracle D 2.0"
> >
> > You should add 2.0.2 and update the DT_VERS_STRING also.
> >
> > >
> > > #ifdef __cplusplus
> > > --
> > > 2.43.5
> > >
> >
> > _______________________________________________
> > DTrace-devel mailing list
> > DTrace-devel at oss.oracle.com
> > https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list