Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Fix builds (hopefully) when DTRACE hooks are not included.



details:   https://anonhg.NetBSD.org/src/rev/95bda153debe
branches:  trunk
changeset: 374521:95bda153debe
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Apr 29 23:30:18 2023 +0000

description:
Fix builds (hopefully) when DTRACE hooks are not included.

diffstat:

 sys/kern/vfs_subr.c |  22 ++++++++++++++++------
 sys/sys/sdt.h       |   9 ++++++++-
 2 files changed, 24 insertions(+), 7 deletions(-)

diffs (110 lines):

diff -r d522870f889f -r 95bda153debe sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Sat Apr 29 21:37:07 2023 +0000
+++ b/sys/kern/vfs_subr.c       Sat Apr 29 23:30:18 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.498 2023/04/29 10:07:30 riastradh Exp $ */
+/*     $NetBSD: vfs_subr.c,v 1.499 2023/04/29 23:30:18 kre Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008, 2019, 2020
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.498 2023/04/29 10:07:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.499 2023/04/29 23:30:18 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_43.h"
@@ -714,7 +714,7 @@ vn_syncer_add1(struct vnode *vp, int del
 void
 vn_syncer_add_to_worklist(struct vnode *vp, int delayx)
 {
-       vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
+       SDT_VAR_DECL(vnode_impl_t *vip = VNODE_TO_VIMPL(vp));
 
        KASSERT(mutex_owned(vp->v_interlock));
 
@@ -840,9 +840,10 @@ sched_sync(void *arg)
        struct vnode *vp;
        struct mount *mp;
        time_t starttime, endtime;
-       int vdelay, oslot, nslot, delayx;
+       int vdelay, nslot, delayx;
+       SDT_VAR_DECL(int oslot);
        bool synced;
-       int error;
+       SDT_VAR_DECL(int error);
 
        for (;;) {
                starttime = time_second;
@@ -861,14 +862,21 @@ sched_sync(void *arg)
                        }
 
                        vdelay = sync_delay(mp);
+#ifdef KDTRACE_HOOKS
                        oslot = mp->mnt_synclist_slot;
+#endif
                        nslot = sync_delay_slot(vdelay);
                        mp->mnt_synclist_slot = nslot;
                        SDT_PROBE4(vfs, syncer, worklist, mount__update,
                            mp, vdelay, oslot, nslot);
 
                        SDT_PROBE1(vfs, syncer, sync, mount__start,  mp);
-                       error = VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
+#ifdef KDTRACE_HOOKS
+                       error =
+#else
+                       (void)
+#endif
+                               VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
                        SDT_PROBE2(vfs, syncer, sync, mount__done,
                            mp, error);
                }
@@ -918,7 +926,9 @@ sched_sync(void *arg)
                                 * into the future.
                                 */
                                delayx = synced ? syncdelay : lockdelay;
+#ifdef KDTRACE_HOOKS
                                oslot = vi->vi_synclist_slot;
+#endif
                                vn_syncer_add1(vp, delayx);
                                nslot = vi->vi_synclist_slot;
                                SDT_PROBE4(vfs, syncer, worklist,
diff -r d522870f889f -r 95bda153debe sys/sys/sdt.h
--- a/sys/sys/sdt.h     Sat Apr 29 21:37:07 2023 +0000
+++ b/sys/sys/sdt.h     Sat Apr 29 23:30:18 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdt.h,v 1.15 2022/10/29 14:00:12 riastradh Exp $       */
+/*     $NetBSD: sdt.h,v 1.16 2023/04/29 23:30:18 kre Exp $     */
 
 /*-
  * Copyright 2006-2008 John Birrell <jb%FreeBSD.org@localhost>
@@ -37,6 +37,9 @@
 
 #define        _DTRACE_VERSION 1
 
+#define SDT_PROVIDER_DEFINE(prov)
+#define SDT_PROVIDER_DECLARE(prov)
+
 #define        DTRACE_PROBE(prov, name) do {                           \
        extern void __dtrace_##prov##___##name(void);           \
        __dtrace_##prov##___##name();                           \
@@ -138,6 +141,8 @@
     arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6,     \
     xarg6)
 
+#define        SDT_VAR_DECL(decl)                                      __nothing
+
 #define        DTRACE_PROBE(name)                                      __nothing
 #define        DTRACE_PROBE1(name, type0, arg0)                        __nothing
 #define        DTRACE_PROBE2(name, type0, arg0, type1, arg1)           __nothing
@@ -334,6 +339,8 @@
                            (uintptr_t)arg6);                                  \
        } while (0)
 
+#define        SDT_VAR_DECL(decl)      decl ;
+
 #define        DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4)     do { \
        static SDT_PROBE_DEFINE(sdt, , , name);                              \
        SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4);



Home | Main Index | Thread Index | Old Index