Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Oct 2001 19:20:07 -0400
From:      The Anarcat <anarcat@anarcat.dyndns.org>
To:        Libh <freebsd-libh@freebsd.org>
Subject:   disklabel can now display sub parts
Message-ID:  <20011009192007.C601@shall.anarcat.dyndns.org>

next in thread | raw e-mail | index | archive | help

--3Gf/FFewwPeBMqCJ
Content-Type: multipart/mixed; boundary="4jXrM3lyYWu4nBt5"
Content-Disposition: inline


--4jXrM3lyYWu4nBt5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Here is some more progress on the disklabel module.

I *want* to have your advice/opinion about the layout of the GUI and
such. One thing: Qt here uses variable-width font, so the columns are
not aligned. It would be interesting to have some "table" widget
instead of "tabbed" listboxes.

Here a few of the current issues:

1- Tables

We have a recurring problem (both with fdisk.tcl and disklabel.tcl) of
displaying a list of fields with columns. Qt really doesn't render this
properly, it's ugly.=20

If there is no table widget available, I'll probably try to setup the
label editor as a list of buttons/fields/labels in various containers.
Then the problem will be of having this area "panable".

So no buttons yet, no gizmos, just figuring out how to dig into libdisk. :)

2- General Layout and logical relation with fdisk

You need to apply the previously posted patches to diskwizard to
"launch" the label editor. I'm thinking very hard about how to lay this
out properly. My main concern is that there is a lot of duplication from
diskwizard.tcl to disklabel.tcl (the editor). Both display the disks and
I could technically put a "fdisk" button in the disklabel window.

Note that the "available disks" listbox is doomed to go. That or the
disk units from the "available partitions" listbox. I think the disk
lines are important there because they delimit which partitions are on
which disk, and inform about the space left.

Now, the thing is that if disklabel "replaces" diskwizard, users might
be confused if they arrive to disklabel first and that there is nothing
there (in the case of a new install). Logically, the fdisk operation
goes before the disklabel operation... A workaround might be to popup
the fdisk dialog before, but then on which disk???

I think, however, that we could expect that a user seeing something
like:

############### Label Editor #####################################
#x  Available partitions                                       x##
#x  ad0       : all free                                       x##
#x  ad1       : all free                                       x##
#x                                                             x##
##################################################################
#x  Quit                                 Fdisk                 x##
##################################################################

=2E.. would be wise enough to select the disk and press the freakin button.=
 :)

3- backwards disks

Little quirk I haven't figured out, the disks get out backwards (ad1
then ad0)...

root@shall [/usr/share/doc/handbook]# sysctl kern.disks
kern.disks: cd0 ad1 ad0 md0
root@shall [/usr/share/doc/handbook]#=20

Eh! :)

Apart from that, I think it's pretty neat, and I'm confident.

A.

--4jXrM3lyYWu4nBt5
Content-Type: application/x-tcl
Content-Description: new disklabel
Content-Disposition: attachment; filename="disklabel.tcl"
Content-Transfer-Encoding: quoted-printable

