1 /* 2 * Copyright (c) 1998,1999,2000 3 * Traakan, Inc., Los Altos, CA 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice unmodified, this list of conditions, and the following 11 * disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 /* 30 * Project: NDMJOB 31 * Ident: $Id: $ 32 * 33 * Description: 34 * 35 */ 36 37 38 #include "ndmagents.h" 39 40 41 42 #ifndef GLOBAL 43 #define GLOBAL extern 44 #endif 45 46 GLOBAL char * progname; 47 48 GLOBAL struct ndm_session the_session; 49 GLOBAL struct ndm_session_param the_param; 50 51 GLOBAL int the_mode; 52 GLOBAL int d_debug; 53 GLOBAL char * L_log_file; 54 GLOBAL int n_noop; 55 GLOBAL int v_verbose; 56 GLOBAL int o_no_time_stamps; 57 GLOBAL char * o_config_file; 58 GLOBAL char * o_tape_tcp; 59 GLOBAL char * o_load_files_file; 60 61 extern void error_byebye (char *fmt, ...); 62 63 extern struct ndmp_enum_str_table mode_long_name_table[]; 64 65 extern int process_args (int argc, char *argv[]); 66 extern int handle_long_option (char *str); 67 extern void set_job_mode (int mode); 68 extern void usage (void); 69 extern void help (void); 70 extern void ndmjob_version_info (void); 71 extern void dump_settings (void); 72 73 extern int copy_args_expanding_macros (int argc, char *argv[], 74 char *av[], int max_ac); 75 extern int lookup_and_snarf (char *av[], char *name); 76 extern int snarf_macro (char *av[], char *val); 77 78 extern void ndmjob_log_deliver(struct ndmlog *log, char *tag, 79 int lev, char *msg); 80 81 extern void ndmjob_log (int level, char *fmt, ...); 82 83 84 #ifndef NDMOS_OPTION_NO_CONTROL_AGENT 85 86 #define MAX_EXCLUDE_PATTERN 100 87 #define MAX_FILE_ARG NDM_MAX_NLIST 88 89 GLOBAL char * B_bu_type; 90 GLOBAL int b_bsize; 91 GLOBAL char * C_chdir; 92 GLOBAL struct ndmagent D_data_agent; 93 GLOBAL ndmp9_pval E_environment[NDM_MAX_ENV]; 94 GLOBAL int n_E_environment; 95 GLOBAL int nn_E_environment; 96 GLOBAL char * e_exclude_pattern[MAX_EXCLUDE_PATTERN]; 97 GLOBAL int n_e_exclude_pattern; 98 GLOBAL char * f_tape_device; 99 GLOBAL char * I_index_file; /* output */ 100 GLOBAL char * J_index_file; /* input */ 101 GLOBAL struct ndmmedia m_media[NDM_MAX_MEDIA]; 102 GLOBAL int n_m_media; 103 GLOBAL struct ndmagent R_robot_agent; 104 GLOBAL struct ndmscsi_target r_robot_target; 105 GLOBAL struct ndmagent T_tape_agent; 106 GLOBAL char * U_user; 107 108 GLOBAL int o_time_limit; 109 GLOBAL int o_swap_connect; 110 GLOBAL int o_use_eject; 111 GLOBAL int o_tape_addr; 112 GLOBAL int o_from_addr; 113 GLOBAL int o_to_addr; 114 GLOBAL struct ndmscsi_target o_tape_scsi; 115 GLOBAL int o_tape_timeout; 116 GLOBAL int o_robot_timeout; 117 GLOBAL char * o_rules; 118 GLOBAL off_t o_tape_limit; 119 GLOBAL int p_ndmp_port; 120 121 GLOBAL char * file_arg[MAX_FILE_ARG]; 122 GLOBAL char * file_arg_new[MAX_FILE_ARG]; 123 GLOBAL int n_file_arg; 124 125 /* The ji_ variables are set according to the -J input index */ 126 GLOBAL struct ndmmedia ji_media[NDM_MAX_MEDIA]; 127 GLOBAL int n_ji_media; 128 GLOBAL ndmp9_pval ji_environment[NDM_MAX_ENV]; 129 GLOBAL int n_ji_environment; 130 131 GLOBAL ndmp9_name nlist[MAX_FILE_ARG]; /* parallels file_arg[] */ 132 GLOBAL ndmp9_name nlist_new[MAX_FILE_ARG];/* parallels file_arg[] */ 133 134 GLOBAL FILE * index_fp; 135 136 GLOBAL struct ndm_job_param the_job; 137 138 #define AGENT_GIVEN(AGENT) (AGENT.conn_type != NDMCONN_TYPE_NONE) 139 #define ROBOT_GIVEN() (r_robot_target.dev_name[0] != 0) 140 141 extern void ndmjob_ixlog_deliver(struct ndmlog *log, char *tag, 142 int lev, char *msg); 143 144 #endif /* !NDMOS_OPTION_NO_CONTROL_AGENT */ 145 146 147 148 149 150 151 152 #ifndef NDMOS_OPTION_NO_CONTROL_AGENT 153 extern int start_index_file (void); 154 extern int sort_index_file (void); 155 extern int build_job (void); 156 extern int args_to_job (void); 157 extern int args_to_job_backup_env (void); 158 extern int args_to_job_recover_env (void); 159 extern int args_to_job_recover_nlist (void); 160 extern int jndex_doit (void); 161 extern int jndex_tattle (void); 162 extern int jndex_merge_media (void); 163 extern int jndex_audit_not_found (void); 164 extern int jndex_merge_environment (void); 165 extern int jndex_fetch_post_backup_data_env (FILE *fp); 166 extern int jndex_fetch_post_backup_media (FILE *fp); 167 168 extern int apply_rules (struct ndm_job_param *job, char *rules); 169 extern int help_rules (void); 170 #endif /* !NDMOS_OPTION_NO_CONTROL_AGENT */ 171