Adds new subfiling API H5FDsubfiling_get_file_mapping() (#5828)

Adds H5FDsubfiling_get_file_mapping() API to map logical HDF5 files to physical subfiles, with Fortran support and comprehensive testing.

Adds H5FDsubfiling_get_file_mapping() in H5FDsubfiling.c to retrieve subfile paths for a logical HDF5 file.
Updates Fortran interface in H5VFDff.F90 to include h5fdsubfiling_get_file_mapping_f().

Updates h5fuse.in to support a list of subfiles for processing with a new -l option.
This commit is contained in:
Scot Breitenfeld
2025-09-26 11:30:16 -05:00
committed by GitHub
parent 2e88b9da1a
commit 877cbf79a7
13 changed files with 1287 additions and 14 deletions
+44 -13
View File
@@ -26,10 +26,11 @@ function usage {
configuration file either as a command-line argument or the script will
search for the *.config file in the current directory."
echo ""
echo "usage: h5fuse [-f filename] [-h] [-p] [-q] [-r] [-v] "
echo "usage: h5fuse [-f filename] [-h] [-p] [-q] [-r] [-v] [-l subfile1,subfile2,...]"
echo "-f filename Subfile configuration file."
echo "-h Print this help."
echo "-q Quiet all output. [no]"
echo "-l Comma separated list of subfiles to process"
echo "-p h5fuse is being run in parallel, with more than one rank. [no]"
echo "-r Remove subfiles after being processed. [no]"
echo "-v Verbose output. [no]"
@@ -131,8 +132,7 @@ for i in "${subfiles[@]}"; do
if [ "$verbose" == "true" ]; then
echo -e "$GRN $EXEC $NC"
fi
err=$( $EXEC 2>&1 1>/dev/null )
if [ $? -ne 0 ]; then
if ! err=$( $EXEC 2>&1 1>/dev/null ); then
echo -e "$CYN ERR: dd Utility Failed $NC"
echo -e "$CYN MSG: $err $NC"
exit $FAILED
@@ -172,7 +172,8 @@ verbose="false"
quiet="false"
rm_subf="false"
parallel="false"
while getopts "hpqrvf:" option; do
subf_list=()
while getopts "hpqrvf:l:" option; do
case $option in
f) # subfiling configuration file
file_config=$OPTARG;;
@@ -187,6 +188,9 @@ while getopts "hpqrvf:" option; do
rm_subf="true";;
v) # verbose output
verbose="true";;
l) # process a list of subfiles
# Split the comma-separated list into an array
IFS=',' read -r -a subf_list <<< "${OPTARG}";;
\?) # Invalid option
echo -e "$RED ERROR: Invalid option ${BLD}-${OPTARG}${RED} $NC"
usage
@@ -259,17 +263,44 @@ fi
nsubfiles=${#subfiles[@]}
# Get the number of local subfiles
subfiles_loc=()
subfiles_size=()
for i in "${subfiles[@]}"; do
subfile="${subfile_dir}/${i}"
if [ -f "${subfile}" ]; then
subfiles_loc+=("$subfile")
subfiles_size+=($(wc -c "${subfile}" | awk '{print $1}'))
else
subfiles_size+=(0)
fi
done
if [[ "${#subf_list[@]}" == "0" ]]; then
for i in "${subfiles[@]}"; do
subfile="${subfile_dir}/${i}"
if [ -f "${subfile}" ]; then
subfiles_loc+=("$subfile")
subfiles_size+=("$(wc -c "${subfile}" | awk '{print $1}')")
else
subfiles_size+=(0)
fi
done
else
for i in "${subfiles[@]}"; do
subfile="${subfile_dir}/${i}"
match=0
for ((j=0; j<${#subf_list[@]}; ++j)); do
if [[ "${subf_list[j]}" == "$subfile" ]]; then
unset "subf_list[$j]" # Use unset within loop for proper removal
match=1
break
fi
done
if [[ "$match" == "1" ]]; then
subfiles_loc+=("$subfile")
subfiles_size+=("$(wc -c "${subfile}" | awk '{print $1}')")
else
subfiles_size+=(0)
fi
done
fi
if [ "$quiet" == "false" ]; then
TIMEFORMAT="COMPLETION TIME = %R s"