905 devzvol_prunedir(sdvp);
906 ptr = sdvp->sdev_path + strlen(ZVOL_DIR);
907 if ((strcmp(ptr, "/dsk") == 0) || (strcmp(ptr, "/rdsk") == 0)) {
908 rw_exit(&sdvp->sdev_contents);
909 devzvol_create_pool_dirs(dvp);
910 rw_enter(&sdvp->sdev_contents, RW_READER);
911 return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
912 }
913
914 ptr = strchr(ptr + 1, '/');
915 if (ptr == NULL)
916 return (ENOENT);
917 ptr++;
918 rw_exit(&sdvp->sdev_contents);
919 sdev_iter_datasets(dvp, ZFS_IOC_DATASET_LIST_NEXT, ptr);
920 rw_enter(&sdvp->sdev_contents, RW_READER);
921 return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
922 }
923
924 const fs_operation_def_t devzvol_vnodeops_tbl[] = {
925 VOPNAME_READDIR, { .vop_readdir = devzvol_readdir },
926 VOPNAME_LOOKUP, { .vop_lookup = devzvol_lookup },
927 VOPNAME_CREATE, { .vop_create = devzvol_create },
928 VOPNAME_RENAME, { .error = fs_nosys },
929 VOPNAME_MKDIR, { .error = fs_nosys },
930 VOPNAME_RMDIR, { .error = fs_nosys },
931 VOPNAME_REMOVE, { .error = fs_nosys },
932 VOPNAME_SYMLINK, { .error = fs_nosys },
933 NULL, NULL
934 };
|
905 devzvol_prunedir(sdvp);
906 ptr = sdvp->sdev_path + strlen(ZVOL_DIR);
907 if ((strcmp(ptr, "/dsk") == 0) || (strcmp(ptr, "/rdsk") == 0)) {
908 rw_exit(&sdvp->sdev_contents);
909 devzvol_create_pool_dirs(dvp);
910 rw_enter(&sdvp->sdev_contents, RW_READER);
911 return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
912 }
913
914 ptr = strchr(ptr + 1, '/');
915 if (ptr == NULL)
916 return (ENOENT);
917 ptr++;
918 rw_exit(&sdvp->sdev_contents);
919 sdev_iter_datasets(dvp, ZFS_IOC_DATASET_LIST_NEXT, ptr);
920 rw_enter(&sdvp->sdev_contents, RW_READER);
921 return (devname_readdir_func(dvp, uiop, cred, eofp, 0));
922 }
923
924 const fs_operation_def_t devzvol_vnodeops_tbl[] = {
925 { VOPNAME_READDIR, { .vop_readdir = devzvol_readdir } },
926 { VOPNAME_LOOKUP, { .vop_lookup = devzvol_lookup } },
927 { VOPNAME_CREATE, { .vop_create = devzvol_create } },
928 { VOPNAME_RENAME, { .error = fs_nosys } },
929 { VOPNAME_MKDIR, { .error = fs_nosys } },
930 { VOPNAME_RMDIR, { .error = fs_nosys } },
931 { VOPNAME_REMOVE, { .error = fs_nosys } },
932 { VOPNAME_SYMLINK, { .error = fs_nosys } },
933 { NULL, { NULL } }
934 };
|