mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fs.c: fix f_type
* ext/-test-/file/fs.c (get_fsname): try magic number only if f_type is included. [ruby-dev:48913] [Bug #11000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8d43213467
commit
526b12964f
2 changed files with 16 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Mar 25 17:03:08 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/-test-/file/fs.c (get_fsname): try magic number only if
|
||||||
|
f_type is included. [ruby-dev:48913] [Bug #11000]
|
||||||
|
|
||||||
Wed Mar 25 11:20:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Mar 25 11:20:40 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* benchmark/bm_hash_aref_flo.rb: make more realistic data.
|
* benchmark/bm_hash_aref_flo.rb: make more realistic data.
|
||||||
|
|
|
@ -12,21 +12,24 @@
|
||||||
typedef struct statfs statfs_t;
|
typedef struct statfs statfs_t;
|
||||||
# define STATFS(f, s) statfs((f), (s))
|
# define STATFS(f, s) statfs((f), (s))
|
||||||
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
||||||
|
# if defined HAVE_STRUCT_STATFS_F_TYPE
|
||||||
|
# define HAVE_STRUCT_STATFS_T_F_TYPE 1
|
||||||
|
# endif
|
||||||
#elif defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) /* NetBSD */
|
#elif defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) /* NetBSD */
|
||||||
typedef struct statvfs statfs_t;
|
typedef struct statvfs statfs_t;
|
||||||
# define STATFS(f, s) statvfs((f), (s))
|
# define STATFS(f, s) statvfs((f), (s))
|
||||||
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
||||||
|
# if defined HAVE_STRUCT_STATVFS_F_TYPE
|
||||||
|
# define HAVE_STRUCT_STATFS_T_F_TYPE 1
|
||||||
|
# endif
|
||||||
#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) /* AIX, HP-UX, Solaris */
|
#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) /* AIX, HP-UX, Solaris */
|
||||||
typedef struct statvfs statfs_t;
|
typedef struct statvfs statfs_t;
|
||||||
# define STATFS(f, s) statvfs((f), (s))
|
# define STATFS(f, s) statvfs((f), (s))
|
||||||
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
||||||
# define f_fstypename f_basetype
|
# define f_fstypename f_basetype
|
||||||
#elif defined HAVE_STRUCT_STATFS_F_TYPE
|
# if defined HAVE_STRUCT_STATVFS_F_TYPE
|
||||||
typedef struct statfs statfs_t;
|
# define HAVE_STRUCT_STATFS_T_F_TYPE 1
|
||||||
# define STATFS(f, s) statfs((f), (s))
|
# endif
|
||||||
#elif defined HAVE_STRUCT_STATVFS_F_TYPE
|
|
||||||
typedef struct statvfs statfs_t;
|
|
||||||
# define STATFS(f, s) statvfs((f), (s))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
@ -45,6 +48,7 @@ get_fsname(VALUE self, VALUE str)
|
||||||
if (st.f_fstypename[0])
|
if (st.f_fstypename[0])
|
||||||
return CSTR(st.f_fstypename);
|
return CSTR(st.f_fstypename);
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef HAVE_STRUCT_STATFS_T_F_TYPE
|
||||||
switch (st.f_type) {
|
switch (st.f_type) {
|
||||||
case 0x9123683E: /* BTRFS_SUPER_MAGIC */
|
case 0x9123683E: /* BTRFS_SUPER_MAGIC */
|
||||||
return CSTR("btrfs");
|
return CSTR("btrfs");
|
||||||
|
@ -57,6 +61,7 @@ get_fsname(VALUE self, VALUE str)
|
||||||
case 0x01021994: /* TMPFS_MAGIC */
|
case 0x01021994: /* TMPFS_MAGIC */
|
||||||
return CSTR("tmpfs");
|
return CSTR("tmpfs");
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue