[PATCH 1/3] style fixes in tgtd.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alexander Nezhinsky <nezhinsky@xxxxxxxxx>


Signed-off-by: Alexander Nezhinsky <alexandern@xxxxxxxxxxxx>
---
 usr/tgtd.c |   51 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/usr/tgtd.c b/usr/tgtd.c
index 6199926..b4c78ec 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -50,8 +50,7 @@ static char program_name[] = "tgtd";
 static LIST_HEAD(tgt_events_list);
 static LIST_HEAD(tgt_sched_events_list);
 
-static struct option const long_options[] =
-{
+static struct option const long_options[] = {
 	{"foreground", no_argument, 0, 'f'},
 	{"control-port", required_argument, 0, 'C'},
 	{"nr_iothreads", required_argument, 0, 't'},
@@ -66,29 +65,32 @@ static char *spare_args;
 
 static void usage(int status)
 {
-	if (status)
-		fprintf(stderr, "Try `%s --help' for more information.\n", program_name);
-	else {
-		printf("Usage: %s [OPTION]\n", program_name);
-		printf("\
-Target framework daemon, version %s\n\
-  -f, --foreground        make the program run in the foreground\n\
-  -C, --control-port NNNN use port NNNN for the mgmt channel\n\
-  -t, --nr_iothreads NNNN specify the number of I/O threads\n\
-  -d, --debug debuglevel  print debugging information\n\
-  -V, --version           print version and exit\n\
-  -h, --help              display this help and exit\n\
-", TGT_VERSION);
+	if (status) {
+		fprintf(stderr, "Try `%s --help' for more information.\n",
+			program_name);
+		exit(status);
 	}
-	exit(status);
+
+	printf("Linux SCSI Target framework daemon, version %s\n\n"
+		"Usage: %s [OPTION]\n"
+		"-f, --foreground        make the program run in the foreground\n"
+		"-C, --control-port NNNN use port NNNN for the mgmt channel\n"
+		"-t, --nr_iothreads NNNN specify the number of I/O threads\n"
+		"-d, --debug debuglevel  print debugging information\n"
+		"-V, --version           print version and exit\n"
+		"-h, --help              display this help and exit\n",
+		TGT_VERSION, program_name);
+	exit(0);
 }
 
 static void bad_optarg(int ret, int ch, char *optarg)
 {
 	if (ret == ERANGE)
-		fprintf(stderr, "-%c argument value '%s' out of range\n", ch, optarg);
+		fprintf(stderr, "-%c argument value '%s' out of range\n",
+			ch, optarg);
 	else
-		fprintf(stderr, "-%c argument value '%s' invalid\n", ch, optarg);
+		fprintf(stderr, "-%c argument value '%s' invalid\n",
+			ch, optarg);
 	usage(ret);
 }
 
@@ -99,9 +101,10 @@ static void version(void)
 }
 
 /* Default TGT mgmt port */
-short int control_port = 0;
+short int control_port;
 
-static void signal_catch(int signo) {
+static void signal_catch(int signo)
+{
 }
 
 static int oom_adjust(void)
@@ -113,12 +116,14 @@ static int oom_adjust(void)
 	sprintf(path, "/proc/%d/oom_adj", getpid());
 	fd = open(path, O_WRONLY);
 	if (fd < 0) {
-		fprintf(stderr, "can't adjust oom-killer's pardon %s, %m\n", path);
+		fprintf(stderr, "can't adjust oom-killer's pardon %s, %m\n",
+			path);
 		return errno;
 	}
 	err = write(fd, "-17\n", 4);
 	if (err < 0) {
-		fprintf(stderr, "can't adjust oom-killer's pardon %s, %m\n", path);
+		fprintf(stderr, "can't adjust oom-killer's pardon %s, %m\n",
+			path);
 		close(fd);
 		return errno;
 	}
@@ -565,7 +570,7 @@ int main(int argc, char **argv)
 	if (err)
 		exit(1);
 
-	if (is_daemon && daemon(0,0))
+	if (is_daemon && daemon(0, 0))
 		exit(1);
 
 	err = log_init(program_name, LOG_SPACE_SIZE, is_daemon, is_debug);
-- 
1.7.9.6

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux