make the debug level available on the command line.
This commit is contained in:
parent
a534436e93
commit
68a964c306
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.1 2011/10/23 21:11:23 agc Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2012/05/27 19:52:51 christos Exp $
|
||||
|
||||
PROG= iscsid
|
||||
|
||||
@ -8,6 +8,8 @@ SRCS= iscsid_main.c iscsid_lists.c iscsid_driverif.c \
|
||||
CPPFLAGS+= -I${DESTDIR}/usr/include/dev/iscsi
|
||||
CPPFLAGS+= -I${DESTDIR}/usr/include
|
||||
CPPFLAGS+= -D_THREAD_SAFE
|
||||
CPPFLAGS+= -DISCSI_NOTHREAD
|
||||
DBG=-g
|
||||
|
||||
MAN= iscsid.8
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: iscsid.8,v 1.2 2011/11/21 08:23:20 njoly Exp $
|
||||
.\" $NetBSD: iscsid.8,v 1.3 2012/05/27 19:52:51 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2011 Alistair Crooks <agc@NetBSD.org>
|
||||
.\" All rights reserved.
|
||||
@ -23,7 +23,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd August 8, 2011
|
||||
.Dd May 27, 2012
|
||||
.Dt ISCSID 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -31,6 +31,7 @@
|
||||
.Nd interface to kernel iSCSI driver
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Ar d
|
||||
.Sh DESCRIPTION
|
||||
The iSCSI initiator runs as a kernel driver, and provides access
|
||||
to iSCSI targets running across a network using the iSCSI protocol,
|
||||
@ -56,7 +57,9 @@ exits on receiving a terminate message,
|
||||
(no response to one that is sent to the kernel),
|
||||
or when an error occurs reading from or writing to the socket.
|
||||
.Pp
|
||||
There are no command line arguments to
|
||||
The only command line argument
|
||||
.Ar d
|
||||
increases the debug level.
|
||||
.Nm .
|
||||
.Pp
|
||||
It is envisaged that user-level communication take place with
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: iscsid_main.c,v 1.3 2011/11/20 01:23:57 agc Exp $ */
|
||||
/* $NetBSD: iscsid_main.c,v 1.4 2012/05/27 19:52:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
|
||||
@ -53,9 +53,10 @@ pthread_t event_thread; /* event thread handle */
|
||||
int driver = -1; /* the driver's file desc */
|
||||
int client_sock; /* the client communication socket */
|
||||
|
||||
#ifdef ISCSI_DEBUG
|
||||
int debug_level = ISCSI_DEBUG; /* How much info to display */
|
||||
#ifndef ISCSI_DEBUG
|
||||
#define ISCSI_DEBUG 0
|
||||
#endif
|
||||
int debug_level = ISCSI_DEBUG; /* How much info to display */
|
||||
|
||||
/*
|
||||
To avoid memory fragmentation (and speed things up a bit), we use the
|
||||
@ -68,6 +69,13 @@ static uint8_t rsp_buf[RSP_BUFFER_SIZE]; /* default buffer for responses */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void __dead
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [-d]\n", getprogname());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* create_node_name:
|
||||
@ -501,7 +509,7 @@ int
|
||||
/*ARGSUSED*/
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int req_temp, rsp_temp;
|
||||
int req_temp, rsp_temp, c;
|
||||
ssize_t ret;
|
||||
size_t len;
|
||||
struct sockaddr_un from;
|
||||
@ -518,7 +526,17 @@ main(int argc, char **argv)
|
||||
|
||||
printf("iSCSI Daemon loaded\n");
|
||||
|
||||
daemon(0, 1);
|
||||
while ((c = getopt(argc, argv, "d")) != -1)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
debug_level++;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
||||
if (!debug_level)
|
||||
daemon(0, 1);
|
||||
|
||||
#ifndef ISCSI_NOTHREAD
|
||||
ret = pthread_create(&event_thread, NULL, event_handler, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user