Skip to content

Commit

Permalink
Disable clang formatting for these blocks again
Browse files Browse the repository at this point in the history
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
  • Loading branch information
qkoziol committed Dec 18, 2024
1 parent f77bc18 commit c932bda
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 148 deletions.
107 changes: 56 additions & 51 deletions src/H5FD.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,65 +936,70 @@ H5FD_open(bool try, H5FD_t **_file, const char *name, unsigned flags, hid_t fapl
if (HADDR_UNDEF == maxaddr)
maxaddr = driver->maxaddr;

/* clang-format off */

/* Try dispatching to file driver */
if (try) {
H5E_PAUSE_ERRORS
{/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL){file = (driver->open)(name, flags, fapl_id, maxaddr);
H5_BEFORE_USER_CB(FAIL)
{
file = (driver->open)(name, flags, fapl_id, maxaddr);
}
H5_AFTER_USER_CB(FAIL)
}
H5E_RESUME_ERRORS

/* Check if file was not opened */
if (NULL == file)
HGOTO_DONE(SUCCEED);
}
else
{
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
file = (driver->open)(name, flags, fapl_id, maxaddr);
}
H5_AFTER_USER_CB(FAIL)
if (NULL == file)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "can't open file");
}
H5_AFTER_USER_CB
(FAIL)
}
H5E_RESUME_ERRORS

/* Check if file was not opened */
if (NULL == file)
HGOTO_DONE(SUCCEED);
}
else
{
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
file = (driver->open)(name, flags, fapl_id, maxaddr);
}
H5_AFTER_USER_CB(FAIL)
if (NULL == file)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "can't open file");
}
/* clang-format on */

/* Set the file access flags */
file->access_flags = flags;
/* Set the file access flags */
file->access_flags = flags;

/* Fill in public fields. We must increment the reference count on the
* driver ID to prevent it from being freed while this file is open.
*/
file->driver_id = driver_prop.driver_id;
if (H5I_inc_ref(file->driver_id, false) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver");
file->cls = driver;
file->maxaddr = maxaddr;
if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &file->threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment threshold");
if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &file->alignment) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");

/* Retrieve the VFL driver feature flags */
if (H5FD__query(file, &file->feature_flags) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to query file driver");

/* Increment the global serial number & assign it to this H5FD_t object */
if (++H5FD_file_serial_no_g == 0)
/* (Just error out if we wrap around for now...) */
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to get file serial number");
file->fileno = H5FD_file_serial_no_g;

/* Start with base address set to 0 */
/* (This will be changed later, when the superblock is located) */
file->base_addr = 0;

/* Set 'out' parameter */
*_file = file;
/* Fill in public fields. We must increment the reference count on the
* driver ID to prevent it from being freed while this file is open.
*/
file->driver_id = driver_prop.driver_id;
if (H5I_inc_ref(file->driver_id, false) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver");
file->cls = driver;
file->maxaddr = maxaddr;
if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &file->threshold) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment threshold");
if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &file->alignment) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");

/* Retrieve the VFL driver feature flags */
if (H5FD__query(file, &file->feature_flags) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to query file driver");

/* Increment the global serial number & assign it to this H5FD_t object */
if (++H5FD_file_serial_no_g == 0)
/* (Just error out if we wrap around for now...) */
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to get file serial number");
file->fileno = H5FD_file_serial_no_g;

/* Start with base address set to 0 */
/* (This will be changed later, when the superblock is located) */
file->base_addr = 0;

/* Set 'out' parameter */
*_file = file;

done :
/* Can't cleanup 'file' information, since we don't know what type it is */
Expand Down
199 changes: 102 additions & 97 deletions src/H5Z.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,126 +1447,131 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i
tmp_flags = flags | (pline->filter[idx].flags);
tmp_flags |= (edc_read == H5Z_DISABLE_EDC) ? H5Z_FLAG_SKIP_EDC : 0;

/* clang-format off */

H5E_PAUSE_ERRORS
{/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL){
new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts,
pline->filter[idx].cd_values, *nbytes, buf_size, buf);
}
H5_AFTER_USER_CB
(FAIL)
}
H5E_RESUME_ERRORS
H5_BEFORE_USER_CB(FAIL)
{
new_nbytes = (fclass->filter)(tmp_flags, pline->filter[idx].cd_nelmts,
pline->filter[idx].cd_values, *nbytes, buf_size, buf);
}
H5_AFTER_USER_CB(FAIL)
}
H5E_RESUME_ERRORS

/* clang-format on */

#ifdef H5Z_DEBUG
H5_timer_stop(&timer);
H5_timer_get_times(timer, &times);
fstats->stats[1].times.elapsed += times.elapsed;
fstats->stats[1].times.system += times.system;
fstats->stats[1].times.user += times.user;

