open-cas-linux/configure.d/1_munmap.conf
Michal Mielewczyk 42f981918d Force ordering in configure script
To prevent using macros before they are defined, enfoce calling them in an
appropriate order.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-03 08:34:32 -04:00

40 lines
1020 B
Bash

#!/bin/bash
#
# Copyright(c) 2012-2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
if compile_module "vm_munmap(0, 0)" "linux/mm.h"
then
add_function "
#include <uapi/asm-generic/mman-common.h>
static inline unsigned long cas_vm_mmap(struct file *file,
unsigned long addr, unsigned long len)
{
return vm_mmap(file, addr, len, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0);
}"
add_function "
static inline int cas_vm_munmap(unsigned long start, size_t len)
{
return vm_munmap(start, len);
}"
elif compile_module "do_munmap(NULL, 0)" "linux/mm.h"
then
add_function "
#include <asm-generic/mman-common.h>
static inline unsigned long cas_vm_mmap(struct file *file,
unsigned long addr, unsigned long len)
{
return do_mmap_pgoff(file, addr, len, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0);
}"
add_function "
static inline int cas_vm_munmap(unsigned long start, size_t len)
{
return do_munmap(current->mm, start, len);
}"
fi