Git development
 help / color / mirror / Atom feed
* [PATCH 4/6] Don't use struct stat's st_blocks member on Haiku
@ 2008-08-17  8:59 Andreas Färber
  2008-08-17  9:28 ` Jakub Narebski
  2008-08-17  9:47 ` [PATCH] compat: introduce stat_to_kilobytes Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Andreas Färber @ 2008-08-17  8:59 UTC (permalink / raw)
  To: git, gitster

Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>
---
BeOS didn't have that field, so neither has Haiku currently.
It is part of the optional XSI POSIX feature.

  Makefile                |    4 ++++
  builtin-count-objects.c |    4 ++++
  configure.ac            |    8 ++++++++
  3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 5dba2c7..a4d73fc 100644
--- a/Makefile
+++ b/Makefile
@@ -730,6 +730,7 @@ ifeq ($(uname_S),HP-UX)
  endif
  ifeq ($(uname_S),Haiku)
  	NO_IPV6 = YesPlease
+	NO_ST_BLOCKS_IN_STAT = YesPlease
  	EXTLIBS += -lnetwork
  endif
  ifneq (,$(findstring MINGW,$(uname_S)))
@@ -867,6 +868,9 @@ endif
  ifdef NO_D_INO_IN_DIRENT
  	BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
  endif
+ifdef NO_ST_BLOCKS_IN_STAT
+	BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STAT
+endif
  ifdef NO_C99_FORMAT
  	BASIC_CFLAGS += -DNO_C99_FORMAT
  endif
diff --git a/builtin-count-objects.c b/builtin-count-objects.c
index 91b5487..609c687 100644
--- a/builtin-count-objects.c
+++ b/builtin-count-objects.c
@@ -43,7 +43,11 @@ static void count_objects(DIR *d, char *path, int  
len, int verbose,
  			if (lstat(path, &st) || !S_ISREG(st.st_mode))
  				bad = 1;
  			else
+#ifdef NO_ST_BLOCKS_IN_STAT
+				(*loose_size) += (st.st_size + 511) / 512;
+#else
  				(*loose_size) += xsize_t(st.st_blocks);
+#endif
  		}
  		if (bad) {
  			if (verbose) {
diff --git a/configure.ac b/configure.ac
index 75ec83a..09d18ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,6 +281,14 @@ AC_CHECK_MEMBER(struct dirent.d_type,
  [#include <dirent.h>])
  AC_SUBST(NO_D_TYPE_IN_DIRENT)
  #
+# Define NO_ST_BLOCKS_IN_STAT if your platform does not have  
st_blocks in
+# struct stat (BeOS, Haiku).
+AC_CHECK_MEMBER(struct stat.st_blocks,
+[NO_ST_BLOCKS_IN_STAT=],
+[NO_ST_BLOCKS_IN_STAT=YesPlease],
+[#include <sys/stat.h>])
+AC_SUBST(NO_ST_BLOCKS_IN_STAT)
+#
  # Define NO_SOCKADDR_STORAGE if your platform does not have struct
  # sockaddr_storage.
  AC_CHECK_TYPE(struct sockaddr_storage,
-- 
1.6.0.rc3.32.g8aaa

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-08-19  8:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-17  8:59 [PATCH 4/6] Don't use struct stat's st_blocks member on Haiku Andreas Färber
2008-08-17  9:28 ` Jakub Narebski
2008-08-17  9:47 ` [PATCH] compat: introduce stat_to_kilobytes Junio C Hamano
2008-08-17 17:27   ` Andreas Färber
2008-08-18 19:57   ` [PATCH 1/2] " Johannes Sixt
2008-08-18 20:01     ` [PATCH 2/2] Revert "Windows: Use a customized struct stat that also has the st_blocks member." Johannes Sixt
2008-08-18 20:44       ` Junio C Hamano
2008-08-18 20:40     ` [PATCH 1/2] compat: introduce stat_to_kilobytes Junio C Hamano
2008-08-19  7:31       ` Junio C Hamano
2008-08-19  8:39     ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox