Date: Tue, 9 Oct 2001 00:40:01 -0400 From: The Anarcat <anarcat@anarcat.dyndns.org> To: Libh <freebsd-libh@freebsd.org> Subject: adding Disk::freespace to lib[h]disk Message-ID: <20011009004001.A25152@shall.anarcat.dyndns.org>
next in thread | raw e-mail | index | archive | help
--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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011009004001.A25152>