man-pages/man5/mlocate.db.5.html
2021-03-31 01:06:50 +01:00

164 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of mlocate.db</TITLE>
</HEAD><BODY>
<H1>mlocate.db</H1>
Section: File Formats (5)<BR>Updated: Jan 2007<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
mlocate.db - a mlocate database
<P>
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
A mlocate database starts with a file header:
8 bytes for a magic number (<B>&quot;\0mlocate&quot;</B> like a C literal),
4 bytes for the
<I>configuration block</I>
size in big endian,
1 byte for file format version (<B>0</B>),
1 byte for the ``require visibility'' flag (<B>0</B> or <B>1</B>),
2 bytes padding,
and a NUL-terminated path name of the root of the database.
<P>
The header is followed by a <I>configuration block</I>,
included to ensure databases are not reused
if some configuration changes
could affect their contents.
The size of the configuration block in bytes is stored in the file header.
The configuration block is a sequence of <I>variable assignments</I>,
ordered by variable name.
Each
<I>variable assignment</I>
consists of a NUL-terminated variable name
and an ordered list of NUL-terminated values.
The value list is terminated by one more
<FONT SIZE="-1">NUL</FONT>
character.
The ordering used is defined by the
<B>strcmp ()</B>
function.
<P>
Currently defined variables are:
<DL COMPACT>
<DT id="1"><B>prune_bind_mounts</B><DD>
A single entry, the value of <B>PRUNE_BIND_MOUNTS</B>; one of the strings
<B>0</B>
or <B>1</B>.
<P>
<DT id="2"><B>prunefs</B><DD>
The value of <B>PRUNEFS</B>, each entry is converted to uppercase.
<P>
<DT id="3"><B>prunepaths</B><DD>
The value of <B>PRUNEPATHS</B>.
<P>
</DL>
<P>
The rest of the file until
<FONT SIZE="-1">EOF</FONT>
describes directories and their contents.
Each directory starts with a header:
8 bytes for
<I>directory time</I>
(seconds) in big endian,
4 bytes for
<I>directory time</I>
(nanoseconds) in big endian (0 if unknown, less than 1,000,000,000),
4 bytes padding,
and a NUL-terminated path name of the the directory.
Directory contents, a sequence of
<I>file entries</I>
sorted by name, follow.
<P>
<I>Directory time</I>
is the maximum of
<B>st_ctime</B>
and
<B>st_mtime</B>
of the directory.
<B><A HREF="/cgi-bin/man/man2html?8+updatedb">updatedb</A></B>(8)
uses the original data if the
<I>directory time</I>
in the database and in the file system match exactly.
<I>Directory time</I>
equal to 0 always causes rescanning of the directory:
this is necessary to handle directories
which were being updated while building the database.
<P>
Each
<I>file entry</I>
starts with a single byte, marking its type:
<DL COMPACT>
<DT id="4"><B>0</B><DD>
A non-directory file.
Followed by a NUL-terminated file (not path) name.
<P>
<DT id="5"><B>1</B><DD>
A subdirectory.
Followed by a NUL-terminated file (not path) name.
<P>
<DT id="6"><B>2</B><DD>
Marks the end of the current directory.
<P>
</DL>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+locate">locate</A>(1)</B>
only reports file entries,
directory names are not reported
because they are reported as an entry in their parent directory.
The only exception is the root directory of the database,
which is stored in the file header.
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>AUTHOR</H2>
Miloslav Trmac &lt;<A HREF="mailto:mitr@redhat.com">mitr@redhat.com</A>&gt;
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+locate">locate</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?5+updatedb.conf">updatedb.conf</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?8+updatedb">updatedb</A></B>(8)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT id="9"><A HREF="#lbAD">AUTHOR</A><DD>
<DT id="10"><A HREF="#lbAE">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:04 GMT, March 31, 2021
</BODY>
</HTML>