26 #include <sys/types.h>
27 #include <sys/ksynch.h>
28 #include <sys/errno.h>
29 #include <sys/file.h>
30 #include <sys/open.h>
31 #include <sys/cred.h>
32 #include <sys/kmem.h>
33 #include <sys/uio.h>
34 #include <sys/ddi.h>
35 #include <sys/sdt.h>
36
37 #define __NSC_GEN__
38 #include "nsc_dev.h"
39 #include "nsc_disk.h"
40 #include "../nsctl.h"
41
42
43 #define _I(x) (((long)(&((nsc_io_t *)0)->x))/sizeof (long))
44
45 nsc_def_t _nsc_disk_def[] = {
46 "UserRead", (uintptr_t)nsc_ioerr, _I(uread),
47 "UserWrite", (uintptr_t)nsc_ioerr, _I(uwrite),
48 "PartSize", (uintptr_t)nsc_null, _I(partsize),
49 "MaxFbas", (uintptr_t)nsc_null, _I(maxfbas),
50 "Control", (uintptr_t)nsc_ioerr, _I(control),
51 0, 0, 0
52 };
53
54
55 extern nsc_mem_t *_nsc_local_mem;
56
57 static int _nsc_uread(dev_t, uio_t *, cred_t *, nsc_fd_t *);
58 static int _nsc_uwrite(dev_t, uio_t *, cred_t *, nsc_fd_t *);
59 static int _nsc_rw_uio(nsc_fd_t *, uio_t *, uio_rw_t);
60
61 static int _nsc_free_dhandle(nsc_dbuf_t *);
62 static int _nsc_alloc_dbuf(blind_t, nsc_off_t, nsc_size_t, int, nsc_dbuf_t **);
63 static int _nsc_free_dbuf(nsc_dbuf_t *);
64 static void _nsc_wait_dbuf(nsc_dbuf_t *);
65 static int _nsc_read_dbuf(nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
66 static int _nsc_write_dbuf(nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
67 static int _nsc_zero_dbuf(nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
68 static int _nsc_dbuf_io(int (*)(), nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
69
70 static nsc_dbuf_t *_nsc_alloc_dhandle(void (*)(), void (*)(), void (*)());
71
|
26 #include <sys/types.h>
27 #include <sys/ksynch.h>
28 #include <sys/errno.h>
29 #include <sys/file.h>
30 #include <sys/open.h>
31 #include <sys/cred.h>
32 #include <sys/kmem.h>
33 #include <sys/uio.h>
34 #include <sys/ddi.h>
35 #include <sys/sdt.h>
36
37 #define __NSC_GEN__
38 #include "nsc_dev.h"
39 #include "nsc_disk.h"
40 #include "../nsctl.h"
41
42
43 #define _I(x) (((long)(&((nsc_io_t *)0)->x))/sizeof (long))
44
45 nsc_def_t _nsc_disk_def[] = {
46 { "UserRead", (uintptr_t)nsc_ioerr, _I(uread) },
47 { "UserWrite", (uintptr_t)nsc_ioerr, _I(uwrite) },
48 { "PartSize", (uintptr_t)nsc_null, _I(partsize) },
49 { "MaxFbas", (uintptr_t)nsc_null, _I(maxfbas) },
50 { "Control", (uintptr_t)nsc_ioerr, _I(control) },
51 { NULL, (uintptr_t)NULL, 0 }
52 };
53
54
55 extern nsc_mem_t *_nsc_local_mem;
56
57 static int _nsc_uread(dev_t, uio_t *, cred_t *, nsc_fd_t *);
58 static int _nsc_uwrite(dev_t, uio_t *, cred_t *, nsc_fd_t *);
59 static int _nsc_rw_uio(nsc_fd_t *, uio_t *, uio_rw_t);
60
61 static int _nsc_free_dhandle(nsc_dbuf_t *);
62 static int _nsc_alloc_dbuf(blind_t, nsc_off_t, nsc_size_t, int, nsc_dbuf_t **);
63 static int _nsc_free_dbuf(nsc_dbuf_t *);
64 static void _nsc_wait_dbuf(nsc_dbuf_t *);
65 static int _nsc_read_dbuf(nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
66 static int _nsc_write_dbuf(nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
67 static int _nsc_zero_dbuf(nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
68 static int _nsc_dbuf_io(int (*)(), nsc_dbuf_t *, nsc_off_t, nsc_size_t, int);
69
70 static nsc_dbuf_t *_nsc_alloc_dhandle(void (*)(), void (*)(), void (*)());
71
|