Lines Matching refs:pOpts
109 static void rtPathRmVerbose(PRTPATHRMCMDOPTS pOpts, const char *pszPath)
111 if (!pOpts->fMachineReadable)
116 static int rtPathRmError(PRTPATHRMCMDOPTS pOpts, const char *pszPath, int rc,
119 if (pOpts->fMachineReadable)
136 * @param pOpts The RM options.
139 static int rtPathRmOneSymlink(PRTPATHRMCMDOPTS pOpts, const char *pszPath)
141 if (pOpts->fVerbose)
142 rtPathRmVerbose(pOpts, pszPath);
145 return rtPathRmError(pOpts, pszPath, rc, "Error removing symbolic link '%s': %Rrc\n", pszPath, rc);
156 * @param pOpts The RM options.
160 static int rtPathRmOneFile(PRTPATHRMCMDOPTS pOpts, const char *pszPath, PRTFSOBJINFO pObjInfo)
163 if (pOpts->fVerbose)
164 rtPathRmVerbose(pOpts, pszPath);
169 if (pOpts->fSafeDelete && RTFS_IS_FILE(pObjInfo->Attr.fMode))
178 return rtPathRmError(pOpts, pszPath, rc, "Opening '%s' for overwriting: %Rrc\n", pszPath, rc);
188 rc = rtPathRmError(pOpts, pszPath, rc, "Error seeking to start of '%s': %Rrc\n", pszPath, rc);
199 rc = rtPathRmError(pOpts, pszPath, rc, "Error writing to '%s': %Rrc\n", pszPath, rc);
207 return rtPathRmError(pOpts, pszPath, rc2, "Closing '%s' failed: %Rrc\n", pszPath, rc);
217 return rtPathRmError(pOpts, pszPath, rc,
230 * @param pOpts The RM options.
233 static int rtPathRmOneDir(PRTPATHRMCMDOPTS pOpts, const char *pszPath)
235 if (pOpts->fVerbose)
236 rtPathRmVerbose(pOpts, pszPath);
240 return rtPathRmError(pOpts, pszPath, rc, "Error removing directory '%s': %Rrc", pszPath, rc);
249 * @param pOpts The RM options.
256 static int rtPathRmRecursive(PRTPATHRMCMDOPTS pOpts, char *pszPath, size_t cchPath, PRTDIRENTRYEX pDirEntry)
264 return rtPathRmError(pOpts, pszPath, VERR_BUFFER_OVERFLOW, "Buffer overflow fixing up '%s'.\n", pszPath);
275 return rtPathRmError(pOpts, pszPath, rc, "Error opening directory '%s': %Rrc", pszPath, rc);
292 return rtPathRmError(pOpts, pszPath, rc, "Error closing directory '%s': %Rrc", pszPath, rc);
295 int rc2 = rtPathRmOneDir(pOpts, pszPath);
303 rc = rtPathRmError(pOpts, pszPath, rc, "Error reading directory '%s': %Rrc", pszPath, rc);
318 rc = rtPathRmError(pOpts, pszPath, VERR_BUFFER_OVERFLOW, "Path buffer overflow in directory '%s'.", pszPath);
329 rc = rtPathRmOneFile(pOpts, pszPath, &pDirEntry->Info);
333 rc = rtPathRmRecursive(pOpts, pszPath, cchPath + pDirEntry->cbName, pDirEntry);
337 rc = rtPathRmOneSymlink(pOpts, pszPath);
344 rc = rtPathRmOneFile(pOpts, pszPath, &pDirEntry->Info);
349 rc = rtPathRmError(pOpts, pszPath, VERR_UNEXPECTED_FS_OBJ_TYPE,
369 * @param pOpts The RM options.
372 static int rtPathRmOneValidate(PRTPATHRMCMDOPTS pOpts, const char *pszPath)
384 && pOpts->fPreserveRoot)
385 return rtPathRmError(pOpts, pszPath, VERR_CANT_DELETE_DIRECTORY, "Cannot remove root directory ('%s').\n", pszPath);
395 return rtPathRmError(pOpts, pszPath, VERR_CANT_DELETE_DIRECTORY, "Cannot remove special directory '%s'.\n", pszPath);
405 * @param pOpts The RM options.
408 static int rtPathRmOne(PRTPATHRMCMDOPTS pOpts, const char *pszPath)
413 int rc = rtPathRmOneValidate(pOpts, pszPath);
424 if (pOpts->fForce && (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND))
426 return rtPathRmError(pOpts, pszPath, rc, "Error deleting '%s': %Rrc", pszPath, rc);
435 return rtPathRmOneFile(pOpts, pszPath, &ObjInfo);
438 if (pOpts->fRecursive)
443 return rtPathRmError(pOpts, pszPath, rc, "RTPathAbs failed on '%s': %Rrc\n", pszPath, rc);
451 return rtPathRmRecursive(pOpts, szPath, strlen(szPath), &DirEntry.Core);
453 if (pOpts->fDirsAndOther)
454 return rtPathRmOneDir(pOpts, pszPath);
455 return rtPathRmError(pOpts, pszPath, VERR_IS_A_DIRECTORY, "Cannot remove '%s': %Rrc\n", pszPath, VERR_IS_A_DIRECTORY);
458 return rtPathRmOneSymlink(pOpts, pszPath);
464 return rtPathRmOneFile(pOpts, pszPath, &ObjInfo);
468 return rtPathRmError(pOpts, pszPath, VERR_UNEXPECTED_FS_OBJ_TYPE,