123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #include "volume_id_internal.h"
- #define OCFS2_VOL_UUID_LEN 16
- #define OCFS2_MAX_VOL_LABEL_LEN 64
- #define OCFS2_SUPERBLOCK_OFFSET 0x2000
- struct ocfs2_super_block {
- uint8_t i_signature[8];
- uint32_t i_generation;
- int16_t i_suballoc_slot;
- uint16_t i_suballoc_bit;
- uint32_t i_reserved0;
- uint32_t i_clusters;
- uint32_t i_uid;
- uint32_t i_gid;
- uint64_t i_size;
- uint16_t i_mode;
- uint16_t i_links_count;
- uint32_t i_flags;
- uint64_t i_atime;
- uint64_t i_ctime;
- uint64_t i_mtime;
- uint64_t i_dtime;
- uint64_t i_blkno;
- uint64_t i_last_eb_blk;
- uint32_t i_fs_generation;
- uint32_t i_atime_nsec;
- uint32_t i_ctime_nsec;
- uint32_t i_mtime_nsec;
- uint64_t i_reserved1[9];
- uint64_t i_pad1;
-
- uint16_t s_major_rev_level;
- uint16_t s_minor_rev_level;
- uint16_t s_mnt_count;
- int16_t s_max_mnt_count;
- uint16_t s_state;
- uint16_t s_errors;
- uint32_t s_checkinterval;
- uint64_t s_lastcheck;
- uint32_t s_creator_os;
- uint32_t s_feature_compat;
- uint32_t s_feature_incompat;
- uint32_t s_feature_ro_compat;
- uint64_t s_root_blkno;
- uint64_t s_system_dir_blkno;
- uint32_t s_blocksize_bits;
- uint32_t s_clustersize_bits;
- uint16_t s_max_slots;
- uint16_t s_reserved1;
- uint32_t s_reserved2;
- uint64_t s_first_cluster_group;
- uint8_t s_label[OCFS2_MAX_VOL_LABEL_LEN];
- uint8_t s_uuid[OCFS2_VOL_UUID_LEN];
- } PACKED;
- int FAST_FUNC volume_id_probe_ocfs2(struct volume_id *id )
- {
- #define off ((uint64_t)0)
- struct ocfs2_super_block *os;
- dbg("probing at offset 0x%llx", (unsigned long long) off);
- os = volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200);
- if (os == NULL)
- return -1;
- if (memcmp(os->i_signature, "OCFSV2", 6) != 0) {
- return -1;
- }
- volume_id_set_label_string(id, os->s_label, OCFS2_MAX_VOL_LABEL_LEN < VOLUME_ID_LABEL_SIZE ?
- OCFS2_MAX_VOL_LABEL_LEN : VOLUME_ID_LABEL_SIZE);
- volume_id_set_uuid(id, os->s_uuid, UUID_DCE);
- IF_FEATURE_BLKID_TYPE(id->type = "ocfs2";)
- return 0;
- }
|