|
@@ -618,9 +618,9 @@ static void dfsgroup(const char *name)
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
-static void dfsmap(const char *lname)
|
|
|
+static void dfsmap(const char *lname, IUserDescriptor *user)
|
|
|
{
|
|
|
- Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,user);
|
|
|
if (!file) {
|
|
|
ERRLOG("File %s not found",lname);
|
|
|
return;
|
|
@@ -651,9 +651,9 @@ static int dfsexists(const char *lname,IUserDescriptor *user)
|
|
|
}
|
|
|
//=============================================================================
|
|
|
|
|
|
-static void dfsparents(const char *lname)
|
|
|
+static void dfsparents(const char *lname, IUserDescriptor *user)
|
|
|
{
|
|
|
- Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,user);
|
|
|
if (file) {
|
|
|
Owned<IDistributedSuperFileIterator> iter = file->getOwningSuperFiles();
|
|
|
ForEach(*iter)
|
|
@@ -663,10 +663,10 @@ static void dfsparents(const char *lname)
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
-static void dfsunlink(const char *lname)
|
|
|
+static void dfsunlink(const char *lname, IUserDescriptor *user)
|
|
|
{
|
|
|
loop {
|
|
|
- Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,user);
|
|
|
if (file) {
|
|
|
Owned<IDistributedSuperFileIterator> iter = file->getOwningSuperFiles();
|
|
|
if (!iter->first())
|
|
@@ -787,10 +787,10 @@ public:
|
|
|
};
|
|
|
|
|
|
|
|
|
-static int dfsverify(const char *name,CDateTime *cutoff)
|
|
|
+static int dfsverify(const char *name,CDateTime *cutoff, IUserDescriptor *user)
|
|
|
{
|
|
|
static CIpTable dafilesrvips;
|
|
|
- Owned<IDistributedFile> file=queryDistributedFileDirectory().lookup(name,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file=queryDistributedFileDirectory().lookup(name,user);
|
|
|
if (!file) {
|
|
|
ERRLOG("VERIFY: cannot find %s",name);
|
|
|
return 1;
|
|
@@ -905,39 +905,19 @@ static int dfsverify(const char *name,CDateTime *cutoff)
|
|
|
return 3;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-static void dfsVerifyFiles(const char *grp,unsigned days)
|
|
|
-{
|
|
|
- CDateTime cutoff;
|
|
|
- if (days) {
|
|
|
- cutoff.setNow();
|
|
|
- cutoff.adjustTime(-60*24*days);
|
|
|
- }
|
|
|
-
|
|
|
- IDFAttributesIterator *iter = queryDistributedFileDirectory().getDFAttributesIterator("*",UNKNOWN_USER,true,false);//MORE:Pass IUserDescriptor
|
|
|
- ForEach(*iter) {
|
|
|
- StringBuffer lpath;
|
|
|
- IPropertyTree &attr=iter->query();
|
|
|
- const char *name=attr.queryProp("@name");
|
|
|
- const char *g=attr.queryProp("@group");
|
|
|
- if ((strcmp("*",grp)==0)||(g&&(strcmp(g,grp)==0))) // TBD - Handling for multiple clusters?
|
|
|
- dfsverify(name,days?&cutoff:NULL);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
//=============================================================================
|
|
|
|
|
|
-static void setprotect(const char *filename, const char *callerid)
|
|
|
+static void setprotect(const char *filename, const char *callerid, IUserDescriptor *user)
|
|
|
{
|
|
|
- Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(filename,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(filename,user);
|
|
|
file->setProtect(callerid,true);
|
|
|
}
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
-static void unprotect(const char *filename, const char *callerid)
|
|
|
+static void unprotect(const char *filename, const char *callerid, IUserDescriptor *user)
|
|
|
{
|
|
|
- Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(filename,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(filename,user);
|
|
|
file->setProtect((strcmp(callerid,"*")==0)?NULL:callerid,false);
|
|
|
}
|
|
|
//=============================================================================
|
|
@@ -1271,9 +1251,9 @@ static void checksubfile(const char *lfn)
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
-static void listexpires(const char * lfnmask)
|
|
|
+static void listexpires(const char * lfnmask, IUserDescriptor *user)
|
|
|
{
|
|
|
- IDFAttributesIterator *iter = queryDistributedFileDirectory().getDFAttributesIterator(lfnmask,UNKNOWN_USER,true,false);//MORE:Pass IUserDescriptor
|
|
|
+ IDFAttributesIterator *iter = queryDistributedFileDirectory().getDFAttributesIterator(lfnmask,user,true,false);
|
|
|
ForEach(*iter) {
|
|
|
IPropertyTree &attr=iter->query();
|
|
|
const char * expires = attr.queryProp("@expires");
|
|
@@ -1372,9 +1352,9 @@ static offset_t getCompressedSize(IDistributedFile *file)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static void dfscompratio (const char *lname)
|
|
|
+static void dfscompratio (const char *lname, IUserDescriptor *user)
|
|
|
{
|
|
|
- Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,UNKNOWN_USER);
|
|
|
+ Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(lname,user);
|
|
|
StringBuffer out;
|
|
|
out.appendf("File %s ",lname);
|
|
|
if (file) {
|
|
@@ -1452,10 +1432,10 @@ static bool countScopeChildren(IPropertyTree *t,unsigned &files, unsigned &sfile
|
|
|
return (other!=0)||(files!=0)||(sfiles!=0)||(scopes!=0)||(!onlyNamePtree(t));
|
|
|
}
|
|
|
|
|
|
-static void dfsscopes(const char *name)
|
|
|
+static void dfsscopes(const char *name, IUserDescriptor *user)
|
|
|
{
|
|
|
bool wild = isWild(name);
|
|
|
- Owned<IDFScopeIterator> iter = queryDistributedFileDirectory().getScopeIterator(UNKNOWN_USER,wild?NULL:name,true,true);//MORE:Pass IUserDescriptor
|
|
|
+ Owned<IDFScopeIterator> iter = queryDistributedFileDirectory().getScopeIterator(user,wild?NULL:name,true,true);
|
|
|
StringBuffer ln;
|
|
|
ForEach(*iter) {
|
|
|
CDfsLogicalFileName dlfn;
|
|
@@ -1506,9 +1486,9 @@ static bool recursiveCheckEmptyScope(IPropertyTree &ct)
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void cleanscopes()
|
|
|
+static void cleanscopes(IUserDescriptor *user)
|
|
|
{
|
|
|
- Owned<IDFScopeIterator> iter = queryDistributedFileDirectory().getScopeIterator(UNKNOWN_USER, NULL,true,true);//MORE:Pass IUserDescriptor
|
|
|
+ Owned<IDFScopeIterator> iter = queryDistributedFileDirectory().getScopeIterator(user, NULL,true,true);
|
|
|
CDfsLogicalFileName dlfn;
|
|
|
StringBuffer s;
|
|
|
StringArray toremove;
|
|
@@ -2237,7 +2217,7 @@ int main(int argc, char* argv[])
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfsmap")==0) {
|
|
|
CHECKPARAMS(1,1);
|
|
|
- dfsmap(params.item(1));
|
|
|
+ dfsmap(params.item(1), userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfsexist")==0) {
|
|
|
CHECKPARAMS(1,1);
|
|
@@ -2245,23 +2225,23 @@ int main(int argc, char* argv[])
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfsparents")==0) {
|
|
|
CHECKPARAMS(1,1);
|
|
|
- dfsparents(params.item(1));
|
|
|
+ dfsparents(params.item(1),userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfsunlink")==0) {
|
|
|
CHECKPARAMS(1,1);
|
|
|
- dfsunlink(params.item(1));
|
|
|
+ dfsunlink(params.item(1),userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfsverify")==0) {
|
|
|
CHECKPARAMS(1,1);
|
|
|
- ret = dfsverify(params.item(1),NULL);
|
|
|
+ ret = dfsverify(params.item(1),NULL,userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"setprotect")==0) {
|
|
|
CHECKPARAMS(2,2);
|
|
|
- setprotect(params.item(1),params.item(2));
|
|
|
+ setprotect(params.item(1),params.item(2),userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"unprotect")==0) {
|
|
|
CHECKPARAMS(2,2);
|
|
|
- unprotect(params.item(1),params.item(2));
|
|
|
+ unprotect(params.item(1),params.item(2),userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"listprotect")==0) {
|
|
|
CHECKPARAMS(0,2);
|
|
@@ -2279,7 +2259,7 @@ int main(int argc, char* argv[])
|
|
|
}
|
|
|
else if (stricmp(cmd,"listexpires")==0) {
|
|
|
CHECKPARAMS(0,1);
|
|
|
- listexpires((np>1)?params.item(1):"*");
|
|
|
+ listexpires((np>1)?params.item(1):"*",userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"listrelationships")==0) {
|
|
|
CHECKPARAMS(2,2);
|
|
@@ -2293,15 +2273,15 @@ int main(int argc, char* argv[])
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfscompratio")==0) {
|
|
|
CHECKPARAMS(1,1);
|
|
|
- dfscompratio(params.item(1));
|
|
|
+ dfscompratio(params.item(1),userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"dfsscopes")==0) {
|
|
|
CHECKPARAMS(0,1);
|
|
|
- dfsscopes((np>1)?params.item(1):"*");
|
|
|
+ dfsscopes((np>1)?params.item(1):"*",userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"cleanscopes")==0) {
|
|
|
CHECKPARAMS(0,0);
|
|
|
- cleanscopes();
|
|
|
+ cleanscopes(userDesc);
|
|
|
}
|
|
|
else if (stricmp(cmd,"listworkunits")==0) {
|
|
|
CHECKPARAMS(0,3);
|