#=0A# bugs from sysinstall not to repeat:=0A# - do not "overmount" without =
confirm, epecially /=0A# - must quit sysinstall to make 2 writes in disklab=
el=0A=0A# translated from sysinstall=0Aproc free_space {chunk} {=0A    =0A =
   set size [$chunk size]=0A    for {set c1 [$chunk part]}\=0A	{![H::is_nul=
l $c1]}\=0A	{set c1 [$c1 next]} {=0A            # XXX: it seems we can't us=
e 1 here since (?) unused=0A            # freebsd space is not "unused"=0A =
           if {[$c1 type_text] !=3D "unused"} {=0A                incr size=
 -[$c1 size]=0A            }=0A        }=0A    if {$size < 0} {=0A        p=
uts stderr "Partitions are larger than actual chunk??"=0A    }=0A    return=
 $size=0A}=0A=0Aproc free_space_str {chunk} {=0A    set free [free_space $c=
hunk]=0A    if {$free =3D=3D [$chunk size]} {=0A        set free "all free"=
=0A    } elseif {$free =3D=3D 0} {=0A        set free "complete" =0A    } e=
lse {=0A        set free [format "%d/%d free" $free [$chunk size]]=0A    }=
=0A    return $free=0A}=0A=0A# walk a chunk architecture, exectuting proc o=
n each chunk=0A# this does not belong here, but more to lib/disk/=0Aproc it=
erate_chunk {chunk procname {level 0}} {=0A    if {[info commands $procname=
] !=3D $procname} {=0A        puts stderr "unknown procedure $procname!!!"=
=0A    }=0A    =0A    if {![H::is_null $chunk]} {=0A        $procname $chun=
k $level=0A        iterate_chunk [$chunk next] $procname $level=0A        i=
terate_chunk [$chunk part] $procname [expr $level + 1]=0A    }=0A}=0A=0Apro=
c print_chunk {chunk level} {=0A    =0A    puts [format "%d %10s %10s %10s =
%10s" \=0A          $level [$chunk name] [$chunk type_text] \=0A           =
   [$chunk offset] [$chunk end]]=0A=0A}=0A=0Aproc add_chunk {chunk {level 0=
}} {=0A=0A    global parts=0A    add_chunk_r $parts $chunk $level=0A=0A}=0A=
=0Aproc add_chunk_r {listbox chunk level} {=0A    =0A    switch [$chunk typ=
e] {=0A        # whole=0A        0 {$listbox add [$listbox numberOfItems] [=
whole_format $chunk]}=0A        # unknown=0A        1 {$listbox add [$listb=
ox numberOfItems] [part_format $chunk]}=0A        # fat=0A        2 {$listb=
ox add [$listbox numberOfItems] [dos_format $chunk]}=0A        # fbsd=0A   =
     3 {$listbox add [$listbox numberOfItems] [fbsd_format $chunk]}=0A     =
   # extended=0A        4 {$listbox add [$listbox numberOfItems] [dos_forma=
