Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 1 | #ifndef _NFSD_BLOCKLAYOUTXDR_H |
| 2 | #define _NFSD_BLOCKLAYOUTXDR_H 1 |
| 3 | |
| 4 | #include <linux/blkdev.h> |
| 5 | #include "xdr4.h" |
| 6 | |
| 7 | struct iomap; |
| 8 | struct xdr_stream; |
| 9 | |
Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 10 | struct pnfs_block_extent { |
| 11 | struct nfsd4_deviceid vol_id; |
| 12 | u64 foff; |
| 13 | u64 len; |
| 14 | u64 soff; |
| 15 | enum pnfs_block_extent_state es; |
| 16 | }; |
Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 17 | |
Christoph Hellwig | f99d4fb | 2016-03-04 20:46:17 +0100 | [diff] [blame] | 18 | struct pnfs_block_range { |
| 19 | u64 foff; |
| 20 | u64 len; |
| 21 | }; |
| 22 | |
Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 23 | /* |
| 24 | * Random upper cap for the uuid length to avoid unbounded allocation. |
| 25 | * Not actually limited by the protocol. |
| 26 | */ |
| 27 | #define PNFS_BLOCK_UUID_LEN 128 |
| 28 | |
| 29 | struct pnfs_block_volume { |
| 30 | enum pnfs_block_volume_type type; |
| 31 | union { |
| 32 | struct { |
| 33 | u64 offset; |
| 34 | u32 sig_len; |
| 35 | u8 sig[PNFS_BLOCK_UUID_LEN]; |
| 36 | } simple; |
Christoph Hellwig | f99d4fb | 2016-03-04 20:46:17 +0100 | [diff] [blame] | 37 | struct { |
| 38 | enum scsi_code_set code_set; |
| 39 | enum scsi_designator_type designator_type; |
| 40 | int designator_len; |
| 41 | u8 designator[256]; |
| 42 | u64 pr_key; |
| 43 | } scsi; |
Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 44 | }; |
| 45 | }; |
| 46 | |
| 47 | struct pnfs_block_deviceaddr { |
| 48 | u32 nr_volumes; |
| 49 | struct pnfs_block_volume volumes[]; |
| 50 | }; |
| 51 | |
| 52 | __be32 nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr, |
| 53 | struct nfsd4_getdeviceinfo *gdp); |
| 54 | __be32 nfsd4_block_encode_layoutget(struct xdr_stream *xdr, |
| 55 | struct nfsd4_layoutget *lgp); |
| 56 | int nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp, |
| 57 | u32 block_size); |
Christoph Hellwig | f99d4fb | 2016-03-04 20:46:17 +0100 | [diff] [blame] | 58 | int nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp, |
| 59 | u32 block_size); |
Christoph Hellwig | 8650b8a | 2015-01-21 11:40:00 +0100 | [diff] [blame] | 60 | |
| 61 | #endif /* _NFSD_BLOCKLAYOUTXDR_H */ |