aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_iops.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2006-06-09 03:00:52 -0400
committerNathan Scott <nathans@sgi.com>2006-06-09 03:00:52 -0400
commit67fcaa73adafb19139a7cd8ab133592b6a0a0901 (patch)
tree6e7b83e7c8b0a1d8b4776af1537d6f07ebe9435d /fs/xfs/linux-2.6/xfs_iops.c
parentb83bd1388133e914c38bd31d69bc90143e6ab10c (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_iops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c99
1 files changed, 44 insertions, 55 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 0da1d6b081e7..0857658882e0 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -61,7 +61,7 @@
61 */ 61 */
62xfs_inode_t * 62xfs_inode_t *
63xfs_vtoi( 63xfs_vtoi(
64 struct vnode *vp) 64 bhv_vnode_t *vp)
65{ 65{
66 bhv_desc_t *bdp; 66 bhv_desc_t *bdp;
67 67
@@ -80,7 +80,7 @@ void
80xfs_synchronize_atime( 80xfs_synchronize_atime(
81 xfs_inode_t *ip) 81 xfs_inode_t *ip)
82{ 82{
83 vnode_t *vp; 83 bhv_vnode_t *vp;
84 84
85 vp = XFS_ITOV_NULL(ip); 85 vp = XFS_ITOV_NULL(ip);
86 if (vp) { 86 if (vp) {
@@ -202,12 +202,8 @@ xfs_validate_fields(
202 struct inode *ip, 202 struct inode *ip,
203 struct vattr *vattr) 203 struct vattr *vattr)
204{ 204{
205 vnode_t *vp = vn_from_inode(ip);
206 int error;
207
208 vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; 205 vattr->va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
209 VOP_GETATTR(vp, vattr, ATTR_LAZY, NULL, error); 206 if (!bhv_vop_getattr(vn_from_inode(ip), vattr, ATTR_LAZY, NULL)) {
210 if (likely(!error)) {
211 ip->i_nlink = vattr->va_nlink; 207 ip->i_nlink = vattr->va_nlink;
212 ip->i_blocks = vattr->va_nblocks; 208 ip->i_blocks = vattr->va_nblocks;
213 209
@@ -225,7 +221,7 @@ xfs_validate_fields(
225 */ 221 */
226STATIC int 222STATIC int
227xfs_init_security( 223xfs_init_security(
228 struct vnode *vp, 224 bhv_vnode_t *vp,
229 struct inode *dir) 225 struct inode *dir)
230{ 226{
231 struct inode *ip = vn_to_inode(vp); 227 struct inode *ip = vn_to_inode(vp);
@@ -241,7 +237,7 @@ xfs_init_security(
241 return -error; 237 return -error;
242 } 238 }
243 239
244 VOP_ATTR_SET(vp, name, value, length, ATTR_SECURE, NULL, error); 240 error = bhv_vop_attr_set(vp, name, value, length, ATTR_SECURE, NULL);
245 if (!error) 241 if (!error)
246 VMODIFY(vp); 242 VMODIFY(vp);
247 243
@@ -264,13 +260,12 @@ xfs_has_fs_struct(struct task_struct *task)
264 260
265STATIC inline void 261STATIC inline void
266xfs_cleanup_inode( 262xfs_cleanup_inode(
267 vnode_t *dvp, 263 bhv_vnode_t *dvp,
268 vnode_t *vp, 264 bhv_vnode_t *vp,
269 struct dentry *dentry, 265 struct dentry *dentry,
270 int mode) 266 int mode)
271{ 267{
272 struct dentry teardown = {}; 268 struct dentry teardown = {};
273 int error;
274 269
275 /* Oh, the horror. 270 /* Oh, the horror.
276 * If we can't add the ACL or we fail in 271 * If we can't add the ACL or we fail in
@@ -281,9 +276,9 @@ xfs_cleanup_inode(
281 teardown.d_name = dentry->d_name; 276 teardown.d_name = dentry->d_name;
282 277
283 if (S_ISDIR(mode)) 278 if (S_ISDIR(mode))
284 VOP_RMDIR(dvp, &teardown, NULL, error); 279 bhv_vop_rmdir(dvp, &teardown, NULL);
285 else 280 else
286 VOP_REMOVE(dvp, &teardown, NULL, error); 281 bhv_vop_remove(dvp, &teardown, NULL);
287 VN_RELE(vp); 282 VN_RELE(vp);
288} 283}
289 284
@@ -296,7 +291,7 @@ xfs_vn_mknod(
296{ 291{
297 struct inode *ip; 292 struct inode *ip;
298 vattr_t vattr = { 0 }; 293 vattr_t vattr = { 0 };
299 vnode_t *vp = NULL, *dvp = vn_from_inode(dir); 294 bhv_vnode_t *vp = NULL, *dvp = vn_from_inode(dir);
300 xfs_acl_t *default_acl = NULL; 295 xfs_acl_t *default_acl = NULL;
301 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS; 296 attrexists_t test_default_acl = _ACL_DEFAULT_EXISTS;
302 int error; 297 int error;
@@ -330,10 +325,10 @@ xfs_vn_mknod(
330 vattr.va_mask |= XFS_AT_RDEV; 325 vattr.va_mask |= XFS_AT_RDEV;
331 /*FALLTHROUGH*/ 326 /*FALLTHROUGH*/
332 case S_IFREG: 327 case S_IFREG:
333 VOP_CREATE(dvp, dentry, &vattr, &vp, NULL, error); 328 error = bhv_vop_create(dvp, dentry, &vattr, &vp, NULL);
334 break; 329 break;
335 case S_IFDIR: 330 case S_IFDIR:
336 VOP_MKDIR(dvp, dentry, &vattr, &vp, NULL, error); 331 error = bhv_vop_mkdir(dvp, dentry, &vattr, &vp, NULL);
337 break; 332 break;
338 default: 333 default:
339 error = EINVAL; 334 error = EINVAL;
@@ -396,14 +391,14 @@ xfs_vn_lookup(
396 struct dentry *dentry, 391 struct dentry *dentry,
397 struct nameidata *nd) 392 struct nameidata *nd)
398{ 393{
399 struct vnode *vp = vn_from_inode(dir), *cvp; 394 bhv_vnode_t *vp = vn_from_inode(dir), *cvp;
400 int error; 395 int error;
401 396
402 if (dentry->d_name.len >= MAXNAMELEN) 397 if (dentry->d_name.len >= MAXNAMELEN)
403 return ERR_PTR(-ENAMETOOLONG); 398 return ERR_PTR(-ENAMETOOLONG);
404 399
405 VOP_LOOKUP(vp, dentry, &cvp, 0, NULL, NULL, error); 400 error = bhv_vop_lookup(vp, dentry, &cvp, 0, NULL, NULL);
406 if (error) { 401 if (unlikely(error)) {
407 if (unlikely(error != ENOENT)) 402 if (unlikely(error != ENOENT))
408 return ERR_PTR(-error); 403 return ERR_PTR(-error);
409 d_add(dentry, NULL); 404 d_add(dentry, NULL);
@@ -420,8 +415,8 @@ xfs_vn_link(
420 struct dentry *dentry) 415 struct dentry *dentry)
421{ 416{
422 struct inode *ip; /* inode of guy being linked to */ 417 struct inode *ip; /* inode of guy being linked to */
423 vnode_t *tdvp; /* target directory for new name/link */ 418 bhv_vnode_t *tdvp; /* target directory for new name/link */
424 vnode_t *vp; /* vp of name being linked */ 419 bhv_vnode_t *vp; /* vp of name being linked */
425 vattr_t vattr; 420 vattr_t vattr;
426 int error; 421 int error;
427 422
@@ -432,7 +427,7 @@ xfs_vn_link(
432 tdvp = vn_from_inode(dir); 427 tdvp = vn_from_inode(dir);
433 vp = vn_from_inode(ip); 428 vp = vn_from_inode(ip);
434 429
435 VOP_LINK(tdvp, vp, dentry, NULL, error); 430 error = bhv_vop_link(tdvp, vp, dentry, NULL);
436 if (likely(!error)) { 431 if (likely(!error)) {
437 VMODIFY(tdvp); 432 VMODIFY(tdvp);
438 VN_HOLD(vp); 433 VN_HOLD(vp);
@@ -448,14 +443,14 @@ xfs_vn_unlink(
448 struct dentry *dentry) 443 struct dentry *dentry)
449{ 444{
450 struct inode *inode; 445 struct inode *inode;
451 vnode_t *dvp; /* directory containing name to remove */ 446 bhv_vnode_t *dvp; /* directory containing name to remove */
452 vattr_t vattr; 447 vattr_t vattr;
453 int error; 448 int error;
454 449
455 inode = dentry->d_inode; 450 inode = dentry->d_inode;
456 dvp = vn_from_inode(dir); 451 dvp = vn_from_inode(dir);
457 452
458 VOP_REMOVE(dvp, dentry, NULL, error); 453 error = bhv_vop_remove(dvp, dentry, NULL);
459 if (likely(!error)) { 454 if (likely(!error)) {
460 xfs_validate_fields(dir, &vattr); /* size needs update */ 455 xfs_validate_fields(dir, &vattr); /* size needs update */
461 xfs_validate_fields(inode, &vattr); 456 xfs_validate_fields(inode, &vattr);
@@ -470,27 +465,26 @@ xfs_vn_symlink(
470 const char *symname) 465 const char *symname)
471{ 466{
472 struct inode *ip; 467 struct inode *ip;
473 vattr_t vattr = { 0 }; 468 vattr_t va = { 0 };
474 vnode_t *dvp; /* directory containing name of symlink */ 469 bhv_vnode_t *dvp; /* directory containing name of symlink */
475 vnode_t *cvp; /* used to lookup symlink to put in dentry */ 470 bhv_vnode_t *cvp; /* used to lookup symlink to put in dentry */
476 int error; 471 int error;
477 472
478 dvp = vn_from_inode(dir); 473 dvp = vn_from_inode(dir);
479 cvp = NULL; 474 cvp = NULL;
480 475
481 vattr.va_mode = S_IFLNK | 476 va.va_mode = S_IFLNK |
482 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO); 477 (irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO);
483 vattr.va_mask = XFS_AT_TYPE|XFS_AT_MODE; 478 va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
484 479
485 error = 0; 480 error = bhv_vop_symlink(dvp, dentry, &va, (char *)symname, &cvp, NULL);
486 VOP_SYMLINK(dvp, dentry, &vattr, (char *)symname, &cvp, NULL, error);
487 if (likely(!error && cvp)) { 481 if (likely(!error && cvp)) {
488 error = xfs_init_security(cvp, dir); 482 error = xfs_init_security(cvp, dir);
489 if (likely(!error)) { 483 if (likely(!error)) {
490 ip = vn_to_inode(cvp); 484 ip = vn_to_inode(cvp);
491 d_instantiate(dentry, ip); 485 d_instantiate(dentry, ip);
492 xfs_validate_fields(dir, &vattr); 486 xfs_validate_fields(dir, &va);
493 xfs_validate_fields(ip, &vattr); 487 xfs_validate_fields(ip, &va);
494 } else { 488 } else {
495 xfs_cleanup_inode(dvp, cvp, dentry, 0); 489 xfs_cleanup_inode(dvp, cvp, dentry, 0);
496 } 490 }
@@ -504,11 +498,11 @@ xfs_vn_rmdir(
504 struct dentry *dentry) 498 struct dentry *dentry)
505{ 499{
506 struct inode *inode = dentry->d_inode; 500 struct inode *inode = dentry->d_inode;
507 vnode_t *dvp = vn_from_inode(dir); 501 bhv_vnode_t *dvp = vn_from_inode(dir);
508 vattr_t vattr; 502 vattr_t vattr;
509 int error; 503 int error;
510 504
511 VOP_RMDIR(dvp, dentry, NULL, error); 505 error = bhv_vop_rmdir(dvp, dentry, NULL);
512 if (likely(!error)) { 506 if (likely(!error)) {
513 xfs_validate_fields(inode, &vattr); 507 xfs_validate_fields(inode, &vattr);
514 xfs_validate_fields(dir, &vattr); 508 xfs_validate_fields(dir, &vattr);
@@ -524,15 +518,15 @@ xfs_vn_rename(
524 struct dentry *ndentry) 518 struct dentry *ndentry)
525{ 519{
526 struct inode *new_inode = ndentry->d_inode; 520 struct inode *new_inode = ndentry->d_inode;
527 vnode_t *fvp; /* from directory */ 521 bhv_vnode_t *fvp; /* from directory */
528 vnode_t *tvp; /* target directory */ 522 bhv_vnode_t *tvp; /* target directory */
529 vattr_t vattr; 523 vattr_t vattr;
530 int error; 524 int error;
531 525
532 fvp = vn_from_inode(odir); 526 fvp = vn_from_inode(odir);
533 tvp = vn_from_inode(ndir); 527 tvp = vn_from_inode(ndir);
534 528
535 VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error); 529 error = bhv_vop_rename(fvp, odentry, tvp, ndentry, NULL);
536 if (likely(!error)) { 530 if (likely(!error)) {
537 if (new_inode) 531 if (new_inode)
538 xfs_validate_fields(new_inode, &vattr); 532 xfs_validate_fields(new_inode, &vattr);
@@ -553,7 +547,7 @@ xfs_vn_follow_link(
553 struct dentry *dentry, 547 struct dentry *dentry,
554 struct nameidata *nd) 548 struct nameidata *nd)
555{ 549{
556 vnode_t *vp; 550 bhv_vnode_t *vp;
557 uio_t *uio; 551 uio_t *uio;
558 iovec_t iov; 552 iovec_t iov;
559 int error; 553 int error;
@@ -586,8 +580,8 @@ xfs_vn_follow_link(
586 uio->uio_resid = MAXPATHLEN; 580 uio->uio_resid = MAXPATHLEN;
587 uio->uio_iovcnt = 1; 581 uio->uio_iovcnt = 1;
588 582
589 VOP_READLINK(vp, uio, 0, NULL, error); 583 error = bhv_vop_readlink(vp, uio, 0, NULL);
590 if (error) { 584 if (unlikely(error)) {
591 kfree(link); 585 kfree(link);
592 link = ERR_PTR(-error); 586 link = ERR_PTR(-error);
593 } else { 587 } else {
@@ -618,12 +612,7 @@ xfs_vn_permission(
618 int mode, 612 int mode,
619 struct nameidata *nd) 613 struct nameidata *nd)
620{ 614{
621 vnode_t *vp = vn_from_inode(inode); 615 return -bhv_vop_access(vn_from_inode(inode), mode << 6, NULL);
622 int error;
623
624 mode <<= 6; /* convert from linux to vnode access bits */
625 VOP_ACCESS(vp, mode, NULL, error);
626 return -error;
627} 616}
628#else 617#else
629#define xfs_vn_permission NULL 618#define xfs_vn_permission NULL
@@ -636,7 +625,7 @@ xfs_vn_getattr(
636 struct kstat *stat) 625 struct kstat *stat)
637{ 626{
638 struct inode *inode = dentry->d_inode; 627 struct inode *inode = dentry->d_inode;
639 vnode_t *vp = vn_from_inode(inode); 628 bhv_vnode_t *vp = vn_from_inode(inode);
640 int error = 0; 629 int error = 0;
641 630
642 if (unlikely(vp->v_flag & VMODIFIED)) 631 if (unlikely(vp->v_flag & VMODIFIED))
@@ -653,7 +642,7 @@ xfs_vn_setattr(
653{ 642{
654 struct inode *inode = dentry->d_inode; 643 struct inode *inode = dentry->d_inode;
655 unsigned int ia_valid = attr->ia_valid; 644 unsigned int ia_valid = attr->ia_valid;
656 vnode_t *vp = vn_from_inode(inode); 645 bhv_vnode_t *vp = vn_from_inode(inode);
657 vattr_t vattr = { 0 }; 646 vattr_t vattr = { 0 };
658 int flags = 0; 647 int flags = 0;
659 int error; 648 int error;
@@ -697,7 +686,7 @@ xfs_vn_setattr(
697 flags |= ATTR_NONBLOCK; 686 flags |= ATTR_NONBLOCK;
698#endif 687#endif
699 688
700 VOP_SETATTR(vp, &vattr, flags, NULL, error); 689 error = bhv_vop_setattr(vp, &vattr, flags, NULL);
701 if (likely(!error)) 690 if (likely(!error))
702 __vn_revalidate(vp, &vattr); 691 __vn_revalidate(vp, &vattr);
703 return -error; 692 return -error;
@@ -718,7 +707,7 @@ xfs_vn_setxattr(
718 size_t size, 707 size_t size,
719 int flags) 708 int flags)
720{ 709{
721 vnode_t *vp = vn_from_inode(dentry->d_inode); 710 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
722 char *attr = (char *)name; 711 char *attr = (char *)name;
723 attrnames_t *namesp; 712 attrnames_t *namesp;
724 int xflags = 0; 713 int xflags = 0;
@@ -748,7 +737,7 @@ xfs_vn_getxattr(
748 void *data, 737 void *data,
749 size_t size) 738 size_t size)
750{ 739{
751 vnode_t *vp = vn_from_inode(dentry->d_inode); 740 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
752 char *attr = (char *)name; 741 char *attr = (char *)name;
753 attrnames_t *namesp; 742 attrnames_t *namesp;
754 int xflags = 0; 743 int xflags = 0;
@@ -777,7 +766,7 @@ xfs_vn_listxattr(
777 char *data, 766 char *data,
778 size_t size) 767 size_t size)
779{ 768{
780 vnode_t *vp = vn_from_inode(dentry->d_inode); 769 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
781 int error, xflags = ATTR_KERNAMELS; 770 int error, xflags = ATTR_KERNAMELS;
782 ssize_t result; 771 ssize_t result;
783 772
@@ -796,7 +785,7 @@ xfs_vn_removexattr(
796 struct dentry *dentry, 785 struct dentry *dentry,
797 const char *name) 786 const char *name)
798{ 787{
799 vnode_t *vp = vn_from_inode(dentry->d_inode); 788 bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
800 char *attr = (char *)name; 789 char *attr = (char *)name;
801 attrnames_t *namesp; 790 attrnames_t *namesp;
802 int xflags = 0; 791 int xflags = 0;