Remove conditionals for NetBSD before 4.0.

This commit is contained in:
joerg 2015-05-15 16:24:30 +00:00
parent 5d88ea0bae
commit 8f2555d84b
6 changed files with 42 additions and 93 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_globals.h,v 1.7 2015/04/13 16:33:24 riastradh Exp $ */
/* $NetBSD: iscsi_globals.h,v 1.8 2015/05/15 16:24:30 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -328,13 +328,6 @@ typedef struct ccb_list_s ccb_list_t;
/*
Per connection data: the connection structure
*/
#if (__NetBSD_Version__ >= 399000900)
typedef struct lwp *PTHREADOBJ;
#else
typedef struct proc *PTHREADOBJ;
#endif
struct connection_s {
TAILQ_ENTRY(connection_s) connections;
@ -374,7 +367,7 @@ struct connection_s {
conn_state_t state; /* State of connection */
PTHREADOBJ threadobj;
struct lwp *threadobj;
/* proc/thread pointer of socket owner */
struct file *sock; /* the connection's socket */
session_t *session;
@ -681,45 +674,20 @@ sn_a_le_b(uint32_t a, uint32_t b)
/* Version dependencies */
#if (__NetBSD_Version__ >= 399000900)
#define PROCP(obj) (obj->l_proc)
#else
#define PROCP(obj) obj
#define UIO_SETUP_SYSSPACE(uio) (uio)->uio_segflg = UIO_SYSSPACE
#endif
#if (__NetBSD_Version__ >= 106000000)
# ifdef ISCSI_TEST_MODE
#ifdef ISCSI_TEST_MODE
#define SET_CCB_TIMEOUT(conn, ccb, tout) do { \
if (test_ccb_timeout (conn)) { \
callout_schedule(&ccb->timeout, tout); \
} \
} while (/*CONSTCOND*/ 0)
# else
#define SET_CCB_TIMEOUT(conn, ccb, tout) callout_schedule(&ccb->timeout, tout)
# endif
#else
/* no test mode for 1.5 */
#define SET_CCB_TIMEOUT(conn, ccb, tout) \
callout_reset(&ccb->timeout, tout, ccb_timeout, ccb)
#endif
#if (__NetBSD_Version__ >= 106000000)
# ifdef ISCSI_TEST_MODE
#define SET_CONN_TIMEOUT(conn, tout) do { \
if (test_conn_timeout (conn)) { \
callout_schedule(&conn->timeout, tout); \
} \
} while (/*CONSTCOND*/0)
# else
#define SET_CONN_TIMEOUT(conn, tout) callout_schedule(&conn->timeout, tout)
# endif
} while (/*CONSTCOND*/ 0)
#else
/* no test mode for 1.5 */
#define SET_CONN_TIMEOUT(conn, tout) \
callout_reset(&conn->timeout, tout, connection_timeout, conn)
#define SET_CCB_TIMEOUT(conn, ccb, tout) callout_schedule(&ccb->timeout, tout)
#define SET_CONN_TIMEOUT(conn, tout) callout_schedule(&conn->timeout, tout)
#endif
/* in iscsi_ioctl.c */
@ -742,7 +710,7 @@ void iscsi_cleanup_thread(void *);
uint32_t map_databuf(struct proc *, void **, uint32_t);
void unmap_databuf(struct proc *, void *, uint32_t);
#endif
int iscsiioctl(dev_t, u_long, void *, int, PTHREADOBJ);
int iscsiioctl(dev_t, u_long, void *, int, struct lwp *);
session_t *find_session(uint32_t);
connection_t *find_connection(session_t *, uint32_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_ioctl.c,v 1.7 2015/05/03 15:07:12 joerg Exp $ */
/* $NetBSD: iscsi_ioctl.c,v 1.8 2015/05/15 16:24:30 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -606,7 +606,7 @@ kill_session(session_t *session, uint32_t status, int logout, bool recover)
* Parameter:
* par IN/OUT: The login parameters
* session IN: The owning session
* p IN: The proc pointer of the caller
* l IN: The lwp pointer of the caller
*
* Returns: 0 on success
* >0 on failure, connection structure deleted
@ -615,7 +615,7 @@ kill_session(session_t *session, uint32_t status, int logout, bool recover)
STATIC int
create_connection(iscsi_login_parameters_t *par, session_t *session,
PTHREADOBJ p)
struct lwp *l)
{
connection_t *connection;
int rc, s;
@ -672,7 +672,7 @@ create_connection(iscsi_login_parameters_t *par, session_t *session,
/* close the file descriptor */
fd_close(par->socket);
connection->threadobj = p;
connection->threadobj = l;
connection->login_par = par;
/*DEBOUT (("Creating receive thread\n")); */
@ -753,7 +753,7 @@ create_connection(iscsi_login_parameters_t *par, session_t *session,
* Parameter:
* par IN/OUT: The login parameters
* conn IN: The connection
* p IN: The proc pointer of the caller
* l IN: The lwp pointer of the caller
*
* Returns: 0 on success
* >0 on failure, connection structure deleted
@ -762,7 +762,7 @@ create_connection(iscsi_login_parameters_t *par, session_t *session,
STATIC int
recreate_connection(iscsi_login_parameters_t *par, session_t *session,
connection_t *connection, PTHREADOBJ p)
connection_t *connection, struct lwp *l)
{
int rc, s;
ccb_t *ccb;
@ -797,7 +797,7 @@ recreate_connection(iscsi_login_parameters_t *par, session_t *session,
/* close the file descriptor */
fd_close(par->socket);
connection->threadobj = p;
connection->threadobj = l;
connection->login_par = par;
connection->terminating = ISCSI_STATUS_SUCCESS;
connection->recover++;
@ -952,11 +952,11 @@ check_login_pars(iscsi_login_parameters_t *par)
*
* Parameter:
* par IN/OUT: The login parameters
* p IN: The proc pointer of the caller
* l IN: The lwp pointer of the caller
*/
STATIC void
login(iscsi_login_parameters_t *par, PTHREADOBJ p)
login(iscsi_login_parameters_t *par, struct lwp *l)
{
session_t *session;
int rc, s;
@ -993,7 +993,7 @@ login(iscsi_login_parameters_t *par, PTHREADOBJ p)
session->login_type = par->login_type;
session->CmdSN = 1;
if ((rc = create_connection(par, session, p)) != 0) {
if ((rc = create_connection(par, session, l)) != 0) {
if (rc > 0) {
free(session, M_DEVBUF);
}
@ -1051,11 +1051,11 @@ logout(iscsi_logout_parameters_t *par)
*
* Parameter:
* par IN/OUT: The login parameters
* p IN: The proc pointer of the caller
* l IN: The lwp pointer of the caller
*/
STATIC void
add_connection(iscsi_login_parameters_t *par, PTHREADOBJ p)
add_connection(iscsi_login_parameters_t *par, struct lwp *l)
{
session_t *session;
@ -1067,7 +1067,7 @@ add_connection(iscsi_login_parameters_t *par, PTHREADOBJ p)
return;
}
if ((par->status = check_login_pars(par)) == 0) {
create_connection(par, session, p);
create_connection(par, session, l);
}
}
@ -1114,11 +1114,11 @@ remove_connection(iscsi_remove_parameters_t *par)
*
* Parameter:
* par IN/OUT: The login parameters
* p IN: The proc pointer of the caller
* l IN: The lwp pointer of the caller
*/
STATIC void
restore_connection(iscsi_login_parameters_t *par, PTHREADOBJ p)
restore_connection(iscsi_login_parameters_t *par, struct lwp *l)
{
session_t *session;
connection_t *connection;
@ -1140,7 +1140,7 @@ restore_connection(iscsi_login_parameters_t *par, PTHREADOBJ p)
}
if ((par->status = check_login_pars(par)) == 0) {
recreate_connection(par, session, connection, p);
recreate_connection(par, session, connection, l);
}
}
@ -1222,13 +1222,8 @@ unmap_databuf(struct proc *p, void *buf, uint32_t datalen)
/* following code lifted almost verbatim from uvm_io.c */
vm_map_lock(kernel_map);
uvm_unmap_remove(kernel_map, databuf, databuf + datalen, &dead_entries
#if (__NetBSD_Version__ >= 399000500)
, 0
#elif (__NetBSD_Version__ >= 300000000)
, NULL
#endif
);
uvm_unmap_remove(kernel_map, databuf, databuf + datalen, &dead_entries,
0);
vm_map_unlock(kernel_map);
if (dead_entries != NULL) {
uvm_unmap_detach(dead_entries, AMAP_REFALL);
@ -1244,11 +1239,11 @@ unmap_databuf(struct proc *p, void *buf, uint32_t datalen)
*
* Parameter:
* par IN/OUT: The iocommand parameters
* p IN: The proc pointer of the caller
* l IN: The lwp pointer of the caller
*/
STATIC void
io_command(iscsi_iocommand_parameters_t *par, PTHREADOBJ p)
io_command(iscsi_iocommand_parameters_t *par, struct lwp *l)
{
uint32_t datalen = par->req.datalen;
void *databuf = par->req.databuf;
@ -1272,7 +1267,7 @@ io_command(iscsi_iocommand_parameters_t *par, PTHREADOBJ p)
return;
}
if (datalen && (par->status = map_databuf(PROCP(p),
if (datalen && (par->status = map_databuf(l->l_proc,
&par->req.databuf, datalen)) != 0) {
return;
}
@ -1280,7 +1275,7 @@ io_command(iscsi_iocommand_parameters_t *par, PTHREADOBJ p)
par->options.immediate, par->connection_id);
if (datalen) {
unmap_databuf(PROCP(p), par->req.databuf, datalen);
unmap_databuf(l->l_proc, par->req.databuf, datalen);
par->req.databuf = databuf; /* restore original addr */
}
@ -1602,11 +1597,11 @@ iscsi_cleanup_thread(void *par)
* cmd The ioctl Command
* addr IN/OUT: The command parameter
* flag Flags (ignored)
* p IN: The thread object of the caller
* l IN: The lwp object of the caller
*/
int
iscsiioctl(dev_t dev, u_long cmd, void *addr, int flag, PTHREADOBJ p)
iscsiioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
{
DEB(1, ("ISCSI Ioctl cmd = %x\n", (int) cmd));
@ -1617,15 +1612,15 @@ iscsiioctl(dev_t dev, u_long cmd, void *addr, int flag, PTHREADOBJ p)
break;
case ISCSI_LOGIN:
login((iscsi_login_parameters_t *) addr, p);
login((iscsi_login_parameters_t *) addr, l);
break;
case ISCSI_ADD_CONNECTION:
add_connection((iscsi_login_parameters_t *) addr, p);
add_connection((iscsi_login_parameters_t *) addr, l);
break;
case ISCSI_RESTORE_CONNECTION:
restore_connection((iscsi_login_parameters_t *) addr, p);
restore_connection((iscsi_login_parameters_t *) addr, l);
break;
case ISCSI_LOGOUT:
@ -1638,7 +1633,7 @@ iscsiioctl(dev_t dev, u_long cmd, void *addr, int flag, PTHREADOBJ p)
#ifndef ISCSI_MINIMAL
case ISCSI_IO_COMMAND:
io_command((iscsi_iocommand_parameters_t *) addr, p);
io_command((iscsi_iocommand_parameters_t *) addr, l);
break;
#endif
@ -1694,11 +1689,11 @@ iscsiioctl(dev_t dev, u_long cmd, void *addr, int flag, PTHREADOBJ p)
break;
case ISCSI_TEST_ADD_MODIFICATION:
test_add_mod(PROCP(p), (iscsi_test_add_modification_parameters_t *) addr);
test_add_mod(l->l_proc, (iscsi_test_add_modification_parameters_t *) addr);
break;
case ISCSI_TEST_SEND_PDU:
test_send_pdu(PROCP(p), (iscsi_test_send_pdu_parameters_t *) addr);
test_send_pdu(l->l_proc, (iscsi_test_send_pdu_parameters_t *) addr);
break;
case ISCSI_TEST_CANCEL:

View File

@ -121,7 +121,7 @@ STATIC void iscsi_minphys(struct buf *);
*******************************************************************************/
int
iscsiopen(dev_t dev, int flag, int mode, PTHREADOBJ p)
iscsiopen(dev_t dev, int flag, int mode, struct lwp *l)
{
DEB(99, ("ISCSI Open\n"));
@ -129,7 +129,7 @@ iscsiopen(dev_t dev, int flag, int mode, PTHREADOBJ p)
}
int
iscsiclose(dev_t dev, int flag, int mode, PTHREADOBJ p)
iscsiclose(dev_t dev, int flag, int mode, struct lwp *l)
{
DEB(99, ("ISCSI Close\n"));

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_rcv.c,v 1.6 2014/09/05 09:27:34 matt Exp $ */
/* $NetBSD: iscsi_rcv.c,v 1.7 2015/05/15 16:24:30 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -90,11 +90,7 @@ try_resynch_receive(connection_t *conn)
int rc;
uio.uio_rw = UIO_READ;
#if (__NetBSD_Version__ >= 399000900)
UIO_SETUP_SYSSPACE(&uio);
#else
uio.uio_segflg = UIO_SYSSPACE;
#endif
do {
io_vec.iov_base = buffer;
@ -199,11 +195,7 @@ read_pdu_data(pdu_t *pdu, uint8_t *data, uint32_t offset)
uio->uio_iovcnt = 1;
uio->uio_rw = UIO_READ;
uio->uio_resid = len;
#if (__NetBSD_Version__ >= 399000900)
UIO_SETUP_SYSSPACE(uio);
#else
uio->uio_segflg = UIO_SYSSPACE;
#endif
if (pad) {
uio->uio_iovcnt++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_send.c,v 1.10 2014/09/25 00:30:45 tls Exp $ */
/* $NetBSD: iscsi_send.c,v 1.11 2015/05/15 16:24:30 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -59,11 +59,7 @@ my_soo_write(connection_t *conn, struct uio *u)
assert(resid != 0);
#if (__NetBSD_Version__ >= 300000000)
ret = sosend(so, NULL, u, NULL, NULL, 0, conn->threadobj);
#else
ret = sosend(so, NULL, u, NULL, NULL, 0);
#endif
DEB(99, ("soo_write done: len = %zu\n", u->uio_resid));

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_utils.c,v 1.5 2012/12/29 11:05:30 mlelstv Exp $ */
/* $NetBSD: iscsi_utils.c,v 1.6 2015/05/15 16:24:30 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2008 The NetBSD Foundation, Inc.
@ -316,9 +316,7 @@ create_ccbs(session_t *sess)
ccb->session = sess;
callout_init(&ccb->timeout, 0);
#if (__NetBSD_Version__ >= 106000000)
callout_setfunc(&ccb->timeout, ccb_timeout, ccb);
#endif
/*DEB (9, ("Create_ccbs: ccb %x itt %x\n", ccb, ccb->ITT)); */
TAILQ_INSERT_HEAD(&sess->ccb_pool, ccb, chain);