mlf_init

Synopsis

    
      #include "mlf.h"
      mlf_def_t *mlf_init( int n_levels, int n_files, int writing,
    	  char *fbase, char *fsuffix, char *config );
    

Description

The multi-level file routines are designed for efficiently storing a large number of sequential files. Most hierarchical file systems become seriously inefficient as the number of files in a single directory becomes large. This is due in large part to the fact that any search for a specific filename requires a linear search through the directory, and hence sequentially accessing each file in a directory is an order n^2 operation.

The MLF routines address this issue by using multiple directory levels to store sequential files. The number of levels and the number of entries at each level is configurable, depending on the total expected number of files.

mlf_init() establishes the parameters for subsequent multi-level file operations. n_levels specifies how many levels of directories should be used. n_files specifies the number of files per directory. the writing argument should be non-zero for write operations, zero for read operations. fbase is the name of the first level directory. fsuffix is a suffix that is appended to each file. config is an optional string defining the first file to access. The base and suffix in the config string takes precedence over the fbase and fsuffix parameters.

Generated file names are of the form:

$fbase/\d\d+(/\d\d)* /\d\d\.$fsuffix

Returns

mlf_init() returns a pointer to a dynamically allocated structure which holds the definitions. Most errors are syntax errors and are fatal, although they can be made non-fatal by manipulating nl_response.

See Also

Multi-level File Routines.

Source File

/usr/local/src/nortlib/mlf.c

Alphabetical List
Subject List
Return to Manuals Page
webmaster@huarp.harvard.edu
Copyright 2001 by the President and Fellows of Harvard College