Cygwin: unlink: drop unlink_nt/unlink_nt_shareable wrappers

Useless indirection.  Rename _unlink_nt back to unlink_nt
and call the function directly with `sharable' flag as needed.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-03-20 12:23:36 +01:00
parent fcccdc4021
commit 271292b1fb
3 changed files with 10 additions and 22 deletions

View File

@ -1836,7 +1836,7 @@ fhandler_disk_file::mkdir (mode_t mode)
int
fhandler_disk_file::rmdir ()
{
extern NTSTATUS unlink_nt (path_conv &pc);
extern NTSTATUS unlink_nt (path_conv &pc, bool sharable);
if (!pc.isdir ())
{
@ -1849,7 +1849,7 @@ fhandler_disk_file::rmdir ()
return -1;
}
NTSTATUS status = unlink_nt (pc);
NTSTATUS status = unlink_nt (pc, false);
if (!NT_SUCCESS (status))
{

View File

@ -29,7 +29,7 @@ details. */
/* Allow concurrent processes to use the same dll or exe
* via their hardlink while we delete our hardlink. */
extern NTSTATUS unlink_nt_shareable (path_conv &pc);
extern NTSTATUS unlink_nt (path_conv &pc, bool sharable);
#define MUTEXSEP L"@"
#define PATHSEP L"\\"
@ -132,7 +132,7 @@ rmdirs (WCHAR ntmaxpathbuf[NT_MAX_PATH])
RtlInitUnicodeString (&fn, ntmaxpathbuf);
path_conv pc (&fn);
unlink_nt_shareable (pc); /* move to bin */
unlink_nt (pc, true); /* move to bin */
}
if (!pfdi->NextEntryOffset)

View File

@ -665,8 +665,8 @@ _unlink_nt_post_dir_check (NTSTATUS status, POBJECT_ATTRIBUTES attr, const path_
return status;
}
static NTSTATUS
_unlink_nt (path_conv &pc, bool shareable)
NTSTATUS
unlink_nt (path_conv &pc, bool shareable)
{
NTSTATUS status;
HANDLE fh, fh_ro = NULL;
@ -1062,18 +1062,6 @@ out:
return status;
}
NTSTATUS
unlink_nt (path_conv &pc)
{
return _unlink_nt (pc, false);
}
NTSTATUS
unlink_nt_shareable (path_conv &pc)
{
return _unlink_nt (pc, true);
}
extern "C" int
unlink (const char *ourname)
{
@ -1113,7 +1101,7 @@ unlink (const char *ourname)
goto done;
}
status = unlink_nt (win32_name);
status = unlink_nt (win32_name, false);
if (NT_SUCCESS (status))
res = 0;
else
@ -2504,7 +2492,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int at2flags)
unlink_nt returns with STATUS_DIRECTORY_NOT_EMPTY. */
if (dstpc->isdir ())
{
status = unlink_nt (*dstpc);
status = unlink_nt (*dstpc, false);
if (!NT_SUCCESS (status))
{
__seterrno_from_nt_status (status);
@ -2645,7 +2633,7 @@ skip_pre_W10_checks:
? FILE_OPEN_REPARSE_POINT : 0));
if (NT_SUCCESS (status))
{
status = unlink_nt (*dstpc);
status = unlink_nt (*dstpc, false);
if (NT_SUCCESS (status))
break;
}
@ -2665,7 +2653,7 @@ skip_pre_W10_checks:
if (NT_SUCCESS (status))
{
if (removepc)
unlink_nt (*removepc);
unlink_nt (*removepc, false);
res = 0;
}
else