(root)/
util-linux-2.39/
libblkid/
src/
partitions/
aix.c
       1  /*
       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  
      17  static 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 BLKID_PROBE_OK;
      26  
      27  	ls = blkid_probe_get_partlist(pr);
      28  	if (!ls)
      29  		return BLKID_PROBE_NONE;
      30  
      31  	tab = blkid_partlist_new_parttable(ls, "aix", 0);
      32  	if (!tab)
      33  		return -ENOMEM;
      34  
      35  	return BLKID_PROBE_OK;
      36  }
      37  
      38  /*
      39   * We know nothing about AIX on-disk structures. Everything what we know is the
      40   * magic number at begin of the disk.
      41   *
      42   * Note, Linux kernel is trying to be smart and AIX signature is ignored when
      43   * there is a valid DOS partitions table. We don't support such behavior. All
      44   * fdisk-like programs has to properly wipe the fist sector. Everything other
      45   * is a bug.
      46   */
      47  const struct blkid_idinfo aix_pt_idinfo =
      48  {
      49  	.name		= "aix",
      50  	.probefunc	= probe_aix_pt,
      51  	.magics		=
      52  	{
      53  		{ .magic = BLKID_AIX_MAGIC_STRING, .len = BLKID_AIX_MAGIC_STRLEN },
      54  		{ NULL }
      55  	}
      56  };
      57