diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-04-14 05:03:26 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-04-14 05:03:26 (GMT) |
commit | aa1cedb4f8b57fa73ab385d6316073a497410244 (patch) | |
tree | f1070fa6203d1b5ed7d2f3056f1fe83c01c4a315 /src/H5Olayout.c | |
parent | 4e4bdd91633a24a39450a236cc88ab7a3b3a17d4 (diff) | |
download | hdf5-aa1cedb4f8b57fa73ab385d6316073a497410244.zip hdf5-aa1cedb4f8b57fa73ab385d6316073a497410244.tar.gz hdf5-aa1cedb4f8b57fa73ab385d6316073a497410244.tar.bz2 |
[svn-r6658] Purpose:
New feature
Description:
Track changes in the internal metadata API with clearing the metadata
dirty flag without flushing object.
Added ability to delete an object header in the file and restore all the
space referenced by various header messages.
Platforms tested:
FreeBSD 4.8 (sleipnir) w/C++
Linux 2.4 (burrwhite) w/FORTRAN
Solaris 2.7 (arabica) w/FORTRAN
IRIX64 6.5 (modi4) w/parallel & FORTRAN
(h5committest not run due to my ongoing difficulties with C++ on burrwhite).
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r-- | src/H5Olayout.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 43d1df7..fc1eeae 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -24,6 +24,7 @@ #include "H5Dprivate.h" #include "H5Eprivate.h" #include "H5FLprivate.h" /*Free Lists */ +#include "H5MFprivate.h" /* File space management */ #include "H5MMprivate.h" #include "H5Opkg.h" /* Object header functions */ @@ -34,6 +35,7 @@ static void *H5O_layout_copy(const void *_mesg, void *_dest); static size_t H5O_layout_size(H5F_t *f, const void *_mesg); static herr_t H5O_layout_reset (void *_mesg); static herr_t H5O_layout_free (void *_mesg); +static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -47,7 +49,8 @@ const H5O_class_t H5O_LAYOUT[1] = {{ H5O_layout_copy, /*copy the native value */ H5O_layout_size, /*size of message on disk */ H5O_layout_reset, /*reset method */ - H5O_layout_free, /*free the struct */ + H5O_layout_free, /*free the struct */ + H5O_layout_delete, /* file delete method */ NULL, /*get share method */ NULL, /*set share method */ H5O_layout_debug, /*debug the message */ @@ -444,6 +447,59 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_layout_delete + * + * Purpose: Free file space referenced by message + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, March 19, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) +{ + const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_layout_delete, FAIL); + + /* check args */ + assert(f); + assert(mesg); + + /* Perform different actions, depending on the type of storage */ + switch(mesg->type) { + case H5D_COMPACT: /* Compact data storage */ + /* Nothing required */ + break; + + case H5D_CONTIGUOUS: /* Contiguous block on disk */ + /* Free the file space for the raw data */ + if (H5F_contig_delete(f, dxpl_id, mesg)<0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data"); + break; + + case H5D_CHUNKED: /* Chunked blocks on disk */ + /* Free the file space for the raw data */ + if (H5F_istore_delete(f, dxpl_id, mesg)<0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data"); + break; + + default: + HGOTO_ERROR (H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type"); + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_layout_delete() */ + + +/*------------------------------------------------------------------------- * Function: H5O_layout_debug * * Purpose: Prints debugging info for a message. |