summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-08-07 07:14:40 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-24 20:58:32 +0200
commit5f96e48d0671bbcbc0b5f4c88baddc021dddc81a (patch)
treee57f657b64d2dfc3968e371bcb5dacdab51d7dd7
parent62548b20c29639e6ddb5435514a0cc7d45700cbb (diff)
downloadcryptodev-linux-5f96e48d0671bbcbc0b5f4c88baddc021dddc81a.tar.gz
cryptodev-linux-5f96e48d0671bbcbc0b5f4c88baddc021dddc81a.tar.xz
cryptodev-linux-5f96e48d0671bbcbc0b5f4c88baddc021dddc81a.zip
Abstract <linux/ncr.h> from <ncrypto.h> users
Let <ncrypto.h> users #include this header file alone, without caring about <linux/ncr.h>. To do so, set up a temporary copy of ncr.h so that the #include <linux/ncr.h> works at build time as well.
-rw-r--r--.gitignore1
-rw-r--r--examples/Makefile2
-rw-r--r--userspace/Makefile10
-rw-r--r--userspace/ncrypto.h2
-rw-r--r--userspace/ncrypto_fd.c2
-rw-r--r--userspace/ncrypto_generate_params.c2
-rw-r--r--userspace/ncrypto_key.c2
-rw-r--r--userspace/ncrypto_masterkey.c2
-rw-r--r--userspace/ncrypto_params.c2
-rw-r--r--userspace/ncrypto_session.c2
10 files changed, 18 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index d6b0962..e293651 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,5 +19,6 @@ scripts
userspace/ncr-setkey
userspace/libcryptodev.so
userspace/libcryptodev.so.*
+userspace/linux
version.h
tags
diff --git a/examples/Makefile b/examples/Makefile
index fb07989..33a67bc 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -Wall -g -O2
+CFLAGS = -Wall -g -O2 -I../userspace
GNUTLS_LDFLAGS = -L/usr/local/lib -lgnutls
USERSPACE_LDFLAGS = -L../userspace -lcryptodev
diff --git a/userspace/Makefile b/userspace/Makefile
index b87bf0c..9156205 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -Wall -g -O2 -fPIC
+CFLAGS = -I. -Wall -g -O2 -fPIC
progs := ncr-setkey
@@ -15,5 +15,11 @@ libcryptodev.so: ${libobj}
ln -sf libcryptodev.so.0.0 libcryptodev.so.0
ln -sf libcryptodev.so.0.0 libcryptodev.so
+$(libobj): linux/ncr.h
+
+linux/ncr.h: ../ncr.h
+ mkdir -p linux
+ cp $< linux/ncr.h
+
clean:
- rm -f *.o *~ libcryptodev.so* ncr-setkey
+ rm -rf *.o *~ libcryptodev.so* ncr-setkey linux
diff --git a/userspace/ncrypto.h b/userspace/ncrypto.h
index 9e32291..752824d 100644
--- a/userspace/ncrypto.h
+++ b/userspace/ncrypto.h
@@ -2,6 +2,8 @@
#ifndef __NCRYPT_H__
#define __NCRYPT_H__
+#include <linux/ncr.h>
+
#define NCR_DATA_GET_LAST 1
//#define NCR_DATA_SET_APPEND 1
#define NCR_SESSION_FINAL 1
diff --git a/userspace/ncrypto_fd.c b/userspace/ncrypto_fd.c
index ce925cf..7e6741d 100644
--- a/userspace/ncrypto_fd.c
+++ b/userspace/ncrypto_fd.c
@@ -3,7 +3,7 @@
#include <fcntl.h>
#include <pthread.h>
#include <unistd.h>
-#include "../ncr.h"
+#include <linux/ncr.h>
#include "ncrypto.h"
int __ncr_file_descriptor = -1;
diff --git a/userspace/ncrypto_generate_params.c b/userspace/ncrypto_generate_params.c
index 5772aaf..9dd901d 100644
--- a/userspace/ncrypto_generate_params.c
+++ b/userspace/ncrypto_generate_params.c
@@ -2,7 +2,7 @@
#include <sys/types.h>
#include <stdlib.h>
#include <errno.h>
-#include "../ncr.h"
+#include <linux/ncr.h>
#include "ncrypto.h"
int
diff --git a/userspace/ncrypto_key.c b/userspace/ncrypto_key.c
index 924ac22..5321c78 100644
--- a/userspace/ncrypto_key.c
+++ b/userspace/ncrypto_key.c
@@ -3,7 +3,7 @@
#include <sys/ioctl.h>
#include <string.h>
#include <errno.h>
-#include "../ncr.h"
+#include <linux/ncr.h>
#include "ncrypto.h"
extern int __ncr_file_descriptor;
diff --git a/userspace/ncrypto_masterkey.c b/userspace/ncrypto_masterkey.c
index a5c55c3..5910ac0 100644
--- a/userspace/ncrypto_masterkey.c
+++ b/userspace/ncrypto_masterkey.c
@@ -3,7 +3,7 @@
#include <sys/ioctl.h>
#include <string.h>
#include <errno.h>
-#include "../ncr.h"
+#include <linux/ncr.h>
#include "ncrypto.h"
extern int __ncr_file_descriptor;
diff --git a/userspace/ncrypto_params.c b/userspace/ncrypto_params.c
index f5385f4..6fb49f2 100644
--- a/userspace/ncrypto_params.c
+++ b/userspace/ncrypto_params.c
@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include "../ncr.h"
+#include <linux/ncr.h>
#include "ncrypto.h"
int
diff --git a/userspace/ncrypto_session.c b/userspace/ncrypto_session.c
index e37aa21..e14dba2 100644
--- a/userspace/ncrypto_session.c
+++ b/userspace/ncrypto_session.c
@@ -3,7 +3,7 @@
#include <sys/ioctl.h>
#include <string.h>
#include <errno.h>
-#include "../ncr.h"
+#include <linux/ncr.h>
#include "ncrypto.h"
extern int __ncr_file_descriptor;