Structures and macros use the default definition of the kernel [I80K89]

optimize headers file

Signed-off-by: Yang Yanchao <yangyanchao6@huawei.com>
This commit is contained in:
Yang Yanchao 2023-09-12 11:07:38 +08:00
parent 10c2b83331
commit 29c9237b0c
3 changed files with 117 additions and 2 deletions

View File

@ -0,0 +1,67 @@
From 512d8df361f3afa3831fff90cdf3c3f43bbc9142 Mon Sep 17 00:00:00 2001
From: Yang Yanchao <yangyanchao6@huawei.com>
Date: Tue, 12 Sep 2023 10:54:05 +0800
Subject: [PATCH] Structures and macros use the default definition of the
kernel
Signed-off-by: Yang Yanchao <yangyanchao6@huawei.com>
---
include/libgmem.h | 29 -----------------------------
src/libgmem.c | 1 +
2 files changed, 1 insertion(+), 29 deletions(-)
diff --git a/include/libgmem.h b/include/libgmem.h
index ece13a3..35cf463 100644
--- a/include/libgmem.h
+++ b/include/libgmem.h
@@ -17,35 +17,6 @@
#include <syscall.h>
__BEGIN_DECLS
-/*
- * TODO: Remove these "ifndef" after kernel upgrade
- */
-#include <sys/ioctl.h>
-struct hmadvise_arg {
- int hnid;
- unsigned long start;
- size_t len_in;
- int behavior;
-};
-struct gmem_hnid_arg {
- int *hnuma_id;
-};
-#ifndef GMEM_GET_HNUMA_ID
- #define GMEM_GET_HNUMA_ID _IOW(0x55, 1, struct gmem_hnid_arg)
-#endif
-
-#ifndef GMEM_MADVISE
- #define GMEM_MADVISE _IOW(0x55, 2, struct hmadvise_arg)
-#endif
-
-#ifndef MADV_PREFETCH
-# define MADV_PREFETCH 32
-#endif
-
-#ifndef MADV_DONTNEED
-# define MADV_DONTNEED 4
-#endif
-
/*
* gmemFreeEager - unmap memory data
* @args
diff --git a/src/libgmem.c b/src/libgmem.c
index 59682af..870da87 100644
--- a/src/libgmem.c
+++ b/src/libgmem.c
@@ -14,6 +14,7 @@
#include <linux/mman.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/ioctl.h>
#include <libgmem.h>
#include <gmem_common.h>
--
2.41.0.windows.3

View File

@ -1,6 +1,6 @@
Name: libgmem
Version: 0.1
Release: 3
Release: 4
Summary: Library of Generalized Memory Management
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/libgmem
@ -8,9 +8,11 @@ Source0: https://gitee.com/openeuler/libgmem/repository/archive/%{name}-v
PATCH0001: use-ioctl-instead-of-syscall.patch
PATCH0002: fix-three-issue-I7YV2X-I7XQMW-I7Z2RF.patch
Patch0003: Structures-and-macros-use-the-default-definition-of-.patch
Patch0004: optimize-headers-file.patch
BuildRequires: autoconf automake libtool
BuildRequires: gcc glibc-devel make
BuildRequires: gcc glibc-devel make kernel-headers
%description
libgmem is the abstract layer of GMEM(Generalized Memory Management) user-mode interface,
@ -46,6 +48,10 @@ sh ./autogen.sh
%{_includedir}/libgmem.h
%changelog
* Tue Sep 12 2023 Yang Yanchao <yangyanchao6@huawei.com> - 0.1-4
- Structures and macros use the default definition of the kernel [I80K89]
optimize headers file
* Wed Sep 06 2023 Yang Yanchao <yangyanchao6@huawei.com> - 0.1-3
- Check the return ptr of the malloc[#I7YV2X]
add hnid in gmemPrefetch [#I7XQMW]

View File

@ -0,0 +1,42 @@
From 074fe4486f48838690e674a7e0f394705777cc93 Mon Sep 17 00:00:00 2001
From: Yang Yanchao <yangyanchao6@huawei.com>
Date: Tue, 12 Sep 2023 12:02:03 +0800
Subject: [PATCH] optimize headers file
add linux/gmem_dev.h in gmem_common.h
change syscall.h position
Signed-off-by: Yang Yanchao <yangyanchao6@huawei.com>
---
include/gmem_common.h | 2 ++
include/libgmem.h | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/gmem_common.h b/include/gmem_common.h
index a400b37..dfaeb56 100644
--- a/include/gmem_common.h
+++ b/include/gmem_common.h
@@ -15,6 +15,8 @@
#include <libgmem.h>
#include <stdlib.h>
+#include <syscall.h>
+#include <linux/gmem_dev.h>
typedef struct {
int (*FreeEager)(void *userData, void *stream);
diff --git a/include/libgmem.h b/include/libgmem.h
index 35cf463..d68aed7 100644
--- a/include/libgmem.h
+++ b/include/libgmem.h
@@ -14,7 +14,6 @@
#define _LIBGMEM_H
#include <unistd.h>
-#include <syscall.h>
__BEGIN_DECLS
/*
--
2.41.0.windows.3