tgt/tgt-fix-build

261 lines
8.2 KiB
Plaintext

diff --git a/scripts/tgt-setup-lun b/scripts/tgt-setup-lun
index 1e214ee..2ae9193 100755
--- a/scripts/tgt-setup-lun
+++ b/scripts/tgt-setup-lun
@@ -1,3 +1,5 @@
+#!/bin/bash
+
# LUN assignment script
#
# Copyright (C) 2007 Erez Zilber <erezz@voltaire.com>
@@ -17,8 +19,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
-#!/bin/bash
-
usage()
{
name=$(basename $0)
diff --git a/usr/Makefile b/usr/Makefile
index a59364b..bf264f4 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -50,7 +50,7 @@ INCLUDES += -I. -I../include -I$(KERNELSRC)/include
CFLAGS += -D_GNU_SOURCE
CFLAGS += $(INCLUDES)
-CFLAGS += -g -O2 -Wall -Wstrict-prototypes -fPIC
+CFLAGS += $(OPTFLAGS)
LIBS += -lpthread
diff --git a/usr/fc/fc.c b/usr/fc/fc.c
index febb1e9..59f7573 100644
--- a/usr/fc/fc.c
+++ b/usr/fc/fc.c
@@ -29,6 +29,8 @@
#include <syscall.h>
#include <unistd.h>
#include <linux/fs.h>
+#include <linux/types.h>
+typedef __u8 u8;
#include <scsi/scsi.h>
#include <sys/mman.h>
diff --git a/usr/iscsi/iscsi_rdma.c b/usr/iscsi/iscsi_rdma.c
index d3b5147..c155b48 100644
--- a/usr/iscsi/iscsi_rdma.c
+++ b/usr/iscsi/iscsi_rdma.c
@@ -144,7 +144,7 @@ struct conn_info {
/* but count so we can drain CQ on close */
int recvl_posted;
- struct tgt_event tx_sched;
+ struct tgtd_event tx_sched;
/* login phase resources, freed at full-feature */
void *srbuf_login;
@@ -196,7 +196,7 @@ struct iser_device {
void *mempool_listbuf;
struct ibv_mr *mempool_mr;
- struct tgt_event poll_sched;
+ struct tgtd_event poll_sched;
/* free and allocated mempool entries */
struct list_head mempool_free, mempool_alloc;
@@ -281,9 +281,9 @@ static void iscsi_rdma_release(struct iscsi_connection *conn);
static int iscsi_rdma_show(struct iscsi_connection *conn, char *buf,
int rest);
static void iscsi_rdma_event_modify(struct iscsi_connection *conn, int events);
-static void iser_sched_poll_cq(struct tgt_event *tev);
-static void iser_sched_consume_cq(struct tgt_event *tev);
-static void iser_sched_tx(struct tgt_event *evt);
+static void iser_sched_poll_cq(struct tgtd_event *tev);
+static void iser_sched_consume_cq(struct tgtd_event *tev);
+static void iser_sched_tx(struct tgtd_event *evt);
/*
* Called when ready for full feature, builds resources.
@@ -1058,7 +1058,7 @@ static void iser_poll_cq_armable(struct iser_device *dev)
/* Scheduled to poll cq after a completion event has been
received and acknowledged, if no more completions are found
the interrupts are re-armed */
-static void iser_sched_poll_cq(struct tgt_event *tev)
+static void iser_sched_poll_cq(struct tgtd_event *tev)
{
struct iser_device *dev = tev->data;
iser_poll_cq_armable(dev);
@@ -1069,7 +1069,7 @@ static void iser_sched_poll_cq(struct tgt_event *tev)
the notification interrupts were re-armed.
Intended to consume those remaining completions only,
this function does not re-arm interrupts. */
-static void iser_sched_consume_cq(struct tgt_event *tev)
+static void iser_sched_consume_cq(struct tgtd_event *tev)
{
struct iser_device *dev = tev->data;
int ret;
@@ -1112,7 +1112,7 @@ static void iser_cqe_handler(int fd __attribute__((unused)),
* tries to push tx on a connection, until nothing
* is ready anymore. No progress limit here.
*/
-static void iser_sched_tx(struct tgt_event *evt)
+static void iser_sched_tx(struct tgtd_event *evt)
{
struct conn_info *ci = evt->data;
struct iscsi_connection *conn = &ci->iscsi_conn;
diff --git a/usr/tgtd.c b/usr/tgtd.c
index 62aaa04..a226906 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -99,7 +99,7 @@ static int oom_adjust(void)
int tgt_event_add(int fd, int events, event_handler_t handler, void *data)
{
struct epoll_event ev;
- struct tgt_event *tev;
+ struct tgtd_event *tev;
int err;
tev = zalloc(sizeof(*tev));
@@ -123,9 +123,9 @@ int tgt_event_add(int fd, int events, event_handler_t handler, void *data)
return err;
}
-static struct tgt_event *tgt_event_lookup(int fd)
+static struct tgtd_event *tgt_event_lookup(int fd)
{
- struct tgt_event *tev;
+ struct tgtd_event *tev;
list_for_each_entry(tev, &tgt_events_list, e_list) {
if (tev->fd == fd)
@@ -136,7 +136,7 @@ static struct tgt_event *tgt_event_lookup(int fd)
void tgt_event_del(int fd)
{
- struct tgt_event *tev;
+ struct tgtd_event *tev;
tev = tgt_event_lookup(fd);
if (!tev) {
@@ -152,7 +152,7 @@ void tgt_event_del(int fd)
int tgt_event_modify(int fd, int events)
{
struct epoll_event ev;
- struct tgt_event *tev;
+ struct tgtd_event *tev;
tev = tgt_event_lookup(fd);
if (!tev) {
@@ -167,7 +167,7 @@ int tgt_event_modify(int fd, int events)
return epoll_ctl(ep_fd, EPOLL_CTL_MOD, fd, &ev);
}
-void tgt_init_sched_event(struct tgt_event *evt,
+void tgt_init_sched_event(struct tgtd_event *evt,
sched_event_handler_t sched_handler, void *data)
{
evt->sched_handler = sched_handler;
@@ -176,7 +176,7 @@ void tgt_init_sched_event(struct tgt_event *evt,
INIT_LIST_HEAD(&evt->e_list);
}
-void tgt_add_sched_event(struct tgt_event *evt)
+void tgt_add_sched_event(struct tgtd_event *evt)
{
if (!evt->scheduled) {
evt->scheduled = 1;
@@ -184,7 +184,7 @@ void tgt_add_sched_event(struct tgt_event *evt)
}
}
-void tgt_remove_sched_event(struct tgt_event *evt)
+void tgt_remove_sched_event(struct tgtd_event *evt)
{
if (evt->scheduled) {
evt->scheduled = 0;
@@ -195,7 +195,7 @@ void tgt_remove_sched_event(struct tgt_event *evt)
static int tgt_exec_scheduled(void)
{
struct list_head *last_sched;
- struct tgt_event *tev, *tevn;
+ struct tgtd_event *tev, *tevn;
int work_remains = 0;
if (!list_empty(&tgt_sched_events_list)) {
@@ -218,7 +218,7 @@ static void event_loop(void)
{
int nevent, i, sched_remains, timeout;
struct epoll_event events[1024];
- struct tgt_event *tev;
+ struct tgtd_event *tev;
retry:
sched_remains = tgt_exec_scheduled();
@@ -232,7 +232,7 @@ retry:
}
} else if (nevent) {
for (i = 0; i < nevent; i++) {
- tev = (struct tgt_event *) events[i].data.ptr;
+ tev = (struct tgtd_event *) events[i].data.ptr;
tev->handler(tev->fd, events[i].events, tev->data);
}
} else
diff --git a/usr/tgtd.h b/usr/tgtd.h
index da751c8..207c167 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
@@ -206,21 +206,21 @@ extern int tgt_bind_host_to_target(int tid, int host_no);
extern int tgt_unbind_host_to_target(int tid, int host_no);
extern int tgt_bound_target_lookup(int host_no);
-struct tgt_event;
-typedef void (*sched_event_handler_t)(struct tgt_event *tev);
+struct tgtd_event;
+typedef void (*sched_event_handler_t)(struct tgtd_event *tev);
-extern void tgt_init_sched_event(struct tgt_event *evt,
+extern void tgt_init_sched_event(struct tgtd_event *evt,
sched_event_handler_t sched_handler, void *data);
typedef void (*event_handler_t)(int fd, int events, void *data);
-extern int tgt_event_add(int fd, int events, event_handler_t handler, void *data);
-extern void tgt_event_del(int fd);
+extern int tgtd_event_add(int fd, int events, event_handler_t handler, void *data);
+extern void tgtd_event_del(int fd);
-extern void tgt_add_sched_event(struct tgt_event *evt);
-extern void tgt_remove_sched_event(struct tgt_event *evt);
+extern void tgt_add_sched_event(struct tgtd_event *evt);
+extern void tgt_remove_sched_event(struct tgtd_event *evt);
-extern int tgt_event_modify(int fd, int events);
+extern int tgtd_event_modify(int fd, int events);
extern int target_cmd_queue(int tid, struct scsi_cmd *cmd);
extern void target_cmd_done(struct scsi_cmd *cmd);
struct scsi_cmd *target_cmd_lookup(int tid, uint64_t itn_id, uint64_t tag);
@@ -269,7 +269,7 @@ extern int dtd_load_unload(int tid, uint64_t lun, int load, char *file);
extern int register_backingstore_template(struct backingstore_template *bst);
extern struct backingstore_template *get_backingstore_template(const char *name);
-struct tgt_event {
+struct tgtd_event {
union {
event_handler_t handler;
sched_event_handler_t sched_handler;
diff --git a/usr/tgtif.c b/usr/tgtif.c
index fd5ad5b..9b87b13 100644
--- a/usr/tgtif.c
+++ b/usr/tgtif.c
@@ -36,7 +36,7 @@
#ifndef aligned_u64
#define aligned_u64 unsigned long long __attribute__((aligned(8)))
#endif
-#include <scsi/scsi_tgt_if.h>
+#include "scsi_tgt_if.h"
#include "list.h"
#include "util.h"