blob: de397bf4ad1485b65063eb539962976c54f2a566 [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001/*
2 * aix partitions
3 *
4 * Copyright (C) 2009 Karel Zak <kzak@redhat.com>
5 *
6 * This file may be redistributed under the terms of the
7 * GNU Lesser General Public License.
8 */
9#include <stdio.h>
10#include <string.h>
11#include <stdlib.h>
12#include <stdint.h>
13
14#include "partitions.h"
15#include "aix.h"
16
17static int probe_aix_pt(blkid_probe pr,
18 const struct blkid_idmag *mag __attribute__((__unused__)))
19{
20 blkid_partlist ls;
21 blkid_parttable tab;
22
23 if (blkid_partitions_need_typeonly(pr))
24 /* caller does not ask for details about partitions */
25 return 0;
26
27 ls = blkid_probe_get_partlist(pr);
28 if (!ls)
29 goto err;
30
31 tab = blkid_partlist_new_parttable(ls, "aix", 0);
32 if (!tab)
33 goto err;
34
35 return 0;
36err:
37 return -1;
38}
39
40/*
41 * We know nothing about AIX on-disk structures. Everything what we know is the
42 * magic number at begin of the disk.
43 *
44 * Note, Linux kernel is tring to be smart and AIX signature is ignored when
45 * there is a valid DOS partitions table. We don't support such behaviour. All
46 * fdisk-like programs has to properly wipe the fist sector. Everything other
47 * is a bug.
48 */
49const struct blkid_idinfo aix_pt_idinfo =
50{
51 .name = "aix",
52 .probefunc = probe_aix_pt,
53 .magics =
54 {
55 { .magic = BLKID_AIX_MAGIC_STRING, .len = BLKID_AIX_MAGIC_STRLEN },
56 { NULL }
57 }
58};
59