Whamcloud - gitweb
Add support to the blkid library to recognize Oracle ASM volumes.
authorTheodore Ts'o <tytso@mit.edu>
Fri, 21 Jan 2005 22:57:56 +0000 (17:57 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 21 Jan 2005 22:57:56 +0000 (17:57 -0500)
lib/blkid/ChangeLog
lib/blkid/probe.c
lib/blkid/probe.h

index ec1b98f..28e9724 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-21  Theodore Ts'o  <tytso@mit.edu>
+
+       * probe.c (probe_oracleasm): Add support for recognizing Oracle
+               ASM volumes.  Thanks to Manish Singh (manish.singh at
+               oracle.com) for supplying this patch.
+
 2005-01-18  Theodore Ts'o  <tytso@mit.edu>
 
        * Makefile.in: Fix the kernel compile-time echo commands to be
index d91e2a3..d203c88 100644 (file)
@@ -422,10 +422,10 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)),
 }
 
 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)
+                      blkid_cache cache __BLKID_ATTR((unused)), 
+                      blkid_dev dev,
+                      struct blkid_magic *id __BLKID_ATTR((unused)), 
+                      unsigned char *buf)
 {
        struct ocfs2_super_block *osb;
 
@@ -436,6 +436,20 @@ static int probe_ocfs2(int fd __BLKID_ATTR((unused)),
        return 0;
 }
 
+static int probe_oracleasm(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 oracle_asm_disk_label *dl;
+
+       dl = (struct oracle_asm_disk_label *)buf;
+
+       blkid_set_tag(dev, "LABEL", dl->dl_id, sizeof(dl->dl_id));
+       return 0;
+}
+
 /*
  * BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined
  * in the type_array table below + bim_kbalign.
@@ -452,6 +466,7 @@ static int probe_ocfs2(int fd __BLKID_ATTR((unused)),
  */
 static struct blkid_magic type_array[] = {
 /*  type     kboff   sboff len  magic                  probe */
+  { "oracleasm", 0,    32,  8, "ORCLDISK",             probe_oracleasm },
   { "jbd",      1,   0x38,  2, "\123\357",             probe_jbd },
   { "ext3",     1,   0x38,  2, "\123\357",             probe_ext3 },
   { "ext2",     1,   0x38,  2, "\123\357",             probe_ext2 },
@@ -500,11 +515,11 @@ static struct blkid_magic type_array[] = {
   { "swap",     0, 0x7ff6, 10, "SWAPSPACE2",           probe_swap1 },
   { "swap",     0, 0xfff6, 10, "SWAP-SPACE",           probe_swap0 },
   { "swap",     0, 0xfff6, 10, "SWAPSPACE2",           probe_swap1 },
-  { "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 },
+  { "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 }
 };
 
index ee91abb..c1d923f 100644 (file)
@@ -252,6 +252,15 @@ struct ocfs2_super_block {
 
 #define OCFS2_SUPER_BLOCK_SIGNATURE     "OCFSV2"
 
+struct oracle_asm_disk_label {
+       char dummy[32];
+       char dl_tag[8];
+       char dl_id[24];
+};
+
+#define ORACLE_ASM_DISK_LABEL_MARKED    "ORCLDISK"
+#define ORACLE_ASM_DISK_LABEL_OFFSET    32
+
 #define ISODCL(from, to) (to - from + 1)
 struct iso_volume_descriptor {
        char type[ISODCL(1,1)]; /* 711 */