]> git.pld-linux.org Git - packages/parted.git/blame - parted-aix.patch
- updated for 1.6.23
[packages/parted.git] / parted-aix.patch
CommitLineData
7d3bc8b9
JB
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
3@@ -0,0 +1,283 @@
4+/* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
5+
6+ libparted - a library for manipulating disk partitions
7+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
8+
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.
13+
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.
18+
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
22+
23+ Contributor: Matt Wilson <msw@redhat.com>
24+*/
25+
26+#include "config.h"
27+
28+#include <string.h>
29+
30+#include <parted/parted.h>
31+#include <parted/debug.h>
32+#include <parted/endian.h>
33+
34+#if ENABLE_NLS
35+# include <libintl.h>
36+# define _(String) dgettext (PACKAGE, String)
37+#else
38+# define _(String) (String)
39+#endif /* ENABLE_NLS */
40+
41+typedef struct {
42+ unsigned int magic; /* expect AIX_LABEL_MAGIC */
43+ unsigned int fillbytes[127];
44+} AixLabel;
45+
46+#define AIX_LABEL_MAGIC 0xc9c2d4c1
47+
48+static PedDiskType aix_disk_type;
49+
50+static int
51+aix_probe (PedDevice *dev)
52+{
53+ PedDiskType* disk_type;
54+ AixLabel label;
55+ int i;
56+
57+ PED_ASSERT (dev != NULL, return 0);
58+
59+ if (!ped_device_read (dev, &label, 0, 1))
60+ return 0;
61+
62+ if (PED_BE32_TO_CPU (label.magic) != AIX_LABEL_MAGIC)
63+ return 0;
64+
65+ return 1;
66+}
67+
68+#ifndef DISCOVER_ONLY
69+static int
70+aix_clobber (PedDevice* dev)
71+{
72+ AixLabel label;
73+
74+ PED_ASSERT (dev != NULL, return 0);
75+ PED_ASSERT (aix_probe (dev), return 0);
76+
77+ if (!ped_device_read (dev, &label, 0, 1))
78+ return 0;
79+
80+ label.magic = 0;
81+ return ped_device_write (dev, &label, 0, 1);
82+}
83+#endif /* !DISCOVER_ONLY */
84+
85+static PedDisk*
86+aix_alloc (PedDevice* dev)
87+{
88+ PedDisk* disk;
89+
90+ disk = _ped_disk_alloc (dev, &aix_disk_type);
91+ if (!disk)
92+ return NULL;
93+
94+ return disk;
95+}
96+
97+static PedDisk*
98+aix_duplicate (const PedDisk* disk)
99+{
100+ PedDisk* new_disk;
101+
102+ new_disk = ped_disk_new_fresh (disk->dev, &aix_disk_type);
103+ if (!new_disk)
104+ return NULL;
105+
106+ return new_disk;
107+}
108+
109+static void
110+aix_free (PedDisk *disk)
111+{
112+ _ped_disk_free (disk);
113+}
114+
115+static int
116+aix_read (PedDisk* disk)
117+{
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."));
123+ return 0;
124+}
125+
126+#ifndef DISCOVER_ONLY
127+static int
128+aix_write (PedDisk* disk)
129+{
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."));
134+ return 0;
135+}
136+#endif /* !DISCOVER_ONLY */
137+
138+static PedPartition*
139+aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
140+ const PedFileSystemType* fs_type,
141+ PedSector start, PedSector end)
142+{
143+ PedPartition* part;
144+
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."));
149+ return NULL;
150+}
151+
152+static PedPartition*
153+aix_partition_duplicate (const PedPartition* part)
154+{
155+ PedPartition* new_part;
156+
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."));
161+ return NULL;
162+}
163+
164+static void
165+aix_partition_destroy (PedPartition* part)
166+{
167+ PED_ASSERT (part != NULL, return);
168+
169+ _ped_partition_free (part);
170+}
171+
172+static int
173+aix_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
174+{
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."));
179+ return 0;
180+}
181+
182+static int
183+aix_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
184+{
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."));
189+ return 0;
190+}
191+
192+static int
193+aix_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
194+{
195+ return 0;
196+}
197+
198+
199+static int
200+aix_partition_is_flag_available (const PedPartition* part,
201+ PedPartitionFlag flag)
202+{
203+ return 0;
204+}
205+
206+
207+static int
208+aix_get_max_primary_partition_count (const PedDisk* disk)
209+{
210+ return 4;
211+}
212+
213+static int
214+aix_partition_align (PedPartition* part, const PedConstraint* constraint)
215+{
216+ PED_ASSERT (part != NULL, return 0);
217+
218+ return 1;
219+}
220+
221+static int
222+aix_partition_enumerate (PedPartition* part)
223+{
224+ return 1;
225+}
226+
227+static int
228+aix_alloc_metadata (PedDisk* disk)
229+{
230+ return 1;
231+}
232+
233+static PedDiskOps aix_disk_ops = {
234+ probe: aix_probe,
235+#ifndef DISCOVER_ONLY
236+ clobber: aix_clobber,
237+#else
238+ clobber: NULL,
239+#endif
240+ alloc: aix_alloc,
241+ duplicate: aix_duplicate,
242+ free: aix_free,
243+ read: aix_read,
244+#ifndef DISCOVER_ONLY
245+ write: aix_write,
246+#else
247+ write: NULL,
248+#endif
249+
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,
262+
263+ partition_set_name: NULL,
264+ partition_get_name: NULL,
265+};
266+
267+static PedDiskType aix_disk_type = {
268+ next: NULL,
269+ name: "aix",
270+ ops: &aix_disk_ops,
271+ features: 0
272+};
273+
274+void
275+ped_disk_aix_init ()
276+{
277+ PED_ASSERT (sizeof (AixLabel) == 512, return);
278+ ped_register_disk_type (&aix_disk_type);
279+}
280+
281+void
282+ped_disk_aix_done ()
283+{
284+ ped_unregister_disk_type (&aix_disk_type);
285+}
286+
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
289@@ -47,6 +47,7 @@
290 disk_pc98.c \
291 disk_sun.c \
292 disk_amiga.c \
293+ disk_aix.c \
294 @OS@.c
295
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
299@@ -153,6 +153,13 @@
300 return 0;
301 }
302
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)
308+ return 0;
309+
310 #ifdef ENABLE_PC98
311 /* HACK: it's impossible to tell PC98 and msdos disk labels apart.
312 * Someone made the signatures the same (very clever). Since
e6341a45
JB
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
7d3bc8b9
JB
315@@ -78,6 +78,7 @@
316 return 1;
317 }
318
319+extern void ped_disk_aix_init ();
320 extern void ped_disk_bsd_init ();
e6341a45 321 extern void ped_disk_dvh_init ();
7d3bc8b9 322 extern void ped_disk_gpt_init ();
e6341a45
JB
323@@ -108,6 +109,7 @@
324 ped_disk_dvh_init ();
7d3bc8b9 325 ped_disk_bsd_init ();
e6341a45 326 ped_disk_amiga_init ();
7d3bc8b9
JB
327+ ped_disk_aix_init ();
328 }
329
330 #ifdef ENABLE_FS
e6341a45 331@@ -138,6 +140,7 @@
7d3bc8b9
JB
332 }
333 #endif /* ENABLE_FS */
334
335+extern void ped_disk_aix_done ();
336 extern void ped_disk_bsd_done ();
e6341a45 337 extern void ped_disk_dvh_done ();
7d3bc8b9 338 extern void ped_disk_gpt_done ();
e6341a45
JB
339@@ -166,6 +169,7 @@
340 ped_disk_dvh_done ();
7d3bc8b9 341 ped_disk_bsd_done ();
e6341a45 342 ped_disk_amiga_done ();
7d3bc8b9
JB
343+ ped_disk_aix_done ();
344 }
e6341a45 345
7d3bc8b9 346 static void _init() __attribute__ ((constructor));
This page took 0.873582 seconds and 4 git commands to generate.