1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2014-04-28 19:35:42 +00:00
parent c521d87f68
commit 7973883c3a
2 changed files with 33 additions and 8 deletions

View file

@ -1,3 +1,16 @@
Tue Apr 29 04:29:05 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* 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@cybage.com>
* bootstraptest/test_literal.rb: fix typo of "dynamic". [ci skip]

28
file.c
View file

@ -72,9 +72,21 @@ int flock(int, int);
#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)
{
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 orig)
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)
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)
{
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)
", 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,