"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fcoe-utils/fcnsq.c" between
open-fcoe-3.11.tar.gz and open-fcoe-3.19.tar.gz

About: Open-FCoE is a Fibre Channel over Ethernet implementation. The non-kernel components for Linux kernel version 3.19.

fcnsq.c  (open-fcoe-3.11):fcnsq.c  (open-fcoe-3.19)
skipping to change at line 27 skipping to change at line 27
* Maintained at www.Open-FCoE.org * Maintained at www.Open-FCoE.org
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <getopt.h> #include <getopt.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <linux/types.h> #include <linux/types.h>
typedef __u8 u8; typedef __u8 u8;
skipping to change at line 231 skipping to change at line 232
#define FC_NS_GPN_ID 0x0112 #define FC_NS_GPN_ID 0x0112
static int gpn_id(int bsg, u32 fcid) static int gpn_id(int bsg, u32 fcid)
{ {
u64 wwpn; u64 wwpn;
u16 rjt; u16 rjt;
rjt = gn_id(bsg, fcid, FC_NS_GPN_ID, &wwpn); rjt = gn_id(bsg, fcid, FC_NS_GPN_ID, &wwpn);
if (rjt) if (rjt)
goto fail; goto fail;
print_result("Port Name", "%16.16llx\n", wwpn); print_result("Port Name", "%16.16jx\n", (uintmax_t)wwpn);
return 0; return 0;
fail: fail:
if (rjt == (u16) ~0) if (rjt == (u16) ~0)
print_err("%s ioctl failed: %s\n", __func__, strerror(errno)); print_err("%s ioctl failed: %s\n", __func__, strerror(errno));
else else
print_err("%s command failed: %s, %s\n", __func__, print_err("%s command failed: %s, %s\n", __func__,
rjt_reason[ct_rjt_reason(rjt)], rjt_reason[ct_rjt_reason(rjt)],
rjt_explan[ct_rjt_explan(rjt)]); rjt_explan[ct_rjt_explan(rjt)]);
return rjt; return rjt;
} }
#define FC_NS_GNN_ID 0x0113 #define FC_NS_GNN_ID 0x0113
static int gnn_id(int bsg, u32 fcid) static int gnn_id(int bsg, u32 fcid)
{ {
u64 wwnn; u64 wwnn;
u16 rjt; u16 rjt;
rjt = gn_id(bsg, fcid, FC_NS_GNN_ID, &wwnn); rjt = gn_id(bsg, fcid, FC_NS_GNN_ID, &wwnn);
if (rjt) if (rjt)
goto fail; goto fail;
print_result("Node Name", "%16.16llx\n", wwnn); print_result("Node Name", "%16.16jx\n", (uintmax_t)wwnn);
return 0; return 0;
fail: fail:
if (rjt == (u16) ~0) if (rjt == (u16) ~0)
print_err("%s ioctl failed: %s\n", __func__, strerror(errno)); print_err("%s ioctl failed: %s\n", __func__, strerror(errno));
else else
print_err("%s command failed: %s, %s\n", __func__, print_err("%s command failed: %s, %s\n", __func__,
rjt_reason[ct_rjt_reason(rjt)], rjt_reason[ct_rjt_reason(rjt)],
rjt_explan[ct_rjt_explan(rjt)]); rjt_explan[ct_rjt_explan(rjt)]);
return rjt; return rjt;
} }
skipping to change at line 368 skipping to change at line 369
static void help(int status) static void help(int status)
{ {
printf( printf(
"Usage: fcnsq <host#> <command> [options]\n" "Usage: fcnsq <host#> <command> [options]\n"
"Commands:\n" "Commands:\n"
" --gpn <port id>\n" " --gpn <port id>\n"
" --gnn <port id>\n" " --gnn <port id>\n"
" --gspn <port id>\n" " --gspn <port id>\n"
" --gsnn <world wide node name>\n" " --gsnn <world wide node name>\n"
"Options:\n" "Options:\n"
" --quiet print minimal results on success, and no error me ssages\n" " --quiet|-q print minimal results on success, and no error me ssages\n"
"\n" "\n"
"Port IDs and World Wide Names must be specified in hexadecimal.\ n" "Port IDs and World Wide Names must be specified in hexadecimal.\ n"
); );
exit(status); exit(status);
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *bsg; char *bsg;
int bsg_dev; int bsg_dev;
u32 port_id; u32 port_id = 0;
u64 wwnn; u64 wwnn = 0;
int rc = 0; int rc = 0;
enum commands cmd = 0; enum commands cmd = 0;
char c; char c;
uintmax_t wwnn_tmp = 0;
while(1) { while(1) {
c = getopt_long_only(argc, argv, "", options, NULL); c = getopt_long_only(argc, argv, "", options, NULL);
if (c < 0) if (c < 0)
break; break;
switch(c) { switch(c) {
case '?': case '?':
help(-1); help(-1);
break; break;
case 'q': case 'q':
quiet = true; quiet = true;
break; break;
case GPN_ID: case GPN_ID:
case GNN_ID: case GNN_ID:
case GSPN_ID: case GSPN_ID:
if (cmd) if (cmd)
help(-1); help(-1);
cmd = c; cmd = c;
sscanf(optarg, "%x", &port_id); if (sscanf(optarg, "%x", &port_id) != 1)
help(-1);
break; break;
case GSNN_NN: case GSNN_NN:
if (cmd) if (cmd)
help(-1); help(-1);
cmd = c; cmd = c;
sscanf(optarg, "%llx", &wwnn); if (sscanf(optarg, "%jx", &wwnn_tmp) == 1)
wwnn = (u64)wwnn_tmp;
else
help(-1);
break; break;
} }
} }
if (cmd == NONE) if (cmd == NONE)
help(-1); help(-1);
if (asprintf(&bsg, "/dev/bsg/fc_%s", argv[optind]) < 0) { if (asprintf(&bsg, "/dev/bsg/fc_%s", argv[optind]) < 0) {
if (!quiet) if (!quiet)
perror(NULL); perror(NULL);
 End of changes. 8 change blocks. 
7 lines changed or deleted 13 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS