Skip to content

Commit

Permalink
Set default username from guid.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed Mar 2, 2015
1 parent 7bc7883 commit 493e2cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
24 changes: 17 additions & 7 deletions src/XrdFileCache/XrdFileCacheFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysLogger.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucUtils.hh"
#include "XrdOss/XrdOssCache.hh"
#include "XrdOuc/XrdOucPinLoader.hh"
#include "XrdOuc/XrdOucStream.hh"
Expand Down Expand Up @@ -258,26 +259,35 @@ bool Factory::Config(XrdSysLogger *logger, const char *config_filename, const ch
}


int loff = 0;
char buff[2048];
snprintf(buff, sizeof(buff), "result\n"
loff = snprintf(buff, sizeof(buff), "result\n"
"\tpfc.cachedir %s\n"
"\tpfc.blocksize %lld\n"
"\tpfc.nramread %d\n\tpfc.nramprefetch %d\n",
m_configuration.m_cache_dir.c_str() ,
m_configuration.m_bufferSize,
m_configuration.m_NRamBuffersRead, m_configuration.m_NRamBuffersPrefetch );


if (m_configuration.m_hdfsmode)
{
char buff2[512];
snprintf(buff2, sizeof(buff2), "\tpfc.hdfsmode hdfsbsize %lld \n", m_configuration.m_hdfsbsize);
m_log.Emsg("", buff, buff2);
}
else {
snprintf(buff2, sizeof(buff2), "\tpfc.hdfsmode hdfsbsize %lld\n", m_configuration.m_hdfsbsize);
loff += snprintf(&buff[loff], strlen(buff2), buff2);
}

m_log.Emsg("Config", buff);

char unameBuff[256];
if (m_configuration.m_username.empty()) {
XrdOucUtils::UserName(getuid(), unameBuff, sizeof(unameBuff));
m_configuration.m_username = unameBuff;
}
else {
snprintf(unameBuff, sizeof(unameBuff), "\tpfc.user %s \n", m_configuration.m_username.c_str());
loff += snprintf(&buff[loff], strlen(unameBuff), unameBuff);
}

m_log.Emsg("Config", buff);
}

m_log.Emsg("Config", "Configuration = ", retval ? "Success" : "Fail");
Expand Down
1 change: 0 additions & 1 deletion src/XrdFileCache/XrdFileCacheFactory.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ namespace XrdFileCache
{
Configuration() :
m_hdfsmode(false),
m_username("nobody"),
m_lwm(0.95),
m_hwm(0.9),
m_bufferSize(1024*1024),
Expand Down

0 comments on commit 493e2cc

Please sign in to comment.