Whamcloud - gitweb
LU-11783 utils: fix warnings when lustre_user.h included 76/33876/4
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 14 Dec 2018 22:53:25 +0000 (15:53 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 17 Dec 2018 19:34:48 +0000 (19:34 +0000)
Checking for lustre/lustre_user.h in a configure script
generates a warning because of the included <sys/quota.h>

  checking lustre/lustre_user.h usability... no
  checking lustre/lustre_user.h presence... yes
  WARNING: present but cannot be compiled
  WARNING: check for missing prerequisite headers?
  WARNING: see the Autoconf documentation
  WARNING: section "Present But Cannot Be Compiled"
  WARNING: proceeding with the preprocessor's result
  WARNING: in the future, the compiler will take precedence

Looking into config.log it shows:

  In file included from /usr/include/lustre/lustre_user.h:59,
                   from conftest.c:91:
  /usr/include/sys/quota.h:221: error: expected declaration
    specifiers or '...' before 'caddr_t'

Since we don't really need much from the <sys/quota.h> header,
add conditional #defines for the few needed fields.

The FASYNC constant is not declared everywhere in userspace,
provide a compat declaration if unavailable.

Fix an unused variable warning in ll_dir_ioctl().

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I9cd2b0fcbaf16fe8a5a4a7a0309aada3a72cab07
Reviewed-on: https://review.whamcloud.com/33876
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/llite/dir.c

index 1c56911..7997d39 100644 (file)
 # include <linux/version.h>
 # include <uapi/linux/lustre/lustre_fiemap.h>
 #else /* !__KERNEL__ */
-# define NEED_QUOTA_DEFS
 # include <limits.h>
 # include <stdbool.h>
 # include <stdio.h> /* snprintf() */
 # include <string.h>
-# include <sys/quota.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>
 #endif /* __KERNEL__ */
@@ -85,7 +85,15 @@ extern "C" {
     "project", /* PRJQUOTA */ \
     "undefined", \
 };
+#ifndef USRQUOTA
+#define USRQUOTA 0
+#endif
+#ifndef GRPQUOTA
+#define GRPQUOTA 1
+#endif
+#ifndef PRJQUOTA
 #define PRJQUOTA 2
+#endif
 
 /*
  * We need to always use 64bit version because the structure
@@ -478,6 +486,9 @@ struct fsxattr {
 /* To be compatible with old statically linked binary we keep the check for
  * the older 0100000000 flag.  This is already removed upstream.  LU-812. */
 #define O_LOV_DELAY_CREATE_1_8 0100000000 /* FMODE_NONOTIFY masked in 2.6.36 */
+#ifndef FASYNC
+#define FASYNC                 00020000   /* fcntl, for BSD compatibility */
+#endif
 #define O_LOV_DELAY_CREATE_MASK        (O_NOCTTY | FASYNC)
 #define O_LOV_DELAY_CREATE             (O_LOV_DELAY_CREATE_1_8 | \
                                         O_LOV_DELAY_CREATE_MASK)
index 554693d..e282205 100644 (file)
@@ -1406,7 +1406,7 @@ lmv_out_free:
                        (struct lov_user_md_v1 __user *)arg;
                struct lov_user_md_v3 __user *lumv3p =
                        (struct lov_user_md_v3 __user *)arg;
-               int lum_size;
+               int lum_size = 0;
 
                int set_default = 0;