mtree.h revision 121300
141227Sjdp/*-
241227Sjdp * Copyright (c) 1990, 1993
341227Sjdp *	The Regents of the University of California.  All rights reserved.
4115470Sdes *
587398Sdes * Redistribution and use in source and binary forms, with or without
641227Sjdp * modification, are permitted provided that the following conditions
787398Sdes * are met:
887398Sdes * 1. Redistributions of source code must retain the above copyright
987398Sdes *    notice, this list of conditions and the following disclaimer.
1087398Sdes * 2. Redistributions in binary form must reproduce the above copyright
1187398Sdes *    notice, this list of conditions and the following disclaimer in the
1241227Sjdp *    documentation and/or other materials provided with the distribution.
1341227Sjdp * 3. Neither the name of the University nor the names of its contributors
1441227Sjdp *    may be used to endorse or promote products derived from this software
1541227Sjdp *    without specific prior written permission.
1641227Sjdp *
1741227Sjdp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1841227Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1941227Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2087398Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2187398Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2287398Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2341227Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2441227Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2541227Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2641227Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2741227Sjdp * SUCH DAMAGE.
2841227Sjdp *
2941227Sjdp *	@(#)mtree.h	8.1 (Berkeley) 6/6/93
3041227Sjdp * $FreeBSD: head/usr.sbin/mtree/mtree.h 121300 2003-10-21 08:27:05Z phk $
3141227Sjdp */
3241227Sjdp
3341227Sjdp#include <string.h>
3441227Sjdp#include <stdlib.h>
3541227Sjdp
3641227Sjdp#define	KEYDEFAULT \
3784218Sdillon	(F_GID | F_MODE | F_NLINK | F_SIZE | F_SLINK | F_TIME | F_UID | F_FLAGS)
3884218Sdillon
3984218Sdillon#define	MISMATCHEXIT	2
4041227Sjdp
4141227Sjdptypedef struct _node {
4241227Sjdp	struct _node	*parent, *child;	/* up, down */
4341227Sjdp	struct _node	*prev, *next;		/* left, right */
4441227Sjdp	off_t	st_size;			/* size */
4541227Sjdp	struct timespec	st_mtimespec;		/* last modification time */
4641227Sjdp	u_long	cksum;				/* check sum */
4741227Sjdp	char	*md5digest;			/* MD5 digest */
4841227Sjdp	char	*sha1digest;			/* SHA-1 digest */
4987398Sdes	char	*rmd160digest;			/* RIPEMD160 digest */
5090229Sdes	char	*slink;				/* symbolic link reference */
5141227Sjdp	uid_t	st_uid;				/* uid */
5290229Sdes	gid_t	st_gid;				/* gid */
5341227Sjdp#define	MBITS	(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
54115465Sdes	mode_t	st_mode;			/* mode */
55115465Sdes	u_long	st_flags;			/* flags */
56115465Sdes	nlink_t	st_nlink;			/* link count */
5741227Sjdp
5879476Smarkm#define	F_CKSUM	0x0001				/* check sum */
5993984Sdes#define	F_DONE	0x0002				/* directory done */
6079476Smarkm#define	F_GID	0x0004				/* gid */
6141227Sjdp#define	F_GNAME	0x0008				/* group name */
62106082Sdes#define	F_IGN	0x0010				/* ignore */
6341227Sjdp#define	F_MAGIC	0x0020				/* name has magic chars */
6441227Sjdp#define	F_MODE	0x0040				/* mode */
6541227Sjdp#define	F_NLINK	0x0080				/* number of links */
6641227Sjdp#define	F_SIZE	0x0100				/* size */
6741227Sjdp#define	F_SLINK	0x0200				/* link count */
6841227Sjdp#define	F_TIME	0x0400				/* modification time */
6941227Sjdp#define	F_TYPE	0x0800				/* file type */
7041227Sjdp#define	F_UID	0x1000				/* uid */
7141227Sjdp#define	F_UNAME	0x2000				/* user name */
7241227Sjdp#define	F_VISIT	0x4000				/* file visited */
73106082Sdes#define F_MD5	0x8000				/* MD5 digest */
7441227Sjdp#define F_NOCHANGE 0x10000			/* If owner/mode "wrong", do */
7541227Sjdp						/* not change */
7641227Sjdp#define	F_SHA1	0x20000				/* SHA-1 digest */
7741227Sjdp#define	F_RMD160 0x40000			/* RIPEMD160 digest */
7841227Sjdp#define	F_FLAGS	0x80000				/* file flags */
7994564Sdes	u_int	flags;				/* items set */
8041227Sjdp
81106082Sdes#define	F_BLOCK	0x001				/* block special */
82106082Sdes#define	F_CHAR	0x002				/* char special */
8341227Sjdp#define	F_DIR	0x004				/* directory */
8441227Sjdp#define	F_FIFO	0x008				/* fifo */
8541227Sjdp#define	F_FILE	0x010				/* regular file */
8641227Sjdp#define	F_LINK	0x020				/* symbolic link */
87106082Sdes#define	F_SOCK	0x040				/* socket */
88106082Sdes	u_char	type;				/* file type */
8941227Sjdp
9094564Sdes	char	name[1];			/* file name (must be last) */
9141227Sjdp} NODE;
9241227Sjdp
9341227Sjdp#define	RP(p)	\
9441227Sjdp	((p)->fts_path[0] == '.' && (p)->fts_path[1] == '/' ? \
9594564Sdes	    (p)->fts_path + 2 : (p)->fts_path)
9641227Sjdp