static inline int svc_expkey_hash(struct svc_expkey *item)
{
	int hash = item->ek_fsidtype;
	char * cp = (char*)item->ek_fsid;
	int len = key_len(item->ek_fsidtype);

	hash ^= hash_mem(cp, len, EXPKEY_HASHBITS);
	hash ^= hash_ptr(item->ek_client, EXPKEY_HASHBITS);
	return hash & EXPKEY_HASHMASK;
}
示例#2
0
文件: split.c 项目: acv/wiggle
static int split_internal(char *start, char *end, int type,
			  struct elmnt *list)
{
	int cnt = 0;

	while (start < end) {
		char *cp = start;

		if (*cp == '\0' && cp+19 < end && cp[18] == '\n') {
			/* special word */
			cp += 20;
		} else
			switch (type) {
			case ByLine:
				while (cp < end && *cp != '\n')
					cp++;
				if (cp < end)
					cp++;
				break;
			case ByWord:
				if (isalnum(*cp) || *cp == '_') {
					do
						cp++;
					while (cp < end
					       && (isalnum(*cp)
						   || *cp == '_'));
				} else if (*cp == ' ' || *cp == '\t') {
					do
						cp++;
					while (cp < end
					       && (*cp == ' '
						   || *cp == '\t'));
				} else
					cp++;
				break;
			}
		if (list) {
			list->start = start;
			list->len = cp-start;
			if (*start)
				list->hash = hash_mem(start, list->len,
						      BITS_PER_LONG);
			else
				list->hash = atoi(start+1);
			list++;
		}
		cnt++;
		start = cp;
	}
	return cnt;
}
示例#3
0
static void test_sunrpc_svc(void){
	u32 val;
	struct svc_rqst rqstp;
        char name[50];
        struct iovec iov;
	int bits=0, bits2=0;
	rqstp.rq_resused=1;

	svc_getu32(&iov);
//	svc_putu32(&iov, val);

	xdr_argsize_check(&rqstp,&val);
	xdr_ressize_check(&rqstp,&val);
	svc_take_page(&rqstp);
	svc_pushback_allpages(&rqstp);
	svc_pushback_unused_pages(&rqstp);
	svc_free_allpages(&rqstp);
	hash_str(name, bits);
	hash_mem(name, bits, bits2);
	printk("finished svc test\n");

}
static inline int rsi_hash(struct rsi *item)
{
	return hash_mem(item->in_handle.data, item->in_handle.len, RSI_HASHBITS)
	     ^ hash_mem(item->in_token.data, item->in_token.len, RSI_HASHBITS);
}