From 1523e8e65e258078e7f4a86963d1e528d46b4617 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Mon, 3 Jun 2019 18:13:21 +0800 Subject: [PATCH 1/1] Add a simple dummy memtrack HAL --- Android.mk | 25 +++++++++++++++++++++++++ memtrack.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 Android.mk create mode 100644 memtrack.c diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..068d750 --- /dev/null +++ b/Android.mk @@ -0,0 +1,25 @@ +# Copyright (C) 2019 The Android-x86 Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE_RELATIVE_PATH := hw +LOCAL_CFLAGS := -Wall +LOCAL_SHARED_LIBRARIES := liblog libcutils +LOCAL_SRC_FILES := $(call all-subdir-c-files) +LOCAL_MODULE := memtrack.default +LOCAL_VENDOR_MODULE := true +include $(BUILD_SHARED_LIBRARY) diff --git a/memtrack.c b/memtrack.c new file mode 100644 index 0000000..efd32ac --- /dev/null +++ b/memtrack.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2019 The Android-x86 Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +static int memtrack_init(const struct memtrack_module *module) +{ + if (!module) + return -1; + + return 0; +} + +static struct hw_module_methods_t memtrack_module_methods = { + .open = NULL, +}; + +struct memtrack_module HAL_MODULE_INFO_SYM = { + .common = { + .tag = HARDWARE_MODULE_TAG, + .module_api_version = MEMTRACK_MODULE_API_VERSION_0_1, + .hal_api_version = HARDWARE_HAL_API_VERSION, + .id = MEMTRACK_HARDWARE_MODULE_ID, + .name = "Dummy Memory Tracker HAL", + .author = "The Android-x86 Open Source Project", + .methods = &memtrack_module_methods, + }, + + .init = memtrack_init, +}; -- 2.11.0