orangefs: get rid of dec_string and enc_string
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 9 Oct 2015 21:43:15 +0000 (17:43 -0400)
committerMike Marshall <hubcap@omnibond.com>
Fri, 13 Nov 2015 16:56:17 +0000 (11:56 -0500)
The latter is never used, the former has one user and would be
better off spelled out right there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/dir.c
fs/orangefs/pvfs2-dev-proto.h

index 280755d..eb4c3d3 100644 (file)
@@ -23,7 +23,6 @@ static long decode_dirents(char *ptr, struct pvfs2_readdir_response_s *readdir)
        struct pvfs2_readdir_response_s *rd =
                (struct pvfs2_readdir_response_s *) ptr;
        char *buf = ptr;
-       char **pptr = &buf;
 
        readdir->token = rd->token;
        readdir->pvfs_dirent_outcount = rd->pvfs_dirent_outcount;
@@ -32,15 +31,17 @@ static long decode_dirents(char *ptr, struct pvfs2_readdir_response_s *readdir)
                                        GFP_KERNEL);
        if (readdir->dirent_array == NULL)
                return -ENOMEM;
-       *pptr += offsetof(struct pvfs2_readdir_response_s, dirent_array);
+       buf += offsetof(struct pvfs2_readdir_response_s, dirent_array);
        for (i = 0; i < readdir->pvfs_dirent_outcount; i++) {
-               dec_string(pptr, &readdir->dirent_array[i].d_name,
-                          &readdir->dirent_array[i].d_length);
+               __u32 len = *(__u32 *)buf;
+               readdir->dirent_array[i].d_name = buf + 4;
+               buf += roundup8(4 + len + 1);
+               readdir->dirent_array[i].d_length = len;
                readdir->dirent_array[i].khandle =
-                       *(struct pvfs2_khandle *) *pptr;
-               *pptr += 16;
+                       *(struct pvfs2_khandle *) buf;
+               buf += 16;
        }
-       return (unsigned long)*pptr - (unsigned long)ptr;
+       return buf - ptr;
 }
 
 static long readdir_handle_ctor(struct readdir_handle_s *rhandle, void *buf,
index 9c82e6e..68b1bc6 100644 (file)
 #define roundup8(x) (((x)+7) & ~7)
 #endif
 
-/* strings; decoding just points into existing character data */
-#define enc_string(pptr, pbuf) do { \
-       __u32 len = strlen(*pbuf); \
-       *(__u32 *) *(pptr) = (len); \
-       memcpy(*(pptr)+4, *pbuf, len+1); \
-       *(pptr) += roundup8(4 + len + 1); \
-} while (0)
-
-#define dec_string(pptr, pbuf, plen) do { \
-       __u32 len = (*(__u32 *) *(pptr)); \
-       *pbuf = *(pptr) + 4; \
-       *(pptr) += roundup8(4 + len + 1); \
-       if (plen) \
-               *plen = len;\
-} while (0)
-
 struct read_write_x {
        __s64 off;
        __s64 len;