diff options
author | Robb Matzke <matzke@llnl.gov> | 1997-10-20 23:14:35 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1997-10-20 23:14:35 (GMT) |
commit | 56ad55117a89a423a9341d2f0c3912d4ad57ec6f (patch) | |
tree | dff0bada659180ac324d81a4d97f7bfb884f0ed6 /src/H5Oistore.c | |
parent | dc4961d072249ddf39a7db7a945ea627c276d025 (diff) | |
download | hdf5-56ad55117a89a423a9341d2f0c3912d4ad57ec6f.zip hdf5-56ad55117a89a423a9341d2f0c3912d4ad57ec6f.tar.gz hdf5-56ad55117a89a423a9341d2f0c3912d4ad57ec6f.tar.bz2 |
[svn-r129] Changes since 19970916
----------------------
./config/depend.in
Fixed backslashes in sed script because the H5Gnode.c
dependency info was disappearing. You'll have to rerun
config.status to rebuild the Makefiles unless you use gnu
make.
./config/conclude.in
Also removes emacs backup files, TAGS, and svf backup files.
./config/linux
Grouped gcc flags and added provisions for debugging vs. production.
./html/H5.format.html
Updated messages 0x0008, 0x0009, and 0x000A.
./html/storage.html
Documentation describing storage schemes.
./src/Makefile.in
./test/Makefile.in
New source files.
./src/H5A.c
./src/H5Apublic.h
./src/H5C.c
Changed VOIDP to void* in a couple places.
./src/H5AC.c
./src/H5ACprivate.h
./src/H5B.c
./src/H5Bprivate.h
./src/H5G.c
./src/H5Gnode.c
./src/H5Gprivate.h
./src/H5H.c
./src/H5O.c
Removed `const' from some variables because H5G_node_found() wanted
to modify it's udata argument. Removing const there caused it
to cascade to these other locations.
./src/H5AC.c
./src/H5ACprivate.h
./src/H5B.c
./src/H5Gnode.c
./src/H5Gstab.c
./src/H5H.c
./src/H5O.c
Added an extra argument to H5AC_find_f() and H5AC_protect(). This
arg gets passed to the load() method. Also added an extra
argument to the H5AC_find() macro.
./src/H5B.c
./src/H5Bprivate.h
./src/H5Gnode.c
Extra argument passed to the sizeof_rkey() method.
./src/H5Fprivate.c
./src/H5Fistore.c (new)
Added indexed I/O operations.
./src/H5G.c
./src/H5Gnode.c
./src/H5Gprivate.h
Beginning to add H5G_open/close and related bug fixes.
./src/H5Oprivate.h
./src/H5Oistore.c (new)
Added the H5O_ISTORE messsage (0x0008) for indexed storage of
objects.
./src/H5private.h
Added extra braces around both sides of the FUNC_ENTER() and
FUNC_LEAVE() macros so FUNC_ENTER() can appear before
declarations or after executable statements the second case is
used by H5G_namei() to initialize output arguments to sane
values before FUNC_ENTER() might return failure.
int f ()
{
int decl1;
printf ("This happens before FUNC_ENTER()\n");
FUNC_ENTER (...);
int another_declaration;
./src/H5B.c
./src/H5Bprivate.h
./src/H5Gnode.c
Extra arguments for key encoding and decoding.
./src/H5E.c
./src/H5Epublic.h
./src/H5Fistore.c
./src/H5Oistore.c
./src/H5Oprivate.h
Indexed, chunked, sparse storage (not ready for general consumption
yet).
./src/H5V.c (new)
./src/H5Vprivate.h (new)
./test/hyperslab.c (new)
Vector, array, and hyperslab functions.
./src/H5B.c
./src/H5Bprivate.h
./src/H5Fistore.c
./src/H5Gnode.c
./src/H5V.c
./src/H5Vprivate.h
./test/hyperslab.c
Added functionality for indexed storage.
./src/H5F.c
Fixed problems with seek optimizing. Recommend we disable it
until we can implement it in the file/address class since all
of HDF5 must be aware of it.
./src/H5O.c
Fixed comeent speling erorr :-)
./MANIFEST
Added new files.
./config/conclude.in
Added the word `Testing' to the test cases. So if a test
program is called hyperslab then the make output will contain
the line `Testing hyperslab'.
./config/linux
The default file I/O library is Posix section 2 on my linux
machine so I can do some I/O performance testing.
./src/H5C.c
./src/H5Cprivate.h
./src/H5Cpublic.h
Added ability to set size of indexed-storage B-tree.
./src/H5D.c
./src/H5E.c
./src/H5Epublic.h
./src/H5F.c
./src/H5Fprivate.h
./src/H5G.c
./src/H5Gnode.c
./src/H5Gpkg.h
./src/H5Gprivate.h
./src/H5Gpublic.h
./src/H5Gshad.c
./src/H5Gstab.c
./test/stab.c
Changed `directory' to `group' in numerous places.
./src/H5private.h
The FILELIB constant can be set on the compile command-line.
./src/istore.c NEW
Tests for indexed storage.
Diffstat (limited to 'src/H5Oistore.c')
-rw-r--r-- | src/H5Oistore.c | 271 |
1 files changed, 271 insertions, 0 deletions
diff --git a/src/H5Oistore.c b/src/H5Oistore.c new file mode 100644 index 0000000..1ed275e --- /dev/null +++ b/src/H5Oistore.c @@ -0,0 +1,271 @@ +/* + * Copyright (C) 1997 NCSA + * All rights reserved. + * + * Programmer: Robb Matzke <matzke@llnl.gov> + * Wednesday, October 8, 1997 + */ +#include <H5private.h> +#include <H5Eprivate.h> +#include <H5MMprivate.h> +#include <H5Oprivate.h> + +#define PABLO_MASK H5O_istore_mask + +/* PRIVATE PROTOTYPES */ +static void *H5O_istore_decode (H5F_t *f, size_t raw_size, const uint8 *p); +static herr_t H5O_istore_encode (H5F_t *f, size_t size, uint8 *p, + const void *_mesg); +static void *H5O_istore_copy (const void *_mesg, void *_dest); +static size_t H5O_istore_size (H5F_t *f, const void *_mesg); +static herr_t H5O_istore_debug (H5F_t *f, const void *_mesg, FILE *stream, + intn indent, intn fwidth); + +/* This message derives from H5O */ +const H5O_class_t H5O_ISTORE[1] = {{ + H5O_ISTORE_ID, /*message id number */ + "istore", /*message name for debugging */ + sizeof(H5O_istore_t), /*native message size */ + H5G_NOTHING_CACHED, /*symtab entry `type' field */ + H5O_istore_decode, /*decode message */ + H5O_istore_encode, /*encode message */ + NULL, /*get messsage from stab entry */ + NULL, /*put message into stab entry */ + H5O_istore_copy, /*copy the native value */ + H5O_istore_size, /*size of message on disk */ + NULL, /*reset method */ + H5O_istore_debug, /*debug the message */ +}}; + +/* Is the interface initialized? */ +static hbool_t interface_initialize_g = FALSE; + + + +/*------------------------------------------------------------------------- + * Function: H5O_istore_decode + * + * Purpose: Decode an indexed storage message and return a pointer to a + * new one created with malloc(). + * + * Return: Success: Ptr to new message in native order. + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Wednesday, October 8, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5O_istore_decode (H5F_t *f, size_t raw_size, const uint8 *p) +{ + H5O_istore_t *mesg = NULL; + intn i; + + FUNC_ENTER (H5O_istore_decode, NULL, NULL); + + /* check args */ + assert (f); + assert (p); + + /* decode */ + mesg = H5MM_xcalloc (1, sizeof(H5O_istore_t)); + H5F_decode_offset (f, p, mesg->btree_addr); + mesg->ndims = *p++; + assert (raw_size == H5O_istore_size (f, mesg)); + + /* Reserved bytes */ + p += 7; + + /* Read the min_corner, max_corner, and alignment values */ + for (i=0; i<mesg->ndims; i++) { + UINT32DECODE (p, mesg->alignment[i]); + } + + FUNC_LEAVE (mesg); +} + + + +/*------------------------------------------------------------------------- + * Function: H5O_istore_encode + * + * Purpose: Encodes a message. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Wednesday, October 8, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_istore_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg) +{ + const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + int i; + + FUNC_ENTER (H5O_istore_encode, NULL, FAIL); + + /* check args */ + assert (f); + assert (mesg); + assert (mesg->ndims>0 && mesg->ndims<=H5O_ISTORE_NDIMS); + assert (raw_size == H5O_istore_size (f, _mesg)); + assert (p); + + /* encode B-tree offset */ + H5F_encode_offset (f, p, mesg->btree_addr); + + /* number of dimensions */ + *p++ = mesg->ndims; + + /* reserved bytes should be zero */ + for (i=0; i<7; i++) *p++ = 0; + + /* min_corner, max_corner, and alignment */ + for (i=0; i<mesg->ndims; i++) { + UINT32ENCODE (p, mesg->alignment[i]); + } + + FUNC_LEAVE (SUCCEED); +} + + + +/*------------------------------------------------------------------------- + * Function: H5O_istore_copy + * + * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if + * necessary. + * + * Return: Success: Ptr to _DEST + * + * Failure: NULL + * + * Programmer: Robb Matzke + * Wednesday, October 8, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5O_istore_copy (const void *_mesg, void *_dest) +{ + const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + H5O_istore_t *dest = (H5O_istore_t *)_dest; + + FUNC_ENTER (H5O_istore_copy, NULL, NULL); + + /* check args */ + assert (mesg); + if (!dest) dest = H5MM_xcalloc (1, sizeof(H5O_istore_t)); + + /* copy */ + *dest = *mesg; + + FUNC_LEAVE ((void*)dest); +} + + + +/*------------------------------------------------------------------------- + * Function: H5O_istore_size + * + * Purpose: Returns the size of the raw message in bytes not counting the + * message type or size fields, but only the data fields. This + * function doesn't take into account message alignment. + * + * Return: Success: Message data size in bytes + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Wednesday, October 8, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static size_t +H5O_istore_size (H5F_t *f, const void *_mesg) +{ + const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + size_t ret_value = FAIL; + + FUNC_ENTER (H5O_istore_size, NULL, FAIL); + + /* check args */ + assert (f); + assert (mesg); + assert (mesg->ndims>0 && mesg->ndims<=H5O_ISTORE_NDIMS); + + ret_value = H5F_SIZEOF_OFFSET (f) + /* B-tree address */ + 1 + /* max dimension index */ + 7 + /* reserved bytes */ + mesg->ndims * 4; /* alignment */ + + FUNC_LEAVE (ret_value); +} + + + +/*------------------------------------------------------------------------- + * Function: H5O_istore_debug + * + * Purpose: Prints debugging info for a message. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Wednesday, October 8, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_istore_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent, + intn fwidth) +{ + const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg; + intn i; + + FUNC_ENTER (H5O_istore_debug, NULL, FAIL); + + /* check args */ + assert (f); + assert (mesg); + assert (stream); + assert (indent>=0); + assert (fwidth>=0); + + fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, + "B-tree address:", + (unsigned long)(mesg->btree_addr)); + fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Number of dimensions:", + (unsigned long)(mesg->ndims)); + + /* Alignment */ + fprintf (stream, "%*s%-*s {", indent, "", fwidth, + "Alignment:"); + for (i=0; i<mesg->ndims; i++) { + fprintf (stream, "%s%lu", i?", ":"", + (unsigned long)(mesg->alignment[i])); + } + fprintf (stream, "}\n"); + + FUNC_LEAVE (SUCCEED); +} + |