]> sourceware.org Git - lvm2.git/commitdiff
o builds a very sub-optimal table
authorJoe Thornber <thornber@redhat.com>
Wed, 10 Oct 2001 15:30:31 +0000 (15:30 +0000)
committerJoe Thornber <thornber@redhat.com>
Wed, 10 Oct 2001 15:30:31 +0000 (15:30 +0000)
lib/activate/table-build.c [new file with mode: 0644]
lib/activate/table-build.h [new file with mode: 0644]

diff --git a/lib/activate/table-build.c b/lib/activate/table-build.c
new file mode 100644 (file)
index 0000000..c88d0b3
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2001 Sistina Software (UK) Limited.
+ *
+ * This file is released under the GPL.
+ */
+
+#include "table-build.c"
+
+/* FIXME: optimise linear runs */
+int build_table(struct volume_group *vg, struct logical_volume *lv,
+               const char *file)
+{
+       int i;
+       uint64_t sector = 0;
+       uint64_t pe_size = vg->extent_size;
+       uint64_t dest;
+       struct pe_specifier *pes;
+       FILE *fp = fopen(file, "w");
+
+       if (!fp) {
+               log_err("couldn't open '%s' to write table", file);
+               return 0;
+       }
+
+       for (i = 0; i < lv->le_count; i++) {
+               pes = lv->map + i;
+               dest = pes->pv->pe_start + (pe_size * pes->pe);
+               fprintf(fp, "%ull %ull linear %s %ull\n",
+                       sector, pe_size, pes->pv->dev->name, dest);
+               sector += pe_size;
+       }
+       fclose(fp);
+
+       return 1;
+}
diff --git a/lib/activate/table-build.h b/lib/activate/table-build.h
new file mode 100644 (file)
index 0000000..d783bf1
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2001 Sistina Software (UK) Limited.
+ *
+ * This file is released under the GPL.
+ */
+
+#ifndef TABLE_BUILD_H
+#define TABLE_BUILD_H
+
+int build_table(struct volume_group *vg, struct logical_volume *lv,
+               const char *file);
+
+#endif
This page took 0.038571 seconds and 5 git commands to generate.