From owner-freebsd-current@FreeBSD.ORG Thu Nov 16 21:24:21 2006 Return-Path: X-Original-To: freebsd-current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8A6DF16A415; Thu, 16 Nov 2006 21:24:21 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BD1343D7D; Thu, 16 Nov 2006 21:24:12 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.1/8.13.1) with ESMTP id kAGLNajb058333; Thu, 16 Nov 2006 16:23:46 -0500 (EST) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-current@FreeBSD.org Date: Thu, 16 Nov 2006 16:23:07 -0500 User-Agent: KMail/1.6.2 References: <200611162005.kAGK58cB084521@ambrisko.com> In-Reply-To: <200611162005.kAGK58cB084521@ambrisko.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200611161623.10758.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.88.6/2200/Thu Nov 16 09:10:16 2006 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: freebsd-fs@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: ZFS patches for FreeBSD. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2006 21:24:21 -0000 On Thursday 16 November 2006 03:05 pm, Doug Ambrisko wrote: > This is on i386: > one% grep memset zfs_20061117.patch > + (void) memset(p, 0, n); > + (void) memset(wp, 0, sizeof (*wp)); > + (void) memset(wp, 0, sizeof (*wp)); > +zap_memset(void *a, int c, size_t n) > + zap_memset(&l->l_phys->l_hdr, 0, sizeof (struct > zap_leaf_header)); + zap_memset(l->l_phys->l_hash, CHAIN_END, > 2*ZAP_LEAF_HASH_NUMENTRIES(l)); + > zap_memset(l->l_phys->l_hash, CHAIN_END, > 2*ZAP_LEAF_HASH_NUMENTRIES(l)); one% > > In contrib/opensolaris/lib/libuutil/common/uu_alloc.c > +void * > +uu_zalloc(size_t n) > +{ > + void *p = malloc(n); > + > + if (p == NULL) { > + uu_set_error(UU_ERROR_SYSTEM); > + return (NULL); > + } > + > + (void) memset(p, 0, n); > + > + return (p); > +} > + > > %nm dmu_objset.o | grep memset > U memset > % > > If I run it compile -E I see > static __inline void * > memset(void *b, int c, size_t len) > { > char *bb; > > if (c == 0) > bzero(b, len); > else > for (bb = (char *)b; len--; ) > *bb++ = c; > return (b); > } > > and nothing calling it unless it is what Max. is talking about. > I don't see other stuff breaking. It seems the memset() is not used in the kernel part. However, there are at least three places, which does 'struct foo bar = { 0 }': %grep '{ 0 }' zfs_20061117_sys.patch + struct oscarg oa = { 0 }; + struct snaparg sn = { 0 }; + zfs_create_data_t cbdata = { 0 }; (Note: zfs_20061117_sys.patch is extracted from the original patch.) The first two are from dmu_objset_create() and dmu_objset_snapshot() in sys/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c and that is what you saw. The third one is from zfs_ioc_create() in sys/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c. FYI... Jung-uk Kim