📄 lustre-core.m4
字号:
#* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-#* vim:expandtab:shiftwidth=8:tabstop=8:## LC_CONFIG_SRCDIR## Wrapper for AC_CONFIG_SUBDIR#AC_DEFUN([LC_CONFIG_SRCDIR],[AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])])## LC_PATH_DEFAULTS## lustre specific paths#AC_DEFUN([LC_PATH_DEFAULTS],[# ptlrpc kernel build requires thisLUSTRE="$PWD/lustre"AC_SUBST(LUSTRE)# mount.lustrerootsbindir='/sbin'AC_SUBST(rootsbindir)demodir='$(docdir)/demo'AC_SUBST(demodir)pkgexampledir='${pkgdatadir}/examples'AC_SUBST(pkgexampledir)])## LC_TARGET_SUPPORTED## is the target os supported?#AC_DEFUN([LC_TARGET_SUPPORTED],[case $target_os in linux* | darwin*)$1 ;; *)$2 ;;esac])## LC_CONFIG_EXT3## that ext3 is enabled in the kernel#AC_DEFUN([LC_CONFIG_EXT3],[LB_LINUX_CONFIG([EXT3_FS],[],[ LB_LINUX_CONFIG([EXT3_FS_MODULE],[],[$2])])LB_LINUX_CONFIG([EXT3_FS_XATTR],[$1],[$3])])## LC_FSHOOKS## If we have (and can build) fshooks.h#AC_DEFUN([LC_FSHOOKS],[LB_CHECK_FILE([$LINUX/include/linux/fshooks.h],[ AC_MSG_CHECKING([if fshooks.h can be compiled]) LB_LINUX_TRY_COMPILE([ #include <linux/fshooks.h> ],[],[ AC_MSG_RESULT([yes]) ],[ AC_MSG_RESULT([no]) AC_MSG_WARN([You might have better luck with gcc 3.3.x.]) AC_MSG_WARN([You can set CC=gcc33 before running configure.]) AC_MSG_ERROR([Your compiler cannot build fshooks.h.]) ])$1],[$2])])## LC_STRUCT_KIOBUF## rh 2.4.18 has iobuf->dovary, but other kernels do not#AC_DEFUN([LC_STRUCT_KIOBUF],[AC_MSG_CHECKING([if struct kiobuf has a dovary field])LB_LINUX_TRY_COMPILE([ #include <linux/iobuf.h>],[ struct kiobuf iobuf; iobuf.dovary = 1;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])],[ AC_MSG_RESULT([no])])])## LC_FUNC_COND_RESCHED## cond_resched() was introduced in 2.4.20#AC_DEFUN([LC_FUNC_COND_RESCHED],[AC_MSG_CHECKING([if kernel offers cond_resched])LB_LINUX_TRY_COMPILE([ #include <linux/sched.h>],[ cond_resched();],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])],[ AC_MSG_RESULT([no])])])## LC_FUNC_ZAP_PAGE_RANGE## if zap_page_range() takes a vma arg#AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],[AC_MSG_CHECKING([if zap_page_range with vma parameter])ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter]) AC_MSG_RESULT([yes])else AC_MSG_RESULT([no])fi])## LC_FUNC_PDE## if proc_fs.h defines PDE()#AC_DEFUN([LC_FUNC_PDE],[AC_MSG_CHECKING([if kernel defines PDE])HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"if test "$HAVE_PDE" != 0 ; then AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE]) AC_MSG_RESULT([yes])else AC_MSG_RESULT([no])fi])## LC_FUNC_FILEMAP_FDATASYNC## if filemap_fdatasync() exists#AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],[AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])LB_LINUX_TRY_COMPILE([ #include <linux/fs.h>],[ int (*foo)(struct address_space *)= filemap_fdatawrite;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])],[ AC_MSG_RESULT([no])])])## LC_FUNC_DIRECT_IO## if direct_IO takes a struct file argument#AC_DEFUN([LC_FUNC_DIRECT_IO],[AC_MSG_CHECKING([if kernel passes struct file to direct_IO])HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"if test "$HAVE_DIO_FILE" != 0 ; then AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fi])## LC_HEADER_MM_INLINE## RHEL kernels define page_count in mm_inline.h#AC_DEFUN([LC_HEADER_MM_INLINE],[AC_MSG_CHECKING([if kernel has mm_inline.h header])LB_LINUX_TRY_COMPILE([ #include <linux/mm_inline.h>],[ #ifndef page_count #error mm_inline.h does not define page_count #endif],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])],[ AC_MSG_RESULT([no])])])## LC_STRUCT_INODE## if inode->i_alloc_sem exists#AC_DEFUN([LC_STRUCT_INODE],[AC_MSG_CHECKING([if struct inode has i_alloc_sem])LB_LINUX_TRY_COMPILE([ #include <linux/fs.h> #include <linux/version.h>],[ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24)) #error "down_read_trylock broken before 2.4.24" #endif struct inode i; return (char *)&i.i_alloc_sem - (char *)&i;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])],[ AC_MSG_RESULT([no])])])## LC_FUNC_REGISTER_CACHE## if register_cache() is defined by kernel#AC_DEFUN([LC_FUNC_REGISTER_CACHE],[AC_MSG_CHECKING([if kernel defines register_cache()])LB_LINUX_TRY_COMPILE([ #include <linux/list.h> #include <linux/cache_def.h>],[ struct cache_definition cache;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found]) AC_MSG_CHECKING([if kernel expects return from cache shrink function]) HAVE_CACHE_RETURN_INT="`grep -c 'int.*shrink' $LINUX/include/linux/cache_def.h`" if test "$HAVE_CACHE_RETURN_INT" != 0 ; then AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [kernel expects return from shrink_cache]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi],[ AC_MSG_RESULT([no])])])## LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP## check for our patched grab_cache_page_nowait_gfp() function#AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],[AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"if test "$HAVE_GCPN_GFP" != 0 ; then AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1, [kernel has grab_cache_page_nowait_gfp()]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fi])## LC_FUNC_DEV_SET_RDONLY## check for the old-style dev_set_rdonly which took an extra "devno" param# and can only set a single device to discard writes at one time#AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],[AC_MSG_CHECKING([if kernel has new dev_set_rdonly])LB_LINUX_TRY_COMPILE([ #include <linux/fs.h>],[ #ifndef HAVE_CLEAR_RDONLY_ON_PUT #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above. #endif],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])],[ AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre kernel patches from Lustre version 1.4.3 or above.])])])## LC_CONFIG_BACKINGFS## setup, check the backing filesystem#AC_DEFUN([LC_CONFIG_BACKINGFS],[BACKINGFS="ldiskfs"if test x$with_ldiskfs = xno ; then BACKINGFS="ext3" if test x$linux25$enable_server = xyesyes ; then AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.]) fi # --- Check that ext3 and ext3 xattr are enabled in the kernel LC_CONFIG_EXT3([],[ AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel]) ],[ AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel]) AC_MSG_WARN([This build may fail.]) ])else # ldiskfs is enabled LB_DEFINE_LDISKFS_OPTIONSfi #ldiskfsAC_MSG_CHECKING([which backing filesystem to use])AC_MSG_RESULT([$BACKINGFS])AC_SUBST(BACKINGFS)])## LC_CONFIG_PINGER## the pinger is temporary, until we have the recovery node in place#AC_DEFUN([LC_CONFIG_PINGER],[AC_MSG_CHECKING([whether to enable pinger support])AC_ARG_ENABLE([pinger], AC_HELP_STRING([--disable-pinger], [disable recovery pinger support]), [],[enable_pinger='yes'])AC_MSG_RESULT([$enable_pinger])if test x$enable_pinger != xno ; then AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)fi])## LC_CONFIG_CHECKSUM## do checksum of bulk data between client and OST#AC_DEFUN([LC_CONFIG_CHECKSUM],[AC_MSG_CHECKING([whether to enable data checksum support])AC_ARG_ENABLE([checksum], AC_HELP_STRING([--disable-checksum], [disable data checksum support]), [],[enable_checksum='yes'])AC_MSG_RESULT([$enable_checksum])if test x$enable_checksum != xno ; then AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)fi])## LC_CONFIG_HEALTH_CHECK_WRITE## Turn on the actual write to the disk#AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],[AC_MSG_CHECKING([whether to enable a write with the health check])AC_ARG_ENABLE([health-write], AC_HELP_STRING([--enable-health-write], [enable disk writes when doing health check]), [],[enable_health_write='no'])AC_MSG_RESULT([$enable_health_write])if test x$enable_health_write == xyes ; then AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)fi])## LC_CONFIG_LIBLUSTRE_RECOVERY#AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],[AC_MSG_CHECKING([whether to enable liblustre recovery support])AC_ARG_ENABLE([liblustre-recovery], AC_HELP_STRING([--disable-liblustre-recovery], [disable liblustre recovery support]), [],[enable_liblustre_recovery='yes'])AC_MSG_RESULT([$enable_liblustre_recovery])if test x$enable_liblustre_recovery != xno ; then AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)fi])## LC_CONFIG_OBD_BUFFER_SIZE## the maximum buffer size of lctl ioctls#AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],[AC_MSG_CHECKING([maximum OBD ioctl size])AC_ARG_WITH([obd-buffer-size], AC_HELP_STRING([--with-obd-buffer-size=[size]], [set lctl ioctl maximum bytes (default=8192)]), [ OBD_BUFFER_SIZE=$with_obd_buffer_size ],[ OBD_BUFFER_SIZE=8192 ])AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])])## LC_STRUCT_STATFS## AIX does not have statfs.f_namelen#AC_DEFUN([LC_STRUCT_STATFS],[AC_MSG_CHECKING([if struct statfs has a f_namelen field])LB_LINUX_TRY_COMPILE([ #include <linux/vfs.h>],[ struct statfs sfs; sfs.f_namelen = 1;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])],[ AC_MSG_RESULT([no])])])## LC_READLINK_SSIZE_T#AC_DEFUN([LC_READLINK_SSIZE_T],[AC_MSG_CHECKING([if readlink returns ssize_t])AC_TRY_COMPILE([ #include <unistd.h>],[ ssize_t readlink(const char *, char *, size_t);],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])],[ AC_MSG_RESULT([no])])])AC_DEFUN([LC_FUNC_PAGE_MAPPED],[AC_MSG_CHECKING([if kernel offers page_mapped])LB_LINUX_TRY_COMPILE([ #include <linux/mm.h>],[ page_mapped(NULL);],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])],[ AC_MSG_RESULT([no])])])AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],[AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])LB_LINUX_TRY_COMPILE([ #include <linux/fs.h>],[ struct file_operations fops; &fops.unlocked_ioctl;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])],[ AC_MSG_RESULT([no])])])AC_DEFUN([LC_FILEMAP_POPULATE],[AC_MSG_CHECKING([for exported filemap_populate])LB_LINUX_TRY_COMPILE([ #include <asm/page.h> #include <linux/mm.h>],[ filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])],[ AC_MSG_RESULT([no])])])AC_DEFUN([LC_D_ADD_UNIQUE],[AC_MSG_CHECKING([for d_add_unique])LB_LINUX_TRY_COMPILE([ #include <linux/dcache.h>],[ d_add_unique(NULL, NULL);],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])],[ AC_MSG_RESULT([no])])])AC_DEFUN([LC_BIT_SPINLOCK_H],[LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[ AC_MSG_CHECKING([if bit_spinlock.h can be compiled]) LB_LINUX_TRY_COMPILE([ #include <asm/processor.h> #include <linux/spinlock.h> #include <linux/bit_spinlock.h> ],[],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h]) ],[ AC_MSG_RESULT([no]) ])],[])])## LC_POSIX_ACL_XATTR## If we have xattr_acl.h #AC_DEFUN([LC_XATTR_ACL],[LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[ AC_MSG_CHECKING([if xattr_acl.h can be compiled]) LB_LINUX_TRY_COMPILE([ #include <linux/xattr_acl.h> ],[],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl]) ],[ AC_MSG_RESULT([no]) ])],[])])AC_DEFUN([LC_STRUCT_INTENT_FILE],[AC_MSG_CHECKING([if struct open_intent has a file field])LB_LINUX_TRY_COMPILE([ #include <linux/fs.h> #include <linux/namei.h>],[ struct open_intent intent; &intent.file;],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])],[ AC_MSG_RESULT([no])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -