Simplify and optimize commit clean operation
[idzebra-moved-to-github.git] / bfile / mfile.h
index 3cf4cda..71fbf9d 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: mfile.h,v 1.1 2004-12-08 12:23:08 adam Exp $
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
-   Index Data Aps
+/* $Id: mfile.h,v 1.7 2006-10-09 22:10:00 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
+
 */
 
 
@@ -85,7 +85,6 @@ typedef struct meta_file
     int no_files;
     int cur_file;
     int open;                          /* is this file open? */
-    int unlink_flag;
     int blocksize;
     mfile_off_t min_bytes_creat;  /* minimum bytes required to enter directory */
     MFile_area ma;
@@ -135,21 +134,35 @@ int mf_read(MFile mf, zint no, int offset, int nbytes, void *buf);
 int mf_write(MFile mf, zint no, int offset, int nbytes, const void *buf);
 
 /*
- * Destroy a metafile, unlinking component files. File must be open.
- */
-int mf_unlink(MFile mf);
-
-
-/*
  * Destroy all metafiles. No files may be opened.
  */
-void mf_reset(MFile_area ma);
+void mf_reset(MFile_area ma, int unlink_flag);
+
+/* \brief gets statistics about directory in metafile area
+   \param ma the area
+   \param no directory number (0=first, 1=second,...)
+   \param directory holds directory name (if found)
+   \param used_bytes used file bytes in directory (if found)
+   \param max_bytes max usage of bytes (if found)
+   \retval 1 no is within range and directory, used, max are set.
+   \retval 0 no is out of range and directory, used, max are unset
+
+   We are using double, because off_t may have a different size
+   on same platform depending on whether 64-bit is enabled or not.
+   Note that if an area has unlimited size, that is represented
+   as max_bytes = -1.
+*/ 
+int mf_area_directory_stat(MFile_area ma, int no, const char **directory,
+                          double *bytes_used, double *bytes_max);
+    
+YAZ_END_CDECL
 
+#endif
 /*
- * Unlink the file by name, rather than MFile-handle.
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
  */
-int mf_unlink_name(MFile_area, const char *name);
 
-YAZ_END_CDECL
-
-#endif