Skip to contentSkip to conversation

NFSD: Adds macro EX_UUID_LEN for exports uuid's length

PATCH In review Kinglong Mee 2 participants 2 messages May 23, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 NFSD: Adds macro EX_UUID_LEN for exports uuid's length

---
 fs/nfsd/export.c  | 6 +++---
 fs/nfsd/export.h  | 1 +
 fs/nfsd/nfs4xdr.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
fs/nfsd/export.c +3 -3
index 8771f41..90d37b6 100644
@@ -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]);
fs/nfsd/export.h +1 -0
index d7939a6..c7d4ed0 100644
@@ -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;
fs/nfsd/nfs4xdr.c +1 -1
index 18881f3..071b0be 100644
@@ -2250,7 +2250,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
 			WRITE32(MINOR(stat.dev));
 			break;
 		case FSIDSOURCE_UUID:
-			WRITEMEM(exp->ex_uuid, 16);
+			WRITEMEM(exp->ex_uuid, EX_UUID_LEN);
 			break;
 		}
 	}
Signature · 1 line
1.9.0
#1 lore raw
Quoted 1 line · Kinglong Mee

Applying with some minor fixups after xdr encoding stuff.

--b.

Quoted 60 lines
---
 fs/nfsd/export.c  | 6 +++---
 fs/nfsd/export.h  | 1 +
 fs/nfsd/nfs4xdr.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
fs/nfsd/export.c +3 -3
index 8771f41..90d37b6 100644
@@ -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]);
fs/nfsd/export.h +1 -0
index d7939a6..c7d4ed0 100644
@@ -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;
fs/nfsd/nfs4xdr.c +1 -1
index 18881f3..071b0be 100644
@@ -2250,7 +2250,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
 			WRITE32(MINOR(stat.dev));
 			break;
 		case FSIDSOURCE_UUID:
-			WRITEMEM(exp->ex_uuid, 16);
+			WRITEMEM(exp->ex_uuid, EX_UUID_LEN);
 			break;
 		}
 	}
Signature · 1 line
1.9.0