public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/main] Cygwin: unlink: drop unlink_nt/unlink_nt_shareable wrappers
Date: Mon, 20 Mar 2023 11:58:34 +0000 (GMT)	[thread overview]
Message-ID: <20230320115834.904EA3858002@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=271292b1fbdc7da7c1ed678836eebe596170e635

commit 271292b1fbdc7da7c1ed678836eebe596170e635
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Mon Mar 20 12:23:36 2023 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Mar 20 12:55:30 2023 +0100

    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>

Diff:
---
 winsup/cygwin/fhandler/disk_file.cc |  4 ++--
 winsup/cygwin/forkable.cc           |  4 ++--
 winsup/cygwin/syscalls.cc           | 24 ++++++------------------
 3 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/winsup/cygwin/fhandler/disk_file.cc b/winsup/cygwin/fhandler/disk_file.cc
index 8528f7f8d4de..19c976aaae41 100644
--- a/winsup/cygwin/fhandler/disk_file.cc
+++ b/winsup/cygwin/fhandler/disk_file.cc
@@ -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))
     {
diff --git a/winsup/cygwin/forkable.cc b/winsup/cygwin/forkable.cc
index fbc30ae3028f..c69c8bea9e98 100644
--- a/winsup/cygwin/forkable.cc
+++ b/winsup/cygwin/forkable.cc
@@ -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)
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 8ae0397fb184..af4f870851eb 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -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

                 reply	other threads:[~2023-03-20 11:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230320115834.904EA3858002@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).