XRootD
Loading...
Searching...
No Matches
XrdXrootdPrepare.hh
Go to the documentation of this file.
1#ifndef __XROOTD_PREPARE__H
2#define __XROOTD_PREPARE__H
3/******************************************************************************/
4/* */
5/* X r d X r o o t d P r e p a r e . h h */
6/* */
7/* (c) 2004 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/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33#include <dirent.h>
34#include <sys/types.h>
35
36#include "Xrd/XrdJob.hh"
37#include "Xrd/XrdScheduler.hh"
38#include "XrdSys/XrdSysError.hh"
39#include "XrdOuc/XrdOucTList.hh"
40
41/******************************************************************************/
42/* X r d O l b P r e p A r g s */
43/******************************************************************************/
44
46{
47public:
48friend class XrdXrootdPrepare;
49
50char *reqid;
51char *user;
52char *notify;
53int prty;
54char mode[4];
56
57 XrdXrootdPrepArgs(int sfree=1, int pfree=1)
58 {reqid = user = notify = 0; paths = 0; *mode = '\0';
59 dirP = 0; prty = reqlen = usrlen = 0;
60 freestore = sfree; freepaths = pfree;
61 }
63 {XrdOucTList *tp;
64 if (freestore)
65 {if (reqid) free(reqid);
66 if (notify) free(notify);
67 }
68 if (freepaths) while((tp=paths)) {paths=paths->next; delete tp;}
69 if (dirP) closedir(dirP);
70 }
71private:
72DIR *dirP;
73int reqlen;
74int usrlen;
75int freestore;
76int freepaths;
77};
78
79/******************************************************************************/
80/* C l a s s X r d O l b P r e p a r e */
81/******************************************************************************/
82
84{
85public:
86
87static int Close(int fd) {return close(fd);}
88
89 void DoIt() {Scrub();
90 SchedP->Schedule((XrdJob *)this, scrubtime+time(0));
91 }
92
93static int List(XrdXrootdPrepArgs &pargs, char *resp, int resplen);
94
95static void Log(XrdXrootdPrepArgs &pargs);
96
97static void Logdel(char *reqid);
98
99static int Open(const char *reqid, int &fsz);
100
101static void Scrub();
102
103static int setParms(int stime, int skeep);
104
105static int setParms(char *ldir);
106
107 XrdXrootdPrepare(XrdSysError *lp, XrdScheduler *sp, bool nomsg);
108 ~XrdXrootdPrepare() {} // Never gets deleted
109
110private:
111
112static const char *TraceID;
113static XrdScheduler *SchedP; // System scheduler
114static XrdSysError *eDest; // Error message handler
115
116static int scrubtime;
117static int scrubkeep;
118static char *LogDir;
119static int LogDirLen;
120};
121#endif
#define close(a)
Definition XrdPosix.hh:43
#define closedir(a)
Definition XrdPosix.hh:45
XrdOucTList * next
void Schedule(XrdJob *jp)
XrdXrootdPrepArgs(int sfree=1, int pfree=1)
static int List(XrdXrootdPrepArgs &pargs, char *resp, int resplen)
static void Log(XrdXrootdPrepArgs &pargs)
static void Logdel(char *reqid)
static int Close(int fd)
static int setParms(int stime, int skeep)
static int Open(const char *reqid, int &fsz)