155 _fini()
156 {
157 return (EBUSY);
158 }
159
160 int
161 _info(struct modinfo *modinfop)
162 {
163 return (mod_info(&modlinkage, modinfop));
164 }
165
166
167 /* -------------------- vfs routines -------------------- */
168
169 /*
170 * XXX - this appears only to be used by the VM code to handle the case where
171 * UNIX is running off the mini-root. That probably wants to be done
172 * differently.
173 */
174 struct vnode *rootvp;
175 #ifndef __lint
176 _NOTE(SCHEME_PROTECTS_DATA("safe sharing", rootvp))
177 #endif
178 static int32_t
179 udf_mount(struct vfs *vfsp, struct vnode *mvp,
180 struct mounta *uap, struct cred *cr)
181 {
182 dev_t dev;
183 struct vnode *lvp = NULL;
184 struct vnode *svp = NULL;
185 struct pathname dpn;
186 int32_t error;
187 enum whymountroot why;
188 int oflag, aflag;
189
190 ud_printf("udf_mount\n");
191
192 if ((error = secpolicy_fs_mount(cr, mvp, vfsp)) != 0) {
193 return (error);
194 }
195
196 if (mvp->v_type != VDIR) {
197 return (ENOTDIR);
773 }
774 return (error);
775 }
776
777 ASSERT(devvp != 0);
778 /*
779 * Flush back any dirty pages on the block device to
780 * try and keep the buffer cache in sync with the page
781 * cache if someone is trying to use block devices when
782 * they really should be using the raw device.
783 */
784 (void) VOP_PUTPAGE(common_specvp(devvp), (offset_t)0,
785 (uint32_t)0, B_INVAL, cr, NULL);
786
787
788 /*
789 * Check if the file system
790 * is a valid udfs and fill
791 * the required fields in udf_vfs
792 */
793 #ifndef __lint
794 _NOTE(NO_COMPETING_THREADS_NOW);
795 #endif
796
797 if ((lbsize = ud_get_lbsize(dev, &avd_loc)) == 0) {
798 error = EINVAL;
799 goto out;
800 }
801
802 udf_vfsp = ud_validate_and_fill_superblock(dev, lbsize, avd_loc);
803 if (udf_vfsp == NULL) {
804 error = EINVAL;
805 goto out;
806 }
807
808 /*
809 * Fill in vfs private data
810 */
811 vfsp->vfs_fstype = udf_fstype;
812 vfs_make_fsid(&vfsp->vfs_fsid, dev, udf_fstype);
813 vfsp->vfs_data = (caddr_t)udf_vfsp;
814 vfsp->vfs_dev = dev;
815 vfsp->vfs_flag |= VFS_NOTRUNC;
816 udf_vfsp->udf_devvp = devvp;
895 goto out;
896 }
897 udf_vfsp->udf_flags = UDF_FL_RW;
898
899 if (SWAP_32(lvid->lvid_int_type) == LOG_VOL_CLOSE_INT) {
900 udf_vfsp->udf_clean = UDF_CLEAN;
901 } else {
902 if (isroot) {
903 udf_vfsp->udf_clean = UDF_DIRTY;
904 } else {
905 error = ENOSPC;
906 goto out;
907 }
908 }
909 }
910
911 mutex_init(&udf_vfsp->udf_lock, NULL, MUTEX_DEFAULT, NULL);
912
913 mutex_init(&udf_vfsp->udf_rename_lck, NULL, MUTEX_DEFAULT, NULL);
914
915 #ifndef __lint
916 _NOTE(COMPETING_THREADS_NOW);
917 #endif
918 if (error = ud_iget(vfsp, udf_vfsp->udf_ricb_prn,
919 udf_vfsp->udf_ricb_loc, &rip, NULL, cr)) {
920 mutex_destroy(&udf_vfsp->udf_lock);
921 goto out;
922 }
923
924
925 /*
926 * Get the root inode and
927 * initialize the root vnode
928 */
929 rvp = ITOV(rip);
930 mutex_enter(&rvp->v_lock);
931 rvp->v_flag |= VROOT;
932 mutex_exit(&rvp->v_lock);
933 udf_vfsp->udf_root = rvp;
934
935
936 if (why == ROOT_INIT && isroot)
937 rootvp = devvp;
|
155 _fini()
156 {
157 return (EBUSY);
158 }
159
160 int
161 _info(struct modinfo *modinfop)
162 {
163 return (mod_info(&modlinkage, modinfop));
164 }
165
166
167 /* -------------------- vfs routines -------------------- */
168
169 /*
170 * XXX - this appears only to be used by the VM code to handle the case where
171 * UNIX is running off the mini-root. That probably wants to be done
172 * differently.
173 */
174 struct vnode *rootvp;
175
176 static int32_t
177 udf_mount(struct vfs *vfsp, struct vnode *mvp,
178 struct mounta *uap, struct cred *cr)
179 {
180 dev_t dev;
181 struct vnode *lvp = NULL;
182 struct vnode *svp = NULL;
183 struct pathname dpn;
184 int32_t error;
185 enum whymountroot why;
186 int oflag, aflag;
187
188 ud_printf("udf_mount\n");
189
190 if ((error = secpolicy_fs_mount(cr, mvp, vfsp)) != 0) {
191 return (error);
192 }
193
194 if (mvp->v_type != VDIR) {
195 return (ENOTDIR);
771 }
772 return (error);
773 }
774
775 ASSERT(devvp != 0);
776 /*
777 * Flush back any dirty pages on the block device to
778 * try and keep the buffer cache in sync with the page
779 * cache if someone is trying to use block devices when
780 * they really should be using the raw device.
781 */
782 (void) VOP_PUTPAGE(common_specvp(devvp), (offset_t)0,
783 (uint32_t)0, B_INVAL, cr, NULL);
784
785
786 /*
787 * Check if the file system
788 * is a valid udfs and fill
789 * the required fields in udf_vfs
790 */
791 if ((lbsize = ud_get_lbsize(dev, &avd_loc)) == 0) {
792 error = EINVAL;
793 goto out;
794 }
795
796 udf_vfsp = ud_validate_and_fill_superblock(dev, lbsize, avd_loc);
797 if (udf_vfsp == NULL) {
798 error = EINVAL;
799 goto out;
800 }
801
802 /*
803 * Fill in vfs private data
804 */
805 vfsp->vfs_fstype = udf_fstype;
806 vfs_make_fsid(&vfsp->vfs_fsid, dev, udf_fstype);
807 vfsp->vfs_data = (caddr_t)udf_vfsp;
808 vfsp->vfs_dev = dev;
809 vfsp->vfs_flag |= VFS_NOTRUNC;
810 udf_vfsp->udf_devvp = devvp;
889 goto out;
890 }
891 udf_vfsp->udf_flags = UDF_FL_RW;
892
893 if (SWAP_32(lvid->lvid_int_type) == LOG_VOL_CLOSE_INT) {
894 udf_vfsp->udf_clean = UDF_CLEAN;
895 } else {
896 if (isroot) {
897 udf_vfsp->udf_clean = UDF_DIRTY;
898 } else {
899 error = ENOSPC;
900 goto out;
901 }
902 }
903 }
904
905 mutex_init(&udf_vfsp->udf_lock, NULL, MUTEX_DEFAULT, NULL);
906
907 mutex_init(&udf_vfsp->udf_rename_lck, NULL, MUTEX_DEFAULT, NULL);
908
909 if (error = ud_iget(vfsp, udf_vfsp->udf_ricb_prn,
910 udf_vfsp->udf_ricb_loc, &rip, NULL, cr)) {
911 mutex_destroy(&udf_vfsp->udf_lock);
912 goto out;
913 }
914
915
916 /*
917 * Get the root inode and
918 * initialize the root vnode
919 */
920 rvp = ITOV(rip);
921 mutex_enter(&rvp->v_lock);
922 rvp->v_flag |= VROOT;
923 mutex_exit(&rvp->v_lock);
924 udf_vfsp->udf_root = rvp;
925
926
927 if (why == ROOT_INIT && isroot)
928 rootvp = devvp;
|