From owner-freebsd-current@FreeBSD.ORG Tue Feb 8 16:52:33 2005 Return-Path: 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 1DB6316A4CF for ; Tue, 8 Feb 2005 16:52:33 +0000 (GMT) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id C7FFC43D2D for ; Tue, 8 Feb 2005 16:52:32 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with SMTP id 0AA0546B16; Tue, 8 Feb 2005 11:52:32 -0500 (EST) Date: Tue, 8 Feb 2005 16:51:30 +0000 (GMT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Bosko Milekic In-Reply-To: <20050208164125.GA46363@technokratis.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Poul-Henning Kamp cc: current@freebsd.org Subject: Re: UFS/FFS/softupdates/snapshots: the view from 10m above X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Tue, 08 Feb 2005 16:52:33 -0000 On Tue, 8 Feb 2005, Bosko Milekic wrote: > On Tue, Feb 08, 2005 at 10:30:58AM +0100, Poul-Henning Kamp wrote: > > > > http://phk.freebsd.dk/misc/ufs.pdf > > > > You need 18 sheets of paper, a color printer and some tape. > > Neat! How'd you have this done? Had something parse up the source? You can find a similar picture of the sockets layer from early 2004 here: http://www.watson.org/~robert/freebsd/20040303-sockets.ps The answer to "how" is at: http://www.watson.org/~robert/freebsd/prcc/ That and a lot of hand-crafting and cleanup. The first thing you find out when trying to apply cflow and graphviz to the kernel in order to generate a call flow diagram is that there's a lot of "stuff" and the type of picture you want is as much a product of how you plan to use the picture as the source you base it on. The first thing you have to decide is "what's important to me" and generate a list of symbols/functions/whatever that you're not interested in. You might or might not be interested in memory allocation, locking, string operations, assertions, etc. You also find pretty quickly that you have to give graphviz a bit of help with visual layout -- assigning ranks or groupings to functions so that you get a representation that matches the API structure (i.e., line up the VOP's). Another observation is that cflow doesn't do a good job at pluggable API boundaries -- ie., protosw, VOP's, etc, so you have to give it some help figuring out where the function pointers go. Finally, cflow utterly barfs on some C constructions, especially if you use prcc directly, so you may have to help it with some macros, functions, delete the SYSINITs, etc. That said, you get both a very useful result, and get to go through quite an educational process generating a cohensive graph of a subsystem. I recommend it highly :-). The kernel is a highly complex software system that takes years to even start to really understand. Graphs of this sort are an excellent way to see how the pieces are put together. Robert N M Watson