823 uint64_t size;
824 int cd, rc;
825
826 if ((cd = __raw_get_cd(fd)) == -1 || !_nsc_raw_files[cd].in_use)
827 return (EIO);
828
829 if ((*partitionp = _nsc_raw_files[cd].partition) != -1) {
830 return (0);
831 }
832
833 rc = _raw_init_dev(fd, &size, partitionp);
834 if (rc != 0 || *partitionp < 0) {
835 return (EIO);
836 }
837
838 return (0);
839 }
840
841
842 nsc_def_t _nsc_raw_def[] = {
843 "Open", (uintptr_t)_raw_open, 0,
844 "Close", (uintptr_t)_raw_close, 0,
845 "Attach", (uintptr_t)_raw_attach_io, 0,
846 "UserRead", (uintptr_t)_raw_uread, 0,
847 "UserWrite", (uintptr_t)_raw_uwrite, 0,
848 "PartSize", (uintptr_t)_raw_partsize, 0,
849 "MaxFbas", (uintptr_t)_raw_maxfbas, 0,
850 "Control", (uintptr_t)_raw_control, 0,
851 "Provide", NSC_DEVICE, 0,
852 0, 0, 0
853 };
|
823 uint64_t size;
824 int cd, rc;
825
826 if ((cd = __raw_get_cd(fd)) == -1 || !_nsc_raw_files[cd].in_use)
827 return (EIO);
828
829 if ((*partitionp = _nsc_raw_files[cd].partition) != -1) {
830 return (0);
831 }
832
833 rc = _raw_init_dev(fd, &size, partitionp);
834 if (rc != 0 || *partitionp < 0) {
835 return (EIO);
836 }
837
838 return (0);
839 }
840
841
842 nsc_def_t _nsc_raw_def[] = {
843 { "Open", (uintptr_t)_raw_open, 0 },
844 { "Close", (uintptr_t)_raw_close, 0 },
845 { "Attach", (uintptr_t)_raw_attach_io, 0 },
846 { "UserRead", (uintptr_t)_raw_uread, 0 },
847 { "UserWrite", (uintptr_t)_raw_uwrite, 0 },
848 { "PartSize", (uintptr_t)_raw_partsize, 0 },
849 { "MaxFbas", (uintptr_t)_raw_maxfbas, 0 },
850 { "Control", (uintptr_t)_raw_control, 0 },
851 { "Provide", NSC_DEVICE, 0 },
852 { NULL, (uintptr_t)NULL, 0 }
853 };
|