File Index
Files and directories
Sign in
FILE

blocklayoutxdr.h

File preview with syntax highlighting.

linux-6.19.14/fs/nfsd/blocklayoutxdr.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _NFSD_BLOCKLAYOUTXDR_H
 3#define _NFSD_BLOCKLAYOUTXDR_H 1
 4
 5#include <linux/blkdev.h>
 6#include "xdr4.h"
 7
 8struct iomap;
 9struct xdr_stream;
10
11/* On the wire size of the layout4 struct with zero number of extents */
12#define PNFS_BLOCK_LAYOUT4_SIZE \
13	(sizeof(__be32) * 2 +	/* offset4 */ \
14	 sizeof(__be32) * 2 +	/* length4 */ \
15	 sizeof(__be32) +	/* layoutiomode4 */ \
16	 sizeof(__be32) +	/* layouttype4 */ \
17	 sizeof(__be32) +	/* number of bytes */ \
18	 sizeof(__be32))	/* number of extents */
19
20struct pnfs_block_extent {
21	struct nfsd4_deviceid		vol_id;
22	u64				foff;
23	u64				len;
24	u64				soff;
25	enum pnfs_block_extent_state	es;
26};
27
28struct pnfs_block_range {
29	u64				foff;
30	u64				len;
31};
32
33struct pnfs_block_layout {
34	u32				nr_extents;
35	struct pnfs_block_extent	extents[] __counted_by(nr_extents);
36};
37
38/*
39 * Random upper cap for the uuid length to avoid unbounded allocation.
40 * Not actually limited by the protocol.
41 */
42#define PNFS_BLOCK_UUID_LEN	128
43
44struct pnfs_block_volume {
45	enum pnfs_block_volume_type	type;
46	union {
47		struct {
48			u64		offset;
49			u32		sig_len;
50			u8		sig[PNFS_BLOCK_UUID_LEN];
51		} simple;
52		struct {
53			enum scsi_code_set		code_set;
54			enum scsi_designator_type	designator_type;
55			int				designator_len;
56			u8				designator[256];
57			u64				pr_key;
58		} scsi;
59	};
60};
61
62struct pnfs_block_deviceaddr {
63	u32				nr_volumes;
64	struct pnfs_block_volume	volumes[] __counted_by(nr_volumes);
65};
66
67__be32 nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr,
68		const struct nfsd4_getdeviceinfo *gdp);
69__be32 nfsd4_block_encode_layoutget(struct xdr_stream *xdr,
70		const struct nfsd4_layoutget *lgp);
71__be32 nfsd4_block_decode_layoutupdate(struct xdr_stream *xdr,
72		struct iomap **iomapp, int *nr_iomapsp, u32 block_size);
73__be32 nfsd4_scsi_decode_layoutupdate(struct xdr_stream *xdr,
74		struct iomap **iomapp, int *nr_iomapsp, u32 block_size);
75
76#endif /* _NFSD_BLOCKLAYOUTXDR_H */
~/ Read-only file preview.