1997-09-22 10:08:54 +08:00
|
|
|
|
/*
|
2001-04-06 01:29:14 +08:00
|
|
|
|
* Copyright (C) 1997-2001 National Center for Supercomputing Applications
|
|
|
|
|
* All rights reserved.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Programmer: Robb Matzke <matzke@llnl.gov>
|
|
|
|
|
* Friday, September 19, 1997
|
|
|
|
|
*/
|
|
|
|
|
#define H5G_PACKAGE
|
2000-10-10 15:43:38 +08:00
|
|
|
|
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2001-04-06 01:29:14 +08:00
|
|
|
|
#include "H5private.h"
|
|
|
|
|
#include "H5Eprivate.h"
|
|
|
|
|
#include "H5Fpkg.h"
|
|
|
|
|
#include "H5Gpkg.h"
|
|
|
|
|
#include "H5HLprivate.h"
|
|
|
|
|
#include "H5MMprivate.h"
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
#define PABLO_MASK H5G_ent_mask
|
2001-08-15 06:09:56 +08:00
|
|
|
|
static int interface_initialize_g = 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
#define INTERFACE_INIT NULL
|
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_cache
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Returns a pointer to the cache associated with the symbol
|
|
|
|
|
* table entry. You should modify the cache directly, then call
|
|
|
|
|
* H5G_modified() with the new cache type (even if the type is
|
|
|
|
|
* still the same).
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to the cache in the symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
1997-09-22 10:08:54 +08:00
|
|
|
|
* Friday, September 19, 1997
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5G_cache_t *
|
|
|
|
|
H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2002-08-09 00:52:55 +08:00
|
|
|
|
H5G_cache_t *ret_value; /* Return value */
|
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_cache, NULL);
|
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (!ent)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "no entry");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (cache_type)
|
|
|
|
|
*cache_type = ent->type;
|
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=&(ent->cache);
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_modified
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: This function should be called after you make any
|
|
|
|
|
* modifications to a symbol table entry cache. Supply the new
|
|
|
|
|
* type for the cache. If CACHE_TYPE is the constant
|
|
|
|
|
* H5G_NO_CHANGE then the cache type isn't changed--just the
|
|
|
|
|
* dirty bit is set.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
1997-09-22 10:08:54 +08:00
|
|
|
|
* Friday, September 19, 1997
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_modified, FAIL);
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
assert(ent);
|
2002-05-29 23:07:55 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (H5G_NO_CHANGE != ent->type)
|
|
|
|
|
ent->type = cache_type;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
ent->dirty = TRUE;
|
2002-05-29 23:07:55 +08:00
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_decode_vec
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Same as H5G_ent_decode() except it does it for an array of
|
|
|
|
|
* symbol table entries.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* SYM CANTDECODE Can't decode.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative, with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* after the last symbol.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2001-08-15 06:09:56 +08:00
|
|
|
|
H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, int n)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int i;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_decode_vec, FAIL);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
assert(ent);
|
|
|
|
|
assert(n >= 0);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode entries */
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (H5G_ent_decode(f, pp, ent + i) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_decode
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Decodes a symbol table entry pointed to by `*pp'.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* following the symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1998-07-20 21:45:25 +08:00
|
|
|
|
* Robb Matzke, 17 Jul 1998
|
|
|
|
|
* Added a 4-byte padding field for alignment and future expansion.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
const uint8_t *p_ret = *pp;
|
|
|
|
|
uint32_t tmp;
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_decode, FAIL);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
assert(ent);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
ent->file = f;
|
1998-01-08 01:14:26 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode header */
|
2000-10-10 15:43:38 +08:00
|
|
|
|
H5F_DECODE_LENGTH(f, *pp, ent->name_off);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5F_addr_decode(f, pp, &(ent->header));
|
1998-01-29 04:24:49 +08:00
|
|
|
|
UINT32DECODE(*pp, tmp);
|
1998-07-20 21:45:25 +08:00
|
|
|
|
*pp += 4; /*reserved*/
|
1998-01-29 04:24:49 +08:00
|
|
|
|
ent->type=(H5G_type_t)tmp;
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode scratch-pad */
|
|
|
|
|
switch (ent->type) {
|
|
|
|
|
case H5G_NOTHING_CACHED:
|
|
|
|
|
break;
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
case H5G_CACHED_STAB:
|
|
|
|
|
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
|
|
|
|
|
H5F_addr_decode(f, pp, &(ent->cache.stab.btree_addr));
|
|
|
|
|
H5F_addr_decode(f, pp, &(ent->cache.stab.heap_addr));
|
|
|
|
|
break;
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-04-15 00:44:46 +08:00
|
|
|
|
case H5G_CACHED_SLINK:
|
|
|
|
|
UINT32DECODE (*pp, ent->cache.slink.lval_offset);
|
|
|
|
|
break;
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
default:
|
|
|
|
|
HDabort();
|
|
|
|
|
}
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
*pp = p_ret + H5G_SIZEOF_ENTRY(f);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_encode_vec
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Same as H5G_ent_encode() except it does it for an array of
|
|
|
|
|
* symbol table entries.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* SYM CANTENCODE Can't encode.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative, with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* after the last symbol.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2001-08-15 06:09:56 +08:00
|
|
|
|
H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int i;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_encode_vec, FAIL);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
assert(ent);
|
|
|
|
|
assert(n >= 0);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* encode entries */
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (H5G_ent_encode(f, pp, ent + i) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_encode
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Encodes the specified symbol table entry into the buffer
|
|
|
|
|
* pointed to by *pp.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative, with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* after the symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Robb Matzke, 8 Aug 1997
|
|
|
|
|
* Writes zeros for the bytes that aren't used so the file doesn't
|
|
|
|
|
* contain junk.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_encode, FAIL);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
|
|
|
|
|
if (ent) {
|
|
|
|
|
/* encode header */
|
2000-10-10 15:43:38 +08:00
|
|
|
|
H5F_ENCODE_LENGTH(f, *pp, ent->name_off);
|
1999-07-29 02:25:43 +08:00
|
|
|
|
H5F_addr_encode(f, pp, ent->header);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
UINT32ENCODE(*pp, ent->type);
|
1998-07-20 21:45:25 +08:00
|
|
|
|
UINT32ENCODE(*pp, 0); /*reserved*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* encode scratch-pad */
|
|
|
|
|
switch (ent->type) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
case H5G_NOTHING_CACHED:
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
case H5G_CACHED_STAB:
|
|
|
|
|
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
|
|
|
|
|
H5F_addr_encode(f, pp, ent->cache.stab.btree_addr);
|
|
|
|
|
H5F_addr_encode(f, pp, ent->cache.stab.heap_addr);
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
case H5G_CACHED_SLINK:
|
|
|
|
|
UINT32ENCODE (*pp, ent->cache.slink.lval_offset);
|
|
|
|
|
break;
|
1998-04-15 00:44:46 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
default:
|
|
|
|
|
HDabort();
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2000-10-10 15:43:38 +08:00
|
|
|
|
H5F_ENCODE_LENGTH(f, *pp, 0);
|
1999-08-11 04:21:32 +08:00
|
|
|
|
H5F_addr_encode(f, pp, HADDR_UNDEF);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
UINT32ENCODE(*pp, H5G_NOTHING_CACHED);
|
1998-07-20 21:45:25 +08:00
|
|
|
|
UINT32ENCODE(*pp, 0); /*reserved*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* fill with zero */
|
1999-07-29 02:25:43 +08:00
|
|
|
|
while (*pp < p_ret) *(*pp)++ = 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
*pp = p_ret;
|
1999-07-29 02:25:43 +08:00
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_debug
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Prints debugging information about a symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 29 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1999-07-29 02:25:43 +08:00
|
|
|
|
* Robb Matzke, 1999-07-28
|
|
|
|
|
* The HEAP argument is passed by value.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1999-04-16 03:57:50 +08:00
|
|
|
|
H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE * stream,
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int indent, int fwidth, haddr_t heap)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
1998-04-15 00:44:46 +08:00
|
|
|
|
const char *lval = NULL;
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1998-04-15 00:44:46 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_debug, FAIL);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
|
|
|
|
"Name offset into private heap:",
|
|
|
|
|
(unsigned long) (ent->name_off));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"Object header address:", ent->header);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
|
|
|
|
|
"Dirty:",
|
|
|
|
|
ent->dirty ? "Yes" : "No");
|
|
|
|
|
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
|
|
|
|
|
"Symbol type:");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
switch (ent->type) {
|
|
|
|
|
case H5G_NOTHING_CACHED:
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "Nothing Cached\n");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5G_CACHED_STAB:
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "Symbol Table\n");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"B-tree address:", ent->cache.stab.btree_addr);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"Heap address:", ent->cache.stab.heap_addr);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
break;
|
|
|
|
|
|
1998-04-15 00:44:46 +08:00
|
|
|
|
case H5G_CACHED_SLINK:
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf (stream, "Symbolic Link\n");
|
|
|
|
|
HDfprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
|
|
|
|
"Link value offset:",
|
|
|
|
|
(unsigned long)(ent->cache.slink.lval_offset));
|
|
|
|
|
if (H5F_addr_defined(heap)) {
|
1998-04-15 00:44:46 +08:00
|
|
|
|
lval = H5HL_peek (ent->file, heap, ent->cache.slink.lval_offset);
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf (stream, "%*s%-*s %s\n", indent, "", fwidth,
|
|
|
|
|
"Link value:",
|
|
|
|
|
lval);
|
1998-04-15 00:44:46 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
default:
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|