msdosfs_vfsops.c (132805) | msdosfs_vfsops.c (132902) |
---|---|
1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_vfsops.c 132805 2004-07-28 20:21:04Z phk $ */ | 1/* $FreeBSD: head/sys/fs/msdosfs/msdosfs_vfsops.c 132902 2004-07-30 22:08:52Z phk $ */ |
2/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ 3 4/*- 5 * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. 6 * Copyright (C) 1994, 1995, 1997 TooLs GmbH. 7 * All rights reserved. 8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). 9 * --- 81 unchanged lines hidden (view full) --- 91 92struct iconv_functions *msdosfs_iconv = NULL; 93 94static int update_mp(struct mount *mp, struct msdosfs_args *argp, 95 struct thread *td); 96static int mountmsdosfs(struct vnode *devvp, struct mount *mp, 97 struct thread *td, struct msdosfs_args *argp); 98static vfs_fhtovp_t msdosfs_fhtovp; | 2/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ 3 4/*- 5 * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. 6 * Copyright (C) 1994, 1995, 1997 TooLs GmbH. 7 * All rights reserved. 8 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). 9 * --- 81 unchanged lines hidden (view full) --- 91 92struct iconv_functions *msdosfs_iconv = NULL; 93 94static int update_mp(struct mount *mp, struct msdosfs_args *argp, 95 struct thread *td); 96static int mountmsdosfs(struct vnode *devvp, struct mount *mp, 97 struct thread *td, struct msdosfs_args *argp); 98static vfs_fhtovp_t msdosfs_fhtovp; |
99static vfs_mount_t msdosfs_mount; | 99static vfs_omount_t msdosfs_omount; |
100static vfs_root_t msdosfs_root; 101static vfs_statfs_t msdosfs_statfs; 102static vfs_sync_t msdosfs_sync; 103static vfs_unmount_t msdosfs_unmount; 104static vfs_vptofh_t msdosfs_vptofh; 105 106static int 107update_mp(mp, argp, td) --- 45 unchanged lines hidden (view full) --- 153} 154 155/* 156 * mp - path - addr in user space of mount point (ie /usr or whatever) 157 * data - addr in user space of mount params including the name of the block 158 * special file to treat as a filesystem. 159 */ 160static int | 100static vfs_root_t msdosfs_root; 101static vfs_statfs_t msdosfs_statfs; 102static vfs_sync_t msdosfs_sync; 103static vfs_unmount_t msdosfs_unmount; 104static vfs_vptofh_t msdosfs_vptofh; 105 106static int 107update_mp(mp, argp, td) --- 45 unchanged lines hidden (view full) --- 153} 154 155/* 156 * mp - path - addr in user space of mount point (ie /usr or whatever) 157 * data - addr in user space of mount params including the name of the block 158 * special file to treat as a filesystem. 159 */ 160static int |
161msdosfs_mount(mp, path, data, ndp, td) | 161msdosfs_omount(mp, path, data, td) |
162 struct mount *mp; 163 char *path; 164 caddr_t data; | 162 struct mount *mp; 163 char *path; 164 caddr_t data; |
165 struct nameidata *ndp; | |
166 struct thread *td; 167{ 168 struct vnode *devvp; /* vnode for blk device to mount */ 169 struct msdosfs_args args; /* will hold data from mount request */ 170 /* msdosfs specific mount control block */ 171 struct msdosfsmount *pmp = NULL; | 165 struct thread *td; 166{ 167 struct vnode *devvp; /* vnode for blk device to mount */ 168 struct msdosfs_args args; /* will hold data from mount request */ 169 /* msdosfs specific mount control block */ 170 struct msdosfsmount *pmp = NULL; |
171 struct nameidata ndp; |
|
172 size_t size; 173 int error, flags; 174 mode_t accessmode; 175 176 error = copyin(data, (caddr_t)&args, sizeof(struct msdosfs_args)); 177 if (error) 178 return (error); 179 if (args.magic != MSDOSFS_ARGSMAGIC) --- 56 unchanged lines hidden (view full) --- 236 return (EOPNOTSUPP); 237 return (vfs_export(mp, &args.export)); 238 } 239 } 240 /* 241 * Not an update, or updating the name: look up the name 242 * and verify that it refers to a sensible disk device. 243 */ | 172 size_t size; 173 int error, flags; 174 mode_t accessmode; 175 176 error = copyin(data, (caddr_t)&args, sizeof(struct msdosfs_args)); 177 if (error) 178 return (error); 179 if (args.magic != MSDOSFS_ARGSMAGIC) --- 56 unchanged lines hidden (view full) --- 236 return (EOPNOTSUPP); 237 return (vfs_export(mp, &args.export)); 238 } 239 } 240 /* 241 * Not an update, or updating the name: look up the name 242 * and verify that it refers to a sensible disk device. 243 */ |
244 NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td); 245 error = namei(ndp); | 244 NDINIT(&ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td); 245 error = namei(&ndp); |
246 if (error) 247 return (error); | 246 if (error) 247 return (error); |
248 devvp = ndp->ni_vp; 249 NDFREE(ndp, NDF_ONLY_PNBUF); | 248 devvp = ndp.ni_vp; 249 NDFREE(&ndp, NDF_ONLY_PNBUF); |
250 251 if (!vn_isdisk(devvp, &error)) { 252 vrele(devvp); 253 return (error); 254 } 255 /* 256 * If mount by non-root, then verify that user has necessary 257 * permissions on the device. --- 31 unchanged lines hidden (view full) --- 289 msdosfs_unmount(mp, MNT_FORCE, td); 290 return error; 291 } 292 (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 293 &size); 294 bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 295 (void) msdosfs_statfs(mp, &mp->mnt_stat, td); 296#ifdef MSDOSFS_DEBUG | 250 251 if (!vn_isdisk(devvp, &error)) { 252 vrele(devvp); 253 return (error); 254 } 255 /* 256 * If mount by non-root, then verify that user has necessary 257 * permissions on the device. --- 31 unchanged lines hidden (view full) --- 289 msdosfs_unmount(mp, MNT_FORCE, td); 290 return error; 291 } 292 (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 293 &size); 294 bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 295 (void) msdosfs_statfs(mp, &mp->mnt_stat, td); 296#ifdef MSDOSFS_DEBUG |
297 printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap); | 297 printf("msdosfs_omount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap); |
298#endif 299 return (0); 300} 301 302static int 303mountmsdosfs(devvp, mp, td, argp) 304 struct vnode *devvp; 305 struct mount *mp; --- 589 unchanged lines hidden (view full) --- 895 defhp->defid_dirofs = dep->de_diroffset; 896 /* defhp->defid_gen = dep->de_gen; */ 897 return (0); 898} 899 900static struct vfsops msdosfs_vfsops = { 901 .vfs_fhtovp = msdosfs_fhtovp, 902 .vfs_init = msdosfs_init, | 298#endif 299 return (0); 300} 301 302static int 303mountmsdosfs(devvp, mp, td, argp) 304 struct vnode *devvp; 305 struct mount *mp; --- 589 unchanged lines hidden (view full) --- 895 defhp->defid_dirofs = dep->de_diroffset; 896 /* defhp->defid_gen = dep->de_gen; */ 897 return (0); 898} 899 900static struct vfsops msdosfs_vfsops = { 901 .vfs_fhtovp = msdosfs_fhtovp, 902 .vfs_init = msdosfs_init, |
903 .vfs_mount = msdosfs_mount, | 903 .vfs_omount = msdosfs_omount, |
904 .vfs_root = msdosfs_root, 905 .vfs_statfs = msdosfs_statfs, 906 .vfs_sync = msdosfs_sync, 907 .vfs_uninit = msdosfs_uninit, 908 .vfs_unmount = msdosfs_unmount, 909 .vfs_vptofh = msdosfs_vptofh, 910}; 911 912VFS_SET(msdosfs_vfsops, msdosfs, 0); 913MODULE_VERSION(msdosfs, 1); | 904 .vfs_root = msdosfs_root, 905 .vfs_statfs = msdosfs_statfs, 906 .vfs_sync = msdosfs_sync, 907 .vfs_uninit = msdosfs_uninit, 908 .vfs_unmount = msdosfs_unmount, 909 .vfs_vptofh = msdosfs_vptofh, 910}; 911 912VFS_SET(msdosfs_vfsops, msdosfs, 0); 913MODULE_VERSION(msdosfs, 1); |