From owner-freebsd-libh Mon Oct 8 21:39:28 2001 Delivered-To: freebsd-libh@freebsd.org Received: from tomts7-srv.bellnexxia.net (tomts7.bellnexxia.net [209.226.175.40]) by hub.freebsd.org (Postfix) with ESMTP id 66DF337B40A for ; Mon, 8 Oct 2001 21:39:24 -0700 (PDT) Received: from khan.anarcat.dyndns.org ([65.94.128.156]) by tomts7-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20011009043923.TSET2701.tomts7-srv.bellnexxia.net@khan.anarcat.dyndns.org> for ; Tue, 9 Oct 2001 00:39:23 -0400 Received: from shall.anarcat.dyndns.org (shall.anarcat.dyndns.org [192.168.0.1]) by khan.anarcat.dyndns.org (Postfix) with ESMTP id ABB1619DD for ; Tue, 9 Oct 2001 00:39:18 -0400 (EDT) Received: by shall.anarcat.dyndns.org (Postfix, from userid 1000) id 57DB220C07; Tue, 9 Oct 2001 00:40:02 -0400 (EDT) Date: Tue, 9 Oct 2001 00:40:01 -0400 From: The Anarcat To: Libh Subject: adding Disk::freespace to lib[h]disk Message-ID: <20011009004001.A25152@shall.anarcat.dyndns.org> Mail-Followup-To: The Anarcat , Libh Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BXVAT5kNtrzKuDFl" Content-Disposition: inline User-Agent: Mutt/1.3.22.1i Sender: owner-freebsd-libh@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi. I'm now placed in front of a design decision, i think. :) Either I hack Disk to make a freespace() routine there or make it part of diskedit. Of course I think it should belong to Disk, but it's not so obvious. First, all the calculations can be done in TCL, from what I understand. Second, this should be available in libdisk. :) Indeed, the algorithm is shamefully simple (again stolen form sysinstall): static int space_free(struct chunk *c) { struct chunk *c1; int sz =3D c->size; for (c1 =3D c->part; c1; c1 =3D c1->next) { if (c1->type !=3D unused) sz -=3D c1->size; } if (sz < 0) msgFatal("Partitions are larger than actual chunk??"); return sz; } Integrating this into libdisk should be easy (?). Another thought about "freespace": freespace is not a magical pool of bytes. It's made of *chunks* of unused partitions. And to make things worse, there are 2 different "layers" of freespace: the slice (dos vs fbsd) and partition (inside fbsd parts) layers. I will therefore make 2 different "labels" or kind of displays about this.=20 Ideally, I'll be able to make a nice colored bar of the sections of the disk used [uh yes... drool, drool... :)] For now, I'll just stick to freespace() and a simple text-like GUI display. :) A. --BXVAT5kNtrzKuDFl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjvCf58ACgkQttcWHAnWiGePgACfQZMme353bTohFZWcwYOH8QcV lLEAmwawsuIwuH8lEqxkytwFm6id5/NR =qNoZ -----END PGP SIGNATURE----- --BXVAT5kNtrzKuDFl-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-libh" in the body of the message