commit libfsext for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libfsext for openSUSE:Factory checked in at 2022-08-31 18:08:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libfsext (Old) and /work/SRC/openSUSE:Factory/.libfsext.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libfsext" Wed Aug 31 18:08:53 2022 rev:8 rq:1000307 version:20220829 Changes: -------- --- /work/SRC/openSUSE:Factory/libfsext/libfsext.changes 2022-08-30 14:49:58.160195340 +0200 +++ /work/SRC/openSUSE:Factory/.libfsext.new.2083/libfsext.changes 2022-08-31 18:09:00.463378585 +0200 @@ -1,0 +2,6 @@ +Tue Aug 30 14:59:26 UTC 2022 - Jan Engelhardt <jengelh@inai.de> + +- Update to release 20220829 + * Unspecified updates to the API + +------------------------------------------------------------------- Old: ---- libfsext-experimental-20220822.tar.gz libfsext-experimental-20220822.tar.gz.asc New: ---- libfsext-experimental-20220829.tar.gz libfsext-experimental-20220829.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libfsext.spec ++++++ --- /var/tmp/diff_new_pack.Lgxgtb/_old 2022-08-31 18:09:00.975379940 +0200 +++ /var/tmp/diff_new_pack.Lgxgtb/_new 2022-08-31 18:09:00.979379950 +0200 @@ -18,7 +18,7 @@ %define lname libfsext1 Name: libfsext -Version: 20220822 +Version: 20220829 Release: 0 Summary: Library and tools to access the Extended File System License: GFDL-1.3-or-later AND LGPL-3.0-or-later ++++++ libfsext-experimental-20220822.tar.gz -> libfsext-experimental-20220829.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/common/config.h new/libfsext-20220829/common/config.h --- old/libfsext-20220822/common/config.h 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/common/config.h 2022-08-30 16:12:51.000000000 +0200 @@ -593,7 +593,7 @@ #define PACKAGE_NAME "libfsext" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libfsext 20220822" +#define PACKAGE_STRING "libfsext 20220829" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libfsext" @@ -602,7 +602,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "20220822" +#define PACKAGE_VERSION "20220829" /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 @@ -635,7 +635,7 @@ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ -#define VERSION "20220822" +#define VERSION "20220829" /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/configure new/libfsext-20220829/configure --- old/libfsext-20220822/configure 2022-08-22 07:04:27.000000000 +0200 +++ new/libfsext-20220829/configure 2022-08-30 16:12:34.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for libfsext 20220822. +# Generated by GNU Autoconf 2.71 for libfsext 20220829. # # Report bugs to <joachim.metz@gmail.com>. # @@ -621,8 +621,8 @@ # Identity of this package. PACKAGE_NAME='libfsext' PACKAGE_TARNAME='libfsext' -PACKAGE_VERSION='20220822' -PACKAGE_STRING='libfsext 20220822' +PACKAGE_VERSION='20220829' +PACKAGE_STRING='libfsext 20220829' PACKAGE_BUGREPORT='joachim.metz@gmail.com' PACKAGE_URL='' @@ -1715,7 +1715,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libfsext 20220822 to adapt to many kinds of systems. +\`configure' configures libfsext 20220829 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1786,7 +1786,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libfsext 20220822:";; + short | recursive ) echo "Configuration of libfsext 20220829:";; esac cat <<\_ACEOF @@ -2061,7 +2061,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libfsext configure 20220822 +libfsext configure 20220829 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2782,7 +2782,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libfsext $as_me 20220822, which was +It was created by libfsext $as_me 20220829, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -4272,7 +4272,7 @@ # Define the identity of the package. PACKAGE='libfsext' - VERSION='20220822' + VERSION='20220829' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -60283,7 +60283,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libfsext $as_me 20220822, which was +This file was extended by libfsext $as_me 20220829, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -60351,7 +60351,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -libfsext config.status 20220822 +libfsext config.status 20220829 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/configure.ac new/libfsext-20220829/configure.ac --- old/libfsext-20220822/configure.ac 2022-08-22 06:35:24.000000000 +0200 +++ new/libfsext-20220829/configure.ac 2022-08-29 07:00:03.000000000 +0200 @@ -2,7 +2,7 @@ AC_INIT( [libfsext], - [20220822], + [20220829], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/dpkg/changelog new/libfsext-20220829/dpkg/changelog --- old/libfsext-20220822/dpkg/changelog 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/dpkg/changelog 2022-08-30 16:12:51.000000000 +0200 @@ -1,5 +1,5 @@ -libfsext (20220822-1) unstable; urgency=low +libfsext (20220829-1) unstable; urgency=low * Auto-generated - -- Joachim Metz <joachim.metz@gmail.com> Mon, 22 Aug 2022 07:04:43 +0200 + -- Joachim Metz <joachim.metz@gmail.com> Tue, 30 Aug 2022 16:12:49 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/include/libfsext/definitions.h new/libfsext-20220829/include/libfsext/definitions.h --- old/libfsext-20220822/include/libfsext/definitions.h 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/include/libfsext/definitions.h 2022-08-30 16:12:50.000000000 +0200 @@ -24,11 +24,11 @@ #include <libfsext/types.h> -#define LIBFSEXT_VERSION 20220822 +#define LIBFSEXT_VERSION 20220829 /* The version string */ -#define LIBFSEXT_VERSION_STRING "20220822" +#define LIBFSEXT_VERSION_STRING "20220829" /* The file access * bit 1 set to 1 for read access diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/include/libfsext.h new/libfsext-20220829/include/libfsext.h --- old/libfsext-20220822/include/libfsext.h 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/include/libfsext.h 2022-08-30 16:12:50.000000000 +0200 @@ -953,6 +953,27 @@ size64_t *size, libfsext_error_t **error ); +/* Retrieves the number of extents + * Returns 1 if successful or -1 on error + */ +LIBFSEXT_EXTERN \ +int libfsext_extended_attribute_get_number_of_extents( + libfsext_extended_attribute_t *extended_attribute, + int *number_of_extents, + libfsext_error_t **error ); + +/* Retrieves a specific extent + * Returns 1 if successful or -1 on error + */ +LIBFSEXT_EXTERN \ +int libfsext_extended_attribute_get_extent_by_index( + libfsext_extended_attribute_t *extended_attribute, + int extent_index, + off64_t *extent_offset, + size64_t *extent_size, + uint32_t *extent_flags, + libfsext_error_t **error ); + #if defined( __cplusplus ) } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/include/libfsext.h.in new/libfsext-20220829/include/libfsext.h.in --- old/libfsext-20220822/include/libfsext.h.in 2022-08-22 06:35:33.000000000 +0200 +++ new/libfsext-20220829/include/libfsext.h.in 2022-08-28 21:53:16.000000000 +0200 @@ -953,6 +953,27 @@ size64_t *size, libfsext_error_t **error ); +/* Retrieves the number of extents + * Returns 1 if successful or -1 on error + */ +LIBFSEXT_EXTERN \ +int libfsext_extended_attribute_get_number_of_extents( + libfsext_extended_attribute_t *extended_attribute, + int *number_of_extents, + libfsext_error_t **error ); + +/* Retrieves a specific extent + * Returns 1 if successful or -1 on error + */ +LIBFSEXT_EXTERN \ +int libfsext_extended_attribute_get_extent_by_index( + libfsext_extended_attribute_t *extended_attribute, + int extent_index, + off64_t *extent_offset, + size64_t *extent_size, + uint32_t *extent_flags, + libfsext_error_t **error ); + #if defined( __cplusplus ) } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/libfsext/libfsext.rc new/libfsext-20220829/libfsext/libfsext.rc --- old/libfsext-20220822/libfsext/libfsext.rc 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/libfsext/libfsext.rc 2022-08-30 16:12:51.000000000 +0200 @@ -22,12 +22,12 @@ BLOCK "040904E4" BEGIN VALUE "FileDescription", "Library to support the Extended File System (ext) format\0" - VALUE "FileVersion", "20220822" "\0" + VALUE "FileVersion", "20220829" "\0" VALUE "InternalName", "libfsext.dll\0" VALUE "LegalCopyright", "(C) 2010-2022, Joachim Metz <joachim.metz@gmail.com>\0" VALUE "OriginalFilename", "libfsext.dll\0" VALUE "ProductName", "libfsext\0" - VALUE "ProductVersion", "20220822" "\0" + VALUE "ProductVersion", "20220829" "\0" VALUE "Comments", "For more information visit https://github.com/libyal/libfsext/\0" END END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/libfsext/libfsext_attribute_values.c new/libfsext-20220829/libfsext/libfsext_attribute_values.c --- old/libfsext-20220822/libfsext/libfsext_attribute_values.c 2022-08-22 06:35:33.000000000 +0200 +++ new/libfsext-20220829/libfsext/libfsext_attribute_values.c 2022-08-28 22:09:48.000000000 +0200 @@ -128,15 +128,15 @@ } if( *attribute_values != NULL ) { - if( ( *attribute_values )->name != NULL ) + if( ( *attribute_values )->value_data != NULL ) { memory_free( - ( *attribute_values )->name ); + ( *attribute_values )->value_data ); } - if( ( *attribute_values )->value_data != NULL ) + if( ( *attribute_values )->name != NULL ) { memory_free( - ( *attribute_values )->value_data ); + ( *attribute_values )->name ); } memory_free( *attribute_values ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/libfsext/libfsext_definitions.h new/libfsext-20220829/libfsext/libfsext_definitions.h --- old/libfsext-20220822/libfsext/libfsext_definitions.h 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/libfsext/libfsext_definitions.h 2022-08-30 16:12:50.000000000 +0200 @@ -37,11 +37,11 @@ * for local use of libfsext */ #else -#define LIBFSEXT_VERSION 20220822 +#define LIBFSEXT_VERSION 20220829 /* The version string */ -#define LIBFSEXT_VERSION_STRING "20220822" +#define LIBFSEXT_VERSION_STRING "20220829" /* The file access * bit 1 set to 1 for read access diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/libfsext/libfsext_extended_attribute.c new/libfsext-20220829/libfsext/libfsext_extended_attribute.c --- old/libfsext-20220822/libfsext/libfsext_extended_attribute.c 2022-08-22 06:35:33.000000000 +0200 +++ new/libfsext-20220829/libfsext/libfsext_extended_attribute.c 2022-08-29 06:59:34.000000000 +0200 @@ -26,6 +26,7 @@ #include "libfsext_attribute_values.h" #include "libfsext_block_stream.h" #include "libfsext_extended_attribute.h" +#include "libfsext_extent.h" #include "libfsext_inode.h" #include "libfsext_inode_table.h" #include "libfsext_io_handle.h" @@ -179,6 +180,23 @@ result = -1; } #endif + if( internal_extended_attribute->data_extents_array != NULL ) + { + if( libcdata_array_free( + &( internal_extended_attribute->data_extents_array ), + (int (*)(intptr_t **, libcerror_error_t **)) &libfsext_extent_free, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to free data extents array.", + function ); + + result = -1; + } + } if( internal_extended_attribute->data_stream != NULL ) { if( libfdata_stream_free( @@ -558,7 +576,7 @@ function, internal_extended_attribute->attribute_values->value_data_inode_number ); - return( -1 ); + goto on_error; } if( inode == NULL ) { @@ -570,7 +588,23 @@ function, internal_extended_attribute->attribute_values->value_data_inode_number ); - return( -1 ); + goto on_error; + } + if( libcdata_array_clone( + &( internal_extended_attribute->data_extents_array ), + inode->data_extents_array, + (int (*)(intptr_t **, libcerror_error_t **)) &libfsext_extent_free, + (int (*)(intptr_t **, intptr_t *, libcerror_error_t **)) &libfsext_extent_clone, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to create data extents array.", + function ); + + goto on_error; } result = libfsext_block_stream_initialize( &( internal_extended_attribute->data_stream ), @@ -581,6 +615,20 @@ } else { + if( libcdata_array_initialize( + &( internal_extended_attribute->data_extents_array ), + 0, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to create data extents array.", + function ); + + goto on_error; + } result = libfsext_block_stream_initialize_from_data( &( internal_extended_attribute->data_stream ), internal_extended_attribute->attribute_values->value_data, @@ -596,9 +644,19 @@ "%s: unable to create block stream.", function ); - return( -1 ); + goto on_error; } return( 1 ); + +on_error: + if( internal_extended_attribute->data_extents_array != NULL ) + { + libcdata_array_free( + &( internal_extended_attribute->data_extents_array ), + (int (*)(intptr_t **, libcerror_error_t **)) &libfsext_extent_free, + NULL ); + } + return( -1 ); } /* Reads data at the current offset into a buffer @@ -1063,3 +1121,216 @@ return( 1 ); } +/* Retrieves the number of extents + * Returns 1 if successful or -1 on error + */ +int libfsext_extended_attribute_get_number_of_extents( + libfsext_extended_attribute_t *extended_attribute, + int *number_of_extents, + libcerror_error_t **error ) +{ + libfsext_internal_extended_attribute_t *internal_extended_attribute = NULL; + static char *function = "libfsext_extended_attribute_get_number_of_extents"; + int result = 1; + + if( extended_attribute == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid extended attribute.", + function ); + + return( -1 ); + } + internal_extended_attribute = (libfsext_internal_extended_attribute_t *) extended_attribute; + +#if defined( HAVE_LIBFSEXT_MULTI_THREAD_SUPPORT ) + if( libcthreads_read_write_lock_grab_for_write( + internal_extended_attribute->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + if( internal_extended_attribute->data_stream == NULL ) + { + /* Determining the data stream will initialize the extents array + */ + if( libfsext_internal_extended_attribute_get_data_stream( + internal_extended_attribute, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to determine data stream.", + function ); + + result = -1; + } + } + if( result != -1 ) + { + if( libcdata_array_get_number_of_entries( + internal_extended_attribute->data_extents_array, + number_of_extents, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve number of entries.", + function ); + + result = -1; + } + } +#if defined( HAVE_LIBFSEXT_MULTI_THREAD_SUPPORT ) + if( libcthreads_read_write_lock_release_for_write( + internal_extended_attribute->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( result ); +} + +/* Retrieves a specific extent + * Returns 1 if successful or -1 on error + */ +int libfsext_extended_attribute_get_extent_by_index( + libfsext_extended_attribute_t *extended_attribute, + int extent_index, + off64_t *extent_offset, + size64_t *extent_size, + uint32_t *extent_flags, + libcerror_error_t **error ) +{ + libfsext_extent_t *extent = NULL; + libfsext_internal_extended_attribute_t *internal_extended_attribute = NULL; + static char *function = "libfsext_extended_attribute_get_extent_by_index"; + int result = 1; + + if( extended_attribute == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid extended attribute.", + function ); + + return( -1 ); + } + internal_extended_attribute = (libfsext_internal_extended_attribute_t *) extended_attribute; + +#if defined( HAVE_LIBFSEXT_MULTI_THREAD_SUPPORT ) + if( libcthreads_read_write_lock_grab_for_write( + internal_extended_attribute->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + if( internal_extended_attribute->data_stream == NULL ) + { + /* Determining the data stream will initialize the extents array + */ + if( libfsext_internal_extended_attribute_get_data_stream( + internal_extended_attribute, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to determine data stream.", + function ); + + result = -1; + } + } + if( result != -1 ) + { + if( libcdata_array_get_entry_by_index( + internal_extended_attribute->data_extents_array, + extent_index, + (intptr_t **) &extent, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve extent: %d.", + function, + extent_index ); + + result = -1; + } + if( result == 1 ) + { + if( libfsext_extent_get_values( + extent, + internal_extended_attribute->io_handle, + extent_offset, + extent_size, + extent_flags, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve extent: %d values.", + function, + extent_index ); + + result = -1; + } + } + } +#if defined( HAVE_LIBFSEXT_MULTI_THREAD_SUPPORT ) + if( libcthreads_read_write_lock_release_for_write( + internal_extended_attribute->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( result ); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/libfsext/libfsext_extended_attribute.h new/libfsext-20220829/libfsext/libfsext_extended_attribute.h --- old/libfsext-20220822/libfsext/libfsext_extended_attribute.h 2022-08-22 06:35:33.000000000 +0200 +++ new/libfsext-20220829/libfsext/libfsext_extended_attribute.h 2022-08-28 22:15:14.000000000 +0200 @@ -64,6 +64,10 @@ */ libfdata_stream_t *data_stream; + /* Data extents array + */ + libcdata_array_t *data_extents_array; + #if defined( HAVE_LIBFSEXT_MULTI_THREAD_SUPPORT ) /* The read/write lock */ @@ -148,6 +152,21 @@ size64_t *size, libcerror_error_t **error ); +LIBFSEXT_EXTERN \ +int libfsext_extended_attribute_get_number_of_extents( + libfsext_extended_attribute_t *extended_attribute, + int *number_of_extents, + libcerror_error_t **error ); + +LIBFSEXT_EXTERN \ +int libfsext_extended_attribute_get_extent_by_index( + libfsext_extended_attribute_t *extended_attribute, + int extent_index, + off64_t *extent_offset, + size64_t *extent_size, + uint32_t *extent_flags, + libcerror_error_t **error ); + #if defined( __cplusplus ) } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/libfsext.spec new/libfsext-20220829/libfsext.spec --- old/libfsext-20220822/libfsext.spec 2022-08-22 07:04:44.000000000 +0200 +++ new/libfsext-20220829/libfsext.spec 2022-08-30 16:12:51.000000000 +0200 @@ -1,5 +1,5 @@ Name: libfsext -Version: 20220822 +Version: 20220829 Release: 1 Summary: Library to support the Extended File System (ext) format Group: System Environment/Libraries @@ -101,6 +101,6 @@ %{_mandir}/man1/* %changelog -* Mon Aug 22 2022 Joachim Metz <joachim.metz@gmail.com> 20220822-1 +* Tue Aug 30 2022 Joachim Metz <joachim.metz@gmail.com> 20220829-1 - Auto-generated diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/manuals/libfsext.3 new/libfsext-20220829/manuals/libfsext.3 --- old/libfsext-20220822/manuals/libfsext.3 2022-08-22 06:35:38.000000000 +0200 +++ new/libfsext-20220829/manuals/libfsext.3 2022-08-28 21:53:49.000000000 +0200 @@ -1,4 +1,4 @@ -.Dd July 10, 2022 +.Dd August 28, 2022 .Dt libfsext 3 .Os libfsext .Sh NAME @@ -206,6 +206,10 @@ .Fn libfsext_extended_attribute_get_offset "libfsext_extended_attribute_t *extended_attribute" "off64_t *offset" "libfsext_error_t **error" .Ft int .Fn libfsext_extended_attribute_get_size "libfsext_extended_attribute_t *extended_attribute" "size64_t *size" "libfsext_error_t **error" +.Ft int +.Fn libfsext_extended_attribute_get_number_of_extents "libfsext_extended_attribute_t *extended_attribute" "int *number_of_extents" "libfsext_error_t **error" +.Ft int +.Fn libfsext_extended_attribute_get_extent_by_index "libfsext_extended_attribute_t *extended_attribute" "int extent_index" "off64_t *extent_offset" "size64_t *extent_size" "uint32_t *extent_flags" "libfsext_error_t **error" .Sh DESCRIPTION The .Fn libfsext_get_version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/pyfsext/pyfsext_extended_attribute.c new/libfsext-20220829/pyfsext/pyfsext_extended_attribute.c --- old/libfsext-20220822/pyfsext/pyfsext_extended_attribute.c 2022-08-22 06:37:57.000000000 +0200 +++ new/libfsext-20220829/pyfsext/pyfsext_extended_attribute.c 2022-08-29 07:24:44.000000000 +0200 @@ -99,6 +99,20 @@ "\n" "Retrieves the size of the data stream object." }, + { "get_number_of_extents", + (PyCFunction) pyfsext_extended_attribute_get_number_of_extents, + METH_NOARGS, + "get_number_of_extents() -> Integer\n" + "\n" + "Retrieves the number of extents." }, + + { "get_extent", + (PyCFunction) pyfsext_extended_attribute_get_extent, + METH_VARARGS | METH_KEYWORDS, + "get_extent(extent_index) -> Tuple(Integer, Integer, Integer)\n" + "\n" + "Retrieves the extent specified by the index." }, + /* Sentinel */ { NULL, NULL, 0, NULL } }; @@ -1093,3 +1107,193 @@ return( integer_object ); } +/* Retrieves the number of extents + * Returns a Python object if successful or NULL on error + */ +PyObject *pyfsext_extended_attribute_get_number_of_extents( + pyfsext_extended_attribute_t *pyfsext_extended_attribute, + PyObject *arguments PYFSEXT_ATTRIBUTE_UNUSED ) +{ + PyObject *integer_object = NULL; + libcerror_error_t *error = NULL; + static char *function = "pyfsext_extended_attribute_get_number_of_extents"; + int number_of_extents = 0; + int result = 0; + + PYFSEXT_UNREFERENCED_PARAMETER( arguments ) + + if( pyfsext_extended_attribute == NULL ) + { + PyErr_Format( + PyExc_ValueError, + "%s: invalid extended attribute.", + function ); + + return( NULL ); + } + Py_BEGIN_ALLOW_THREADS + + result = libfsext_extended_attribute_get_number_of_extents( + pyfsext_extended_attribute->extended_attribute, + &number_of_extents, + &error ); + + Py_END_ALLOW_THREADS + + if( result != 1 ) + { + pyfsext_error_raise( + error, + PyExc_IOError, + "%s: unable to retrieve number of extents.", + function ); + + libcerror_error_free( + &error ); + + return( NULL ); + } +#if PY_MAJOR_VERSION >= 3 + integer_object = PyLong_FromLong( + (long) number_of_extents ); +#else + integer_object = PyInt_FromLong( + (long) number_of_extents ); +#endif + return( integer_object ); +} + +/* Retrieves a specific extent by index + * Returns a Python object if successful or NULL on error + */ +PyObject *pyfsext_extended_attribute_get_extent_by_index( + pyfsext_extended_attribute_t *pyfsext_extended_attribute, + int extent_index ) +{ + libcerror_error_t *error = NULL; + PyObject *integer_object = NULL; + PyObject *tuple_object = NULL; + static char *function = "pyfsext_extended_attribute_get_extent_by_index"; + off64_t extent_offset = 0; + size64_t extent_size = 0; + uint32_t extent_flags = 0; + int result = 0; + + if( pyfsext_extended_attribute == NULL ) + { + PyErr_Format( + PyExc_TypeError, + "%s: invalid extended attribute.", + function ); + + return( NULL ); + } + Py_BEGIN_ALLOW_THREADS + + result = libfsext_extended_attribute_get_extent_by_index( + pyfsext_extended_attribute->extended_attribute, + extent_index, + &extent_offset, + &extent_size, + &extent_flags, + &error ); + + Py_END_ALLOW_THREADS + + if( result != 1 ) + { + pyfsext_error_raise( + error, + PyExc_IOError, + "%s: unable to retrieve extent: %d.", + function, + extent_index ); + + libcerror_error_free( + &error ); + + goto on_error; + } + tuple_object = PyTuple_New( + 3 ); + + integer_object = pyfsext_integer_signed_new_from_64bit( + (int64_t) extent_offset ); + + /* Tuple set item does not increment the reference count of the integer object + */ + if( PyTuple_SetItem( + tuple_object, + 0, + integer_object ) != 0 ) + { + goto on_error; + } + integer_object = pyfsext_integer_unsigned_new_from_64bit( + (uint64_t) extent_size ); + + /* Tuple set item does not increment the reference count of the integer object + */ + if( PyTuple_SetItem( + tuple_object, + 1, + integer_object ) != 0 ) + { + goto on_error; + } + integer_object = pyfsext_integer_unsigned_new_from_64bit( + (uint64_t) extent_flags ); + + /* Tuple set item does not increment the reference count of the integer object + */ + if( PyTuple_SetItem( + tuple_object, + 2, + integer_object ) != 0 ) + { + goto on_error; + } + return( tuple_object ); + +on_error: + if( integer_object != NULL ) + { + Py_DecRef( + (PyObject *) integer_object ); + } + if( tuple_object != NULL ) + { + Py_DecRef( + (PyObject *) tuple_object ); + } + return( NULL ); +} + +/* Retrieves a specific extent + * Returns a Python object if successful or NULL on error + */ +PyObject *pyfsext_extended_attribute_get_extent( + pyfsext_extended_attribute_t *pyfsext_extended_attribute, + PyObject *arguments, + PyObject *keywords ) +{ + PyObject *sequence_object = NULL; + static char *keyword_list[] = { "extent_index", NULL }; + int extent_index = 0; + + if( PyArg_ParseTupleAndKeywords( + arguments, + keywords, + "i", + keyword_list, + &extent_index ) == 0 ) + { + return( NULL ); + } + sequence_object = pyfsext_extended_attribute_get_extent_by_index( + pyfsext_extended_attribute, + extent_index ); + + return( sequence_object ); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/pyfsext/pyfsext_extended_attribute.h new/libfsext-20220829/pyfsext/pyfsext_extended_attribute.h --- old/libfsext-20220822/pyfsext/pyfsext_extended_attribute.h 2022-08-22 06:35:36.000000000 +0200 +++ new/libfsext-20220829/pyfsext/pyfsext_extended_attribute.h 2022-08-28 22:00:01.000000000 +0200 @@ -89,6 +89,19 @@ pyfsext_extended_attribute_t *pyfsext_extended_attribute, PyObject *arguments ); +PyObject *pyfsext_extended_attribute_get_number_of_extents( + pyfsext_extended_attribute_t *pyfsext_extended_attribute, + PyObject *arguments ); + +PyObject *pyfsext_extended_attribute_get_extent_by_index( + pyfsext_extended_attribute_t *pyfsext_extended_attribute, + int extent_index ); + +PyObject *pyfsext_extended_attribute_get_extent( + pyfsext_extended_attribute_t *pyfsext_extended_attribute, + PyObject *arguments, + PyObject *keywords ); + #if defined( __cplusplus ) } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libfsext-20220822/pyfsext/pyfsext_file_entry.c new/libfsext-20220829/pyfsext/pyfsext_file_entry.c --- old/libfsext-20220822/pyfsext/pyfsext_file_entry.c 2022-08-22 06:37:57.000000000 +0200 +++ new/libfsext-20220829/pyfsext/pyfsext_file_entry.c 2022-08-29 07:24:35.000000000 +0200 @@ -289,7 +289,7 @@ { "get_extent", (PyCFunction) pyfsext_file_entry_get_extent, METH_VARARGS | METH_KEYWORDS, - "get_extent(extent_index) -> Tuple( Integer, Integer, Integer )\n" + "get_extent(extent_index) -> Tuple(Integer, Integer, Integer)\n" "\n" "Retrieves a specific extent.\t" "The extent is a tuple of offset, size and flags." },
participants (1)
-
Source-Sync