Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=8880c6dd97ecdc92e432e575c6fee9e3ee50429a

commit 8880c6dd97ecdc92e432e575c6fee9e3ee50429a
Author: James Buren <[email protected]>
Date:   Sat Oct 6 03:15:39 2012 -0500

add code for deleting last partition

diff --git a/src/block.c b/src/block.c
index b3ef469..0af296d 100644
--- a/src/block.c
+++ b/src/block.c
@@ -392,6 +392,24 @@ extern void disk_new_table(struct disk *disk,const char 
*type)
disk->modified = true;
}

+extern void disk_delete_partition(struct disk *disk)
+{
+  struct partition *last = 0;
+
+  if(disk == 0 || disk->size <= 0)
+  {
+    errno = EINVAL;
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return;
+  }
+
+  last = &disk->table[--disk->size];
+
+  memset(last,0,sizeof(struct partition));
+
+  disk->modified = true;
+}
+
extern void disk_close(struct disk *disk)
{
if(disk == 0)
diff --git a/src/local.h b/src/local.h
index 57c776c..2b95069 100644
--- a/src/local.h
+++ b/src/local.h
@@ -91,6 +91,7 @@ extern struct device *device_open(const char *path);
extern void device_close(struct device *device);
extern struct disk *disk_open(struct device *device);
extern void disk_new_table(struct disk *disk,const char *type);
+extern void disk_delete_partition(struct disk *disk);
extern void disk_close(struct disk *disk);
extern int ui_main(int argc,char **argv);
extern void ui_dialog_text(const char *title,const char *text);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to