On Mon, 15 Dec 2008 11:41:23 +0100 Tomasz Chmielewski <mangoo@xxxxxxxx> wrote: > Currently, there is no easy way to check the version of tgtd/tgtadm and one has to do > "ls -l /usr/sbin/tgtd" and look at the date. Which can be misleading, if the files > were i.e. copied. > > This patch adds a version string to tgtd and tgtadm (defined in usr/version.h), > which will be displayed with --help, i.e.: > > # ./tgtd --help > Usage: tgtd [OPTION] > Target framework daemon, version 20081215 > (...) > > # ./tgtadm --help > Usage: tgtadm [OPTION] > Linux SCSI Target Framework Administration Utility, version 20081215 > (...) > > > > Signed-off-by: Tomasz Chmielewski <mangoo@xxxxxxxx> > > diff --git a/usr/tgtadm.c b/usr/tgtadm.c > index de7aed1..8d20c9c 100644 > --- a/usr/tgtadm.c > +++ b/usr/tgtadm.c > @@ -122,7 +122,7 @@ static void usage(int status) > else { > printf("Usage: %s [OPTION]\n", program_name); > printf("\ > -Linux SCSI Target Framework Administration Utility.\n\ > +Linux SCSI Target Framework Administration Utility, version %s\n\ > \n\ > --lld [driver] --mode target --op new --tid=[id] --targetname [name]\n\ > add a new target with [id] and [name]. [id] must not be zero.\n\ > @@ -164,7 +164,7 @@ Linux SCSI Target Framework Administration Utility.\n\ > target.\n\ > --help display this help and exit\n\ > \n\ > -Report bugs to <stgt-devel@xxxxxxxxxxxxxxxx>.\n"); > +Report bugs to <stgt-devel@xxxxxxxxxxxxxxxx>.\n", TGT_VERSION); > } > exit(status == 0 ? 0 : EINVAL); > } > diff --git a/usr/tgtadm.h b/usr/tgtadm.h > index 5d63485..03bea15 100644 > --- a/usr/tgtadm.h > +++ b/usr/tgtadm.h > @@ -5,6 +5,7 @@ > #define TGT_LLD_NAME_LEN 64 > > #include "tgtadm_error.h" > +#include "version.h" > > enum tgtadm_op { > OP_NEW, > diff --git a/usr/tgtd.c b/usr/tgtd.c > index 758e7d5..cbeb19e 100644 > --- a/usr/tgtd.c > +++ b/usr/tgtd.c > @@ -63,11 +63,11 @@ static void usage(int status) > else { > printf("Usage: %s [OPTION]\n", program_name); > printf("\ > -Target framework daemon.\n\ > +Target framework daemon, version %s\n\ > -f, --foreground make the program run in the foreground\n\ > -d, --debug debuglevel print debugging information\n\ > -h, --help display this help and exit\n\ > -"); > +", TGT_VERSION); > } > exit(status); > } > diff --git a/usr/tgtd.h b/usr/tgtd.h > index 12a20dc..3ec5c36 100644 > --- a/usr/tgtd.h > +++ b/usr/tgtd.h > @@ -3,6 +3,7 @@ > > #include "log.h" > #include "scsi_cmnd.h" > +#include "version.h" > > #define SCSI_ID_LEN 24 > #define SCSI_SN_LEN 32 > diff --git a/usr/version.h b/usr/version.h > index e69de29..a882486 100644 > --- a/usr/version.h > +++ b/usr/version.h > @@ -0,0 +1 @@ > +#define TGT_VERSION "20081215" Well, this force me to update TGT_VERSION every time I apply a patch. How about using a real version number (such as 0.9.2) for TGT_VERSION (we don't use a version number like 20081215)? -- 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