int FAST_FUNC volume_id_probe_f2fs(struct volume_id *id /*,uint64_t off*/) { struct f2fs_super_block *sb; // Go for primary super block (ignore second sb) dbg("f2fs: probing at offset 0x%x", F2FS_SB1_OFFSET); sb = volume_id_get_buffer(id, F2FS_SB1_OFFSET, sizeof(*sb)); if (!sb) return -1; if (sb->magic != cpu_to_le32(F2FS_MAGIC)) return -1; IF_FEATURE_BLKID_TYPE(id->type = "f2fs"); // For version 1.0 we don't know sb structure and can't set label/uuid if (sb->major_ver == cpu_to_le16(1) && sb->minor_ver == cpu_to_le16(0)) return 0; volume_id_set_label_unicode16(id, (uint8_t *)sb->volume_name, LE, MIN(F2FS_LABEL_BYTES, VOLUME_ID_LABEL_SIZE)); volume_id_set_uuid(id, sb->uuid, UUID_DCE); return 0; }
int FAST_FUNC volume_id_probe_nilfs(struct volume_id *id /*,uint64_t off*/) { struct nilfs2_super_block *sb; // Primary super block dbg("nilfs: probing at offset 0x%x", NILFS_SB1_OFFSET); sb = volume_id_get_buffer(id, NILFS_SB1_OFFSET, sizeof(*sb)); if (sb == NULL) return -1; if (sb->s_magic != NILFS_MAGIC) return -1; // The secondary superblock is not always used, so ignore it for now. // When used it is at 4K from the end of the partition (sb->s_dev_size - NILFS_SB2_OFFSET). volume_id_set_label_string(id, sb->s_volume_name, NILFS_LABEL_SIZE < VOLUME_ID_LABEL_SIZE ? NILFS_LABEL_SIZE : VOLUME_ID_LABEL_SIZE); volume_id_set_uuid(id, sb->s_uuid, UUID_DCE); if (sb->s_rev_level == 2) IF_FEATURE_BLKID_TYPE(id->type = "nilfs2"); return 0; }