vnode.h (231949) | vnode.h (241896) |
---|---|
1/*- 2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/cddl/compat/opensolaris/sys/vnode.h 231949 2012-02-21 01:05:12Z kib $ | 26 * $FreeBSD: head/sys/cddl/compat/opensolaris/sys/vnode.h 241896 2012-10-22 17:50:54Z kib $ |
27 */ 28 29#ifndef _OPENSOLARIS_SYS_VNODE_H_ 30#define _OPENSOLARIS_SYS_VNODE_H_ 31 32#ifdef _KERNEL 33 34struct vnode; --- 153 unchanged lines hidden (view full) --- 188 if (fdc->fd_cdir == NULL) { 189 fdc->fd_cdir = rootvnode; 190 vref(fdc->fd_rdir); 191 } 192 FILEDESC_XUNLOCK(fdc); 193 194 if (startvp != NULL) 195 vref(startvp); | 27 */ 28 29#ifndef _OPENSOLARIS_SYS_VNODE_H_ 30#define _OPENSOLARIS_SYS_VNODE_H_ 31 32#ifdef _KERNEL 33 34struct vnode; --- 153 unchanged lines hidden (view full) --- 188 if (fdc->fd_cdir == NULL) { 189 fdc->fd_cdir = rootvnode; 190 vref(fdc->fd_rdir); 191 } 192 FILEDESC_XUNLOCK(fdc); 193 194 if (startvp != NULL) 195 vref(startvp); |
196 NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td); | 196 NDINIT_ATVP(&nd, operation, 0, UIO_SYSSPACE, pnamep, startvp, td); |
197 filemode |= O_NOFOLLOW; 198 error = vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred, NULL); 199 NDFREE(&nd, NDF_ONLY_PNBUF); 200 if (error == 0) { 201 /* We just unlock so we hold a reference. */ 202 VOP_UNLOCK(nd.ni_vp, 0); 203 *vpp = nd.ni_vp; 204 } --- 13 unchanged lines hidden (view full) --- 218 219#define RLIM64_INFINITY 0 220static __inline int 221zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, caddr_t base, ssize_t len, 222 offset_t offset, enum uio_seg seg, int ioflag, int ulimit, cred_t *cr, 223 ssize_t *residp) 224{ 225 struct thread *td = curthread; | 197 filemode |= O_NOFOLLOW; 198 error = vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred, NULL); 199 NDFREE(&nd, NDF_ONLY_PNBUF); 200 if (error == 0) { 201 /* We just unlock so we hold a reference. */ 202 VOP_UNLOCK(nd.ni_vp, 0); 203 *vpp = nd.ni_vp; 204 } --- 13 unchanged lines hidden (view full) --- 218 219#define RLIM64_INFINITY 0 220static __inline int 221zfs_vn_rdwr(enum uio_rw rw, vnode_t *vp, caddr_t base, ssize_t len, 222 offset_t offset, enum uio_seg seg, int ioflag, int ulimit, cred_t *cr, 223 ssize_t *residp) 224{ 225 struct thread *td = curthread; |
226 int error, vfslocked; | 226 int error; |
227 ssize_t resid; 228 229 ASSERT(ioflag == 0); 230 ASSERT(ulimit == RLIM64_INFINITY); 231 | 227 ssize_t resid; 228 229 ASSERT(ioflag == 0); 230 ASSERT(ulimit == RLIM64_INFINITY); 231 |
232 vfslocked = VFS_LOCK_GIANT(vp->v_mount); | |
233 if (rw == UIO_WRITE) { 234 ioflag = IO_SYNC; 235 } else { 236 ioflag = IO_DIRECT; 237 } 238 error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, NOCRED, 239 &resid, td); | 232 if (rw == UIO_WRITE) { 233 ioflag = IO_SYNC; 234 } else { 235 ioflag = IO_DIRECT; 236 } 237 error = vn_rdwr(rw, vp, base, len, offset, seg, ioflag, cr, NOCRED, 238 &resid, td); |
240 VFS_UNLOCK_GIANT(vfslocked); | |
241 if (residp != NULL) 242 *residp = (ssize_t)resid; 243 return (error); 244} 245#define vn_rdwr(rw, vp, base, len, offset, seg, ioflag, ulimit, cr, residp) \ 246 zfs_vn_rdwr((rw), (vp), (base), (len), (offset), (seg), (ioflag), (ulimit), (cr), (residp)) 247 248static __inline int 249zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) 250{ 251 struct mount *mp; | 239 if (residp != NULL) 240 *residp = (ssize_t)resid; 241 return (error); 242} 243#define vn_rdwr(rw, vp, base, len, offset, seg, ioflag, ulimit, cr, residp) \ 244 zfs_vn_rdwr((rw), (vp), (base), (len), (offset), (seg), (ioflag), (ulimit), (cr), (residp)) 245 246static __inline int 247zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr) 248{ 249 struct mount *mp; |
252 int error, vfslocked; | 250 int error; |
253 254 ASSERT(flag == FSYNC); 255 | 251 252 ASSERT(flag == FSYNC); 253 |
256 vfslocked = VFS_LOCK_GIANT(vp->v_mount); | |
257 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) 258 goto drop; 259 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); 260 error = VOP_FSYNC(vp, MNT_WAIT, curthread); 261 VOP_UNLOCK(vp, 0); 262 vn_finished_write(mp); 263drop: | 254 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) 255 goto drop; 256 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); 257 error = VOP_FSYNC(vp, MNT_WAIT, curthread); 258 VOP_UNLOCK(vp, 0); 259 vn_finished_write(mp); 260drop: |
264 VFS_UNLOCK_GIANT(vfslocked); | |
265 return (error); 266} 267#define VOP_FSYNC(vp, flag, cr, ct) zfs_vop_fsync((vp), (flag), (cr)) 268 269static __inline int 270zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr) 271{ | 261 return (error); 262} 263#define VOP_FSYNC(vp, flag, cr, ct) zfs_vop_fsync((vp), (flag), (cr)) 264 265static __inline int 266zfs_vop_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr) 267{ |
272 int error, vfslocked; | 268 int error; |
273 274 ASSERT(count == 1); 275 ASSERT(offset == 0); 276 | 269 270 ASSERT(count == 1); 271 ASSERT(offset == 0); 272 |
277 vfslocked = VFS_LOCK_GIANT(vp->v_mount); | |
278 error = vn_close(vp, flag, cr, curthread); | 273 error = vn_close(vp, flag, cr, curthread); |
279 VFS_UNLOCK_GIANT(vfslocked); | |
280 return (error); 281} 282#define VOP_CLOSE(vp, oflags, count, offset, cr, ct) \ 283 zfs_vop_close((vp), (oflags), (count), (offset), (cr)) 284 285static __inline int 286vn_rename(char *from, char *to, enum uio_seg seg) 287{ --- 19 unchanged lines hidden --- | 274 return (error); 275} 276#define VOP_CLOSE(vp, oflags, count, offset, cr, ct) \ 277 zfs_vop_close((vp), (oflags), (count), (offset), (cr)) 278 279static __inline int 280vn_rename(char *from, char *to, enum uio_seg seg) 281{ --- 19 unchanged lines hidden --- |