From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E29DD3857C52; Thu, 1 Feb 2024 11:39:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E29DD3857C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706787558; bh=KL/sCIh7vFxOheyEKNXNqW55CN2WvkvP3JjponbSEM8=; h=From:To:Subject:Date:From; b=mBRDjNnnbr7lHZd4mwlS54X4xf1K1wAZNB/CfqHymteMD7YHgiJ44WC0tDkjL7x6G qORhYujAsYiioyTcoRGyZgMygEr0iTWNuSiGy/RvNemL7puD7ZzF1fhfzaNRafakFs yvr83Iib5JuuPvq2/BxP1K5PK/DGFYj/nNlCCXLo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: dirent.h: make definition of struct __DIR opaque X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: d72be712aa1e88f20a2cc0606c6d7b0928923848 X-Git-Newrev: 5353cb8ef8a5cf411ee3c3518edfd6f472abbe58 Message-Id: <20240201113918.E29DD3857C52@sourceware.org> Date: Thu, 1 Feb 2024 11:39:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D5353cb8ef8a= 5cf411ee3c3518edfd6f472abbe58 commit 5353cb8ef8a5cf411ee3c3518edfd6f472abbe58 Author: Corinna Vinschen AuthorDate: Tue Jan 23 16:09:02 2024 +0100 Commit: Corinna Vinschen CommitDate: Wed Jan 31 20:11:57 2024 +0100 Cygwin: dirent.h: make definition of struct __DIR opaque =20 The content of DIR should never have been exposed into userspace. Move struct __DIR to local dirent.h and only keep forward declaration in exported dirent.h. =20 This allows to tweak the structure in future, for instance, to add thread-safety. =20 Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/include/sys/dirent.h | 18 ++---------------- winsup/cygwin/local_includes/dirent.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys= /dirent.h index 668c870295b4..dae324a7f6f6 100644 --- a/winsup/cygwin/include/sys/dirent.h +++ b/winsup/cygwin/include/sys/dirent.h @@ -1,4 +1,4 @@ -/* Posix dirent.h for WIN32. +/* Posix dirent.h =20 This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -41,21 +41,7 @@ struct dirent =20 #define d_fileno d_ino /* BSD compatible definition */ =20 -#define __DIRENT_COOKIE 0xcdcd8484 - -typedef struct __DIR -{ - /* This is first to set alignment in non _LIBC case. */ - unsigned long __d_cookie; - struct dirent *__d_dirent; - char *__d_dirname; /* directory name with trailing '*' */ - __int32_t __d_position; /* used by telldir/seekdir */ - int __d_fd; - uintptr_t __d_internal; - void *__handle; - void *__fh; - unsigned __flags; -} DIR; +typedef struct __DIR DIR; =20 #if __BSD_VISIBLE #ifdef _DIRENT_HAVE_D_TYPE diff --git a/winsup/cygwin/local_includes/dirent.h b/winsup/cygwin/local_in= cludes/dirent.h new file mode 100644 index 000000000000..075b762ce922 --- /dev/null +++ b/winsup/cygwin/local_includes/dirent.h @@ -0,0 +1,30 @@ +/* dirent.h: define struct __DIR + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _CYGWIN_DIRENT_H +#define _CYGWIN_DIRENT_H + +#include_next + +#define __DIRENT_COOKIE 0xcdcd8484 + +struct __DIR +{ + /* This is first to set alignment in non _LIBC case. */ + unsigned long __d_cookie; + struct dirent *__d_dirent; + char *__d_dirname; /* directory name with trailing '*' */ + __int32_t __d_position; /* used by telldir/seekdir */ + int __d_fd; + uintptr_t __d_internal; + void *__handle; + void *__fh; + unsigned __flags; +}; + +#endif /* _CYGWIN_DIRENT_H */