Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/fstyp/hammer.c
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | __test_ondisk(const hammer_volume_ondisk_t ondisk) | ||||
if (ondisk->vol_count < 1 || ondisk->vol_count > HAMMER_MAX_VOLUMES) | if (ondisk->vol_count < 1 || ondisk->vol_count > HAMMER_MAX_VOLUMES) | ||||
return (4); | return (4); | ||||
if (count == 0) { | if (count == 0) { | ||||
count = ondisk->vol_count; | count = ondisk->vol_count; | ||||
assert(count != 0); | assert(count != 0); | ||||
memcpy(&fsid, &ondisk->vol_fsid, sizeof(fsid)); | memcpy(&fsid, &ondisk->vol_fsid, sizeof(fsid)); | ||||
memcpy(&fstype, &ondisk->vol_fstype, sizeof(fstype)); | memcpy(&fstype, &ondisk->vol_fstype, sizeof(fstype)); | ||||
strncpy(label, ondisk->vol_label, sizeof(label)); | strlcpy(label, ondisk->vol_label, sizeof(label)); | ||||
} else { | } else { | ||||
if (ondisk->vol_count != count) | if (ondisk->vol_count != count) | ||||
return (5); | return (5); | ||||
if (memcmp(&ondisk->vol_fsid, &fsid, sizeof(fsid))) | if (memcmp(&ondisk->vol_fsid, &fsid, sizeof(fsid))) | ||||
return (6); | return (6); | ||||
if (memcmp(&ondisk->vol_fstype, &fstype, sizeof(fstype))) | if (memcmp(&ondisk->vol_fstype, &fstype, sizeof(fstype))) | ||||
return (7); | return (7); | ||||
if (strncmp(ondisk->vol_label, label, sizeof(label))) | if (strcmp(ondisk->vol_label, label)) | ||||
return (8); | return (8); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
fstyp_hammer(FILE *fp, char *label, size_t size) | fstyp_hammer(FILE *fp, char *label, size_t size) | ||||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |