sysctl variable creation

Eric Anderson anderson at centtech.com
Fri Sep 30 14:52:00 PDT 2005


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:

--- ufs_vnops.c-orig    Thu Sep 29 20:47:50 2005
+++ ufs_vnops.c Fri Sep 30 13:44:55 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,12 @@
         0, DIRBLKSIZ - 12, 2, ".."
  };

+struct ufsstats ufsstats;
+
+static SYSCTL_NODE(_vfs, OID_AUTO, ufs, CTLFLAG_RD, 0, "UFS filesystem");
+SYSCTL_STRUCT(_vfs_ufs, OID_AUTO, ufsstats, CTLFLAG_RD,
+        &ufsstats, ufsstats, "S,ufsstats");
+
  void
  ufs_itimes(vp)
         struct vnode *vp;
@@ -172,6 +179,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);

Compiles ok, just no sysctl variable..

Thanks! (sorry if it's a stupid mistake - I'm new to this)
Eric



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


More information about the freebsd-hackers mailing list