nfs_clport.c (222718) | nfs_clport.c (222719) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clport.c 222718 2011-06-05 17:31:44Z rmacklem $"); | 35__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clport.c 222719 2011-06-05 18:17:37Z rmacklem $"); |
36 37/* 38 * generally, I don't like #includes inside .h files, but it seems to 39 * be the easiest way to handle the port. 40 */ 41#include <sys/hash.h> 42#include <fs/nfs/nfsport.h> 43#include <netinet/if_ether.h> --- 451 unchanged lines hidden (view full) --- 495 idlen--; 496 } 497} 498 499/* 500 * Fill in a lock owner name. For now, pid + the process's creation time. 501 */ 502void | 36 37/* 38 * generally, I don't like #includes inside .h files, but it seems to 39 * be the easiest way to handle the port. 40 */ 41#include <sys/hash.h> 42#include <fs/nfs/nfsport.h> 43#include <netinet/if_ether.h> --- 451 unchanged lines hidden (view full) --- 495 idlen--; 496 } 497} 498 499/* 500 * Fill in a lock owner name. For now, pid + the process's creation time. 501 */ 502void |
503nfscl_filllockowner(struct thread *td, u_int8_t *cp) | 503nfscl_filllockowner(void *id, u_int8_t *cp, int flags) |
504{ 505 union { 506 u_int32_t lval; 507 u_int8_t cval[4]; 508 } tl; 509 struct proc *p; 510 | 504{ 505 union { 506 u_int32_t lval; 507 u_int8_t cval[4]; 508 } tl; 509 struct proc *p; 510 |
511if (td == NULL) { 512 printf("NULL td\n"); 513 bzero(cp, 12); 514 return; | 511 if (id == NULL) { 512 printf("NULL id\n"); 513 bzero(cp, NFSV4CL_LOCKNAMELEN); 514 return; 515 } 516 if ((flags & F_POSIX) != 0) { 517 p = (struct proc *)id; 518 tl.lval = p->p_pid; 519 *cp++ = tl.cval[0]; 520 *cp++ = tl.cval[1]; 521 *cp++ = tl.cval[2]; 522 *cp++ = tl.cval[3]; 523 tl.lval = p->p_stats->p_start.tv_sec; 524 *cp++ = tl.cval[0]; 525 *cp++ = tl.cval[1]; 526 *cp++ = tl.cval[2]; 527 *cp++ = tl.cval[3]; 528 tl.lval = p->p_stats->p_start.tv_usec; 529 *cp++ = tl.cval[0]; 530 *cp++ = tl.cval[1]; 531 *cp++ = tl.cval[2]; 532 *cp = tl.cval[3]; 533 } else { 534 printf("nfscl_filllockowner: not F_POSIX\n"); 535 bzero(cp, NFSV4CL_LOCKNAMELEN); 536 } |
515} | 537} |
516 p = td->td_proc; 517if (p == NULL) { 518 printf("NULL pid\n"); 519 bzero(cp, 12); 520 return; 521} 522 tl.lval = p->p_pid; 523 *cp++ = tl.cval[0]; 524 *cp++ = tl.cval[1]; 525 *cp++ = tl.cval[2]; 526 *cp++ = tl.cval[3]; 527if (p->p_stats == NULL) { 528 printf("pstats null\n"); 529 bzero(cp, 8); 530 return; 531} 532 tl.lval = p->p_stats->p_start.tv_sec; 533 *cp++ = tl.cval[0]; 534 *cp++ = tl.cval[1]; 535 *cp++ = tl.cval[2]; 536 *cp++ = tl.cval[3]; 537 tl.lval = p->p_stats->p_start.tv_usec; 538 *cp++ = tl.cval[0]; 539 *cp++ = tl.cval[1]; 540 *cp++ = tl.cval[2]; 541 *cp = tl.cval[3]; 542} | |
543 544/* 545 * Find the parent process for the thread passed in as an argument. 546 * If none exists, return NULL, otherwise return a thread for the parent. 547 * (Can be any of the threads, since it is only used for td->td_proc.) 548 */ 549NFSPROC_T * 550nfscl_getparent(struct thread *td) --- 750 unchanged lines hidden --- | 538 539/* 540 * Find the parent process for the thread passed in as an argument. 541 * If none exists, return NULL, otherwise return a thread for the parent. 542 * (Can be any of the threads, since it is only used for td->td_proc.) 543 */ 544NFSPROC_T * 545nfscl_getparent(struct thread *td) --- 750 unchanged lines hidden --- |