sys/fs/nfsclient/nfs_clport.c
/*
 * Fill in the client id name. For these bytes:
 * 1 - they must be unique
 * 2 - they should be persistent across client reboots
 * 1 is more critical than 2
 * Use the mount point's unique id plus either the uuid or, if that
 * isn't set, random junk.
 */
Fill in the client id name. For these bytes:
1 - they must be unique
2 - they should be persistent across client reboots
1 is more critical than 2
Use the mount point's unique id plus either the uuid or, if that
isn't set, random junk.
Fill in the client id name . For these bytes : 1 - they must be unique 2 - they should be persistent across client reboots 1 is more critical than 2 Use the mount point ' s unique id plus either the uuid or if that isn ' t set random junk .
void
nfscl_fillclid(u_int64_t clval, char *uuid, u_int8_t *cp, u_int16_t idlen)
{
	int uuidlen;
	if (idlen >= sizeof (u_int64_t)) {
		NFSBCOPY((caddr_t)&clval, cp, sizeof (u_int64_t));
		cp += sizeof (u_int64_t);
		idlen -= sizeof (u_int64_t);
	}
	uuidlen = strlen(uuid);
	if (uuidlen > 0 && idlen >= uuidlen) {
		NFSBCOPY(uuid, cp, uuidlen);
		cp += uuidlen;
		idlen -= uuidlen;
	}
	while (idlen > 0) {
		*cp++ = (u_int8_t)(arc4random() % 256);
		idlen--;
	}
}
void nfscl_fillclid ( u_int64_t clval , char * uuid , u_int8_t * cp , u_int16_t idlen ) { int uuidlen ; if ( idlen >= sizeof ( u_int64_t ) ) { NFSBCOPY ( ( caddr_t ) & clval , cp , sizeof ( u_int64_t ) ) ; cp += sizeof ( u_int64_t ) ; idlen -= sizeof ( u_int64_t ) ; } uuidlen = strlen ( uuid ) ; if ( uuidlen > 0 && idlen >= uuidlen ) { NFSBCOPY ( uuid , cp , uuidlen ) ; cp += uuidlen ; idlen -= uuidlen ; } while ( idlen > 0 ) { * cp ++ = ( u_int8_t ) ( arc4random ( ) % 256 ) ; idlen -- ; } }
Fill in the client id name.
Fill in the client id name .
/*
	 * First, put in the 64bit mount point identifier.
	 */ /*
	 * If uuid is non-zero length, use it.
	 */ /*
	 * This only normally happens if the uuid isn't set.
	 */