4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29 /*
30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 * The Regents of the University of California
32 * All Rights Reserved
33 *
34 * University Acknowledgment- Portions of this document are derived from
35 * software developed by the University of California, Berkeley, and its
36 * contributors.
37 */
38
39 #include <sys/types.h>
40 #include <sys/thread.h>
41 #include <sys/t_lock.h>
42 #include <sys/param.h>
43 #include <sys/systm.h>
1774 ASSERT(sp->s_commonvp == vp);
1775
1776 /*
1777 * XXX Given the above assertion, this might not do
1778 * what is wanted here.
1779 */
1780 if (vp->v_flag & VNOMAP)
1781 return (ENOSYS);
1782 TRACE_4(TR_FAC_SPECFS, TR_SPECFS_GETPAGE,
1783 "specfs getpage:vp %p off %llx len %ld snode %p",
1784 vp, off, len, sp);
1785
1786 switch (vp->v_type) {
1787 case VBLK:
1788 if (protp != NULL)
1789 *protp = PROT_ALL;
1790
1791 if (((u_offset_t)off + len) > (SPEC_SIZE(sp) + PAGEOFFSET))
1792 return (EFAULT); /* beyond EOF */
1793
1794 if (len <= PAGESIZE)
1795 err = spec_getapage(vp, (u_offset_t)off, len, protp, pl,
1796 plsz, seg, addr, rw, cr);
1797 else
1798 err = pvn_getpages(spec_getapage, vp, (u_offset_t)off,
1799 len, protp, pl, plsz, seg, addr, rw, cr);
1800 break;
1801
1802 case VCHR:
1803 cmn_err(CE_NOTE, "spec_getpage called for character device. "
1804 "Check any non-ON consolidation drivers");
1805 err = 0;
1806 pl[0] = (page_t *)0;
1807 break;
1808
1809 default:
1810 panic("spec_getpage: bad v_type 0x%x", vp->v_type);
1811 /*NOTREACHED*/
1812 }
1813
1814 return (err);
1815 }
1816
1817 extern int klustsize; /* set in machdep.c */
1818
1819 int spec_ra = 1;
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30 /*
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
34 *
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
38 */
39
40 #include <sys/types.h>
41 #include <sys/thread.h>
42 #include <sys/t_lock.h>
43 #include <sys/param.h>
44 #include <sys/systm.h>
1775 ASSERT(sp->s_commonvp == vp);
1776
1777 /*
1778 * XXX Given the above assertion, this might not do
1779 * what is wanted here.
1780 */
1781 if (vp->v_flag & VNOMAP)
1782 return (ENOSYS);
1783 TRACE_4(TR_FAC_SPECFS, TR_SPECFS_GETPAGE,
1784 "specfs getpage:vp %p off %llx len %ld snode %p",
1785 vp, off, len, sp);
1786
1787 switch (vp->v_type) {
1788 case VBLK:
1789 if (protp != NULL)
1790 *protp = PROT_ALL;
1791
1792 if (((u_offset_t)off + len) > (SPEC_SIZE(sp) + PAGEOFFSET))
1793 return (EFAULT); /* beyond EOF */
1794
1795 err = pvn_getpages(spec_getapage, vp, (u_offset_t)off, len,
1796 protp, pl, plsz, seg, addr, rw, cr);
1797 break;
1798
1799 case VCHR:
1800 cmn_err(CE_NOTE, "spec_getpage called for character device. "
1801 "Check any non-ON consolidation drivers");
1802 err = 0;
1803 pl[0] = (page_t *)0;
1804 break;
1805
1806 default:
1807 panic("spec_getpage: bad v_type 0x%x", vp->v_type);
1808 /*NOTREACHED*/
1809 }
1810
1811 return (err);
1812 }
1813
1814 extern int klustsize; /* set in machdep.c */
1815
1816 int spec_ra = 1;
|