12654012fSReza Sabdar /* 2*876b86efSReza Sabdar * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 32654012fSReza Sabdar */ 42654012fSReza Sabdar 52654012fSReza Sabdar /* 62654012fSReza Sabdar * BSD 3 Clause License 72654012fSReza Sabdar * 82654012fSReza Sabdar * Copyright (c) 2007, The Storage Networking Industry Association. 92654012fSReza Sabdar * 102654012fSReza Sabdar * Redistribution and use in source and binary forms, with or without 112654012fSReza Sabdar * modification, are permitted provided that the following conditions 122654012fSReza Sabdar * are met: 132654012fSReza Sabdar * - Redistributions of source code must retain the above copyright 142654012fSReza Sabdar * notice, this list of conditions and the following disclaimer. 152654012fSReza Sabdar * 162654012fSReza Sabdar * - Redistributions in binary form must reproduce the above copyright 172654012fSReza Sabdar * notice, this list of conditions and the following disclaimer in 182654012fSReza Sabdar * the documentation and/or other materials provided with the 192654012fSReza Sabdar * distribution. 202654012fSReza Sabdar * 212654012fSReza Sabdar * - Neither the name of The Storage Networking Industry Association (SNIA) 222654012fSReza Sabdar * nor the names of its contributors may be used to endorse or promote 232654012fSReza Sabdar * products derived from this software without specific prior written 242654012fSReza Sabdar * permission. 252654012fSReza Sabdar * 262654012fSReza Sabdar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 272654012fSReza Sabdar * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 282654012fSReza Sabdar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 292654012fSReza Sabdar * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 302654012fSReza Sabdar * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 312654012fSReza Sabdar * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 322654012fSReza Sabdar * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 332654012fSReza Sabdar * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 342654012fSReza Sabdar * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 352654012fSReza Sabdar * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 362654012fSReza Sabdar * POSSIBILITY OF SUCH DAMAGE. 372654012fSReza Sabdar */ 382654012fSReza Sabdar #ifndef _TLM_PROTO_H 392654012fSReza Sabdar #define _TLM_PROTO_H 402654012fSReza Sabdar 412654012fSReza Sabdar #include <tlm.h> 422654012fSReza Sabdar #include <tlm_buffers.h> 432654012fSReza Sabdar #include <ndmpd_door.h> 442654012fSReza Sabdar #include <dirent.h> 452654012fSReza Sabdar #include <syslog.h> 462654012fSReza Sabdar #include <pthread.h> 472654012fSReza Sabdar 482654012fSReza Sabdar #define SCSI_CHANGER_DIR "/dev/scsi/changer" 492654012fSReza Sabdar #define SCSI_TAPE_DIR "/dev/rmt" 502654012fSReza Sabdar 512654012fSReza Sabdar #define MAXIORETRY 20 522654012fSReza Sabdar 532654012fSReza Sabdar typedef void log_func_t(ulong_t, char *, ...); 542654012fSReza Sabdar typedef void * (*funct_t)(void *); /* function pointer */ 552654012fSReza Sabdar 562654012fSReza Sabdar extern longlong_t llmin(longlong_t, longlong_t); 572654012fSReza Sabdar extern unsigned int min(unsigned int, unsigned int); 582654012fSReza Sabdar extern unsigned int max(unsigned int, unsigned int); 592654012fSReza Sabdar extern int oct_atoi(char *p); 602654012fSReza Sabdar 612654012fSReza Sabdar extern int tlm_log_fhnode(tlm_job_stats_t *, 622654012fSReza Sabdar char *, 632654012fSReza Sabdar char *, 642654012fSReza Sabdar struct stat64 *, 652654012fSReza Sabdar u_longlong_t); 662654012fSReza Sabdar 672654012fSReza Sabdar extern int tlm_log_fhdir(tlm_job_stats_t *, 682654012fSReza Sabdar char *, 692654012fSReza Sabdar struct stat64 *, 702654012fSReza Sabdar struct fs_fhandle *); 712654012fSReza Sabdar 722654012fSReza Sabdar extern int tlm_log_fhpath_name(tlm_job_stats_t *, 732654012fSReza Sabdar char *, 742654012fSReza Sabdar struct stat64 *, 752654012fSReza Sabdar u_longlong_t); 762654012fSReza Sabdar 772654012fSReza Sabdar extern boolean_t tlm_is_too_long(int, 782654012fSReza Sabdar char *, 792654012fSReza Sabdar char *); 802654012fSReza Sabdar 812654012fSReza Sabdar extern void tlm_log_list(char *, 822654012fSReza Sabdar char **); 832654012fSReza Sabdar extern tlm_drive_t *tlm_drive(int, int); 842654012fSReza Sabdar extern tlm_library_t *tlm_library(int); 852654012fSReza Sabdar extern tlm_slot_t *tlm_slot(int, int); 862654012fSReza Sabdar 872654012fSReza Sabdar extern sasd_drive_t *sasd_slink_drive(scsi_link_t *); 882654012fSReza Sabdar extern scsi_link_t *sasd_dev_slink(int); 892654012fSReza Sabdar extern sasd_drive_t *sasd_drive(int); 902654012fSReza Sabdar extern scsi_adapter_t *scsi_get_adapter(int); 912654012fSReza Sabdar extern int scsi_get_adapter_count(void); 922654012fSReza Sabdar 932654012fSReza Sabdar extern char *sasd_slink_name(scsi_link_t *); 942654012fSReza Sabdar extern int sasd_dev_count(void); 952654012fSReza Sabdar extern int tlm_ioctl(int, int, void *); 962654012fSReza Sabdar extern int probe_scsi(); 972654012fSReza Sabdar 982654012fSReza Sabdar extern void tlm_enable_barcode(int); 992654012fSReza Sabdar extern int tlm_insert_new_library(scsi_link_t *); 1002654012fSReza Sabdar extern int tlm_insert_new_drive(int); 1012654012fSReza Sabdar extern int tlm_insert_new_slot(int); 1022654012fSReza Sabdar 1032654012fSReza Sabdar extern char *tlm_get_tape_name(int, int); 1042654012fSReza Sabdar extern int tlm_library_count(void); 1052654012fSReza Sabdar 1062654012fSReza Sabdar extern boolean_t fs_is_rdonly(char *); 1072654012fSReza Sabdar extern boolean_t fs_is_chkpntvol(); 1082654012fSReza Sabdar extern int get_zfsvolname(char *, int, char *); 1092654012fSReza Sabdar extern int chkpnt_creationtime_bypattern(); 1102654012fSReza Sabdar 1112654012fSReza Sabdar extern log_func_t log_debug; 1122654012fSReza Sabdar extern log_func_t log_error; 1132654012fSReza Sabdar extern boolean_t match(char *, char *); 1142654012fSReza Sabdar 1152654012fSReza Sabdar extern void tlm_build_header_checksum(tlm_tar_hdr_t *); 1162654012fSReza Sabdar extern int tlm_vfy_tar_checksum(tlm_tar_hdr_t *); 1172654012fSReza Sabdar extern int tlm_entry_restored(tlm_job_stats_t *, char *, int); 1182654012fSReza Sabdar extern char *strupr(char *); 1192654012fSReza Sabdar extern char *parse(char **, char *); 120b6b15642SReza Sabdar extern int sysattr_rdonly(char *); 121b6b15642SReza Sabdar extern int sysattr_rw(char *); 1222654012fSReza Sabdar 1232654012fSReza Sabdar extern int tar_putfile(char *, 1242654012fSReza Sabdar char *, 1252654012fSReza Sabdar char *, 1262654012fSReza Sabdar tlm_acls_t *, 1272654012fSReza Sabdar tlm_commands_t *, 1282654012fSReza Sabdar tlm_cmd_t *, 1292654012fSReza Sabdar tlm_job_stats_t *, 1302654012fSReza Sabdar struct hardlink_q *); 1312654012fSReza Sabdar 1322654012fSReza Sabdar extern int tar_putdir(char *, 1332654012fSReza Sabdar tlm_acls_t *, 1342654012fSReza Sabdar tlm_cmd_t *, 1352654012fSReza Sabdar tlm_job_stats_t *); 1362654012fSReza Sabdar 1372654012fSReza Sabdar extern int tar_getfile(tlm_backup_restore_arg_t *); 1382654012fSReza Sabdar 1392654012fSReza Sabdar extern int 1402654012fSReza Sabdar tar_getdir(tlm_commands_t *, 1412654012fSReza Sabdar tlm_cmd_t *, 1422654012fSReza Sabdar tlm_job_stats_t *, 1432654012fSReza Sabdar struct rs_name_maker *, 1442654012fSReza Sabdar int, 1452654012fSReza Sabdar int, 1462654012fSReza Sabdar char **, 1472654012fSReza Sabdar char **, 1482654012fSReza Sabdar int, 1492654012fSReza Sabdar int, 150fb4eb4e8SReza Sabdar char *, 1512654012fSReza Sabdar struct hardlink_q *); 1522654012fSReza Sabdar #endif /* _TLM_PROTO_H */ 153