summaryrefslogtreecommitdiffstats
path: root/fdisk/fdiskaixlabel.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:37 +0100
committerKarel Zak2006-12-07 00:25:37 +0100
commit5c36a0eb7cdb0360f9afd5d747c321f423b35984 (patch)
tree147599a77eaff2b5fbc0d389e89d2b51602326c0 /fdisk/fdiskaixlabel.c
parentImported from util-linux-2.8 tarball. (diff)
downloadkernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.tar.gz
kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.tar.xz
kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.zip
Imported from util-linux-2.9i tarball.
Diffstat (limited to 'fdisk/fdiskaixlabel.c')
-rw-r--r--fdisk/fdiskaixlabel.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/fdisk/fdiskaixlabel.c b/fdisk/fdiskaixlabel.c
new file mode 100644
index 000000000..848a6ece8
--- /dev/null
+++ b/fdisk/fdiskaixlabel.c
@@ -0,0 +1,64 @@
+#include <stdio.h> /* stderr */
+#include <stdlib.h> /* uint */
+#include <string.h> /* strstr */
+#include <unistd.h> /* write */
+
+#include <endian.h>
+
+#include "fdisk.h"
+#include "fdiskaixlabel.h"
+
+static int other_endian = 0;
+static short volumes=1;
+
+/*
+ * only dealing with free blocks here
+ */
+
+void
+aix_info( void )
+{
+ printf(
+ "\n\tThere is a valid AIX label on this disk.\n"
+ "\tUnfortunately Linux cannot handle these\n"
+ "\tdisks at the moment. Nevertheless some\n"
+ "\tadvice:\n"
+ "\t1. fdisk will destroy its contents on write.\n"
+ "\t2. Be sure that this disk is NOT a still vital\n"
+ "\t part of a volume group. (Otherwise you may\n"
+ "\t erase the other disks as well, if unmirrored.)\n"
+ "\t3. Before deleting this physical volume be sure\n"
+ "\t to remove the disk logically from your AIX\n"
+ "\t machine. (Otherwise you become an AIXpert).\n"
+ );
+}
+
+void
+aix_nolabel( void )
+{
+ aixlabel->magic = 0;
+ aix_label = 0;
+ partitions = 4;
+ memset( buffer, 0, sizeof(buffer) ); /* avoid fdisk cores */
+ return;
+}
+
+int
+check_aix_label( void )
+{
+ if (aixlabel->magic != AIX_LABEL_MAGIC &&
+ aixlabel->magic != AIX_LABEL_MAGIC_SWAPPED) {
+ aix_label = 0;
+ other_endian = 0;
+ return 0;
+ }
+ other_endian = (aixlabel->magic == AIX_LABEL_MAGIC_SWAPPED);
+ update_units();
+ aix_label = 1;
+ partitions= 1016;
+ volumes = 15;
+ aix_info();
+ aix_nolabel(); /* %% */
+ aix_label = 1; /* %% */
+ return 1;
+}