Whamcloud - gitweb
LU-5417 lustre: fix comparison between signed and unsigned
[fs/lustre-release.git] / lustre / include / lustre_cfg.h
index 0cb0a1e..29292df 100644 (file)
@@ -169,13 +169,12 @@ static inline void lustre_cfg_bufs_reset(struct lustre_cfg_bufs *bufs, char *nam
                 lustre_cfg_bufs_set_string(bufs, 0, name);
 }
 
-static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index)
+static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, __u32 index)
 {
-        int i;
-        int offset;
-        int bufcount;
-        LASSERT (lcfg != NULL);
-        LASSERT (index >= 0);
+       __u32 i;
+       size_t offset;
+       __u32 bufcount;
+       LASSERT (lcfg != NULL);
 
         bufcount = lcfg->lcfg_bufcount;
         if (index >= bufcount)
@@ -190,7 +189,7 @@ static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index)
 static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs,
                                         struct lustre_cfg *lcfg)
 {
-        int i;
+       __u32 i;
         bufs->lcfg_bufcount = lcfg->lcfg_bufcount;
         for (i = 0; i < bufs->lcfg_bufcount; i++) {
                 bufs->lcfg_buflen[i] = lcfg->lcfg_buflens[i];
@@ -198,7 +197,7 @@ static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs,
         }
 }
 
-static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
+static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, __u32 index)
 {
        char *s;
 
@@ -214,7 +213,7 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
         * of data.  Try to use the padding first though.
         */
        if (s[lcfg->lcfg_buflens[index] - 1] != '\0') {
-               int last = min((int)lcfg->lcfg_buflens[index],
+               size_t last = min((size_t)lcfg->lcfg_buflens[index],
                               cfs_size_round(lcfg->lcfg_buflens[index]) - 1);
                char lost = s[last];
                s[last] = '\0';
@@ -226,10 +225,10 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
        return s;
 }
 
-static inline int lustre_cfg_len(__u32 bufcount, __u32 *buflens)
+static inline __u32 lustre_cfg_len(__u32 bufcount, __u32 *buflens)
 {
-        int i;
-        int len;
+       __u32 i;
+       __u32 len;
         ENTRY;
 
         len = LCFG_HDR_SIZE(bufcount);
@@ -246,7 +245,7 @@ static inline void lustre_cfg_init(struct lustre_cfg *lcfg, int cmd,
                                   struct lustre_cfg_bufs *bufs)
 {
        char *ptr;
-       int i;
+       __u32 i;
 
        lcfg->lcfg_version = LUSTRE_CFG_VERSION;
        lcfg->lcfg_command = cmd;
@@ -284,7 +283,7 @@ static inline void lustre_cfg_free(struct lustre_cfg *lcfg)
         return;
 }
 
-static inline int lustre_cfg_sanity_check(void *buf, int len)
+static inline int lustre_cfg_sanity_check(void *buf, size_t len)
 {
         struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
         ENTRY;