00001 /* 00002 * dsds.h 00003 * 00004 * Contains the definitions needed for the dsds_svc module. 00005 * 00006 */ 00007 #ifndef DSDS_INCL 00008 00009 #ifndef SOI_VERSION_INCL 00010 #include <soi_version.h> 00011 #endif 00012 00013 #include <soi_key.h> 00014 #include <sum_rpc.h> 00015 00016 #define DSDS_VERSION_NUM (0.8) 00017 00018 #define DSDSMASTER "sonar.Stanford.EDU" /* location of global dsds/ampex_svc */ 00019 00020 // #define MAX_PART 64 /* max # +1 of dedicated DSDS partitions */ 00021 00022 #define NUM_GROUPS 256 00023 00024 #define MAX_RETRIEVE 196 /* max # of simultaneous lago/ampex_svc retrievals */ 00025 00026 00027 /* Note: Do NOT change the following. They are in the database */ 00028 #define DARW 1 /* data allocate assigned as read/write */ 00029 #define DADP 2 /* data allocate deletion pending when effective date */ 00030 #define DAAP 4 /* data allocate archive pending */ 00031 #define DARO 8 /* data request assigned as read only */ 00032 #define DAPERM 16 /* data allocate is permanent */ 00033 #define DASAP 32 /* data allocate safe archive pending */ 00034 /* Here are sub-statuses for DAAP */ 00035 #define DAAEDDP 32 /* don't archive and when effective date mark DADP */ 00036 #define DAAPERM 64 /* archive then mark DAPERM */ 00037 #define DAADP 128 /* archive then mark DADP when effective date */ 00038 /* Here are sub-statuses for DADP */ 00039 #define DADMVA 256 /* active ds move, don't delete wd */ 00040 #define DADMVC 512 /* ds has been moved, don't mark offline when rm wd */ 00041 00042 /* Pe/uid assignment table. One of these is put onto the peuid_hdr pointer 00043 * each time a pe registers (opens) with dsds_svc, and removed when pe 00044 * deregisters (closes). 00045 */ 00046 //now in sum_rpc.h 00047 //struct peuid { 00048 // struct peuid *next; 00049 // long uid; 00050 // int petid; 00051 //}; 00052 //typedef struct peuid PEUID; 00053 00054 /* Partition assignment table. For working directory assignments made 00055 * by dsds_svc, there will be a number of these tables linked onto one of 00056 * the pahdr_xx pointers. 00057 */ 00058 //now in sum_rpc.h 00059 //struct padata { 00060 // struct padata *next; 00061 // char *wd; 00062 // char *effective_date; 00063 // long uid; 00064 // double bytes; 00065 // int status; 00066 // int archsub; /* archive pend substatuses */ 00067 // int group_id; /* for grouping in tape archives */ 00068 // int safe_id; /* for grouping in safe tape archives */ 00069 // unsigned long ds_index; 00070 //}; 00071 //typedef struct padata PADATA; 00072 00073 /* Partition definition table. One for each dedicated DSDS partition. 00074 * Initialized by dsds_svc from the partn_avail data base table. */ 00075 //struct partition { 00076 // char *name; /* name of the partition */ 00077 // double bytes_total; /* total number of bytes of the partition */ 00078 // double bytes_left; /* bytes unassigned */ 00079 // double bytes_alloc; /* bytes allocated by DS_Allocate() */ 00080 // int pds_set_num; /* which /PDS set the partition belongs to */ 00081 //}; 00082 //typedef struct partition PART; 00083 00084 /* This is a linked list of keylist pointers and their status. 00085 * Saves the keylist here and the status returned by a query 00086 * to DS_DataRequest() for each dataset passed to DataRequestAll() for a pe. 00087 */ 00088 struct key_link { 00089 struct key_link *next; 00090 int status; 00091 KEY *list; 00092 }; 00093 typedef struct key_link KEY_LINK; 00094 00095 /* Used by DataRequestAll() for tape retrieval for a pe. 00096 * An array of these end up sorted by increasing tapeid and filenum. 00097 */ 00098 struct tapesort { 00099 int tapeid; 00100 int filenum; 00101 int status; 00102 KEY *list; 00103 }; 00104 typedef struct tapesort TAPESORT; 00105 00106 /* An array of these for all the pe's that have an active retrieval request 00107 * with DataRequestAll(). 00108 */ 00109 struct pe_active { 00110 long dsds_uid; /* unique id for each pe. 0 if free */ 00111 int retnum; /* # of retrievals to do */ 00112 int retcurrent; /* current retrieval # (0 to retnum-1) */ 00113 KEY *origlist; /* original keylist to DataRequestAll */ 00114 TAPESORT *tapeptr; /* the sorted tape list for ampex retrieval */ 00115 KEY_LINK *keylink; /* start of the key_link chain for this pe */ 00116 }; 00117 typedef struct pe_active PE_ACTIVE; 00118 00119 00120 //typedef struct tape { 00121 // struct tape *next; 00122 // int barcode; /* lago barcode is barcode number on Exabyte tape 00123 // * ampex barcode is combination of barcode on 00124 // * ampex cartridge and tape partition number 00125 // */ 00126 // int lastfn; /* file number of the last successfully written 00127 // * file on the tape 00128 // */ 00129 // int group_id; /* integer between 0 and NUM_GROUPS which defines 00130 // * which datasets can be archived on this tape 00131 // */ 00132 // long availblocks;/* number of available blocks remaining on the tape 00133 // */ 00134 //} TAPE; 00135 00136 /* Defines each /PDS set. 00137 * Initialized by src/libpe.d/pds_set_def.c. 00138 */ 00139 struct pds_set_def { 00140 char *host_name; /* host that has the /PDS local */ 00141 char *first_parti; /* 1st partition in the set, e.g. "/PDS0" */ 00142 char *last_parti; /* last partition in the set, e.g. "/PDS19" */ 00143 int pds_set_num; /* unique number for the entire set */ 00144 }; 00145 typedef struct pds_set_def PDS_SET_DEF; 00146 00147 #ifdef __sgi 00148 /* Pthread variables for thread syncronization in dsds_svc */ 00149 typedef struct p_struct_tag { 00150 pthread_mutex_t mutex; 00151 pthread_cond_t cond; 00152 KEY *list; 00153 int req_num; 00154 int callertid; 00155 } P_STRUCT_T; 00156 #endif 00157 00158 00159 00160 00161 /* utilities for handling archive group id's */ 00162 extern int is_arch (int gpid); 00163 extern int is_safe (int gpid); 00164 extern int is_export (int gpid); 00165 extern int get_gpid(char *prog, char *level, char *series); 00166 extern int get_safe_gpid(char *prog, char *level, char *series); 00167 extern int get_rgpid(char *prog, char *level, char *series); 00168 extern char *get_export_site (int xgpid); 00169 00170 /* utilities for handling DataRequestAll() for REQREQALL call */ 00171 extern void ret_key_all(KEY_LINK *link, TAPESORT *tapeptr, KEY **retlist, int num); 00172 extern TAPESORT *sort_tapes(KEY_LINK **link, int num); 00173 extern int compare_tape(const void *a, const void *b); 00174 extern int ret_key_link(KEY_LINK *link, KEY **retlist); 00175 extern struct RETTAB *get_rettab(KEY *list, int *status); 00176 extern int read_ds(struct RETTAB *ptab); 00177 extern KEY *read_ds_ack(struct RETTAB *ptab, int *stat); 00178 extern int startret(struct RETTAB *pret, KEY *list, PE_ACTIVE *peaptr); 00179 extern int retrieve_open_lago(struct RETTAB *pret, int tapeid, int reqnum); 00180 extern void log_key_link(KEY_LINK *link); 00181 extern void free_all(PE_ACTIVE *peaptr); 00182 extern void free_tapeptr(TAPESORT *tapeptr, int num); 00183 extern void reqreqstat(int offflg, int (*log)(char *fmt, ...)); 00184 00185 #ifdef PVM33 /* for pvm version 3.3 and above */ 00186 #define hostinfo pvmhostinfo 00187 #define taskinfo pvmtaskinfo 00188 #define pvm_serror(x) pvm_setopt(PvmAutoErr,x) 00189 #endif /* PVM33 */ 00190 00191 #define DSDS_INCL 00192 #endif 00193 /* 00194 * Revision History 00195 * v0.3 93.08.09 ja change from Mb to bytes of storage 00196 * v0.2 93.08.04 ja 00197 * v0.1 93.07.26 ja 00198 * created original file 00199 * 00200 */ 00201 00202 /* 00203 $Id: dsds.h,v 1.2 2016/02/25 20:53:51 arta Exp $ 00204 $Source: /home/cvsuser/cvsroot/JSOC/proj/jpe/apps/dsds.h,v $ 00205 $Author: arta $ 00206 */ 00207 /* $Log: dsds.h,v $ 00208 /* Revision 1.2 2016/02/25 20:53:51 arta 00209 /* Changes to jpe so that it works with sha.dsds dataseries. 00210 /* 00211 /* Revision 1.1 2009/04/24 21:50:28 production 00212 /* *** empty log message *** 00213 /* 00214 * Revision 1.34 2003/05/15 17:14:50 jim 00215 * change DSDSMASTER from tarax to sonar. Tarax has gone away. This may 00216 * not be entirely necessary as it's just used for spawning ampex in 00217 * local (-L) mode and tarax is now a sonar alias... 00218 * 00219 * Revision 1.33 2002/11/22 21:33:55 jim 00220 * add edate to DS_UpArchsub() 00221 * 00222 * Revision 1.32 2000/05/16 22:46:34 CM 00223 * add #ifdef __sgi 00224 * 00225 * Revision 1.31 2000/04/27 23:54:36 jim 00226 * add P_STRUCT_T 00227 * 00228 * Revision 1.30 2000/03/15 00:30:20 jim 00229 * add sub-statuses for DSDP and update protocols 00230 * 00231 * Revision 1.29 1999/09/07 18:46:15 jim 00232 * add struct pds_set_def and pds_set_num in struct partition 00233 * 00234 * Revision 1.28 1998/12/10 01:07:53 jim 00235 * add bytes_alloc to PART 00236 * 00237 * Revision 1.27 1998/08/03 22:08:14 kay 00238 * add get_rgpid, delete search_gpid, match 00239 * 00240 * Revision 1.26 1998/06/16 22:14:03 kehcheng 00241 * added PVM33 macros for pvm versions 3.3 and above 00242 * 00243 * Revision 1.25 1997/04/16 21:37:34 kehcheng 00244 * added #include <soi_version.h> 00245 * 00246 * Revision 1.24 1997/04/07 23:40:51 jim 00247 * add reqreqstat() 00248 * 00249 * Revision 1.23 1997/01/19 19:11:49 jim 00250 * adjust for REQREQALL 00251 * 00252 * Revision 1.22 1997/01/14 19:24:03 jim 00253 * update to support REQREQALL 00254 * 00255 * Revision 1.21 1996/09/24 23:16:36 kay 00256 * changed *Stat* and CatDelete to use ds_index instead of wd and uid 00257 * 00258 * Revision 1.20 1996/09/23 17:06:31 kay 00259 * added ds_index to PADATA, DS_PaUpdate, NC_PaUpdate 00260 * added functions NC_PaAdd, NC_PaDelete, NC_PaReplace 00261 * 00262 * Revision 1.19 1996/08/29 19:04:32 kay 00263 * added NC_PaRequest_AP 00264 * 00265 * Revision 1.18 1996/08/02 00:49:51 kay 00266 * added NC_ExportRequest 00267 * 00268 * Revision 1.17 1996/07/18 21:11:22 kay 00269 * added define for DASAP, added status and safe_id to struct padata 00270 * added gpid to arguments of *PaUpdate and NC_StatArchive 00271 * added new functions NC_PaRequest, NC_SafeID, and group id utilities 00272 * deleted externs for *PaUpdate_AP 00273 * 00274 * Revision 1.16 1996/06/13 21:00:50 jim 00275 * change history prototype 00276 * 00277 * Revision 1.15 1996/03/29 17:33:53 jim 00278 * change meaning of DAAEDDP 00279 * 00280 * Revision 1.14 1996/01/04 16:14:35 jayasree 00281 * added extern TAPE *NC_TapeByDate 00282 * 00283 * Revision 1.13 1995/12/28 17:31:47 kay 00284 * added next pointer to TAPE structure 00285 * 00286 * Revision 1.12 1995/12/01 19:53:25 jim 00287 * changed DSDSMASTER to tarax 00288 * 00289 * Revision 1.11 1995/11/07 16:53:39 jim 00290 * added DSDSMASTER 00291 * 00292 * Revision 1.10 1995/08/04 17:12:31 jim 00293 * changed MAX_PART from 32 to 64 00294 * 00295 * Revision 1.9 1995/06/19 15:56:09 jayasree 00296 * added group_id to tape structure. 00297 * 00298 * Revision 1.8 1995/04/20 23:00:34 jim 00299 * made all prototype bytes a double. 00300 * 00301 * Revision 1.7 1994/09/02 22:56:48 jim 00302 * put back lago.h include 00303 * 00304 * Revision 1.6 1994/09/02 22:53:36 jim 00305 * removed include <lago.h> 00306 * 00307 * Revision 1.5 1994/09/02 20:41:34 jim 00308 * add DS_ConnectDB and DS_DisConnectDB prototypes 00309 * 00310 * Revision 1.4 1994/08/30 23:10:01 jayasree 00311 * add eff_date and archsub to DS_PaUpdate 00312 * 00313 * Revision 1.3 1994/08/29 17:29:34 jayasree 00314 * removed dbname from DS_ functions prototyps. 00315 * 00316 * Revision 1.2 1994/08/29 17:12:39 jim 00317 * added effective date and archsub to padata 00318 * 00319 * Revision 1.1 1994/02/16 23:21:14 CM 00320 * Initial revision 00321 * */