{"thread":{"id":"59829","subject":"[PATCH] statinfo.h: move DTYPE defines from dir.h","startedAt":"2023-06-02T18:46:56Z","lastAt":"2023-06-12T18:00:16Z","messageCount":12,"participants":["Aleajndro R Sedeño","Alejandro Sedeño","Eric Sunshine","Alejandro R Sedeño","Elijah Newren","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"477974","messageId":"20230602184557.1445044-1-asedeno@google.com","threadId":"59829","inReplyTo":null,"subject":"[PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Aleajndro R Sedeño","fromEmail":"asedeno@google.com","sentAt":"2023-06-02T18:45:57Z","receivedAt":"2023-06-02T18:46:56Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"From: Alejandro R. Sedeño <asedeno@mit.edu>\n\nThese definitions are used in cache.h, which can't include dir.h\nwithout causing name-info.cc to have two definitions of\n`struct dir_entry`.\n\nBoth dir.h and cache.h include statinfo.h, and this seems a reasonable\nplace for these definitions.\n\nThis change fixes a broken build issue on old SunOS.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nSigned-off-by: Alejandro R Sedeño <asedeno@google.com>\n---\n dir.h      | 14 --------------\n statinfo.h | 14 ++++++++++++++\n 2 files changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/dir.h b/dir.h\nindex 79b85a01ee..d65a40126c 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n \treturn path_match_flags(path, what | PATH_MATCH_NATIVE);\n }\n \n-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n-#define DTYPE(de)\t((de)->d_type)\n-#else\n-#undef DT_UNKNOWN\n-#undef DT_DIR\n-#undef DT_REG\n-#undef DT_LNK\n-#define DT_UNKNOWN\t0\n-#define DT_DIR\t\t1\n-#define DT_REG\t\t2\n-#define DT_LNK\t\t3\n-#define DTYPE(de)\tDT_UNKNOWN\n-#endif\n-\n #endif\ndiff --git a/statinfo.h b/statinfo.h\nindex e49e3054ea..fe8df633a4 100644\n--- a/statinfo.h\n+++ b/statinfo.h\n@@ -21,4 +21,18 @@ struct stat_data {\n \tunsigned int sd_size;\n };\n \n+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n+#define DTYPE(de)\t((de)->d_type)\n+#else\n+#undef DT_UNKNOWN\n+#undef DT_DIR\n+#undef DT_REG\n+#undef DT_LNK\n+#define DT_UNKNOWN\t0\n+#define DT_DIR\t\t1\n+#define DT_REG\t\t2\n+#define DT_LNK\t\t3\n+#define DTYPE(de)\tDT_UNKNOWN\n+#endif\n+\n #endif\n-- \n2.41.0.rc2.161.g9c6817b8e7-goog\n\n"},{"id":"477975","messageId":"CALVMLfJt7n_KxMY7x6d8VMtYY83ai24cwJPTEbeJwH+up17woA@mail.gmail.com","threadId":"59829","inReplyTo":"20230602184557.1445044-1-asedeno@google.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Alejandro Sedeño","fromEmail":"asedeno@google.com","sentAt":"2023-06-02T18:50:40Z","receivedAt":"2023-06-02T18:51:07Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"And today is the day I notice I misspelled my name in my git sendmail\nconfig at work. Cool. (Fixed.)\n\n-Alejandro\n\n\nOn Fri, Jun 2, 2023 at 2:46 PM Aleajndro R Sedeño <asedeno@google.com> wrote:\n>\n> From: Alejandro R. Sedeño <asedeno@mit.edu>\n>\n> These definitions are used in cache.h, which can't include dir.h\n> without causing name-info.cc to have two definitions of\n> `struct dir_entry`.\n>\n> Both dir.h and cache.h include statinfo.h, and this seems a reasonable\n> place for these definitions.\n>\n> This change fixes a broken build issue on old SunOS.\n>\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n> ---\n>  dir.h      | 14 --------------\n>  statinfo.h | 14 ++++++++++++++\n>  2 files changed, 14 insertions(+), 14 deletions(-)\n>\n> diff --git a/dir.h b/dir.h\n> index 79b85a01ee..d65a40126c 100644\n> --- a/dir.h\n> +++ b/dir.h\n> @@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n>         return path_match_flags(path, what | PATH_MATCH_NATIVE);\n>  }\n>\n> -#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n> -#define DTYPE(de)      ((de)->d_type)\n> -#else\n> -#undef DT_UNKNOWN\n> -#undef DT_DIR\n> -#undef DT_REG\n> -#undef DT_LNK\n> -#define DT_UNKNOWN     0\n> -#define DT_DIR         1\n> -#define DT_REG         2\n> -#define DT_LNK         3\n> -#define DTYPE(de)      DT_UNKNOWN\n> -#endif\n> -\n>  #endif\n> diff --git a/statinfo.h b/statinfo.h\n> index e49e3054ea..fe8df633a4 100644\n> --- a/statinfo.h\n> +++ b/statinfo.h\n> @@ -21,4 +21,18 @@ struct stat_data {\n>         unsigned int sd_size;\n>  };\n>\n> +#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n> +#define DTYPE(de)      ((de)->d_type)\n> +#else\n> +#undef DT_UNKNOWN\n> +#undef DT_DIR\n> +#undef DT_REG\n> +#undef DT_LNK\n> +#define DT_UNKNOWN     0\n> +#define DT_DIR         1\n> +#define DT_REG         2\n> +#define DT_LNK         3\n> +#define DTYPE(de)      DT_UNKNOWN\n> +#endif\n> +\n>  #endif\n> --\n> 2.41.0.rc2.161.g9c6817b8e7-goog\n>\n"},{"id":"477977","messageId":"CAPig+cS0sGYiCa9Og-f-UL=pZo9OAz587UsdX69BCf7hraHWFA@mail.gmail.com","threadId":"59829","inReplyTo":"20230602184557.1445044-1-asedeno@google.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2023-06-02T19:06:36Z","receivedAt":"2023-06-02T19:06:53Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 2, 2023 at 3:03 PM Aleajndro R Sedeño <asedeno@google.com> wrote:\n> These definitions are used in cache.h, which can't include dir.h\n> without causing name-info.cc to have two definitions of\n> `struct dir_entry`.\n\nWhat is `name-info.cc`?\n\n> Both dir.h and cache.h include statinfo.h, and this seems a reasonable\n> place for these definitions.\n>\n> This change fixes a broken build issue on old SunOS.\n>\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n"},{"id":"477981","messageId":"CALVMLfLw4P=VnBOYA-WbHRNPZiAiO05h4k+cSvPJuaqkjgp5ew@mail.gmail.com","threadId":"59829","inReplyTo":"CAPig+cS0sGYiCa9Og-f-UL=pZo9OAz587UsdX69BCf7hraHWFA@mail.gmail.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Alejandro Sedeño","fromEmail":"asedeno@google.com","sentAt":"2023-06-02T19:21:28Z","receivedAt":"2023-06-02T19:21:49Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"That is a valid question, and it's another typo. I meant name-hash.c.\n\n-Alejandro\n\nOn Fri, Jun 2, 2023 at 3:06 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> On Fri, Jun 2, 2023 at 3:03 PM Aleajndro R Sedeño <asedeno@google.com> wrote:\n> > These definitions are used in cache.h, which can't include dir.h\n> > without causing name-info.cc to have two definitions of\n> > `struct dir_entry`.\n>\n> What is `name-info.cc`?\n>\n> > Both dir.h and cache.h include statinfo.h, and this seems a reasonable\n> > place for these definitions.\n> >\n> > This change fixes a broken build issue on old SunOS.\n> >\n> > Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> > Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n"},{"id":"477982","messageId":"20230602192700.1548636-1-asedeno@google.com","threadId":"59829","inReplyTo":"CALVMLfLw4P=VnBOYA-WbHRNPZiAiO05h4k+cSvPJuaqkjgp5ew@mail.gmail.com","subject":"[PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Alejandro R Sedeño","fromEmail":"asedeno@google.com","sentAt":"2023-06-02T19:27:00Z","receivedAt":"2023-06-02T19:27:11Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"From: Alejandro R. Sedeño <asedeno@mit.edu>\n\nThese definitions are used in cache.h, which can't include dir.h\nwithout causing name-hash.c to have two definitions of\n`struct dir_entry`.\n\nBoth dir.h and cache.h include statinfo.h, and this seems a reasonable\nplace for these definitions.\n\nThis change fixes a broken build issue on old SunOS.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nSigned-off-by: Alejandro R Sedeño <asedeno@google.com>\n---\n dir.h      | 14 --------------\n statinfo.h | 14 ++++++++++++++\n 2 files changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/dir.h b/dir.h\nindex 79b85a01ee..d65a40126c 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n \treturn path_match_flags(path, what | PATH_MATCH_NATIVE);\n }\n \n-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n-#define DTYPE(de)\t((de)->d_type)\n-#else\n-#undef DT_UNKNOWN\n-#undef DT_DIR\n-#undef DT_REG\n-#undef DT_LNK\n-#define DT_UNKNOWN\t0\n-#define DT_DIR\t\t1\n-#define DT_REG\t\t2\n-#define DT_LNK\t\t3\n-#define DTYPE(de)\tDT_UNKNOWN\n-#endif\n-\n #endif\ndiff --git a/statinfo.h b/statinfo.h\nindex e49e3054ea..fe8df633a4 100644\n--- a/statinfo.h\n+++ b/statinfo.h\n@@ -21,4 +21,18 @@ struct stat_data {\n \tunsigned int sd_size;\n };\n \n+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n+#define DTYPE(de)\t((de)->d_type)\n+#else\n+#undef DT_UNKNOWN\n+#undef DT_DIR\n+#undef DT_REG\n+#undef DT_LNK\n+#define DT_UNKNOWN\t0\n+#define DT_DIR\t\t1\n+#define DT_REG\t\t2\n+#define DT_LNK\t\t3\n+#define DTYPE(de)\tDT_UNKNOWN\n+#endif\n+\n #endif\n-- \n2.41.0.rc2.161.g9c6817b8e7-goog\n\n"},{"id":"478004","messageId":"CABPp-BEH46_daydTZpt0YLXLDYEOOeBobuht3hUgJvucSyUKMA@mail.gmail.com","threadId":"59829","inReplyTo":"20230602192700.1548636-1-asedeno@google.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-06-03T01:47:05Z","receivedAt":"2023-06-03T01:47:23Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Jun 2, 2023 at 12:27 PM Alejandro R Sedeño <asedeno@google.com> wrote:\n>\n> From: Alejandro R. Sedeño <asedeno@mit.edu>\n>\n> These definitions are used in cache.h, which can't include dir.h\n> without causing name-hash.c to have two definitions of\n> `struct dir_entry`.\n\n...are _currently_ used in cache.h (your commit message is fine, just\npointing it out for below...)\n\n> Both dir.h and cache.h include statinfo.h, and this seems a reasonable\n> place for these definitions.\n>\n> This change fixes a broken build issue on old SunOS.\n\nMaintainer note for Junio: en/header-split-cache-h-part-3 moves the\ninline functions in cache.h that use the DT_* defines, but that series\nshould both textually and semantically merge cleanly with this change.\n(Just noting this for your peace of mind.)\n\nAfter en/header-split-cache-h-part-3 merges down, I might opt for a\ndifferent fix (I'm still mulling it over), but that other fix isn't\npossible until cache.h is split up more.  Alejandro's fix is the\ncleanest interim solution I can think of.\n\n\nReviewed-by: Elijah Newren <newren@gmail.com>\n"},{"id":"478007","messageId":"xmqqilc571hf.fsf@gitster.g","threadId":"59829","inReplyTo":"20230602192700.1548636-1-asedeno@google.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-03T01:56:12Z","receivedAt":"2023-06-03T01:56:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alejandro R Sedeño\" <asedeno@google.com> writes:\n\n> From: Alejandro R. Sedeño <asedeno@mit.edu>\n>\n> These definitions are used in cache.h, which can't include dir.h\n> without causing name-hash.c to have two definitions of\n> `struct dir_entry`.\n>\n> Both dir.h and cache.h include statinfo.h, and this seems a reasonable\n> place for these definitions.\n>\n> This change fixes a broken build issue on old SunOS.\n>\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n\nThis is a bit unusual; do you want to publish both names (I am\nassuming that they are the same single person)?\n\nI thought somebody in the earlier discussion identified the topic\nthat was problematic by bisecting.  It is a shame to lose that.\nPerhaps it is a good idea to rephrase the beginning of the proposed\ncommit log message to mention that, like\n\n    592fc5b3 (dir.h: move DTYPE defines from cache.h, 2023-04-22)\n    moved DTYPE macros from cache.h to dir.h, but are still used\n    by cache.h to implement ce_to_dtype(); but cache.h cannot\n    include dir.h because ...\n\nor something?\n\nWhy does name-hash.c end up with two definitions?  Aren't we\nproperly guarding against multiple inclusions with \n\n    #ifndef __DIR_H__\n    #define __DIR_H__\n\t...\n    struct dir_entry {\n\t...\n    };\n    #endif\n\nor is there something funny going on?\n\nThanks.\n"},{"id":"478009","messageId":"CABPp-BHZ6a8VEuK=miMAcBG9RbUz+epuQ+d1xvwbRj_tsnYqcQ@mail.gmail.com","threadId":"59829","inReplyTo":"xmqqilc571hf.fsf@gitster.g","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-06-03T02:04:31Z","receivedAt":"2023-06-03T02:04:49Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Jun 2, 2023 at 6:56 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Why does name-hash.c end up with two definitions?  Aren't we\n> properly guarding against multiple inclusions with\n>\n>     #ifndef __DIR_H__\n>     #define __DIR_H__\n>         ...\n>     struct dir_entry {\n>         ...\n>     };\n>     #endif\n>\n> or is there something funny going on?\n\nThere are two _different_ things named \"struct dir_entry\" in the codebase:\n\ndir.h:struct dir_entry {\ndir.h-  unsigned int len;\ndir.h-  char name[FLEX_ARRAY]; /* more */\ndir.h-};\n--\nname-hash.c:struct dir_entry {\nname-hash.c-    struct hashmap_entry ent;\nname-hash.c-    struct dir_entry *parent;\nname-hash.c-    int nr;\nname-hash.c-    unsigned int namelen;\nname-hash.c-    char name[FLEX_ARRAY];\nname-hash.c-};\n\nSo, name-hash.c cannot include anything that includes dir.h.\n"},{"id":"478011","messageId":"xmqq4jnp6zvv.fsf@gitster.g","threadId":"59829","inReplyTo":"CABPp-BHZ6a8VEuK=miMAcBG9RbUz+epuQ+d1xvwbRj_tsnYqcQ@mail.gmail.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-03T02:30:44Z","receivedAt":"2023-06-03T02:30:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> There are two _different_ things named \"struct dir_entry\" in the codebase:\n\nIn the longer term, we should rename such a local type to avoid name\nclashes with the global one.  But I of course am OK to leave it\noutside the topic to clean it up.\n\nIn any case, it is worth saying in the proposed log message why\nname-hash cannot use cache.h if we make it include dir.h; it is easy\nto do so (i.e. \"it has its own 'dir_entry' that is used for other\npurpose\").\n\nThanks.\n\n"},{"id":"478012","messageId":"CALVMLfK4zD4ifgtQLfXBKFJH43hfLevmvVdsZ-ydKCt8kuPfqw@mail.gmail.com","threadId":"59829","inReplyTo":"xmqqilc571hf.fsf@gitster.g","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Alejandro Sedeño","fromEmail":"asedeno@google.com","sentAt":"2023-06-03T03:02:01Z","receivedAt":"2023-06-03T03:02:32Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"Sorry for the dupes; resending as plain-text as per list requirements.\n\nOn Fri, Jun 2, 2023 at 9:56 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"Alejandro R Sedeño\" <asedeno@google.com> writes:\n>\n> > …\n> > Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> > Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n\nThey are both me; it's my way of sticking with my historical personal\naddress and still attaching my work address for work reasons.\n\n\n>\n> This is a bit unusual; do you want to publish both names (I am\n> assuming that they are the same single person)?\n>\n> I thought somebody in the earlier discussion identified the topic\n> that was problematic by bisecting.  It is a shame to lose that.\n\nI identified it earlier, by inspection because the machine I build on\nis slow and this was easy to track down.\n\n> Perhaps it is a good idea to rephrase the beginning of the proposed\n> commit log message to mention that, like\n>\n>     592fc5b3 (dir.h: move DTYPE defines from cache.h, 2023-04-22)\n>     moved DTYPE macros from cache.h to dir.h, but are still used\n>     by cache.h to implement ce_to_dtype(); but cache.h cannot\n>     include dir.h because ...\n>\n> or something?\n\nHappy to rephrase.\n\n-Alejandro\n"},{"id":"478116","messageId":"20230606205935.3183276-1-asedeno@google.com","threadId":"59829","inReplyTo":"xmqqilc571hf.fsf@gitster.g","subject":"[PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Alejandro R Sedeño","fromEmail":"asedeno@google.com","sentAt":"2023-06-06T20:59:35Z","receivedAt":"2023-06-06T20:59:57Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"From: Alejandro R. Sedeño <asedeno@mit.edu>\n\n592fc5b3 (dir.h: move DTYPE defines from cache.h, 2023-04-22) moved\nDTYPE macros from cache.h to dir.h, but they are still used by cache.h\nto implement ce_to_dtype(); cache.h cannot include dir.h because that\nwould cause name-hash.c to have two different and conflicting\ndefinitions of `struct dir_entry`. (That should be separately fixed.)\n\nBoth dir.h and cache.h include statinfo.h, and this seems a reasonable\nplace for these definitions.\n\nThis change fixes a broken build issue on old SunOS.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nSigned-off-by: Alejandro R Sedeño <asedeno@google.com>\n---\n dir.h      | 14 --------------\n statinfo.h | 14 ++++++++++++++\n 2 files changed, 14 insertions(+), 14 deletions(-)\n\ndiff --git a/dir.h b/dir.h\nindex 79b85a01ee..d65a40126c 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n \treturn path_match_flags(path, what | PATH_MATCH_NATIVE);\n }\n \n-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n-#define DTYPE(de)\t((de)->d_type)\n-#else\n-#undef DT_UNKNOWN\n-#undef DT_DIR\n-#undef DT_REG\n-#undef DT_LNK\n-#define DT_UNKNOWN\t0\n-#define DT_DIR\t\t1\n-#define DT_REG\t\t2\n-#define DT_LNK\t\t3\n-#define DTYPE(de)\tDT_UNKNOWN\n-#endif\n-\n #endif\ndiff --git a/statinfo.h b/statinfo.h\nindex e49e3054ea..fe8df633a4 100644\n--- a/statinfo.h\n+++ b/statinfo.h\n@@ -21,4 +21,18 @@ struct stat_data {\n \tunsigned int sd_size;\n };\n \n+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n+#define DTYPE(de)\t((de)->d_type)\n+#else\n+#undef DT_UNKNOWN\n+#undef DT_DIR\n+#undef DT_REG\n+#undef DT_LNK\n+#define DT_UNKNOWN\t0\n+#define DT_DIR\t\t1\n+#define DT_REG\t\t2\n+#define DT_LNK\t\t3\n+#define DTYPE(de)\tDT_UNKNOWN\n+#endif\n+\n #endif\n-- \n2.41.0.rc2.161.g9c6817b8e7-goog\n\n"},{"id":"478289","messageId":"xmqqzg54a7di.fsf@gitster.g","threadId":"59829","inReplyTo":"20230606205935.3183276-1-asedeno@google.com","subject":"Re: [PATCH] statinfo.h: move DTYPE defines from dir.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-12T18:00:09Z","receivedAt":"2023-06-12T18:00:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alejandro R Sedeño\" <asedeno@google.com> writes:\n\n> From: Alejandro R. Sedeño <asedeno@mit.edu>\n>\n> 592fc5b3 (dir.h: move DTYPE defines from cache.h, 2023-04-22) moved\n> DTYPE macros from cache.h to dir.h, but they are still used by cache.h\n> to implement ce_to_dtype(); cache.h cannot include dir.h because that\n> would cause name-hash.c to have two different and conflicting\n> definitions of `struct dir_entry`. (That should be separately fixed.)\n>\n> Both dir.h and cache.h include statinfo.h, and this seems a reasonable\n> place for these definitions.\n>\n> This change fixes a broken build issue on old SunOS.\n>\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n> ---\n>  dir.h      | 14 --------------\n>  statinfo.h | 14 ++++++++++++++\n>  2 files changed, 14 insertions(+), 14 deletions(-)\n\nThanks.  Looking great.\n\n> diff --git a/dir.h b/dir.h\n> index 79b85a01ee..d65a40126c 100644\n> --- a/dir.h\n> +++ b/dir.h\n> @@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)\n>  \treturn path_match_flags(path, what | PATH_MATCH_NATIVE);\n>  }\n>  \n> -#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n> -#define DTYPE(de)\t((de)->d_type)\n> -#else\n> -#undef DT_UNKNOWN\n> -#undef DT_DIR\n> -#undef DT_REG\n> -#undef DT_LNK\n> -#define DT_UNKNOWN\t0\n> -#define DT_DIR\t\t1\n> -#define DT_REG\t\t2\n> -#define DT_LNK\t\t3\n> -#define DTYPE(de)\tDT_UNKNOWN\n> -#endif\n> -\n>  #endif\n> diff --git a/statinfo.h b/statinfo.h\n> index e49e3054ea..fe8df633a4 100644\n> --- a/statinfo.h\n> +++ b/statinfo.h\n> @@ -21,4 +21,18 @@ struct stat_data {\n>  \tunsigned int sd_size;\n>  };\n>  \n> +#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n> +#define DTYPE(de)\t((de)->d_type)\n> +#else\n> +#undef DT_UNKNOWN\n> +#undef DT_DIR\n> +#undef DT_REG\n> +#undef DT_LNK\n> +#define DT_UNKNOWN\t0\n> +#define DT_DIR\t\t1\n> +#define DT_REG\t\t2\n> +#define DT_LNK\t\t3\n> +#define DTYPE(de)\tDT_UNKNOWN\n> +#endif\n> +\n>  #endif\n"}]}