mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: add configure.in checks for fiemap.h and magic.h
This commit is contained in:
parent
61cb58e549
commit
309bdfa224
2
configure
vendored
2
configure
vendored
@ -5875,7 +5875,7 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
for ac_header in termios.h sys/statvfs.h sys/timerfd.h
|
for ac_header in termios.h sys/statvfs.h sys/timerfd.h linux/magic.h linux/fiemap.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
|
@ -103,7 +103,7 @@ AC_CHECK_HEADERS([assert.h ctype.h dirent.h errno.h fcntl.h float.h \
|
|||||||
sys/time.h sys/types.h sys/utsname.h sys/wait.h time.h \
|
sys/time.h sys/types.h sys/utsname.h sys/wait.h time.h \
|
||||||
unistd.h], , [AC_MSG_ERROR(bailing out)])
|
unistd.h], , [AC_MSG_ERROR(bailing out)])
|
||||||
|
|
||||||
AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h)
|
AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h linux/magic.h linux/fiemap.h)
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
linux*)
|
linux*)
|
||||||
|
@ -264,9 +264,15 @@
|
|||||||
/* Define to 1 if you have the <limits.h> header file. */
|
/* Define to 1 if you have the <limits.h> header file. */
|
||||||
#undef HAVE_LIMITS_H
|
#undef HAVE_LIMITS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <linux/fiemap.h> header file. */
|
||||||
|
#undef HAVE_LINUX_FIEMAP_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <linux/fs.h> header file. */
|
/* Define to 1 if you have the <linux/fs.h> header file. */
|
||||||
#undef HAVE_LINUX_FS_H
|
#undef HAVE_LINUX_FS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <linux/magic.h> header file. */
|
||||||
|
#undef HAVE_LINUX_MAGIC_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <locale.h> header file. */
|
/* Define to 1 if you have the <locale.h> header file. */
|
||||||
#undef HAVE_LOCALE_H
|
#undef HAVE_LOCALE_H
|
||||||
|
|
||||||
|
@ -21,9 +21,18 @@
|
|||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/vfs.h> /* fstatfs */
|
#include <sys/vfs.h> /* fstatfs */
|
||||||
#include <linux/fs.h> /* FS_IOC_FIEMAP */
|
|
||||||
#include <linux/fiemap.h> /* fiemap */
|
#ifdef __linux__
|
||||||
#include <linux/magic.h> /* BTRFS_SUPER_MAGIC */
|
#include <linux/fs.h> /* FS_IOC_FIEMAP */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LINUX_FIEMAP_H
|
||||||
|
#include <linux/fiemap.h> /* fiemap */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LINUX_MAGIC_H
|
||||||
|
#include <linux/magic.h> /* BTRFS_SUPER_MAGIC */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DM_STATS_REGION_NOT_PRESENT UINT64_MAX
|
#define DM_STATS_REGION_NOT_PRESENT UINT64_MAX
|
||||||
#define DM_STATS_GROUP_NOT_PRESENT DM_STATS_GROUP_NONE
|
#define DM_STATS_GROUP_NOT_PRESENT DM_STATS_GROUP_NONE
|
||||||
@ -4064,6 +4073,7 @@ int dm_stats_get_group_descriptor(const struct dm_stats *dms,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LINUX_FIEMAP_H
|
||||||
/*
|
/*
|
||||||
* Group a table of region_ids corresponding to the extents of a file.
|
* Group a table of region_ids corresponding to the extents of a file.
|
||||||
*/
|
*/
|
||||||
@ -4258,6 +4268,7 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd,
|
|||||||
struct statfs fsbuf;
|
struct statfs fsbuf;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
|
#ifdef BTRFS_SUPER_MAGIC
|
||||||
if (fstatfs(fd, &fsbuf)) {
|
if (fstatfs(fd, &fsbuf)) {
|
||||||
log_error("fstatfs failed for fd %d", fd);
|
log_error("fstatfs failed for fd %d", fd);
|
||||||
return 0;
|
return 0;
|
||||||
@ -4268,6 +4279,7 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd,
|
|||||||
"physical FIEMAP extent data.");
|
"physical FIEMAP extent data.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fstat(fd, &buf)) {
|
if (fstat(fd, &buf)) {
|
||||||
log_error("fstat failed for fd %d", fd);
|
log_error("fstat failed for fd %d", fd);
|
||||||
@ -4360,6 +4372,17 @@ out:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* HAVE_LINUX_FIEMAP */
|
||||||
|
uint64_t *dm_stats_create_regions_from_fd(struct dm_stats *dms, int fd,
|
||||||
|
int group, int precise,
|
||||||
|
struct dm_histogram *bounds,
|
||||||
|
const char *alias)
|
||||||
|
{
|
||||||
|
log_error("File mapping requires FIEMAP ioctl support.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_LINUX_FIEMAP */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Backward compatible dm_stats_create_region() implementations.
|
* Backward compatible dm_stats_create_region() implementations.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user