From 2077729abca4eeb7daf4ae619cb51ce0dae95dc6 Mon Sep 17 00:00:00 2001 From: edwardhartnett Date: Thu, 15 Aug 2019 06:51:06 -0600 Subject: [PATCH 1/4] removed base_pe functions from dispatch table --- include/netcdf_dispatch.h | 4 ++-- libdap2/ncd2dispatch.c | 2 -- libdap4/ncd4dispatch.c | 8 -------- libdispatch/dfile.c | 11 +++++++---- libhdf4/hdf4dispatch.c | 2 -- libhdf5/hdf5dispatch.c | 2 -- libsrc/nc3dispatch.c | 2 -- nc_test/tst_formats.c | 10 ++-------- nc_test4/tst_udf.c | 2 -- 9 files changed, 11 insertions(+), 32 deletions(-) diff --git a/include/netcdf_dispatch.h b/include/netcdf_dispatch.h index a4e4ca1886..5ebc3102b9 100644 --- a/include/netcdf_dispatch.h +++ b/include/netcdf_dispatch.h @@ -35,8 +35,8 @@ struct NC_Dispatch int (*abort)(int); int (*close)(int, void *); int (*set_fill)(int, int, int *); - int (*inq_base_pe)(int, int *); - int (*set_base_pe)(int, int); + /* int (*inq_base_pe)(int, int *); */ + /* int (*set_base_pe)(int, int); */ int (*inq_format)(int, int*); int (*inq_format_extended)(int, int *, int *); diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c index 1299f91431..30772b8f29 100644 --- a/libdap2/ncd2dispatch.c +++ b/libdap2/ncd2dispatch.c @@ -101,8 +101,6 @@ NCD2_sync, NCD2_abort, NCD2_close, NCD2_set_fill, -NCD2_inq_base_pe, -NCD2_set_base_pe, NCD2_inq_format, NCD2_inq_format_extended, /*inq_format_extended*/ diff --git a/libdap4/ncd4dispatch.c b/libdap4/ncd4dispatch.c index a91b68934f..8f944a733f 100644 --- a/libdap4/ncd4dispatch.c +++ b/libdap4/ncd4dispatch.c @@ -117,12 +117,6 @@ NCD4_set_fill(int ncid, int fillmode, int* old_modep) return (NC_EPERM); } -static int -NCD4_set_base_pe(int ncid, int pe) -{ - return (NC_EPERM); -} - static int NCD4_def_dim(int ncid, const char* name, size_t len, int* idp) { @@ -806,8 +800,6 @@ NCD4_sync, NCD4_abort, NCD4_close, NCD4_set_fill, -NCD4_inq_base_pe, -NCD4_set_base_pe, NCD4_inq_format, NCD4_inq_format_extended, /*inq_format_extended*/ diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c index f74c2dd242..36cc8d0d01 100644 --- a/libdispatch/dfile.c +++ b/libdispatch/dfile.c @@ -1454,8 +1454,8 @@ nc_set_fill(int ncid, int fillmode, int *old_modep) * @internal Learn base PE. * * @deprecated This function was used in the old days with the Cray at - * NCAR. The Cray is long gone, and this call is supported only for - * backward compatibility. + * NCAR. The Cray is long gone, and this call is now meaningless. The + * value returned for pe is always 0. * * @param ncid File and group ID. * @param pe Pointer for base PE. @@ -1470,7 +1470,9 @@ nc_inq_base_pe(int ncid, int *pe) NC* ncp; int stat = NC_check_id(ncid, &ncp); if(stat != NC_NOERR) return stat; - return ncp->dispatch->inq_base_pe(ncid,pe); + /* return ncp->dispatch->inq_base_pe(ncid,pe); */ + if (pe) *pe = 0; + return NC_NOERR; } /** @@ -1493,7 +1495,8 @@ nc_set_base_pe(int ncid, int pe) NC* ncp; int stat = NC_check_id(ncid, &ncp); if(stat != NC_NOERR) return stat; - return ncp->dispatch->set_base_pe(ncid,pe); + /* return ncp->dispatch->set_base_pe(ncid,pe); */ + return NC_NOERR; } /** \ingroup datasets diff --git a/libhdf4/hdf4dispatch.c b/libhdf4/hdf4dispatch.c index 4cb790bb21..d2b5437cd8 100644 --- a/libhdf4/hdf4dispatch.c +++ b/libhdf4/hdf4dispatch.c @@ -28,8 +28,6 @@ static const NC_Dispatch HDF4_dispatcher = { NC_HDF4_abort, NC_HDF4_close, NC_RO_set_fill, - NC_NOTNC3_inq_base_pe, - NC_NOTNC3_set_base_pe, NC_HDF4_inq_format, NC_HDF4_inq_format_extended, diff --git a/libhdf5/hdf5dispatch.c b/libhdf5/hdf5dispatch.c index 06203a9a72..9e703b0cd6 100644 --- a/libhdf5/hdf5dispatch.c +++ b/libhdf5/hdf5dispatch.c @@ -28,8 +28,6 @@ static const NC_Dispatch HDF5_dispatcher = { NC4_abort, NC4_close, NC4_set_fill, - NC_NOTNC3_inq_base_pe, - NC_NOTNC3_set_base_pe, NC4_inq_format, NC4_inq_format_extended, diff --git a/libsrc/nc3dispatch.c b/libsrc/nc3dispatch.c index 59a6643f36..165caff4d6 100644 --- a/libsrc/nc3dispatch.c +++ b/libsrc/nc3dispatch.c @@ -91,8 +91,6 @@ NC3_sync, NC3_abort, NC3_close, NC3_set_fill, -NC3_inq_base_pe, -NC3_set_base_pe, NC3_inq_format, NC3_inq_format_extended, diff --git a/nc_test/tst_formats.c b/nc_test/tst_formats.c index 6f9e8b0a94..251026d271 100644 --- a/nc_test/tst_formats.c +++ b/nc_test/tst_formats.c @@ -87,14 +87,8 @@ check_inq_format(int ncid, int expected_format, int expected_extended_format, in /* Nothing to do with inq_format, but let's check the base_pe * functions. */ - if (expected_format == NC_FORMAT_CLASSIC || expected_format == NC_FORMAT_64BIT_OFFSET || - expected_format == NC_FORMAT_CDF5) { - if (nc_set_base_pe(ncid, 0)) ERR; - if (nc_inq_base_pe(ncid, NULL)) ERR; - } else { - if (nc_set_base_pe(ncid, 0) != NC_ENOTNC3) ERR; - if (nc_inq_base_pe(ncid, NULL) != NC_ENOTNC3) ERR; - } + if (nc_set_base_pe(ncid, 0)) ERR; + if (nc_inq_base_pe(ncid, NULL)) ERR; return 0; } diff --git a/nc_test4/tst_udf.c b/nc_test4/tst_udf.c index 534d3be42d..25f85f2d10 100644 --- a/nc_test4/tst_udf.c +++ b/nc_test4/tst_udf.c @@ -77,8 +77,6 @@ NC_RO_sync, tst_abort, tst_close, NC_RO_set_fill, -NC_NOTNC3_inq_base_pe, -NC_NOTNC3_set_base_pe, tst_inq_format, tst_inq_format_extended, From c7c2892de5ab9a055787bd785d929c5dcec20c0c Mon Sep 17 00:00:00 2001 From: edwardhartnett Date: Thu, 15 Aug 2019 06:53:57 -0600 Subject: [PATCH 2/4] clean up --- libdispatch/dfile.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c index 36cc8d0d01..ece18aac6e 100644 --- a/libdispatch/dfile.c +++ b/libdispatch/dfile.c @@ -1470,7 +1470,6 @@ nc_inq_base_pe(int ncid, int *pe) NC* ncp; int stat = NC_check_id(ncid, &ncp); if(stat != NC_NOERR) return stat; - /* return ncp->dispatch->inq_base_pe(ncid,pe); */ if (pe) *pe = 0; return NC_NOERR; } @@ -1495,27 +1494,25 @@ nc_set_base_pe(int ncid, int pe) NC* ncp; int stat = NC_check_id(ncid, &ncp); if(stat != NC_NOERR) return stat; - /* return ncp->dispatch->set_base_pe(ncid,pe); */ return NC_NOERR; } -/** \ingroup datasets -Inquire about the binary format of a netCDF file -as presented by the API. - -This function returns the (rarely needed) format version. - -\param ncid NetCDF ID, from a previous call to nc_open() or -nc_create(). - -\param formatp Pointer to location for returned format version, one of -NC_FORMAT_CLASSIC, NC_FORMAT_64BIT_OFFSET, NC_FORMAT_CDF5, NC_FORMAT_NETCDF4, -NC_FORMAT_NETCDF4_CLASSIC. - -\returns ::NC_NOERR No error. - -\returns ::NC_EBADID Invalid ncid passed. - +/** + * @ingroup datasets + * Inquire about the binary format of a netCDF file + * as presented by the API. + * + * This function returns the (rarely needed) format version. + * + * @param ncid NetCDF ID, from a previous call to nc_open() or + * nc_create(). + * @param formatp Pointer to location for returned format version, one + * of NC_FORMAT_CLASSIC, NC_FORMAT_64BIT_OFFSET, NC_FORMAT_CDF5, + * NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC. + * + * @returns ::NC_NOERR No error. + * @returns ::NC_EBADID Invalid ncid passed. + * @author Dennis Heimbigner */ int nc_inq_format(int ncid, int *formatp) From 94f1a89a403139afd4079896270ca9e49561e99c Mon Sep 17 00:00:00 2001 From: edwardhartnett Date: Thu, 15 Aug 2019 07:05:10 -0600 Subject: [PATCH 3/4] final removal --- hdf4_test/tst_hdf4_extra.c | 4 +-- hdf4_test/tst_interops3.c | 11 ------ include/nc3dispatch.h | 6 ---- include/nc4dispatch.h | 6 ---- include/netcdf_dispatch.h | 4 --- libdap2/ncd2dispatch.c | 16 --------- libdap2/ncd2dispatch.h | 6 ---- libdap4/ncd4dispatch.c | 12 ------- libdispatch/dnotnc3.c | 32 +----------------- libsrc/nc3internal.c | 68 -------------------------------------- libsrc4/ncfunc.c | 3 +- libsrcp/ncpdispatch.c | 15 --------- 12 files changed, 4 insertions(+), 179 deletions(-) diff --git a/hdf4_test/tst_hdf4_extra.c b/hdf4_test/tst_hdf4_extra.c index 1e48694469..9727d571ab 100644 --- a/hdf4_test/tst_hdf4_extra.c +++ b/hdf4_test/tst_hdf4_extra.c @@ -128,8 +128,8 @@ main(int argc, char **argv) if (nc_inq(ncid + TEST_VAL_42, NULL, NULL, NULL, NULL) != NC_EBADID) ERR; /* These only work for netCDF-3 files. */ - if (nc_set_base_pe(ncid, 0) != NC_ENOTNC3) ERR; - if (nc_inq_base_pe(ncid, NULL) != NC_ENOTNC3) ERR; + if (nc_set_base_pe(ncid, 0)) ERR; + if (nc_inq_base_pe(ncid, NULL)) ERR; /* Attempt to write. */ if (nc_rename_att(ncid, NC_GLOBAL, ATT_NAME, NAME_DUMB) != NC_EPERM) ERR; diff --git a/hdf4_test/tst_interops3.c b/hdf4_test/tst_interops3.c index 6ea9029c17..a75acca106 100644 --- a/hdf4_test/tst_interops3.c +++ b/hdf4_test/tst_interops3.c @@ -49,17 +49,6 @@ check_inq_format(int ncid, int expected_format, int expected_extended_format, in if (mode != expected_mode) ERR; if (extended_format != expected_extended_format) ERR; - /* Nothing to do with inq_format, but let's check the base_pe - * functions. */ - if (expected_format == NC_FORMAT_CLASSIC || expected_format == NC_FORMAT_64BIT_OFFSET || - expected_format == NC_FORMAT_CDF5) { - if (nc_set_base_pe(ncid, 0)) ERR; - if (nc_inq_base_pe(ncid, NULL)) ERR; - } else { - if (nc_set_base_pe(ncid, 0) != NC_ENOTNC3) ERR; - if (nc_inq_base_pe(ncid, NULL) != NC_ENOTNC3) ERR; - } - return 0; } diff --git a/include/nc3dispatch.h b/include/nc3dispatch.h index 998ee4314d..274c6dfed5 100644 --- a/include/nc3dispatch.h +++ b/include/nc3dispatch.h @@ -83,12 +83,6 @@ extern "C" { extern int NC3_set_fill(int ncid, int fillmode, int *old_modep); - extern int - NC3_set_base_pe(int ncid, int pe); - - extern int - NC3_inq_base_pe(int ncid, int *pe); - extern int NC3_inq_format(int ncid, int *formatp); diff --git a/include/nc4dispatch.h b/include/nc4dispatch.h index 65f9518398..4417d9f716 100644 --- a/include/nc4dispatch.h +++ b/include/nc4dispatch.h @@ -49,12 +49,6 @@ extern "C" { EXTERNL int NC4_set_fill(int ncid, int fillmode, int *old_modep); - EXTERNL int - NC4_set_base_pe(int ncid, int pe); - - EXTERNL int - NC4_inq_base_pe(int ncid, int *pe); - EXTERNL int NC4_inq_format(int ncid, int *formatp); diff --git a/include/netcdf_dispatch.h b/include/netcdf_dispatch.h index 5ebc3102b9..532748a911 100644 --- a/include/netcdf_dispatch.h +++ b/include/netcdf_dispatch.h @@ -35,8 +35,6 @@ struct NC_Dispatch int (*abort)(int); int (*close)(int, void *); int (*set_fill)(int, int, int *); - /* int (*inq_base_pe)(int, int *); */ - /* int (*set_base_pe)(int, int); */ int (*inq_format)(int, int*); int (*inq_format_extended)(int, int *, int *); @@ -163,8 +161,6 @@ EXTERNL int NC_RO_set_fill(int ncid, int fillmode, int *old_modep); /* These functions are for dispatch layers that don't implement these * legacy functions. They return NC_ENOTNC3. */ -EXTERNL int NC_NOTNC3_set_base_pe(int ncid, int pe); -EXTERNL int NC_NOTNC3_inq_base_pe(int ncid, int *pe); EXTERNL int NC_NOTNC3_put_varm(int ncid, int varid, const size_t * start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *imapp, const void *value0, diff --git a/libdap2/ncd2dispatch.c b/libdap2/ncd2dispatch.c index 30772b8f29..b383ef3c5f 100644 --- a/libdap2/ncd2dispatch.c +++ b/libdap2/ncd2dispatch.c @@ -2255,12 +2255,6 @@ NCD2_set_fill(int ncid, int fillmode, int* old_modep) return THROW(NC_EPERM); } -int -NCD2_set_base_pe(int ncid, int pe) -{ - return THROW(NC_EPERM); -} - int NCD2_def_dim(int ncid, const char* name, size_t len, int* idp) { @@ -2285,16 +2279,6 @@ NCD2_def_var(int ncid, const char *name, Following functions basically return the netcdf-3 value WRT to the nc3id. */ -int -NCD2_inq_base_pe(int ncid, int* pe) -{ - NC* drno; - int ret; - if((ret = NC_check_id(ncid, (NC**)&drno)) != NC_NOERR) return THROW(ret); - ret = nc_inq_base_pe(getnc3id(drno), pe); - return THROW(ret); -} - int NCD2_inq_format(int ncid, int* formatp) { diff --git a/libdap2/ncd2dispatch.h b/libdap2/ncd2dispatch.h index d0947ab091..03bb10140a 100644 --- a/libdap2/ncd2dispatch.h +++ b/libdap2/ncd2dispatch.h @@ -57,12 +57,6 @@ NCD2_inq_format_extended(int ncid, int* formatp, int* modep); extern int NCD2_set_fill(int ncid, int fillmode, int *old_modep); -extern int -NCD2_set_base_pe(int ncid, int pe); - -extern int -NCD2_inq_base_pe(int ncid, int *pe); - extern int NCD2_inq_format(int ncid, int *formatp); diff --git a/libdap4/ncd4dispatch.c b/libdap4/ncd4dispatch.c index 8f944a733f..780a53383e 100644 --- a/libdap4/ncd4dispatch.c +++ b/libdap4/ncd4dispatch.c @@ -247,18 +247,6 @@ Following functions basically return the netcdf-4 value WRT to the nc4id. However, it is necessary to modify the grpid(ncid) to point to the substrate. */ -static int -NCD4_inq_base_pe(int ncid, int* pe) -{ - NC* ncp; - int ret = NC_NOERR; - int substrateid; - if((ret = NC_check_id(ncid, (NC**)&ncp)) != NC_NOERR) return (ret); - substrateid = makenc4id(ncp,ncid); - ret = nc_inq_base_pe(substrateid, pe); - return (ret); -} - static int NCD4_inq_format(int ncid, int* formatp) { diff --git a/libdispatch/dnotnc3.c b/libdispatch/dnotnc3.c index a57bc5ebdc..61af896b61 100644 --- a/libdispatch/dnotnc3.c +++ b/libdispatch/dnotnc3.c @@ -1,7 +1,7 @@ /* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying * and redistribution conditions.*/ /** - * @file @internal This file handles the *_base_pe() + * @file @internal This file handles the *_varm() * functions for dispatch layers that need to return ::NC_ENOTNC3. * * @author Ed Hartnett @@ -9,36 +9,6 @@ #include "nc4dispatch.h" -/** - * @internal This function only does anything for netcdf-3 files. - * - * @param ncid Ignored. - * @param pe Ignored. - * - * @return ::NC_ENOTNC3 Not a netCDF classic format file. - * @author Ed Hartnett - */ -int -NC_NOTNC3_set_base_pe(int ncid, int pe) -{ - return NC_ENOTNC3; -} - -/** - * @internal This function only does anything for netcdf-3 files. - * - * @param ncid Ignored. - * @param pe Ignored. - * - * @return ::NC_ENOTNC3 Not a netCDF classic format file. - * @author Ed Hartnett - */ -int -NC_NOTNC3_inq_base_pe(int ncid, int *pe) -{ - return NC_ENOTNC3; -} - /** * @internal This function only does anything for netcdf-3 files. * diff --git a/libsrc/nc3internal.c b/libsrc/nc3internal.c index dc0bdc5e67..063f6864e3 100644 --- a/libsrc/nc3internal.c +++ b/libsrc/nc3internal.c @@ -1608,74 +1608,6 @@ void NC_increase_numrecs(NC *nc3, size_t nrecs) #endif /* LOCKNUMREC */ -/* everyone in communicator group will be executing this */ -/*ARGSUSED*/ -int -NC3_set_base_pe(int ncid, int pe) -{ -#if _CRAYMPP && defined(LOCKNUMREC) - int status; - NC *nc; - NC3_INFO* nc3; - shmem_t numrecs; - - if ((status = NC_check_id(ncid, &nc) != NC_NOERR) { - return status; - } - if (pe < 0 || pe >= _num_pes()) { - return NC_EINVAL; /* invalid base pe */ - } - nc3 = NC3_DATA(nc); - - numrecs = (shmem_t) NC_get_numrecs(nc3); - - nc3->lock[LOCKNUMREC_VALUE] = (ushmem_t) numrecs; - - /* update serving & lock values for a "smooth" transition */ - /* note that the "real" server will being doing this as well */ - /* as all the rest in the group */ - /* must have synchronization before & after this step */ - shmem_short_get( - (shmem_t *) nc3->lock + LOCKNUMREC_SERVING, - (shmem_t *) nc3->lock + LOCKNUMREC_SERVING, - 1, nc3->lock[LOCKNUMREC_BASEPE]); - - shmem_short_get( - (shmem_t *) nc3->lock + LOCKNUMREC_LOCK, - (shmem_t *) nc3->lock + LOCKNUMREC_LOCK, - 1, nc3->lock[LOCKNUMREC_BASEPE]); - - /* complete transition */ - nc3->lock[LOCKNUMREC_BASEPE] = (ushmem_t) pe; - -#endif /* _CRAYMPP && LOCKNUMREC */ - return NC_NOERR; -} - -/*ARGSUSED*/ -int -NC3_inq_base_pe(int ncid, int *pe) -{ -#if _CRAYMPP && defined(LOCKNUMREC) - int status; - NC *nc; - NC3_INFO* nc3; - - if ((status = NC_check_id(ncid, &nc)) != NC_NOERR) { - return status; - } - - *pe = (int) nc3->lock[LOCKNUMREC_BASEPE]; - nc3 = NC3_DATA(nc); -#else - /* - * !_CRAYMPP, only pe 0 is valid - */ - if (pe) *pe = 0; -#endif /* _CRAYMPP && LOCKNUMREC */ - return NC_NOERR; -} - /** * Return the file format. * diff --git a/libsrc4/ncfunc.c b/libsrc4/ncfunc.c index 7a2f836ec6..fe9d401054 100644 --- a/libsrc4/ncfunc.c +++ b/libsrc4/ncfunc.c @@ -8,8 +8,7 @@ * This file is part of netcdf-4, a netCDF-like interface for HDF5, or a * HDF5 backend for netCDF, depending on your point of view. * - * This file handles the (useless) *_base_pe() functions, and the - * inq_format functions. + * This file handles the inq_format functions. * * @author Ed Hartnett, Dennis Heimbigner */ diff --git a/libsrcp/ncpdispatch.c b/libsrcp/ncpdispatch.c index 1fde2c4784..375817b650 100644 --- a/libsrcp/ncpdispatch.c +++ b/libsrcp/ncpdispatch.c @@ -238,19 +238,6 @@ NCP_set_fill(int ncid, int fillmode, int *old_mode_ptr) #endif } -static int -NCP_inq_base_pe(int ncid, int *pep) -{ - if (pep) *pep = 0; - return NC_NOERR; -} - -static int -NCP_set_base_pe(int ncid, int pe) -{ - return NC_NOERR; -} - static int NCP_inq_format(int ncid, int *formatp) { @@ -1399,8 +1386,6 @@ NCP_sync, NCP_abort, NCP_close, NCP_set_fill, -NCP_inq_base_pe, -NCP_set_base_pe, NCP_inq_format, NCP_inq_format_extended, From 965073c42c54f3f337f0d36cd556f89af683c534 Mon Sep 17 00:00:00 2001 From: edwardhartnett Date: Thu, 15 Aug 2019 07:09:15 -0600 Subject: [PATCH 4/4] updated RELEASE_NOTES --- RELEASE_NOTES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 18163447ea..ba1fc106e2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,12 @@ This file contains a high-level description of this package's evolution. Release ## 4.7.1 - TBD +* [Enhancement] Remove obsolete and deprecated functions +nc_set_base_pe() and nc_inq_base_pe() from the dispatch table. (Both +functions are still supported in the library, this is an internal +change only.) +See [GitHub #1436](https://github.com/Unidata/netcdf-c/issues/1468) + * [Bug Fix] Reverted nccopy behavior so that if no -c parameters are given, then any default chunking is left to the netcdf-c library to decide.