]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] nfs fix
authorAndries E. Brouwer <andries.brouwer@cwi.nl>
Tue, 11 Feb 2003 10:46:39 +0000 (02:46 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 11 Feb 2003 10:46:39 +0000 (02:46 -0800)
nfs must not use MINORBITS - that fails with 32-bit dev_t

fs/nfs/nfs3xdr.c
fs/nfs/nfs4xdr.c

index 11d782aee2b2800f9d16905d8584a2c506c4fb6f..7b359269f58e482bfd3b75a2869bad09b0f61654 100644 (file)
@@ -146,7 +146,7 @@ xdr_decode_time3(u32 *p, struct timespec *timep)
 static u32 *
 xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
 {
-       unsigned int    type;
+       unsigned int    type, major, minor;
        int             fmode;
 
        type = ntohl(*p++);
@@ -160,9 +160,12 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr)
        fattr->gid = ntohl(*p++);
        p = xdr_decode_hyper(p, &fattr->size);
        p = xdr_decode_hyper(p, &fattr->du.nfs3.used);
+
        /* Turn remote device info into Linux-specific dev_t */
-       fattr->rdev = ntohl(*p++) << MINORBITS;
-       fattr->rdev |= ntohl(*p++) & MINORMASK;
+       major = ntohl(*p++);
+       minor = ntohl(*p++);
+       fattr->rdev = MKDEV(major, minor);
+
        p = xdr_decode_hyper(p, &fattr->fsid_u.nfs3);
        p = xdr_decode_hyper(p, &fattr->fileid);
        p = xdr_decode_time3(p, &fattr->atime);
@@ -412,8 +415,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, u32 *p, struct nfs3_mknodargs *args)
        *p++ = htonl(args->type);
        p = xdr_encode_sattr(p, args->sattr);
        if (args->type == NF3CHR || args->type == NF3BLK) {
-               *p++ = htonl(args->rdev >> MINORBITS);
-               *p++ = htonl(args->rdev & MINORMASK);
+               *p++ = htonl(MAJOR(args->rdev));
+               *p++ = htonl(MINOR(args->rdev));
        }
 
        req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
index 53ac5b398266d43ca48a2e794ecd5dc5ee017848..4cafe6f1825bd183c8d1d18e53091469640f00fd 100644 (file)
@@ -1385,13 +1385,14 @@ decode_getattr(struct xdr_stream *xdr, struct nfs4_getattr *getattr)
                 dprintk("read_attrs: gid=%d\n", (int)nfp->gid);
         }
         if (bmval1 & FATTR4_WORD1_RAWDEV) {
-                READ_BUF(8);
-                len += 8;
-                READ32(dummy32);
-               nfp->rdev = (dummy32 << MINORBITS);
-                READ32(dummy32);
-               nfp->rdev |= (dummy32 & MINORMASK);
-                dprintk("read_attrs: rdev=%d\n", nfp->rdev);
+               uint32_t major, minor;
+
+               READ_BUF(8);
+               len += 8;
+               READ32(major);
+               READ32(minor);
+               nfp->rdev = MKDEV(major, minor);
+               dprintk("read_attrs: rdev=0x%x\n", nfp->rdev);
         }
         if (bmval1 & FATTR4_WORD1_SPACE_AVAIL) {
                 READ_BUF(8);