19 package org.sleuthkit.datamodel;
21 import java.util.List;
22 import org.apache.commons.lang3.ArrayUtils;
33 private long imgOffset, blockSize, blockCount, rootInum,
37 private volatile long filesystemHandle = 0;
55 long first_inum,
long last_inum) {
56 super(db, obj_id, name);
57 this.imgOffset = img_offset;
58 this.fsType = fs_type;
59 this.blockSize = block_size;
60 this.blockCount = block_count;
61 this.rootInum = root_inum;
62 this.firstInum = first_inum;
63 this.lastInum = last_inum;
74 if (dataSource instanceof
Image && ArrayUtils.isEmpty(((
Image) dataSource).getPaths())) {
82 return blockSize * blockCount;
95 if (filesystemHandle == 0) {
97 if (filesystemHandle == 0) {
99 if ((dataSource == null) || ( !(dataSource instanceof
Image))) {
100 throw new TskCoreException(
"Data Source of File System is not an image");
103 Image image = (Image) dataSource;
106 if (isPoolContent()) {
107 Pool pool = getPool();
109 throw new TskCoreException(
"Error finding pool for file system");
112 Volume poolVolume = getPoolVolume();
113 if (poolVolume == null) {
114 throw new TskCoreException(
"File system is in a pool but has no volume");
116 filesystemHandle = SleuthkitJNI.openFsPool(image.getImageHandle(), imgOffset, pool.getPoolHandle(), poolVolume.getStart(),
getSleuthkitCase());
118 filesystemHandle = SleuthkitJNI.openFs(image.getImageHandle(), imgOffset,
getSleuthkitCase());
123 return this.filesystemHandle;
129 if (children.size() != 1) {
130 throw new TskCoreException(
"FileSystem must have only one child.");
133 if (!(children.get(0) instanceof
Directory)) {
134 throw new TskCoreException(
"Child of FileSystem must be a Directory.");
203 @SuppressWarnings(
"deprecation")
207 if (filesystemHandle != 0) {
209 filesystemHandle = 0;
218 return v.
visit(
this);
222 public <T> T accept(ContentVisitor<T> v) {
223 return v.visit(
this);
228 return super.toString(preserveState) +
"FileSystem [\t" +
" blockCount " + blockCount +
"\t" +
"blockSize " + blockSize +
"\t" +
"firstInum " + firstInum +
"\t" +
"fsType " + fsType +
"\t" +
"imgOffset " + imgOffset +
"\t" +
"lastInum " + lastInum +
"\t" +
"rootInum " + rootInum +
"\t" +
"]";
String toString(boolean preserveState)
List< Content > getChildren()
Directory getRootDirectory()
int read(byte[] buf, long offset, long len)
SleuthkitCase getSleuthkitCase()
FileSystem(SleuthkitCase db, long obj_id, String name, long img_offset, TskData.TSK_FS_TYPE_ENUM fs_type, long block_size, long block_count, long root_inum, long first_inum, long last_inum)
TskData.TSK_FS_TYPE_ENUM getFsType()
static int readFs(long fsHandle, byte[] readBuffer, long offset, long len)