Add example scripts to integrate metastore with git
[metastore.git] / metaentry.h
blob7ec9465cd136589bd146ddde683c93bcb99cb7be
1 /*
2 * Various functions to work with meta entries.
4 * Copyright (C) 2007 David Härdeman <david@hardeman.nu>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 /* Recurses opath and adds metadata entries to the metaentry list */
22 void mentries_recurse_path(const char *opath, struct metaentry **mlist);
24 /* Stores a metaentry list to a file */
25 void mentries_tofile(const struct metaentry *mlist, const char *path);
27 /* Creates a metaentry list from a file */
28 void mentries_fromfile(struct metaentry **mlist, const char *path);
30 /* Searches haystack for an xattr matching xattr number n in needle */
31 int mentry_find_xattr(struct metaentry *haystack,
32 struct metaentry *needle,
33 int n);
35 #define DIFF_NONE 0x00
36 #define DIFF_OWNER 0x01
37 #define DIFF_GROUP 0x02
38 #define DIFF_MODE 0x04
39 #define DIFF_TYPE 0x08
40 #define DIFF_MTIME 0x10
41 #define DIFF_XATTR 0x20
42 #define DIFF_ADDED 0x40
43 #define DIFF_DELE 0x80
45 /* Compares lists of real and stored metadata and calls pfunc for each */
46 void mentries_compare(struct metaentry *mlistreal,
47 struct metaentry *mliststored,
48 void (*pfunc)(struct metaentry *real,
49 struct metaentry *stored,
50 int cmp),
51 int do_mtime);