From 80e513f9fbf87477978a59c4dcefb4b6b39a3c5b Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 29 Dec 2010 12:13:00 +1100 Subject: [PATCH] Fix delete operations --- tsmpipe.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tsmpipe.c b/tsmpipe.c index 9819b9c..dadc984 100644 --- a/tsmpipe.c +++ b/tsmpipe.c @@ -408,7 +408,7 @@ typedef int (*tsm_query_callback)(dsmQueryType, DataBlk *, void *); dsInt16_t tsm_queryfile(dsUint32_t sesshandle, dsmObjName *objName, char *description, dsmSendType sendtype, char verbose, - tsm_query_callback usercb, void * userdata, char *pitdate) + tsm_query_callback usercb, void * userdata, char *pitdate, int querytype) { dsmQueryType qType; qryArchiveData qaData; @@ -451,7 +451,7 @@ dsInt16_t tsm_queryfile(dsUint32_t sesshandle, dsmObjName *objName, qbData.stVersion = qryBackupDataVersion; qbData.objName = objName; qbData.owner = ""; - qbData.objState = DSM_ANY_MATCH; + qbData.objState = querytype; if (pitdate) { qbData.pitDate = xStringToDate(pitdate); @@ -563,7 +563,7 @@ int tsm_matchone_cb(dsmQueryType qType, DataBlk *qResp, void * userdata) int tsm_deletefile(dsUint32_t sesshandle, char *fsname, char *filename, - char *description, dsmSendType sendtype, char verbose, char *pitdate) + char *description, dsmSendType sendtype, char verbose) { dsInt16_t rc; dsUint16_t reason=0; @@ -583,7 +583,7 @@ int tsm_deletefile(dsUint32_t sesshandle, char *fsname, char *filename, cbdata.numfound = 0; rc = tsm_queryfile(sesshandle, &objName, description, sendtype, - verbose, tsm_matchone_cb, &cbdata, pitdate); + verbose, tsm_matchone_cb, &cbdata, NULL, DSM_ACTIVE); if(rc != DSM_RC_OK) { return 0; } @@ -659,7 +659,7 @@ int tsm_restorefile(dsUint32_t sesshandle, char *fsname, char *filename, cbdata.numfound = 0; rc = tsm_queryfile(sesshandle, &objName, description, sendtype, - verbose, tsm_matchone_cb, &cbdata, pitdate); + verbose, tsm_matchone_cb, &cbdata, pitdate, DSM_ANY_MATCH); if(rc != DSM_RC_OK) { return 0; } @@ -729,18 +729,18 @@ int tsm_restorefile(dsUint32_t sesshandle, char *fsname, char *filename, } // Display the dsmDate value as a string -static void QryDateToStr(char *s,dsmDate date) +void QryDateToStr(char *s,dsmDate date) { - sprintf(s,"%i/%02i/%02i %02i:%02i:%02i", - date.year, + sprintf(s,"%02i/%02i/%02i %02i:%02i:%02i", (dsInt16_t)date.month, (dsInt16_t)date.day, + date.year, (dsInt16_t)date.hour, (dsInt16_t)date.minute, (dsInt16_t)date.second); } -static dsmDate xStringToDate(char *s) +dsmDate xStringToDate(char *s) { dsUint32_t temp; dsUint32_t temp1; @@ -837,7 +837,7 @@ int tsm_listfile(dsUint32_t sesshandle, char *fsname, char *filename, } rc = tsm_queryfile(sesshandle, &objName, description, sendtype, - verbose, tsm_listfile_cb, NULL, pitdate); + verbose, tsm_listfile_cb, NULL, pitdate, DSM_ANY_MATCH); if(rc != DSM_RC_OK && rc != DSM_RC_ABORT_NO_MATCH) { return 0; } @@ -1033,7 +1033,7 @@ int main(int argc, char *argv[]) { } if(delete) { - if(!tsm_deletefile(sesshandle, space, filename, desc, sendtype, verbose, pitdate)) { + if(!tsm_deletefile(sesshandle, space, filename, desc, sendtype, verbose)) { dsmTerminate(sesshandle); exit(7); }