From: jcl Date: Thu, 7 Feb 2013 22:34:15 +0000 (+0100) Subject: LU-2782 mdt: add macros for fid string len X-Git-Tag: 2.4.51~35 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8c5dc672bf613b3dbb5406c3e5995f3db199642a LU-2782 mdt: add macros for fid string len 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 Change-Id: If257b7e12f43ea48bbdf6a6788d285d465c6a1bc Reviewed-on: http://review.whamcloud.com/5299 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 59a0931..4b74f94 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -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)); */ +#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) \ diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index d6f2e98..acf394d 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -6142,6 +6142,10 @@ static int __init mdt_mod_init(void) 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;