From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 1 04:14:12 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5B91816A41F for ; Sat, 1 Oct 2005 04:14:12 +0000 (GMT) (envelope-from anderson@centtech.com) Received: from mh1.centtech.com (moat3.centtech.com [207.200.51.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id E550043D4C for ; Sat, 1 Oct 2005 04:14:11 +0000 (GMT) (envelope-from anderson@centtech.com) Received: from [192.168.42.23] (andersonbox3.centtech.com [192.168.42.23]) by mh1.centtech.com (8.13.1/8.13.1) with ESMTP id j914E9Q4080172; Fri, 30 Sep 2005 23:14:09 -0500 (CDT) (envelope-from anderson@centtech.com) Message-ID: <433E0D09.7060804@centtech.com> Date: Fri, 30 Sep 2005 23:14:01 -0500 From: Eric Anderson User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.11) Gecko/20050914 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Jeremy References: <433DB377.6080202@centtech.com> <20051001040822.GM72352@cirb503493.alcatel.com.au> In-Reply-To: <20051001040822.GM72352@cirb503493.alcatel.com.au> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.82/1106/Fri Sep 30 12:17:17 2005 on mh1.centtech.com X-Virus-Status: Clean Cc: freebsd-hackers@freebsd.org Subject: Re: sysctl variable creation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2005 04:14:12 -0000 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 #include #include +#include #ifdef UFS_DIRHASH #include #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. ------------------------------------------------------------------------