/* * Lockd host handle (used both by the client and server personality).
*/ struct nlm_host { struct hlist_node h_hash; /* doubly linked list */ struct sockaddr_storage h_addr; /* peer address */
size_t h_addrlen; struct sockaddr_storage h_srcaddr; /* our address (optional) */
size_t h_srcaddrlen; struct rpc_clnt *h_rpcclnt; /* RPC client to talk to peer */ char *h_name; /* remote hostname */
u32 h_version; /* interface version */ unsignedshort h_proto; /* transport proto */ unsignedshort h_reclaiming : 1,
h_server : 1, /* server side, not client side */
h_noresvport : 1,
h_inuse : 1;
wait_queue_head_t h_gracewait; /* wait while reclaiming */ struct rw_semaphore h_rwsem; /* Reboot recovery lock */
u32 h_state; /* pseudo-state counter */
u32 h_nsmstate; /* true remote NSM state */
u32 h_pidcount; /* Pseudopids */
refcount_t h_count; /* reference count */ struct mutex h_mutex; /* mutex for pmap binding */ unsignedlong h_nextrebind; /* next portmap call */ unsignedlong h_expires; /* eligible for GC */ struct list_head h_lockowners; /* Lockowners for the client */
spinlock_t h_lock; 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; /* address eyecatcher */ struct net *net; /* host net */ conststruct cred *h_cred; char nodename[UNX_MAXNODENAME + 1]; conststruct nlmclnt_operations *h_nlmclnt_ops; /* Callback ops for NLM users */
};
/* * The largest string sm_addrbuf should hold is a full-size IPv6 address * (no "::" anywhere) with a scope ID. The buffer size is computed to * hold eight groups of colon-separated four-hex-digit numbers, a * percent sign, a scope id (at most 32 bits, in decimal), and NUL.
*/ #define NSM_ADDRBUF ((8 * 4 + 7) + (1 + 10) + 1)
/* * This is the representation of a blocked client lock.
*/ struct nlm_wait { struct list_head b_list; /* linked list */
wait_queue_head_t b_wait; /* where to wait on */ struct nlm_host *b_host; struct file_lock *b_lock; /* local file lock */
__be32 b_status; /* grant callback status */
};
/* * This struct describes a file held open by lockd on behalf of * an NFS client.
*/ struct nlm_file { struct hlist_node f_list; /* linked list */ struct nfs_fh f_handle; /* NFS file handle */ struct file * f_file[2]; /* VFS file pointers,
indexed by O_ flags */ struct nlm_share * f_shares; /* DOS shares */ struct list_head f_blocks; /* blocked locks */ unsignedint f_locks; /* guesstimate # of locks */ unsignedint f_count; /* reference count */ struct mutex f_mutex; /* avoid concurrent access */
};
/* * This is a server block (i.e. a lock requested by some client which * couldn't be granted because of a conflicting lock).
*/ #define NLM_NEVER (~(unsignedlong) 0) /* timeout on non-blocking call: */ #define NLM_TIMEOUT (7 * HZ)
/* * This is used in garbage collection and resource reclaim * A return value != 0 means destroy the lock/block/share
*/ typedefint (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
/* * Ensure incoming requests are from local privileged callers. * * Return TRUE if sender is local and is connecting via a privileged port; * otherwise return FALSE.
*/ staticinlineint nlm_privileged_requester(conststruct svc_rqst *rqstp)
{ conststruct sockaddr *sap = svc_addr(rqstp);
switch (sap->sa_family) { case AF_INET: return __nlm_privileged_request4(sap); case AF_INET6: return __nlm_privileged_request6(sap); default: return 0;
}
}
/* * Compare two NLM locks. * When the second lock is of type F_UNLCK, this acts like a wildcard.
*/ staticinlineint nlm_compare_locks(conststruct file_lock *fl1, conststruct file_lock *fl2)
{ return file_inode(fl1->c.flc_file) == file_inode(fl2->c.flc_file)
&& fl1->c.flc_pid == fl2->c.flc_pid
&& fl1->c.flc_owner == fl2->c.flc_owner
&& fl1->fl_start == fl2->fl_start
&& fl1->fl_end == fl2->fl_end
&&(fl1->c.flc_type == fl2->c.flc_type || fl2->c.flc_type == F_UNLCK);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.