blob: bc5166bfe46bf1dea2c219fd44f740a3438d5f5a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Christoph Hellwig8650b8a2015-01-21 11:40:00 +01002#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
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010011struct pnfs_block_extent {
12 struct nfsd4_deviceid vol_id;
13 u64 foff;
14 u64 len;
15 u64 soff;
16 enum pnfs_block_extent_state es;
17};
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010018
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010019struct pnfs_block_range {
20 u64 foff;
21 u64 len;
22};
23
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010024/*
25 * Random upper cap for the uuid length to avoid unbounded allocation.
26 * Not actually limited by the protocol.
27 */
28#define PNFS_BLOCK_UUID_LEN 128
29
30struct pnfs_block_volume {
31 enum pnfs_block_volume_type type;
32 union {
33 struct {
34 u64 offset;
35 u32 sig_len;
36 u8 sig[PNFS_BLOCK_UUID_LEN];
37 } simple;
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010038 struct {
39 enum scsi_code_set code_set;
40 enum scsi_designator_type designator_type;
41 int designator_len;
42 u8 designator[256];
43 u64 pr_key;
44 } scsi;
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010045 };
46};
47
48struct pnfs_block_deviceaddr {
49 u32 nr_volumes;
50 struct pnfs_block_volume volumes[];
51};
52
53__be32 nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr,
54 struct nfsd4_getdeviceinfo *gdp);
55__be32 nfsd4_block_encode_layoutget(struct xdr_stream *xdr,
56 struct nfsd4_layoutget *lgp);
57int nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
58 u32 block_size);
Christoph Hellwigf99d4fb2016-03-04 20:46:17 +010059int nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
60 u32 block_size);
Christoph Hellwig8650b8a2015-01-21 11:40:00 +010061
62#endif /* _NFSD_BLOCKLAYOUTXDR_H */