xrootd
XrdFrcReqFile.hh
Go to the documentation of this file.
1 #ifndef __FRCREQFILE_H__
2 #define __FRCREQFILE_H__
3 /******************************************************************************/
4 /* */
5 /* X r d F r c R e q F i l e . h h */
6 /* */
7 /* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 #include "XrdFrc/XrdFrcRequest.hh"
14 #include "XrdSys/XrdSysPthread.hh"
15 
17 {
18 public:
19 
20  void Add(XrdFrcRequest *rP);
21 
22  void Can(XrdFrcRequest *rP);
23 
24  void Del(XrdFrcRequest *rP);
25 
26  int Get(XrdFrcRequest *rP);
27 
28  int Init();
29 
30  char *List(char *Buff, int bsz, int &Offs,
31  XrdFrcRequest::Item *ITList=0, int ITNum=0);
32 
33  void ListL(XrdFrcRequest &tmpReq, char *Buff, int bsz,
34  XrdFrcRequest::Item *ITList, int ITNum);
35 
36  XrdFrcReqFile(const char *fn, int aVal);
38 
39 private:
41 
42 static const int ReqSize = sizeof(XrdFrcRequest);
43 
44 void FailAdd(char *lfn, int unlk=1);
45 void FailCan(char *rid, int unlk=1);
46 void FailDel(char *lfn, int unlk=1);
47 int FailIni(const char *lfn);
48 int FileLock(LockType ltype=lkExcl);
49 int reqRead(void *Buff, int Offs);
50 int reqWrite(void *Buff, int Offs, int updthdr=1);
51 
52 struct FileHdr
53 {
54 int First;
55 int Last;
56 int Free;
57 } HdrData;
58 
59 char *lokFN;
60 int lokFD;
61 int reqFD;
62 char *reqFN;
63 
64 int isAgent;
65 
66 struct recEnt {recEnt *Next;
68  recEnt(XrdFrcRequest &reqref) {Next = 0; reqData = reqref;}
69  };
70 int ReWrite(recEnt *rP);
71 
72 class rqMonitor
73 {
74 public:
75  rqMonitor(int isAgent) : doUL(isAgent)
76  {if (isAgent) rqMutex.Lock();}
78 private:
80 int doUL;
81 };
82 };
83 #endif