blocklayoutxdr.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. enum pnfs_block_extent_state {
  8. PNFS_BLOCK_READWRITE_DATA = 0,
  9. PNFS_BLOCK_READ_DATA = 1,
  10. PNFS_BLOCK_INVALID_DATA = 2,
  11. PNFS_BLOCK_NONE_DATA = 3,
  12. };
  13. struct pnfs_block_extent {
  14. struct nfsd4_deviceid vol_id;
  15. u64 foff;
  16. u64 len;
  17. u64 soff;
  18. enum pnfs_block_extent_state es;
  19. };
  20. #define NFS4_BLOCK_EXTENT_SIZE 44
  21. enum pnfs_block_volume_type {
  22. PNFS_BLOCK_VOLUME_SIMPLE = 0,
  23. PNFS_BLOCK_VOLUME_SLICE = 1,
  24. PNFS_BLOCK_VOLUME_CONCAT = 2,
  25. PNFS_BLOCK_VOLUME_STRIPE = 3,
  26. };
  27. /*
  28. * Random upper cap for the uuid length to avoid unbounded allocation.
  29. * Not actually limited by the protocol.
  30. */
  31. #define PNFS_BLOCK_UUID_LEN 128
  32. struct pnfs_block_volume {
  33. enum pnfs_block_volume_type type;
  34. union {
  35. struct {
  36. u64 offset;
  37. u32 sig_len;
  38. u8 sig[PNFS_BLOCK_UUID_LEN];
  39. } simple;
  40. };
  41. };
  42. struct pnfs_block_deviceaddr {
  43. u32 nr_volumes;
  44. struct pnfs_block_volume volumes[];
  45. };
  46. __be32 nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr,
  47. struct nfsd4_getdeviceinfo *gdp);
  48. __be32 nfsd4_block_encode_layoutget(struct xdr_stream *xdr,
  49. struct nfsd4_layoutget *lgp);
  50. int nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
  51. u32 block_size);
  52. #endif /* _NFSD_BLOCKLAYOUTXDR_H */