Package: partman
Severity: wishlist

Hi,

Attached is the partman patch (against current svn source) which implements the GET_DISK_TYPE command in parted_server.c. It makes it possible to get the partition table type of the disk (essentially, it just returns disk->type->name) by doing something like

open_dialog GET_DISK_TYPE
read_line disk_type
close_dialog

This is useful for various arch-specific hooks (at least on sparc and alpha) which check that the disk where kernel is installed has a partition table type supported by the loader.

[0] http://lists.debian.org/debian-boot/2004/12/msg01241.html

Best regards,

Jurij Smakov                                        [EMAIL PROTECTED]
Key: http://www.wooyd.org/pgpkey/                   KeyID: C99E03CC
diff -aurN --exclude po --exclude .svn partman_orig/parted_server.c 
partman/parted_server.c
--- partman_orig/parted_server.c        2004-12-30 01:45:03.000000000 -0500
+++ partman/parted_server.c     2004-12-30 01:47:49.000000000 -0500
@@ -2000,7 +2000,22 @@
         free(srcid);
 }
 
-
+void command_get_disk_type()
+{
+       log("command_get_disk_type()");
+       scan_device_name();
+       open_out();
+       oprintf("OK\n");
+       deactivate_exception_handler();
+       if((disk == NULL) || (disk->type == NULL) 
+                         || (disk->type->name == NULL)) {
+               oprintf("unknown\n");
+       } else {
+               oprintf("%s\n", disk->type->name);
+       }
+       activate_exception_handler();
+}
+       
 /**********************************************************************
    Main
 **********************************************************************/
@@ -2085,6 +2100,8 @@
                         command_get_virtual_resize_range();
                 else if (!strcasecmp(str, "COPY_PARTITION"))
                         command_copy_partition();
+               else if (!strcasecmp(str, "GET_DISK_TYPE"))
+                       command_get_disk_type();
                 else
                         critical_error("Unknown command %s", str);
                 free(str);

Reply via email to