aboutsummaryrefslogtreecommitdiffstats
path: root/src/modify.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modify.c')
-rw-r--r--src/modify.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/modify.c b/src/modify.c
new file mode 100644
index 0000000..7a26073
--- /dev/null
+++ b/src/modify.c
@@ -0,0 +1,37 @@
+#include "project.h"
+
+
+
+int
+add (DISK * d, int n, char *name,char *type_guid, int start, int end)
+{
+ GPT_headers h;
+ GPT_entry e={0};
+
+ h=headers_get(d);
+
+ if(a_to_guid(type_guid,&e.type)) {
+ fprintf(stderr,"GUID type %s was not parsed\n");
+ return -1;
+ }
+ e.label=guid_random();
+ e.start=start;
+ e.end=end;
+
+
+ ascii_to_utf16(name,-1,e.name,sizeof(e.name));
+
+
+ entry_show(&e);
+
+/*Odd order because efi says so*/
+
+ entry_write(d,&h.header,n,&e);
+ header_redo_ent_crc(d,&h.header);
+ header_write(d,&h.header);
+
+ entry_write(d,&h.alt_header,n,&e);
+ header_redo_ent_crc(d,&h.alt_header);
+ header_write(d,&h.alt_header);
+return 0;
+}