Add support for ocfs2 detection to the blkid library,

courtesy of manish.singh@oracle.com
This commit is contained in:
Theodore Ts'o 2004-09-17 21:37:49 -04:00
parent 9ee42c9509
commit 414846b126
3 changed files with 39 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2004-09-17 Theodore Ts'o <tytso@mit.edu>
* probe.c, probe.h: Add support for ocfs2 detection, courtesy of
manish.singh@oracle.com
* getsize.c: Clean up header #include's. Include sys/disk.h if
present since this is the new place where the
DIOCGMEDIASIZE ioctl is defined on FreeBSD systems.

View File

@ -327,9 +327,7 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)),
major = ocfsmajor(ovh);
if (major == 1)
blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1"));
else if (major == 2)
blkid_set_tag(dev,"SEC_TYPE","ocfs2",sizeof("ocfs2"));
blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs"));
else if (major >= 9)
blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs"));
@ -339,6 +337,21 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_ocfs2(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct ocfs2_super_block *osb;
osb = (struct ocfs2_super_block *)buf;
blkid_set_tag(dev, "LABEL", osb->s_label, sizeof(osb->s_label));
set_uuid(dev, osb->s_uuid);
return 0;
}
/*
* BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined
* in the type_array table below + bim_kbalign.
@ -398,7 +411,11 @@ static struct blkid_magic type_array[] = {
{ "swap", 0, 0x1ff6, 10, "SWAPSPACE2", 0 },
{ "swap", 0, 0x3ff6, 10, "SWAP-SPACE", 0 },
{ "swap", 0, 0x3ff6, 10, "SWAPSPACE2", 0 },
{ "ocfs", 0, 8, 9, "OracleCFS", probe_ocfs },
{ "ocfs", 0, 8, 9, "OracleCFS", probe_ocfs },
{ "ocfs2", 1, 0, 6, "OCFSV2", probe_ocfs2 },
{ "ocfs2", 2, 0, 6, "OCFSV2", probe_ocfs2 },
{ "ocfs2", 4, 0, 6, "OCFSV2", probe_ocfs2 },
{ "ocfs2", 8, 0, 6, "OCFSV2", probe_ocfs2 },
{ NULL, 0, 0, 0, NULL, NULL }
};

View File

@ -234,6 +234,21 @@ struct ocfs_volume_label {
#define OCFS_MAGIC "OracleCFS"
struct ocfs2_super_block {
u_char signature[8];
u_char s_dummy1[184];
u_char s_dummy2[80];
u_char s_label[64];
u_char s_uuid[16];
};
#define OCFS2_MIN_BLOCKSIZE 512
#define OCFS2_MAX_BLOCKSIZE 4096
#define OCFS2_SUPER_BLOCK_BLKNO 2
#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
#define ISODCL(from, to) (to - from + 1)
struct iso_volume_descriptor {
char type[ISODCL(1,1)]; /* 711 */