Skip to content

Commit 7c113cf

Browse files
committed
Merge branch 'h5align.dmh' of https://github.com/DennisHeimbigner/netcdf-c into gh2206.wif
2 parents 49842fc + bbbc727 commit 7c113cf

35 files changed

Lines changed: 457 additions & 238 deletions

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This file contains a high-level description of this package's evolution. Release
99

1010
* [Bug Fix] Require that the type of the variable in nc_def_var_filter is not variable length. See [Github #/2231](https://github.com/Unidata/netcdf-c/pull/2231).
1111
* [File Change] Apply HDF5 v1.8 format compatibility when writing to previous files, as well as when creating new files. The superblock version remains at 2 for newly created files. Full backward read/write compatibility for netCDF-4 is maintained in all cases. See [Github #2176](https://github.com/Unidata/netcdf-c/issues/2176).
12+
* [Enhancement] Add ability to set dataset alignment for netcdf-4/HDF5 files. See [Github #2206](https://github.com/Unidata/netcdf-c/pull/2206).
1213
* [Enhancement] Add complete bitgroom support to NCZarr. See [Github #2197](https://github.com/Unidata/netcdf-c/pull/2197).
1314
* [Bug Fix] Clean up the handling of deeply nested VLEN types. Marks nc_free_vlen() and nc_free_string as deprecated in favor of ncaux_reclaim_data(). See [Github #2179](https://github.com/Unidata/netcdf-c/pull/2179).
1415
* [Bug Fix] Make sure that netcdf.h accurately defines the flags in the open/create mode flags. See [Github #2183](https://github.com/Unidata/netcdf-c/pull/2183).

acinclude.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,4 +384,6 @@ MOSTLYCLEANFILES += $(valgrind_log_files)
384384
AC_SUBST([VALGRIND_CHECK_RULES])
385385
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])])
386386
])
387+
387388
AC_DEFUN([_AC_FINALIZE],[])
389+

docs/Doxyfile.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,6 @@ INPUT = \
781781
@abs_top_srcdir@/libdispatch/derror.c \
782782
@abs_top_srcdir@/libdispatch/dv2i.c \
783783
@abs_top_srcdir@/libdispatch/dcopy.c \
784-
@abs_top_srcdir@/libdispatch/daux.c \
785784
@abs_top_srcdir@/libsrc4/nc4var.c \
786785
@abs_top_srcdir@/libhdf5/nc4hdf.c \
787786
@abs_top_srcdir@/libsrc4/nc4internal.c \

include/nc4internal.h

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ typedef enum {NC_FALSE = 0, NC_TRUE = 1} nc_bool_t;
118118
/* Forward declarations. */
119119
struct NC_GRP_INFO;
120120
struct NC_TYPE_INFO;
121+
struct NCRCinfo;
121122

122123
/**
123124
* This struct provides indexed Access to Meta-data objects. See the
@@ -205,9 +206,11 @@ typedef struct NC_VAR_INFO
205206
int parallel_access; /**< Type of parallel access for I/O on variable (collective or independent). */
206207
nc_bool_t shuffle; /**< True if var has shuffle filter applied. */
207208
nc_bool_t fletcher32; /**< True if var has fletcher32 filter applied. */
208-
size_t chunk_cache_size; /**< Size in bytes of the var chunk cache. */
209-
size_t chunk_cache_nelems; /**< Number of slots in var chunk cache. */
210-
float chunk_cache_preemption; /**< Chunk cache preemtion policy. */
209+
struct ChunkCache {
210+
size_t size; /**< Size in bytes of the var chunk cache. */
211+
size_t nelems; /**< Number of slots in var chunk cache. */
212+
float preemption; /**< Chunk cache preemtion policy. */
213+
} chunkcache;
211214
int quantize_mode; /**< Quantize mode. NC_NOQUANTIZE is 0, and means no quantization. */
212215
int nsd; /**< Number of significant digits if quantization is used, 0 if not. */
213216
void *format_var_info; /**< Pointer to any binary format info. */
@@ -327,6 +330,24 @@ typedef struct NC_FILE_INFO
327330
} mem;
328331
} NC_FILE_INFO_T;
329332

333+
/* Collect global state info in one place */
334+
typedef struct NCglobalstate {
335+
int initialized;
336+
char* tempdir; /* track a usable temp dir */
337+
char* home; /* track $HOME */
338+
char* cwd; /* track getcwd */
339+
struct NCRCinfo* rcinfo; /* Currently only one rc file per session */
340+
struct GlobalZarr { /* Zarr specific parameters */
341+
char dimension_separator;
342+
} zarr;
343+
struct Alignment { /* H5Pset_alignment parameters */
344+
int defined; /* 1 => threshold and alignment explicitly set */
345+
int threshold;
346+
int alignment;
347+
} alignment;
348+
struct ChunkCache chunkcache;
349+
} NCglobalstate;
350+
330351
/** Variable Length Datatype struct in memory. Must be identical to
331352
* HDF5 hvl_t. (This is only used for VL sequences, not VL strings,
332353
* which are stored in char *'s) */
@@ -460,6 +481,10 @@ extern const char* nc4_atomic_name[NUM_ATOMIC_TYPES];
460481
/* Binary searcher for reserved attributes */
461482
extern const NC_reservedatt* NC_findreserved(const char* name);
462483

484+
/* Global State Management */
485+
extern NCglobalstate* NC_getglobalstate(void);
486+
extern void NC_freeglobalstate(void);
487+
463488
/* Generic reserved Attributes */
464489
#define NC_ATT_REFERENCE_LIST "REFERENCE_LIST"
465490
#define NC_ATT_CLASS "CLASS"

include/ncrc.h

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,26 @@ typedef struct NCRCentry {
3333
char* value;
3434
} NCRCentry;
3535

36-
/* collect all the relevant info around the rc file */
36+
struct AWSentry {
37+
char* key;
38+
char* value;
39+
};
40+
41+
struct AWSprofile {
42+
char* name;
43+
NClist* entries; /* NClist<struct AWSentry*> */
44+
};
45+
46+
/* collect all the relevant info around the rc file and AWS */
3747
typedef struct NCRCinfo {
3848
int ignore; /* if 1, then do not use any rc file */
3949
int loaded; /* 1 => already loaded */
4050
NClist* entries; /* the rc file entry store fields*/
4151
char* rcfile; /* specified rcfile; overrides anything else */
4252
char* rchome; /* Overrides $HOME when looking for .rc files */
53+
NClist* s3profiles; /* NClist<struct AWSprofile*> */
4354
} NCRCinfo;
4455

45-
/* Collect global state info in one place */
46-
typedef struct NCRCglobalstate {
47-
int initialized;
48-
char* tempdir; /* track a usable temp dir */
49-
char* home; /* track $HOME */
50-
char* cwd; /* track getcwd */
51-
NCRCinfo rcinfo; /* Currently only one rc file per session */
52-
struct GlobalZarr { /* Zarr specific parameters */
53-
char dimension_separator;
54-
} zarr;
55-
struct S3credentials {
56-
NClist* profiles; /* NClist<struct AWSprofile*> */
57-
} s3creds;
58-
} NCRCglobalstate;
59-
60-
struct AWSprofile {
61-
char* name;
62-
NClist* entries; /* NClist<struct AWSentry*> */
63-
};
64-
65-
struct AWSentry {
66-
char* key;
67-
char* value;
68-
};
69-
7056
typedef struct NCS3INFO {
7157
char* host; /* non-null if other*/
7258
char* region; /* region */
@@ -80,9 +66,7 @@ extern "C" {
8066
#endif
8167

8268
/* From drc.c */
83-
EXTERNL int ncrc_createglobalstate(void);
8469
EXTERNL void ncrc_initialize(void);
85-
EXTERNL void ncrc_freeglobalstate(void);
8670
EXTERNL int NC_rcfile_insert(const char* key, const char* value, const char* hostport, const char* path);
8771
EXTERNL char* NC_rclookup(const char* key, const char* hostport, const char* path);
8872
EXTERNL char* NC_rclookupx(NCURI* uri, const char* key);
@@ -94,7 +78,6 @@ EXTERNL size_t NC_rcfile_length(NCRCinfo*);
9478
EXTERNL NCRCentry* NC_rcfile_ith(NCRCinfo*,size_t);
9579

9680
/* For internal use */
97-
EXTERNL NCRCglobalstate* ncrc_getglobalstate(void);
9881
EXTERNL void NC_rcclear(NCRCinfo* info);
9982
EXTERNL void NC_rcclear(NCRCinfo* info);
10083

include/netcdf.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,14 @@ nc_def_user_format(int mode_flag, NC_Dispatch *dispatch_table, char *magic_numbe
560560
EXTERNL int
561561
nc_inq_user_format(int mode_flag, NC_Dispatch **dispatch_table, char *magic_number);
562562

563+
/* Set the global alignment property */
564+
EXTERNL int
565+
nc_set_alignment(int threshold, int alignment);
566+
567+
/* Get the global alignment property */
568+
EXTERNL int
569+
nc_get_alignment(int* thresholdp, int* alignmentp);
570+
563571
EXTERNL int
564572
nc__create(const char *path, int cmode, size_t initialsz,
565573
size_t *chunksizehintp, int *ncidp);

libdap4/d4file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ set_curl_properties(NCD4INFO* d4info)
367367
char* newpath = NULL;
368368
int len;
369369
errno = 0;
370-
NCRCglobalstate* globalstate = ncrc_getglobalstate();
370+
NCglobalstate* globalstate = NC_getglobalstate();
371371

372372
/* Create the unique cookie file name */
373373
len =

libdispatch/ddispatch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ See LICENSE.txt for license information.
1212
#include "ncoffsets.h"
1313
#include "ncpathmgr.h"
1414
#include "ncxml.h"
15+
#include "nc4internal.h"
1516

1617
/* Required for getcwd, other functions. */
1718
#ifdef HAVE_UNISTD_H
@@ -48,16 +49,15 @@ NCDISPATCH_initialize(void)
4849
{
4950
int status = NC_NOERR;
5051
int i;
51-
NCRCglobalstate* globalstate = NULL;
52+
NCglobalstate* globalstate = NULL;
5253

5354
for(i=0;i<NC_MAX_VAR_DIMS;i++) {
5455
NC_coord_zero[i] = 0;
5556
NC_coord_one[i] = 1;
5657
NC_stride_one[i] = 1;
5758
}
5859

59-
status = ncrc_createglobalstate(); /* will allocate and clear */
60-
globalstate = ncrc_getglobalstate(); /* will allocate and clear */
60+
globalstate = NC_getglobalstate(); /* will allocate and clear */
6161

6262
/* Capture temp dir*/
6363
{
@@ -123,7 +123,7 @@ int
123123
NCDISPATCH_finalize(void)
124124
{
125125
int status = NC_NOERR;
126-
ncrc_freeglobalstate();
126+
NC_freeglobalstate();
127127
#if defined(ENABLE_BYTERANGE) || defined(ENABLE_DAP) || defined(ENABLE_DAP4)
128128
curl_global_cleanup();
129129
#endif

0 commit comments

Comments
 (0)