// Path: src/jext2/Filesystem.java
// public class Filesystem {
// 	private static Charset charset = Charset.defaultCharset();
// 	private static Logger logger;
// 
// 	static class Jext2Formatter extends Formatter {
// 		private static final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
// 
// 		@Override
// 		public String format(LogRecord record) {
// 			StringBuilder s = new StringBuilder(1000)
// 			// Timestamp
// 			.append(df.format(new Date(record.getMillis())))
// 			.append("  ")
// 
// 			// Source class name
// 			.append("[")
// 			.append(record.getSourceClassName())
// 			.append(".")
// 			.append(record.getSourceMethodName())
// 			.append("]")
// 			.append("  ")
// 
// 			// Loglevel
// 			.append(record.getLevel())
// 			.append("  ")
// 
// 			// Message
// 			.append(formatMessage(record))
// 			.append("\n");
// 			return s.toString();
// 		}
// 	}
// 
// 	public static Charset getCharset() {
// 		return charset;
// 	}
// 	public static void setCharset(Charset charset) {
// 		Filesystem.charset = charset;
// 	}
// 
// 	/**
// 	 * Get the PID of the running process
// 	 */
// 	public static long getPID() {
// 		String appName = ManagementFactory.getRuntimeMXBean().getName();
// 		String strPid = appName.substring(0, appName.indexOf('@')-1);
// 		return Long.parseLong(strPid);
// 	}
// 
// 	public static void initializeLoggingToFile(String logfile) throws IOException {
// 		FileHandler handler = new FileHandler(logfile);
// 		handler.setFormatter(new Jext2Formatter());
// 
// 		logger.addHandler(handler);
// 	}
// 
// 	public static void initializeLoggingToConsole() {
// 		ConsoleHandler handler = new ConsoleHandler();
// 		handler.setFormatter(new Jext2Formatter());
// 
// 		logger.addHandler(handler);
// 	}
// 	
// 	public static void initializeLogging() {
// 		LogManager logman = LogManager.getLogManager();
// 		logman.reset();
// 
// 		logger = Logger.getLogger("jext2");
// 		logger.setLevel(Level.WARNING);
// 	}
// 
// 	public static void setLogLevel(String level) {
// 		logger.setLevel(Level.parse(level));
// 	}
// 
// 	public static Logger getLogger() {
// 		return logger;
// 	}
// }


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.Constructor;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import java.util.logging.Handler;
import java.util.logging.Logger;
import jext2.Filesystem;
import jlowfuse.JLowFuse;
import jlowfuse.JLowFuseArgs;
import jlowfuse.async.DefaultTaskImplementations;
import jlowfuse.async.TaskImplementations;
import jlowfuse.async.tasks.JLowFuseTask;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import fuse.Fuse;
import fuse.SWIGTYPE_p_fuse_chan;
import fuse.SWIGTYPE_p_fuse_session;
import fuse.Session;
			} catch (IOException e) {
				System.err.println(Arrays.toString(e.getStackTrace()));
				System.err.println(e.getLocalizedMessage());
			}
		}

		private void shutdownThreadPool() {
	    	logger.info("Shutting down thread pool");

			service.shutdown();

			try {
		    	logger.info("Waiting for "+ (service.getActiveCount()+service.getQueue().size()) + " tasks to finish");
				System.out.println("Awaiting Termination... Queued: " + service.getQueue()
														  +" Running: " + service.getActiveCount());
				service.awaitTermination(120, TimeUnit.SECONDS);
			} catch (InterruptedException e) {
				System.err.println("Thread pool shutdown interrupted!");
				System.err.println(Arrays.toString(e.getStackTrace()));
			}
		}

		private void shutdownFuse() {
	    	logger.info("Fuse shutdown, Unmounting..");
			Session.removeChan(chan);
			Session.exit(sess);
			Fuse.unmount(mountpoint, chan);
		}

		private void flushLog() {
// Path: src/jext2/Filesystem.java
// public class Filesystem {
// 	private static Charset charset = Charset.defaultCharset();
// 	private static Logger logger;
// 
// 	static class Jext2Formatter extends Formatter {
// 		private static final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
// 
// 		@Override
// 		public String format(LogRecord record) {
// 			StringBuilder s = new StringBuilder(1000)
// 			// Timestamp
// 			.append(df.format(new Date(record.getMillis())))
// 			.append("  ")
// 
// 			// Source class name
// 			.append("[")
// 			.append(record.getSourceClassName())
// 			.append(".")
// 			.append(record.getSourceMethodName())
// 			.append("]")
// 			.append("  ")
// 
// 			// Loglevel
// 			.append(record.getLevel())
// 			.append("  ")
// 
// 			// Message
// 			.append(formatMessage(record))
// 			.append("\n");
// 			return s.toString();
// 		}
// 	}
// 
// 	public static Charset getCharset() {
// 		return charset;
// 	}
// 	public static void setCharset(Charset charset) {
// 		Filesystem.charset = charset;
// 	}
// 
// 	/**
// 	 * Get the PID of the running process
// 	 */
// 	public static long getPID() {
// 		String appName = ManagementFactory.getRuntimeMXBean().getName();
// 		String strPid = appName.substring(0, appName.indexOf('@')-1);
// 		return Long.parseLong(strPid);
// 	}
// 
// 	public static void initializeLoggingToFile(String logfile) throws IOException {
// 		FileHandler handler = new FileHandler(logfile);
// 		handler.setFormatter(new Jext2Formatter());
// 
// 		logger.addHandler(handler);
// 	}
// 
// 	public static void initializeLoggingToConsole() {
// 		ConsoleHandler handler = new ConsoleHandler();
// 		handler.setFormatter(new Jext2Formatter());
// 
// 		logger.addHandler(handler);
// 	}
// 	
// 	public static void initializeLogging() {
// 		LogManager logman = LogManager.getLogManager();
// 		logman.reset();
// 
// 		logger = Logger.getLogger("jext2");
// 		logger.setLevel(Level.WARNING);
// 	}
// 
// 	public static void setLogLevel(String level) {
// 		logger.setLevel(Level.parse(level));
// 	}
// 
// 	public static Logger getLogger() {
// 		return logger;
// 	}
// }


// Path: src/fusejext2/FuseJExt2.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.Constructor;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import java.util.logging.Handler;
import java.util.logging.Logger;
import jext2.Filesystem;
import jlowfuse.JLowFuse;
import jlowfuse.JLowFuseArgs;
import jlowfuse.async.DefaultTaskImplementations;
import jlowfuse.async.TaskImplementations;
import jlowfuse.async.tasks.JLowFuseTask;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import fuse.Fuse;
import fuse.SWIGTYPE_p_fuse_chan;
import fuse.SWIGTYPE_p_fuse_session;
import fuse.Session;

			} catch (IOException e) {
				System.err.println(Arrays.toString(e.getStackTrace()));
				System.err.println(e.getLocalizedMessage());
			}
		}

		private void shutdownThreadPool() {
	    	logger.info("Shutting down thread pool");

			service.shutdown();

			try {
		    	logger.info("Waiting for "+ (service.getActiveCount()+service.getQueue().size()) + " tasks to finish");
				System.out.println("Awaiting Termination... Queued: " + service.getQueue()
														  +" Running: " + service.getActiveCount());
				service.awaitTermination(120, TimeUnit.SECONDS);
			} catch (InterruptedException e) {
				System.err.println("Thread pool shutdown interrupted!");
				System.err.println(Arrays.toString(e.getStackTrace()));
			}
		}

		private void shutdownFuse() {
	    	logger.info("Fuse shutdown, Unmounting..");
			Session.removeChan(chan);
			Session.exit(sess);
			Fuse.unmount(mountpoint, chan);
		}

		private void flushLog() {
			for (Handler h : Filesystem.getLogger().getHandlers()) {