[newlib-cygwin/cygwin-3_6-branch] Cygwin: flock.cc: rename i_all to __i_all, improve inode_t comments
Corinna Vinschen
corinna@sourceware.org
Wed Nov 26 13:01:47 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7ca9c6b1f9f644e9e19d4b21716fe6d6f98f9f82
commit 7ca9c6b1f9f644e9e19d4b21716fe6d6f98f9f82
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Nov 26 11:23:30 2025 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Nov 26 14:00:46 2025 +0100
Cygwin: flock.cc: rename i_all to __i_all, improve inode_t comments
Accessing i_all should always be performed via the i_all_lf pointer,
never directly. Add leading underscores to support this notion.
Improve inode_t comments a bit so it's hopefully clearer what all the
members are doing.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 008f8bfba19c65312237ba6493e34877a4b7a6bd)
Diff:
---
winsup/cygwin/flock.cc | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index c910bc07251f..dd0360d08674 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -279,7 +279,8 @@ class lockf_t
void del_lock_obj (HANDLE fhdl, bool signal = false);
};
-/* Number of lockf_t structs which fit in the temporary buffer. */
+/* Max. number of lockf_t structs in the __i_all buffer so that an inode_t
+ fits into a 64K cygheap chunk. */
#define MAX_LOCKF_CNT ((intptr_t)((NT_MAX_PATH * sizeof (WCHAR)) \
/ sizeof (lockf_t)) - 1)
@@ -290,19 +291,22 @@ class inode_t
public:
LIST_ENTRY (inode_t) i_next;
- lockf_t *i_lockf; /* List of locks of this process. */
- /* list of all locks for this file. */
- lockf_t *i_all_lf;
+ lockf_t *i_lockf; /* List of locks held by this process. */
+ lockf_t *i_all_lf; /* List of all locks on this file. Always
+ points to __i_all below. The indirection
+ is required by list handling. */
dev_t i_dev; /* Device ID */
ino_t i_ino; /* inode number */
private:
- HANDLE i_dir;
- HANDLE i_mtx;
+ HANDLE i_dir; /* Directory in NT namespace holding symlinks
+ representing locks on this file. */
+ HANDLE i_mtx; /* Mutex controlling access to locks on
+ this file. */
uint32_t i_cnt; /* # of threads referencing this instance. */
- uint32_t i_lock_cnt; /* # of locks for this file */
- lockf_t i_all[MAX_LOCKF_CNT];
+ uint32_t i_lock_cnt; /* # of locks on this file */
+ lockf_t __i_all[MAX_LOCKF_CNT];
public:
inode_t (dev_t dev, ino_t ino);
@@ -511,7 +515,7 @@ inode_t::get (dev_t dev, ino_t ino, bool create_if_missing, bool lock)
}
inode_t::inode_t (dev_t dev, ino_t ino)
-: i_lockf (NULL), i_all_lf (i_all), i_dev (dev), i_ino (ino), i_cnt (0L),
+: i_lockf (NULL), i_all_lf (__i_all), i_dev (dev), i_ino (ino), i_cnt (0L),
i_lock_cnt (0)
{
HANDLE parent_dir;
More information about the Cygwin-cvs
mailing list