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