/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> * * This file describes the layout of the file handles as passed * over the wire.
*/ #ifndef _LINUX_NFSD_NFSFH_H #define _LINUX_NFSD_NFSFH_H
/* * The file handle starts with a sequence of four-byte words. * The first word contains a version number (1) and three descriptor bytes * that tell how the remaining 3 variable length fields should be handled. * These three bytes are auth_type, fsid_type and fileid_type. * * All four-byte values are in host-byte-order. * * The auth_type field is deprecated and must be set to 0. * * The fsid_type identifies how the filesystem (or export point) is * encoded. * Current values: * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number * NOTE: we cannot use the kdev_t device id value, because kdev_t.h * says we mustn't. We must break it up and reassemble. * 1 - 4 byte user specified identifier * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED * 3 - 4 byte device id, encoded for user-space, 4 byte inode number * 4 - 4 byte inode number and 4 byte uuid * 5 - 8 byte uuid * 6 - 16 byte uuid * 7 - 8 byte inode number and 16 byte uuid * * The fileid_type identifies how the file within the filesystem is encoded. * The values for this field are filesystem specific, exccept that * filesystems must not use the values '0' or '0xff'. 'See enum fid_type' * in include/linux/exportfs.h for currently registered values.
*/
struct knfsd_fh { unsignedint fh_size; /* * Points to the current size while * building a new file handle.
*/
u8 fh_raw[NFS4_FHSIZE];
};
/* * This is the internal representation of an NFS handle used in knfsd. * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
*/ typedefstruct svc_fh { struct knfsd_fh fh_handle; /* FH data */ int fh_maxsize; /* max size for fh_handle */ struct dentry * fh_dentry; /* validated dentry */ struct svc_export * fh_export; /* export pointer */
bool fh_want_write; /* remount protection taken */ bool fh_no_wcc; /* no wcc data needed */ bool fh_no_atomic_attr; /* * wcc data is not atomic with * operation
*/ bool fh_use_wgather; /* NFSv2 wgather option */ bool fh_64bit_cookies;/* readdir cookie size */ int fh_flags; /* FH flags */ bool fh_post_saved; /* post-op attrs saved */ bool fh_pre_saved; /* pre-op attrs saved */
/* Pre-op attributes saved when inode is locked */
__u64 fh_pre_size; /* size before operation */ struct timespec64 fh_pre_mtime; /* mtime before oper */ struct timespec64 fh_pre_ctime; /* ctime before oper */ /* * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode) * to find out if it is valid.
*/
u64 fh_pre_change;
/* * This might look a little large to "inline" but in all calls except * one, 'vers' is constant so moste of the function disappears. * * In some cases the values are considered to be host endian and in * others, net endian. fsidv is always considered to be u32 as the * callers don't know which it will be. So we must use __force to keep * sparse from complaining. Since these values are opaque to the * client, that shouldn't be a problem.
*/ staticinlinevoid mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino,
u32 fsid, unsignedchar *uuid)
{
u32 *up; switch(vers) { case FSID_DEV:
fsidv[0] = (__force __u32)htonl((MAJOR(dev)<<16) |
MINOR(dev));
fsidv[1] = ino_t_to_u32(ino); break; case FSID_NUM:
fsidv[0] = fsid; break; case FSID_MAJOR_MINOR:
fsidv[0] = (__force __u32)htonl(MAJOR(dev));
fsidv[1] = (__force __u32)htonl(MINOR(dev));
fsidv[2] = ino_t_to_u32(ino); break;
case FSID_ENCODE_DEV:
fsidv[0] = new_encode_dev(dev);
fsidv[1] = ino_t_to_u32(ino); break;
case FSID_UUID4_INUM: /* 4 byte fsid and inode number */
up = (u32*)uuid;
fsidv[0] = ino_t_to_u32(ino);
fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3]; break;
if (fh1->fh_fsid_type != fh2->fh_fsid_type) returnfalse; if (memcmp(fsid1, fsid2, key_len(fh1->fh_fsid_type)) != 0) returnfalse; returntrue;
}
/** * knfsd_fh_hash - calculate the crc32 hash for the filehandle * @fh - pointer to filehandle * * returns a crc32 hash for the filehandle that is compatible with * the one displayed by "wireshark".
*/ staticinline u32 knfsd_fh_hash(conststruct knfsd_fh *fh)
{ return ~crc32_le(0xFFFFFFFF, fh->fh_raw, fh->fh_size);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.