summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Viro <viro@www.linux.org.uk>2003-09-22 22:50:51 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-09-22 22:50:51 -0700
commit9e2135245918b261e7500bb6410cd7b207596c31 (patch)
treedba8772a607cef86b1cb67cf63ab91e8d27673a6 /include
parent7f904771736fc6a6465a80541a0cb607d69772d3 (diff)
[PATCH] prepare for 32-bit dev_t: NFS
NFS made dev_t-agnostic. Aside of minor fixes in debugging printks, and adding old_encode_dev()/old_decode_dev(), the main part is in handling of exports with large dev_t. New fhandle format introduced, fh_verify(), fh_compose() and exports cache taught to deal with it. Format is used when ->s_dev of exported fs doesn't fit into 256:256; in that case we put major and minor in separate words in fhandle; ->fh_fsid_type is set to 2.
Diffstat (limited to 'include')
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/nfsd/nfsd.h12
-rw-r--r--include/linux/nfsd/nfsfh.h26
3 files changed, 19 insertions, 21 deletions
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 74272d6a562e..204294616cf1 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -65,7 +65,7 @@ struct svc_expkey {
struct auth_domain * ek_client;
int ek_fsidtype;
- u32 ek_fsid[2];
+ u32 ek_fsid[3];
struct svc_export * ek_export;
};
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 8c4fb5cfff21..97a57608a6e6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -15,6 +15,7 @@
#include <linux/unistd.h>
#include <linux/dirent.h>
#include <linux/fs.h>
+#include <linux/mount.h>
#include <linux/nfsd/debug.h>
#include <linux/nfsd/nfsfh.h>
@@ -209,6 +210,17 @@ void nfsd_lockd_shutdown(void);
*/
extern struct timeval nfssvc_boot;
+static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh)
+{
+ if (fh->fh_export->ex_flags & NFSEXP_FSID) {
+ struct vfsmount *mnt = fh->fh_export->ex_mnt;
+ if (!old_valid_dev(mnt->mnt_sb->s_dev) ||
+ (reffh->fh_version == 1 && reffh->fh_fsid_type == 1))
+ return 1;
+ }
+ return 0;
+}
+
#ifdef CONFIG_NFSD_V4
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index d4d63cc8e5fa..555793d69ddc 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -117,26 +117,6 @@ struct knfsd_fh {
#ifdef __KERNEL__
-/*
- * Conversion macros for the filehandle fields.
- *
- * Keep the device numbers in "backwards compatible
- * format", ie the low 16 bits contain the low 8 bits
- * of the 20-bit minor and the 12-bit major number.
- *
- * The high 16 bits contain the rest (4 bits major
- * and 12 bits minor),
- */
-
-static inline dev_t u32_to_dev_t(__u32 udev)
-{
- unsigned int minor, major;
-
- minor = (udev & 0xff) | ((udev >> 8) & 0xfff00);
- major = ((udev >> 8) & 0xff) | ((udev >> 20) & 0xf00);
- return MKDEV(major, minor);
-}
-
static inline __u32 ino_t_to_u32(ino_t ino)
{
return (__u32) ino;
@@ -196,6 +176,12 @@ static inline void mk_fsid_v1(u32 *fsidv, u32 fsid)
fsidv[0] = fsid;
}
+static inline void mk_fsid_v2(u32 *fsidv, dev_t dev, ino_t ino)
+{
+ fsidv[0] = htonl(MAJOR(dev));
+ fsidv[1] = htonl(MINOR(dev));
+ fsidv[2] = ino_t_to_u32(ino);
+}
/*
* Shorthand for dprintk()'s