add UNLEASHED_OBJ to unleashed.mk
[unleashed/tickless.git] / usr / src / cmd / ndmpd / tlm / tlm_proto.h
blobf37f206e6e1e1e06916e5b5d70cf4f9bb578ec68
1 /*
2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 */
5 /*
6 * BSD 3 Clause License
8 * Copyright (c) 2007, The Storage Networking Industry Association.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * - Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
16 * - Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
21 * - Neither the name of The Storage Networking Industry Association (SNIA)
22 * nor the names of its contributors may be used to endorse or promote
23 * products derived from this software without specific prior written
24 * permission.
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
38 #ifndef _TLM_PROTO_H
39 #define _TLM_PROTO_H
41 #include <tlm.h>
42 #include <tlm_buffers.h>
43 #include <ndmpd_door.h>
44 #include <dirent.h>
45 #include <syslog.h>
46 #include <pthread.h>
48 #define SCSI_CHANGER_DIR "/dev/scsi/changer"
49 #define SCSI_TAPE_DIR "/dev/rmt"
51 #define MAXIORETRY 20
53 typedef void log_func_t(ulong_t, char *, ...);
54 typedef void * (*funct_t)(void *); /* function pointer */
56 extern longlong_t llmin(longlong_t, longlong_t);
57 extern unsigned int min(unsigned int, unsigned int);
58 extern unsigned int max(unsigned int, unsigned int);
59 extern int oct_atoi(char *p);
61 extern int tlm_log_fhnode(tlm_job_stats_t *,
62 char *,
63 char *,
64 struct stat64 *,
65 u_longlong_t);
67 extern int tlm_log_fhdir(tlm_job_stats_t *,
68 char *,
69 struct stat64 *,
70 struct fs_fhandle *);
72 extern int tlm_log_fhpath_name(tlm_job_stats_t *,
73 char *,
74 struct stat64 *,
75 u_longlong_t);
77 extern boolean_t tlm_is_too_long(int,
78 char *,
79 char *);
81 extern void tlm_log_list(char *,
82 char **);
83 extern tlm_drive_t *tlm_drive(int, int);
84 extern tlm_library_t *tlm_library(int);
85 extern tlm_slot_t *tlm_slot(int, int);
87 extern sasd_drive_t *sasd_slink_drive(scsi_link_t *);
88 extern scsi_link_t *sasd_dev_slink(int);
89 extern sasd_drive_t *sasd_drive(int);
90 extern scsi_adapter_t *scsi_get_adapter(int);
91 extern int scsi_get_adapter_count(void);
93 extern char *sasd_slink_name(scsi_link_t *);
94 extern int sasd_dev_count(void);
95 extern int tlm_ioctl(int, int, void *);
96 extern int probe_scsi();
98 extern void tlm_enable_barcode(int);
99 extern int tlm_insert_new_library(scsi_link_t *);
100 extern int tlm_insert_new_drive(int);
101 extern int tlm_insert_new_slot(int);
103 extern char *tlm_get_tape_name(int, int);
104 extern int tlm_library_count(void);
106 extern boolean_t fs_is_rdonly(char *);
107 extern boolean_t fs_is_chkpntvol();
108 extern int get_zfsvolname(char *, int, char *);
109 extern int chkpnt_creationtime_bypattern();
111 extern log_func_t log_debug;
112 extern log_func_t log_error;
113 extern boolean_t match(char *, char *);
115 extern void tlm_build_header_checksum(tlm_tar_hdr_t *);
116 extern int tlm_vfy_tar_checksum(tlm_tar_hdr_t *);
117 extern int tlm_entry_restored(tlm_job_stats_t *, char *, int);
118 extern char *strupr(char *);
119 extern char *parse(char **, char *);
120 extern int sysattr_rdonly(char *);
121 extern int sysattr_rw(char *);
123 extern int tar_putfile(char *,
124 char *,
125 char *,
126 tlm_acls_t *,
127 tlm_commands_t *,
128 tlm_cmd_t *,
129 tlm_job_stats_t *,
130 struct hardlink_q *);
132 extern int tar_putdir(char *,
133 tlm_acls_t *,
134 tlm_cmd_t *,
135 tlm_job_stats_t *);
137 extern int tar_getfile(tlm_backup_restore_arg_t *);
139 extern int
140 tar_getdir(tlm_commands_t *,
141 tlm_cmd_t *,
142 tlm_job_stats_t *,
143 struct rs_name_maker *,
144 int,
145 int,
146 char **,
147 char **,
148 int,
149 int,
150 char *,
151 struct hardlink_q *);
152 #endif /* _TLM_PROTO_H */