diff --git a/bindings/java/jni/dataModel_SleuthkitJNI.cpp b/bindings/java/jni/dataModel_SleuthkitJNI.cpp index 121ca940c7c53d388025bba476a19094e8f91ec2..25ea354791e5651c2c402ccd796b59e20460b010 100644 --- a/bindings/java/jni/dataModel_SleuthkitJNI.cpp +++ b/bindings/java/jni/dataModel_SleuthkitJNI.cpp @@ -1452,13 +1452,12 @@ Java_org_sleuthkit_datamodel_SleuthkitJNI_openPoolNat(JNIEnv * env, } /* -TODO UPDATe -* Open file system with the given offset -* @return the created TSK_FS_INFO pointer +* Create new image info to use with a specific pool volume +* @return the created TSK_IMG_INFO pointer * @param env pointer to java environment this was called from * @param obj the java object this was called from -* @param a_img_info the pointer to the parent img object -* @param fs_offset the offset in bytes to the file system +* @param a_pool_info the pointer to the pool object +* @param pool_block the block number of the pool volume */ JNIEXPORT jlong JNICALL Java_org_sleuthkit_datamodel_SleuthkitJNI_getImgInfoNat (JNIEnv * env, jclass obj, jlong a_pool_info, jlong pool_block) { @@ -1653,12 +1652,12 @@ Java_org_sleuthkit_datamodel_SleuthkitJNI_readImgNat(JNIEnv * env, } /* -TODO UPDATE -* Read bytes from the given volume system -* @return number of bytes read from the volume system, -1 on error +* Read bytes from the given pool +* @return number of bytes read from the pool, -1 on error * @param env pointer to java environment this was called from * @param obj the java object this was called from -* @param a_vs_info the pointer to the volume system object +* @param a_pool_info the pointer to the pool object +* @param jbuf the buffer to write to * @param offset the offset in bytes to start at * @param len number of bytes to read */ diff --git a/bindings/java/src/org/sleuthkit/datamodel/Content.java b/bindings/java/src/org/sleuthkit/datamodel/Content.java index 89d52f0c5025321fd215d332b0179b2d463b2603..caa02b9338ce51eb361d3698d9f2cc61a372f614 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Content.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Content.java @@ -102,7 +102,7 @@ public interface Content extends SleuthkitVisitableItem { * @throws TskCoreException if critical error occurred within tsk core */ public Content getDataSource() throws TskCoreException; - + /** * Gets the child content objects of this content. * diff --git a/bindings/java/src/org/sleuthkit/datamodel/Pool.java b/bindings/java/src/org/sleuthkit/datamodel/Pool.java index be2200efba9c07a4d7780eacc1efa1d35cf70d6e..72a9eab6fcffabcbba343a50411dd51b669f8950 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/Pool.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Pool.java @@ -106,14 +106,6 @@ long getPoolHandle() throws TskCoreException { @Override public void close() { - //if (volumeSystemHandle != 0) { - // synchronized (this) { - // if (volumeSystemHandle != 0) { - // // SleuthkitJNI.closeVs(volumeSystemHandle); // closeVs is currently a no-op - // volumeSystemHandle = 0; - // } - // } - //} } @Override diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java index 766571b1925a7b45b3eaa45d04d17f859378be44..9a8b1de49d002a4d1c8f5c5ebea8ddf7e4164027 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java @@ -5737,7 +5737,6 @@ public FileSystem addFileSystem(long parentObjId, long imgOffset, TskData.TSK_FS preparedStatement.setLong(7, firstInum); preparedStatement.setLong(8, lastInum); preparedStatement.setString(9, displayName); - preparedStatement.setLong(10, 0); // TODO - deal with this properly connection.executeUpdate(preparedStatement); // Create the new FileSystem object @@ -10910,8 +10909,8 @@ private enum PREPARED_STATEMENT { INSERT_VS_INFO("INSERT INTO tsk_vs_info (obj_id, vs_type, img_offset, block_size) VALUES (?, ?, ?, ?)"), INSERT_VS_PART_SQLITE("INSERT INTO tsk_vs_parts (obj_id, addr, start, length, desc, flags) VALUES (?, ?, ?, ?, ?, ?)"), INSERT_VS_PART_POSTGRESQL("INSERT INTO tsk_vs_parts (obj_id, addr, start, length, descr, flags) VALUES (?, ?, ?, ?, ?, ?)"), - INSERT_FS_INFO("INSERT INTO tsk_fs_info (obj_id, img_offset, fs_type, block_size, block_count, root_inum, first_inum, last_inum, display_name, pool_block)" - + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + INSERT_FS_INFO("INSERT INTO tsk_fs_info (obj_id, img_offset, fs_type, block_size, block_count, root_inum, first_inum, last_inum, display_name)" + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); private final String sql; diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java index 94b37a1387828c2504194c89b25bf605a57e1e45..2f91626b74c1e452bbd7f249deae2dfe20317562 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitJNI.java @@ -824,13 +824,12 @@ public static long openVsPart(long vsHandle, long volId) throws TskCoreException } /** - * TODO update this - * Get volume Handle + * Get pool Handle * - * @param vsHandle pointer to the volume system structure in the sleuthkit - * @param volId id of the volume + * @param imgHandle pointer to the image structure in the sleuthkit + * @param offset offset of the pool * - * @return pointer to a volHandle structure in the sleuthkit + * @return pointer to a pool info structure in the sleuthkit * * @throws TskCoreException exception thrown if critical error occurs within * TSK @@ -859,8 +858,6 @@ public static long openPool(long imgHandle, long offset, SleuthkitCase skCase) t return poolHandle; } } - - } finally { releaseTSKReadLock(); } @@ -909,6 +906,21 @@ public static long openFs(long imgHandle, long fsOffset, SleuthkitCase skCase) t } } + /** + * Get file system Handle Opened handle is cached (transparently) so it does + * not need be reopened next time for the duration of the application + * + * @param imgHandle pointer to imgHandle in sleuthkit + * @param fsOffset byte offset to the file system + * @param poolHandle pointer to the pool info handle + * @param poolBlock pool block + * @param skCase the case containing the file system + * + * @return pointer to a fsHandle structure in the sleuthkit + * + * @throws TskCoreException exception thrown if critical error occurs within + * TSK + */ public static long openFsPool(long imgHandle, long fsOffset, long poolHandle, long poolBlock, SleuthkitCase skCase) throws TskCoreException { getTSKReadLock(); try { @@ -925,16 +937,15 @@ public static long openFsPool(long imgHandle, long fsOffset, long poolHandle, lo throw new TskCoreException("Missing image offset to file system handle cache for image handle " + imgHandle); } - long combinedOffset = fsOffset + poolBlock; - if (imgOffSetToFsHandle.containsKey(combinedOffset)) { + if (imgOffSetToFsHandle.containsKey(poolBlock)) { //return cached - fsHandle = imgOffSetToFsHandle.get(combinedOffset); + fsHandle = imgOffSetToFsHandle.get(poolBlock); } else { long poolImgHandle = getImgInfoNat(poolHandle, poolBlock); HandleCache.getCaseHandles(caseDbPointer).poolImgCache.add(poolImgHandle); fsHandle = openFsNat(poolImgHandle, fsOffset); //cache it - imgOffSetToFsHandle.put(combinedOffset, fsHandle); + imgOffSetToFsHandle.put(poolBlock, fsHandle); } } return fsHandle; @@ -1065,12 +1076,15 @@ public static int readVs(long vsHandle, byte[] readBuffer, long offset, long len } /** - * TODO - * @param poolHandle - * @param readBuffer - * @param offset - * @param len - * @return + * Reads data from a pool + * + * @param poolHandle handle to the pool info struct + * @param readBuffer buffer to read into + * @param offset starting offset + * @param len length + * + * @return number of bytes read + * * @throws TskCoreException */ public static int readPool(long poolHandle, byte[] readBuffer, long offset, long len) throws TskCoreException { diff --git a/bindings/java/src/org/sleuthkit/datamodel/TskData.java b/bindings/java/src/org/sleuthkit/datamodel/TskData.java index aecc8d9ae308737d6ae3a2531f699fa1ed85cd4b..7f39aed7dc23066049c795c306625fbcf1dc93bf 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/TskData.java +++ b/bindings/java/src/org/sleuthkit/datamodel/TskData.java @@ -632,7 +632,7 @@ public enum ObjectType { ABSTRACTFILE(4), ///< File - see tsk_files for more details ARTIFACT(5), /// Artifact - see blackboard_artifacts for more details REPORT(6), ///< Report - see reports for more details - POOL(7) ///< Pool + POOL(7) ///< Pool ; private short objectType; diff --git a/tsk/auto/tsk_case_db.h b/tsk/auto/tsk_case_db.h index 2ed91875572253b1f371a886bb156ae3ba064de2..eee845990c82acf2f44045eb540398e6f53ce6e3 100644 --- a/tsk/auto/tsk_case_db.h +++ b/tsk/auto/tsk_case_db.h @@ -128,8 +128,8 @@ class TskAutoDb:public TskAuto { int64_t m_curImgId; ///< Object ID of image currently being processed int64_t m_curVsId; ///< Object ID of volume system currently being processed int64_t m_curVolId; ///< Object ID of volume currently being processed - int64_t m_curPoolVol; // POOL - int64_t m_curPoolVs; // POOL - temp + int64_t m_curPoolVol; ///< Object ID of the pool volume currently being processed + int64_t m_curPoolVs; ///< Object ID of the pool volume system currently being processed int64_t m_curFsId; ///< Object ID of file system currently being processed int64_t m_curFileId; ///< Object ID of file currently being processed TSK_INUM_T m_curDirAddr; ///< Meta address the directory currently being processed diff --git a/tsk/fs/apfs_compat.cpp b/tsk/fs/apfs_compat.cpp index 03c05936afbe76385553475e179ef8dbc0d8ba14..23aeb6d8fea26fd38f95b5b9c29f47097586892f 100755 --- a/tsk/fs/apfs_compat.cpp +++ b/tsk/fs/apfs_compat.cpp @@ -173,8 +173,6 @@ APFSFSCompat::APFSFSCompat(TSK_IMG_INFO* img_info, const TSK_POOL_INFO* pool_inf _fsinfo.flags |= TSK_FS_INFO_FLAG_ENCRYPTED; } - //_fsinfo.fs_pool_info = pool_info; - //_fsinfo.fs_vol_block = vol_block; _fsinfo.img_info = img_info; _fsinfo.offset = pool.first_img_offset(); _fsinfo.block_count = vol.alloc_blocks(); diff --git a/tsk/fs/tsk_fs.h b/tsk/fs/tsk_fs.h index 89580f6688015241281f7b036e148671781d5397..1921ef79b56c3c4482bde997650d4df713090fd0 100644 --- a/tsk/fs/tsk_fs.h +++ b/tsk/fs/tsk_fs.h @@ -927,16 +927,11 @@ extern "C" { */ struct TSK_FS_INFO { int tag; ///< \internal Will be set to TSK_FS_INFO_TAG if structure is still allocated, 0 if not - //union { + struct { TSK_IMG_INFO *img_info; ///< Pointer to the image layer state TSK_OFF_T offset; ///< Byte offset into img_info that fs starts }; - // struct { - // const TSK_POOL_INFO *fs_pool_info; ///< Pointer to the pool layer state - // TSK_DADDR_T fs_vol_block; ///< Block number in the pool for the volume - // }; - //}; /* meta data */ TSK_INUM_T inum_count; ///< Number of metadata addresses diff --git a/tsk/pool/apfs_pool_compat.cpp b/tsk/pool/apfs_pool_compat.cpp index 24f175b3c497c2c1f55f166ad86472861378ae2d..95be71731b96cab4612834d0aa8f3abd2fd209ff 100755 --- a/tsk/pool/apfs_pool_compat.cpp +++ b/tsk/pool/apfs_pool_compat.cpp @@ -269,16 +269,6 @@ apfs_img_close(TSK_IMG_INFO * img_info) IMG_POOL_INFO *pool_img_info = (IMG_POOL_INFO *)img_info; - // Close the pool and original image - //if (pool_img_info->pool_info != NULL) { - // const auto pool = static_cast<APFSPoolCompat*>(pool_img_info->pool_info->impl); - // TSK_IMG_INFO *origInfo = pool->getTSKImgInfo(0); - // tsk_img_close(origInfo); - - //pool_img_info->pool_info->close(pool_img_info->pool_info); - //pool_img_info->pool_info = NULL; - //} - // Close the pool image tsk_deinit_lock(&(img_info->cache_lock)); tsk_img_free(img_info);