2 * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
3 * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
5 * Inspired by libvolume_id by
6 * Kay Sievers <kay.sievers@vrfy.org>
8 * This file may be redistributed under the terms of the
9 * GNU Lesser General Public License.
17 #include "superblocks.h"
24 } __attribute__((packed));
26 #define NVIDIA_SIGNATURE "NVIDIA"
28 static int probe_nvraid(blkid_probe pr,
29 const struct blkid_idmag *mag __attribute__((__unused__)))
32 struct nv_metadata *nv;
34 if (pr->size < 0x10000)
36 if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
39 off = ((pr->size / 0x200) - 2) * 0x200;
40 nv = (struct nv_metadata *)
41 blkid_probe_get_buffer(pr,
43 sizeof(struct nv_metadata));
47 if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
49 if (blkid_probe_sprintf_version(pr, "%u", le16_to_cpu(nv->version)) != 0)
51 if (blkid_probe_set_magic(pr, off, sizeof(nv->vendor),
52 (unsigned char *) nv->vendor))
57 const struct blkid_idinfo nvraid_idinfo = {
58 .name = "nvidia_raid_member",
59 .usage = BLKID_USAGE_RAID,
60 .probefunc = probe_nvraid,
61 .magics = BLKID_NONE_MAGIC