// Path: src/jext2/RegularInode.java
// public class RegularInode extends DataInode {
// 	protected RegularInode(long blockNr, int offset) throws IoError {
// 		super(blockNr, offset);
// 	}
// 
// 	public static RegularInode fromByteBuffer(ByteBuffer buf, int offset) throws IoError {
// 		RegularInode inode = new RegularInode(-1, offset);
// 		inode.read(buf);
// 		return inode;
// 	}
// 
// 	@Override
// 	public short getFileType() {
// 		return DirectoryEntry.FILETYPE_REG_FILE;
// 	}
// 
// 	@Override
// 	public boolean isSymlink() {
// 		return false;
// 	}
// 
// 	@Override
// 	public boolean isDirectory() {
// 		return false;
// 	}
// 
// 	@Override
// 	public boolean isRegularFile() {
// 		return true;
// 	}
// 
// 	/**
// 	 * Set size. For regular inodes the size is stored in i_size and i_dir_acl
// 	 *
// 	 */
// 	@Override
// 	public void setSize(long newsize) {
// 		super.setSize(newsize & Ext2fsDataTypes.LE32_MAX);
// 		super.setDirAcl((newsize >>> Ext2fsDataTypes.LE32_SIZE) & Ext2fsDataTypes.LE32_MAX);
// 	}
// 
// 	@Override
// 	public long getSize() {
// 		return super.getSize() + (super.getDirAcl() << Ext2fsDataTypes.LE32_SIZE);
// 	}
// 
// 	/**
// 	 * Set size and truncate.
// 	 * @param   size    new size
// 	 * @throws FileTooLarge
// 	 */
// 	@NotThreadSafe(useLock=false)  // XXX will be thread safe once truncate is
// 	public void setSizeAndTruncate(long size) throws JExt2Exception, FileTooLarge {
// 		if (size < 0)
// 			throw new IllegalArgumentException("Try to set negative file size");
// 		long oldSize = getSize();
// 		setSize(size);
// 		if (oldSize > size)
// 			accessData().truncate(size);
// 	}
// 
// 	/**
// 	 * Create empty Inode. Initialize *Times, block array.
// 	 */
// 	public static RegularInode createEmpty() throws IoError {
// 		RegularInode inode = new RegularInode(-1, -1);
// 		Date now = new Date();
// 
// 		inode.setModificationTime(now);
// 		inode.setAccessTime(now);
// 		inode.setStatusChangeTime(now);
// 		inode.setDeletionTime(new Date(0));
// 		inode.setMode(new ModeBuilder().regularFile().create());
// 		inode.setBlock(new long[Constants.EXT2_N_BLOCKS]);
// 
// 		return inode;
// 	}
// }
// 
// Path: src/jext2/exceptions/JExt2Exception.java
// public class JExt2Exception extends Exception {
// 	protected static final int ERRNO = -1;
// 
// 	private static final long serialVersionUID = -7429088074385678308L;
// 
// 	Logger logger = Filesystem.getLogger();
// 
// 	public JExt2Exception() {
// 		log("");
// 	}
// 
// 	public JExt2Exception(String msg) {
// 		log(msg);
// 	}
// 
// 	private void log(String msg) {
// 		if (logger.isLoggable(Level.FINE)) {
// 			StackTraceElement[] stack = getStackTrace();
// 
// 			StringBuilder log = new StringBuilder();
// 			log.append("JEXT2 exception was raised: ");
// 			log.append(this.getClass().getSimpleName());
// 			log.append(" source=");
// 			log.append(stack[0].getClassName());
// 			log.append("->");
// 			log.append(stack[0].getMethodName());
// 			log.append(" msg=");
// 			log.append(msg);
// 			log.append(" errno=");
// 			log.append(getErrno());
// 
// 			logger.fine(log.toString());
// 		}
// 	}
// 
// 	public int getErrno() {
// 		throw new RuntimeException("This method should not be executed. " +
// 				"- The errno value defined here is meaningless");
// 	}
// }
// 
// Path: src/fusejext2/Jext2Context.java
// public class Jext2Context extends Context {
// 	public BlockAccess blocks;
// 	public Superblock superblock;
// 	public BlockGroupAccess blockGroups;
// 
// 	public FileChannel blockDev;
// 
// 	public InodeAccess inodes;
// 
// 	public Jext2Context(FileChannel blockDev) {
// 		this.blockDev = blockDev;
// 	}
// }


import java.nio.ByteBuffer;
import jext2.RegularInode;
import jext2.exceptions.JExt2Exception;
import jlowfuse.FuseReq;
import jlowfuse.Reply;
import fuse.FileInfo;
import fusejext2.Jext2Context;
/*
 * Copyright (c) 2011 Marcel Lauhoff.
 * 
 * This file is part of jext2.
 * 
 * jext2 is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * jext2 is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with jext2.  If not, see <http://www.gnu.org/licenses/>.
 */

package fusejext2.tasks;




public class Read extends jlowfuse.async.tasks.Read<Jext2Context> {

	public Read(FuseReq req, long ino, long size, long off, FileInfo fi) {
		super(req, ino, size, off, fi);
	}

