From owner-cvs-src Sat Mar 8 19: 3:22 2003 Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D130B37B404 for <cvs-src@freebsd.org>; Sat, 8 Mar 2003 19:03:20 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 1103C43FBF for <cvs-src@freebsd.org>; Sat, 8 Mar 2003 19:03:18 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 91159 invoked by uid 1000); 9 Mar 2003 03:03:19 -0000 Date: Sat, 8 Mar 2003 19:03:19 -0800 (PST) From: Nate Lawson <nate@root.org> To: Poul-Henning Kamp <phk@FreeBSD.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org Subject: Re: cvs commit: src/sys/sys devicestat.h In-Reply-To: <20030308195605.D5D2837B4BC@hub.freebsd.org> Message-ID: <Pine.BSF.4.21.0303081754050.90870-100000@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-src@FreeBSD.ORG Precedence: bulk List-ID: <cvs-src.FreeBSD.ORG> List-Archive: <http://docs.freebsd.org/mail/> (Web Archive) List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions) List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20cvs-src> List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20cvs-src> X-Loop: FreeBSD.ORG On Sat, 8 Mar 2003, Poul-Henning Kamp wrote: > Modified files: > sys/sys devicestat.h > Log: > Augment the devstat structure with 3 new fields and bump the DEVSTAT_VERSION. > > Two fields are sequence numbers for integrity check when we switch devstat > to use mmap to export data rather than sysctl, the last field is to mark > this as an allocated devstat entry. > > Revision Changes Path > 1.19 +14 -1 src/sys/sys/devicestat.h It would be nice to see some email on arch@ about this. There may have been others working on functionality in this area. > @@ -121,6 +124,8 @@ > } devstat_type_flags; > > struct devstat { > + int sequence0; /* Update sequence# */ > + int allocated; /* Allocated entry */ > STAILQ_ENTRY(devstat) dev_links; > u_int32_t device_number; /* > * Devstat device > @@ -203,12 +208,20 @@ > */ > devstat_type_flags device_type; /* Device type */ > devstat_priority priority; /* Controls list pos. */ > + > + int sequence1; /* Update sequence# */ > }; Is there a reason for adding one element at the beginning and one at the end? Despite the fact this API is properly versioned, I believe accepted practice is to add items at the end unless other requirements supersede this one. >+struct devstat *devstat_new_entry(const char *dev_name, >+ int unit_number, u_int32_t block_size, >+ devstat_support_flags flags, >+ devstat_type_flags device_type, >+ devstat_priority priority); This only differs from devstat_add_entry by the fact that it returns a new devstat rather than leaving that to the user. Is there any reason not to make this two separate calls: devstat_alloc and then devstat_add_entry? Again, posting a diff might have revealed that others are sitting on some API changes that could have been rolled into this one. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-src" in the body of the message