[前][次][番号順一覧][スレッド一覧]

ruby-changes:33659

From: kazu <ko1@a...>
Date: Tue, 29 Apr 2014 04:35:45 +0900 (JST)
Subject: [ruby-changes:33659] kazu:r45740 (trunk): new macros for statfs_t

kazu	2014-04-29 04:35:42 +0900 (Tue, 29 Apr 2014)

  New Revision: 45740

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45740

  Log:
    new macros for statfs_t
    
    * file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for
      statfs_t.
    * file.c (HAVE_STRUCT_STATFS_T_F_TYPE): ditto.
    
    * file.c (rb_io_statfs): check FSTATFS macro only instead of
      HAVE_FSTATFS and HAVE_FSTATVFS.
    
    * file.c (statfs_type): use new macro.
    * file.c (statfs_fstypename): ditto.
    * file.c (statfs_inspect): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/file.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45739)
+++ ChangeLog	(revision 45740)
@@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr 29 04:29:05 2014  Kazuhiro NISHIYAMA  <zn@m...>
+
+	* file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for
+	  statfs_t.
+	* file.c (HAVE_STRUCT_STATFS_T_F_TYPE): ditto.
+
+	* file.c (rb_io_statfs): check FSTATFS macro only instead of
+	  HAVE_FSTATFS and HAVE_FSTATVFS.
+
+	* file.c (statfs_type): use new macro.
+	* file.c (statfs_fstypename): ditto.
+	* file.c (statfs_inspect): ditto.
+
 Tue Apr 29 00:20:26 2014  Rajarshi Das  <rajarshid@c...>
 
 	* bootstraptest/test_literal.rb: fix typo of "dynamic".  [ci skip]
Index: file.c
===================================================================
--- file.c	(revision 45739)
+++ file.c	(revision 45740)
@@ -72,9 +72,21 @@ int flock(int, int); https://github.com/ruby/ruby/blob/trunk/file.c#L72
 #ifdef HAVE_STRUCT_STATFS
 typedef struct statfs statfs_t;
 #define STATFS(f, s) statfs((f), (s))
+#ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME
+#define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_TYPE
+#define HAVE_STRUCT_STATFS_T_F_TYPE 1
+#endif
 #elif defined(HAVE_STRUCT_STATVFS)
 typedef struct statvfs statfs_t;
 #define STATFS(f, s) statvfs((f), (s))
+#ifdef HAVE_STRUCT_STATVFS_F_FSTYPENAME
+#define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
+#endif
+#ifdef HAVE_STRUCT_STATVFS_F_TYPE
+#define HAVE_STRUCT_STATFS_T_F_TYPE 1
+#endif
 #else
 # define WITHOUT_STATFS
 #endif
@@ -1135,13 +1147,13 @@ rb_io_statfs(VALUE obj) https://github.com/ruby/ruby/blob/trunk/file.c#L1147
 {
     rb_io_t *fptr;
     statfs_t st;
-#if !defined(HAVE_FSTATFS) && !defined(HAVE_FSTATVFS)
+#ifndef FSTATFS
     VALUE path;
 #endif
     int ret;
 
     GetOpenFile(obj, fptr);
-#if defined(HAVE_FSTATFS) || defined(HAVE_FSTATVFS)
+#ifdef FSTATFS
     ret = FSTATFS(fptr->fd, &st);
 #else
     path = rb_str_encode_ospath(fptr->pathv);
@@ -5443,7 +5455,7 @@ rb_statfs_init_copy(VALUE copy, VALUE or https://github.com/ruby/ruby/blob/trunk/file.c#L5455
     return copy;
 }
 
-#ifdef HAVE_STRUCT_STATFS_F_TYPE
+#ifdef HAVE_STRUCT_STATFS_T_F_TYPE
 /*
  *  call-seq:
  *     st.type    -> fixnum
@@ -5549,7 +5561,7 @@ statfs_ffree(VALUE self) https://github.com/ruby/ruby/blob/trunk/file.c#L5561
     return LL2NUM(get_statfs(self)->f_ffree);
 }
 
-#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
+#ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
 /*
  *  call-seq:
  *     st.fstypename    -> string
@@ -5591,10 +5603,10 @@ statfs_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/file.c#L5603
 {
     statfs_t *st = get_statfs(self);
     return rb_sprintf("#<%"PRIsVALUE" "
-#ifdef HAVE_STRUCT_STATFS_F_TYPE
+#ifdef HAVE_STRUCT_STATFS_T_F_TYPE
 		      "type=%ld"
 #endif
-#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
+#ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
 		      "(%s)"
 #endif
 		      ", bsize=%ld"
@@ -5602,10 +5614,10 @@ statfs_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/file.c#L5614
 		      ", files=%"PRI_LL_PREFIX"d/%"PRI_LL_PREFIX"d"
 		      ">",
 		      rb_obj_class(self),
-#ifdef HAVE_STRUCT_STATFS_F_TYPE
+#ifdef HAVE_STRUCT_STATFS_T_F_TYPE
 		      (long)st->f_type,
 #endif
-#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
+#ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
 		      st->f_fstypename,
 #endif
 		      (long)st->f_bsize,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]