mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
ccc70d640b
and https://github.com/Unidata/netcdf-c/issues/708 Expand the NC_INMEMORY capabilities to support writing and accessing the final modified memory. Three new functions have been added: nc_open_memio, nc_create_mem, and nc_close_memio. The following new capabilities were added. 1. nc_open_memio() allows the NC_WRITE mode flag so a chunk of memory can be passed in and be modified 2. nc_create_mem() allows the NC_INMEMORY flag to be set to cause the created file to be kept in memory. 3. nc_close_mem() allows the final in-memory contents to be retrieved at the time the file is closed. 4. A special flag, NC_MEMIO_LOCK, is provided to ensure that the provided memory will not be freed or reallocated. Note the following. 1. If nc_open_memio() is called with NC_WRITE, and NC_MEMIO_LOCK is not set, then the netcdf-c library will take control of the incoming memory. This means that the original memory block should not be freed but the block returned by nc_close_mem() must be freed. 2. If nc_open_memio() is called with NC_WRITE, and NC_MEMIO_LOCK is set, then modifications to the original memory may fail if the space available is insufficient. Documentation is provided in the file docs/inmemory.md. A test case is provided: nc_test/tst_inmemory.c driven by nc_test/run_inmemory.sh WARNING: changes were made to the dispatch table for the close entry. From int (*close)(int) to int (*close)(int,void*). |
||
---|---|---|
.. | ||
bad_cdf5_begin.nc | ||
CMakeLists.txt | ||
error.c | ||
error.h | ||
large_files.c | ||
Make0 | ||
make_test_file.sh | ||
Makefile.am | ||
nc_enddef.cdl | ||
nc_sync.cdl | ||
nc_test.c | ||
nc_test.html | ||
quick_large_files.c | ||
ref_tst_diskless2.cdl | ||
run_cdf5.sh | ||
run_diskless2.sh | ||
run_diskless5.sh | ||
run_diskless.sh | ||
run_inmemory.sh | ||
run_mmap.sh | ||
run_pnetcdf_test.sh | ||
run_valgrind_tests.sh | ||
t_nc_p5.c | ||
t_nc.c | ||
test_get_p5.c | ||
test_get_p5.m4 | ||
test_get.m4 | ||
test_put.m4 | ||
test_read.m4 | ||
test_write.m4 | ||
testnc3perf.c | ||
tests.h | ||
tst_addvar.c | ||
tst_atts3.c | ||
tst_atts.c | ||
tst_big_rvar.c | ||
tst_big_var2.c | ||
tst_big_var6.c | ||
tst_big_var.c | ||
tst_cdf5_begin.c | ||
tst_cdf5format.c | ||
tst_def_var_fill.c | ||
tst_diskless2.c | ||
tst_diskless3.c | ||
tst_diskless4.c | ||
tst_diskless5.c | ||
tst_diskless5.cdl | ||
tst_diskless.c | ||
tst_elatefill.c | ||
tst_formats.c | ||
tst_formatx_pnetcdf.c | ||
tst_global_fillval.c | ||
tst_inmemory.c | ||
tst_inq_type.c | ||
tst_large_cdf5.c | ||
tst_large.c | ||
tst_max_var_dims.c | ||
tst_meta.c | ||
tst_misc.c | ||
tst_names.c | ||
tst_nofill2.c | ||
tst_nofill3.c | ||
tst_nofill.c | ||
tst_norm.c | ||
tst_open_cdf5.c | ||
tst_parallel2.c | ||
tst_pnetcdf.c | ||
tst_put_vars.c | ||
tst_small.c | ||
tst_utf8_phrases.c | ||
tst_utf8_validate.c | ||
util.c |