fuse_vnops.c (2aaf9152a852aba9eb2036b95f4948ee77988826) | fuse_vnops.c (7e4844f7d9546ba65202fbe834d1c06aa72a37b8) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2007-2009 Google Inc. and Amit Singh 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 are --- 464 unchanged lines hidden (view full) --- 473static int 474fuse_vnop_getattr(struct vop_getattr_args *ap) 475{ 476 struct vnode *vp = ap->a_vp; 477 struct vattr *vap = ap->a_vap; 478 struct ucred *cred = ap->a_cred; 479 struct thread *td = curthread; 480 struct fuse_vnode_data *fvdat = VTOFUD(vp); | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2007-2009 Google Inc. and Amit Singh 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 are --- 464 unchanged lines hidden (view full) --- 473static int 474fuse_vnop_getattr(struct vop_getattr_args *ap) 475{ 476 struct vnode *vp = ap->a_vp; 477 struct vattr *vap = ap->a_vap; 478 struct ucred *cred = ap->a_cred; 479 struct thread *td = curthread; 480 struct fuse_vnode_data *fvdat = VTOFUD(vp); |
481 struct fuse_attr_out *fao; |
|
481 482 int err = 0; 483 int dataflags; 484 struct fuse_dispatcher fdi; 485 486 dataflags = fuse_get_mpdata(vnode_mount(vp))->dataflags; 487 488 /* Note that we are not bailing out on a dead file system just yet. */ --- 15 unchanged lines hidden (view full) --- 504 goto fake; 505 } 506 if (err == ENOENT) { 507 fuse_internal_vnode_disappear(vp); 508 } 509 goto out; 510 } 511 | 482 483 int err = 0; 484 int dataflags; 485 struct fuse_dispatcher fdi; 486 487 dataflags = fuse_get_mpdata(vnode_mount(vp))->dataflags; 488 489 /* Note that we are not bailing out on a dead file system just yet. */ --- 15 unchanged lines hidden (view full) --- 505 goto fake; 506 } 507 if (err == ENOENT) { 508 fuse_internal_vnode_disappear(vp); 509 } 510 goto out; 511 } 512 |
512 cache_attrs(vp, (struct fuse_attr_out *)fdi.answ, vap); | 513 fao = (struct fuse_attr_out *)fdi.answ; 514 fuse_internal_cache_attrs(vp, &fao->attr, fao->attr_valid, 515 fao->attr_valid_nsec, vap); |
513 if (vap->va_type != vnode_vtype(vp)) { 514 fuse_internal_vnode_disappear(vp); 515 err = ENOENT; 516 goto out; 517 } 518 if ((fvdat->flag & FN_SIZECHANGE) != 0) 519 vap->va_size = fvdat->filesize; 520 --- 449 unchanged lines hidden (view full) --- 970 971 (void)fuse_vnode_setsize(vp, cred, fattr->size); 972 fvdat->flag &= ~FN_SIZECHANGE; 973 } 974 *vpp = vp; 975 } 976 977 if (op == FUSE_GETATTR) { | 516 if (vap->va_type != vnode_vtype(vp)) { 517 fuse_internal_vnode_disappear(vp); 518 err = ENOENT; 519 goto out; 520 } 521 if ((fvdat->flag & FN_SIZECHANGE) != 0) 522 vap->va_size = fvdat->filesize; 523 --- 449 unchanged lines hidden (view full) --- 973 974 (void)fuse_vnode_setsize(vp, cred, fattr->size); 975 fvdat->flag &= ~FN_SIZECHANGE; 976 } 977 *vpp = vp; 978 } 979 980 if (op == FUSE_GETATTR) { |
978 cache_attrs(*vpp, (struct fuse_attr_out *)fdi.answ, 979 NULL); | 981 struct fuse_attr_out *fao = 982 (struct fuse_attr_out*)fdi.answ; 983 fuse_internal_cache_attrs(*vpp, 984 &fao->attr, fao->attr_valid, 985 fao->attr_valid_nsec, NULL); |
980 } else { | 986 } else { |
981 cache_attrs(*vpp, (struct fuse_entry_out *)fdi.answ, 982 NULL); | 987 struct fuse_entry_out *feo = 988 (struct fuse_entry_out*)fdi.answ; 989 fuse_internal_cache_attrs(*vpp, 990 &feo->attr, feo->attr_valid, 991 feo->attr_valid_nsec, NULL); |
983 } 984 985 /* Insert name into cache if appropriate. */ 986 987 /* 988 * Nooo, caching is evil. With caching, we can't avoid stale 989 * information taking over the playground (cached info is not 990 * just positive/negative, it does have qualitative aspects, --- 640 unchanged lines hidden (view full) --- 1631 * There's nothing really we can do, so let us just 1632 * force an internal revocation and tell the caller to 1633 * try again, if interested. 1634 */ 1635 fuse_internal_vnode_disappear(vp); 1636 err = EAGAIN; 1637 } 1638 } | 992 } 993 994 /* Insert name into cache if appropriate. */ 995 996 /* 997 * Nooo, caching is evil. With caching, we can't avoid stale 998 * information taking over the playground (cached info is not 999 * just positive/negative, it does have qualitative aspects, --- 640 unchanged lines hidden (view full) --- 1640 * There's nothing really we can do, so let us just 1641 * force an internal revocation and tell the caller to 1642 * try again, if interested. 1643 */ 1644 fuse_internal_vnode_disappear(vp); 1645 err = EAGAIN; 1646 } 1647 } |
1639 if (err == 0) 1640 cache_attrs(vp, (struct fuse_attr_out *)fdi.answ, NULL); | 1648 if (err == 0) { 1649 struct fuse_attr_out *fao = (struct fuse_attr_out*)fdi.answ; 1650 fuse_internal_cache_attrs(vp, &fao->attr, fao->attr_valid, 1651 fao->attr_valid_nsec, NULL); 1652 } |
1641 1642out: 1643 fdisp_destroy(&fdi); 1644 if (!err && sizechanged) { 1645 fuse_vnode_setsize(vp, cred, newsize); 1646 VTOFUD(vp)->flag &= ~FN_SIZECHANGE; 1647 } 1648 return err; --- 715 unchanged lines hidden --- | 1653 1654out: 1655 fdisp_destroy(&fdi); 1656 if (!err && sizechanged) { 1657 fuse_vnode_setsize(vp, cred, newsize); 1658 VTOFUD(vp)->flag &= ~FN_SIZECHANGE; 1659 } 1660 return err; --- 715 unchanged lines hidden --- |