AC_SUBST(CCASFLAGS)
# everyone builds against lnet and lustre
-EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include"
+EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include/uapi -I$PWD/lustre/include"
AC_SUBST(EXTRA_KCFLAGS)
]) # LB_PROG_CC
#include <stdarg.h>
#include <stdint.h>
+#include <time.h>
+#include <unistd.h>
+#include <sys/types.h>
#include <linux/lustre/lustre_user.h>
#if defined(__cplusplus)
# define _LUSTRE_BARRIER_USER_H
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lustre/lustre_user.h>
-#else
-# include <linux/lustre/lustre_user.h>
-#endif
+#include <linux/lustre/lustre_user.h>
#define BARRIER_VERSION_V1 1
#define BARRIER_TIMEOUT_DEFAULT 30
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lustre/lustre_user.h>
-#else
-# include <linux/lustre/lustre_user.h>
-#endif
-
-/* Handle older distros */
-#ifndef __ALIGN_KERNEL
-# define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-# define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
-#endif
+#include <linux/lustre/lustre_user.h>
/** \defgroup cfg cfg
*
static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, __u32 index)
{
__u32 i;
- size_t offset;
+ __kernel_size_t offset;
__u32 bufcount;
if (!lcfg)
}
}
-static inline int lustre_cfg_sanity_check(void *buf, size_t len)
+static inline int lustre_cfg_sanity_check(void *buf, __kernel_size_t len)
{
struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
#define _UAPI_LUSTRE_FID_H_
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lustre/lustre_idl.h>
-#else
-# include <linux/lustre/lustre_idl.h>
-#endif
+#include <linux/lustre/lustre_idl.h>
/** returns fid object sequence */
static inline __u64 fid_seq(const struct lu_fid *fid)
* \param fid an igif to get inode number from.
* \return inode number for the igif.
*/
-static inline ino_t lu_igif_ino(const struct lu_fid *fid)
+static inline __kernel_ino_t lu_igif_ino(const struct lu_fid *fid)
{
return fid_seq(fid);
}
/* XXX: We use fiemap_extent::fe_reserved[0] */
#define fe_device fe_reserved[0]
-static inline size_t fiemap_count_to_size(size_t extent_count)
+static inline __kernel_size_t fiemap_count_to_size(size_t extent_count)
{
return sizeof(struct fiemap) + extent_count *
sizeof(struct fiemap_extent);
#include <asm/byteorder.h>
#include <linux/errno.h>
+#include <linux/fiemap.h>
#include <linux/types.h>
-
/*
* This is due to us being out of kernel and the way the OpenSFS branch
* handles CFLAGS.
*/
#ifdef __KERNEL__
# include <uapi/linux/lnet/lnet-types.h>
-# include <uapi/linux/lustre/lustre_user.h> /* Defn's shared with user-space. */
-# include <uapi/linux/lustre/lustre_ver.h>
#else
# include <linux/lnet/lnet-types.h>
-# include <linux/lustre/lustre_user.h>
-# include <linux/lustre/lustre_ver.h>
#endif
+#include <linux/lustre/lustre_user.h>
+#include <linux/lustre/lustre_ver.h>
#if defined(__cplusplus)
extern "C" {
return next;
}
-static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
+static inline __kernel_size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
{
- size_t size;
+ __kernel_size_t size;
if (attr & LUDA_TYPE) {
- const size_t align = sizeof(struct luda_type) - 1;
+ const __kernel_size_t align = sizeof(struct luda_type) - 1;
size = (sizeof(struct lu_dirent) + namelen + 1 + align) &
~align;
}
static inline __u32
-lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
+lov_mds_md_max_stripe_count(__kernel_size_t buf_size, __u32 lmm_magic)
{
switch (lmm_magic) {
case LOV_MAGIC_V1: {
**/
#define LUSTRE_FNV_1A_64_PRIME 0x100000001b3ULL
#define LUSTRE_FNV_1A_64_OFFSET_BIAS 0xcbf29ce484222325ULL
-static inline __u64 lustre_hash_fnv_1a_64(const void *buf, size_t size)
+static inline __u64 lustre_hash_fnv_1a_64(const void *buf, __kernel_size_t size)
{
__u64 hash = LUSTRE_FNV_1A_64_OFFSET_BIAS;
const unsigned char *p = buf;
- size_t i;
+ __kernel_size_t i;
for (i = 0; i < size; i++) {
hash ^= p[i];
#include <linux/ioctl.h>
#include <linux/kernel.h>
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lustre/lustre_idl.h>
-#else
-# include <linux/lustre/lustre_idl.h>
-# define __user
-#endif
+#include <linux/lustre/lustre_idl.h>
#if !defined(__KERNEL__) && !defined(LUSTRE_UTILS)
# error This file is for Lustre internal use only.
#endif
-/* Handle older distros */
-#ifndef __ALIGN_KERNEL
-# define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-# define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
+/*
+ * sparse kernel source annotations
+ */
+#ifndef __user
+#define __user
#endif
enum md_echo_cmd {
# define _LUSTRE_LFSCK_USER_H
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lustre/lustre_user.h>
-#else
-# include <linux/lustre/lustre_user.h>
-#endif
+#include <linux/lustre/lustre_user.h>
/**
* state machine:
#define _LUSTRE_LOG_USER_H
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-#include <uapi/linux/lustre/lustre_fid.h>
-#else
#include <linux/lustre/lustre_fid.h>
-#endif
/* Lustre logs use FIDs constructed from oi_id and oi_seq directly,
* without attempting to use the IGIF and IDIF ranges as is done
#include <linux/errno.h>
#include <linux/types.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-#include <uapi/linux/lustre/lustre_fid.h>
-#else
#include <linux/lustre/lustre_fid.h>
-#endif
static inline __u64 lmm_oi_id(const struct ost_id *oi)
{
* @{
*/
+#include <linux/fs.h>
+#include <linux/limits.h>
#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/quota.h>
#include <linux/types.h>
+#include <linux/unistd.h>
+#include <linux/lustre/lustre_fiemap.h>
-#ifdef __KERNEL__
-# include <linux/fs.h>
-# include <linux/quota.h>
-# include <linux/string.h> /* snprintf() */
-# include <linux/version.h>
-# include <uapi/linux/lustre/lustre_fiemap.h>
-#else /* !__KERNEL__ */
-# include <limits.h>
+#ifndef __KERNEL__
# include <stdbool.h>
# include <stdio.h> /* snprintf() */
-# include <stdint.h>
-# include <string.h>
-# define NEED_QUOTA_DEFS
-/* # include <sys/quota.h> - this causes complaints about caddr_t */
# include <sys/stat.h>
-# include <linux/lustre/lustre_fiemap.h>
# define FILEID_LUSTRE 0x97 /* for name_to_handle_at() (and llapi_fd2fid()) */
-#endif /* __KERNEL__ */
-
-/* Handle older distros */
-#ifndef __ALIGN_KERNEL
-# define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-# define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
-#endif
+#endif /* !__KERNEL__ */
#if defined(__cplusplus)
extern "C" {
#endif
+#ifdef __STRICT_ANSI__
+#define typeof __typeof__
+#endif
+
/*
* This is a temporary solution of adding quota type.
* Should be removed as soon as system header is updated.
extern char *mdt_hash_name[LMV_HASH_TYPE_MAX];
struct lustre_foreign_type {
- uint32_t lft_type;
- const char *lft_name;
+ __u32 lft_type;
+ const char *lft_name;
};
/**
#define LUSTRE_QUOTABLOCK_BITS 10
#define LUSTRE_QUOTABLOCK_SIZE (1 << LUSTRE_QUOTABLOCK_BITS)
-static inline __u64 lustre_stoqb(size_t space)
+static inline __u64 lustre_stoqb(__kernel_size_t space)
{
return (space + LUSTRE_QUOTABLOCK_SIZE - 1) >> LUSTRE_QUOTABLOCK_BITS;
}
};
struct sepol_downcall_data {
- __u32 sdd_magic;
- time_t sdd_sepol_mtime;
- __u16 sdd_sepol_len;
- char sdd_sepol[0];
+ __u32 sdd_magic;
+ __kernel_time_t sdd_sepol_mtime;
+ __u16 sdd_sepol_len;
+ char sdd_sepol[0];
};
#ifdef NEED_QUOTA_DEFS
static inline struct changelog_ext_extra_flags *changelog_rec_extra_flags(
const struct changelog_rec *rec);
-static inline size_t changelog_rec_offset(enum changelog_rec_flags crf,
+static inline __kernel_size_t changelog_rec_offset(enum changelog_rec_flags crf,
enum changelog_rec_extra_flags cref)
{
- size_t size = sizeof(struct changelog_rec);
+ __kernel_size_t size = sizeof(struct changelog_rec);
if (crf & CLF_RENAME)
size += sizeof(struct changelog_ext_rename);
return size;
}
-static inline size_t changelog_rec_size(const struct changelog_rec *rec)
+static inline __kernel_size_t changelog_rec_size(const struct changelog_rec *rec)
{
enum changelog_rec_extra_flags cref = CLFE_INVALID;
(enum changelog_rec_flags)rec->cr_flags, cref);
}
-static inline size_t changelog_rec_varsize(const struct changelog_rec *rec)
+static inline __kernel_size_t changelog_rec_varsize(const struct changelog_rec *rec)
{
return changelog_rec_size(rec) - sizeof(*rec) + rec->cr_namelen;
}
(enum changelog_rec_extra_flags)(cref & CLFE_SUPPORTED));
}
-static inline size_t changelog_rec_snamelen(const struct changelog_rec *rec)
+static inline __kernel_size_t changelog_rec_snamelen(const struct changelog_rec *rec)
{
return rec->cr_namelen - strlen(changelog_rec_name(rec)) - 1;
}
/**
* Compute the current length of the provided hsm_user_request. This returns -1
- * instead of an errno because ssize_t is defined to be only [ -1, SSIZE_MAX ]
+ * instead of an errno because __kernel_ssize_t is defined to be only
+ * [ -1, SSIZE_MAX ]
*
* return -1 on bounds check error.
*/
-static inline ssize_t hur_len(struct hsm_user_request *hur)
+static inline __kernel_size_t hur_len(struct hsm_user_request *hur)
{
__u64 size;
(__u64)hur->hur_request.hr_itemcount *
sizeof(hur->hur_user_item[0]) + hur->hur_request.hr_data_len;
- if ((ssize_t)size < 0)
+ if ((__kernel_ssize_t)size < 0)
return -1;
return size;
* \retval buffer
*/
static inline char *hai_dump_data_field(const struct hsm_action_item *hai,
- char *buffer, size_t len)
+ char *buffer, __kernel_size_t len)
{
int i;
int data_len;
/* Return pointer to first hai in action list */
static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal)
{
- size_t offset = __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8);
+ __kernel_size_t offset = __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8);
return (struct hsm_action_item *)(hal->hal_fsname + offset);
}
/* Return pointer to next hai */
static inline struct hsm_action_item * hai_next(struct hsm_action_item *hai)
{
- size_t offset = __ALIGN_KERNEL(hai->hai_len, 8);
+ __kernel_size_t offset = __ALIGN_KERNEL(hai->hai_len, 8);
return (struct hsm_action_item *)((char *)hai + offset);
}
/* Return size of an hsm_action_list */
-static inline size_t hal_size(struct hsm_action_list *hal)
+static inline __kernel_size_t hal_size(struct hsm_action_list *hal)
{
__u32 i;
- size_t sz;
+ __kernel_size_t sz;
struct hsm_action_item *hai;
sz = sizeof(*hal) + __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8);
export PARALLEL=${PARALLEL:-"no"}
TRACE=${TRACE:-""}
-LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
LUSTRE=${LUSTRE:-$(dirname $0)/..}
+LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
. $LUSTRE/tests/test-framework.sh
init_test_env $@
local prefix=/usr/include/lustre
local prog
+ # Oleg removes c files in his test rig so test if any c files exist
+ [ -z "$(ls -A $LUSTRE_TESTS_API_DIR)" ] && \
+ skip_env "Needed c test files are missing"
+
if ! [[ -d $prefix ]]; then
# Assume we're running in tree and fixup the include path.
extra_flags+=" -I$LUSTRE/../lnet/include/uapi -I$LUSTRE/include/uapi -I$LUSTRE/include"
fi
for prog in $LUSTRE_TESTS_API_DIR/*.c; do
- $CC -Wall -Werror $extra_flags -o $out $prog -llustreapi ||
+ $CC -Wall -Werror -std=c99 $extra_flags -o $out $prog -llustreapi ||
error "client api broken"
done
rm -f $out
continue # lustre_ioctl.h is internal header
fi
- $CC -Wall -Werror -include $header -c -x c /dev/null -o $out ||
+ $CC -Wall -Werror -std=c99 -include $header -c -x c /dev/null -o $out ||
error "cannot compile '$header'"
done
rm -f $out