128 lines
4.5 KiB
Diff
128 lines
4.5 KiB
Diff
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/log.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.c
|
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/log.c 2010-05-06 15:26:01.000000000 -0500
|
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.c 2010-05-06 15:51:47.000000000 -0500
|
|
@@ -281,10 +281,15 @@ void log_do_log_daemon(int prio, void *p
|
|
|
|
void log_do_log_stderr(int prio, void *priv, const char *fmt, va_list ap)
|
|
{
|
|
- fprintf(stderr, "%s: ", log_name);
|
|
- vfprintf(stderr, fmt, ap);
|
|
- fprintf(stderr, "\n");
|
|
- fflush(stderr);
|
|
+ if (prio == LOG_INFO) {
|
|
+ vfprintf(stdout, fmt, ap);
|
|
+ fprintf(stdout, "\n");
|
|
+ } else {
|
|
+ fprintf(stderr, "%s: ", log_name);
|
|
+ vfprintf(stderr, fmt, ap);
|
|
+ fprintf(stderr, "\n");
|
|
+ fflush(stderr);
|
|
+ }
|
|
}
|
|
|
|
void log_warning(const char *fmt, ...)
|
|
@@ -313,6 +318,14 @@ void log_debug(int level, const char *fm
|
|
}
|
|
}
|
|
|
|
+void log_info(const char *fmt, ...)
|
|
+{
|
|
+ va_list ap;
|
|
+ va_start(ap, fmt);
|
|
+ log_func(LOG_INFO, log_func_priv, fmt, ap);
|
|
+ va_end(ap);
|
|
+}
|
|
+
|
|
static void __dump_line(int level, unsigned char *buf, int *cp)
|
|
{
|
|
char line[16*3+5], *lp = line;
|
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/log.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.h
|
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/log.h 2010-05-06 15:26:01.000000000 -0500
|
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.h 2010-05-06 15:39:58.000000000 -0500
|
|
@@ -71,6 +71,8 @@ extern int log_init(char *program_name,
|
|
void *priv);
|
|
extern void log_close (pid_t pid);
|
|
extern void dump_logmsg (void *);
|
|
+extern void log_info(const char *fmt, ...)
|
|
+ __attribute__ ((format (printf, 1, 2)));
|
|
extern void log_warning(const char *fmt, ...)
|
|
__attribute__ ((format (printf, 1, 2)));
|
|
extern void log_error(const char *fmt, ...)
|
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/session_mgmt.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/session_mgmt.c
|
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/session_mgmt.c 2010-05-06 15:26:01.000000000 -0500
|
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/session_mgmt.c 2010-05-06 15:43:28.000000000 -0500
|
|
@@ -42,10 +42,10 @@ static void log_login_msg(struct node_re
|
|
rec->conn[0].port);
|
|
iscsid_handle_error(rc);
|
|
} else
|
|
- log_warning("Login to [iface: %s, target: %s, portal: "
|
|
- "%s,%d] successful.", rec->iface.name,
|
|
- rec->name, rec->conn[0].address,
|
|
- rec->conn[0].port);
|
|
+ log_info("Login to [iface: %s, target: %s, portal: "
|
|
+ "%s,%d] successful.", rec->iface.name,
|
|
+ rec->name, rec->conn[0].address,
|
|
+ rec->conn[0].port);
|
|
}
|
|
|
|
struct iscsid_async_req {
|
|
@@ -100,15 +100,15 @@ int iscsi_login_portal(void *data, struc
|
|
struct iscsid_async_req *async_req = NULL;
|
|
int rc = 0, fd;
|
|
|
|
- log_warning("Logging in to [iface: %s, target: %s, portal: %s,%d]",
|
|
- rec->iface.name, rec->name, rec->conn[0].address,
|
|
- rec->conn[0].port);
|
|
+ log_info("Logging in to [iface: %s, target: %s, portal: %s,%d]",
|
|
+ rec->iface.name, rec->name, rec->conn[0].address,
|
|
+ rec->conn[0].port);
|
|
|
|
if (list) {
|
|
async_req = calloc(1, sizeof(*async_req));
|
|
if (!async_req)
|
|
- log_error("Could not allocate memory for async login "
|
|
- "handling. Using sequential login instead.");
|
|
+ log_info("Could not allocate memory for async login "
|
|
+ "handling. Using sequential login instead.");
|
|
else
|
|
INIT_LIST_HEAD(&async_req->list);
|
|
}
|
|
@@ -215,10 +215,10 @@ static void log_logout_msg(struct sessio
|
|
info->persistent_address, info->port);
|
|
iscsid_handle_error(rc);
|
|
} else
|
|
- log_warning("Logout of [sid: %d, target: %s, "
|
|
- "portal: %s,%d] successful.",
|
|
- info->sid, info->targetname,
|
|
- info->persistent_address, info->port);
|
|
+ log_info("Logout of [sid: %d, target: %s, "
|
|
+ "portal: %s,%d] successful.",
|
|
+ info->sid, info->targetname,
|
|
+ info->persistent_address, info->port);
|
|
}
|
|
|
|
static int iscsid_logout_reqs_wait(struct list_head *list)
|
|
@@ -252,16 +252,16 @@ int iscsi_logout_portal(struct session_i
|
|
int fd, rc;
|
|
|
|
/* TODO: add fn to add session prefix info like dev_printk */
|
|
- log_warning("Logging out of session [sid: %d, target: %s, portal: "
|
|
- "%s,%d]",
|
|
- info->sid, info->targetname, info->persistent_address,
|
|
- info->port);
|
|
+ log_info("Logging out of session [sid: %d, target: %s, portal: "
|
|
+ "%s,%d]",
|
|
+ info->sid, info->targetname, info->persistent_address,
|
|
+ info->port);
|
|
|
|
if (list) {
|
|
async_req = calloc(1, sizeof(*async_req));
|
|
if (!async_req)
|
|
- log_error("Could not allocate memory for async logout "
|
|
- "handling. Using sequential logout instead.");
|
|
+ log_info("Could not allocate memory for async logout "
|
|
+ "handling. Using sequential logout instead.");
|
|
}
|
|
|
|
if (!async_req)
|