diff options
author | Nathan Scott <nathans@sgi.com> | 2006-06-09 03:00:52 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-06-09 03:00:52 -0400 |
commit | 67fcaa73adafb19139a7cd8ab133592b6a0a0901 (patch) | |
tree | 6e7b83e7c8b0a1d8b4776af1537d6f07ebe9435d /fs/xfs/linux-2.6/xfs_file.c | |
parent | b83bd1388133e914c38bd31d69bc90143e6ab10c (diff) |
[XFS] Resolve a namespace collision on vnode/vnodeops for FreeBSD porters.
SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26107a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 120 |
1 files changed, 44 insertions, 76 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 97615cc74ef5..89b1a7421357 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -58,15 +58,12 @@ __xfs_file_read( | |||
58 | { | 58 | { |
59 | struct iovec iov = {buf, count}; | 59 | struct iovec iov = {buf, count}; |
60 | struct file *file = iocb->ki_filp; | 60 | struct file *file = iocb->ki_filp; |
61 | vnode_t *vp = vn_from_inode(file->f_dentry->d_inode); | 61 | bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode); |
62 | ssize_t rval; | ||
63 | 62 | ||
64 | BUG_ON(iocb->ki_pos != pos); | 63 | BUG_ON(iocb->ki_pos != pos); |
65 | |||
66 | if (unlikely(file->f_flags & O_DIRECT)) | 64 | if (unlikely(file->f_flags & O_DIRECT)) |
67 | ioflags |= IO_ISDIRECT; | 65 | ioflags |= IO_ISDIRECT; |
68 | VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval); | 66 | return bhv_vop_read(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL); |
69 | return rval; | ||
70 | } | 67 | } |
71 | 68 | ||
72 | STATIC ssize_t | 69 | STATIC ssize_t |
@@ -100,15 +97,12 @@ __xfs_file_write( | |||
100 | struct iovec iov = {(void __user *)buf, count}; | 97 | struct iovec iov = {(void __user *)buf, count}; |
101 | struct file *file = iocb->ki_filp; | 98 | struct file *file = iocb->ki_filp; |
102 | struct inode *inode = file->f_mapping->host; | 99 | struct inode *inode = file->f_mapping->host; |
103 | vnode_t *vp = vn_from_inode(inode); | 100 | bhv_vnode_t *vp = vn_from_inode(inode); |
104 | ssize_t rval; | ||
105 | 101 | ||
106 | BUG_ON(iocb->ki_pos != pos); | 102 | BUG_ON(iocb->ki_pos != pos); |
107 | if (unlikely(file->f_flags & O_DIRECT)) | 103 | if (unlikely(file->f_flags & O_DIRECT)) |
108 | ioflags |= IO_ISDIRECT; | 104 | ioflags |= IO_ISDIRECT; |
109 | 105 | return bhv_vop_write(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL); | |
110 | VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval); | ||
111 | return rval; | ||
112 | } | 106 | } |
113 | 107 | ||
114 | STATIC ssize_t | 108 | STATIC ssize_t |
@@ -140,7 +134,7 @@ __xfs_file_readv( | |||
140 | loff_t *ppos) | 134 | loff_t *ppos) |
141 | { | 135 | { |
142 | struct inode *inode = file->f_mapping->host; | 136 | struct inode *inode = file->f_mapping->host; |
143 | vnode_t *vp = vn_from_inode(inode); | 137 | bhv_vnode_t *vp = vn_from_inode(inode); |
144 | struct kiocb kiocb; | 138 | struct kiocb kiocb; |
145 | ssize_t rval; | 139 | ssize_t rval; |
146 | 140 | ||
@@ -149,7 +143,8 @@ __xfs_file_readv( | |||
149 | 143 | ||
150 | if (unlikely(file->f_flags & O_DIRECT)) | 144 | if (unlikely(file->f_flags & O_DIRECT)) |
151 | ioflags |= IO_ISDIRECT; | 145 | ioflags |= IO_ISDIRECT; |
152 | VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); | 146 | rval = bhv_vop_read(vp, &kiocb, iov, nr_segs, |
147 | &kiocb.ki_pos, ioflags, NULL); | ||
153 | 148 | ||
154 | *ppos = kiocb.ki_pos; | 149 | *ppos = kiocb.ki_pos; |
155 | return rval; | 150 | return rval; |
@@ -184,7 +179,7 @@ __xfs_file_writev( | |||
184 | loff_t *ppos) | 179 | loff_t *ppos) |
185 | { | 180 | { |
186 | struct inode *inode = file->f_mapping->host; | 181 | struct inode *inode = file->f_mapping->host; |
187 | vnode_t *vp = vn_from_inode(inode); | 182 | bhv_vnode_t *vp = vn_from_inode(inode); |
188 | struct kiocb kiocb; | 183 | struct kiocb kiocb; |
189 | ssize_t rval; | 184 | ssize_t rval; |
190 | 185 | ||
@@ -193,7 +188,8 @@ __xfs_file_writev( | |||
193 | if (unlikely(file->f_flags & O_DIRECT)) | 188 | if (unlikely(file->f_flags & O_DIRECT)) |
194 | ioflags |= IO_ISDIRECT; | 189 | ioflags |= IO_ISDIRECT; |
195 | 190 | ||
196 | VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); | 191 | rval = bhv_vop_write(vp, &kiocb, iov, nr_segs, |
192 | &kiocb.ki_pos, ioflags, NULL); | ||
197 | 193 | ||
198 | *ppos = kiocb.ki_pos; | 194 | *ppos = kiocb.ki_pos; |
199 | return rval; | 195 | return rval; |
@@ -227,11 +223,8 @@ xfs_file_sendfile( | |||
227 | read_actor_t actor, | 223 | read_actor_t actor, |
228 | void *target) | 224 | void *target) |
229 | { | 225 | { |
230 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 226 | return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode), |
231 | ssize_t rval; | 227 | filp, pos, 0, count, actor, target, NULL); |
232 | |||
233 | VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval); | ||
234 | return rval; | ||
235 | } | 228 | } |
236 | 229 | ||
237 | STATIC ssize_t | 230 | STATIC ssize_t |
@@ -242,11 +235,8 @@ xfs_file_sendfile_invis( | |||
242 | read_actor_t actor, | 235 | read_actor_t actor, |
243 | void *target) | 236 | void *target) |
244 | { | 237 | { |
245 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 238 | return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode), |
246 | ssize_t rval; | 239 | filp, pos, IO_INVIS, count, actor, target, NULL); |
247 | |||
248 | VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval); | ||
249 | return rval; | ||
250 | } | 240 | } |
251 | 241 | ||
252 | STATIC ssize_t | 242 | STATIC ssize_t |
@@ -257,11 +247,8 @@ xfs_file_splice_read( | |||
257 | size_t len, | 247 | size_t len, |
258 | unsigned int flags) | 248 | unsigned int flags) |
259 | { | 249 | { |
260 | vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); | 250 | return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode), |
261 | ssize_t rval; | 251 | infilp, ppos, pipe, len, flags, 0, NULL); |
262 | |||
263 | VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval); | ||
264 | return rval; | ||
265 | } | 252 | } |
266 | 253 | ||
267 | STATIC ssize_t | 254 | STATIC ssize_t |
@@ -272,11 +259,9 @@ xfs_file_splice_read_invis( | |||
272 | size_t len, | 259 | size_t len, |
273 | unsigned int flags) | 260 | unsigned int flags) |
274 | { | 261 | { |
275 | vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); | 262 | return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode), |
276 | ssize_t rval; | 263 | infilp, ppos, pipe, len, flags, IO_INVIS, |
277 | 264 | NULL); | |
278 | VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval); | ||
279 | return rval; | ||
280 | } | 265 | } |
281 | 266 | ||
282 | STATIC ssize_t | 267 | STATIC ssize_t |
@@ -287,11 +272,8 @@ xfs_file_splice_write( | |||
287 | size_t len, | 272 | size_t len, |
288 | unsigned int flags) | 273 | unsigned int flags) |
289 | { | 274 | { |
290 | vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); | 275 | return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode), |
291 | ssize_t rval; | 276 | pipe, outfilp, ppos, len, flags, 0, NULL); |
292 | |||
293 | VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval); | ||
294 | return rval; | ||
295 | } | 277 | } |
296 | 278 | ||
297 | STATIC ssize_t | 279 | STATIC ssize_t |
@@ -302,11 +284,9 @@ xfs_file_splice_write_invis( | |||
302 | size_t len, | 284 | size_t len, |
303 | unsigned int flags) | 285 | unsigned int flags) |
304 | { | 286 | { |
305 | vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); | 287 | return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode), |
306 | ssize_t rval; | 288 | pipe, outfilp, ppos, len, flags, IO_INVIS, |
307 | 289 | NULL); | |
308 | VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval); | ||
309 | return rval; | ||
310 | } | 290 | } |
311 | 291 | ||
312 | STATIC int | 292 | STATIC int |
@@ -314,24 +294,17 @@ xfs_file_open( | |||
314 | struct inode *inode, | 294 | struct inode *inode, |
315 | struct file *filp) | 295 | struct file *filp) |
316 | { | 296 | { |
317 | vnode_t *vp = vn_from_inode(inode); | ||
318 | int error; | ||
319 | |||
320 | if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) | 297 | if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) |
321 | return -EFBIG; | 298 | return -EFBIG; |
322 | VOP_OPEN(vp, NULL, error); | 299 | return -bhv_vop_open(vn_from_inode(inode), NULL); |
323 | return -error; | ||
324 | } | 300 | } |
325 | 301 | ||
326 | STATIC int | 302 | STATIC int |
327 | xfs_file_close( | 303 | xfs_file_close( |
328 | struct file *filp) | 304 | struct file *filp) |
329 | { | 305 | { |
330 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 306 | return -bhv_vop_close(vn_from_inode(filp->f_dentry->d_inode), 0, |
331 | int error; | 307 | file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL); |
332 | |||
333 | VOP_CLOSE(vp, 0, file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL, error); | ||
334 | return -error; | ||
335 | } | 308 | } |
336 | 309 | ||
337 | STATIC int | 310 | STATIC int |
@@ -339,12 +312,11 @@ xfs_file_release( | |||
339 | struct inode *inode, | 312 | struct inode *inode, |
340 | struct file *filp) | 313 | struct file *filp) |
341 | { | 314 | { |
342 | vnode_t *vp = vn_from_inode(inode); | 315 | bhv_vnode_t *vp = vn_from_inode(inode); |
343 | int error = 0; | ||
344 | 316 | ||
345 | if (vp) | 317 | if (vp) |
346 | VOP_RELEASE(vp, error); | 318 | return -bhv_vop_release(vp); |
347 | return -error; | 319 | return 0; |
348 | } | 320 | } |
349 | 321 | ||
350 | STATIC int | 322 | STATIC int |
@@ -353,17 +325,14 @@ xfs_file_fsync( | |||
353 | struct dentry *dentry, | 325 | struct dentry *dentry, |
354 | int datasync) | 326 | int datasync) |
355 | { | 327 | { |
356 | struct inode *inode = dentry->d_inode; | 328 | bhv_vnode_t *vp = vn_from_inode(dentry->d_inode); |
357 | vnode_t *vp = vn_from_inode(inode); | ||
358 | int error; | ||
359 | int flags = FSYNC_WAIT; | 329 | int flags = FSYNC_WAIT; |
360 | 330 | ||
361 | if (datasync) | 331 | if (datasync) |
362 | flags |= FSYNC_DATA; | 332 | flags |= FSYNC_DATA; |
363 | if (VN_TRUNC(vp)) | 333 | if (VN_TRUNC(vp)) |
364 | VUNTRUNCATE(vp); | 334 | VUNTRUNCATE(vp); |
365 | VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); | 335 | return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1); |
366 | return -error; | ||
367 | } | 336 | } |
368 | 337 | ||
369 | #ifdef CONFIG_XFS_DMAPI | 338 | #ifdef CONFIG_XFS_DMAPI |
@@ -374,7 +343,7 @@ xfs_vm_nopage( | |||
374 | int *type) | 343 | int *type) |
375 | { | 344 | { |
376 | struct inode *inode = area->vm_file->f_dentry->d_inode; | 345 | struct inode *inode = area->vm_file->f_dentry->d_inode; |
377 | vnode_t *vp = vn_from_inode(inode); | 346 | bhv_vnode_t *vp = vn_from_inode(inode); |
378 | 347 | ||
379 | ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); | 348 | ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); |
380 | if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0)) | 349 | if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0)) |
@@ -390,7 +359,7 @@ xfs_file_readdir( | |||
390 | filldir_t filldir) | 359 | filldir_t filldir) |
391 | { | 360 | { |
392 | int error = 0; | 361 | int error = 0; |
393 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 362 | bhv_vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); |
394 | uio_t uio; | 363 | uio_t uio; |
395 | iovec_t iov; | 364 | iovec_t iov; |
396 | int eof = 0; | 365 | int eof = 0; |
@@ -425,7 +394,7 @@ xfs_file_readdir( | |||
425 | 394 | ||
426 | start_offset = uio.uio_offset; | 395 | start_offset = uio.uio_offset; |
427 | 396 | ||
428 | VOP_READDIR(vp, &uio, NULL, &eof, error); | 397 | error = bhv_vop_readdir(vp, &uio, NULL, &eof); |
429 | if ((uio.uio_offset == start_offset) || error) { | 398 | if ((uio.uio_offset == start_offset) || error) { |
430 | size = 0; | 399 | size = 0; |
431 | break; | 400 | break; |
@@ -475,18 +444,17 @@ xfs_file_mmap( | |||
475 | return 0; | 444 | return 0; |
476 | } | 445 | } |
477 | 446 | ||
478 | |||
479 | STATIC long | 447 | STATIC long |
480 | xfs_file_ioctl( | 448 | xfs_file_ioctl( |
481 | struct file *filp, | 449 | struct file *filp, |
482 | unsigned int cmd, | 450 | unsigned int cmd, |
483 | unsigned long arg) | 451 | unsigned long p) |
484 | { | 452 | { |
485 | int error; | 453 | int error; |
486 | struct inode *inode = filp->f_dentry->d_inode; | 454 | struct inode *inode = filp->f_dentry->d_inode; |
487 | vnode_t *vp = vn_from_inode(inode); | 455 | bhv_vnode_t *vp = vn_from_inode(inode); |
488 | 456 | ||
489 | VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error); | 457 | error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p); |
490 | VMODIFY(vp); | 458 | VMODIFY(vp); |
491 | 459 | ||
492 | /* NOTE: some of the ioctl's return positive #'s as a | 460 | /* NOTE: some of the ioctl's return positive #'s as a |
@@ -502,13 +470,13 @@ STATIC long | |||
502 | xfs_file_ioctl_invis( | 470 | xfs_file_ioctl_invis( |
503 | struct file *filp, | 471 | struct file *filp, |
504 | unsigned int cmd, | 472 | unsigned int cmd, |
505 | unsigned long arg) | 473 | unsigned long p) |
506 | { | 474 | { |
507 | struct inode *inode = filp->f_dentry->d_inode; | ||
508 | vnode_t *vp = vn_from_inode(inode); | ||
509 | int error; | 475 | int error; |
476 | struct inode *inode = filp->f_dentry->d_inode; | ||
477 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
510 | 478 | ||
511 | VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, (void __user *)arg, error); | 479 | error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p); |
512 | VMODIFY(vp); | 480 | VMODIFY(vp); |
513 | 481 | ||
514 | /* NOTE: some of the ioctl's return positive #'s as a | 482 | /* NOTE: some of the ioctl's return positive #'s as a |
@@ -527,7 +495,7 @@ xfs_vm_mprotect( | |||
527 | struct vm_area_struct *vma, | 495 | struct vm_area_struct *vma, |
528 | unsigned int newflags) | 496 | unsigned int newflags) |
529 | { | 497 | { |
530 | vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode); | 498 | bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode); |
531 | int error = 0; | 499 | int error = 0; |
532 | 500 | ||
533 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { | 501 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { |
@@ -553,7 +521,7 @@ STATIC int | |||
553 | xfs_file_open_exec( | 521 | xfs_file_open_exec( |
554 | struct inode *inode) | 522 | struct inode *inode) |
555 | { | 523 | { |
556 | vnode_t *vp = vn_from_inode(inode); | 524 | bhv_vnode_t *vp = vn_from_inode(inode); |
557 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); | 525 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); |
558 | int error = 0; | 526 | int error = 0; |
559 | xfs_inode_t *ip; | 527 | xfs_inode_t *ip; |