home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / include / linux / lockd / xdr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-12-24  |  3.0 KB  |  112 lines

  1. /*
  2.  * linux/include/linux/lockd/xdr.h
  3.  *
  4.  * XDR types for the NLM protocol
  5.  *
  6.  * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de>
  7.  */
  8.  
  9. #ifndef LOCKD_XDR_H
  10. #define LOCKD_XDR_H
  11.  
  12. #include <linux/fs.h>
  13. #include <linux/nfs.h>
  14. #include <linux/sunrpc/xdr.h>
  15.  
  16. struct svc_rqst;
  17.  
  18. #define NLM_MAXCOOKIELEN        32
  19. #define NLM_MAXSTRLEN        1024
  20.  
  21. #define    nlm_granted        __constant_htonl(NLM_LCK_GRANTED)
  22. #define    nlm_lck_denied        __constant_htonl(NLM_LCK_DENIED)
  23. #define    nlm_lck_denied_nolocks    __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
  24. #define    nlm_lck_blocked        __constant_htonl(NLM_LCK_BLOCKED)
  25. #define    nlm_lck_denied_grace_period    __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
  26.  
  27. #define nlm_drop_reply        __constant_htonl(30000)
  28.  
  29. /* Lock info passed via NLM */
  30. struct nlm_lock {
  31.     char *            caller;
  32.     unsigned int        len;     /* length of "caller" */
  33.     struct nfs_fh        fh;
  34.     struct xdr_netobj    oh;
  35.     u32            svid;
  36.     struct file_lock    fl;
  37. };
  38.  
  39. /*
  40.  *    NLM cookies. Technically they can be 1K, but Linux only uses 8 bytes.
  41.  *    FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to
  42.  *    32 bytes.
  43.  */
  44.  
  45. struct nlm_cookie
  46. {
  47.     unsigned char data[NLM_MAXCOOKIELEN];
  48.     unsigned int len;
  49. };
  50.  
  51. /*
  52.  * Generic lockd arguments for all but sm_notify
  53.  */
  54. struct nlm_args {
  55.     struct nlm_cookie    cookie;
  56.     struct nlm_lock        lock;
  57.     u32            block;
  58.     u32            reclaim;
  59.     u32            state;
  60.     u32            monitor;
  61.     u32            fsm_access;
  62.     u32            fsm_mode;
  63. };
  64.  
  65. typedef struct nlm_args nlm_args;
  66.  
  67. /*
  68.  * Generic lockd result
  69.  */
  70. struct nlm_res {
  71.     struct nlm_cookie    cookie;
  72.     __be32            status;
  73.     struct nlm_lock        lock;
  74. };
  75.  
  76. /*
  77.  * statd callback when client has rebooted
  78.  */
  79. struct nlm_reboot {
  80.     char *        mon;
  81.     unsigned int    len;
  82.     u32        state;
  83.     __be32        addr;
  84. };
  85.  
  86. /*
  87.  * Contents of statd callback when monitored host rebooted
  88.  */
  89. #define NLMSVC_XDRSIZE        sizeof(struct nlm_args)
  90.  
  91. int    nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  92. int    nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
  93. int    nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  94. int    nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  95. int    nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  96. int    nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
  97. int    nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
  98. int    nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *);
  99. int    nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *);
  100. int    nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  101. int    nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
  102. int    nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
  103. int    nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
  104. /*
  105. int    nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  106. int    nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  107. int    nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  108. int    nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  109.  */
  110.  
  111. #endif /* LOCKD_XDR_H */
  112.