Changeset 3590

Show
Ignore:
Timestamp:
11/01/2009 11:59:19 PM (3 weeks ago)
Author:
brian
Message:

Working version of TFC integration.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • XrdHdfs/XrdHdfs.cc

    r3589 r3590  
    115115// Open the directory and get it's id 
    116116// 
    117    TRACE(Opendir, "path " << dir_path); 
    118    if (!(dh = hdfsListDirectory(fs, dir_path, &numEntries))) { 
     117   TRACE(Opendir, "path " << fname); 
     118   if (!(dh = hdfsListDirectory(fs, fname, &numEntries))) { 
    119119      isopen = 0; 
    120120      if (errno == 0) 
     
    263263   } 
    264264 
     265   (XrdHdfsSS.eDest)->Say("File we will access: ", fname); 
     266 
    265267// Set the actual open mode 
    266268// 
     
    293295   int err_code = 0; 
    294296 
    295    if ((fh = hdfsOpenFile(fs, path, open_flag, 0, 0, 0)) == NULL) { 
     297   if ((fh = hdfsOpenFile(fs, fname, open_flag, 0, 0, 0)) == NULL) { 
    296298       err_code = errno; 
    297        hdfsFileInfo * fileInfo = hdfsGetPathInfo(fs, path); 
     299       hdfsFileInfo * fileInfo = hdfsGetPathInfo(fs, fname); 
    298300       if (fileInfo != NULL) { 
    299301           if (fileInfo->mKind == kObjectKindDirectory) { 
     
    302304           hdfsFreeFileInfo(fileInfo, 1); 
    303305       } else {  
    304            err_code = EEXIST; 
     306           err_code = ENOENT; 
    305307       } 
    306308   } 
     
    510512   eDest->logger(lp); 
    511513   eDest->Say("Copr. 2009, Brian Bockelman, Hdfs Version "); 
     514   eDest->Emsg("Config", "Copr. 2009, Brian Bockelman, Hdfs Version "); 
    512515 
    513516// Initialize the subsystems 
    514517// 
     518   N2N_Lib=NULL; 
     519   the_N2N=NULL; 
    515520   tmp = ((NoGo=Configure(configfn)) ? "failed." : "completed."); 
    516521   eDest->Say("------ HDFS storage system initialization ", tmp); 
     522   eDest->Emsg("HDFS storage system initialization.", tmp); 
    517523 
    518524// All done. 
  • XrdHdfs/XrdHdfs.hh

    r3589 r3590  
    179179char             *N2N_Parms; // -> Name2Name Object Parameters 
    180180XrdOucName2Name  *the_N2N;   // -> File mapper object 
     181const char       *ConfigFN;  // Pointer to the configuration filename 
     182XrdSysError      *eDest; 
    181183 
    182184XrdHdfsSys() : XrdOss() {} 
     
    186188 
    187189int    Configure(const char *); 
    188 int    ConfigN2N(XrdSysError &Eroute); 
    189 int    ConfigProc(XrdSysError &Eroute); 
    190 int    ConfigXeq(char *, XrdOucStream &, XrdSysError &); 
    191 int    xnml(XrdOucStream &Config, XrdSysError &Eroute); 
     190int    ConfigN2N(); 
     191int    ConfigProc(const char *); 
     192int    ConfigXeq(char *, XrdOucStream &); 
     193int    xnml(XrdOucStream &Config); 
    192194 
    193 static XrdSysError *eDest; 
    194195 
    195196}; 
  • XrdHdfs/XrdHdfsConfig.cc

    r3588 r3590  
    2020 
    2121#include "XrdVersion.hh" 
     22#include "XrdOuc/XrdOucEnv.hh" 
    2223#include "XrdSys/XrdSysError.hh" 
    2324#include "XrdSys/XrdSysHeaders.hh" 
     
    2728#include "XrdSec/XrdSecInterface.hh" 
    2829#include "XrdCmsTfc/XrdCmsTfc.hh" 
    29 #include "XrdOss/XrdOssTrace.hh" 
     30#include "XrdHdfs/XrdHdfs.hh" 
    3031 
    3132/******************************************************************************/ 
     
    3334/******************************************************************************/ 
    3435 
    35 #define TS_Xeq(x,m)    if (!strcmp(x,var)) return m(Config, Eroute); 
     36#define TS_Xeq(x,m)    if (!strcmp(x,var)) return m(Config); 
    3637 
    3738/******************************************************************************/ 
     
    5051   int NoGo = 0; 
    5152 
    52    N2N_Lib = ""
     53   N2N_Lib = NULL
    5354   the_N2N = NULL; 
     55 
     56   eDest->Emsg("Config", "Configuring HDFS."); 
    5457 
    5558// Process the configuration file 
     
    7174  int  cfgFD, retc, NoGo = 0; 
    7275  XrdOucEnv myEnv; 
    73   XrdOucStream Config(&eDest, getenv("XRDINSTANCE"), &myEnv, "=====> "); 
     76  XrdOucStream Config(eDest, getenv("XRDINSTANCE"), &myEnv, "=====> "); 
    7477 
    7578// Make sure we have a config file 
    7679// 
    7780   if (!Cfn || !*Cfn) 
    78       {eDest.Emsg("Config", "Configuration file not specified."); 
     81      {eDest->Emsg("Config", "Configuration file not specified."); 
    7982       return 1; 
    8083      } 
     
    8386// 
    8487   if ( (cfgFD = open(Cfn, O_RDONLY, 0)) < 0) 
    85       {eDest.Emsg("Config", errno, "open config file", Cfn); 
     88      {eDest->Emsg("Config", errno, "open config file", Cfn); 
    8689       return 1; 
    8790      } 
     91   ConfigFN = Cfn; 
     92 
    8893   Config.Attach(cfgFD); 
    8994 
     
    97102// All done scanning the file, set dependent parameters. 
    98103// 
    99    if (N2N_Lib) NoGo |= ConfigN2N(Eroute); 
     104   if (N2N_Lib) NoGo |= ConfigN2N(); 
    100105 
    101106// Now check if any errors occured during file i/o 
    102107// 
    103108   if ((retc = Config.LastError())) 
    104       NoGo = eDest.Emsg("Config", retc, "read config file", Cfn); 
     109      NoGo = eDest->Emsg("Config", retc, "read config file", Cfn); 
    105110   Config.Close(); 
    106111 
     
    119124   // Process items. for either a local or a remote configuration 
    120125   // 
     126 
    121127   TS_Xeq("namelib",       xnml); 
    122128 
    123129   // No match found, complain. 
    124130   // 
    125    eDest.Say("Config warning: ignoring unknown directive '",var,"'."); 
    126    Config.Echo(); 
     131   //eDest->Say("Config warning: ignoring unknown directive '",var,"'."); 
     132   //Config.Echo(); 
    127133   return 0; 
    128134} 
     
    132138/******************************************************************************/ 
    133139 
    134 int XrdHdfsSys::ConfigN2N(XrdSysError &Eroute
     140int XrdHdfsSys::ConfigN2N(
    135141{ 
    136142   XrdSysPlugin    *myLib; 
     
    140146// the library must stay open but we never want to reference it again). 
    141147// 
    142    if (!(myLib = new XrdSysPlugin(&Eroute, N2N_Lib))) return 1; 
     148   if (!(myLib = new XrdSysPlugin(eDest, N2N_Lib))) return 1; 
    143149 
    144150// Now get the entry point of the object creator 
     
    150156// Get the Object now 
    151157// 
    152    the_N2N = ep(&Eroute, ConfigFN, 
     158   the_N2N = ep(eDest, ConfigFN, 
    153159                (N2N_Parms ? N2N_Parms : ""), 
    154                 LocalRoot, RemoteRoot); 
    155    return lcl_N2N == 0; 
     160                NULL, NULL); 
     161   return the_N2N == 0; 
    156162} 
    157163 
     
    171177*/ 
    172178 
    173 int XrdHdfsSys::xnml(XrdOucStream &Config, XrdSysError &Eroute
     179int XrdHdfsSys::xnml(XrdOucStream &Config
    174180{ 
    175181    char *val, parms[1024]; 
     
    178184// 
    179185   if (!(val = Config.GetWord()) || !val[0]) 
    180       {Eroute.Emsg("Config", "namelib not specified"); return 1;} 
     186      {eDest->Emsg("Config", "namelib not specified"); return 1;} 
    181187 
    182188// Record the path 
     
    188194// 
    189195   if (!Config.GetRest(parms, sizeof(parms))) 
    190       {Eroute.Emsg("Config", "namelib parameters too long"); return 1;} 
     196      {eDest->Emsg("Config", "namelib parameters too long"); return 1;} 
    191197   if (N2N_Parms) free(N2N_Parms); 
    192198   N2N_Parms = (*parms ? strdup(parms) : 0);