X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=bfile%2Fmfile.c;h=21ea32250fb7b3f427a5088f981204b5436fb94b;hb=8b2d919ca1ab2134c098057bb0965ec7dc42cd9d;hp=ce4279afc966159ca3bed910e565041b6a055a3f;hpb=47eeb5384a8fae8bcac8afb8a84782ca094683f9;p=idzebra-moved-to-github.git diff --git a/bfile/mfile.c b/bfile/mfile.c index ce4279a..21ea322 100644 --- a/bfile/mfile.c +++ b/bfile/mfile.c @@ -1,5 +1,5 @@ -/* $Id: mfile.c,v 1.62 2005-06-14 20:28:53 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: mfile.c,v 1.67 2006-08-14 10:40:05 adam Exp $ + Copyright (C) 1995-2006 Index Data ApS This file is part of the Zebra server. @@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ @@ -437,7 +437,7 @@ int mf_close(MFile mf) { int i; - yaz_log (YLOG_DEBUG, "mf_close(%s)", mf->name); + yaz_log (YLOG_DEBUG, "mf_close(%s) unlink=%d", mf->name, mf->unlink_flag); assert(mf->open); for (i = 0; i < mf->no_files; i++) { @@ -604,7 +604,9 @@ int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf) int mf_unlink(MFile mf) { if (mf->open) + { mf->unlink_flag = 1; + } else { int i; @@ -614,11 +616,34 @@ int mf_unlink(MFile mf) return 0; } -/* - * Unlink the file by name, rather than MFile-handle. File should be closed. - */ -int mf_unlink_name(MFile_area ma, const char *name) +int mf_area_directory_stat(MFile_area ma, int no, const char **directory, + double *used_bytes, double *max_bytes) { - abort(); - return 0; + int i; + mf_dir *d = ma->dirs; + for (i = 0; d && inext) + ; + if (!d) + return 0; + if (directory) + *directory = d->name; + if (max_bytes) + { + /* possible loss of data. But it's just statistics and lies */ + *max_bytes = (double) d->max_bytes; + } + if (used_bytes) + { + /* possible loss of data. But it's just statistics and lies */ + *used_bytes = (double) (d->max_bytes - d->avail_bytes); + } + return 1; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +