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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
29 */
30
31 #include <sys/param.h>
32 #include <sys/t_lock.h>
33 #include <sys/systm.h>
34 #include <sys/sysmacros.h>
35 #include <sys/user.h>
36 #include <sys/buf.h>
37 #include <sys/stat.h>
38 #include <sys/vfs.h>
39 #include <sys/vfs_opreg.h>
40 #include <sys/dirent.h>
41 #include <sys/vnode.h>
42 #include <sys/proc.h>
43 #include <sys/file.h>
44 #include <sys/fcntl.h>
45 #include <sys/uio.h>
46 #include <sys/fs/pc_label.h>
47 #include <sys/fs/pc_fs.h>
48 #include <sys/fs/pc_dir.h>
1409 continue;
1410 }
1411 if (PCDL_IS_LFN(ep)) {
1412 if (pc_read_long_fn(dvp, uiop, ld, &ep, &offset, &bp) !=
1413 0)
1414 break;
1415 continue;
1416 }
1417
1418 if (pc_read_short_fn(dvp, uiop, ld, &ep, &offset, &bp) != 0)
1419 break;
1420 }
1421 if (bp)
1422 brelse(bp);
1423 pc_unlockfs(fsp);
1424 return (error);
1425 }
1426
1427
1428 /*
1429 * Called from pvn_getpages or pcfs_getpage to get a particular page.
1430 * When we are called the pcfs is already locked.
1431 */
1432 /*ARGSUSED*/
1433 static int
1434 pcfs_getapage(
1435 struct vnode *vp,
1436 u_offset_t off,
1437 size_t len,
1438 uint_t *protp,
1439 page_t *pl[], /* NULL if async IO is requested */
1440 size_t plsz,
1441 struct seg *seg,
1442 caddr_t addr,
1443 enum seg_rw rw,
1444 struct cred *cr)
1445 {
1446 struct pcnode *pcp;
1447 struct pcfs *fsp = VFSTOPCFS(vp->v_vfsp);
1448 struct vnode *devvp;
1449 page_t *pp;
1450 page_t *pagefound;
1584 enum seg_rw rw,
1585 struct cred *cr,
1586 caller_context_t *ct)
1587 {
1588 struct pcfs *fsp = VFSTOPCFS(vp->v_vfsp);
1589 int err;
1590
1591 PC_DPRINTF0(6, "pcfs_getpage\n");
1592 if (err = pc_verify(fsp))
1593 return (err);
1594 if (vp->v_flag & VNOMAP)
1595 return (ENOSYS);
1596 ASSERT(off <= UINT32_MAX);
1597 err = pc_lockfs(fsp, 0, 0);
1598 if (err)
1599 return (err);
1600 if (protp != NULL)
1601 *protp = PROT_ALL;
1602
1603 ASSERT((off & PAGEOFFSET) == 0);
1604 if (len <= PAGESIZE) {
1605 err = pcfs_getapage(vp, off, len, protp, pl,
1606 plsz, seg, addr, rw, cr);
1607 } else {
1608 err = pvn_getpages(pcfs_getapage, vp, off,
1609 len, protp, pl, plsz, seg, addr, rw, cr);
1610 }
1611 pc_unlockfs(fsp);
1612 return (err);
1613 }
1614
1615
1616 /*
1617 * Flags are composed of {B_INVAL, B_FREE, B_DONTNEED, B_FORCE}
1618 * If len == 0, do from off to EOF.
1619 *
1620 * The normal cases should be len == 0 & off == 0 (entire vp list),
1621 * len == MAXBSIZE (from segmap_release actions), and len == PAGESIZE
1622 * (from pageout).
1623 *
1624 */
1625 /*ARGSUSED*/
1626 static int
1627 pcfs_putpage(
1628 struct vnode *vp,
1629 offset_t off,
1630 size_t len,
|
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 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
29 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
30 */
31
32 #include <sys/param.h>
33 #include <sys/t_lock.h>
34 #include <sys/systm.h>
35 #include <sys/sysmacros.h>
36 #include <sys/user.h>
37 #include <sys/buf.h>
38 #include <sys/stat.h>
39 #include <sys/vfs.h>
40 #include <sys/vfs_opreg.h>
41 #include <sys/dirent.h>
42 #include <sys/vnode.h>
43 #include <sys/proc.h>
44 #include <sys/file.h>
45 #include <sys/fcntl.h>
46 #include <sys/uio.h>
47 #include <sys/fs/pc_label.h>
48 #include <sys/fs/pc_fs.h>
49 #include <sys/fs/pc_dir.h>
1410 continue;
1411 }
1412 if (PCDL_IS_LFN(ep)) {
1413 if (pc_read_long_fn(dvp, uiop, ld, &ep, &offset, &bp) !=
1414 0)
1415 break;
1416 continue;
1417 }
1418
1419 if (pc_read_short_fn(dvp, uiop, ld, &ep, &offset, &bp) != 0)
1420 break;
1421 }
1422 if (bp)
1423 brelse(bp);
1424 pc_unlockfs(fsp);
1425 return (error);
1426 }
1427
1428
1429 /*
1430 * Called from pvn_getpages to get a particular page. When we are called
1431 * the pcfs is already locked.
1432 */
1433 /*ARGSUSED*/
1434 static int
1435 pcfs_getapage(
1436 struct vnode *vp,
1437 u_offset_t off,
1438 size_t len,
1439 uint_t *protp,
1440 page_t *pl[], /* NULL if async IO is requested */
1441 size_t plsz,
1442 struct seg *seg,
1443 caddr_t addr,
1444 enum seg_rw rw,
1445 struct cred *cr)
1446 {
1447 struct pcnode *pcp;
1448 struct pcfs *fsp = VFSTOPCFS(vp->v_vfsp);
1449 struct vnode *devvp;
1450 page_t *pp;
1451 page_t *pagefound;
1585 enum seg_rw rw,
1586 struct cred *cr,
1587 caller_context_t *ct)
1588 {
1589 struct pcfs *fsp = VFSTOPCFS(vp->v_vfsp);
1590 int err;
1591
1592 PC_DPRINTF0(6, "pcfs_getpage\n");
1593 if (err = pc_verify(fsp))
1594 return (err);
1595 if (vp->v_flag & VNOMAP)
1596 return (ENOSYS);
1597 ASSERT(off <= UINT32_MAX);
1598 err = pc_lockfs(fsp, 0, 0);
1599 if (err)
1600 return (err);
1601 if (protp != NULL)
1602 *protp = PROT_ALL;
1603
1604 ASSERT((off & PAGEOFFSET) == 0);
1605 err = pvn_getpages(pcfs_getapage, vp, off, len, protp, pl, plsz,
1606 seg, addr, rw, cr);
1607
1608 pc_unlockfs(fsp);
1609 return (err);
1610 }
1611
1612
1613 /*
1614 * Flags are composed of {B_INVAL, B_FREE, B_DONTNEED, B_FORCE}
1615 * If len == 0, do from off to EOF.
1616 *
1617 * The normal cases should be len == 0 & off == 0 (entire vp list),
1618 * len == MAXBSIZE (from segmap_release actions), and len == PAGESIZE
1619 * (from pageout).
1620 *
1621 */
1622 /*ARGSUSED*/
1623 static int
1624 pcfs_putpage(
1625 struct vnode *vp,
1626 offset_t off,
1627 size_t len,
|