FreeBSD/sys/fs/nfsclient/nfs_clport.c
/*
 * Fill in a lock owner name. For now, pid + the process's creation time.
 */
Fill in a lock owner name. For now, pid + the process's creation time.
Fill in a lock owner name . For now pid + the process ' s creation time .
void
nfscl_filllockowner(void *id, u_int8_t *cp, int flags)
{
	union {
		u_int32_t	lval;
		u_int8_t	cval[4];
	} tl;
	struct proc *p;
	if (id == NULL) {
		printf("NULL id\n");
		bzero(cp, NFSV4CL_LOCKNAMELEN);
		return;
	}
	if ((flags & F_POSIX) != 0) {
		p = (struct proc *)id;
		tl.lval = p->p_pid;
		*cp++ = tl.cval[0];
		*cp++ = tl.cval[1];
		*cp++ = tl.cval[2];
		*cp++ = tl.cval[3];
		tl.lval = p->p_stats->p_start.tv_sec;
		*cp++ = tl.cval[0];
		*cp++ = tl.cval[1];
		*cp++ = tl.cval[2];
		*cp++ = tl.cval[3];
		tl.lval = p->p_stats->p_start.tv_usec;
		*cp++ = tl.cval[0];
		*cp++ = tl.cval[1];
		*cp++ = tl.cval[2];
		*cp = tl.cval[3];
	} else if ((flags & F_FLOCK) != 0) {
		bcopy(&id, cp, sizeof(id));
		bzero(&cp[sizeof(id)], NFSV4CL_LOCKNAMELEN - sizeof(id));
	} else {
		printf("nfscl_filllockowner: not F_POSIX or F_FLOCK\n");
		bzero(cp, NFSV4CL_LOCKNAMELEN);
	}
}
void nfscl_filllockowner ( void * id , u_int8_t * cp , int flags ) { union { u_int32_t lval ; u_int8_t cval [ 4 ] ; } tl ; struct proc * p ; if ( id == NULL ) { printf ( " \n " ) ; bzero ( cp , NFSV4CL_LOCKNAMELEN ) ; return ; } if ( ( flags & F_POSIX ) != 0 ) { p = ( struct proc * ) id ; tl . lval = p -> p_pid ; * cp ++ = tl . cval [ 0 ] ; * cp ++ = tl . cval [ 1 ] ; * cp ++ = tl . cval [ 2 ] ; * cp ++ = tl . cval [ 3 ] ; tl . lval = p -> p_stats -> p_start . tv_sec ; * cp ++ = tl . cval [ 0 ] ; * cp ++ = tl . cval [ 1 ] ; * cp ++ = tl . cval [ 2 ] ; * cp ++ = tl . cval [ 3 ] ; tl . lval = p -> p_stats -> p_start . tv_usec ; * cp ++ = tl . cval [ 0 ] ; * cp ++ = tl . cval [ 1 ] ; * cp ++ = tl . cval [ 2 ] ; * cp = tl . cval [ 3 ] ; } else if ( ( flags & F_FLOCK ) != 0 ) { bcopy ( & id , cp , sizeof ( id ) ) ; bzero ( & cp [ sizeof ( id ) ] , NFSV4CL_LOCKNAMELEN - sizeof ( id ) ) ; } else { printf ( " \n " ) ; bzero ( cp , NFSV4CL_LOCKNAMELEN ) ; } }
Fill in a lock owner name.
Fill in a lock owner name .