/* -*- Mode: C++; tab-width: 8; c-basic-offset: 8 -*-
 *
 */

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "LFSFileSystem.h"
#include "Exception.h"

int
main(int /* argc */, char* argv[])
{
	int fd;

	if ((fd = open(argv[1], O_RDONLY)) < 0) {
		fprintf(stderr, "%s: unable to mount %s: %s\n",
			argv[0], argv[1], strerror(errno));

		return 1;
	}

	int error = 0;
	try {
		CLFSFileSystem lfsFileSystem(fd);
		lfsFileSystem.Mount();
		lfsFileSystem.VerifySegmentBlockCounts();
	}
	catch (CException* ex) {
		fprintf(stderr, "%s: %s\n", argv[0], ex->GetMessage());
		delete ex;
	}
	close(fd);
	return error;
}

