1 /*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)mtree.h 8.1 (Berkeley) 06/06/93 8 */ 9 10 #include <string.h> 11 #include <stdlib.h> 12 13 #define KEYDEFAULT \ 14 (F_GID | F_MODE | F_NLINK | F_SIZE | F_SLINK | F_TIME | F_UID) 15 16 #define MISMATCHEXIT 2 17 18 typedef struct _node { 19 struct _node *parent, *child; /* up, down */ 20 struct _node *prev, *next; /* left, right */ 21 off_t st_size; /* size */ 22 struct timespec st_mtimespec; /* last modification time */ 23 u_long cksum; /* check sum */ 24 char *slink; /* symbolic link reference */ 25 uid_t st_uid; /* uid */ 26 gid_t st_gid; /* gid */ 27 #define MBITS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) 28 mode_t st_mode; /* mode */ 29 nlink_t st_nlink; /* link count */ 30 31 #define F_CKSUM 0x0001 /* check sum */ 32 #define F_DONE 0x0002 /* directory done */ 33 #define F_GID 0x0004 /* gid */ 34 #define F_GNAME 0x0008 /* group name */ 35 #define F_IGN 0x0010 /* ignore */ 36 #define F_MAGIC 0x0020 /* name has magic chars */ 37 #define F_MODE 0x0040 /* mode */ 38 #define F_NLINK 0x0080 /* number of links */ 39 #define F_SIZE 0x0100 /* size */ 40 #define F_SLINK 0x0200 /* link count */ 41 #define F_TIME 0x0400 /* modification time */ 42 #define F_TYPE 0x0800 /* file type */ 43 #define F_UID 0x1000 /* uid */ 44 #define F_UNAME 0x2000 /* user name */ 45 #define F_VISIT 0x4000 /* file visited */ 46 u_short flags; /* items set */ 47 48 #define F_BLOCK 0x001 /* block special */ 49 #define F_CHAR 0x002 /* char special */ 50 #define F_DIR 0x004 /* directory */ 51 #define F_FIFO 0x008 /* fifo */ 52 #define F_FILE 0x010 /* regular file */ 53 #define F_LINK 0x020 /* symbolic link */ 54 #define F_SOCK 0x040 /* socket */ 55 u_char type; /* file type */ 56 57 char name[1]; /* file name (must be last) */ 58 } NODE; 59 60 #define RP(p) \ 61 ((p)->fts_path[0] == '.' && (p)->fts_path[1] == '/' ? \ 62 (p)->fts_path + 2 : (p)->fts_path) 63