t $chunk]}=0A        # part=0A        5 {$listbox add [$listbox numberOfIte=
ms] [part_format $chunk]}=0A        # unused=0A        6 {=0A             i=
f {$level < 2} {=0A                 $listbox add [$listbox numberOfItems] [=
unused_format $chunk]=0A             }=0A        }=0A        default {}    =
      =0A    }=0A}=0A=0Aproc unused_format {chunk} {=0A    return [format "=
%-10s: %-18d %-18d unused" \=0A                    [$chunk name] [$chunk of=
fset] [$chunk end]]=0A}=0A=0Aproc fbsd_format {chunk} {=0A    return [forma=
t "%-10s: %-18d %-18d fbsd (%s)" \=0A                [$chunk name] [$chunk =
offset] [$chunk end] [free_space_str $chunk]]=0A}=0A=0Aproc whole_format {c=
hunk} {=0A    return [format "%-10s: %s" \=0A                [$chunk name] =
[free_space_str $chunk]]=0A}=0A=0Aproc dos_format {chunk} {=0A    switch [$=
chunk subtype] {=0A        1 {set type "fat12"}=0A        4 -=0A        6 {=
set type "fat16"}=0A        11 -=0A        12 -=0A        14 {set type "fat=
32"}=0A        5 -=0A        15 {set type "extended"}=0A        default {se=
t type "fat"}=0A    }=0A    return [format "%-10s: %-18d %-18d %s %s" \=0A =
               [$chunk name] [$chunk offset] [$chunk end] \=0A             =
   $type [$chunk type_text]]=0A}=0A=0Aproc part_format {chunk} {=0A    if {=
[$chunk subtype] =3D=3D 7} {=0A        set type "FFS"=0A    } elseif {[$chu=
nk subtype] =3D=3D 1} {=0A        set type "Swap"=0A    } else {=0A        =
set type [$chunk subtype]=0A    }=0A    return [format "%-10s: %-18d %-18d =
%s %s" \=0A                [$chunk name] [$chunk offset] [$chunk end] \=0A =
               $type [$chunk type_text]]=0A}=0A=0Aproc update_all {slices} =
{=0A    =0A    global progress=0A    global parts=0A    =0A    $parts remov=
eAll=0A    $slices removeAll=0A    =0A    foreach disk_name [Disk::Disk_Nam=
es] {=0A        if {![string match "*cd*" $disk_name] &&=0A            ![st=
ring match "*md*" $disk_name]=0A        } {=0A            if { [catch {set =
disk [Disk $disk_name]} fid] } {=0A                # XXX: we should put thi=
s in a window=0A                puts stderr "warning: $fid"=0A            }=
 else {=0A                set whole [$disk chunks]=0A                $slice=
s add 0 [format "%5s %30s (%d free)" \=0A                               $di=
sk_name [disk_geometry_text $disk] [free_space [$whole part]]]=0A#         =
       $progress progressIndicator [format "%s_prog" $disk_name] 0 [$whole =
size] 0=0A#                iterate_chunk $whole "print_chunk" 0=0A         =
       iterate_chunk $whole "add_chunk" 0=0A            }=0A        }=0A   =
 }=0A    $slices select 0=0A    $parts select 0=0A}=0A=0Aproc disklabel {} =
{=0A    puts stderr "unimplemented"=0A    global main_window=0A    global m=
enubar=0A    global hui=0A    global slices=0A    global parts=0A    global=
 dialog=0A    global activedisk=0A    global progress=0A=0A    set dialog [=
$hui dialog $main_window "labeldialog"\=0A                    "Label Editor=
" "1 0" "75 18" "vertical"]=0A    =0A#    set progress [$hcont1 container "=
vcont2" "0 0" "vertical"]=0A=0A    set slices [$dialog listBox "sliceslistb=
ox" {} -1 \=0A		    "Available disks"]=0A    set parts [$dialog listBox "pa=
rtslistbox" {} -1 \=0A                   "Available partitions"]=0A    =0A =
   =0A    # now this edits:=0A    # - a DiskChunk:=0A    #   + =0A    # - a=
 mountpoint=0A    # - if we newfs this part=0A    # - newfs flags=0A    # -=
 type (by setting subtype or type)=0A    # - =0A    update_all $slices=0A=
=0A    $dialog exec=0A}
--4jXrM3lyYWu4nBt5
Content-Type: text/plain; charset=us-ascii
Content-Description: old patch
Content-Disposition: attachment; filename=patch-20011008
Content-Transfer-Encoding: quoted-printable

Index: diskwizard.tcl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/libh/cvs/libh/release/diskedit/diskwizard.tcl,v
retrieving revision 1.5
diff -u -r1.5 diskwizard.tcl
--- diskwizard.tcl	2001/10/04 18:21:35	1.5
+++ diskwizard.tcl	2001/10/08 18:02:18
@@ -1,5 +1,12 @@
 global disks
=20
+proc part_callback {hui button userdata} {
+
+    source disklabel.tcl
+    disklabel
+
+}
+
 proc disk_geometry_text {disk} {
     # XXX add size of disk in MB
     format "%d cyls/%d heads/%d sectors =3D %d sectors" [$disk bios_cyl] [=
$disk bios_hd] [$disk bios_sect] [expr [$disk bios_cyl] * [$disk bios_hd] *=
 [$disk bios_sect]]
@@ -52,9 +59,13 @@
=20
     set quit_button [$cont button "quit_button" "&Quit" {quit_callback ""}]
     set fdisk_button [$cont button "fdisk_button" "&FDisk" {fdisk_callback=
 ""}]
+    set label_button [$cont button "label_button" "&Partition" {part_callb=
ack ""}]
+
     $quit_button resize "10 2"
     $fdisk_button resize "10 2"
+    $label_button resize "10 2"
     $quit_button move "0 0"
+    $label_button move "19 0"
     $fdisk_button move "38 0"
=20
     set menubar [$hui menuBar]

--4jXrM3lyYWu4nBt5--

--3Gf/FFewwPeBMqCJ
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

iEYEARECAAYFAjvDhiYACgkQttcWHAnWiGdOFACZAakWGfDSlrpMmsgm+DRv3WKd
stUAn2nUD0upSJwr4TpzU1/8wqiQHQrp
=JSmC
-----END PGP SIGNATURE-----

--3Gf/FFewwPeBMqCJ--

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?20011009192007.C601>