Index: e2fsprogs-cfs/lib/blkid/probe.c =================================================================== --- e2fsprogs-cfs.orig/lib/blkid/probe.c +++ e2fsprogs-cfs/lib/blkid/probe.c @@ -647,6 +647,21 @@ static int probe_jfs(struct blkid_probe return 0; } +static int probe_zfs(struct blkid_probe *probe, struct blkid_magic *id, + unsigned char *buf) +{ + struct zfs_uber_block *zub; + char *vdev_label; + const char *pool_name = 0; + + zub = (struct zfs_uber_block *)buf; + + /* read nvpair data for pool name, pool GUID (complex) */ + //blkid_set_tag(probe->dev, "LABEL", pool_name, sizeof(pool_name)); + //set_uuid(probe->dev, pool_guid, 0); + return 0; +} + static int probe_luks(struct blkid_probe *probe, struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) @@ -896,15 +911,6 @@ static int probe_hfsplus(struct blkid_pr } /* - * BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined - * in the type_array table below + bim_kbalign. - * - * When probing for a lot of magics, we handle everything in 1kB buffers so - * that we don't have to worry about reading each combination of block sizes. - */ -#define BLKID_BLK_OFFS 64 /* currently reiserfs */ - -/* * Various filesystem magics that we can check for. Note that kboff and * sboff are in kilobytes and bytes respectively. All magics are in * byte strings so we don't worry about endian issues. @@ -954,6 +960,8 @@ static struct blkid_magic type_array[] = { "iso9660", 32, 1, 5, "CD001", probe_iso9660 }, { "iso9660", 32, 9, 5, "CDROM", probe_iso9660 }, { "jfs", 32, 0, 4, "JFS1", probe_jfs }, + { "zfs", 128, 0, 8, "\0\0\0\0\x00\xba\xb1\x0c", probe_zfs }, + { "zfs", 128, 0, 8, "\x0c\xb1\xba\x00\0\0\0\0", probe_zfs }, { "hfsplus", 1, 0, 2, "BD", probe_hfsplus }, { "hfsplus", 1, 0, 2, "H+", 0 }, { "hfs", 1, 0, 2, "BD", 0 }, @@ -1074,7 +1082,7 @@ try_again: if (!buf) continue; - if (memcmp(id->bim_magic, buf + (id->bim_sboff&0x3ff), + if (memcmp(id->bim_magic, buf + (id->bim_sboff & 0x3ff), id->bim_len)) continue; @@ -1104,7 +1112,7 @@ try_again: dev = 0; goto found_type; } - + found_type: if (dev && type) { dev->bid_devno = st.st_rdev; @@ -1113,7 +1121,7 @@ found_type: cache->bic_flags |= BLKID_BIC_FL_CHANGED; blkid_set_tag(dev, "TYPE", type, 0); - + DBG(DEBUG_PROBE, printf("%s: devno 0x%04llx, type %s\n", dev->bid_name, (long long)st.st_rdev, type)); } Index: e2fsprogs-cfs/lib/blkid/probe.h =================================================================== --- e2fsprogs-cfs.orig/lib/blkid/probe.h +++ e2fsprogs-cfs/lib/blkid/probe.h @@ -190,6 +190,16 @@ struct jfs_super_block { unsigned char js_loguuid[16]; }; +#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ +struct zfs_uberblock { + __u64 ub_magic; /* UBERBLOCK_MAGIC */ + __u64 ub_version; /* ZFS_VERSION */ + __u64 ub_txg; /* txg of last sync */ + __u64 ub_guid_sum; /* sum of all vdev guids */ + __u64 ub_timestamp; /* UTC time of last sync */ + char ub_rootbp; /* MOS objset_phys_t */ +}; + struct romfs_super_block { unsigned char ros_magic[8]; __u32 ros_dummy1[2]; Index: e2fsprogs-cfs/lib/blkid/tests/zfs.results =================================================================== --- /dev/null +++ e2fsprogs-cfs/lib/blkid/tests/zfs.results @@ -0,0 +1 @@ +TYPE='zfs' Index: e2fsprogs-cfs/lib/blkid/tests/zfs.img.bz2 =================================================================== --- /dev/null +++ e2fsprogs-cfs/lib/blkid/tests/zfs.img.bz2 @@ -0,0 +1,18 @@ +BZh91AY&SYg +=0'M2zbL2iii dz3diLOLSLB#Rz 执Jy&M14i0 +m 2LO4SPzI< COS& &LhdTI'5l7e13'e'ڪBjU"E'z;59ˑ䂂6 +]HS0bdlt&TlͷN??+;Lx"6$$ۈH%Ӱ@QSEK@.I*L*MQ)=\@+xhBI!W$X40 ,g$} [f +΁|8X24ƍJ#8_pi>Ӆ!Xu2{A tO} +E~֟TWjޛ'9u++㿆D,َUl]ࣺZ*8/D0֫wh*ފC ӗ6N[n B} IAκXQ<(yZ!e(Àk\G%Z@wݡI#!Ƌ.nvOi @j ijk30Ls  +}0SIDi6I ,B.riRJTz DP'[Pu ^X: +-]-G$ΰc}$RI)E~ +d0:I#eY6T3 2 *KhK43[ê ^%9QV mBmo0q""Z(»$ ++]8XPdFXf^ZWwD7U25'UYٯ&!t^QYêAģwߣU2{LIL(m?"3Z[H#Vhgbhu fjZ~|Lc+ӆU=2,C qOSR$«!anJ9}Vtڜ>GJ̾~7)OY+Tj-bcis$T)CbK*߱6XR6_"!oX[o ~Нž0[NZdY`"nI +'whWgI]r|%t43\y@B ?uW|ZzmhgE%]οݎ~n /ͶܑN$ \ No newline at end of file