mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-30 21:09:38 +03:00
dcdc12e8ba
This change appears to primarily be a name change for the enum. Had to update the test logic so that it works so long as either one of these is present (favoring the newer one). Additionally, as this is newer, it only shows up in node_page_item, so this commit doesn't test zone_page_item for the same enum. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Coleman Kane <ckane@colemankane.org> Closes #10696
104 lines
2.8 KiB
C
104 lines
2.8 KiB
C
/*
|
|
* Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
|
|
* Copyright (C) 2007 The Regents of the University of California.
|
|
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
|
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
|
|
* UCRL-CODE-235197
|
|
*
|
|
* This file is part of the SPL, Solaris Porting Layer.
|
|
* For details, see <http://zfsonlinux.org/>.
|
|
*
|
|
* The SPL is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
* The SPL is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with the SPL. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _SPL_VMSYSTM_H
|
|
#define _SPL_VMSYSTM_H
|
|
|
|
#include <linux/mmzone.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/swap.h>
|
|
#include <linux/highmem.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <sys/types.h>
|
|
#include <asm/uaccess.h>
|
|
|
|
#ifdef HAVE_TOTALRAM_PAGES_FUNC
|
|
#define zfs_totalram_pages totalram_pages()
|
|
#else
|
|
#define zfs_totalram_pages totalram_pages
|
|
#endif
|
|
|
|
#ifdef HAVE_TOTALHIGH_PAGES
|
|
#define zfs_totalhigh_pages totalhigh_pages()
|
|
#else
|
|
#define zfs_totalhigh_pages totalhigh_pages
|
|
#endif
|
|
|
|
#define membar_producer() smp_wmb()
|
|
#define physmem zfs_totalram_pages
|
|
#ifdef ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B
|
|
#define freemem (nr_free_pages() + \
|
|
global_page_state(NR_INACTIVE_FILE) + \
|
|
global_page_state(NR_INACTIVE_ANON) + \
|
|
global_page_state(NR_SLAB_RECLAIMABLE_B))
|
|
#else
|
|
#define freemem (nr_free_pages() + \
|
|
global_page_state(NR_INACTIVE_FILE) + \
|
|
global_page_state(NR_INACTIVE_ANON) + \
|
|
global_page_state(NR_SLAB_RECLAIMABLE))
|
|
#endif /* ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE_B */
|
|
|
|
#define xcopyin(from, to, size) copy_from_user(to, from, size)
|
|
#define xcopyout(from, to, size) copy_to_user(to, from, size)
|
|
|
|
static __inline__ int
|
|
copyin(const void *from, void *to, size_t len)
|
|
{
|
|
/* On error copyin routine returns -1 */
|
|
if (xcopyin(from, to, len))
|
|
return (-1);
|
|
|
|
return (0);
|
|
}
|
|
|
|
static __inline__ int
|
|
copyout(const void *from, void *to, size_t len)
|
|
{
|
|
/* On error copyout routine returns -1 */
|
|
if (xcopyout(from, to, len))
|
|
return (-1);
|
|
|
|
return (0);
|
|
}
|
|
|
|
static __inline__ int
|
|
copyinstr(const void *from, void *to, size_t len, size_t *done)
|
|
{
|
|
size_t rc;
|
|
|
|
if (len == 0)
|
|
return (-ENAMETOOLONG);
|
|
|
|
/* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */
|
|
|
|
memset(to, 0, len);
|
|
rc = copyin(from, to, len - 1);
|
|
if (done != NULL)
|
|
*done = rc;
|
|
|
|
return (0);
|
|
}
|
|
|
|
#endif /* SPL_VMSYSTM_H */
|