blocklayoutxdr.h 1.3 KB

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