| From af17efc862b9acfd63ce2ecb21f75ed890a93a5d Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?Andreas=20K=C3=B6lbl?= <koelblandreas@freenet.de> |
| Date: Thu, 9 Jul 2020 14:29:18 +0200 |
| Subject: [PATCH] Fix linkage of global identifiers |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| Align the code to the standard and modern compilers. |
| |
| Upstream-Status: Submitted [https://github.com/OpenAoE/vblade/pull/15] |
| Signed-off-by: Andreas Kรถlbl <koelblandreas@freenet.de> |
| --- |
| dat.c | 12 ++++++++++++ |
| dat.h | 19 ++++++++++--------- |
| makefile | 7 +++++-- |
| 3 files changed, 27 insertions(+), 11 deletions(-) |
| create mode 100644 dat.c |
| |
| --- /dev/null |
| +++ b/dat.c |
| @@ -0,0 +1,12 @@ |
| +/* dat.c: Global memory for vblade AoE target */ |
| +#include "dat.h" |
| + |
| +int shelf, slot; |
| +ulong aoetag; |
| +uchar mac[6]; |
| +int bfd; // block file descriptor |
| +int sfd; // socket file descriptor |
| +vlong size; // size of vblade |
| +vlong offset; |
| +char *progname; |
| +char serial[Nserial+1]; |
| --- a/dat.h |
| +++ b/dat.h |
| @@ -1,4 +1,5 @@ |
| /* dat.h: include file for vblade AoE target */ |
| +#include <sys/types.h> |
| |
| #define nil ((void *)0) |
| /* |
| @@ -163,12 +164,12 @@ enum { |
| Nserial= 20, |
| }; |
| |
| -int shelf, slot; |
| -ulong aoetag; |
| -uchar mac[6]; |
| -int bfd; // block file descriptor |
| -int sfd; // socket file descriptor |
| -vlong size; // size of vblade |
| -vlong offset; |
| -char *progname; |
| -char serial[Nserial+1]; |
| +extern int shelf, slot; |
| +extern ulong aoetag; |
| +extern uchar mac[6]; |
| +extern int bfd; // block file descriptor |
| +extern int sfd; // socket file descriptor |
| +extern vlong size; // size of vblade |
| +extern vlong offset; |
| +extern char *progname; |
| +extern char serial[Nserial+1]; |
| --- a/makefile |
| +++ b/makefile |
| @@ -8,7 +8,7 @@ sbindir = ${prefix}/sbin |
| sharedir = ${prefix}/share |
| mandir = ${sharedir}/man |
| |
| -O=aoe.o bpf.o ${PLATFORM}.o ata.o |
| +O=aoe.o bpf.o ${PLATFORM}.o ata.o dat.o |
| |
| vblade: $O |
| ${CC} ${LDFLAGS} -o vblade $O |
| @@ -25,6 +25,9 @@ ata.o : ata.c config.h dat.h fns.h makef |
| bpf.o : bpf.c |
| ${CC} ${CFLAGS} -c $< |
| |
| +dat.o : dat.c |
| + ${CC} ${CFLAGS} -c $< |
| + |
| config.h : config/config.h.in makefile |
| @if ${CC} ${CFLAGS} config/u64.c > /dev/null 2>&1; then \ |
| sh -xc "cp config/config.h.in config.h"; \ |