FreeBSD/sys/geom/virstor/g_virstor_md.c
/*
 * Decode data from endian-independant byte stream into g_virstor_metadata
 * structure.
 */
Decode data from endian-independant byte stream into g_virstor_metadata
structure.
Decode data from endian - independant byte stream into g_virstor_metadata structure .
void
virstor_metadata_decode(unsigned char *data, struct g_virstor_metadata *md)
{
	bin_stream_t bs;
	bs_open(&bs, (char *)(data));
	bs_read_buf(&bs, md->md_magic, sizeof(md->md_magic));
	md->md_version = bs_read_u32(&bs);
	bs_read_buf(&bs, md->md_name, sizeof(md->md_name));
	md->md_virsize = bs_read_u64(&bs);
	md->md_chunk_size = bs_read_u32(&bs);
	md->md_id = bs_read_u32(&bs);
	md->md_count = bs_read_u16(&bs);
	bs_read_buf(&bs, md->provider, sizeof(md->provider));
	md->no = bs_read_u16(&bs);
	md->provsize = bs_read_u64(&bs);
	md->chunk_count = bs_read_u32(&bs);
	md->chunk_next = bs_read_u32(&bs);
	md->chunk_reserved = bs_read_u16(&bs);
	md->flags = bs_read_u16(&bs);
}
void virstor_metadata_decode ( unsigned char * data , struct g_virstor_metadata * md ) { bin_stream_t bs ; bs_open ( & bs , ( char * ) ( data ) ) ; bs_read_buf ( & bs , md -> md_magic , sizeof ( md -> md_magic ) ) ; md -> md_version = bs_read_u32 ( & bs ) ; bs_read_buf ( & bs , md -> md_name , sizeof ( md -> md_name ) ) ; md -> md_virsize = bs_read_u64 ( & bs ) ; md -> md_chunk_size = bs_read_u32 ( & bs ) ; md -> md_id = bs_read_u32 ( & bs ) ; md -> md_count = bs_read_u16 ( & bs ) ; bs_read_buf ( & bs , md -> provider , sizeof ( md -> provider ) ) ; md -> no = bs_read_u16 ( & bs ) ; md -> provsize = bs_read_u64 ( & bs ) ; md -> chunk_count = bs_read_u32 ( & bs ) ; md -> chunk_next = bs_read_u32 ( & bs ) ; md -> chunk_reserved = bs_read_u16 ( & bs ) ; md -> flags = bs_read_u16 ( & bs ) ; }
Decode data from endian-independant byte stream into g_virstor_metadata
 structure.
Decode data from endian - independant byte stream into g_virstor_metadata structure .