Print this page
XXXX give me a better summary

*** 18,27 **** --- 18,28 ---- * * CDDL HEADER END */ /* * Copyright (c) 1987, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */
*** 132,142 **** * swap device. Flags are one of: * SA_NOT Must have a slot from a physical swap device other than the * the one containing input (*vpp, *offp). * Less slots than requested may be returned. *lenp allocated slots are * returned starting at *offp on *vpp. ! * Returns 1 for a successful allocation, 0 for couldn't allocate any slots. */ int swap_phys_alloc( struct vnode **vpp, u_offset_t *offp, --- 133,144 ---- * swap device. Flags are one of: * SA_NOT Must have a slot from a physical swap device other than the * the one containing input (*vpp, *offp). * Less slots than requested may be returned. *lenp allocated slots are * returned starting at *offp on *vpp. ! * Returns 1 for a successful allocation, 0 for couldn't allocate any slots, ! * and -1 when there are no swap devices on this system. */ int swap_phys_alloc( struct vnode **vpp, u_offset_t *offp,
*** 146,155 **** --- 148,162 ---- struct swapinfo *sip; offset_t soff, noff; size_t len; mutex_enter(&swapinfo_lock); + if (swapinfo == NULL) { + /* NO SWAP DEVICES on this system currently. */ + mutex_exit(&swapinfo_lock); + return (-1); + } sip = silast; /* Find a desirable physical device and allocate from it. */ do { if (sip == NULL)
*** 1656,1665 **** --- 1663,1673 ---- * backed as [*offp, *offp + *lenp) and the physical offsets used to * back them from *pvpp in the range [*pstartp, *pstartp + *lenp). * Returns 0 for success * SE_NOANON -- no anon slot for requested paged * SE_NOSWAP -- no physical swap space available + * SE_NODEV -- no swap devices on this system */ int swap_newphysname( struct vnode *vp, u_offset_t offset,
*** 1678,1688 **** ASSERT(*offp <= offset && offset < *offp + *lenp); /* Get new physical swap slots. */ plen = *lenp; ! if (!swap_phys_alloc(&pvp, &pstart, &plen, 0)) { /* * No swap available so return error unless requested * offset is already backed in which case return that. */ ahm = AH_MUTEX(vp, offset); --- 1686,1697 ---- ASSERT(*offp <= offset && offset < *offp + *lenp); /* Get new physical swap slots. */ plen = *lenp; ! error = swap_phys_alloc(&pvp, &pstart, &plen, 0); ! if (error != 1) { /* * No swap available so return error unless requested * offset is already backed in which case return that. */ ahm = AH_MUTEX(vp, offset);
*** 1690,1700 **** if ((ap = swap_anon(vp, offset)) == NULL) { error = SE_NOANON; mutex_exit(ahm); return (error); } ! error = (ap->an_pvp ? 0 : SE_NOSWAP); *offp = offset; *lenp = PAGESIZE; *pvpp = ap->an_pvp; *poffp = ap->an_poff; mutex_exit(ahm); --- 1699,1709 ---- if ((ap = swap_anon(vp, offset)) == NULL) { error = SE_NOANON; mutex_exit(ahm); return (error); } ! error = (ap->an_pvp ? 0 : (error == 0) ? SE_NOSWAP : SE_NODEV); *offp = offset; *lenp = PAGESIZE; *pvpp = ap->an_pvp; *poffp = ap->an_poff; mutex_exit(ahm);