Fix delete operations

This commit is contained in:
Deon George 2010-12-29 12:13:00 +11:00 committed by Deon George
parent 2c08c83b24
commit 80e513f9fb

View File

@ -408,7 +408,7 @@ typedef int (*tsm_query_callback)(dsmQueryType, DataBlk *, void *);
dsInt16_t tsm_queryfile(dsUint32_t sesshandle, dsmObjName *objName, dsInt16_t tsm_queryfile(dsUint32_t sesshandle, dsmObjName *objName,
char *description, dsmSendType sendtype, char verbose, 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; dsmQueryType qType;
qryArchiveData qaData; qryArchiveData qaData;
@ -451,7 +451,7 @@ dsInt16_t tsm_queryfile(dsUint32_t sesshandle, dsmObjName *objName,
qbData.stVersion = qryBackupDataVersion; qbData.stVersion = qryBackupDataVersion;
qbData.objName = objName; qbData.objName = objName;
qbData.owner = ""; qbData.owner = "";
qbData.objState = DSM_ANY_MATCH; qbData.objState = querytype;
if (pitdate) { if (pitdate) {
qbData.pitDate = xStringToDate(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, 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; dsInt16_t rc;
dsUint16_t reason=0; dsUint16_t reason=0;
@ -583,7 +583,7 @@ int tsm_deletefile(dsUint32_t sesshandle, char *fsname, char *filename,
cbdata.numfound = 0; cbdata.numfound = 0;
rc = tsm_queryfile(sesshandle, &objName, description, sendtype, 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) { if(rc != DSM_RC_OK) {
return 0; return 0;
} }
@ -659,7 +659,7 @@ int tsm_restorefile(dsUint32_t sesshandle, char *fsname, char *filename,
cbdata.numfound = 0; cbdata.numfound = 0;
rc = tsm_queryfile(sesshandle, &objName, description, sendtype, 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) { if(rc != DSM_RC_OK) {
return 0; return 0;
} }
@ -729,18 +729,18 @@ int tsm_restorefile(dsUint32_t sesshandle, char *fsname, char *filename,
} }
// Display the dsmDate value as a string // 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", sprintf(s,"%02i/%02i/%02i %02i:%02i:%02i",
date.year,
(dsInt16_t)date.month, (dsInt16_t)date.month,
(dsInt16_t)date.day, (dsInt16_t)date.day,
date.year,
(dsInt16_t)date.hour, (dsInt16_t)date.hour,
(dsInt16_t)date.minute, (dsInt16_t)date.minute,
(dsInt16_t)date.second); (dsInt16_t)date.second);
} }
static dsmDate xStringToDate(char *s) dsmDate xStringToDate(char *s)
{ {
dsUint32_t temp; dsUint32_t temp;
dsUint32_t temp1; dsUint32_t temp1;
@ -837,7 +837,7 @@ int tsm_listfile(dsUint32_t sesshandle, char *fsname, char *filename,
} }
rc = tsm_queryfile(sesshandle, &objName, description, sendtype, 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) { if(rc != DSM_RC_OK && rc != DSM_RC_ABORT_NO_MATCH) {
return 0; return 0;
} }
@ -1033,7 +1033,7 @@ int main(int argc, char *argv[]) {
} }
if(delete) { if(delete) {
if(!tsm_deletefile(sesshandle, space, filename, desc, sendtype, verbose, pitdate)) { if(!tsm_deletefile(sesshandle, space, filename, desc, sendtype, verbose)) {
dsmTerminate(sesshandle); dsmTerminate(sesshandle);
exit(7); exit(7);
} }