Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 1 | From af17efc862b9acfd63ce2ecb21f75ed890a93a5d Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Andreas=20K=C3=B6lbl?= <koelblandreas@freenet.de> |
| 3 | Date: Thu, 9 Jul 2020 14:29:18 +0200 |
| 4 | Subject: [PATCH] Fix linkage of global identifiers |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | Align the code to the standard and modern compilers. |
| 10 | |
| 11 | Upstream-Status: Submitted [https://github.com/OpenAoE/vblade/pull/15] |
| 12 | Signed-off-by: Andreas Kรถlbl <koelblandreas@freenet.de> |
| 13 | --- |
| 14 | dat.c | 12 ++++++++++++ |
| 15 | dat.h | 19 ++++++++++--------- |
| 16 | makefile | 7 +++++-- |
| 17 | 3 files changed, 27 insertions(+), 11 deletions(-) |
| 18 | create mode 100644 dat.c |
| 19 | |
| 20 | --- /dev/null |
| 21 | +++ b/dat.c |
| 22 | @@ -0,0 +1,12 @@ |
| 23 | +/* dat.c: Global memory for vblade AoE target */ |
| 24 | +#include "dat.h" |
| 25 | + |
| 26 | +int shelf, slot; |
| 27 | +ulong aoetag; |
| 28 | +uchar mac[6]; |
| 29 | +int bfd; // block file descriptor |
| 30 | +int sfd; // socket file descriptor |
| 31 | +vlong size; // size of vblade |
| 32 | +vlong offset; |
| 33 | +char *progname; |
| 34 | +char serial[Nserial+1]; |
| 35 | --- a/dat.h |
| 36 | +++ b/dat.h |
| 37 | @@ -1,4 +1,5 @@ |
| 38 | /* dat.h: include file for vblade AoE target */ |
| 39 | +#include <sys/types.h> |
| 40 | |
| 41 | #define nil ((void *)0) |
| 42 | /* |
| 43 | @@ -163,12 +164,12 @@ enum { |
| 44 | Nserial= 20, |
| 45 | }; |
| 46 | |
| 47 | -int shelf, slot; |
| 48 | -ulong aoetag; |
| 49 | -uchar mac[6]; |
| 50 | -int bfd; // block file descriptor |
| 51 | -int sfd; // socket file descriptor |
| 52 | -vlong size; // size of vblade |
| 53 | -vlong offset; |
| 54 | -char *progname; |
| 55 | -char serial[Nserial+1]; |
| 56 | +extern int shelf, slot; |
| 57 | +extern ulong aoetag; |
| 58 | +extern uchar mac[6]; |
| 59 | +extern int bfd; // block file descriptor |
| 60 | +extern int sfd; // socket file descriptor |
| 61 | +extern vlong size; // size of vblade |
| 62 | +extern vlong offset; |
| 63 | +extern char *progname; |
| 64 | +extern char serial[Nserial+1]; |
| 65 | --- a/makefile |
| 66 | +++ b/makefile |
| 67 | @@ -8,7 +8,7 @@ sbindir = ${prefix}/sbin |
| 68 | sharedir = ${prefix}/share |
| 69 | mandir = ${sharedir}/man |
| 70 | |
| 71 | -O=aoe.o bpf.o ${PLATFORM}.o ata.o |
| 72 | +O=aoe.o bpf.o ${PLATFORM}.o ata.o dat.o |
| 73 | |
| 74 | vblade: $O |
| 75 | ${CC} ${LDFLAGS} -o vblade $O |
| 76 | @@ -25,6 +25,9 @@ ata.o : ata.c config.h dat.h fns.h makef |
| 77 | bpf.o : bpf.c |
| 78 | ${CC} ${CFLAGS} -c $< |
| 79 | |
| 80 | +dat.o : dat.c |
| 81 | + ${CC} ${CFLAGS} -c $< |
| 82 | + |
| 83 | config.h : config/config.h.in makefile |
| 84 | @if ${CC} ${CFLAGS} config/u64.c > /dev/null 2>&1; then \ |
| 85 | sh -xc "cp config/config.h.in config.h"; \ |