fstats->stats[1].total += MAX(*nbytes, new_nbytes);
if (0 == new_nbytes)
fstats->stats[1].errors += *nbytes;
H5_timer_stop(&timer);
H5_timer_get_times(timer, &times);
fstats->stats[1].times.elapsed += times.elapsed;
fstats->stats[1].times.system += times.system;
fstats->stats[1].times.user += times.user;

fstats->stats[1].total += MAX(*nbytes, new_nbytes);
if (0 == new_nbytes)
fstats->stats[1].errors += *nbytes;
#endif

if (0 == new_nbytes) {
if (cb_struct.func) {
H5Z_cb_return_t status;
if (0 == new_nbytes) {
if (cb_struct.func) {
H5Z_cb_return_t status;

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data);
}
H5_AFTER_USER_CB(FAIL)
if (H5Z_CB_FAIL == status)
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read");
}
else
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read");

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data);
*nbytes = *buf_size;
failed |= (unsigned)1 << idx;
}
H5_AFTER_USER_CB(FAIL)
if (H5Z_CB_FAIL == status)
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read");
}
else
HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read");

*nbytes = *buf_size;
failed |= (unsigned)1 << idx;
}
else
*nbytes = new_nbytes;
}
}
else if (pline)
{ /* Write */
for (idx = 0; idx < pline->nused; idx++) {
if (*filter_mask & ((unsigned)1 << idx)) {
failed |= (unsigned)1 << idx;
continue; /* filter excluded */
else
*nbytes = new_nbytes;
}
if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) {
/* Check if filter is optional -- If it isn't, then error */
if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered");
failed |= (unsigned)1 << idx;
continue; /* filter excluded */
} /* end if */
}
else if (pline)
{ /* Write */
for (idx = 0; idx < pline->nused; idx++) {
if (*filter_mask & ((unsigned)1 << idx)) {
failed |= (unsigned)1 << idx;
continue; /* filter excluded */
}
if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) {
/* Check if filter is optional -- If it isn't, then error */
if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered");
failed |= (unsigned)1 << idx;
continue; /* filter excluded */
} /* end if */

fclass = &H5Z_table_g[fclass_idx];
fclass = &H5Z_table_g[fclass_idx];

#ifdef H5Z_DEBUG
fstats = &H5Z_stat_table_g[fclass_idx];
H5_timer_start(&timer);
fstats = &H5Z_stat_table_g[fclass_idx];
H5_timer_start(&timer);
#endif

H5E_PAUSE_ERRORS
{/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL){new_nbytes = (fclass->filter)(
flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts,
pline->filter[idx].cd_values, *nbytes, buf_size, buf);
}
H5_AFTER_USER_CB
(FAIL)
}
H5E_RESUME_ERRORS
H5E_PAUSE_ERRORS
{/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
new_nbytes = (fclass->filter)(flags | (pline->filter[idx].flags), pline->filter[idx].cd_nelmts,
pline->filter[idx].cd_values, *nbytes, buf_size, buf);
}
H5_AFTER_USER_CB(FAIL)
}
H5E_RESUME_ERRORS

#ifdef H5Z_DEBUG
H5_timer_stop(&timer);
H5_timer_get_times(timer, &times);
fstats->stats[0].times.elapsed += times.elapsed;
fstats->stats[0].times.system += times.system;
fstats->stats[0].times.user += times.user;

fstats->stats[0].total += MAX(*nbytes, new_nbytes);
if (0 == new_nbytes)
fstats->stats[0].errors += *nbytes;
H5_timer_stop(&timer);
H5_timer_get_times(timer, &times);
fstats->stats[0].times.elapsed += times.elapsed;
fstats->stats[0].times.system += times.system;
fstats->stats[0].times.user += times.user;

fstats->stats[0].total += MAX(*nbytes, new_nbytes);
if (0 == new_nbytes)
fstats->stats[0].errors += *nbytes;
#endif

if (0 == new_nbytes) {
if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) {
if (cb_struct.func) {
H5Z_cb_return_t status;
if (0 == new_nbytes) {
if (0 == (pline->filter[idx].flags & H5Z_FLAG_OPTIONAL)) {
if (cb_struct.func) {
H5Z_cb_return_t status;

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data);
}
H5_AFTER_USER_CB(FAIL)
if (H5Z_CB_FAIL == status)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure");
}
else
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure");
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data);
}
H5_AFTER_USER_CB(FAIL)
if (H5Z_CB_FAIL == status)
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure");
}
else
HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure");

*nbytes = *buf_size;
*nbytes = *buf_size;
}
failed |= (unsigned)1 << idx;
}
else
*nbytes = new_nbytes;
} /* end for */
}
failed |= (unsigned)1 << idx;
}
else
*nbytes = new_nbytes;
} /* end for */
}

*filter_mask = failed;
*filter_mask = failed;

done : FUNC_LEAVE_NOAPI(ret_value)
done:
FUNC_LEAVE_NOAPI(ret_value)
}

/*-------------------------------------------------------------------------
Expand Down

0 comments on commit c932bda

Please sign in to comment.