xref: /openbsd-src/usr.bin/rdistd/server.h (revision f59ead6eb5b76421d44dbbc2c0e7f44d9d348873)
1*f59ead6eSguenther /*	$OpenBSD: server.h,v 1.2 2015/01/21 04:08:37 guenther Exp $	*/
2e06ba677Sguenther 
3e06ba677Sguenther #ifndef __SERVER_H__
4e06ba677Sguenther #define __SERVER_H__
5e06ba677Sguenther /*
6e06ba677Sguenther  * Copyright (c) 1983 Regents of the University of California.
7e06ba677Sguenther  * All rights reserved.
8e06ba677Sguenther  *
9e06ba677Sguenther  * Redistribution and use in source and binary forms, with or without
10e06ba677Sguenther  * modification, are permitted provided that the following conditions
11e06ba677Sguenther  * are met:
12e06ba677Sguenther  * 1. Redistributions of source code must retain the above copyright
13e06ba677Sguenther  *    notice, this list of conditions and the following disclaimer.
14e06ba677Sguenther  * 2. Redistributions in binary form must reproduce the above copyright
15e06ba677Sguenther  *    notice, this list of conditions and the following disclaimer in the
16e06ba677Sguenther  *    documentation and/or other materials provided with the distribution.
17e06ba677Sguenther  * 3. Neither the name of the University nor the names of its contributors
18e06ba677Sguenther  *    may be used to endorse or promote products derived from this software
19e06ba677Sguenther  *    without specific prior written permission.
20e06ba677Sguenther  *
21e06ba677Sguenther  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22e06ba677Sguenther  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23e06ba677Sguenther  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24e06ba677Sguenther  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25e06ba677Sguenther  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26e06ba677Sguenther  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27e06ba677Sguenther  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28e06ba677Sguenther  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29e06ba677Sguenther  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30e06ba677Sguenther  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31e06ba677Sguenther  * SUCH DAMAGE.
32e06ba677Sguenther  */
33e06ba677Sguenther 
34e06ba677Sguenther /*
35e06ba677Sguenther  * $From: defs.h,v 1.6 2001/03/12 18:16:30 kim Exp $
36e06ba677Sguenther  * @(#)defs.h      5.2 (Berkeley) 3/20/86
37e06ba677Sguenther  */
38e06ba677Sguenther 
39e06ba677Sguenther #include <sys/stat.h>
40e06ba677Sguenther 
41e06ba677Sguenther #include "defs.h"
42e06ba677Sguenther 
43e06ba677Sguenther /*
44e06ba677Sguenther  * Suffix to use when saving files
45e06ba677Sguenther  */
46e06ba677Sguenther #ifndef SAVE_SUFFIX
47e06ba677Sguenther #define SAVE_SUFFIX	".OLD"
48e06ba677Sguenther #endif
49e06ba677Sguenther 
50e06ba677Sguenther 
51e06ba677Sguenther #define MEFLAG_READONLY			0x01
52e06ba677Sguenther #define MEFLAG_IGNORE			0x02
53e06ba677Sguenther #define MEFLAG_NFS			0x04
54e06ba677Sguenther 
55e06ba677Sguenther /*
56e06ba677Sguenther  * Our internal mount entry type
57e06ba677Sguenther  */
58e06ba677Sguenther typedef struct {
59e06ba677Sguenther 	char			       *me_path;	/* Mounted path */
60e06ba677Sguenther 	int				me_flags;	/* Mount flags */
61e06ba677Sguenther } mntent_t;
62e06ba677Sguenther 
63e06ba677Sguenther /*
64e06ba677Sguenther  * Internal mount information type
65e06ba677Sguenther  */
66e06ba677Sguenther struct mntinfo {
67e06ba677Sguenther 	mntent_t			*mi_mnt;
68*f59ead6eSguenther 	dev_t				mi_dev;
69e06ba677Sguenther 	struct mntinfo			*mi_nxt;
70e06ba677Sguenther };
71e06ba677Sguenther 
72e06ba677Sguenther /* filesys-os.c */
73e06ba677Sguenther int	        setmountent(void);
74e06ba677Sguenther mntent_t       *getmountent(void);
75e06ba677Sguenther mntent_t       *newmountent(const mntent_t *);
76e06ba677Sguenther void		endmountent(void);
77e06ba677Sguenther 
78e06ba677Sguenther /* filesys.c */
79e06ba677Sguenther char		*find_file(char *, struct stat *, int *);
80e06ba677Sguenther mntent_t	*findmnt(struct stat *, struct mntinfo *);
81e06ba677Sguenther int		isdupmnt(mntent_t *, struct mntinfo *);
82e06ba677Sguenther void		wakeup(int);
83e06ba677Sguenther struct mntinfo	*makemntinfo(struct mntinfo *);
84e06ba677Sguenther mntent_t	*getmntpt(char *, struct stat *, int *);
85e06ba677Sguenther int		is_nfs_mounted(char *, struct stat *, int *);
86e06ba677Sguenther int		is_ro_mounted(char *, struct stat *, int *);
87e06ba677Sguenther int		is_symlinked(char *, struct stat *, int *);
88e06ba677Sguenther int		getfilesysinfo(char *, int64_t *, int64_t *);
89e06ba677Sguenther 
90e06ba677Sguenther /* server.c */
91e06ba677Sguenther void		server(void);
92e06ba677Sguenther 
93e06ba677Sguenther #endif	/* __SERVER_H__ */
94