file.h (247602) | file.h (255240) |
---|---|
1/*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 33 unchanged lines hidden (view full) --- 42 43extern struct fileops linuxfileops; 44 45static inline struct linux_file * 46linux_fget(unsigned int fd) 47{ 48 struct file *file; 49 | 1/*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 33 unchanged lines hidden (view full) --- 42 43extern struct fileops linuxfileops; 44 45static inline struct linux_file * 46linux_fget(unsigned int fd) 47{ 48 struct file *file; 49 |
50 if (fget_unlocked(curthread->td_proc->p_fd, fd, 0, 0, &file, NULL) != 0) | 50 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 51 NULL) != 0) { |
51 return (NULL); | 52 return (NULL); |
53 } |
|
52 return (struct linux_file *)file->f_data; 53} 54 55static inline void 56fput(struct linux_file *filp) 57{ 58 if (filp->_file == NULL) { 59 kfree(filp); --- 5 unchanged lines hidden (view full) --- 65 } 66} 67 68static inline void 69put_unused_fd(unsigned int fd) 70{ 71 struct file *file; 72 | 54 return (struct linux_file *)file->f_data; 55} 56 57static inline void 58fput(struct linux_file *filp) 59{ 60 if (filp->_file == NULL) { 61 kfree(filp); --- 5 unchanged lines hidden (view full) --- 67 } 68} 69 70static inline void 71put_unused_fd(unsigned int fd) 72{ 73 struct file *file; 74 |
73 if (fget_unlocked(curthread->td_proc->p_fd, fd, 0, 0, &file, NULL) != 0) | 75 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 76 NULL) != 0) { |
74 return; | 77 return; |
78 } |
|
75 fdclose(curthread->td_proc->p_fd, file, fd, curthread); 76} 77 78static inline void 79fd_install(unsigned int fd, struct linux_file *filp) 80{ 81 struct file *file; 82 | 79 fdclose(curthread->td_proc->p_fd, file, fd, curthread); 80} 81 82static inline void 83fd_install(unsigned int fd, struct linux_file *filp) 84{ 85 struct file *file; 86 |
83 if (fget_unlocked(curthread->td_proc->p_fd, fd, 0, 0, &file, NULL) != 0) | 87 if (fget_unlocked(curthread->td_proc->p_fd, fd, NULL, 0, &file, 88 NULL) != 0) { |
84 file = NULL; | 89 file = NULL; |
90 } |
|
85 filp->_file = file; 86 finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); 87} 88 89static inline int 90get_unused_fd(void) 91{ 92 struct file *file; --- 29 unchanged lines hidden --- | 91 filp->_file = file; 92 finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); 93} 94 95static inline int 96get_unused_fd(void) 97{ 98 struct file *file; --- 29 unchanged lines hidden --- |