summaryrefslogtreecommitdiff
path: root/create
diff options
context:
space:
mode:
authorAlejandro Sior <aho@sior.be>2022-06-21 15:38:48 +0200
committerAlejandro Sior <aho@sior.be>2022-06-21 15:38:48 +0200
commitf42a480cbe487fc5fb9b3772990e80926201f6e4 (patch)
treed6af05ea6942732fafa721c97895b66cd42298b3 /create
parentd000a6edf4ad9fcc2302a80080fdbebb23fb7378 (diff)
gptman: reorganize commands in a cmd module
Diffstat (limited to 'create')
-rw-r--r--create/create.ha41
1 files changed, 0 insertions, 41 deletions
diff --git a/create/create.ha b/create/create.ha
deleted file mode 100644
index b7dc0f7..0000000
--- a/create/create.ha
+++ /dev/null
@@ -1,41 +0,0 @@
-use fmt;
-use fs;
-use getopt;
-use io;
-use os;
-use strconv;
-
-use gpt;
-use volume;
-
-export fn create(vol: str, args: []str) void = {
- // XXX this is a stub
-
- const cmd = getopt::parse(args,
- "create a volume",
- ('f', "file", "specify another partition file to fit"),
- ('l', "length", "specify another length margin")
- );
- defer getopt::finish(&cmd);
-
- let length = 0z;
-
- for (let i = 0z; i < len(cmd.opts); i += 1) {
- const opt = cmd.opts[i];
- switch (opt.0) {
- case 'l' =>
- length += (strconv::stoi(opt.1)! / 512 + 1): size;
- case 'f' =>
- const stat = os::stat(opt.1)!;
- length += stat.sz / 512 + 1;
- };
- };
-
- const vol = volume::mkvol(vol);
- const vol = gpt::create(vol, length);
- defer {
- gpt::chksums(vol);
- gpt::commit(vol)!;
- gpt::finish(vol);
- };
-};