FreeBSD/sys/fs/nfsclient/nfs_clstate.c
/*
 * Generate the next cbident value. Basically just increment a static value
 * and then check that it isn't already in the list, if it has wrapped around.
 */
Generate the next cbident value. Basically just increment a static value
and then check that it isn't already in the list, if it has wrapped around.
Generate the next cbident value . Basically just increment a static value and then check that it isn ' t already in the list if it has wrapped around .
static u_int32_t
nfscl_nextcbident(void)
{
	struct nfsclclient *clp;
	int matched;
	static u_int32_t nextcbident = 0;
	static int haswrapped = 0;
	nextcbident++;
	if (nextcbident == 0)
		haswrapped = 1;
	if (haswrapped) {
		do {
			matched = 0;
			NFSLOCKCLSTATE();
			LIST_FOREACH(clp, &nfsclhead, nfsc_list) {
				if (clp->nfsc_cbident == nextcbident) {
					matched = 1;
					break;
				}
			}
			NFSUNLOCKCLSTATE();
			if (matched == 1)
				nextcbident++;
		} while (matched);
	}
	return (nextcbident);
}
static u_int32_t nfscl_nextcbident ( void ) { struct nfsclclient * clp ; int matched ; static u_int32_t nextcbident = 0 ; static int haswrapped = 0 ; nextcbident ++ ; if ( nextcbident == 0 ) haswrapped = 1 ; if ( haswrapped ) { do { matched = 0 ; NFSLOCKCLSTATE ( ) ; LIST_FOREACH ( clp , & nfsclhead , nfsc_list ) { if ( clp -> nfsc_cbident == nextcbident ) { matched = 1 ; break ; } } NFSUNLOCKCLSTATE ( ) ; if ( matched == 1 ) nextcbident ++ ; } while ( matched ) ; } return ( nextcbident ) ; }
Generate the next cbident value.
Generate the next cbident value .
/*
		 * Search the clientid list for one already using this cbident.
		 */