From: Hannes Reinecke <h...@suse.de>

Add a -f/--suffix option to specify a suffix to be appended
to the interface name. The default is changed to devname.vlan,
instead of devname.vlan-fcoe .

Signed-off-by: Ankit Jain <jan...@novell.com>
Signed-off-by: Hannes Reinecke <h...@suse.de>
Signed-off-by: Robert Love <robert.w.l...@intel.com>
---
 doc/fipvlan.8   |   10 +++++++++-
 doc/fipvlan.txt |   11 ++++++++---
 fipvlan.c       |   14 +++++++++++---
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/doc/fipvlan.8 b/doc/fipvlan.8
index c26ea1c..76b8db1 100644
--- a/doc/fipvlan.8
+++ b/doc/fipvlan.8
@@ -51,6 +51,11 @@ Start the
 initiator on discovered FCoE VLANs
 .RE
 .PP
+\fB\-f\fR, \fB\-\-suffix \fI<suffix string>\fR
+.RS 4
+Append the specified string \fI<suffix string>\fR to VLAN interface names.
+.RE
+.PP
 \fB\-h\fR, \fB\-\-help\fR
 .RS 4
 Display a help message with basic usage instructions
@@ -64,7 +69,10 @@ version string
 .RE
 .SH "VLAN NAMING CONVENTIONS"
 .sp
-If a new VLAN device is created, it will have the name 
\fIdev\fR\&.\fIvlan\fR\-fcoe; where \fIdev\fR is the name of the Ethernet 
parent device and \fIvlan\fR is the discovered VLAN ID number\&.
+The default VLAN device name is \fIdev\fR\&.\fIvlan\fR; where
+\fIdev\fR is the name of the Ethernet parent device and \fIvlan\fR is
+the discovered VLAN ID number\&. An optional suffix can be appended to
+this with \fI-f\fR commandline option.
 .SH "EXAMPLES"
 .sp
 Display all discoverable VLANs with FCoE services
diff --git a/doc/fipvlan.txt b/doc/fipvlan.txt
index aa90d8b..0acff3f 100644
--- a/doc/fipvlan.txt
+++ b/doc/fipvlan.txt
@@ -56,6 +56,9 @@ OPTIONS
 *-s*, *--start*::
        Start the _Open-FCoE_ initiator on discovered FCoE VLANs
 
+*-f*, *--suffix* _suffix_::
+       Append the specified string _suffix_ to VLAN interface names.
+
 *-h*, *--help*::
        Display a help message with basic usage instructions
 
@@ -64,9 +67,11 @@ OPTIONS
 
 VLAN NAMING CONVENTIONS
 -----------------------
-If a new VLAN device is created, it will have the name _dev_._vlan_-fcoe;
+If a new VLAN device is created, it will have the name _dev_._vlan_;
 where _dev_ is the name of the Ethernet parent device and _vlan_ is the
-discovered VLAN ID number.
+discovered VLAN ID number. An optional suffix may be appended to this
+with the the *-f* command line option.
+
 
 EXAMPLES
 --------
@@ -80,7 +85,7 @@ _Open-FCoE_ initiator
        fipvlan --create --start eth2
 
 In this example if FCoE services were available on VLAN 101 of network
-interface eth2, then a VLAN interface eth2.101-fcoe would be created and
+interface eth2, then a VLAN interface eth2.101 would be created and
 used as the parent device for the initiator.
 
 SEE ALSO
diff --git a/fipvlan.c b/fipvlan.c
index 87fe949..37ec035 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -63,11 +63,13 @@ struct {
        bool automode;
        bool create;
        bool start;
+       char suffix[256];
 } config = {
        .namev = NULL,
        .namec = 0,
        .automode = false,
        .create = false,
+       .suffix = "",
 };
 
 char *exe;
@@ -402,12 +404,13 @@ void rtnl_recv_newlink(struct nlmsghdr *nh)
 
 /* command line arguments */
 
-#define GETOPT_STR "acshv"
+#define GETOPT_STR "acf:shv"
 
 static const struct option long_options[] = {
        { "auto", no_argument, NULL, 'a' },
        { "create", no_argument, NULL, 'c' },
        { "start", no_argument, NULL, 's' },
+       { "suffix", required_argument, NULL, 'f' },
        { "help", no_argument, NULL, 'h' },
        { "version", no_argument, NULL, 'v' },
        { NULL, 0, NULL, 0 }
@@ -421,6 +424,7 @@ static void help(int status)
                "  -a, --auto           Auto select Ethernet interfaces\n"
                "  -c, --create         Create system VLAN devices\n"
                "  -s, --start          Start FCoE login automatically\n"
+               "  -f, --suffix         Append the suffix to VLAN interface 
name\n"
                "  -h, --help           Display this help and exit\n"
                "  -v, --version        Display version information and exit\n",
                exe);
@@ -446,6 +450,10 @@ void parse_cmdline(int argc, char **argv)
                case 's':
                        config.start = true;
                        break;
+               case 'f':
+                       if (optarg && strlen(optarg))
+                               strncpy(config.suffix, optarg, 256);
+                       break;
                case 'h':
                        help(0);
                        break;
@@ -500,8 +508,8 @@ void create_missing_vlans()
                                    real_dev->ifname, fcf->vlan, vlan->ifname);
                        continue;
                }
-               snprintf(vlan_name, IFNAMSIZ, "%s.%d-fcoe",
-                        real_dev->ifname, fcf->vlan);
+               snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
+                        real_dev->ifname, fcf->vlan, config.suffix);
                rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
                if (rc < 0)
                        printf("Failed to crate VLAN device %s\n\t%s\n",

_______________________________________________
devel mailing list
devel@open-fcoe.org
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to