From owner-freebsd-libh Sun Oct 7 13:25:42 2001 Delivered-To: freebsd-libh@freebsd.org Received: from tomts11-srv.bellnexxia.net (tomts11.bellnexxia.net [209.226.175.55]) by hub.freebsd.org (Postfix) with ESMTP id 77A7837B401 for ; Sun, 7 Oct 2001 13:25:34 -0700 (PDT) Received: from khan.anarcat.dyndns.org ([65.94.128.156]) by tomts11-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20011007202532.KXAO17332.tomts11-srv.bellnexxia.net@khan.anarcat.dyndns.org> for ; Sun, 7 Oct 2001 16:25:32 -0400 Received: from shall.anarcat.dyndns.org (shall.anarcat.dyndns.org [192.168.0.1]) by khan.anarcat.dyndns.org (Postfix) with ESMTP id 45FD719DD for ; Sun, 7 Oct 2001 16:25:28 -0400 (EDT) Received: by shall.anarcat.dyndns.org (Postfix, from userid 1000) id 7076B20BE2; Sun, 7 Oct 2001 16:26:00 -0400 (EDT) Delivered-To: anarcat@shall.anarcat.dyndns.org Received: from shall.anarcat.dyndns.org (shall.anarcat.dyndns.org [192.168.0.1]) by khan.anarcat.dyndns.org (Postfix) with ESMTP id 01C181B05 for ; Sun, 7 Oct 2001 16:24:57 -0400 (EDT) Received: by shall.anarcat.dyndns.org (Postfix, from userid 1000) id 35B7220BE1; Sun, 7 Oct 2001 16:25:28 -0400 (EDT) Date: Sun, 7 Oct 2001 16:25:28 -0400 From: The Anarcat To: The Anarcat Subject: basic label editor stub Message-ID: <20011007162528.A28881@shall.anarcat.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="aM3YZ0Iwxop3KEKx" 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 --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi. In my ongoing work on what I call the "label editor", here is a patch to release/diskedit/fdisk.tcl that creates a simple "Edit Partitions" button and a stub to call a unimplemented "disklabel" procedure. I also include a stub disklabel.tcl file that must be added to the repo in order for this change to not break anything. I will keep on working on disklabel.tcl now. A. --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Description: patch to fdisk.tcl Content-Disposition: attachment; filename="patch-2001.10.07" Index: fdisk.tcl =================================================================== RCS file: /home/libh/cvs/libh/release/diskedit/fdisk.tcl,v retrieving revision 1.6 diff -u -r1.6 fdisk.tcl --- fdisk.tcl 2001/06/10 16:10:03 1.6 +++ fdisk.tcl 2001/10/07 20:21:58 @@ -3,6 +3,33 @@ source sliceops.tcl source fdiskops.tcl +proc edit_part_callback {hui button userdata} { + + global activedisk + set listbox [$hui byName "sliceslistbox"] + set slice [$listbox select] + set slicename [$listbox text $slice] + + set chunk [[$activedisk chunks] part] + for {set index 0}\ + {![H::is_null $chunk] && [expr $index < $slice]}\ + {incr index} { + set chunk [$chunk next] + } + + # from libdisk source, type returns 3 for FreeBSD partitions + # this (3) should be a variable + if {[$chunk type] != 3} { + # can't edit that + # FIXME: put a warning here + puts stderr "unimplemented: can't edit slice, not FreeBSD" + } else { + puts stderr "found good slice, launching disklabel editor" + source disklabel.tcl + disklabel [$chunk part] + } +} + proc update_slices {} { global slices global activedisk @@ -122,6 +149,7 @@ $vcont3 button "quit_button" "&Quit" {button_click_result QUIT} $vcont3 button "undo_button" "&Undo All Changes" {undo_all ""} $vcont3 button "write_button" "Write Changes" {write_changes ""} + $vcont3 button "edit_button" "Edit &Partitions" {edit_part_callback ""} update_slices --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Description: new disklabel.tcl file Content-Disposition: attachment; filename="disklabel.tcl" proc disklabel {part} { puts stderr "unimplemented" global main_window global menubar global hui global slices global dialog global activedisk return # this is proc fdisk implementation, we'll use this as an example set activedisk [Disk $diskname] set disk $activedisk set dialog [$hui dialog $main_window [format "%sfdiskdialog" $diskname] \ $diskname "1 0" "75 18" "vertical"] set diskgeometrylabel [$dialog label "diskgeometrylabel" \ [format "Disk Geometry: %s" \ [disk_geometry_text [Disk $diskname]]]] $diskgeometrylabel resize "-1 1" set slices [$dialog listBox "sliceslistbox" {} -1 \ "Offset\tSize(ST)\tEnd\tName\tPType\tDesc\tSubtype\tFlags"] set hcont1 [$dialog container "hcont" "0 0" "horizontal"] $hcont1 resize "-1 8" set vcont1 [$hcont1 container "vcont1" "0 0" "vertical"] $vcont1 button "entire_button" "Use &Entire Disk" {entire_disk ""} $vcont1 button "create_button" "&Create Slice" {create_slice ""} $vcont1 button "delete_button" "&Delete Slice" {delete_slice ""} $vcont1 button "bootable_button" "Toggle &Bootable" {toggle_bootable ""} set vcont2 [$hcont1 container "vcont1" "0 0" "vertical"] $vcont2 button "changetype_button" "Change Type" {change_type ""} $vcont2 button "togglesize_button" "Toggle Size Units" {toggle_size ""} $vcont2 button "help_button" "Help" {fdisk_help ""} set vcont3 [$hcont1 container "vcont2" "0 0" "vertical"] $vcont3 button "quit_button" "&Quit" {button_click_result QUIT} $vcont3 button "undo_button" "&Undo All Changes" {undo_all ""} $vcont3 button "write_button" "Write Changes" {write_changes ""} $vcont3 button "edit_button" "Edit Partitions" {edit_part_callback ""} update_slices $dialog exec } --aM3YZ0Iwxop3KEKx-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-libh" in the body of the message