Denis Vlasenko | 6a5dc5d | 2006-12-30 18:42:29 +0000 | [diff] [blame] | 1 | #if ENABLE_FEATURE_AIX_LABEL |
Denis Vlasenko | 98ae216 | 2006-10-12 19:30:44 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) Andreas Neuper, Sep 1998. |
| 4 | * This file may be redistributed under |
| 5 | * the terms of the GNU Public License. |
| 6 | */ |
| 7 | |
| 8 | typedef struct { |
| 9 | unsigned int magic; /* expect AIX_LABEL_MAGIC */ |
| 10 | unsigned int fillbytes1[124]; |
| 11 | unsigned int physical_volume_id; |
| 12 | unsigned int fillbytes2[124]; |
| 13 | } aix_partition; |
| 14 | |
| 15 | #define AIX_LABEL_MAGIC 0xc9c2d4c1 |
| 16 | #define AIX_LABEL_MAGIC_SWAPPED 0xc1d4c2c9 |
| 17 | #define AIX_INFO_MAGIC 0x00072959 |
| 18 | #define AIX_INFO_MAGIC_SWAPPED 0x59290700 |
| 19 | |
| 20 | #define aixlabel ((aix_partition *)MBRbuffer) |
| 21 | |
| 22 | |
| 23 | /* |
| 24 | Changes: |
| 25 | * 1999-03-20 Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
| 26 | * Internationalization |
| 27 | * |
| 28 | * 2003-03-20 Phillip Kesling <pkesling@sgi.com> |
| 29 | * Some fixes |
| 30 | */ |
| 31 | |
Denis Vlasenko | 284d0fa | 2008-02-16 13:18:17 +0000 | [diff] [blame] | 32 | static smallint aix_other_endian; /* bool */ |
| 33 | static smallint aix_volumes = 1; /* max 15 */ |
Denis Vlasenko | 98ae216 | 2006-10-12 19:30:44 +0000 | [diff] [blame] | 34 | |
| 35 | /* |
| 36 | * only dealing with free blocks here |
| 37 | */ |
| 38 | |
| 39 | static void |
| 40 | aix_info(void) |
| 41 | { |
Denis Vlasenko | bd85207 | 2007-03-19 14:43:38 +0000 | [diff] [blame] | 42 | puts("\n" |
| 43 | "There is a valid AIX label on this disk.\n" |
| 44 | "Unfortunately Linux cannot handle these disks at the moment.\n" |
| 45 | "Nevertheless some advice:\n" |
| 46 | "1. fdisk will destroy its contents on write.\n" |
| 47 | "2. Be sure that this disk is NOT a still vital part of a volume group.\n" |
| 48 | " (Otherwise you may erase the other disks as well, if unmirrored.)\n" |
| 49 | "3. Before deleting this physical volume be sure to remove the disk\n" |
| 50 | " logically from your AIX machine. (Otherwise you become an AIXpert).\n" |
Denis Vlasenko | 98ae216 | 2006-10-12 19:30:44 +0000 | [diff] [blame] | 51 | ); |
| 52 | } |
| 53 | |
| 54 | static int |
| 55 | check_aix_label(void) |
| 56 | { |
| 57 | if (aixlabel->magic != AIX_LABEL_MAGIC && |
| 58 | aixlabel->magic != AIX_LABEL_MAGIC_SWAPPED) { |
| 59 | current_label_type = 0; |
| 60 | aix_other_endian = 0; |
| 61 | return 0; |
| 62 | } |
| 63 | aix_other_endian = (aixlabel->magic == AIX_LABEL_MAGIC_SWAPPED); |
| 64 | update_units(); |
Denis Vlasenko | 4437d19 | 2008-04-17 00:12:10 +0000 | [diff] [blame] | 65 | current_label_type = LABEL_AIX; |
Denis Vlasenko | f77f369 | 2007-12-16 17:22:33 +0000 | [diff] [blame] | 66 | g_partitions = 1016; |
Denis Vlasenko | 98ae216 | 2006-10-12 19:30:44 +0000 | [diff] [blame] | 67 | aix_volumes = 15; |
| 68 | aix_info(); |
| 69 | /*aix_nolabel();*/ /* %% */ |
| 70 | /*aix_label = 1;*/ /* %% */ |
| 71 | return 1; |
| 72 | } |
| 73 | #endif /* AIX_LABEL */ |