Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Sep 2005 23:14:01 -0500
From:      Eric Anderson <anderson@centtech.com>
To:        Peter Jeremy <PeterJeremy@optushome.com.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: sysctl variable creation
Message-ID:  <433E0D09.7060804@centtech.com>
In-Reply-To: <20051001040822.GM72352@cirb503493.alcatel.com.au>
References:  <433DB377.6080202@centtech.com> <20051001040822.GM72352@cirb503493.alcatel.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Jeremy wrote:
> On Fri, 2005-Sep-30 16:51:51 -0500, Eric Anderson wrote:
> 
>>I'm hacking up sys/ufs/ufs/ufs_vnops.c, and I've added a sysctl entry, 
>>but it doesn't appear via sysctl -a -c vfs.ufs.  Here's what I've done:
> 
> 
> The code looks correct but I can't find a '-c' option to sysctl in
> 4.x, 5.x or 7.x.  Note that SYSCTL_STRUCT defines an opaque type that
> won't be displayed by default.  You may want "sysctl -x vfs.ufs"
> 

Yea, that's what I meant, sorry about that.  I think I am missing a 
SYSCTL_DECL in there, so maybe this would work:

--- /usr/src/sys/ufs/ufs/ufs_vnops.c-orig       Thu Sep 29 20:47:50 2005
+++ /usr/src/sys/ufs/ufs/ufs_vnops.c    Fri Sep 30 23:14:34 2005
@@ -79,6 +79,7 @@
  #include <ufs/ufs/dir.h>
  #include <ufs/ufs/ufsmount.h>
  #include <ufs/ufs/ufs_extern.h>
+#include <ufs/ufs/ufsstats.h>
  #ifdef UFS_DIRHASH
  #include <ufs/ufs/dirhash.h>
  #endif
@@ -122,6 +123,13 @@
         0, DIRBLKSIZ - 12, 2, ".."
  };

+struct ufsstats ufsstats;
+
+SYSCTL_DECL(_vfs_ufs);
+
+SYSCTL_STRUCT(_vfs_ufs, OID_AUTO, ufsstats, CTLFLAG_RW,
+        &ufsstats, ufsstats, "S,ufsstats");
+
  void
  ufs_itimes(vp)
         struct vnode *vp;
@@ -172,6 +180,7 @@
         error =
             ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, 
ap->a_vap->va_mode),
             ap->a_dvp, ap->a_vpp, ap->a_cnp);
+        ufsstats.create++;
         if (error)
                 return (error);
         return (0);


Thanks for the reply!

Eric



-- 
------------------------------------------------------------------------
Eric Anderson        Sr. Systems Administrator        Centaur Technology
Anything that works is better than anything that doesn't.
------------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?433E0D09.7060804>