Whamcloud - gitweb
LU-6401 lustre: make lustre_user.h compile in user space 94/16494/5
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 24 Sep 2015 14:16:32 +0000 (10:16 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 2 Oct 2015 04:14:52 +0000 (04:14 +0000)
While building my own lustre dependent application on
Ubuntu I discovered that lustre_user.h does not compile
due to libcfs/types.h not being packaged. So instead of
fixing the packaging just remove the libcfs/type.h
dependency from lustre_user.h which needs to be done
anyways.

Change-Id: Iecb62ca3b1aa727d1b7a01132e7074ee9079d0d4
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/16494
Reviewed-by: Frank Zago <fzago@cray.com>
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustre_idl.h
lustre/include/lustre/lustre_user.h
lustre/include/lustre/seq_range.h
lustre/utils/liblustreapi_json.c
lustre/utils/ll_decode_filter_fid.c

index ba99064..e8a15b6 100644 (file)
@@ -610,15 +610,15 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid)
 {
        if (fid_seq_is_mdt0(oi->oi.oi_seq)) {
                if (oid >= IDIF_MAX_OID) {
-                       CERROR("Bad "LPU64" to set "DOSTID"\n",
-                               oid, POSTID(oi));
+                       CERROR("Bad %llu to set "DOSTID"\n",
+                               (unsigned long long)oid, POSTID(oi));
                        return;
                }
                oi->oi.oi_id = oid;
        } else if (fid_is_idif(&oi->oi_fid)) {
                if (oid >= IDIF_MAX_OID) {
-                       CERROR("Bad "LPU64" to set "DOSTID"\n",
-                               oid, POSTID(oi));
+                       CERROR("Bad %llu to set "DOSTID"\n",
+                               (unsigned long long)oid, POSTID(oi));
                        return;
                }
                oi->oi_fid.f_seq = fid_idif_seq(oid,
@@ -627,8 +627,8 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid)
                oi->oi_fid.f_ver = oid >> 48;
        } else {
                if (oid > OBIF_MAX_OID) {
-                       CERROR("Bad "LPU64" to set "DOSTID"\n",
-                               oid, POSTID(oi));
+                       CERROR("Bad %llu to set "DOSTID"\n",
+                               (unsigned long long)oid, POSTID(oi));
                        return;
                }
                oi->oi_fid.f_oid = oid;
@@ -644,8 +644,8 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid)
 
        if (fid_is_idif(fid)) {
                if (oid >= IDIF_MAX_OID) {
-                       CERROR("Bad "LPU64" to set "DFID"\n",
-                               oid, PFID(fid));
+                       CERROR("Bad %llu to set "DFID"\n",
+                               (unsigned long long)oid, PFID(fid));
                        return -EBADF;
                }
                fid->f_seq = fid_idif_seq(oid, fid_idif_ost_idx(fid));
@@ -653,8 +653,8 @@ static inline int fid_set_id(struct lu_fid *fid, __u64 oid)
                fid->f_ver = oid >> 48;
        } else {
                if (oid > OBIF_MAX_OID) {
-                       CERROR("Bad "LPU64" to set "DFID"\n",
-                               oid, PFID(fid));
+                       CERROR("Bad %llu to set "DFID"\n",
+                               (unsigned long long)oid, PFID(fid));
                        return -EBADF;
                }
                fid->f_oid = oid;
@@ -2798,9 +2798,11 @@ struct ldlm_res_id {
         __u64 name[RES_NAME_SIZE];
 };
 
-#define DLDLMRES       "["LPX64":"LPX64":"LPX64"]."LPX64i
-#define PLDLMRES(res)  (res)->lr_name.name[0], (res)->lr_name.name[1], \
-                       (res)->lr_name.name[2], (res)->lr_name.name[3]
+#define DLDLMRES       "[%#llx:%#llx:%#llx].%#llx"
+#define PLDLMRES(res)  (unsigned long long)(res)->lr_name.name[0],     \
+                       (unsigned long long)(res)->lr_name.name[1],     \
+                       (unsigned long long)(res)->lr_name.name[2],     \
+                       (unsigned long long)(res)->lr_name.name[3]
 
 extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id);
 
index 4f27ec3..ecb0a8c 100644 (file)
@@ -46,7 +46,7 @@
  * @{
  */
 
-#include <libcfs/types.h>
+#include <linux/types.h>
 
 #ifdef __KERNEL__
 # include <linux/quota.h>
@@ -54,6 +54,8 @@
 # include <linux/version.h>
 #else /* !__KERNEL__ */
 # define NEED_QUOTA_DEFS
+# include <limits.h>
+# include <stdbool.h>
 # include <stdio.h> /* snprintf() */
 # include <string.h>
 # include <sys/quota.h>
@@ -218,8 +220,9 @@ struct ost_id {
        };
 };
 
-#define DOSTID LPX64":"LPU64
-#define POSTID(oi) ostid_seq(oi), ostid_id(oi)
+#define DOSTID "%#llx:%llu"
+#define POSTID(oi) ((unsigned long long)ostid_seq(oi)), \
+                  ((unsigned long long)ostid_id(oi))
 
 struct ll_futimes_3 {
        __u64 lfu_atime_sec;
@@ -542,20 +545,14 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen)
    e.g. printf("file FID is "DFID"\n", PFID(fid)); */
 #define FID_NOBRACE_LEN 40
 #define FID_LEN (FID_NOBRACE_LEN + 2)
-#define DFID_NOBRACE LPX64":0x%x:0x%x"
+#define DFID_NOBRACE "%#llx:0x%x:0x%x"
 #define DFID "["DFID_NOBRACE"]"
-#define PFID(fid)     \
-        (fid)->f_seq, \
-        (fid)->f_oid, \
+#define PFID(fid)                              \
+       (unsigned long long)(fid)->f_seq,       \
+       (fid)->f_oid,                           \
         (fid)->f_ver
 
-/* scanf input parse format -- strip '[' first.
-   e.g. sscanf(fidstr, SFID, RFID(&fid)); */
-/* #define SFID "0x"LPX64i":0x"LPSZX":0x"LPSZX""
-liblustreapi.c:2893: warning: format '%lx' expects type 'long unsigned int *', but argument 4 has type 'unsigned int *'
-liblustreapi.c:2893: warning: format '%lx' expects type 'long unsigned int *', but argument 5 has type 'unsigned int *'
-*/
-#define SFID "0x"LPX64i":0x%x:0x%x"
+#define SFID "0x%llx:0x%x:0x%x"
 #define RFID(fid)     \
         &((fid)->f_seq), \
         &((fid)->f_oid), \
index e4efaa4..70bbd21 100644 (file)
@@ -188,12 +188,12 @@ void lustre_swab_lu_seq_range(struct lu_seq_range *range);
 /**
  * printf string and argument list for sequence range
  */
-#define DRANGE "[%#16.16"LPF64"x-%#16.16"LPF64"x):%x:%s"
+#define DRANGE "[%#16.16llx-%#16.16llx]:%x:%s"
 
-#define PRANGE(range)          \
-       (range)->lsr_start,     \
-       (range)->lsr_end,       \
-       (range)->lsr_index,     \
+#define PRANGE(range)                          \
+       (unsigned long long)(range)->lsr_start, \
+       (unsigned long long)(range)->lsr_end,   \
+       (range)->lsr_index,                     \
        fld_range_is_mdt(range) ? "mdt" : "ost"
 
 #endif
index 74936ce..809c6ec 100644 (file)
@@ -141,7 +141,7 @@ int llapi_json_write_list(struct llapi_json_item_list **json_items, FILE *fp)
                        fprintf(fp, "%d", item->lji_integer);
                        break;
                case LLAPI_JSON_BIGNUM:
-                       fprintf(fp, LPU64, item->lji_u64);
+                       fprintf(fp, "%llu", (unsigned long long)item->lji_u64);
                        break;
                case LLAPI_JSON_REAL:
                        fprintf(fp, "%f", item->lji_real);
index 809e994..00de58e 100644 (file)
@@ -75,17 +75,17 @@ int main(int argc, char *argv[])
                        struct filter_fid_old *ffo = (void *)buf;
 
                        /* old filter_fid */
-                       printf("%s: objid="LPU64" seq="LPU64" parent="DFID
+                       printf("%s: objid=%llu seq=%llu parent="DFID
                               " stripe=%u\n", argv[i],
-                              le64_to_cpu(ffo->ff_objid),
-                              le64_to_cpu(ffo->ff_seq),
-                              le64_to_cpu(ffo->ff_parent.f_seq),
+                              (unsigned long long)le64_to_cpu(ffo->ff_objid),
+                              (unsigned long long)le64_to_cpu(ffo->ff_seq),
+                              (unsigned long long)le64_to_cpu(ffo->ff_parent.f_seq),
                               le32_to_cpu(ffo->ff_parent.f_oid), 0 /* ver */,
                               /* this is stripe_nr actually */
                               le32_to_cpu(ffo->ff_parent.f_stripe_idx));
                } else {
                        printf("%s: parent="DFID" stripe=%u\n", argv[i],
-                              le64_to_cpu(ff->ff_parent.f_seq),
+                              (unsigned long long)le64_to_cpu(ff->ff_parent.f_seq),
                               le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
                               /* this is stripe_nr actually */
                               le32_to_cpu(ff->ff_parent.f_stripe_idx));