]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/lockd/lockd.h
lockd: Use sockaddr_storage + length for h_addr field
[linux-2.6-omap-h63xx.git] / include / linux / lockd / lockd.h
index 102d928f7206b4bce0e242c8779b2de01117e8d5..41d7a8e61ceabc16732ee1b0ef6e8420dafbec41 100644 (file)
@@ -38,7 +38,8 @@
  */
 struct nlm_host {
        struct hlist_node       h_hash;         /* doubly linked list */
-       struct sockaddr_in      h_addr;         /* peer address */
+       struct sockaddr_storage h_addr;         /* peer address */
+       size_t                  h_addrlen;
        struct sockaddr_in      h_saddr;        /* our address (optional) */
        struct rpc_clnt *       h_rpcclnt;      /* RPC client to talk to peer */
        char *                  h_name;         /* remote hostname */
@@ -61,6 +62,9 @@ struct nlm_host {
        struct list_head        h_granted;      /* Locks in GRANTED state */
        struct list_head        h_reclaim;      /* Locks in RECLAIM state */
        struct nsm_handle *     h_nsmhandle;    /* NSM status handle */
+
+       char                    h_addrbuf[48],  /* address eyecatchers */
+                               h_saddrbuf[48];
 };
 
 struct nsm_handle {
@@ -70,8 +74,22 @@ struct nsm_handle {
        struct sockaddr_in      sm_addr;
        unsigned int            sm_monitored : 1,
                                sm_sticky : 1;  /* don't unmonitor */
+       char                    sm_addrbuf[48]; /* address eyecatcher */
 };
 
+/*
+ * Rigorous type checking on sockaddr type conversions
+ */
+static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host)
+{
+       return (struct sockaddr_in *)&host->h_addr;
+}
+
+static inline struct sockaddr *nlm_addr(const struct nlm_host *host)
+{
+       return (struct sockaddr *)&host->h_addr;
+}
+
 /*
  * Map an fl_owner_t into a unique 32-bit "pid"
  */
@@ -200,10 +218,12 @@ typedef int         (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
  * Server-side lock handling
  */
 __be32           nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
-                                       struct nlm_lock *, int, struct nlm_cookie *);
+                             struct nlm_host *, struct nlm_lock *, int,
+                             struct nlm_cookie *);
 __be32           nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
 __be32           nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
-                       struct nlm_lock *, struct nlm_lock *, struct nlm_cookie *);
+                       struct nlm_host *, struct nlm_lock *,
+                       struct nlm_lock *, struct nlm_cookie *);
 __be32           nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
 unsigned long    nlmsvc_retry_blocked(void);
 void             nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
@@ -224,7 +244,7 @@ void                  nlmsvc_invalidate_all(void);
  * Cluster failover support
  */
 int           nlmsvc_unlock_all_by_sb(struct super_block *sb);
-int           nlmsvc_unlock_all_by_ip(__be32 server_addr);
+int           nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
 
 static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
 {