summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-40/man5/mlocate.db.5
blob: 60814d6b5d955f41af3f3a40814264bbaf8baa1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.\" A man page for mlocate.db. -*- nroff -*-
.\"
.\" Copyright (C) 2005, 2007 Red Hat, Inc. All rights reserved.
.\"
.\" This copyrighted material is made available to anyone wishing to use,
.\" modify, copy, or redistribute it subject to the terms and conditions of the
.\" GNU General Public License v.2.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
.\" 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 this program; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\" Author: Miloslav Trmac <mitr@redhat.com>
.TH mlocate.db 5 "Jan 2007" mlocate

.SH NAME
mlocate.db \- a mlocate database

.SH DESCRIPTION
A mlocate database starts with a file header:
8 bytes for a magic number (\fB"\\0mlocate"\fR like a C literal),
4 bytes for the
.I configuration block
size in big endian,
1 byte for file format version (\fB0\fR),
1 byte for the \*(lqrequire visibility\*(rq flag (\fB0\fR or \fB1\fR),
2 bytes padding,
and a \f(SMNUL\fR-terminated path name of the root of the database.

The header is followed by a \fIconfiguration block\fR,
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 \fIvariable assignments\fR,
ordered by variable name.
Each 
.I variable assignment
consists of a \f(SMNUL\fR-terminated variable name
and an ordered list of \f(SMNUL\fR-terminated values.
The value list is terminated by one more
.SM NUL
character.
The ordering used is defined by the
.B strcmp ()
function.

Currently defined variables are:
.TP
\fBprune_bind_mounts\fR
A single entry, the value of \fbPRUNE_BIND_MOUNTS\fR; one of the strings
.B 0
or \fB1\fR.

.TP
\fBprunefs\fR
The value of \fBPRUNEFS\fR, each entry is converted to uppercase.

.TP
\fBprunepaths\fR
The value of \fBPRUNEPATHS\fR.

.P
The rest of the file until
.SM EOF
describes directories and their contents.
Each directory starts with a header:
8 bytes for
.I directory time
(seconds) in big endian,
4 bytes for
.I directory time
(nanoseconds) in big endian (0 if unknown, less than 1,000,000,000),
4 bytes padding,
and a \f(SMNUL\fR-terminated path name of the the directory.
Directory contents, a sequence of
.I file entries
sorted by name, follow.

.I Directory time
is the maximum of
.B st_ctime
and
.B st_mtime
of the directory.
.BR updatedb (8)
uses the original data if the 
.I directory time
in the database and in the file system match exactly.
.I Directory time
equal to 0 always causes rescanning of the directory:
this is necessary to handle directories
which were being updated while building the database.

Each
.I file entry
starts with a single byte, marking its type:
.TP
\fB0\fR
A non-directory file.
Followed by a \f(SMNUL\fR-terminated file (not path) name.

.TP
\fB1\fR
A subdirectory.
Followed by a \f(SMNUL\fR-terminated file (not path) name.

.TP
\fB2\fR
Marks the end of the current directory.

.P
.BR locate(1)
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.

.SH AUTHOR
Miloslav Trmac <mitr@redhat.com>

.SH SEE ALSO
.BR locate (1),
.BR updatedb.conf (5),
.BR updatedb (8)