1 /*-
2  * Copyright (c) 2000-2005 MAEKAWA Masahide <maekawa@cvsync.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the author nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 #ifndef __DIRCMP_H__
31 #define	__DIRCMP_H__
32 
33 struct collection;
34 struct cvsync_attr;
35 struct mdirent;
36 struct mux;
37 struct scanfile_attr;
38 
39 #define	DIRCMP_START		0x80
40 #define	DIRCMP_END		0x81
41 
42 #define	DIRCMP_DOWN		0x00
43 #define	DIRCMP_UP		0x01
44 #define	DIRCMP_FILE		0x02
45 #define	DIRCMP_RCS		0x03
46 #define	DIRCMP_RCS_ATTIC	0x04
47 #define	DIRCMP_SYMLINK		0x05
48 
49 struct dircmp_args {
50 	struct mux		*dca_mux;
51 	const char		*dca_hostinfo;
52 	struct collection	*dca_collections, *dca_collection;
53 	uint32_t		dca_proto;
54 	pthread_t		dca_thread;
55 	void			*dca_status;
56 
57 	char			dca_name[CVSYNC_NAME_MAX + 1];
58 	char			dca_release[CVSYNC_NAME_MAX + 1];
59 
60 	char			dca_path[PATH_MAX + CVSYNC_NAME_MAX + 1];
61 	char			*dca_rpath;
62 	char			dca_symlink[PATH_MAX + CVSYNC_NAME_MAX + 1];
63 	size_t			dca_pathmax, dca_pathlen, dca_rpathlen;
64 	size_t			dca_namemax;
65 
66 	uint8_t			dca_tag, dca_cmd[CVSYNC_MAXCMDLEN];
67 	size_t			dca_cmdmax;
68 	struct cvsync_attr	dca_attr;
69 };
70 
71 struct dircmp_args *dircmp_init(struct mux *, const char *,
72 				struct collection *, uint32_t);
73 void dircmp_destroy(struct dircmp_args *);
74 void *dircmp(void *);
75 bool dircmp_start(struct dircmp_args *, const char *, const char *);
76 bool dircmp_end(struct dircmp_args *);
77 bool dircmp_access(struct dircmp_args *, void *);
78 bool dircmp_access_scanfile(struct dircmp_args *, struct scanfile_attr *);
79 
80 bool dircmp_rcs(struct dircmp_args *);
81 bool dircmp_rcs_scanfile(struct dircmp_args *);
82 
83 #endif /* __DIRCMP_H__ */
84