Whamcloud - gitweb
LU-2782 mdt: add macros for fid string len
authorjcl <jacques-charles.lafoucriere@cea.fr>
Thu, 7 Feb 2013 22:34:15 +0000 (23:34 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 7 Jun 2013 04:30:12 +0000 (00:30 -0400)
add 2 macros for the length of a fid string 0xSEQ:0xOID:0xVER
and it's brace version (FID_NOBRACE_LEN, and FID_LEN)

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Change-Id: If257b7e12f43ea48bbdf6a6788d285d465c6a1bc
Reviewed-on: http://review.whamcloud.com/5299
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustre_user.h
lustre/mdt/mdt_handler.c

index 59a0931..4b74f94 100644 (file)
@@ -473,6 +473,8 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen)
 
 /* printf display format
    e.g. printf("file FID is "DFID"\n", PFID(fid)); */
 
 /* printf display format
    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 "["DFID_NOBRACE"]"
 #define PFID(fid)     \
 #define DFID_NOBRACE LPX64":0x%x:0x%x"
 #define DFID "["DFID_NOBRACE"]"
 #define PFID(fid)     \
index d6f2e98..acf394d 100644 (file)
@@ -6142,6 +6142,10 @@ static int __init mdt_mod_init(void)
        struct lprocfs_static_vars lvars;
        int rc;
 
        struct lprocfs_static_vars lvars;
        int rc;
 
+       CLASSERT(sizeof("0x0123456789ABCDEF:0x01234567:0x01234567") ==
+                FID_NOBRACE_LEN + 1);
+       CLASSERT(sizeof("[0x0123456789ABCDEF:0x01234567:0x01234567]") ==
+                FID_LEN + 1);
        rc = lu_kmem_init(mdt_caches);
        if (rc)
                return rc;
        rc = lu_kmem_init(mdt_caches);
        if (rc)
                return rc;