11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
27b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * Copyright (c) 2005 Silicon Graphics, Inc.
37b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * All Rights Reserved.
41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
57b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * This program is free software; you can redistribute it and/or
67b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * modify it under the terms of the GNU General Public License as
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * published by the Free Software Foundation.
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
97b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * This program is distributed in the hope that it would be useful,
107b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * but WITHOUT ANY WARRANTY; without even the implied warranty of
117b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
127b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * GNU General Public License for more details.
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
147b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * You should have received a copy of the GNU General Public License
157b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * along with this program; if not, write the Free Software Foundation,
167b71876980d87c8f237b94d8529ee7fcc05ec2d9Nathan Scott * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef __XFS_EXPORT_H__
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define __XFS_EXPORT_H__
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Common defines for code related to exporting XFS filesystems over NFS.
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * The NFS fileid goes out on the wire as an array of
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 32bit unsigned ints in host order.  There are 5 possible
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * formats.
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * (1)	fileid_type=0x00
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	(no fileid data; handled by the generic code)
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * (2)	fileid_type=0x01
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	inode-num
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	generation
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * (3)	fileid_type=0x02
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	inode-num
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	generation
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	parent-inode-num
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	parent-generation
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * (4)	fileid_type=0x81
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	inode-num-lo32
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	inode-num-hi32
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	generation
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * (5)	fileid_type=0x82
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	inode-num-lo32
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	inode-num-hi32
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	generation
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	parent-inode-num-lo32
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	parent-inode-num-hi32
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	parent-generation
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Note, the NFS filehandle also includes an fsid portion which
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * may have an inode number in it.  That number is hardcoded to
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 32bits and there is no way for XFS to intercept it.  In
57c41564b5af328ea4600b26119f6c9c8e1eb5c28bNathan Scott * practice this means when exporting an XFS filesystem with 64bit
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * inodes you should either export the mountpoint (rather than
591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * a subdirectory) or use the "fsid" export option.
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
62c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwigstruct xfs_fid64 {
63c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwig	u64 ino;
64c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwig	u32 gen;
65c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwig	u64 parent_ino;
66c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwig	u32 parent_gen;
67c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwig} __attribute__((packed));
68c38344fe9e73c99d546cc15a2bb97c7a09942aadChristoph Hellwig
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* This flag goes on the wire.  Don't play with it. */
701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define XFS_FILEID_TYPE_64FLAG	0x80	/* NFS fileid has 64bit inodes */
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif	/* __XFS_EXPORT_H__ */
73