Commit 27fbb74b authored by Elvin Sindrilaru's avatar Elvin Sindrilaru
Browse files

XROOTD: Implement file system stat directly on the diskserver and return ENOSYS for

        masked/unimplemented file system operations
parent fba23e8f
......@@ -211,7 +211,7 @@ std::string
XrdxCastor2Fs::GetAllowedSvc(const char* path,
const std::string& desired_svc)
{
xcastor_debug("path=%s desired_svc=%s", path, desired_svc.c_str());
xcastor_debug("path=%s desired_svc=\"%s\"", path, desired_svc.c_str());
std::string spath = path;
std::string subpath;
std::string allowed_svc = "";
......
......@@ -157,11 +157,11 @@ int XrdxCastor2Ofs::Configure(XrdSysError& Eroute)
(end == val))
{
// There was an error default to LOG_INFO
log_level = 6;
log_level = 6;
}
}
SetLogLevel(log_level);
mLogLevel = log_level;
Eroute.Say("=====> xcastor2.loglevel: ",
Logging::GetPriorityString(mLogLevel), "");
}
......@@ -197,6 +197,9 @@ int XrdxCastor2Ofs::Configure(XrdSysError& Eroute)
config_stream.Close();
}
// Parse the default XRootD directives
int rc = XrdOfs::Configure(Eroute);
// Setup the circular in-memory logging buffer
XrdOucString unit = "rdr@";
unit += XrdSysDNS::getHostName();
......@@ -205,7 +208,7 @@ int XrdxCastor2Ofs::Configure(XrdSysError& Eroute)
Logging::SetLogPriority(mLogLevel);
Logging::SetUnit(unit.c_str());
xcastor_info("logging configured");
int rc = XrdOfs::Configure(Eroute);
// Set the effective user for all the XrdClients used to issue 'prepares'
// to redirector
......@@ -317,7 +320,7 @@ XrdxCastor2OfsFile::open(const char* path,
if (tried_pos != STR_NPOS)
newopaque.erase(tried_pos, amp_pos - tried_pos);
// This prevents 'clever' users from faking internal opaque information
newopaque.replace("source=", "nosource=");
mEnvOpaque = new XrdOucEnv(newopaque.c_str());
......@@ -380,11 +383,29 @@ XrdxCastor2OfsFile::open(const char* path,
}
TIMING("DONE", &opentiming);
opentiming.Print();
if (gSrv->mLogLevel == LOG_DEBUG)
opentiming.Print();
return rc;
}
//------------------------------------------------------------------------------
// Stat file path
//------------------------------------------------------------------------------
int
XrdxCastor2Ofs::stat(const char* path,
struct stat* buf,
XrdOucErrInfo& einfo,
const XrdSecEntity* client,
const char* opaque)
{
xcastor_debug("path=%s, opaque=%s", path, opaque);
return XrdOfs::stat(path, buf, einfo, client, opaque);
}
//------------------------------------------------------------------------------
// Close file
//------------------------------------------------------------------------------
......@@ -811,7 +832,7 @@ XrdxCastor2OfsFile::read(XrdSfsFileOffset fileOffset,
XrdSfsXferSize buffer_size)
{
xcastor_debug("off=%llu, len=%i", fileOffset, buffer_size);
// If we once got an adler checksum error, we fail all reads.
if (mHasAdlerErr)
{
......
......@@ -37,6 +37,7 @@
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucString.hh"
#include "XrdOfs/XrdOfs.hh"
#include "XrdOfs/XrdOfsTrace.hh"
#include "XrdSfs/XrdSfsInterface.hh"
#include "XrdSys/XrdSysTimer.hh"
#include "XrdSys/XrdSysPthread.hh"
......@@ -128,7 +129,7 @@ class XrdxCastor2OfsFile : public XrdOfsFile, public LogId
//! Write to file
//--------------------------------------------------------------------------
int write(XrdSfsAio* aioparm);
//--------------------------------------------------------------------------
//! Unlink file
......@@ -274,88 +275,94 @@ class XrdxCastor2Ofs : public XrdOfs, public LogId
//--------------------------------------------------------------------------
//! Chmod - masked
//--------------------------------------------------------------------------
int chmod(const char* /*Name*/,
XrdSfsMode /*Mode*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client*/,
const char* /*opaque = 0*/)
int chmod(const char* path,
XrdSfsMode Mode,
XrdOucErrInfo& out_error,
const XrdSecEntity* client,
const char* opaque = 0)
{
return SFS_OK;
EPNAME("chmod");
return Emsg(epname, out_error, ENOSYS, epname, path);
}
//--------------------------------------------------------------------------
//! Exists - masked
//--------------------------------------------------------------------------
int exists(const char* /*fileName*/,
XrdSfsFileExistence& /*exists_flag*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client*/,
const char* /*opaque = 0*/)
int exists(const char* path,
XrdSfsFileExistence& exists_flag,
XrdOucErrInfo& out_error,
const XrdSecEntity* client,
const char* opaque = 0)
{
return SFS_OK;
EPNAME("exists");
return Emsg(epname, out_error, ENOSYS, epname, path);
}
//--------------------------------------------------------------------------
//! fsctl - masked
//--------------------------------------------------------------------------
int fsctl(const int /*cmd*/,
const char* /*args*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client*/)
int fsctl(const int cmd,
const char* args,
XrdOucErrInfo& out_error,
const XrdSecEntity* client)
{
return SFS_OK;
EPNAME("fsctl");
return Emsg(epname, out_error, ENOSYS, epname);
}
//--------------------------------------------------------------------------
//! Mkdir - masked
//--------------------------------------------------------------------------
int mkdir(const char* /*dirName*/,
XrdSfsMode /*Mode*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client*/,
const char* /*opaque = 0*/)
int mkdir(const char* path,
XrdSfsMode Mode,
XrdOucErrInfo& out_error,
const XrdSecEntity* client,
const char* opaque = 0)
{
return SFS_OK;
EPNAME("mkdir");
return Emsg(epname, out_error, ENOSYS, epname, path);
}
//--------------------------------------------------------------------------
//! prepare - masked
//--------------------------------------------------------------------------
int prepare(XrdSfsPrep& /*pargs*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client = 0*/)
int prepare(XrdSfsPrep& pargs,
XrdOucErrInfo& out_error,
const XrdSecEntity* client = 0)
{
return SFS_OK;
EPNAME("prepare");
return Emsg(epname, out_error, ENOSYS, epname);
}
//--------------------------------------------------------------------------
//! remdir - masked
//--------------------------------------------------------------------------
int remdir(const char* /*dirName*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client*/,
const char* /*info = 0*/)
int remdir(const char* path,
XrdOucErrInfo& out_error,
const XrdSecEntity* client,
const char* info = 0)
{
return SFS_OK;
return Emsg("remdir", out_error, ENOSYS, path);
}
//--------------------------------------------------------------------------
//! rename - masked
//--------------------------------------------------------------------------
int rename(const char* /*oldFileName*/,
const char* /*newFileName*/,
XrdOucErrInfo& /*out_error*/,
const XrdSecEntity* /*client*/,
const char* /*infoO = 0*/,
const char* /*infoN = 0*/)
int rename(const char* oldFileName,
const char* newFileName,
XrdOucErrInfo& out_error,
const XrdSecEntity* client,
const char* infoO = 0,
const char* infoN = 0)
{
return SFS_OK;
EPNAME("rename");
return Emsg(epname, out_error, ENOSYS, epname, oldFileName);
}
......@@ -367,21 +374,19 @@ class XrdxCastor2Ofs : public XrdOfs, public LogId
const XrdSecEntity* client,
const char* info = 0)
{
return SFS_OK;
EPNAME("rem");
return Emsg(epname, out_error, ENOSYS, epname, path);
}
//--------------------------------------------------------------------------
//! Stat - masked
//! Stat
//--------------------------------------------------------------------------
int stat(const char* Name,
struct stat* buf,
XrdOucErrInfo& out_error,
const XrdSecEntity* client,
const char* opaque = 0)
{
return SFS_OK;
}
const char* opaque = 0);
//--------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment