https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=008f8bfba19c65312237ba6493e34877a4b7a6bd
commit 008f8bfba19c65312237ba6493e34877a4b7a6bd Author: Corinna Vinschen <[email protected]> AuthorDate: Wed Nov 26 11:23:30 2025 +0100 Commit: Corinna Vinschen <[email protected]> CommitDate: Wed Nov 26 14:00:26 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 <[email protected]> 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 5c60f628b397..ee79af3c932a 100644 --- a/winsup/cygwin/flock.cc +++ b/winsup/cygwin/flock.cc @@ -276,7 +276,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) @@ -287,19 +288,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); @@ -508,7 +512,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;
