Whamcloud - gitweb
LU-6245 tests: remove libcfs.h from test applications
[fs/lustre-release.git] / lustre / tests / check_fhandle_syscalls.c
index df7104c..4460dbf 100644 (file)
@@ -21,6 +21,9 @@
 
 /*
  * Copyright (C) 2013, DataDirect Networks, Inc.
+ *
+ * Copyright (c) 2014, Intel Corporation.
+ *
  * Author: Swapnil Pimpale <spimpale@ddn.com>
  */
 
@@ -40,7 +43,6 @@
 #include <sys/stat.h>
 #include <sys/syscall.h>
 
-#include <libcfs/libcfs.h>
 #include <lustre/lustre_user.h>
 
 #define MAX_HANDLE_SZ 128
 #if !defined(HAVE_FHANDLE_GLIBC_SUPPORT) && defined(HAVE_FHANDLE_SYSCALLS)
 /* Because the kernel supports this functions doesn't mean that glibc does.
  * Just in case we define what we need */
-struct file_handle
-{
-       unsigned int handle_bytes;
+struct file_handle {
+       __u32 handle_bytes;
        int handle_type;
-       /* File identifier.  */
+       /* file identifier */
        unsigned char f_handle[0];
 };
 
+#if defined(_ASM_X86_UNISTD_64_H)
+
+#ifndef __NR_name_to_handle_at
+#define __NR_name_to_handle_at 303
+#endif
+
+#ifndef __NR_open_by_handle_at
+#define __NR_open_by_handle_at 304
+#endif
+
+#elif defined(_ASM_X86_UNISTD_32_H)
+
+#ifndef __NR_name_to_handle_at
+#define __NR_name_to_handle_at 341
+#endif
+
+#ifndef __NR_open_by_handle_at
+#define __NR_open_by_handle_at 342
+#endif
+
+#else
+
 #ifndef __NR_name_to_handle_at
 #define __NR_name_to_handle_at 264
 #endif
@@ -64,6 +87,9 @@ struct file_handle
 #define __NR_open_by_handle_at 265
 #endif
 
+
+#endif
+
 static inline int
 name_to_handle_at(int mnt_fd, const char *filename, struct file_handle *fh,
                  int *mnt_id, int flags)