cd9660_vfsops.c (42768) | cd9660_vfsops.c (43301) |
---|---|
1/*- 2 * Copyright (c) 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley 6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 | 1/*- 2 * Copyright (c) 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley 6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 |
39 * $Id: cd9660_vfsops.c,v 1.46 1998/12/06 11:36:24 jkh Exp $ | 39 * $Id: cd9660_vfsops.c,v 1.47 1999/01/17 20:41:02 peter Exp $ |
40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/namei.h> 45#include <sys/proc.h> 46#include <sys/kernel.h> 47#include <sys/vnode.h> --- 186 unchanged lines hidden (view full) --- 234 * If mount by non-root, then verify that user has necessary 235 * permissions on the device. 236 */ 237 if (p->p_ucred->cr_uid != 0) { 238 accessmode = VREAD; 239 if ((mp->mnt_flag & MNT_RDONLY) == 0) 240 accessmode |= VWRITE; 241 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); | 40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/namei.h> 45#include <sys/proc.h> 46#include <sys/kernel.h> 47#include <sys/vnode.h> --- 186 unchanged lines hidden (view full) --- 234 * If mount by non-root, then verify that user has necessary 235 * permissions on the device. 236 */ 237 if (p->p_ucred->cr_uid != 0) { 238 accessmode = VREAD; 239 if ((mp->mnt_flag & MNT_RDONLY) == 0) 240 accessmode |= VWRITE; 241 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); |
242 if (error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p)) { | 242 if ((error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p)) != 0) { |
243 vput(devvp); 244 return (error); 245 } 246 VOP_UNLOCK(devvp, 0, p); 247 } 248 249 if ((mp->mnt_flag & MNT_UPDATE) == 0) { 250 if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR) --- 68 unchanged lines hidden (view full) --- 319 * should be 2048 or the physical sector size on the device, 320 * whichever is greater. For now, we'll just use a constant. 321 */ 322 iso_bsize = ISO_DEFAULT_BLOCK_SIZE; 323 324 for (iso_blknum = 16 + argp->ssector; 325 iso_blknum < 100 + argp->ssector; 326 iso_blknum++) { | 243 vput(devvp); 244 return (error); 245 } 246 VOP_UNLOCK(devvp, 0, p); 247 } 248 249 if ((mp->mnt_flag & MNT_UPDATE) == 0) { 250 if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR) --- 68 unchanged lines hidden (view full) --- 319 * should be 2048 or the physical sector size on the device, 320 * whichever is greater. For now, we'll just use a constant. 321 */ 322 iso_bsize = ISO_DEFAULT_BLOCK_SIZE; 323 324 for (iso_blknum = 16 + argp->ssector; 325 iso_blknum < 100 + argp->ssector; 326 iso_blknum++) { |
327 if (error = bread(devvp, iso_blknum * btodb(iso_bsize), 328 iso_bsize, NOCRED, &bp)) | 327 if ((error = bread(devvp, iso_blknum * btodb(iso_bsize), 328 iso_bsize, NOCRED, &bp)) != 0) |
329 goto out; 330 331 vdp = (struct iso_volume_descriptor *)bp->b_data; 332 if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { 333 if (bcmp (vdp->id_sierra, ISO_SIERRA_ID, 334 sizeof vdp->id) != 0) { 335 error = EINVAL; 336 goto out; --- 72 unchanged lines hidden (view full) --- 409 isomp->im_mountp = mp; 410 isomp->im_dev = dev; 411 isomp->im_devvp = devvp; 412 413 devvp->v_specmountpoint = mp; 414 415 /* Check the Rock Ridge Extention support */ 416 if (!(argp->flags & ISOFSMNT_NORRIP)) { | 329 goto out; 330 331 vdp = (struct iso_volume_descriptor *)bp->b_data; 332 if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { 333 if (bcmp (vdp->id_sierra, ISO_SIERRA_ID, 334 sizeof vdp->id) != 0) { 335 error = EINVAL; 336 goto out; --- 72 unchanged lines hidden (view full) --- 409 isomp->im_mountp = mp; 410 isomp->im_dev = dev; 411 isomp->im_devvp = devvp; 412 413 devvp->v_specmountpoint = mp; 414 415 /* Check the Rock Ridge Extention support */ 416 if (!(argp->flags & ISOFSMNT_NORRIP)) { |
417 if (error = bread(isomp->im_devvp, | 417 if ((error = bread(isomp->im_devvp, |
418 (isomp->root_extent + isonum_711(rootp->ext_attr_length)) << 419 (isomp->im_bshift - DEV_BSHIFT), | 418 (isomp->root_extent + isonum_711(rootp->ext_attr_length)) << 419 (isomp->im_bshift - DEV_BSHIFT), |
420 isomp->logical_block_size, NOCRED, &bp)) | 420 isomp->logical_block_size, NOCRED, &bp)) != 0) |
421 goto out; 422 423 rootp = (struct iso_directory_record *)bp->b_data; 424 425 if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) { 426 argp->flags |= ISOFSMNT_NORRIP; 427 } else { 428 argp->flags &= ~ISOFSMNT_GENS; --- 207 unchanged lines hidden (view full) --- 636 637 /* 638 * Get the export permission structure for this <mp, client> tuple. 639 */ 640 np = vfs_export_lookup(mp, &imp->im_export, nam); 641 if (np == NULL) 642 return (EACCES); 643 | 421 goto out; 422 423 rootp = (struct iso_directory_record *)bp->b_data; 424 425 if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) { 426 argp->flags |= ISOFSMNT_NORRIP; 427 } else { 428 argp->flags &= ~ISOFSMNT_GENS; --- 207 unchanged lines hidden (view full) --- 636 637 /* 638 * Get the export permission structure for this <mp, client> tuple. 639 */ 640 np = vfs_export_lookup(mp, &imp->im_export, nam); 641 if (np == NULL) 642 return (EACCES); 643 |
644 if (error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) { | 644 if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) { |
645 *vpp = NULLVP; 646 return (error); 647 } 648 ip = VTOI(nvp); 649 if (ip->inode.iso_mode == 0) { 650 vput(nvp); 651 *vpp = NULLVP; 652 return (ESTALE); --- 42 unchanged lines hidden (view full) --- 695 int error; 696 697 imp = VFSTOISOFS(mp); 698 dev = imp->im_dev; 699 if ((*vpp = cd9660_ihashget(dev, ino)) != NULLVP) 700 return (0); 701 702 /* Allocate a new vnode/iso_node. */ | 645 *vpp = NULLVP; 646 return (error); 647 } 648 ip = VTOI(nvp); 649 if (ip->inode.iso_mode == 0) { 650 vput(nvp); 651 *vpp = NULLVP; 652 return (ESTALE); --- 42 unchanged lines hidden (view full) --- 695 int error; 696 697 imp = VFSTOISOFS(mp); 698 dev = imp->im_dev; 699 if ((*vpp = cd9660_ihashget(dev, ino)) != NULLVP) 700 return (0); 701 702 /* Allocate a new vnode/iso_node. */ |
703 if (error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) { | 703 if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) { |
704 *vpp = NULLVP; 705 return (error); 706 } 707 MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, 708 M_WAITOK); 709 bzero((caddr_t)ip, sizeof(struct iso_node)); 710 lockinit(&ip->i_lock, PINOD, "isonode", 0, 0); 711 vp->v_data = ip; --- 70 unchanged lines hidden (view full) --- 782 if (relocated) { 783 /* 784 * On relocated directories we must 785 * read the `.' entry out of a dir. 786 */ 787 ip->iso_start = ino >> imp->im_bshift; 788 if (bp != 0) 789 brelse(bp); | 704 *vpp = NULLVP; 705 return (error); 706 } 707 MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, 708 M_WAITOK); 709 bzero((caddr_t)ip, sizeof(struct iso_node)); 710 lockinit(&ip->i_lock, PINOD, "isonode", 0, 0); 711 vp->v_data = ip; --- 70 unchanged lines hidden (view full) --- 782 if (relocated) { 783 /* 784 * On relocated directories we must 785 * read the `.' entry out of a dir. 786 */ 787 ip->iso_start = ino >> imp->im_bshift; 788 if (bp != 0) 789 brelse(bp); |
790 if (error = cd9660_blkatoff(vp, (off_t)0, NULL, &bp)) { | 790 if ((error = cd9660_blkatoff(vp, (off_t)0, NULL, &bp)) != 0) { |
791 vput(vp); 792 return (error); 793 } 794 isodir = (struct iso_directory_record *)bp->b_data; 795 } 796 797 ip->iso_extent = isonum_733(isodir->extent); 798 ip->i_size = isonum_733(isodir->size); --- 36 unchanged lines hidden (view full) --- 835 vp->v_op = cd9660_fifoop_p; 836 break; 837 case VCHR: 838 case VBLK: 839 /* 840 * if device, look at device number table for translation 841 */ 842 vp->v_op = cd9660_specop_p; | 791 vput(vp); 792 return (error); 793 } 794 isodir = (struct iso_directory_record *)bp->b_data; 795 } 796 797 ip->iso_extent = isonum_733(isodir->extent); 798 ip->i_size = isonum_733(isodir->size); --- 36 unchanged lines hidden (view full) --- 835 vp->v_op = cd9660_fifoop_p; 836 break; 837 case VCHR: 838 case VBLK: 839 /* 840 * if device, look at device number table for translation 841 */ 842 vp->v_op = cd9660_specop_p; |
843 if (nvp = checkalias(vp, ip->inode.iso_rdev, mp)) { | 843 if ((nvp = checkalias(vp, ip->inode.iso_rdev, mp)) != NULL) { |
844 /* 845 * Discard unneeded vnode, but save its iso_node. 846 * Note that the lock is carried over in the iso_node 847 * to the replacement vnode. 848 */ 849 nvp->v_data = vp->v_data; 850 vp->v_data = NULL; 851 vp->v_op = spec_vnodeop_p; 852 vrele(vp); 853 vgone(vp); 854 /* 855 * Reinitialize aliased inode. 856 */ 857 vp = nvp; 858 ip->i_vnode = vp; 859 } 860 break; | 844 /* 845 * Discard unneeded vnode, but save its iso_node. 846 * Note that the lock is carried over in the iso_node 847 * to the replacement vnode. 848 */ 849 nvp->v_data = vp->v_data; 850 vp->v_data = NULL; 851 vp->v_op = spec_vnodeop_p; 852 vrele(vp); 853 vgone(vp); 854 /* 855 * Reinitialize aliased inode. 856 */ 857 vp = nvp; 858 ip->i_vnode = vp; 859 } 860 break; |
861 default: 862 break; |
|
861 } 862 863 if (ip->iso_extent == imp->root_extent) 864 vp->v_flag |= VROOT; 865 866 /* 867 * XXX need generation number? 868 */ --- 29 unchanged lines hidden --- | 863 } 864 865 if (ip->iso_extent == imp->root_extent) 866 vp->v_flag |= VROOT; 867 868 /* 869 * XXX need generation number? 870 */ --- 29 unchanged lines hidden --- |