2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 #ident "$Id: mkzftree.h,v 1.7 2006/07/04 04:57:42 hpa Exp $"
14 /* ----------------------------------------------------------------------- *
16 * Copyright 2001-2006 H. Peter Anvin - All Rights Reserved
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
21 * USA; either version 2 of the License, or (at your option) any later
22 * version; incorporated herein by reference.
24 * ----------------------------------------------------------------------- */
29 /* config.h should be included before any system headers!!!! */
36 #include <sys/types.h>
38 #ifdef HAVE_INTTYPES_H
45 #ifdef HAVE_SYSEXITS_H
48 #define EX_USAGE 64 /* command line usage error */
49 #define EX_DATAERR 65 /* data format error */
50 #define EX_NOINPUT 66 /* cannot open input */
51 #define EX_NOUSER 67 /* addressee unknown */
52 #define EX_NOHOST 68 /* host name unknown */
53 #define EX_UNAVAILABLE 69 /* service unavailable */
54 #define EX_SOFTWARE 70 /* internal software error */
55 #define EX_OSERR 71 /* system error (e.g., can't fork) */
56 #define EX_OSFILE 72 /* critical OS file missing */
57 #define EX_CANTCREAT 73 /* can't create (user) output file */
58 #define EX_IOERR 74 /* input/output error */
59 #define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
60 #define EX_PROTOCOL 76 /* remote error in protocol */
61 #define EX_NOPERM 77 /* permission denied */
62 #define EX_CONFIG 78 /* configuration error */
65 /* File transformation functions */
66 typedef int (*munger_func)(FILE *, FILE *, off_t);
67 int block_compress_file(FILE *, FILE *, off_t);
68 int block_uncompress_file(FILE *, FILE *, off_t);
71 extern const char *program; /* Program name */
72 enum verbosity { /* Message verbosity */
73 vl_quiet, /* No messages */
74 vl_error, /* Error messages only */
75 vl_filename, /* Display filenames */
76 vl_crib, /* Cribbing files */
78 #define default_verbosity vl_error
79 struct cmdline_options {
80 int force; /* Always compress */
81 int level; /* Compression level */
82 int parallel; /* Parallelism (0 = strictly serial) */
83 int onefs; /* One filesystem only */
84 int onedir; /* One directory only */
85 int do_mkdir; /* Create stub directories */
86 int file_root; /* The root may be a file */
87 int sloppy; /* Don't make sure metadata is set correctly */
88 enum verbosity verbosity; /* Message verbosity */
89 munger_func munger; /* Default action */
91 extern struct cmdline_options opt;
94 int munge_tree(const char *, const char *, const char *);
95 int munge_entry(const char *, const char *, const char *, const struct stat *);
98 void wait_for_all_workers(void);
99 int spawn_worker(void);
100 void end_worker(int);
103 void *xmalloc(size_t);
104 void *xrealloc(void *, size_t);
105 char *xstrdup(const char *);
106 void message(enum verbosity, const char *, ...);
109 const char *hash_find_file(struct stat *);
110 void hash_insert_file(struct stat *, const char *);
113 int copytime(const char *, const struct stat *);
115 #endif /* MKZFTREE_H */