X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Ftaperscan.h;h=b57ec9a5eccb03a1eb4e540e57e9aa70527e652c;hb=d97071000e65ce0c52c9043046acdc1c125397b0;hp=39190fb56beeb18593587a5eaeb2d2bf040ec7b6;hpb=1194fb66aa28d9929c3f2bef3cc6c1c3f40a60a4;p=debian%2Famanda diff --git a/server-src/taperscan.h b/server-src/taperscan.h index 39190fb..b57ec9a 100644 --- a/server-src/taperscan.h +++ b/server-src/taperscan.h @@ -1,10 +1,9 @@ /* - * Copyright (c) 2005 Zmanda Inc. All Rights Reserved. + * Copyright (c) 2005-2008 Zmanda Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -15,18 +14,24 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120 - * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com + * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300 + * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com */ /* - * $Id: taperscan.h,v 1.1 2005/12/21 19:07:51 paddy_s Exp $ + * $Id: taperscan.h,v 1.3 2006/05/25 01:47:20 johnfranks Exp $ * * This contains the interface to the tape-scan algorithm implementation. * The interface is rather simple: Calling programs (taper, amcheck, * amtape) call the function below with a desired tape label, and get back * all the relevant label information, along with any other error messages. */ +#ifndef TAPERSCAN_H +#define TAPERSCAN_H + +#include + +typedef struct taper_scan_tracker_s taper_scan_tracker_t; /* taper_scan(): Scans the changer to find a tape to use. Reads the tape * label, or invents a new one if label_new_tapes is in use. @@ -34,6 +39,10 @@ * re-read, because there may not actually exist a label * on-tape (for WORM or newly-labeled media). * + * This function may be run multiple times consecutively with + * the same tracker; each run will return a different elegible + * tape. The + * * Inputs: wantlabel * Outputs: Returns: -1 if an error occured or no tape was found. * 1 if the most desirable tape was found. @@ -44,9 +53,30 @@ * timestamp: What the timestamp string on-tape was. May be "X". * error_message: Debugging output. * tapedev: What device to use from now on. + * tracker: Pointer to an allocated taper_scan_tracker_t, used for + * persistance between runs. * * All returned strings are newly-allocated. */ -int taper_scan P((char* wantlabel, - char** gotlabel, char** timestamp, char** error_message, - char **tapedev)); +typedef void (*TaperscanOutputFunctor)(void * data, char * msg); +typedef gboolean (*TaperscanProlongFunctor)(void *data); + +int taper_scan (char* wantlabel, + char** gotlabel, char** timestamp, + char **tapedev, + taper_scan_tracker_t* tracker, + TaperscanOutputFunctor output_functor, + void *output_data, + TaperscanProlongFunctor prolong_functor, + void *prolong_data + ); +void FILE_taperscan_output_callback(void *data, char *msg); +void CHAR_taperscan_output_callback(void *data, char *msg); + +/* Returns a newly allocated tracker object. */ +taper_scan_tracker_t* taper_scan_tracker_new(void); + +/* Frees a tracker object. */ +void taper_scan_tracker_free(taper_scan_tracker_t*); + +#endif /* !TAPERSCAN_H */