FreeBSD/sys/geom/virstor/g_virstor_md.c
/*
 * Encode data from g_virstor_metadata structure into a endian-independant
 * byte stream.
 */
Encode data from g_virstor_metadata structure into a endian-independant
byte stream.
Encode data from g_virstor_metadata structure into a endian - independant byte stream .
void
virstor_metadata_encode(struct g_virstor_metadata *md, unsigned char *data)
{
	bin_stream_t bs;
	bs_open(&bs, data);
	bs_write_buf(&bs, md->md_magic, sizeof(md->md_magic));
	bs_write_u32(&bs, md->md_version);
	bs_write_buf(&bs, md->md_name, sizeof(md->md_name));
	bs_write_u64(&bs, md->md_virsize);
	bs_write_u32(&bs, md->md_chunk_size);
	bs_write_u32(&bs, md->md_id);
	bs_write_u16(&bs, md->md_count);
	bs_write_buf(&bs, md->provider, sizeof(md->provider));
	bs_write_u16(&bs, md->no);
	bs_write_u64(&bs, md->provsize);
	bs_write_u32(&bs, md->chunk_count);
	bs_write_u32(&bs, md->chunk_next);
	bs_write_u16(&bs, md->chunk_reserved);
	bs_write_u16(&bs, md->flags);
}
void virstor_metadata_encode ( struct g_virstor_metadata * md , unsigned char * data ) { bin_stream_t bs ; bs_open ( & bs , data ) ; bs_write_buf ( & bs , md -> md_magic , sizeof ( md -> md_magic ) ) ; bs_write_u32 ( & bs , md -> md_version ) ; bs_write_buf ( & bs , md -> md_name , sizeof ( md -> md_name ) ) ; bs_write_u64 ( & bs , md -> md_virsize ) ; bs_write_u32 ( & bs , md -> md_chunk_size ) ; bs_write_u32 ( & bs , md -> md_id ) ; bs_write_u16 ( & bs , md -> md_count ) ; bs_write_buf ( & bs , md -> provider , sizeof ( md -> provider ) ) ; bs_write_u16 ( & bs , md -> no ) ; bs_write_u64 ( & bs , md -> provsize ) ; bs_write_u32 ( & bs , md -> chunk_count ) ; bs_write_u32 ( & bs , md -> chunk_next ) ; bs_write_u16 ( & bs , md -> chunk_reserved ) ; bs_write_u16 ( & bs , md -> flags ) ; }
Encode data from g_virstor_metadata structure into a endian-independant
 byte stream.
Encode data from g_virstor_metadata structure into a endian - independant byte stream .