Loading...
Searching...
No Matches
XrdMapCluster.cc File Reference
`#include <cerrno>`
`#include <getopt.h>`
`#include <cstdlib>`
`#include <cstdio>`
`#include <cstring>`
`#include <strings.h>`
`#include <unistd.h>`
`#include <sys/param.h>`
`#include <sys/types.h>`
`#include "XProtocol/XProtocol.hh"`
`#include "XrdCl/XrdClEnv.hh"`
`#include "XrdCl/XrdClFileSystem.hh"`
`#include "XrdCl/XrdClDefaultEnv.hh"`
`#include "XrdNet/XrdNetAddr.hh"`
`#include "XrdOuc/XrdOucHash.hh"`
`#include "XrdSys/XrdSysHeaders.hh"`
Include dependency graph for XrdMapCluster.cc:

Go to the source code of this file.

## Macros

#define | EMSG(x)
#define | OPT_TYPE

## Functions

int | main (int argc, char *argv[])

## Variables

int | optind
int | optopt

## Macro Definition Documentation

## EMSG

#define EMSG | ( |  | x | ) |

Value:
std::cerr <<"xrdmapc: " <<x <<std::endl

Definition at line 63 of file XrdMapCluster.cc.

Referenced by main().

## OPT_TYPE

#define OPT_TYPE

Definition at line 70 of file XrdMapCluster.cc.

## Function Documentation

## main()

int main | ( | int | argc,
|  | char * | argv[] )

Definition at line 475 of file XrdMapCluster.cc.

{
const char *opLetters = ":hl:rv";
struct option opVec[] = // For getopt_long()
{
{OPT_TYPE "help", 0, 0, (int)'h'},
{OPT_TYPE "list", 1, 0, (int)'l'},
{OPT_TYPE "quiet", 0, 0, (int)'q'},
{OPT_TYPE "refresh", 0, 0, (int)'r'},
{OPT_TYPE "verify", 0, 0, (int)'v'},
{0, 0, 0, 0}
};
extern int optind, opterr;
extern char *optarg;
XrdNetAddr sPoint;
clMap *baseNode, *clNow;
const char *eMsg;
char opC;
int i;
bool doRefresh = false;
// Process options
//
opterr = 0;
optind = 1;
while((opC = getopt_long(argc, argv, opLetters, opVec, &i)) != (char)-1)
switch(opC)
{case 'h': Usage(0);
break;
case 'l': if (!strcmp("all",optarg))
{listMan = true; listSrv = true;}
else if (!strcmp("m", optarg))
{listMan = true; listSrv = false;}
else if (!strcmp("s", optarg))
{listMan = false; listSrv = true;}
else Usage("Invalid list argument.");
break;
case 'q': doHush = true;
break;
case 'r': doRefresh = true;
break;
case 'v': doVerify = true;
break;
case ':': EMSG("'" <<OpName(argv) <<"' argument missing.");
exit(2); break;
case '?': EMSG("Invalid option, '" <<OpName(argv) <<"'.");
exit(2); break;
default: EMSG("Internal error processing '" <<OpName(argv) <<"'.");
exit(2); break;
}
// Make sure we have a starting point
//
if (optind >= argc) Usage("Initial node not specified.");
// Establish starting point
//
if ((eMsg = sPoint.Set(argv[optind])))
{EMSG("Unable to validate initial node; " <<eMsg);
exit(2);
}
// Make sure it's resolvable
//
if (!sPoint.Name(0, &eMsg))
{EMSG("Unable to resolve " <<argv[optind] <<"; " <<eMsg);
exit(2);
}
// Establish the base node
//
baseNode = new clMap(argv[optind]);
// Check if we will be checking a path
//
if (optind+1 < argc) Path = argv[optind+1];
else doVerify = false;
// Set default client values
//
SetEnv();
// Map the cluster
//
MapCluster(baseNode, baseNode);
// Check if we need to do a locate on a file and possibly verify results
//
if (Path)
{MapPath(baseNode, Path, doRefresh);
eMsg = (doVerify ? "0*rv* " : "0*r** ");
} else eMsg = "0**** ";
// Print the first line
//
std::cout <<eMsg <<baseNode->name <<baseNode->state <<std::endl;
PrintMap(baseNode, 1);
// Check if we have any phantom nodes
//
if (Path && clLost)
{std::cerr <<"Warning! " <<baseNode->name
<<" referred to the following unconnected node:" <<std::endl;
clNow = clLost;
while(clNow)
{std::cerr <<"????? " <<clNow->name <<std::endl;
clNow = clNow->nextSrv;
}
}
// All done
//
exit(0);
}
Usage
void Usage(const char *msg)
Definition XrdAccTest.cc:105
OPT_TYPE
#define OPT_TYPE
Definition XrdCpConfig.cc:68
optind
int optind
EMSG
#define EMSG(x)
Definition XrdMapCluster.cc:63
Path
XrdOucString Path
Definition XrdSecpwdSrvAdmin.cc:160
eMsg
#define eMsg(x)
Definition XrdSecsssAdmin.cc:53
XrdNetAddrInfo::Name
const char * Name(const char *eName=0, const char **eText=0)
Definition XrdNetAddrInfo.cc:309
XrdNetAddr
Definition XrdNetAddr.hh:42
XrdNetAddr::Set
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition XrdNetAddr.cc:216

References EMSG, eMsg, XrdNetAddrInfo::Name(), OPT_TYPE, optind, Path, XrdNetAddr::Set(), and Usage().

Here is the call graph for this function:

## Variable Documentation

## optind

int optind

extern

Referenced by XrdCl::ReplayArgs::ReplayArgs(), XrdCpConfig::Config(), XrdConfig::Configure(), XrdFrmConfig::Configure(), XrdCmsConfig::Configure1(), getargs(), main(), and main().

## optopt

int optopt

Definition at line 108 of file XrdMapCluster.cc.

Referenced by XrdConfig::Configure(), XrdFrmConfig::Configure(), XrdCmsConfig::Configure1(), main(), and main().