Lines Matching +full:100 +full:md

243     struct g_raid3_metadata *md);
244 int g_raid3_read_metadata(struct g_consumer *cp, struct g_raid3_metadata *md);
246 struct g_raid3_metadata *md);
272 raid3_metadata_encode(struct g_raid3_metadata *md, u_char *data) in raid3_metadata_encode() argument
276 bcopy(md->md_magic, data, 16); in raid3_metadata_encode()
277 le32enc(data + 16, md->md_version); in raid3_metadata_encode()
278 bcopy(md->md_name, data + 20, 16); in raid3_metadata_encode()
279 le32enc(data + 36, md->md_id); in raid3_metadata_encode()
280 le16enc(data + 40, md->md_no); in raid3_metadata_encode()
281 le16enc(data + 42, md->md_all); in raid3_metadata_encode()
282 le32enc(data + 44, md->md_genid); in raid3_metadata_encode()
283 le32enc(data + 48, md->md_syncid); in raid3_metadata_encode()
284 le64enc(data + 52, md->md_mediasize); in raid3_metadata_encode()
285 le32enc(data + 60, md->md_sectorsize); in raid3_metadata_encode()
286 le64enc(data + 64, md->md_sync_offset); in raid3_metadata_encode()
287 le64enc(data + 72, md->md_mflags); in raid3_metadata_encode()
288 le64enc(data + 80, md->md_dflags); in raid3_metadata_encode()
289 bcopy(md->md_provider, data + 88, 16); in raid3_metadata_encode()
290 le64enc(data + 104, md->md_provsize); in raid3_metadata_encode()
293 MD5Final(md->md_hash, &ctx); in raid3_metadata_encode()
294 bcopy(md->md_hash, data + 112, 16); in raid3_metadata_encode()
297 raid3_metadata_decode_v0v1v2(const u_char *data, struct g_raid3_metadata *md) in raid3_metadata_decode_v0v1v2() argument
301 bcopy(data + 20, md->md_name, 16); in raid3_metadata_decode_v0v1v2()
302 md->md_id = le32dec(data + 36); in raid3_metadata_decode_v0v1v2()
303 md->md_no = le16dec(data + 40); in raid3_metadata_decode_v0v1v2()
304 md->md_all = le16dec(data + 42); in raid3_metadata_decode_v0v1v2()
305 md->md_syncid = le32dec(data + 44); in raid3_metadata_decode_v0v1v2()
306 md->md_mediasize = le64dec(data + 48); in raid3_metadata_decode_v0v1v2()
307 md->md_sectorsize = le32dec(data + 56); in raid3_metadata_decode_v0v1v2()
308 md->md_sync_offset = le64dec(data + 60); in raid3_metadata_decode_v0v1v2()
309 md->md_mflags = le64dec(data + 68); in raid3_metadata_decode_v0v1v2()
310 md->md_dflags = le64dec(data + 76); in raid3_metadata_decode_v0v1v2()
311 bcopy(data + 84, md->md_provider, 16); in raid3_metadata_decode_v0v1v2()
312 bcopy(data + 100, md->md_hash, 16); in raid3_metadata_decode_v0v1v2()
314 MD5Update(&ctx, data, 100); in raid3_metadata_decode_v0v1v2()
315 MD5Final(md->md_hash, &ctx); in raid3_metadata_decode_v0v1v2()
316 if (bcmp(md->md_hash, data + 100, 16) != 0) in raid3_metadata_decode_v0v1v2()
320 md->md_genid = 0; in raid3_metadata_decode_v0v1v2()
321 md->md_provsize = 0; in raid3_metadata_decode_v0v1v2()
326 raid3_metadata_decode_v3(const u_char *data, struct g_raid3_metadata *md) in raid3_metadata_decode_v3() argument
330 bcopy(data + 20, md->md_name, 16); in raid3_metadata_decode_v3()
331 md->md_id = le32dec(data + 36); in raid3_metadata_decode_v3()
332 md->md_no = le16dec(data + 40); in raid3_metadata_decode_v3()
333 md->md_all = le16dec(data + 42); in raid3_metadata_decode_v3()
334 md->md_genid = le32dec(data + 44); in raid3_metadata_decode_v3()
335 md->md_syncid = le32dec(data + 48); in raid3_metadata_decode_v3()
336 md->md_mediasize = le64dec(data + 52); in raid3_metadata_decode_v3()
337 md->md_sectorsize = le32dec(data + 60); in raid3_metadata_decode_v3()
338 md->md_sync_offset = le64dec(data + 64); in raid3_metadata_decode_v3()
339 md->md_mflags = le64dec(data + 72); in raid3_metadata_decode_v3()
340 md->md_dflags = le64dec(data + 80); in raid3_metadata_decode_v3()
341 bcopy(data + 88, md->md_provider, 16); in raid3_metadata_decode_v3()
342 bcopy(data + 104, md->md_hash, 16); in raid3_metadata_decode_v3()
345 MD5Final(md->md_hash, &ctx); in raid3_metadata_decode_v3()
346 if (bcmp(md->md_hash, data + 104, 16) != 0) in raid3_metadata_decode_v3()
350 md->md_provsize = 0; in raid3_metadata_decode_v3()
355 raid3_metadata_decode_v4v5(const u_char *data, struct g_raid3_metadata *md) in raid3_metadata_decode_v4v5() argument
359 bcopy(data + 20, md->md_name, 16); in raid3_metadata_decode_v4v5()
360 md->md_id = le32dec(data + 36); in raid3_metadata_decode_v4v5()
361 md->md_no = le16dec(data + 40); in raid3_metadata_decode_v4v5()
362 md->md_all = le16dec(data + 42); in raid3_metadata_decode_v4v5()
363 md->md_genid = le32dec(data + 44); in raid3_metadata_decode_v4v5()
364 md->md_syncid = le32dec(data + 48); in raid3_metadata_decode_v4v5()
365 md->md_mediasize = le64dec(data + 52); in raid3_metadata_decode_v4v5()
366 md->md_sectorsize = le32dec(data + 60); in raid3_metadata_decode_v4v5()
367 md->md_sync_offset = le64dec(data + 64); in raid3_metadata_decode_v4v5()
368 md->md_mflags = le64dec(data + 72); in raid3_metadata_decode_v4v5()
369 md->md_dflags = le64dec(data + 80); in raid3_metadata_decode_v4v5()
370 bcopy(data + 88, md->md_provider, 16); in raid3_metadata_decode_v4v5()
371 md->md_provsize = le64dec(data + 104); in raid3_metadata_decode_v4v5()
372 bcopy(data + 112, md->md_hash, 16); in raid3_metadata_decode_v4v5()
375 MD5Final(md->md_hash, &ctx); in raid3_metadata_decode_v4v5()
376 if (bcmp(md->md_hash, data + 112, 16) != 0) in raid3_metadata_decode_v4v5()
381 raid3_metadata_decode(const u_char *data, struct g_raid3_metadata *md) in raid3_metadata_decode() argument
385 bcopy(data, md->md_magic, 16); in raid3_metadata_decode()
386 md->md_version = le32dec(data + 16); in raid3_metadata_decode()
387 switch (md->md_version) { in raid3_metadata_decode()
391 error = raid3_metadata_decode_v0v1v2(data, md); in raid3_metadata_decode()
394 error = raid3_metadata_decode_v3(data, md); in raid3_metadata_decode()
398 error = raid3_metadata_decode_v4v5(data, md); in raid3_metadata_decode()
408 raid3_metadata_dump(const struct g_raid3_metadata *md) in raid3_metadata_dump() argument
414 printf(" magic: %s\n", md->md_magic); in raid3_metadata_dump()
415 printf(" version: %u\n", (u_int)md->md_version); in raid3_metadata_dump()
416 printf(" name: %s\n", md->md_name); in raid3_metadata_dump()
417 printf(" id: %u\n", (u_int)md->md_id); in raid3_metadata_dump()
418 printf(" no: %u\n", (u_int)md->md_no); in raid3_metadata_dump()
419 printf(" all: %u\n", (u_int)md->md_all); in raid3_metadata_dump()
420 printf(" genid: %u\n", (u_int)md->md_genid); in raid3_metadata_dump()
421 printf(" syncid: %u\n", (u_int)md->md_syncid); in raid3_metadata_dump()
422 printf(" mediasize: %jd\n", (intmax_t)md->md_mediasize); in raid3_metadata_dump()
423 printf("sectorsize: %u\n", (u_int)md->md_sectorsize); in raid3_metadata_dump()
424 printf("syncoffset: %jd\n", (intmax_t)md->md_sync_offset); in raid3_metadata_dump()
426 if (md->md_mflags == 0) in raid3_metadata_dump()
429 if ((md->md_mflags & G_RAID3_DEVICE_FLAG_NOAUTOSYNC) != 0) in raid3_metadata_dump()
431 if ((md->md_mflags & G_RAID3_DEVICE_FLAG_ROUND_ROBIN) != 0) in raid3_metadata_dump()
433 if ((md->md_mflags & G_RAID3_DEVICE_FLAG_VERIFY) != 0) in raid3_metadata_dump()
435 if ((md->md_mflags & G_RAID3_DEVICE_FLAG_NOFAILSYNC) != 0) in raid3_metadata_dump()
440 if (md->md_dflags == 0) in raid3_metadata_dump()
443 if ((md->md_dflags & G_RAID3_DISK_FLAG_DIRTY) != 0) in raid3_metadata_dump()
445 if ((md->md_dflags & G_RAID3_DISK_FLAG_SYNCHRONIZING) != 0) in raid3_metadata_dump()
447 if ((md->md_dflags & G_RAID3_DISK_FLAG_FORCE_SYNC) != 0) in raid3_metadata_dump()
451 printf("hcprovider: %s\n", md->md_provider); in raid3_metadata_dump()
452 printf(" provsize: %ju\n", (uintmax_t)md->md_provsize); in raid3_metadata_dump()
455 hash[i * 2] = hex[md->md_hash[i] >> 4]; in raid3_metadata_dump()
456 hash[i * 2 + 1] = hex[md->md_hash[i] & 0x0f]; in raid3_metadata_dump()