file.h (271127) | file.h (277139) |
---|---|
1/*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * Copyright (c) 2013 Mellanox Technologies, Ltd. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 63 unchanged lines hidden (view full) --- 72put_unused_fd(unsigned int fd) 73{ 74 struct file *file; 75 76 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 77 NULL) != 0) { 78 return; 79 } | 1/*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * Copyright (c) 2013 Mellanox Technologies, Ltd. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 63 unchanged lines hidden (view full) --- 72put_unused_fd(unsigned int fd) 73{ 74 struct file *file; 75 76 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 77 NULL) != 0) { 78 return; 79 } |
80 /* 81 * NOTE: We should only get here when the "fd" has not been 82 * installed, so no need to free the associated Linux file 83 * structure. 84 */ |
|
80 fdclose(curthread->td_proc->p_fd, file, fd, curthread); | 85 fdclose(curthread->td_proc->p_fd, file, fd, curthread); |
86 87 /* drop extra reference */ 88 fdrop(file, curthread); |
|
81} 82 83static inline void 84fd_install(unsigned int fd, struct linux_file *filp) 85{ 86 struct file *file; 87 88 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 89 NULL) != 0) { 90 file = NULL; 91 } 92 filp->_file = file; | 89} 90 91static inline void 92fd_install(unsigned int fd, struct linux_file *filp) 93{ 94 struct file *file; 95 96 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 97 NULL) != 0) { 98 file = NULL; 99 } 100 filp->_file = file; |
93 finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); | 101 finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); 102 103 /* drop the extra reference */ 104 fput(filp); |
94} 95 96static inline int 97get_unused_fd(void) 98{ 99 struct file *file; 100 int error; 101 int fd; 102 103 error = falloc(curthread, &file, &fd, 0); 104 if (error) 105 return -error; | 105} 106 107static inline int 108get_unused_fd(void) 109{ 110 struct file *file; 111 int error; 112 int fd; 113 114 error = falloc(curthread, &file, &fd, 0); 115 if (error) 116 return -error; |
117 /* drop the extra reference */ 118 fdrop(file, curthread); |
|
106 return fd; 107} 108 109static inline struct linux_file * 110alloc_file(int mode, const struct file_operations *fops) 111{ 112 struct linux_file *filp; 113 --- 28 unchanged lines hidden --- | 119 return fd; 120} 121 122static inline struct linux_file * 123alloc_file(int mode, const struct file_operations *fops) 124{ 125 struct linux_file *filp; 126 --- 28 unchanged lines hidden --- |