+/*
+ * Replay the journal. We don't care if there are problems.
+ */
+static void
+replay_journal(const char *device)
+{
+ struct vfsconf vfc;
+ int mib[4];
+ int fd = -1;
+
+ fd = open(device, O_RDWR);
+ if (fd == -1) {
+ warn("Could not open block device %s for writing", device);
+ goto done;
+ }
+ if (getvfsbyname("hfs", &vfc) != 0) {
+ warn("Could not get hfs vfs information");
+ goto done;
+ }
+ mib[0] = CTL_VFS;
+ mib[1] = vfc.vfc_typenum;
+ mib[2] = HFS_REPLAY_JOURNAL;
+ mib[3] = fd;
+ (void)sysctl(mib, 4, NULL, NULL, NULL, 0);
+
+done:
+ if (fd != -1)
+ close(fd);
+ return;
+}
+