亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? host.c

?? Linux中關(guān)于遠(yuǎn)程文件鎖定的支持的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/* * linux/fs/lockd/host.c * * Management for NLM peer hosts. The nlm_host struct is shared * between client and server implementation. The only reason to * do so is to reduce code bloat. * * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> */#include <linux/types.h>#include <linux/slab.h>#include <linux/in.h>#include <linux/in6.h>#include <linux/sunrpc/clnt.h>#include <linux/sunrpc/svc.h>#include <linux/lockd/lockd.h>#include <linux/mutex.h>#include <net/ipv6.h>#define NLMDBG_FACILITY		NLMDBG_HOSTCACHE#define NLM_HOST_NRHASH		32#define NLM_HOST_REBIND		(60 * HZ)#define NLM_HOST_EXPIRE		(300 * HZ)#define NLM_HOST_COLLECT	(120 * HZ)static struct hlist_head	nlm_hosts[NLM_HOST_NRHASH];static unsigned long		next_gc;static int			nrhosts;static DEFINE_MUTEX(nlm_host_mutex);static void			nlm_gc_hosts(void);struct nlm_lookup_host_info {	const int		server;		/* search for server|client */	const struct sockaddr	*sap;		/* address to search for */	const size_t		salen;		/* it's length */	const unsigned short	protocol;	/* transport to search for*/	const u32		version;	/* NLM version to search for */	const char		*hostname;	/* remote's hostname */	const size_t		hostname_len;	/* it's length */	const struct sockaddr	*src_sap;	/* our address (optional) */	const size_t		src_len;	/* it's length */	const int		noresvport;	/* use non-priv port */};/* * Hash function must work well on big- and little-endian platforms */static unsigned int __nlm_hash32(const __be32 n){	unsigned int hash = (__force u32)n ^ ((__force u32)n >> 16);	return hash ^ (hash >> 8);}static unsigned int __nlm_hash_addr4(const struct sockaddr *sap){	const struct sockaddr_in *sin = (struct sockaddr_in *)sap;	return __nlm_hash32(sin->sin_addr.s_addr);}static unsigned int __nlm_hash_addr6(const struct sockaddr *sap){	const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;	const struct in6_addr addr = sin6->sin6_addr;	return __nlm_hash32(addr.s6_addr32[0]) ^	       __nlm_hash32(addr.s6_addr32[1]) ^	       __nlm_hash32(addr.s6_addr32[2]) ^	       __nlm_hash32(addr.s6_addr32[3]);}static unsigned int nlm_hash_address(const struct sockaddr *sap){	unsigned int hash;	switch (sap->sa_family) {	case AF_INET:		hash = __nlm_hash_addr4(sap);		break;	case AF_INET6:		hash = __nlm_hash_addr6(sap);		break;	default:		hash = 0;	}	return hash & (NLM_HOST_NRHASH - 1);}static void nlm_clear_port(struct sockaddr *sap){	switch (sap->sa_family) {	case AF_INET:		((struct sockaddr_in *)sap)->sin_port = 0;		break;	case AF_INET6:		((struct sockaddr_in6 *)sap)->sin6_port = 0;		break;	}}/* * Common host lookup routine for server & client */static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni){	struct hlist_head *chain;	struct hlist_node *pos;	struct nlm_host	*host;	struct nsm_handle *nsm = NULL;	mutex_lock(&nlm_host_mutex);	if (time_after_eq(jiffies, next_gc))		nlm_gc_hosts();	/* We may keep several nlm_host objects for a peer, because each	 * nlm_host is identified by	 * (address, protocol, version, server/client)	 * We could probably simplify this a little by putting all those	 * different NLM rpc_clients into one single nlm_host object.	 * This would allow us to have one nlm_host per address.	 */	chain = &nlm_hosts[nlm_hash_address(ni->sap)];	hlist_for_each_entry(host, pos, chain, h_hash) {		if (!nlm_cmp_addr(nlm_addr(host), ni->sap))			continue;		/* See if we have an NSM handle for this client */		if (!nsm)			nsm = host->h_nsmhandle;		if (host->h_proto != ni->protocol)			continue;		if (host->h_version != ni->version)			continue;		if (host->h_server != ni->server)			continue;		if (ni->server &&		    !nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap))			continue;		/* Move to head of hash chain. */		hlist_del(&host->h_hash);		hlist_add_head(&host->h_hash, chain);		nlm_get_host(host);		dprintk("lockd: nlm_lookup_host found host %s (%s)\n",				host->h_name, host->h_addrbuf);		goto out;	}	/*	 * The host wasn't in our hash table.  If we don't	 * have an NSM handle for it yet, create one.	 */	if (nsm)		atomic_inc(&nsm->sm_count);	else {		host = NULL;		nsm = nsm_get_handle(ni->sap, ni->salen,					ni->hostname, ni->hostname_len);		if (!nsm) {			dprintk("lockd: nlm_lookup_host failed; "				"no nsm handle\n");			goto out;		}	}	host = kzalloc(sizeof(*host), GFP_KERNEL);	if (!host) {		nsm_release(nsm);		dprintk("lockd: nlm_lookup_host failed; no memory\n");		goto out;	}	host->h_name	   = nsm->sm_name;	host->h_addrbuf    = nsm->sm_addrbuf;	memcpy(nlm_addr(host), ni->sap, ni->salen);	host->h_addrlen = ni->salen;	nlm_clear_port(nlm_addr(host));	memcpy(nlm_srcaddr(host), ni->src_sap, ni->src_len);	host->h_version    = ni->version;	host->h_proto      = ni->protocol;	host->h_rpcclnt    = NULL;	mutex_init(&host->h_mutex);	host->h_nextrebind = jiffies + NLM_HOST_REBIND;	host->h_expires    = jiffies + NLM_HOST_EXPIRE;	atomic_set(&host->h_count, 1);	init_waitqueue_head(&host->h_gracewait);	init_rwsem(&host->h_rwsem);	host->h_state      = 0;			/* pseudo NSM state */	host->h_nsmstate   = 0;			/* real NSM state */	host->h_nsmhandle  = nsm;	host->h_server	   = ni->server;	host->h_noresvport = ni->noresvport;	hlist_add_head(&host->h_hash, chain);	INIT_LIST_HEAD(&host->h_lockowners);	spin_lock_init(&host->h_lock);	INIT_LIST_HEAD(&host->h_granted);	INIT_LIST_HEAD(&host->h_reclaim);	nrhosts++;	dprintk("lockd: nlm_lookup_host created host %s\n",			host->h_name);out:	mutex_unlock(&nlm_host_mutex);	return host;}/* * Destroy a host */static voidnlm_destroy_host(struct nlm_host *host){	struct rpc_clnt	*clnt;	BUG_ON(!list_empty(&host->h_lockowners));	BUG_ON(atomic_read(&host->h_count));	nsm_unmonitor(host);	nsm_release(host->h_nsmhandle);	clnt = host->h_rpcclnt;	if (clnt != NULL)		rpc_shutdown_client(clnt);	kfree(host);}/** * nlmclnt_lookup_host - Find an NLM host handle matching a remote server * @sap: network address of server * @salen: length of server address * @protocol: transport protocol to use * @version: NLM protocol version * @hostname: '\0'-terminated hostname of server * @noresvport: 1 if non-privileged port should be used * * Returns an nlm_host structure that matches the passed-in * [server address, transport protocol, NLM version, server hostname]. * If one doesn't already exist in the host cache, a new handle is * created and returned. */struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,				     const size_t salen,				     const unsigned short protocol,				     const u32 version,				     const char *hostname,				     int noresvport){	const struct sockaddr source = {		.sa_family	= AF_UNSPEC,	};	struct nlm_lookup_host_info ni = {		.server		= 0,		.sap		= sap,		.salen		= salen,		.protocol	= protocol,		.version	= version,		.hostname	= hostname,		.hostname_len	= strlen(hostname),		.src_sap	= &source,		.src_len	= sizeof(source),		.noresvport	= noresvport,	};	dprintk("lockd: %s(host='%s', vers=%u, proto=%s)\n", __func__,			(hostname ? hostname : "<none>"), version,			(protocol == IPPROTO_UDP ? "udp" : "tcp"));	return nlm_lookup_host(&ni);}/** * nlmsvc_lookup_host - Find an NLM host handle matching a remote client * @rqstp: incoming NLM request * @hostname: name of client host * @hostname_len: length of client hostname * * Returns an nlm_host structure that matches the [client address, * transport protocol, NLM version, client hostname] of the passed-in * NLM request.  If one doesn't already exist in the host cache, a * new handle is created and returned. * * Before possibly creating a new nlm_host, construct a sockaddr * for a specific source address in case the local system has * multiple network addresses.  The family of the address in * rq_daddr is guaranteed to be the same as the family of the * address in rq_addr, so it's safe to use the same family for

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费国产亚洲视频| 在线精品亚洲一区二区不卡| 99精品久久只有精品| 色吊一区二区三区| 欧美一区二区精品在线| 日本一区二区高清| 亚洲高清三级视频| 极品少妇一区二区| 91麻豆视频网站| 日韩免费电影网站| 国产精品久久久久永久免费观看 | 日本午夜一本久久久综合| 精品中文字幕一区二区| 94色蜜桃网一区二区三区| 欧美日韩在线三级| 久久精品水蜜桃av综合天堂| 一级精品视频在线观看宜春院| 美腿丝袜一区二区三区| 99久久国产综合精品女不卡| 5566中文字幕一区二区电影| 中文字幕一区二区三区在线观看| 奇米亚洲午夜久久精品| 色哟哟在线观看一区二区三区| 日韩免费高清av| 亚洲午夜久久久久久久久久久| 国产美女视频91| 欧美精品乱码久久久久久按摩| 国产精品免费视频一区| 日韩二区三区四区| 色综合视频一区二区三区高清| 精品欧美一区二区久久| 亚洲一区二区欧美激情| 成人免费毛片高清视频| 日韩精品中文字幕一区| 亚洲综合久久久| av在线一区二区| 久久久久国产免费免费| 天天影视色香欲综合网老头| 91免费国产视频网站| 国产亚洲欧美色| 久久99精品久久久久久动态图| 欧美色图在线观看| 亚洲精品网站在线观看| 成人丝袜高跟foot| 久久综合九色综合欧美就去吻| 午夜电影一区二区三区| 91成人国产精品| 中文字幕精品三区| 国产福利不卡视频| 久久欧美中文字幕| 久久精品国产一区二区| 欧美一卡在线观看| 日韩成人免费看| 欧美区在线观看| 亚洲高清中文字幕| 欧美性三三影院| 亚洲国产美女搞黄色| 91黄色免费网站| 亚洲欧美另类久久久精品2019| 国产aⅴ综合色| 久久精品人人做人人综合| 麻豆精品国产传媒mv男同| 欧美一卡二卡三卡| 日韩**一区毛片| 欧美一区二区三区视频| 青青国产91久久久久久| 9191久久久久久久久久久| 五月婷婷综合网| 91精品麻豆日日躁夜夜躁| 日日欢夜夜爽一区| 欧美一区二区视频在线观看| 亚洲h精品动漫在线观看| 欧美午夜精品一区二区三区| 亚洲bt欧美bt精品777| 精品视频免费在线| 日韩精品每日更新| 欧美tk丨vk视频| 国产一区二区免费视频| 国产日韩高清在线| eeuss鲁片一区二区三区 | 在线亚洲+欧美+日本专区| 亚洲黄色av一区| 日本福利一区二区| 亚洲va在线va天堂| 日韩一二在线观看| 国产精品99久久久久久宅男| 国产视频视频一区| 波多野结衣一区二区三区 | 欧洲一区在线观看| 亚洲h在线观看| 精品国产一二三| 国产**成人网毛片九色| 亚洲欧美国产三级| 欧美视频在线观看一区| 免费在线观看一区| 2024国产精品| 91亚洲精品久久久蜜桃网站| 亚洲一二三区视频在线观看| 欧美一区二区三区在线视频| 狠狠网亚洲精品| 亚洲图片激情小说| 在线播放亚洲一区| 国产成人一区在线| 亚洲激情一二三区| 9191成人精品久久| 成人永久aaa| 亚洲成人自拍一区| 久久精品一区蜜桃臀影院| 99re热视频这里只精品| 日韩高清在线一区| 中文在线一区二区| 精品视频在线免费看| 懂色av一区二区三区免费观看| 欧洲在线/亚洲| 国产精品第四页| 久久se精品一区二区| 天天综合天天综合色| 亚洲国产日韩a在线播放| 亚洲一区欧美一区| 国产一区不卡视频| 91视频一区二区| 9191成人精品久久| 成人欧美一区二区三区白人| 美女精品一区二区| 91蝌蚪国产九色| 欧美美女直播网站| 色噜噜狠狠色综合欧洲selulu| 久久精品国产亚洲aⅴ | 欧美精品一区在线观看| 欧美喷潮久久久xxxxx| 欧美综合久久久| 欧美三级电影在线看| 欧美挠脚心视频网站| 日韩三级.com| 久久精品一区二区三区av| 国产精品网站导航| 美腿丝袜亚洲色图| 在线中文字幕不卡| 亚洲精品美腿丝袜| 成人激情文学综合网| 国产区在线观看成人精品| 一本大道av伊人久久综合| 懂色av中文字幕一区二区三区| 国产欧美一区二区精品仙草咪| 六月丁香婷婷色狠狠久久| 久久精品一区蜜桃臀影院| 欧美午夜精品久久久久久孕妇| 国内精品久久久久影院色| 一区二区三区日韩| 欧美经典一区二区| 日韩天堂在线观看| 色一情一乱一乱一91av| 国产盗摄精品一区二区三区在线| 亚洲国产婷婷综合在线精品| 国产日韩欧美麻豆| 91麻豆精品国产无毒不卡在线观看| aa级大片欧美| 精品一区二区三区免费观看| 亚洲国产精品视频| 欧美精品一区二区三| 国产河南妇女毛片精品久久久| 精品国产一区二区在线观看| 99re66热这里只有精品3直播 | 在线亚洲精品福利网址导航| 一区二区三区精品在线观看| 91精品国产免费| 精品一区二区三区影院在线午夜| 欧美国产乱子伦| 在线观看免费亚洲| 国产黄色成人av| 亚洲18色成人| 国产精品久99| 欧美一级一区二区| 精油按摩中文字幕久久| 精品99一区二区三区| 国产真实乱偷精品视频免| 中文字幕一区在线观看视频| 欧美亚洲综合久久| 亚洲h在线观看| 日韩精品一区二区三区老鸭窝| 国产成人精品免费网站| 麻豆视频观看网址久久| 亚洲一区二区偷拍精品| 欧美视频中文一区二区三区在线观看| 亚洲福利视频导航| 欧美大片国产精品| 狠狠色综合日日| 国产亚洲欧美日韩日本| 国产永久精品大片wwwapp| 国产亲近乱来精品视频| 国产69精品久久99不卡| 亚洲激情av在线| 国产女人aaa级久久久级| 日韩精品专区在线| 欧美日本韩国一区二区三区视频| 99久免费精品视频在线观看| 国内精品自线一区二区三区视频| 日韩精彩视频在线观看| 亚洲国产另类av| 图片区小说区区亚洲影院|