pub fn new(tsk_img: &TskImg, offset: u64) -> Result<Self, TskError> {
        // Get a pointer to the TSK_VS_INFO sturct
        let tsk_vs = unsafe {tsk::tsk_vs_open(
            tsk_img.handle.as_ptr(),
            offset as _,
            0
        )};

        // Ensure that the ptr is not null
        let handle = match NonNull::new(tsk_vs) {
            None => {
                // Get a ptr to the error msg
                let error_msg_ptr = unsafe { tsk::tsk_error_get() };
                // Get the error message from the string
                let error_msg = unsafe { CStr::from_ptr(error_msg_ptr) }.to_string_lossy();
                // Return an error which includes the TSK error message
                return Err(TskError::lib_tsk_error(
                    format!("There was an error opening the TSK_VS_INFO handle at offset {}: {}", offset, error_msg)
                ));
            },
            Some(h) => h
        };

        Ok( Self { handle } )
    }
/// Create a TSK_VS_INFO wrapper given the TskImg and offset of the file system
Create a TSK_VS_INFO wrapper given the TskImg and offset of the file system
Create a TSK_VS_INFO wrapper given the TskImg and offset of the file system
pub fn new(tsk_img: &TskImg, offset: u64) -> Result<Self, TskError> {
        // Get a pointer to the TSK_VS_INFO sturct
        let tsk_vs = unsafe {tsk::tsk_vs_open(
            tsk_img.handle.as_ptr(),
            offset as _,
            0
        )};
        // Ensure that the ptr is not null
        let handle = match NonNull::new(tsk_vs) {
            None => {
                // Get a ptr to the error msg
                let error_msg_ptr = unsafe { tsk::tsk_error_get() };
                // Get the error message from the string
                let error_msg = unsafe { CStr::from_ptr(error_msg_ptr) }.to_string_lossy();
                // Return an error which includes the TSK error message
                return Err(TskError::lib_tsk_error(
                    format!("There was an error opening the TSK_VS_INFO handle at offset {}: {}", offset, error_msg)
                ));
            },
            Some(h) => h
        };
        Ok( Self { handle } )
    }
pub fn new ( tsk_img : & TskImg , offset : u64 ) -> Result < Self , TskError > { // Get a pointer to the TSK_VS_INFO sturct let tsk_vs = unsafe { tsk :: tsk_vs_open ( tsk_img . handle . as_ptr ( ) , offset as _ , 0 ) } ; // Ensure that the ptr is not null let handle = match NonNull :: new ( tsk_vs ) { None => { // Get a ptr to the error msg let error_msg_ptr = unsafe { tsk :: tsk_error_get ( ) } ; // Get the error message from the string let error_msg = unsafe { CStr :: from_ptr ( error_msg_ptr ) } . to_string_lossy ( ) ; // Return an error which includes the TSK error message return Err ( TskError :: lib_tsk_error ( format ! ( " " offset error_msg ) ) ) ; } , Some ( h ) => h } ; Ok ( Self { handle } ) }
Create a TSK_VS_INFO wrapper given the TskImg and offset of the file system
Create a TSK_VS_INFO wrapper given the TskImg and offset of the file system
tsk_img
&TskImg
offset
u64