NFSD: Adds macro EX_UUID_LEN for exports uuid's length
authorKinglong Mee <kinglongmee@gmail.com>
Fri, 23 May 2014 12:00:19 +0000 (20:00 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 30 May 2014 21:32:19 +0000 (17:32 -0400)
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/export.c
fs/nfsd/export.h
fs/nfsd/nfs4xdr.c

index 8771f417efa6a382386cb882715f053364da26b4..90d37b6ef16339421a0f8c6819bbb5fcead7d07b 100644 (file)
@@ -487,10 +487,10 @@ uuid_parse(char **mesg, char *buf, unsigned char **puuid)
 
        /* expect a 16 byte uuid encoded as \xXXXX... */
        len = qword_get(mesg, buf, PAGE_SIZE);
-       if (len != 16)
+       if (len != EX_UUID_LEN)
                return -EINVAL;
 
-       *puuid = kmemdup(buf, 16, GFP_KERNEL);
+       *puuid = kmemdup(buf, EX_UUID_LEN, GFP_KERNEL);
        if (*puuid == NULL)
                return -ENOMEM;
 
@@ -663,7 +663,7 @@ static int svc_export_show(struct seq_file *m,
                if (exp->ex_uuid) {
                        int i;
                        seq_puts(m, ",uuid=");
-                       for (i=0; i<16; i++) {
+                       for (i = 0; i < EX_UUID_LEN; i++) {
                                if ((i&3) == 0 && i)
                                        seq_putc(m, ':');
                                seq_printf(m, "%02x", exp->ex_uuid[i]);
index d7939a62a0ae64a5b7caf2de48605dab61d0d483..c7d4ed05e470c28ea14d870a130cd0a0d1a96c60 100644 (file)
@@ -37,6 +37,7 @@ struct nfsd4_fs_locations {
  * spkm3i, and spkm3p (and using all 8 at once should be rare).
  */
 #define MAX_SECINFO_LIST       8
+#define EX_UUID_LEN            16
 
 struct exp_flavor_info {
        u32     pseudoflavor;
index 470fe8998c9b820352e234c0aa9e2bd267804863..70d147244891bf023b7b10a4e5e66aad2b306248 100644 (file)
@@ -2223,7 +2223,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
                        *p++ = cpu_to_be32(MINOR(stat.dev));
                        break;
                case FSIDSOURCE_UUID:
-                       p = xdr_encode_opaque_fixed(p, exp->ex_uuid, 16);
+                       p = xdr_encode_opaque_fixed(p, exp->ex_uuid,
+                                                               EX_UUID_LEN);
                        break;
                }
        }