blocklayoutxdr.h 1.4 KB

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