37 long long totalToRemove = 0;
41 if (it->dirUsage ==
nullptr)
43 m_log.
Emsg(
"PurgeQuotaPin--GetBytesToRecover",
"directory not found:", it->path.c_str());
46 long long cv = 512ll * it->dirUsage->m_StBlocks - it->nBytesQuota;
48 it->nBytesToRecover = cv;
50 it->nBytesToRecover = 0;
52 totalToRemove += it->nBytesToRecover;
64 if (!parms || !parms[0] || (strlen(parms) == 0))
66 m_log.
Emsg(
"ConfigPurgePin",
"Quota file not specified.");
69 m_log.
Emsg(
"ConfigPurgePin",
"Using directory list", parms);
72 const char *config_filename = parms;
73 const char *theINS = getenv(
"XRDINSTANCE");
78 if ((fd =
open(config_filename, O_RDONLY, 0)) < 0)
80 m_log.
Emsg(
"ConfigPurgePin() can't open configuration file ", config_filename);
84 static const char *cvec[] = {
"*** pfc purge plugin :", 0};
88 while ((var =
Config.GetMyFirstWord()))
90 std::string dirpath = var;
93 if (!(val =
Config.GetWord()))
95 m_log.
Emsg(
"PurgeQuota plugin",
"quota not specified");
99 std::string tmpc = val;
101 if (::isalpha(*(tmpc.rbegin())))
103 if (
XrdOuca2x::a2sz(m_log,
"Error getting quota", tmpc.c_str(), "a))
110 if (
XrdOuca2x::a2ll(m_log,
"Error getting quota", tmpc.c_str(), "a))
XrdPfc::PurgePin * XrdPfcGetPurgePin(XrdSysError &log)
int open(const char *path, int oflag,...)
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
static int a2ll(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
bool ConfigPurgePin(const char *parms) override
Provide bytes to erase from dir quota listed in a text file.
void InitDirStatesForLocalPaths(const XrdPfc::DataFsPurgeshot &purge_shot)
Set directory statistics.
long long GetBytesToRecover(const XrdPfc::DataFsPurgeshot &purge_shot) override
Provide bytes to erase from dir quota listed in a text file.
XrdPfcPurgeQuota(XrdSysError &log)
Base class for reguesting directory space to obtain.
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
const DirUsage * find_dir_usage_for_dir_path(const std::string &dir_path) const