1 --- parted-1.6.3/libparted/disk_aix.c.aix 2003-05-28 02:37:39.000000000 -0400
2 +++ parted-1.6.3/libparted/disk_aix.c 2003-05-28 02:54:28.000000000 -0400
4 +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
6 + libparted - a library for manipulating disk partitions
7 + Copyright (C) 2000, 2001 Free Software Foundation, Inc.
9 + This program is free software; you can redistribute it and/or modify
10 + it under the terms of the GNU General Public License as published by
11 + the Free Software Foundation; either version 2 of the License, or
12 + (at your option) any later version.
14 + This program is distributed in the hope that it will be useful,
15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 + GNU General Public License for more details.
19 + You should have received a copy of the GNU General Public License
20 + along with this program; if not, write to the Free Software
21 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 + Contributor: Matt Wilson <msw@redhat.com>
30 +#include <parted/parted.h>
31 +#include <parted/debug.h>
32 +#include <parted/endian.h>
35 +# include <libintl.h>
36 +# define _(String) dgettext (PACKAGE, String)
38 +# define _(String) (String)
39 +#endif /* ENABLE_NLS */
42 + unsigned int magic; /* expect AIX_LABEL_MAGIC */
43 + unsigned int fillbytes[127];
46 +#define AIX_LABEL_MAGIC 0xc9c2d4c1
48 +static PedDiskType aix_disk_type;
51 +aix_probe (PedDevice *dev)
53 + PedDiskType* disk_type;
57 + PED_ASSERT (dev != NULL, return 0);
59 + if (!ped_device_read (dev, &label, 0, 1))
62 + if (PED_BE32_TO_CPU (label.magic) != AIX_LABEL_MAGIC)
68 +#ifndef DISCOVER_ONLY
70 +aix_clobber (PedDevice* dev)
74 + PED_ASSERT (dev != NULL, return 0);
75 + PED_ASSERT (aix_probe (dev), return 0);
77 + if (!ped_device_read (dev, &label, 0, 1))
81 + return ped_device_write (dev, &label, 0, 1);
83 +#endif /* !DISCOVER_ONLY */
86 +aix_alloc (PedDevice* dev)
90 + disk = _ped_disk_alloc (dev, &aix_disk_type);
98 +aix_duplicate (const PedDisk* disk)
102 + new_disk = ped_disk_new_fresh (disk->dev, &aix_disk_type);
110 +aix_free (PedDisk *disk)
112 + _ped_disk_free (disk);
116 +aix_read (PedDisk* disk)
118 + ped_disk_delete_all (disk);
119 + ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
120 + PED_EXCEPTION_CANCEL,
121 + _("Support for reading AIX disk labels is "
122 + "is not implemented yet."));
126 +#ifndef DISCOVER_ONLY
128 +aix_write (PedDisk* disk)
130 + ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
131 + PED_EXCEPTION_CANCEL,
132 + _("Support for writing AIX disk labels is "
133 + "is not implemented yet."));
136 +#endif /* !DISCOVER_ONLY */
138 +static PedPartition*
139 +aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
140 + const PedFileSystemType* fs_type,
141 + PedSector start, PedSector end)
143 + PedPartition* part;
145 + ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
146 + PED_EXCEPTION_CANCEL,
147 + _("Support for adding partitions to AIX disk "
148 + "labels is not implemented yet."));
152 +static PedPartition*
153 +aix_partition_duplicate (const PedPartition* part)
155 + PedPartition* new_part;
157 + ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
158 + PED_EXCEPTION_CANCEL,
159 + _("Support for duplicating partitions in AIX "
160 + "disk labels is not implemented yet."));
165 +aix_partition_destroy (PedPartition* part)
167 + PED_ASSERT (part != NULL, return);
169 + _ped_partition_free (part);
173 +aix_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
175 + ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
176 + PED_EXCEPTION_CANCEL,
177 + _("Support for setting system type of partitions "
178 + "in AIX disk labels is not implemented yet."));
183 +aix_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
185 + ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
186 + PED_EXCEPTION_CANCEL,
187 + _("Support for setting flags "
188 + "in AIX disk labels is not implemented yet."));
193 +aix_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
200 +aix_partition_is_flag_available (const PedPartition* part,
201 + PedPartitionFlag flag)
208 +aix_get_max_primary_partition_count (const PedDisk* disk)
214 +aix_partition_align (PedPartition* part, const PedConstraint* constraint)
216 + PED_ASSERT (part != NULL, return 0);
222 +aix_partition_enumerate (PedPartition* part)
228 +aix_alloc_metadata (PedDisk* disk)
233 +static PedDiskOps aix_disk_ops = {
235 +#ifndef DISCOVER_ONLY
236 + clobber: aix_clobber,
241 + duplicate: aix_duplicate,
244 +#ifndef DISCOVER_ONLY
250 + partition_new: aix_partition_new,
251 + partition_duplicate: aix_partition_duplicate,
252 + partition_destroy: aix_partition_destroy,
253 + partition_set_system: aix_partition_set_system,
254 + partition_set_flag: aix_partition_set_flag,
255 + partition_get_flag: aix_partition_get_flag,
256 + partition_is_flag_available: aix_partition_is_flag_available,
257 + partition_align: aix_partition_align,
258 + partition_enumerate: aix_partition_enumerate,
259 + alloc_metadata: aix_alloc_metadata,
260 + get_max_primary_partition_count:
261 + aix_get_max_primary_partition_count,
263 + partition_set_name: NULL,
264 + partition_get_name: NULL,
267 +static PedDiskType aix_disk_type = {
270 + ops: &aix_disk_ops,
275 +ped_disk_aix_init ()
277 + PED_ASSERT (sizeof (AixLabel) == 512, return);
278 + ped_register_disk_type (&aix_disk_type);
282 +ped_disk_aix_done ()
284 + ped_unregister_disk_type (&aix_disk_type);
287 --- parted-1.6.3/libparted/Makefile.am.aix 2003-05-28 02:37:56.000000000 -0400
288 +++ parted-1.6.3/libparted/Makefile.am 2003-05-28 02:38:13.000000000 -0400
296 EXTRA_libparted_la_SOURCES = linux.c \
297 --- parted-1.6.3/libparted/disk_dos.c.aix 2003-05-28 01:34:04.000000000 -0400
298 +++ parted-1.6.3/libparted/disk_dos.c 2003-05-28 01:59:53.000000000 -0400
303 + /* If this is an AIX Physical Volume, fail here. IBMA in EBCDIC */
304 + if (part_table.boot_code[0] == (char) 0xc9 &&
305 + part_table.boot_code[1] == (char) 0xc2 &&
306 + part_table.boot_code[2] == (char) 0xd4 &&
307 + part_table.boot_code[3] == (char) 0xc1)
311 /* HACK: it's impossible to tell PC98 and msdos disk labels apart.
312 * Someone made the signatures the same (very clever). Since
313 --- parted-1.6.23/libparted/libparted.c.orig 2005-07-18 20:57:53.057531736 +0200
314 +++ parted-1.6.23/libparted/libparted.c 2005-07-18 20:59:01.716094048 +0200
319 +extern void ped_disk_aix_init ();
320 extern void ped_disk_bsd_init ();
321 extern void ped_disk_dvh_init ();
322 extern void ped_disk_gpt_init ();
324 ped_disk_dvh_init ();
325 ped_disk_bsd_init ();
326 ped_disk_amiga_init ();
327 + ped_disk_aix_init ();
333 #endif /* ENABLE_FS */
335 +extern void ped_disk_aix_done ();
336 extern void ped_disk_bsd_done ();
337 extern void ped_disk_dvh_done ();
338 extern void ped_disk_gpt_done ();
340 ped_disk_dvh_done ();
341 ped_disk_bsd_done ();
342 ped_disk_amiga_done ();
343 + ped_disk_aix_done ();
346 static void _init() __attribute__ ((constructor));