6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
26 */
27
28 #include <sys/types.h>
29 #include <sys/t_lock.h>
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/buf.h>
33 #include <sys/conf.h>
34 #include <sys/cred.h>
35 #include <sys/kmem.h>
36 #include <sys/sysmacros.h>
37 #include <sys/vfs.h>
38 #include <sys/vfs_opreg.h>
39 #include <sys/vnode.h>
40 #include <sys/debug.h>
41 #include <sys/errno.h>
42 #include <sys/time.h>
43 #include <sys/file.h>
44 #include <sys/open.h>
45 #include <sys/user.h>
1870 sizeof (psi->si_son_straddr), "%p", (void *)so);
1871 (void) snprintf(psi->si_lvn_straddr,
1872 sizeof (psi->si_lvn_straddr), "%p",
1873 (void *)sti->sti_ux_laddr.soua_vp);
1874 (void) snprintf(psi->si_fvn_straddr,
1875 sizeof (psi->si_fvn_straddr), "%p",
1876 (void *)sti->sti_ux_faddr.soua_vp);
1877
1878 ns++;
1879 psi++;
1880 }
1881
1882 ksp->ks_ndata = ns;
1883 return (0);
1884 }
1885
1886 ssize_t
1887 soreadfile(file_t *fp, uchar_t *buf, u_offset_t fileoff, int *err, size_t size)
1888 {
1889 struct uio auio;
1890 struct iovec aiov[MSG_MAXIOVLEN];
1891 register vnode_t *vp;
1892 int ioflag, rwflag;
1893 ssize_t cnt;
1894 int error = 0;
1895 int iovcnt = 0;
1896 short fflag;
1897
1898 vp = fp->f_vnode;
1899 fflag = fp->f_flag;
1900
1901 rwflag = 0;
1902 aiov[0].iov_base = (caddr_t)buf;
1903 aiov[0].iov_len = size;
1904 iovcnt = 1;
1905 cnt = (ssize_t)size;
1906 (void) VOP_RWLOCK(vp, rwflag, NULL);
1907
1908 auio.uio_loffset = fileoff;
1909 auio.uio_iov = aiov;
1910 auio.uio_iovcnt = iovcnt;
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
26 * Copyright 2015, Joyent, Inc. All rights reserved.
27 */
28
29 #include <sys/types.h>
30 #include <sys/t_lock.h>
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/buf.h>
34 #include <sys/conf.h>
35 #include <sys/cred.h>
36 #include <sys/kmem.h>
37 #include <sys/sysmacros.h>
38 #include <sys/vfs.h>
39 #include <sys/vfs_opreg.h>
40 #include <sys/vnode.h>
41 #include <sys/debug.h>
42 #include <sys/errno.h>
43 #include <sys/time.h>
44 #include <sys/file.h>
45 #include <sys/open.h>
46 #include <sys/user.h>
1871 sizeof (psi->si_son_straddr), "%p", (void *)so);
1872 (void) snprintf(psi->si_lvn_straddr,
1873 sizeof (psi->si_lvn_straddr), "%p",
1874 (void *)sti->sti_ux_laddr.soua_vp);
1875 (void) snprintf(psi->si_fvn_straddr,
1876 sizeof (psi->si_fvn_straddr), "%p",
1877 (void *)sti->sti_ux_faddr.soua_vp);
1878
1879 ns++;
1880 psi++;
1881 }
1882
1883 ksp->ks_ndata = ns;
1884 return (0);
1885 }
1886
1887 ssize_t
1888 soreadfile(file_t *fp, uchar_t *buf, u_offset_t fileoff, int *err, size_t size)
1889 {
1890 struct uio auio;
1891 struct iovec aiov[1];
1892 register vnode_t *vp;
1893 int ioflag, rwflag;
1894 ssize_t cnt;
1895 int error = 0;
1896 int iovcnt = 0;
1897 short fflag;
1898
1899 vp = fp->f_vnode;
1900 fflag = fp->f_flag;
1901
1902 rwflag = 0;
1903 aiov[0].iov_base = (caddr_t)buf;
1904 aiov[0].iov_len = size;
1905 iovcnt = 1;
1906 cnt = (ssize_t)size;
1907 (void) VOP_RWLOCK(vp, rwflag, NULL);
1908
1909 auio.uio_loffset = fileoff;
1910 auio.uio_iov = aiov;
1911 auio.uio_iovcnt = iovcnt;
|