CMPIStatus InternalProviderDeleteInstance(CMPIInstanceMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * cop) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *cn = CMGetClassName(cop, NULL); CMPIString *ns = CMGetNameSpace(cop, NULL); char *key = normalizeObjectPathCharsDup(cop); const char *nss = ns->ft->getCharPtr(ns, NULL); const char *cns = cn->ft->getCharPtr(cn, NULL); const char *bnss = repositoryNs(nss); _SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderDeleteInstance"); if (testNameSpace(bnss, &st) == 0) { free(key); _SFCB_RETURN(st); } if (existingBlob(bnss, cns, key) == 0) { CMPIStatus st = { CMPI_RC_ERR_NOT_FOUND, NULL }; free(key); _SFCB_RETURN(st); } deleteBlob(bnss, cns, key); free(key); _SFCB_RETURN(st); }
int main() { if (existingNameSpace(ns) == 0) { printf("--- namspace %s does not exist\n", ns); exit(1); } addBlob(ns, "class1", o1, o1, strlen(o1)); addBlob(ns, "class1", o2, o2, strlen(o2)); addBlob(ns, "class1", o3, o3, strlen(o3)); addBlob(ns, "class1", o4, o4, strlen(o4)); addBlob(ns, "class1", o2, o2, strlen(o2)); deleteBlob(ns, "class1", o2); deleteBlob(ns, "class1", o1); deleteBlob(ns, "class1", o4); printf("--- %s\n", (char *) getBlob(ns, "class1", o3, NULL)); deleteBlob(ns, "class1", o3); }