	@Override
	public void run() {
		try {
// Path: src/jext2/RegularInode.java
// public class RegularInode extends DataInode {
// 	protected RegularInode(long blockNr, int offset) throws IoError {
// 		super(blockNr, offset);
// 	}
// 
// 	public static RegularInode fromByteBuffer(ByteBuffer buf, int offset) throws IoError {
// 		RegularInode inode = new RegularInode(-1, offset);
// 		inode.read(buf);
// 		return inode;
// 	}
// 
// 	@Override
// 	public short getFileType() {
// 		return DirectoryEntry.FILETYPE_REG_FILE;
// 	}
// 
// 	@Override
// 	public boolean isSymlink() {
// 		return false;
// 	}
// 
// 	@Override
// 	public boolean isDirectory() {
// 		return false;
// 	}
// 
// 	@Override
// 	public boolean isRegularFile() {
// 		return true;
// 	}
// 
// 	/**
// 	 * Set size. For regular inodes the size is stored in i_size and i_dir_acl
// 	 *
// 	 */
// 	@Override
// 	public void setSize(long newsize) {
// 		super.setSize(newsize & Ext2fsDataTypes.LE32_MAX);
// 		super.setDirAcl((newsize >>> Ext2fsDataTypes.LE32_SIZE) & Ext2fsDataTypes.LE32_MAX);
// 	}
// 
// 	@Override
// 	public long getSize() {
// 		return super.getSize() + (super.getDirAcl() << Ext2fsDataTypes.LE32_SIZE);
// 	}
// 
// 	/**
// 	 * Set size and truncate.
// 	 * @param   size    new size
// 	 * @throws FileTooLarge
// 	 */
// 	@NotThreadSafe(useLock=false)  // XXX will be thread safe once truncate is
// 	public void setSizeAndTruncate(long size) throws JExt2Exception, FileTooLarge {
// 		if (size < 0)
// 			throw new IllegalArgumentException("Try to set negative file size");
// 		long oldSize = getSize();
// 		setSize(size);
// 		if (oldSize > size)
// 			accessData().truncate(size);
// 	}
// 
// 	/**
// 	 * Create empty Inode. Initialize *Times, block array.
// 	 */
// 	public static RegularInode createEmpty() throws IoError {
// 		RegularInode inode = new RegularInode(-1, -1);
// 		Date now = new Date();
// 
// 		inode.setModificationTime(now);
// 		inode.setAccessTime(now);
// 		inode.setStatusChangeTime(now);
// 		inode.setDeletionTime(new Date(0));
// 		inode.setMode(new ModeBuilder().regularFile().create());
// 		inode.setBlock(new long[Constants.EXT2_N_BLOCKS]);
// 
// 		return inode;
// 	}
// }
// 
// Path: src/jext2/exceptions/JExt2Exception.java
// public class JExt2Exception extends Exception {
// 	protected static final int ERRNO = -1;
// 
// 	private static final long serialVersionUID = -7429088074385678308L;
// 
// 	Logger logger = Filesystem.getLogger();
// 
// 	public JExt2Exception() {
// 		log("");
// 	}
// 
// 	public JExt2Exception(String msg) {
// 		log(msg);
// 	}
// 
// 	private void log(String msg) {
// 		if (logger.isLoggable(Level.FINE)) {
// 			StackTraceElement[] stack = getStackTrace();
// 
// 			StringBuilder log = new StringBuilder();
// 			log.append("JEXT2 exception was raised: ");
// 			log.append(this.getClass().getSimpleName());
// 			log.append(" source=");
// 			log.append(stack[0].getClassName());
// 			log.append("->");
// 			log.append(stack[0].getMethodName());
// 			log.append(" msg=");
// 			log.append(msg);
// 			log.append(" errno=");
// 			log.append(getErrno());
// 
// 			logger.fine(log.toString());
// 		}
// 	}
// 
// 	public int getErrno() {
// 		throw new RuntimeException("This method should not be executed. " +
// 				"- The errno value defined here is meaningless");
// 	}
// }
// 
// Path: src/fusejext2/Jext2Context.java
// public class Jext2Context extends Context {
// 	public BlockAccess blocks;
// 	public Superblock superblock;
// 	public BlockGroupAccess blockGroups;
// 
// 	public FileChannel blockDev;
// 
// 	public InodeAccess inodes;
// 
// 	public Jext2Context(FileChannel blockDev) {
// 		this.blockDev = blockDev;
// 	}
// }


// Path: src/fusejext2/tasks/Read.java
import java.nio.ByteBuffer;
import jext2.RegularInode;
import jext2.exceptions.JExt2Exception;
import jlowfuse.FuseReq;
import jlowfuse.Reply;
import fuse.FileInfo;
import fusejext2.Jext2Context;

/*
 * Copyright (c) 2011 Marcel Lauhoff.
 * 
 * This file is part of jext2.
 * 
 * jext2 is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * jext2 is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with jext2.  If not, see <http://www.gnu.org/licenses/>.
 */

package fusejext2.tasks;




public class Read extends jlowfuse.async.tasks.Read<Jext2Context> {

	public Read(FuseReq req, long ino, long size, long off, FileInfo fi) {
		super(req, ino, size, off, fi);
	}

	@Override
	public void run() {
		try {
			RegularInode inode = (RegularInode)(context.inodes.getOpened(ino));