You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(23) |
Dec
(85) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(19) |
Feb
(13) |
Mar
(7) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(31) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Robert W. <wrw...@us...> - 2008-03-28 02:36:07
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20453/src Modified Files: iSNSLinux.c Log Message: fix daemon holding open parent descriptors Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** iSNSLinux.c 23 Aug 2007 22:31:07 -0000 1.16 --- iSNSLinux.c 28 Mar 2008 02:36:00 -0000 1.17 *************** *** 222,227 **** exit(1); } ! else if (pid) { exit(0); } --- 222,228 ---- exit(1); } ! else if (pid > 0) { + //__LOG_INFO("iSNS parent pid=%i\n",getpid() ); exit(0); } *************** *** 230,236 **** int fd_pid; char buf[64]; ! char *pid_file = "/var/run/isnss.pid"; int rc; fd_pid = open(pid_file, O_WRONLY | O_CREAT, 0644); --- 231,245 ---- int fd_pid; char buf[64]; ! char *pid_file = "/var/run/isnsd.pid"; int rc; + int i; + setsid(); + for (i=getdtablesize();i>0;--i) close(i); // close all descriptors + + chdir("/"); + i=open("/dev/null",O_RDWR); + dup(i); //sdout + dup(i); //sterr fd_pid = open(pid_file, O_WRONLY | O_CREAT, 0644); *************** *** 247,251 **** __LOG_INFO ("isns daemon started as pid:%i",getpid()); - setsid(); } } --- 256,259 ---- *************** *** 254,258 **** /* Never should hit this. */ - exit (-1); } --- 262,265 ---- |
From: Robert W. <wrw...@us...> - 2008-02-14 22:49:18
|
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5533/src Modified Files: comm.c parse.c Log Message: Fix compile warnings for 64bit, update iSNSdef to lastest protocol Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/comm.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comm.c 11 Dec 2006 18:01:08 -0000 1.3 --- comm.c 14 Feb 2008 22:49:13 -0000 1.4 *************** *** 484,488 **** /***********************************************************************/ int ! ESIListener (DWORD lparam) { char eid[256]; --- 484,488 ---- /***********************************************************************/ int ! ESIListener (LPVOID lparam) { char eid[256]; *************** *** 590,594 **** /***********************************************************************/ int ! TCPReceiveMain (DWORD lparam) { int e; --- 590,594 ---- /***********************************************************************/ int ! TCPReceiveMain (LPVOID lparam) { int e; Index: parse.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/parse.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** parse.c 2 Jan 2007 20:12:07 -0000 1.3 --- parse.c 14 Feb 2008 22:49:13 -0000 1.4 *************** *** 106,110 **** case ISNS_PROT_VER : return("Protocol Version Range"); case ISNS_ENTITY_PERIOD : return("Entity Period"); - case ISNS_ENTITY_SCN_BITMAP : return("Entity SCN Bitmap"); case ISNS_ENTITY_CERT : return("Entity Certificate"); case ISNS_PORTAL_IP : return("Portal IP-Address"); --- 106,109 ---- *************** *** 319,323 **** ntohl(p_attr->val.etype)?"Enabled":"Disabled"); break; - case ISNS_ENTITY_SCN_BITMAP : case ISNS_ENTITY_CERT : case ISNS_PORTAL_CERT : --- 318,321 ---- |
From: Robert W. <wrw...@us...> - 2008-02-14 22:49:17
|
Update of /cvsroot/linuxisns/iscsiClient/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5533/include Modified Files: comm.h iSNSdefs.h isns.h Log Message: Fix compile warnings for 64bit, update iSNSdef to lastest protocol Index: isns.h =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/include/isns.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** isns.h 11 Dec 2006 18:01:07 -0000 1.3 --- isns.h 14 Feb 2008 22:49:13 -0000 1.4 *************** *** 176,180 **** int ! ESIListener(DWORD lparam); #ifndef BUFFER_SIZE --- 176,180 ---- int ! ESIListener(LPVOID lparam); #ifndef BUFFER_SIZE Index: comm.h =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/include/comm.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** comm.h 2 Apr 2002 02:57:40 -0000 1.1.1.1 --- comm.h 14 Feb 2008 22:49:13 -0000 1.2 *************** *** 59,63 **** DWORD WINAPI #endif ! ESIListener(DWORD lparam); void SendESIRsp(void); --- 59,63 ---- DWORD WINAPI #endif ! ESIListener(LPVOID lparam); void SendESIRsp(void); *************** *** 68,72 **** DWORD WINAPI #endif ! TCPReceiveMain(DWORD lparam); int --- 68,72 ---- DWORD WINAPI #endif ! TCPReceiveMain(LPVOID lparam); int Index: iSNSdefs.h =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/include/iSNSdefs.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSdefs.h 2 Jan 2007 20:12:06 -0000 1.2 --- iSNSdefs.h 14 Feb 2008 22:49:13 -0000 1.3 *************** *** 180,183 **** --- 180,185 ---- ISNS_DELIMITER=0, ISNS_START_VALID_TAG=1, + + /* ENTITY tags */ ISNS_ENTITY_ID=ISNS_START_VALID_TAG, /* 1 */ ISNS_ENTITY_TYPE, *************** *** 185,193 **** ISNS_TIMESTAMP, ISNS_PROT_VER, ! ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ! ISNS_ENTITY_SCN_BITMAP, ! ISNS_ENTITY_IDX=14, ISNS_ENTITY_CERT, ISNS_PORTAL_IP=16, /* 16 */ ISNS_PORTAL_PORT, --- 187,197 ---- ISNS_TIMESTAMP, ISNS_PROT_VER, ! ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ! ISNS_ENTITY_IDX, ! ISNS_ENTITY_NEXT_IDX, ! ISNS_ENTITY_ISAKMP=11, ISNS_ENTITY_CERT, + /* PORT tags */ ISNS_PORTAL_IP=16, /* 16 */ ISNS_PORTAL_PORT, *************** *** 195,204 **** ISNS_ESI_INTERVAL, ISNS_ESI_PORT, ! /* ISNS_PORTAL_GROUP, -- tag removed from RFC spec */ ISNS_PORTAL_IDX=22, ! ISNS_SCN_PORT=23, ISNS_PORTAL_SECURITY_BITMAP=27, ISNS_PORTAL_CERT=31, ISNS_ISCSI_NODE_ID=32, /* 32 */ ISNS_ISCSI_TYPE, --- 199,210 ---- ISNS_ESI_INTERVAL, ISNS_ESI_PORT, ! ISNS_PORTAL_GROUP, /* tag was removed from RFC spec */ ISNS_PORTAL_IDX=22, ! ISNS_SCN_PORT, ! ISNS_PORTAL_NEXT_IDX, ISNS_PORTAL_SECURITY_BITMAP=27, ISNS_PORTAL_CERT=31, + /* ISCSI node tags */ ISNS_ISCSI_NODE_ID=32, /* 32 */ ISNS_ISCSI_TYPE, *************** *** 206,216 **** ISNS_ISCSI_SCN_BITMAP, ISNS_ISCSI_IDX, ISNS_ISCSI_CERT=40, ISNS_PORTAL_GROUP_ISCSI_NAME=48, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_PORT, ! ISNS_PORTAL_GROUP_TAG=51, ISNS_PORT_NAME=64, /* 64 */ ISNS_PORT_ID, --- 212,228 ---- ISNS_ISCSI_SCN_BITMAP, ISNS_ISCSI_IDX, + ISNS_WWNN_TOKEN, + ISNS_ISCSI_NEXT_IDX, ISNS_ISCSI_CERT=40, + /* PORTAL_GROUP tags */ ISNS_PORTAL_GROUP_ISCSI_NAME=48, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_PORT, ! ISNS_PORTAL_GROUP_TAG, ! ISNS_PORTAL_GROUP_IDX, ! ISNS_PORTAL_GROUP_NEXT_IDX, + /* FC */ ISNS_PORT_NAME=64, /* 64 */ ISNS_PORT_ID, *************** *** 227,232 **** ISNS_IFCP_NODE_CERT=80, iSNS_FC4_TYPE_QUERY_KEY=95, ! ! ISNS_NODE_NAME=96, ISNS_NODE_SYM_NAME, ISNS_FC_NODE_IP, --- 239,243 ---- ISNS_IFCP_NODE_CERT=80, iSNS_FC4_TYPE_QUERY_KEY=95, ! ISNS_NODE_NAME, ISNS_NODE_SYM_NAME, ISNS_FC_NODE_IP, *************** *** 234,247 **** ISNS_FC_NODE_CERT, - ISNS_DDS_ID=101, - ISNS_DDS_SYM_NAME, - ISNS_DDS_STATUS, - ISNS_DD_ID, - ISNS_DD_SYM_NAME, - ISNS_DD_ISCSI_MEMBER_IDX, - ISNS_DD_ISCSI_MEMBER, - ISNS_DD_IFCP_MEMBER, - ISNS_DD_FEATURE_BITMAP, - /* Server specific tags */ ISNS_VENDOR_ID = 131, --- 245,248 ---- *************** *** 259,263 **** ISNS_DD_ACTIVE, ISNS_NODE_ACTIVE, ! ISNS_END_VALID_TAG } ISNS_TAG; --- 260,281 ---- ISNS_DD_ACTIVE, ISNS_NODE_ACTIVE, ! ISNS_END_VALID_TAG, ! ! /* DDS tags */ ! ISNS_DDS_ID=2049, ! ISNS_DDS_SYM_NAME, ! ISNS_DDS_STATUS, ! ! /* DD tags */ ! ISNS_DD_ID=2065, ! ISNS_DD_SYM_NAME, ! ISNS_DD_ISCSI_MEMBER_IDX, ! ISNS_DD_ISCSI_MEMBER, ! ISNS_DD_IFCP_MEMBER, ! ISNS_DD_PORTAL_MEMBER_IDX, ! ISNS_DD_PORTAL_IP_ADDR, ! ISNS_DD_PORTAL_TCPUDP, ! ISNS_DD_FEATURE_BITMAP=2078, ! ISNS_DD_NEXT_ID } ISNS_TAG; |
From: Robert W. <wrw...@us...> - 2007-09-12 15:52:47
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3529/src Modified Files: iSNSquery.c iSNSreg.c Log Message: Change DD Member to lookup index from an iSCSI node rather than store it. Fixes lookup error Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** iSNSreg.c 28 Aug 2007 17:49:06 -0000 1.33 --- iSNSreg.c 12 Sep 2007 15:52:40 -0000 1.34 *************** *** 1469,1489 **** SOIP_Dd_Member *p_member; SOIP_Dd_Member new_member; - SOIP_Iscsi *p_node; - int rval; - SOIP_DB_Entry lentry; - int index_number; ! __DEBUG (isns_reg_debug &1, Add_DD_Member:%s, p_node_name); ! ! rval = read_ISCSIObject(p_node_name, &p_node, &lentry); ! if ( rval != SUCCESS) ! { ! index_number = index; ! } ! else ! { ! index_number = p_node->iscsi_index; ! } ! pnode = NULL; while ((pnode = GetNextNode(&p_dd->member_list, pnode))) --- 1469,1476 ---- SOIP_Dd_Member *p_member; SOIP_Dd_Member new_member; ! __DEBUG (isns_reg_debug &1, Add iSCSI node:%s to Discovery Domain, p_node_name); ! ! /* search for member in list, if found then no need to add */ pnode = NULL; while ((pnode = GetNextNode(&p_dd->member_list, pnode))) *************** *** 1498,1512 **** } memset(&new_member, 0, sizeof(new_member)); - new_member.type = type; new_member.status = status; __ISNS_COPY (new_member.node_id, sizeof(new_member.node_id), p_node_name, strlen(p_node_name)); - new_member.node_idx = index_number; - - __DEBUG (isns_reg_debug &1, Add_DD_Member member.type:%i,new_member.type); __DEBUG (isns_reg_debug &1, Add_DD_Member member.node_id:%s,new_member.node_id); - __DEBUG (isns_reg_debug &1, Add_DD_Member member.node_idx:%i,new_member.node_idx); - AddNode(&p_dd->member_list, (char *)&new_member, sizeof(new_member)); --- 1485,1494 ---- } + /* not found, so add new member to Discovery Domain */ memset(&new_member, 0, sizeof(new_member)); new_member.type = type; new_member.status = status; __ISNS_COPY (new_member.node_id, sizeof(new_member.node_id), p_node_name, strlen(p_node_name)); __DEBUG (isns_reg_debug &1, Add_DD_Member member.node_id:%s,new_member.node_id); AddNode(&p_dd->member_list, (char *)&new_member, sizeof(new_member)); *************** *** 2969,2973 **** /* Active DD's Node Membership */ p_member->status = ISNS_DD_MEMBER_ENABLE; - p_member->node_idx = index; switch ( type ) --- 2951,2954 ---- Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** iSNSquery.c 28 Aug 2007 17:49:06 -0000 1.31 --- iSNSquery.c 12 Sep 2007 15:52:40 -0000 1.32 *************** *** 2137,2141 **** } - /******************************************************************** Gets the next DD iSCSI Member. --- 2137,2140 ---- *************** *** 2155,2158 **** --- 2154,2159 ---- int foundFlag; int rval; + SOIP_Iscsi *p_node; + SOIP_DB_Entry lentry; ISNSParseMsg( &p_md->msg, attr_indx, key_indx, &src_attr ); *************** *** 2189,2193 **** continue; ! if ( p_member->node_idx == p_attr->val.index ) { foundFlag = TRUE; --- 2190,2195 ---- continue; ! rval = read_ISCSIObject(p_member->node_id, &p_node, &lentry); ! if ( rval == SUCCESS && p_node->iscsi_index == p_attr->val.index ) { foundFlag = TRUE; *************** *** 2206,2211 **** /* Append Attribute */ p_member = (SOIP_Dd_Member *)GetNodeData(plnode); ! ISNSAppendAttr(p_rspmsg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_ISCSI_IDX_SIZE, ! NULL, p_member->node_idx); } --- 2208,2216 ---- /* Append Attribute */ p_member = (SOIP_Dd_Member *)GetNodeData(plnode); ! rval = read_ISCSIObject(p_member->node_id, &p_node, &lentry); ! if ( rval == SUCCESS) ! ISNSAppendAttr(p_rspmsg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_ISCSI_IDX_SIZE, NULL, p_node->iscsi_index); ! else ! ISNSAppendAttr(p_rspmsg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_ISCSI_IDX_SIZE, NULL, 0); } *************** *** 2213,2217 **** } - int ISNSdbProcessDDSOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, --- 2218,2221 ---- *************** *** 2291,2294 **** --- 2295,2300 ---- int rval; SOIP_Dds *p_dds; + SOIP_Iscsi *p_node; + SOIP_DB_Entry lentry2; for (ii = 0; (ii < SNS_MAX_ATTRS) && (attr_indx[ii]); ii++) *************** *** 2340,2346 **** if (index_Flag != -1 ) if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ! ISNS_DD_ISCSI_MEMBER_IDX_SIZE, ! NULL, p_member->node_idx); } } --- 2346,2359 ---- if (index_Flag != -1 ) if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! { ! /* find index from iscsi node record from node_id*/ ! rval = read_ISCSIObject(p_member->node_id, &p_node, &lentry2); ! if (rval == SUCCESS) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, ! NULL, p_node->iscsi_index); ! else ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, ! NULL, 0); ! } } } *************** *** 2359,2365 **** if (index_Flag != -1 ) if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ! ISNS_DD_ISCSI_MEMBER_IDX_SIZE, ! NULL, p_member->node_idx); } } --- 2372,2385 ---- if (index_Flag != -1 ) if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! { ! /* find index from iscsi node record from node_id*/ ! rval = read_ISCSIObject(p_member->node_id, &p_node, &lentry2); ! if (rval == SUCCESS) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, ! NULL, p_node->iscsi_index); ! else ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, ! NULL, 0); ! } } } |
From: Robert W. <wrw...@us...> - 2007-09-12 15:52:47
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3529/include Modified Files: iSNStypes.h Log Message: Change DD Member to lookup index from an iSCSI node rather than store it. Fixes lookup error Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** iSNStypes.h 28 Aug 2007 17:47:56 -0000 1.20 --- iSNStypes.h 12 Sep 2007 15:52:40 -0000 1.21 *************** *** 342,346 **** uint32_t status; char sym_name[DDS_SYM_NAME_SIZE]; - ISNS_LIST dd_list; --- 342,345 ---- *************** *** 352,356 **** uint32_t type; uint32_t status; - uint32_t node_idx; } SOIP_Dd_Member, SOIP_DD_Member_Key; --- 351,354 ---- |
From: Robert W. <wrw...@us...> - 2007-08-28 17:49:11
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30922/src Modified Files: iSNSquery.c iSNSreg.c Log Message: fix compiler warnings Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** iSNSreg.c 27 Aug 2007 22:49:05 -0000 1.32 --- iSNSreg.c 28 Aug 2007 17:49:06 -0000 1.33 *************** *** 2840,2844 **** ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); ! if ( key_indx && key_indx[ 0 ] == NULL ) { __DEBUG( isns_reg_debug & 1, (Missing key) ); --- 2840,2844 ---- ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); ! if ( key_indx[0] == NULL ) { __DEBUG( isns_reg_debug & 1, (Missing key) ); Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** iSNSquery.c 27 Aug 2007 22:49:05 -0000 1.30 --- iSNSquery.c 28 Aug 2007 17:49:06 -0000 1.31 *************** *** 1713,1724 **** } ! ISNSAppendKey (p_rspmsg, ISNS_DD_ID, ! ISNS_DD_ID_SIZE, NULL, p_dd->id); ! ! if (attr_indx && attr_indx[0]) ! { ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessDDOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_dd); ! } found=TRUE; --- 1713,1719 ---- } ! ISNSAppendKey (p_rspmsg, ISNS_DD_ID, ISNS_DD_ID_SIZE, NULL, p_dd->id); ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessDDOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_dd); found=TRUE; *************** *** 1755,1767 **** } ! ! ISNSAppendKey (p_rspmsg, ISNS_DDS_ID, ! ISNS_DDS_ID_SIZE, NULL, p_dds->id); ! ! if (attr_indx && attr_indx[0]) ! { ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessDDSOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_dds); ! } found=TRUE; --- 1750,1756 ---- } ! ISNSAppendKey (p_rspmsg, ISNS_DDS_ID,ISNS_DDS_ID_SIZE, NULL, p_dds->id); ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessDDSOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_dds); found=TRUE; *************** *** 1827,1835 **** PAD4 (strlen ((char *)&qkey.val)), (char *)&qkey.val, 0); ! if (attr_indx && attr_indx[0]) ! { ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); ! } found=TRUE; } --- 1816,1821 ---- PAD4 (strlen ((char *)&qkey.val)), (char *)&qkey.val, 0); ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); found=TRUE; } *************** *** 1891,1899 **** PAD4 (strlen (p_entity->eid.id)), p_entity->eid.id, 0); ! if (attr_indx && attr_indx[0]) ! { ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessEntityOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_entity); ! } found=TRUE; --- 1877,1882 ---- PAD4 (strlen (p_entity->eid.id)), p_entity->eid.id, 0); ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessEntityOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_entity); found=TRUE; *************** *** 1931,1939 **** ISNS_PORT_NAME_SIZE, (char *)&qkey.val, 0); ! if (attr_indx && attr_indx[0]) ! { ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessPortOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_port); ! } found=TRUE; --- 1914,1919 ---- ISNS_PORT_NAME_SIZE, (char *)&qkey.val, 0); ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! ISNSdbProcessPortOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_port); found=TRUE; *************** *** 2000,2014 **** } ! ISNSAppendKey (p_rspmsg, ISNS_PORTAL_IP, ! ISNS_PORTAL_IP_SIZE, (char *)&qkey.val, 0); ! ISNSAppendKey (p_rspmsg, ISNS_PORTAL_PORT, ISNS_PORTAL_PORT_SIZE, (char *)&qkey.val + ISNS_PORTAL_IP_SIZE, 0); ! if (attr_indx && attr_indx[0]) ! { ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! SNSProcessPortalOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_portal); ! } found=TRUE; --- 1980,1989 ---- } ! ISNSAppendKey (p_rspmsg, ISNS_PORTAL_IP,ISNS_PORTAL_IP_SIZE,(char *)&qkey.val, 0); ISNSAppendKey (p_rspmsg, ISNS_PORTAL_PORT, ISNS_PORTAL_PORT_SIZE, (char *)&qkey.val + ISNS_PORTAL_IP_SIZE, 0); ! ISNSAppendKey (p_rspmsg, 0, 0, NULL, 0); ! SNSProcessPortalOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_portal); found=TRUE; *************** *** 2444,2447 **** --- 2419,2426 ---- case ISNS_ESI_PORT: case ISNS_PORTAL_CERT: + case ISNS_PORTAL_GROUP_TAG: + case ISNS_PORTAL_GROUP_IP: + case ISNS_PORTAL_GROUP_PORT: + case ISNS_PORTAL_GROUP_ISCSI_NAME: fetchPortalFlag = TRUE; break; *************** *** 2508,2512 **** break; - /* Located in the Entity object */ case ISNS_MGMT_IP: ISNSAppendAttr ( (struct ISNS_msg *) p_msg, ISNS_MGMT_IP, ISNS_IP_SIZE, --- 2487,2490 ---- |
From: Robert W. <wrw...@us...> - 2007-08-28 17:49:11
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30922 Modified Files: Makefile Log Message: fix compiler warnings Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 24 Aug 2007 22:51:34 -0000 1.11 --- Makefile 28 Aug 2007 17:49:06 -0000 1.12 *************** *** 41,45 **** INCDIR += -I/usr/include/ ! OBJECTS = getarg.o OBJECTS += iSNSMain.o OBJECTS += iSNScomm.o --- 41,45 ---- INCDIR += -I/usr/include/ ! OBJECTS = OBJECTS += iSNSMain.o OBJECTS += iSNScomm.o *************** *** 80,86 **** $(CC) $^ -o $@ $(LIBS) - getarg.o : $(SRCDIR)getarg.c - $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ - iSNSMain.o : $(SRCDIR)iSNSMain.c $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ --- 80,83 ---- |
From: Robert W. <wrw...@us...> - 2007-08-28 17:48:00
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30054 Modified Files: iSNS.h iSNSList.h iSNStypes.h Log Message: fix type defs to specify as unsigned integers Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** iSNStypes.h 27 Aug 2007 22:49:05 -0000 1.19 --- iSNStypes.h 28 Aug 2007 17:47:56 -0000 1.20 *************** *** 135,139 **** typedef struct { uint32_t attr_id; ! int attr_len; void *attr_val; } ISNS_ATTR_VALS; --- 135,139 ---- typedef struct { uint32_t attr_id; ! uint32_t attr_len; void *attr_val; } ISNS_ATTR_VALS; *************** *** 143,149 **** */ typedef struct { ! int flags; ! int num_entries; ! int total_size; ISNS_ATTR_VALS *attr_val_sptr; } ISNS_ATTR_VALS_CB; --- 143,149 ---- */ typedef struct { ! uint32_t flags; ! uint32_t num_entries; ! uint32_t total_size; ISNS_ATTR_VALS *attr_val_sptr; } ISNS_ATTR_VALS_CB; *************** *** 531,535 **** uint32_t portal_id; IP_Address ip_addr; ! int32_t ip_port; char sym_name[ PORTAL_SYM_NAME_SIZE ]; uint32_t node_type; //1=target, 2=initiator --- 531,535 ---- uint32_t portal_id; IP_Address ip_addr; ! uint32_t ip_port; char sym_name[ PORTAL_SYM_NAME_SIZE ]; uint32_t node_type; //1=target, 2=initiator *************** *** 725,729 **** typedef struct ISNS_key { ! int tag; uint32_t len; --- 725,729 ---- typedef struct ISNS_key { ! uint32_t tag; uint32_t len; *************** *** 749,753 **** typedef struct ISNS_attr { ! int tag; uint32_t len; --- 749,753 ---- typedef struct ISNS_attr { ! uint32_t tag; uint32_t len; *************** *** 772,776 **** SOIP_COS cos; uint32_t portal_group; ! int priority; SOIP_Node_IPA ipa; SOIP_Hard_Addr hard_addr; --- 772,776 ---- SOIP_COS cos; uint32_t portal_group; ! uint32_t priority; SOIP_Node_IPA ipa; SOIP_Hard_Addr hard_addr; *************** *** 806,810 **** typedef struct soip_scn_callback_entry { ! int bitmap; uint32_t type; void (*scn_callback_func)(ISNS_ATTR_VALS_CB *avcb_ptr); --- 806,810 ---- typedef struct soip_scn_callback_entry { ! uint32_t bitmap; uint32_t type; void (*scn_callback_func)(ISNS_ATTR_VALS_CB *avcb_ptr); Index: iSNSList.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSList.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSList.h 27 Aug 2007 21:25:16 -0000 1.4 --- iSNSList.h 28 Aug 2007 17:47:56 -0000 1.5 *************** *** 39,49 **** { void *data; ! int data_size; ! int list_id; ! int index; void *p_entry; ! int next_index; ! int prev_index; } ISNS_LIST_NODE; --- 39,49 ---- { void *data; ! uint32_t data_size; ! uint32_t list_id; ! uint32_t index; void *p_entry; ! uint32_t next_index; ! uint32_t prev_index; } ISNS_LIST_NODE; *************** *** 51,58 **** typedef struct _list { ! int node_count; ! int list_id; ! int first_index; ! int last_index; void *p_entry; --- 51,58 ---- typedef struct _list { ! uint32_t node_count; ! uint32_t list_id; ! uint32_t first_index; ! uint32_t last_index; void *p_entry; Index: iSNS.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNS.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNS.h 2 Jan 2007 20:15:24 -0000 1.3 --- iSNS.h 28 Aug 2007 17:47:56 -0000 1.4 *************** *** 44,48 **** /* This should be a string */ ! #define ISNS_VERSION "1.2.0" /* This should be an integer, and is the protocol version */ --- 44,48 ---- /* This should be a string */ ! #define ISNS_VERSION "2.1.1" /* This should be an integer, and is the protocol version */ |
From: Robert W. <wrw...@us...> - 2007-08-27 22:49:14
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20606/src Modified Files: iSNSquery.c iSNSreg.c Log Message: fix portal group tag Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** iSNSreg.c 27 Aug 2007 21:25:17 -0000 1.31 --- iSNSreg.c 27 Aug 2007 22:49:05 -0000 1.32 *************** *** 258,261 **** --- 258,262 ---- PORTAL_LIST_ENTRY newPortalEntry; char *p_iscsi_name; + SOIP_DB_Portal *p_idx; __DEBUG (isns_reg_debug & 1, (Registering Portal)); *************** *** 406,410 **** p_portal->portal_index = ISNSGetNewPortalIdx(); ! SOIP_DB_Portal *p_idx; memset (&entry3, 0, sizeof(SOIP_DB_Entry)); p_idx = &entry3.data.portal_idx; --- 407,412 ---- p_portal->portal_index = ISNSGetNewPortalIdx(); ! p_portal->default_portal_tag = 1; //DEFAULT portal_tag ! memset (&entry3, 0, sizeof(SOIP_DB_Entry)); p_idx = &entry3.data.portal_idx; *************** *** 540,543 **** --- 542,548 ---- } break; + case ISNS_PORTAL_GROUP_TAG: + p_portal->default_portal_tag = attr->val.portal_group; + break; case ISNS_PORTAL_IP: case ISNS_PORTAL_PORT: Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** iSNSquery.c 27 Aug 2007 21:25:17 -0000 1.29 --- iSNSquery.c 27 Aug 2007 22:49:05 -0000 1.30 *************** *** 2659,2663 **** if (p_portal_group) { ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_TAG); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, NULL, p_portal_group->portal_tag); --- 2659,2663 ---- if (p_portal_group) { ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_TAG from portal group object); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, NULL, p_portal_group->portal_tag); *************** *** 2665,2671 **** else { ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_TAG); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, ! NULL, 1); } break; --- 2665,2671 ---- else { ! __DEBUG (isns_query_debug &1,Add ISNS_PORTAL_GROUP_TAG from default tag in portal object); ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, ! NULL, p_portal->default_portal_tag); } break; |
From: Robert W. <wrw...@us...> - 2007-08-27 22:49:14
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20606/include Modified Files: iSNStypes.h Log Message: fix portal group tag Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** iSNStypes.h 27 Aug 2007 21:25:16 -0000 1.18 --- iSNStypes.h 27 Aug 2007 22:49:05 -0000 1.19 *************** *** 544,547 **** --- 544,548 ---- void *ptr_cert; uint32_t cert_size; + uint32_t default_portal_tag; } SOIP_Portal; |
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19062/src Modified Files: iSNSList.c iSNSdb.c iSNSdereg.c iSNSesi.c iSNSobjects.c iSNSquery.c iSNSreg.c iSNSscn.c Log Message: abstract database read/write calls Index: iSNSobjects.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSobjects.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSobjects.c 24 Aug 2007 22:51:34 -0000 1.1 --- iSNSobjects.c 27 Aug 2007 21:25:17 -0000 1.2 *************** *** 49,52 **** --- 49,90 ---- /********************************************************************* + read_FCNodeObject + *********************************************************************/ + int + read_FCNodeObject (char *p_id, SOIP_Fc_Node **p_node, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) + return (ERROR); + + key.tag = NODE_NAME_KEY; + strcpy(key.val.node_key.v, p_id); + rval = ISNSdbRead(&key,p_entry); + *p_node = (SOIP_Fc_Node *)&p_entry->data; + return rval; + } + + /********************************************************************* + read_FCPortObject + *********************************************************************/ + int + read_FCPortObject (char *p_id, SOIP_Ifcp **p_node, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) + return (ERROR); + + key.tag = PORT_NAME_KEY; + strcpy(key.val.port_key.v, p_id); + rval = ISNSdbRead(&key,p_entry); + *p_node = (SOIP_Ifcp *)&p_entry->data; + return rval; + } + + /********************************************************************* read_ISCSIObject *********************************************************************/ *************** *** 61,65 **** key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v, p_id); rval = ISNSdbRead(&key,p_entry); *p_node = (SOIP_Iscsi *)&p_entry->data; --- 99,103 ---- key.tag = ISCSI_ID_KEY; ! strcpy(key.val.iscsi_key.v, p_id); rval = ISNSdbRead(&key,p_entry); *p_node = (SOIP_Iscsi *)&p_entry->data; *************** *** 99,102 **** --- 137,178 ---- /********************************************************************* + read_PortalObject + *********************************************************************/ + int + read_PortalObject (SOIP_Portal_Key *p_portal_key, SOIP_Portal **p_portal, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if ( p_portal_key == NULL ) + return (ERROR); + + key.tag = PORTAL_ID_KEY; + __ISNS_COPY (&key.val.portal_key, sizeof(SOIP_Portal_Key), p_portal_key, sizeof(SOIP_Portal_Key)); + rval = ISNSdbRead(&key,p_entry); + *p_portal = (SOIP_Portal *)&p_entry->data; + return rval; + } + + /********************************************************************* + read_PortalGroupObject + *********************************************************************/ + int + read_PortalGroupObject (SOIP_Portal_Group_Key *p_portal_key, SOIP_Portal_Group **p_portal, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if ( p_portal_key == NULL ) + return (ERROR); + + key.tag = PORTAL_GROUP_ID_KEY; + __ISNS_COPY (&key.val.portal_group_key, sizeof(SOIP_Portal_Group_Key), p_portal_key, sizeof(SOIP_Portal_Group_Key)); + rval = ISNSdbRead(&key,p_entry); + *p_portal = (SOIP_Portal_Group *)&p_entry->data; + return rval; + } + + /********************************************************************* read_DDObject Reads a DD object from the database *************** *** 139,144 **** /********************************************************************* write_ISCSIObject ! Reads a ISCSI object from the database *********************************************************************/ int --- 215,328 ---- /********************************************************************* + read_EntityidxObject + Reads a idx object from the database + *********************************************************************/ + int + read_EntityidxObject (int id, void **p_idx, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if (id == 0) + return (ERROR); + + key.tag = ENTITY_IDX_KEY; + key.val.idx.index = id; + key.val.idx.index_type = ENTITY_IDX_KEY; + + rval = ISNSdbRead(&key,p_entry); + *p_idx = (char *)&p_entry->data.entity_idx.id; + + return rval; + } + + /********************************************************************* + read_ISCSIidxObject + Reads a idx object from the database + *********************************************************************/ + int + read_ISCSIidxObject (int id, void **p_idx, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if (id == 0) + return (ERROR); + + key.tag = ISCSI_IDX_KEY; + key.val.idx.index = id; + key.val.idx.index_type = ISCSI_IDX_KEY; + + rval = ISNSdbRead(&key,p_entry); + *p_idx = (char *)&p_entry->data.iscsi_idx; + + return rval; + } + + /********************************************************************* + read_PortalidxObject + Reads a idx object from the database + *********************************************************************/ + int + read_PortalidxObject (int id, void **p_idx, SOIP_DB_Entry *p_entry) + { + ISNS_DBKey key; + int rval; + + if (id == 0) + return (ERROR); + + key.tag = PORTAL_IDX_KEY; + key.val.idx.index = id; + key.val.idx.index_type = PORTAL_IDX_KEY; + + rval = ISNSdbRead(&key,p_entry); + *p_idx = (char *)&p_entry->data.portal_idx; + + return rval; + } + + + /********************************************************************* + write_FCNodeObject + Writes a FCNode object from the database + *********************************************************************/ + int + write_FCNodeObject (char *p_id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) + return (ERROR); + + key.tag = NODE_NAME_KEY; + strcpy(key.val.node_key.v,p_id); + rval = ISNSdbWrite(&key, p_entry); + return rval; + } + + /********************************************************************* + write_FCPortObject + Writes a FCPort object from the database + *********************************************************************/ + int + write_FCPortObject (char *p_id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) + return (ERROR); + + key.tag = PORT_NAME_KEY; + strcpy(key.val.port_key.v,p_id); + rval = ISNSdbWrite(&key, p_entry); + return rval; + } + + /********************************************************************* write_ISCSIObject ! Writes a ISCSI object from the database *********************************************************************/ int *************** *** 152,156 **** key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,p_id); rval = ISNSdbWrite(&key, p_entry); return rval; --- 336,340 ---- key.tag = ISCSI_ID_KEY; ! strcpy(key.val.iscsi_key.v,p_id); rval = ISNSdbWrite(&key, p_entry); return rval; *************** *** 159,163 **** /********************************************************************* write_EntityObject ! Reads a Entity object from the database *********************************************************************/ int --- 343,347 ---- /********************************************************************* write_EntityObject ! Writes a Entity object from the database *********************************************************************/ int *************** *** 177,182 **** /********************************************************************* write_DDObject ! Reads a DD object from the database *********************************************************************/ int --- 361,404 ---- /********************************************************************* + write_PortalObject + Writes a Portal object from the database + *********************************************************************/ + int + write_PortalObject (SOIP_Portal_Key *p_id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) ) + return (ERROR); + + key.tag = PORTAL_ID_KEY; + __ISNS_COPY(&key.val.portal_key, sizeof(SOIP_Portal_Key), p_id, sizeof(SOIP_Portal_Key)); + rval = ISNSdbWrite(&key, p_entry); + return rval; + } + + /********************************************************************* + write_PortalGroupObject + Writes a PortalGroup object from the database + *********************************************************************/ + int + write_PortalGroupObject (SOIP_Portal_Group_Key *p_id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) ) + return (ERROR); + + key.tag = PORTAL_GROUP_ID_KEY; + __ISNS_COPY(&key.val.portal_group_key, sizeof(SOIP_Portal_Group_Key), p_id, sizeof(SOIP_Portal_Group_Key)); + rval = ISNSdbWrite(&key, p_entry); + return rval; + } + + /********************************************************************* write_DDObject ! Writes a DD object from the database *********************************************************************/ int *************** *** 197,201 **** /********************************************************************* write_DDSObject ! Reads a DDS object from the database *********************************************************************/ int --- 419,423 ---- /********************************************************************* write_DDSObject ! Writes a DDS object from the database *********************************************************************/ int *************** *** 215,218 **** --- 437,503 ---- /********************************************************************* + write_ISCSIidxObject + Writes a index object from the database + *********************************************************************/ + int + write_ISCSIidxObject (int id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey idx_key; + int rval; + + if (id == 0) + return (ERROR); + + idx_key.tag = ISCSI_IDX_KEY; + idx_key.val.idx.index_type = ISCSI_IDX_KEY; + idx_key.val.idx.index = id; + rval = ISNSdbWrite(&idx_key,p_entry); + + return rval; + } + + /********************************************************************* + write_EntityidxObject + Writes a index object from the database + *********************************************************************/ + int + write_EntityidxObject (int id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey idx_key; + int rval; + + if (id == 0) + return (ERROR); + + idx_key.tag = ENTITY_IDX_KEY; + idx_key.val.idx.index_type = ENTITY_IDX_KEY; + idx_key.val.idx.index = id; + rval = ISNSdbWrite(&idx_key,p_entry); + + return rval; + } + + /********************************************************************* + write_PortalidxObject + Writes a index object from the database + *********************************************************************/ + int + write_PortalidxObject (int id, SOIP_DB_Entry p_entry) + { + ISNS_DBKey idx_key; + int rval; + + if (id == 0) + return (ERROR); + + idx_key.tag = PORTAL_IDX_KEY; + idx_key.val.idx.index_type = PORTAL_IDX_KEY; + idx_key.val.idx.index = id; + rval = ISNSdbWrite(&idx_key,p_entry); + + return rval; + } + + /********************************************************************* delete_DDObject delete a DD object from the database *************** *** 253,256 **** --- 538,581 ---- /********************************************************************* + delete_FCNodeObject + delete a FCNode object from the database + *********************************************************************/ + int + delete_FCNodeObject (char *p_id) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) + return (ERROR); + + key.tag = NODE_NAME_KEY; + strcpy(key.val.node_key.v,p_id); + + rval = ISNSdbDelete(&key); + return rval; + } + + /********************************************************************* + delete_FCPortObject + delete a FCPort object from the database + *********************************************************************/ + int + delete_FCPortObject (char *p_id) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) + return (ERROR); + + key.tag = PORT_NAME_KEY; + strcpy(key.val.port_key.v,p_id); + + rval = ISNSdbDelete(&key); + return rval; + } + + /********************************************************************* delete_ISCSIObject delete a ISCSI object from the database *************** *** 291,292 **** --- 616,716 ---- return rval; } + + /********************************************************************* + delete_PortalObject + delete a Portal object from the database + *********************************************************************/ + int + delete_PortalObject (SOIP_Portal_Key *p_id) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) ) + return (ERROR); + + key.tag = PORTAL_ID_KEY; + __ISNS_COPY(&key.val.portal_key, sizeof(SOIP_Portal_Key), p_id, sizeof(SOIP_Portal_Key)); + + rval = ISNSdbDelete(&key); + return rval; + } + + /********************************************************************* + delete_PortalGroupObject + delete a PortalGroup object from the database + *********************************************************************/ + int + delete_PortalGroupObject (SOIP_Portal_Group_Key *p_id) + { + ISNS_DBKey key; + int rval; + + if ( (p_id == NULL ) ) + return (ERROR); + + key.tag = PORTAL_GROUP_ID_KEY; + __ISNS_COPY(&key.val.portal_group_key, sizeof(SOIP_Portal_Group_Key), p_id, sizeof(SOIP_Portal_Group_Key)); + + rval = ISNSdbDelete(&key); + return rval; + } + + /********************************************************************* + delete_EntityidxObject + delete a idx object from the database + *********************************************************************/ + int + delete_EntityidxObject (int id) + { + ISNS_DBKey key; + int rval; + + if (id == 0) + return (ERROR); + + key.tag = ENTITY_IDX_KEY; + key.val.idx.index = id; + key.val.idx.index_type = ENTITY_IDX_KEY; + rval = ISNSdbDelete(&key); + return rval; + } + + /********************************************************************* + delete_ISCSIidxObject + delete a idx object from the database + *********************************************************************/ + int + delete_ISCSIidxObject (int id) + { + ISNS_DBKey key; + int rval; + + if (id == 0) + return (ERROR); + + key.tag = ISCSI_IDX_KEY; + key.val.idx.index = id; + key.val.idx.index_type = ISCSI_IDX_KEY; + rval = ISNSdbDelete(&key); + return rval; + } + /********************************************************************* + delete_PortalidxObject + delete a idx object from the database + *********************************************************************/ + int + delete_PortalidxObject (int id) + { + ISNS_DBKey key; + int rval; + + if (id == 0) + return (ERROR); + + key.tag = PORTAL_IDX_KEY; + key.val.idx.index = id; + key.val.idx.index_type = PORTAL_IDX_KEY; + rval = ISNSdbDelete(&key); + return rval; + } Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** iSNSquery.c 24 Aug 2007 22:51:34 -0000 1.28 --- iSNSquery.c 27 Aug 2007 21:25:17 -0000 1.29 *************** *** 234,238 **** SOIP_Ifcp *p_port; SOIP_Portal_Key db_portal; - ISNS_DBKey read_key; int rval; --- 234,237 ---- *************** *** 319,345 **** while (entityKeyFlag != -1) { [...1140 lines suppressed...] p_portal = ptr; --- 3310,3313 ---- *************** *** 3536,3541 **** case DDS_ID_KEY: { - ISNS_LIST_NODE * pnode; - SOIP_Dds * p_dds; p_dds = ptr; int jj; --- 3342,3345 ---- *************** *** 3558,3562 **** case DD_ID_KEY: { - SOIP_Dd *p_dd; p_dd = ptr; int ii; --- 3362,3365 ---- Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNSList.c 13 Aug 2007 22:56:44 -0000 1.14 --- iSNSList.c 27 Aug 2007 21:25:17 -0000 1.15 *************** *** 342,346 **** Retrieves the data pointer from a node. ********************************************************************/ ! char * GetNodeData(ISNS_LIST_NODE *pnode ) { --- 342,346 ---- Retrieves the data pointer from a node. ********************************************************************/ ! void * GetNodeData(ISNS_LIST_NODE *pnode ) { Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSesi.c 7 Aug 2007 14:41:47 -0000 1.11 --- iSNSesi.c 27 Aug 2007 21:25:17 -0000 1.12 *************** *** 49,52 **** --- 49,53 ---- #include "iSNSparse.h" #include "iSNSdebug.h" + #include "iSNSobjects.h" *************** *** 97,107 **** { __DEBUG (isns_esi_debug &1, Next Portal Record found); ! ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return rval; - p_portal = (SOIP_Portal *)&entry2.data; - /* check to see if an interval is set > 0 */ if ( p_portal->esi_interval == 0 ) --- 98,106 ---- { __DEBUG (isns_esi_debug &1, Next Portal Record found); ! __ISNS_COPY(&db_portal, sizeof(SOIP_Portal_Key), &read_key.val.portal_key, sizeof(SOIP_Portal_Key)); ! rval = read_PortalObject(&db_portal, &p_portal, &entry2); if (rval != SUCCESS) return rval; /* check to see if an interval is set > 0 */ if ( p_portal->esi_interval == 0 ) *************** *** 124,128 **** p_portal->esi_timer = mytime; p_portal->esiSent++; ! rval = ISNSdbWrite(&read_key,entry2); __DEBUG (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); --- 123,127 ---- p_portal->esi_timer = mytime; p_portal->esiSent++; ! rval = write_PortalObject(&db_portal, entry2); __DEBUG (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); *************** *** 177,181 **** db_portal.ip_port=p_portal->ip_port; ! SNSRemovePortalEntry ((char *)&db_portal, NULL, NULL); } } --- 176,180 ---- db_portal.ip_port=p_portal->ip_port; ! SNSRemovePortalEntry (&db_portal, NULL, NULL); } } *************** *** 201,205 **** int rval; SOIP_Entity_Id db_entity_id; - ISNS_DBKey update_key; __DEBUG (isns_esi_debug &1, ISNS_ProcessESI); --- 200,203 ---- *************** *** 217,229 **** strncpy(db_entity_id.id,p_attr->val.entity_id.id,sizeof(SOIP_Entity_Id)); ! ISNS_DBKey key; ! key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_key.id,db_entity_id.id); ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return (ERROR); - p_entity = &entry.data.entity; - /* Update the time stamp */ len = sizeof (mytime); --- 215,222 ---- strncpy(db_entity_id.id,p_attr->val.entity_id.id,sizeof(SOIP_Entity_Id)); ! rval = read_EntityObject(db_entity_id.id, &p_entity, &entry); if (rval != SUCCESS) return (ERROR); /* Update the time stamp */ len = sizeof (mytime); *************** *** 235,239 **** /* Store Entry */ ! ISNSdbWrite(&key,entry); memset(&db_portal,0,sizeof(SOIP_Portal_Key)); --- 228,232 ---- /* Store Entry */ ! write_EntityObject(db_entity_id.id, entry); memset(&db_portal,0,sizeof(SOIP_Portal_Key)); *************** *** 258,273 **** db_portal.ip_port=p_attr->val.ip_port; ! update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_Portal_Key)); ! rval = ISNSdbRead(&update_key,&entry); if (rval != SUCCESS) return rval; - p_portal = &entry.data.portal; - p_portal->esiSent = 0; /* Store Portal */ ! rval = ISNSdbWrite(&update_key,entry); return ( ISNS_NO_ERR ); --- 251,262 ---- db_portal.ip_port=p_attr->val.ip_port; ! rval = read_PortalObject(&db_portal, &p_portal, &entry); if (rval != SUCCESS) return rval; p_portal->esiSent = 0; /* Store Portal */ ! rval = write_PortalObject(&db_portal, entry); return ( ISNS_NO_ERR ); Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** iSNSdereg.c 24 Aug 2007 22:51:34 -0000 1.27 --- iSNSdereg.c 27 Aug 2007 21:25:17 -0000 1.28 *************** *** 487,491 **** int rval; ISNS_LIST_NODE *pnode; - ISNS_DBKey key; __DEBUG ( isns_dereg_debug & 1, (Deregistering Entity %s),p_entity_id); --- 487,490 ---- *************** *** 539,550 **** /* Remove Entity In Entity Index Database */ ! ISNS_DBKey remove_key; ! remove_key.tag = ENTITY_IDX_KEY; ! remove_key.val.idx.index = p_entity->entity_index; ! remove_key.val.idx.index_type = ENTITY_IDX_KEY; ! ISNSdbDelete(&remove_key); /* Remove Entity */ ! rval = delete_EntityObject(key.val.entity_key.id); iSNS_stats.num_entity--; --- 538,545 ---- /* Remove Entity In Entity Index Database */ ! delete_EntityidxObject(p_entity->entity_index); /* Remove Entity */ ! rval = delete_EntityObject(p_entity_id); iSNS_stats.num_entity--; *************** *** 576,580 **** SOIP_DD_Key dd_key; ISNS_LIST_NODE *pnode; - ISNS_DBKey delete_key; __DEBUG (isns_dereg_debug & 1, (Deregistering IFCP WWPN)); --- 571,574 ---- *************** *** 590,602 **** __ISNS_COPY (buffer, sizeof(buffer), ifcp_node_key, PORT_NAME_SIZE); ! ISNS_DBKey read_key; ! read_key.tag = PORT_NAME_KEY; ! strcpy(read_key.val.port_name.v,(char *)buffer); ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return rval; - p_ifcp_node = (SOIP_Ifcp *)&entry2.data; - /* Remove from all DD */ pnode=NULL; --- 584,591 ---- __ISNS_COPY (buffer, sizeof(buffer), ifcp_node_key, PORT_NAME_SIZE); ! rval = read_FCPortObject((char *)buffer, &p_ifcp_node, &entry2); if (rval != SUCCESS) return rval; /* Remove from all DD */ pnode=NULL; *************** *** 604,616 **** { dd_key.id = *(uint32_t *) GetNodeData(pnode); ! ISNS_DBKey read_key; ! read_key.tag = PORT_NAME_KEY; ! strcpy(read_key.val.port_name.v,GetNodeData(pnode)); ! rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&entry5.data; - if (ISNS_NO_ERR != Disable_DD_Member (p_dd, p_ifcp_node->port_name.v, ISNS_DD_IFCP_MEMBER)) --- 593,600 ---- { dd_key.id = *(uint32_t *) GetNodeData(pnode); ! rval = read_DDObject(dd_key.id, &p_dd, &entry5); if (rval != SUCCESS) return rval; if (ISNS_NO_ERR != Disable_DD_Member (p_dd, p_ifcp_node->port_name.v, ISNS_DD_IFCP_MEMBER)) *************** *** 618,625 **** /* Store Entry */ ! ISNS_DBKey key; ! key.tag = PORT_NAME_KEY; ! key.val.dd_key.id = dd_key.id; ! rval = ISNSdbWrite(&key,entry5); } --- 602,606 ---- /* Store Entry */ ! rval = write_DDObject(dd_key.id,entry5); } *************** *** 639,652 **** __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_ifcp_node->node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! ISNS_DBKey read_key; ! read_key.tag = NODE_NAME_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) return rval; - p_fc_node = &entry3.data.node; - - /* Remove IFCP Node from FC Node's List */ if ((pnode=FindNode(&p_fc_node->port_list, ifcp_node_key, PORT_NAME_SIZE))) --- 620,627 ---- __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), p_ifcp_node->node_name.v, ISNS_NODE_NAME_SIZE); db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! read_FCNodeObject(db_node_name.v, &p_fc_node, &entry3); if (rval != SUCCESS) return rval; /* Remove IFCP Node from FC Node's List */ if ((pnode=FindNode(&p_fc_node->port_list, ifcp_node_key, PORT_NAME_SIZE))) *************** *** 655,662 **** } ! ISNS_DBKey key; ! key.tag = NODE_NAME_KEY; ! strcpy(key.val.node_key.v,db_node_name.v); ! rval = ISNSdbWrite(&key,entry3); if (IsEmptyList(&p_fc_node->port_list)) --- 630,634 ---- } ! rval = write_FCNodeObject(db_node_name.v, entry3); if (IsEmptyList(&p_fc_node->port_list)) *************** *** 693,705 **** { /* Fetch Portal */ ! ISNS_DBKey read_key; ! read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_Portal_Key)); ! rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) return rval; - p_portal = (SOIP_Portal *)&entry3.data; - if (p_portal->esi_interval != 0) { --- 665,672 ---- { /* Fetch Portal */ ! rval = read_PortalObject(GetNodeData(pnode), &p_portal, &entry3); if (rval != SUCCESS) return rval; if (p_portal->esi_interval != 0) { *************** *** 721,727 **** iSNS_stats.num_ifcp--; ! delete_key.tag = PORT_NAME_KEY; ! strcpy(delete_key.val.port_name.v,buffer); ! if ( ISNSdbDelete (&delete_key) != SUCCESS) { __LOG_ERROR ("ERROR: IFCP NODE Removal failed."); --- 688,693 ---- iSNS_stats.num_ifcp--; ! rval = delete_FCPortObject(buffer); ! if (rval != SUCCESS) { __LOG_ERROR ("ERROR: IFCP NODE Removal failed."); *************** *** 806,810 **** if (SUCCESS != ! (rval = SNSRemovePortalEntry ((char *)&db_portal, src_attr, rspmsg))) return (rval); --- 772,776 ---- if (SUCCESS != ! (rval = SNSRemovePortalEntry (&db_portal, src_attr, rspmsg))) return (rval); *************** *** 968,972 **** SOIP_DD_Key dd_key; ISNS_LIST_NODE *pnode; - ISNS_DBKey remove_key; __DEBUG (isns_dereg_debug & 1, (Deregistering iSCSI Node:%s),iscsi_node_key); --- 934,937 ---- *************** *** 1020,1027 **** /* Delete the iSCSI Node */ ! remove_key.tag = ISCSI_IDX_KEY; ! remove_key.val.idx.index = p_node->iscsi_index; ! remove_key.val.idx.index_type = ISCSI_IDX_KEY; ! ISNSdbDelete(&remove_key); RemoveCert (&p_node->ptr_cert); DeleteList(&p_node->dd_id_list); --- 985,990 ---- /* Delete the iSCSI Node */ ! delete_ISCSIidxObject(p_node->iscsi_index); ! RemoveCert (&p_node->ptr_cert); DeleteList(&p_node->dd_id_list); *************** *** 1051,1058 **** int rval; SOIP_Fc_Node *p_fc_node; - SOIP_Ifcp *p_ifcp_node; SOIP_DB_Node_Name db_node_name; ISNS_LIST_NODE *pnode; - ISNS_DBKey delete_key; ISNS_DBKey read_key; --- 1014,1019 ---- *************** *** 1064,1088 **** db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! read_key.tag = NODE_NAME_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry4); if (rval != SUCCESS) return rval; - p_fc_node = &entry4.data.node; - pnode=NULL; while ((pnode=GetNextNode(&p_fc_node->port_list, pnode))) { strcpy(read_key.val.node_key.v,GetNodeData(pnode)); ! rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS) return rval; ! p_ifcp_node = &entry5.data.port; ! ! memset (p_ifcp_node->node_name.v, 0, ISNS_NODE_NAME_SIZE); ! ! rval = ISNSdbWrite(&read_key,entry5); } --- 1025,1042 ---- db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! rval = read_FCNodeObject(db_node_name.v, &p_fc_node, &entry4); if (rval != SUCCESS) return rval; pnode=NULL; while ((pnode=GetNextNode(&p_fc_node->port_list, pnode))) { strcpy(read_key.val.node_key.v,GetNodeData(pnode)); ! rval = read_FCNodeObject(GetNodeData(pnode), &p_fc_node, &entry5); if (rval != SUCCESS) return rval; ! memset (p_fc_node->node_name.v, 0, ISNS_NODE_NAME_SIZE); ! rval = write_FCNodeObject(db_node_name.v, entry5); } *************** *** 1090,1096 **** db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! delete_key.tag = NODE_NAME_KEY; ! strcpy(delete_key.val.node_key.v,db_node_name.v); ! ISNSdbDelete (&delete_key); __DEBUG (isns_dereg_debug &1,(Prepare response for: %s),p_key); --- 1044,1048 ---- db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! delete_FCNodeObject(db_node_name.v); __DEBUG (isns_dereg_debug &1,(Prepare response for: %s),p_key); *************** *** 1104,1108 **** *********************************************************************/ int ! SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg) { --- 1056,1060 ---- *********************************************************************/ int ! SNSRemovePortalEntry (SOIP_Portal_Key *portal_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg) { *************** *** 1114,1118 **** PORTAL_LIST_ENTRY portalListEntry; char *p_iscsi_name; - ISNS_DBKey read_key; __DEBUG (isns_dereg_debug & 1, (Deregistering Portal)); --- 1066,1069 ---- *************** *** 1121,1132 **** p_scn_all_msg_buffer->hdr.type = ISNS_SCN; ! read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), portal_key, sizeof(SOIP_Portal_Key)); ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return rval; ! ! p_portal = &entry2.data.portal; ! /* Validate the src attr has permission to delete the node --- 1072,1081 ---- p_scn_all_msg_buffer->hdr.type = ISNS_SCN; ! rval = read_PortalObject(portal_key, &p_portal, &entry2); if (rval != SUCCESS) + { + __DEBUG(isns_dereg_debug &1, Portal not found:%i,rval); return rval; ! } /* Validate the src attr has permission to delete the node *************** *** 1140,1154 **** RemoveCert (&p_portal->ptr_cert); ! if (ISNSdbDelete(&read_key) != SUCCESS) ! { ! __LOG_ERROR ("ERROR: Portal DEREG Failed."); ! return (ERROR); ! } ! ! ISNS_DBKey remove_key; ! remove_key.tag = PORTAL_IDX_KEY; ! remove_key.val.idx.index = p_portal->portal_index; ! remove_key.val.idx.index_type = PORTAL_IDX_KEY; ! ISNSdbDelete(&remove_key); iSNS_stats.num_portals--; --- 1089,1093 ---- RemoveCert (&p_portal->ptr_cert); ! delete_PortalidxObject(p_portal->portal_index); iSNS_stats.num_portals--; *************** *** 1169,1173 **** } ! rval = ISNSdbWrite(&read_key,entry4); /* Send detailed SCN */ --- 1108,1112 ---- } ! rval = write_EntityObject(p_portal->entity_id.id, entry4); /* Send detailed SCN */ *************** *** 1179,1182 **** --- 1118,1125 ---- } + rval = delete_PortalObject(portal_key); + if ( rval != SUCCESS) + __LOG_ERROR ("ERROR: Portal DEREG Failed."); + return (rval); } *************** *** 1222,1225 **** --- 1165,1171 ---- ISNS_LIST_NODE *pnode; int memberRemovedFlag; + SOIP_Dds *p_dds; + SOIP_DD_Key dds_key; + ISNS_LIST_NODE *pnode2; dd_key.id = id; *************** *** 1274,1281 **** while ( (pnode = GetNextNode( &p_dd->dds_list, pnode )) ) { - SOIP_Dds *p_dds; - SOIP_DD_Key dds_key; - ISNS_LIST_NODE *pnode2; - dds_key.id = *(uint32_t *) GetNodeData(pnode); rval = read_DDSObject(dds_key.id, &p_dds, &entry2); --- 1220,1223 ---- *************** *** 1479,1493 **** SOIP_DB_Entry lentry; ISNS_LIST_NODE *p_lnode; - ISNS_DBKey key; int rval; ! key.tag = PORT_NAME_KEY; ! strcpy(key.val.port_name.v,p_node_name); ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Ifcp *)&lentry.data; - if ((p_lnode=FindNode(&p_node->dd_id_list, (char *)&id, sizeof(id)))) { --- 1421,1430 ---- SOIP_DB_Entry lentry; ISNS_LIST_NODE *p_lnode; int rval; ! rval = read_FCPortObject(p_node_name, &p_node, &lentry); if (rval != SUCCESS) return rval; if ((p_lnode=FindNode(&p_node->dd_id_list, (char *)&id, sizeof(id)))) { *************** *** 1495,1499 **** } ! ISNSdbWrite(&key,lentry); return (ISNS_NO_ERR); } --- 1432,1436 ---- } ! write_FCPortObject(p_node_name, lentry); return (ISNS_NO_ERR); } *************** *** 1615,1635 **** key = (ISNS_Key *)(key_indx[ifcpKeyIndex]); ! ISNS_DBKey read_key; ! read_key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &key->val, PORT_NAME_SIZE); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_ifcp_node = &entry.data.port; - p_ifcp_node->scn_bitmap=0; p_ifcp_node->scn_sockfd = 0; /* Store the node */ ! ISNS_DBKey update_key; ! update_key.tag = PORT_NAME_KEY; ! strcpy(update_key.val.port_name.v,(char *)&key->val); ! ISNSdbWrite(&update_key,entry); return (ISNS_NO_ERR); --- 1552,1564 ---- key = (ISNS_Key *)(key_indx[ifcpKeyIndex]); ! rval = read_FCPortObject((char *)&key->val, &p_ifcp_node, &entry); if (rval != SUCCESS) return rval; p_ifcp_node->scn_bitmap=0; p_ifcp_node->scn_sockfd = 0; /* Store the node */ ! rval = write_FCPortObject((char *)&key->val, entry); return (ISNS_NO_ERR); Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** iSNSreg.c 24 Aug 2007 22:51:34 -0000 1.30 --- iSNSreg.c 27 Aug 2007 21:25:17 -0000 1.31 *************** *** 258,262 **** PORTAL_LIST_ENTRY newPortalEntry; char *p_iscsi_name; - ISNS_DBKey read_key; __DEBUG (isns_reg_debug & 1, (Registering Portal)); --- 258,261 ---- *************** *** 378,391 **** __DEBUG (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); ! read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal,sizeof(SOIP_Portal_Key)); ! rval = ISNSdbRead(&read_key,&entry2); ! ! p_portal = &entry2.data.portal; ! if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { __DEBUG (isns_reg_debug & 1,Deregistering Portal); ! SNSRemovePortalEntry ((char *)&db_portal, NULL, NULL); rval = ERROR; } --- 377,385 ---- __DEBUG (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); ! rval = read_PortalObject(&db_portal, &p_portal, &entry2); if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { __DEBUG (isns_reg_debug & 1,Deregistering Portal); ! SNSRemovePortalEntry (&db_portal, NULL, NULL); rval = ERROR; } *************** *** 403,407 **** /* create a new node element */ memset (&entry2, 0, sizeof (SOIP_DB_Entry)); - entry2.data_type = PORTAL_ID_KEY; attr = (ISNS_Attr *) attr_indx[portalIpIndex]; --- 397,400 ---- *************** *** 413,426 **** p_portal->portal_index = ISNSGetNewPortalIdx(); - ISNS_DBKey idx_key; - idx_key.tag = PORTAL_IDX_KEY; - idx_key.val.idx.index_type = PORTAL_IDX_KEY; - idx_key.val.idx.index = p_portal->portal_index; SOIP_DB_Portal *p_idx; memset (&entry3, 0, sizeof(SOIP_DB_Entry)); - entry3.data_type = PORTAL_IDX_KEY; p_idx = &entry3.data.portal_idx; __ISNS_COPY (p_idx, sizeof(entry3.data.portal_idx), &db_portal,sizeof(SOIP_DB_Portal)); ! rval = ISNSdbWrite(&idx_key,entry3); /* Update Entity's portal Bitmap */ --- 406,414 ---- p_portal->portal_index = ISNSGetNewPortalIdx(); SOIP_DB_Portal *p_idx; memset (&entry3, 0, sizeof(SOIP_DB_Entry)); p_idx = &entry3.data.portal_idx; __ISNS_COPY (p_idx, sizeof(entry3.data.portal_idx), &db_portal,sizeof(SOIP_DB_Portal)); ! rval = write_PortalidxObject(p_portal->portal_index, entry3); /* Update Entity's portal Bitmap */ *************** *** 483,488 **** /* Store Entity Entry */ __DEBUG (isns_reg_debug &1,Store Entity); ! rval = ISNSdbWrite(&read_key,entry); ! //ISNSDisplay_Entity (&entry.data.entity,HI_DETAIL); } while ( eidKeyIndex!=-1 ); --- 471,475 ---- /* Store Entity Entry */ __DEBUG (isns_reg_debug &1,Store Entity); ! rval = write_EntityObject(db_entity_id.id, entry); } while ( eidKeyIndex!=-1 ); *************** *** 498,502 **** { attr = (ISNS_Attr *)(key_indx[ eidKeyIndex ]); ! if ( read_EntityObject ((char *)&attr->val, &p_entity, &entry) ) { return (ISNS_INVALID_REG_ERR); --- 485,490 ---- { attr = (ISNS_Attr *)(key_indx[ eidKeyIndex ]); ! strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); ! if ( read_EntityObject (db_entity_id.id, &p_entity, &entry) ) { return (ISNS_INVALID_REG_ERR); *************** *** 525,530 **** /* Store Entity Entry */ ! //strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); ! rval = ISNSdbWrite(&read_key,entry); } --- 513,517 ---- /* Store Entity Entry */ ! rval = write_EntityObject(db_entity_id.id,entry); } *************** *** 630,637 **** /* Store the portal */ __DEBUG (isns_reg_debug &1,Store Portal:%s,db_portal.ip_addr.v); ! ISNS_DBKey update_key; ! update_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&update_key.val, sizeof(update_key.val), &db_portal, sizeof(SOIP_Portal_Key)); ! rval = ISNSdbWrite(&update_key,entry2); /* insert the key(s) */ --- 617,621 ---- /* Store the portal */ __DEBUG (isns_reg_debug &1,Store Portal:%s,db_portal.ip_addr.v); ! rval = write_PortalObject(&db_portal, entry2); /* insert the key(s) */ *************** *** 690,694 **** int portal_tag = 1; int newPortalGroupRegFlag; - ISNS_DBKey read_key; __DEBUG (isns_reg_debug & 1, (Registering Portal Group)); --- 674,677 ---- *************** *** 860,874 **** __DEBUG (isns_reg_debug &1,(read portal:%s),db_portal_group.id.v); ! read_key.tag = PORTAL_GROUP_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), &db_portal_group, sizeof(SOIP_Portal_Group_Key)); ! rval = ISNSdbRead(&read_key,&entry2); ! __DEBUG (isns_reg_debug & 1, Read PortalGroup for DB status:%i,rval); ! ! p_portal_group = &entry2.data.portal_group; ! if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { __DEBUG (isns_reg_debug & 1,Deregistering PortalGroup); ! rval = ISNSdbDelete(&read_key); rval = ERROR; } --- 843,851 ---- __DEBUG (isns_reg_debug &1,(read portal:%s),db_portal_group.id.v); ! rval = read_PortalGroupObject(&db_portal_group, &p_portal_group, &entry2); if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { __DEBUG (isns_reg_debug & 1,Deregistering PortalGroup); ! rval = delete_PortalGroupObject(&db_portal_group); rval = ERROR; } *************** *** 880,885 **** memset (&entry2, 0, sizeof (SOIP_DB_Entry)); - entry2.data_type = PORTAL_GROUP_ID_KEY; - attr = (ISNS_Attr *) attr_indx[portalIpIndex]; __ISNS_COPY (p_portal_group->ip_addr.v, sizeof(p_portal_group->ip_addr.v), attr->val.ip_addr.v, attr->len); --- 857,860 ---- *************** *** 897,908 **** __DEBUG (isns_reg_debug &1,Store Portal Group:%s,db_portal_group.id.v); ! ISNS_DBKey update_key; ! update_key.tag = PORTAL_GROUP_ID_KEY; ! __ISNS_COPY (&update_key.val, sizeof(update_key.val), &db_portal_group, sizeof(SOIP_Portal_Group_Key)); ! rval = ISNSdbWrite(&update_key,entry2); ! __DEBUG (isns_reg_debug & 1, Write PortalGroup for DB status:%i,rval); ! ! rval = ISNSdbRead(&read_key,&entry2); ! __DEBUG (isns_reg_debug & 1, Read PortalGroup for DB status:%i,rval); if ( newPortalGroupRegFlag ) --- 872,876 ---- __DEBUG (isns_reg_debug &1,Store Portal Group:%s,db_portal_group.id.v); ! rval = write_PortalGroupObject(&db_portal_group, entry2); if ( newPortalGroupRegFlag ) *************** *** 915,920 **** ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_PORT_SIZE, 0, p_portal_group->ip_port); - ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_ISCSI_NAME, ISNS_PORTAL_PORT_SIZE, 0, - p_portal_group->ip_port); ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, 0, p_portal_group->portal_tag); --- 883,886 ---- *************** *** 1074,1078 **** /* Create a new DDS element */ memset (&entry, 0, sizeof (SOIP_DB_Entry)); - entry.data_type = DDS_ID_KEY; p_dds->id = *(uint32_t *) & key->val; --- 1040,1043 ---- *************** *** 1500,1504 **** SOIP_Dd_Member new_member; SOIP_Iscsi *p_node; - ISNS_DBKey key; int rval; SOIP_DB_Entry lentry; --- 1465,1468 ---- *************** *** 1525,1543 **** (0 == memcmp (p_member->node_id, p_node_name, strlen(p_node_name) ))) { - /* found a match */ - /* update record */ - key.tag = LIST_KEY; - key.val.list.list_id = DD_MEMBER_LIST; - key.val.list.list_index = pnode->index; - key.val.list.key.dd.id = p_dd->id; - rval = ISNSdbRead(&key,&lentry); - if (rval != SUCCESS) - return rval; - - p_member = &lentry.data.list.key.ddmember; - p_member->node_idx = index_number; - - rval = ISNSdbWrite(&key,lentry); - return (ISNS_NO_ERR); } --- 1489,1492 ---- *************** *** 1657,1674 **** /* create a new entity element */ memset ( &entry, 0, sizeof (SOIP_DB_Entry) ); - entry.data_type = ENTITY_ID_KEY; p_entity->entity_index = ISNSGetNewEntityIdx(); - - ISNS_DBKey idx_key; - idx_key.tag = ENTITY_IDX_KEY; - idx_key.val.idx.index_type = ENTITY_IDX_KEY; - idx_key.val.idx.index = p_entity->entity_index; SOIP_Entity_Id *p_idx; memset (&entry3, 0, sizeof(SOIP_Entity_Id)); - entry3.data_type = ENTITY_IDX_KEY; p_idx = &entry3.data.entity_idx; __ISNS_COPY (p_idx, sizeof(entry3.data.entity_idx), &db_entity_id.id, sizeof(SOIP_Entity_Id)); ! rval = ISNSdbWrite(&idx_key,entry3); strncpy (p_entity->eid.id, db_entity_id.id, sizeof(p_entity->eid.id) ); --- 1606,1616 ---- /* create a new entity element */ memset ( &entry, 0, sizeof (SOIP_DB_Entry) ); p_entity->entity_index = ISNSGetNewEntityIdx(); SOIP_Entity_Id *p_idx; memset (&entry3, 0, sizeof(SOIP_Entity_Id)); p_idx = &entry3.data.entity_idx; __ISNS_COPY (p_idx, sizeof(entry3.data.entity_idx), &db_entity_id.id, sizeof(SOIP_Entity_Id)); ! rval = write_EntityidxObject(p_entity->entity_index, entry3); strncpy (p_entity->eid.id, db_entity_id.id, sizeof(p_entity->eid.id) ); *************** *** 1788,1792 **** int newRegFlag; int newKeyFlag; - ISNS_DBKey read_key; __DEBUG (isns_reg_debug & 1, (Registering FC Node)); --- 1730,1733 ---- *************** *** 1841,1850 **** db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! read_key.tag = NODE_NAME_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry); ! ! p_node = (SOIP_Fc_Node *)&entry.data.node; ! if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { --- 1782,1786 ---- db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! rval = read_FCNodeObject(db_node_name.v, &p_node, &entry); if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { *************** *** 1858,1862 **** /* create a new node element */ memset (&entry, 0, sizeof (SOIP_DB_Entry)); - entry.data_type = NODE_NAME_KEY; memset (&entry.data.node.node_ipa, SNS_UNREGISTERED, NODE_IPA_SIZE); __ISNS_COPY (entry.data.node.node_name.v, sizeof(entry.data.node.node_name.v), --- 1794,1797 ---- *************** *** 1867,1878 **** } - /* verify data_type matches key tag */ - if (entry.data_type != NODE_NAME_KEY) - { - __DEBUG (isns_reg_debug & 1, (database key does not match %u %u), - entry.data_type, NODE_NAME_KEY); - return ERROR; - } - /* Store the Node Name */ __ISNS_COPY (p_node->node_name.v, sizeof(p_node->node_name.v), entry.data.node.node_name.v, ISNS_NODE_NAME_SIZE); --- 1802,1805 ---- *************** *** 1910,1917 **** } ! ISNS_DBKey key; ! key.tag = NODE_NAME_KEY; ! strcpy(key.val.node_key.v,db_node_name.v); ! rval = ISNSdbWrite(&key,entry); /* Compose a response */ --- 1837,1841 ---- } ! rval = write_FCNodeObject(db_node_name.v, entry); /* Compose a response */ *************** *** 1962,1966 **** int ii, rval; //char *p_wwpn; - ISNS_DBKey read_key; __DEBUG (isns_reg_debug & 1, (Registering iFCP WWPN)); --- 1886,1889 ---- *************** *** 2008,2016 **** } ! read_key.tag = PORT_NAME_KEY; ! strcpy(read_key.val.port_name.v,(char *)&key->val); ! rval = ISNSdbRead(&read_key,&entry); ! p_ifcp_node = (SOIP_Ifcp *)&entry.data; ! if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { --- 1931,1935 ---- } ! rval = read_FCPortObject((char *)&key->val, &p_ifcp_node, &entry); if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { *************** *** 2072,2076 **** /* create a new port element */ memset (&entry, 0, sizeof (SOIP_DB_Entry)); - entry.data_type = PORT_NAME_KEY; __ISNS_COPY (p_ifcp_node->entity_id.id, sizeof(p_ifcp_node->entity_id.id), entity_id, entity_len); InitList(FCP_DD_LIST, &p_ifcp_node->dd_id_list); --- 1991,1994 ---- *************** *** 2085,2096 **** } - /* verify data_type matches key tag */ - if (entry.data_type != PORT_NAME_KEY) - { - __DEBUG (isns_reg_debug & 1, (database key does not match %u %u), - entry.data_type, PORT_NAME_KEY); - return ERROR; - } - stopFlag = FALSE; for (ii = saveIndex; --- 2003,2006 ---- *************** *** 2180,2187 **** /* Store Port Name */ ! ISNS_DBKey key; ! key.tag = PORT_NAME_KEY; ! __ISNS_COPY (&key.val, sizeof(key.val), buffer, PORT_NAME_SIZE); ! rval = ISNSdbWrite(&key,entry); /* response */ --- 2090,2094 ---- /* Store Port Name */ ! rval = write_FCPortObject(p_ifcp_node->port_name.v,entry); /* response */ *************** *** 2198,2211 **** db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! read_key.tag = NODE_NAME_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry2); ! if ( rval != SUCCESS) { /* We will create the node */ memset (&entry2, 0, sizeof (entry2)); - - entry2.data_type = NODE_NAME_KEY; memset (&entry2.data.node.node_ipa, SNS_UNREGISTERED, NODE_IPA_SIZE); --- 2105,2113 ---- db_node_name.v[8] = (char)SOIP_DB_Node_Id; ! rval = read_FCNodeObject(db_node_name.v, &p_fc_node, &entry2); if ( rval != SUCCESS) { /* We will create the node */ memset (&entry2, 0, sizeof (entry2)); memset (&entry2.data.node.node_ipa, SNS_UNREGISTERED, NODE_IPA_SIZE); *************** *** 2215,2220 **** } - p_fc_node = (SOIP_Fc_Node *)&entry2.data; - /* insert port name into free slot in node's port list */ free_slot = -1; --- 2117,2120 ---- *************** *** 2226,2233 **** } ! ISNS_DBKey key; ! key.tag = NODE_NAME_KEY; ! strcpy(key.val.node_key.v,db_node_name.v); ! rval = ISNSdbWrite(&key,entry2); } --- 2126,2130 ---- } ! rval = write_FCNodeObject(db_node_name.v, entry2); } *************** *** 2375,2379 **** /* Create a new node entry */ memset ( &entry, 0, sizeof (SOIP_DB_Entry) ); - entry.data_type = ISCSI_ID_KEY; strncpy ( p_node->id.v, db_node_name.v, sizeof(p_node->id.v) ); p_node->iscsi_id_len = PAD4(strlen(p_node->id.v)); --- 2272,2275 ---- *************** *** 2381,2394 **** p_node->iscsi_index = ISNSGetNewISCSIIdx(); - ISNS_DBKey idx_key; - idx_key.tag = ISCSI_IDX_KEY; - idx_key.val.idx.index_type = ISCSI_IDX_KEY; - idx_key.val.idx.index = p_node->iscsi_index; SOIP_ISCSI_Node_Id *p_idx; memset (&entry3, 0, sizeof(SOIP_ISCSI_Node_Id)); ! entry3.data_type = ISCSI_IDX_KEY; p_idx = &entry3.data.iscsi_idx; __ISNS_COPY (p_idx, sizeof(entry3.data.iscsi_idx), &p_node->id.v, sizeof(SOIP_ISCSI_Node_Id)); ! rval = ISNSdbWrite(&idx_key,entry3); strncpy ( p_node->entity_id.id, db_entity.id, sizeof(p_node->entity_id.id) ); --- 2277,2287 ---- p_node->iscsi_index = ISNSGetNewISCSIIdx(); SOIP_ISCSI_Node_Id *p_idx; memset (&entry3, 0, sizeof(SOIP_ISCSI_Node_Id)); ! p_idx = &entry3.data.iscsi_idx; __ISNS_COPY (p_idx, sizeof(entry3.data.iscsi_idx), &p_node->id.v, sizeof(SOIP_ISCSI_Node_Id)); ! ! rval = write_ISCSIidxObject(p_node->iscsi_index, entry3); strncpy ( p_node->entity_id.id, db_entity.id, sizeof(p_node->entity_id.id) ); *************** *** 2552,2555 **** --- 2445,2449 ---- ISNS_Attr *attr_indx[SNS_MAX_ATTRS]; ISNS_Attr *key_indx[SNS_MAX_ATTRS]; + SOIP_Portal_Key *db_portal; __DEBUG (isns_reg_debug &1,(RegisterSCN)); *************** *** 2625,2637 **** while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) != NULL) { ! ISNS_DBKey read_key; ! read_key.tag = PORTAL_ID_KEY; ! __ISNS_COPY (&read_key.val, sizeof(read_key.val), GetNodeData(pnode), sizeof(SOIP_Portal_Key)); ! rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) return rval; - p_portal = (SOIP_Portal *)&entry3.data; - /* Get first ESI/SCN Portal */ if (p_portal->esi_port != 0) --- 2519,2527 ---- while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) != NULL) { ! db_portal = GetNodeData(pnode); ! rval = read_PortalObject(db_portal, &p_portal, &entry3); if (rval != SUCCESS) return rval; /* Get first ESI/SCN Portal */ if (p_portal->esi_port != 0) *************** *** 2659,2679 **** key = (ISNS_Key *)(key_indx[ ifcpKeyIndex ]); ! ISNS_DBKey read_key; ! read_key.tag = PORT_NAME_KEY; ! strcpy(read_key.val.port_name.v,(char *)&key->val); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_ifcp_node = &entry.data.port; - - /* verify data_type matches key tag */ - if (entry.data_type != PORT_NAME_KEY) - { - __DEBUG (isns_reg_debug & 1, (database key does not match %u %u), - entry.data_type, PORT_NAME_KEY); - return ( ISNS_SCN_REG_REJECTED_ERR ); - } - scn_bitmap_index = ISNSFindTag (0, ISNS_IFCP_SCN_BITMAP, attr_indx); if (scn_bitmap_index == -1) --- 2549,2556 ---- key = (ISNS_Key *)(key_indx[ ifcpKeyIndex ]); ! rval = read_FCPortObject((char *)&key->val, &p_ifcp_node, &entry); if (rval != SUCCESS) return rval; scn_bitmap_index = ISNSFindTag (0, ISNS_IFCP_SCN_BITMAP, attr_indx); if (scn_bitmap_index == -1) *************** *** 2695,2702 **** /* Store the node */ ! ISNS_DBKey update_key; ! update_key.tag = PORT_NAME_KEY; ! strcpy(update_key.val.port_name.v,(char *)&key->val); ! ISNSdbWrite(&update_key,entry); return ( ISNS_NO_ERR ); --- 2572,2576 ---- /* Store the node */ ! write_FCPortObject((char *)&key->val, entry); return ( ISNS_NO_ERR ); *************** *** 2757,2771 **** SOIP_Ifcp *p_node; SOIP_DB_Entry lentry; - ISNS_DBKey key; int rval; ! key.tag = PORT_NAME_KEY; ! strcpy(key.val.port_name.v,p_node_name); ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Ifcp *)&lentry.data; - if (!FindNode(&p_node->dd_id_list, (char *) &id, sizeof(id))) { --- 2631,2640 ---- SOIP_Ifcp *p_node; SOIP_DB_Entry lentry; int rval; ! rval = read_FCPortObject(p_node_name, &p_node, &lentry); if (rval != SUCCESS) return rval; if (!FindNode(&p_node->dd_id_list, (char *) &id, sizeof(id))) { *************** *** 2773,2777 **** } ! ISNSdbWrite(&key,lentry); return (ISNS_NO_ERR); --- 2642,2646 ---- } ! rval = write_FCPortObject(p_node_name, lentry); return (ISNS_NO_ERR); *************** *** 2789,2793 **** SOIP_DB_Entry lentry; SOIP_Dd *p_dd; - ISNS_DBKey key; int rval; --- 2658,2661 ---- *************** *** 2813,2818 **** } ! /* Store Entry */ ! ISNSdbWrite (&key,lentry); return ( ISNS_NO_ERR ); --- 2681,2685 ---- } ! write_DDObject(dd_id, lentry); return ( ISNS_NO_ERR ); *************** *** 2893,2897 **** /* retrieve all DD */ - key.tag = DD_ID_KEY; --- 2760,2763 ---- *************** *** 2901,2909 **** continue; ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_dd2 = (SOIP_Dd *)&lentry.data; if (0 == strcmp (p_dd2->sym_name, p_sym_name)) { --- 2767,2774 ---- continue; ! rval = read_DDObject(key.val.dd_key.id, &p_dd2, &lentry); if (rval != SUCCESS) return rval; if (0 == strcmp (p_dd2->sym_name, p_sym_name)) { *************** *** 3069,3078 **** while ( SNSdbGetNextOfKey ( &key ) == SUCCESS ) { ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&lentry.data; - /* Find iSCSI Node */ pnode = NULL; --- 2934,2941 ---- while ( SNSdbGetNextOfKey ( &key ) == SUCCESS ) { ! rval = read_DDObject(key.val.dd_key.id, &p_dd, &lentry); if (rval != SUCCESS) return rval; /* Find iSCSI Node */ pnode = NULL; *************** *** 3317,3326 **** search for any entries that has that dd, return that DD */ ! rval = ISNSdbRead(&qkey,&lentry); if (rval != SUCCESS) return 0; - p_dd = (SOIP_Dd *)&lentry.data; - if (0 == strcmp(p_dd->sym_name, p_sym)) return ( p_dd->id ); --- 3180,3187 ---- search for any entries that has that dd, return that DD */ ! rval = read_DDObject(qkey.val.dd_key.id, &p_dd, &lentry); if (rval != SUCCESS) return 0; if (0 == strcmp(p_dd->sym_name, p_sym)) return ( p_dd->id ); *************** *** 3373,3381 **** while (SNSdbGetNextOfKey (&qkey) == SUCCESS) { ! rval = ISNSdbRead(&qkey,&lentry); if ( rval != SUCCESS) return (0); - p_dds = (SOIP_Dds *) &lentry.data; if (0 == strcmp (p_dds->sym_name, p_sym)) return (p_dds->id); --- 3234,3241 ---- while (SNSdbGetNextOfKey (&qkey) == SUCCESS) { ! rval = read_DDSObject(qkey.val.dds_key.id, &p_dds, &lentry); if ( rval != SUCCESS) return (0); if (0 == strcmp (p_dds->sym_name, p_sym)) return (p_dds->id); *************** *** 3544,3551 **** while ( SNSdbGetNextOfKey ( &dds_key ) == SUCCESS ) { ! rval = ISNSdbRead(&dds_key,&lentry1); if (rval != SUCCESS) return rval; - p_dds = (SOIP_Dds *)&lentry1.data; if ( !strcmp("default DDS",p_dds->sym_name) ) { --- 3404,3410 ---- while ( SNSdbGetNextOfKey ( &dds_key ) == SUCCESS ) { ! rval = read_DDSObject(dds_key.val.dds_key.id, &p_dds, &lentry1); if (rval != SUCCESS) return rval; if ( !strcmp("default DDS",p_dds->sym_name) ) { *************** *** 3558,3562 **** __DEBUG (isns_reg_debug &1, Create Default DDS); dds_key.val.dds_key.id = ISNS_GetNewDDS_ID (); - lentry1.data_type = DDS_ID_KEY; p_dds = (SOIP_Dds *)&lentry1.data; p_dds->id = dds_key.val.dds_key.id; --- 3417,3420 ---- *************** *** 3564,3568 **** InitList(DDS_DD_LIST, p_dds); p_dds->status = 1; ! rval = ISNSdbWrite(&dds_key,lentry1); __DEBUG (isns_reg_debug &1,Create Default DDS rval:%i,rval); } --- 3422,3426 ---- InitList(DDS_DD_LIST, p_dds); p_dds->status = 1; ! rval = write_DDSObject(dds_key.val.dds_key.id, lentry1); __DEBUG (isns_reg_debug &1,Create Default DDS rval:%i,rval); } *************** *** 3573,3580 **** while ( SNSdbGetNextOfKey ( &dd_key ) == SUCCESS ) { ! rval = ISNSdbRead(&dd_key,&lentry2); if (rval != SUCCESS) retu... [truncated message content] |
From: Robert W. <wrw...@us...> - 2007-08-27 21:25:26
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19062/include Modified Files: iSNSList.h iSNSobjects.h iSNSreg.h iSNStypes.h Log Message: abstract database read/write calls Index: iSNSobjects.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSobjects.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSobjects.h 24 Aug 2007 22:51:34 -0000 1.1 --- iSNSobjects.h 27 Aug 2007 21:25:16 -0000 1.2 *************** *** 41,45 **** int ! read_ISCSIObject (char *p_id, SOIP_Iscsi ** p_entity, SOIP_DB_Entry *p_entry); int --- 41,51 ---- int ! read_FCNodeObject (char *p_id, SOIP_Fc_Node ** p_node, SOIP_DB_Entry *p_entry); ! ! int ! read_FCPortObject (char *p_id, SOIP_Ifcp ** p_port, SOIP_DB_Entry *p_entry); ! ! int ! read_ISCSIObject (char *p_id, SOIP_Iscsi ** p_node, SOIP_DB_Entry *p_entry); int *************** *** 47,50 **** --- 53,62 ---- int + read_PortalObject (SOIP_Portal_Key *p_portal_key, SOIP_Portal ** p_portal, SOIP_DB_Entry *p_entry); + + int + read_PortalGroupObject (SOIP_Portal_Group_Key *p_portal_key, SOIP_Portal_Group ** p_portal, SOIP_DB_Entry *p_entry); + + int read_DDObject (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); *************** *** 52,56 **** --- 64,83 ---- read_DDSObject (int id, SOIP_Dds ** p_dds, SOIP_DB_Entry * p_entry); + int + read_EntityidxObject (int id, void **p_idx, SOIP_DB_Entry *p_entry); + + int + read_ISCSIidxObject (int id, void **p_idx, SOIP_DB_Entry *p_entry); + + int + read_PortalidxObject (int id, void **p_idx, SOIP_DB_Entry *p_entry); + + + int + write_FCNodeObject (char *p_id, SOIP_DB_Entry p_entry); + + int + write_FCPortObject (char *p_id, SOIP_DB_Entry p_entry); int *************** *** 61,64 **** --- 88,97 ---- int + write_PortalObject (SOIP_Portal_Key *p_portal_key, SOIP_DB_Entry p_entry); + + int + write_PortalGroupObject (SOIP_Portal_Group_Key *p_portal_key, SOIP_DB_Entry p_entry); + + int write_DDObject (int id, SOIP_DB_Entry p_entry); *************** *** 66,71 **** --- 99,117 ---- write_DDSObject (int id, SOIP_DB_Entry p_entry); + int + write_ISCSIidxObject( int id, SOIP_DB_Entry p_entry); + + int + write_EntityidxObject( int id, SOIP_DB_Entry p_entry); + + int + write_PortalidxObject( int id, SOIP_DB_Entry p_entry); + + int + delete_FCNodeObject (char * p_id); + int + delete_FCPortObject (char * p_id); int *************** *** 76,79 **** --- 122,131 ---- int + delete_PortalObject (SOIP_Portal_Key * p_portal_key); + + int + delete_PortalGroupObject (SOIP_Portal_Group_Key * p_portal_key); + + int delete_DDObject (int id); *************** *** 81,84 **** --- 133,145 ---- delete_DDSObject (int id); + int + delete_EntityidxObject (int id); + + int + delete_ISCSIidxObject (int id); + + int + delete_PortalidxObject (int id); + #endif Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** iSNStypes.h 23 Aug 2007 22:31:06 -0000 1.17 --- iSNStypes.h 27 Aug 2007 21:25:16 -0000 1.18 *************** *** 624,630 **** } SOIP_Iscsi; ! typedef struct _soip_iscsi_node_name_key { char v[MAX_ISCSI_NODE_ID_SIZE]; ! } SOIP_ISCSI_Node_Id_Key; /* ids for identifying which list */ --- 624,630 ---- } SOIP_Iscsi; ! typedef struct _soip_iscsi_key { char v[MAX_ISCSI_NODE_ID_SIZE]; ! } SOIP_ISCSI_Key; /* ids for identifying which list */ *************** *** 708,714 **** union { SOIP_Entity_Key entity_key; SOIP_Node_Key node_key; ! SOIP_Port_Key port_name; SOIP_DD_Key dd_key; SOIP_DD_Key dds_key; --- 708,715 ---- union { + SOIP_ISCSI_Key iscsi_key; SOIP_Entity_Key entity_key; SOIP_Node_Key node_key; ! SOIP_Port_Key port_key; SOIP_DD_Key dd_key; SOIP_DD_Key dds_key; Index: iSNSreg.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSreg.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSreg.h 4 Jan 2007 19:00:06 -0000 1.7 --- iSNSreg.h 27 Aug 2007 21:25:16 -0000 1.8 *************** *** 88,92 **** int ! SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); --- 88,92 ---- int ! SNSRemovePortalEntry (SOIP_Portal_Key *portal_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); Index: iSNSList.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSList.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSList.h 22 Nov 2006 17:45:39 -0000 1.3 --- iSNSList.h 27 Aug 2007 21:25:16 -0000 1.4 *************** *** 74,78 **** FindNode(ISNS_LIST *plist, char *pdata, int data_size); ! char * GetNodeData(ISNS_LIST_NODE *pnode); --- 74,78 ---- FindNode(ISNS_LIST *plist, char *pdata, int data_size); ! void * GetNodeData(ISNS_LIST_NODE *pnode); |
From: Robert W. <wrw...@us...> - 2007-08-24 23:27:19
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv13158/isnsclient Modified Files: Makefile Log Message: update isns protocol message tags to match rfc spec Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 15 Mar 2007 22:28:30 -0000 1.7 --- Makefile 24 Aug 2007 23:27:09 -0000 1.8 *************** *** 30,33 **** --- 30,34 ---- SRCDIR = ./src/ INCDIR = ./include/ + INCDIR += -I../isnsserver/include/ INCDIR += -I/usr/include/ |
From: Robert W. <wrw...@us...> - 2007-08-24 23:27:19
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv13158/isnsserver/include Modified Files: iSNSdefs.h Log Message: update isns protocol message tags to match rfc spec Index: iSNSdefs.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdefs.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSdefs.h 13 Aug 2007 22:56:44 -0000 1.10 --- iSNSdefs.h 24 Aug 2007 23:27:09 -0000 1.11 *************** *** 181,184 **** --- 181,185 ---- ISNS_START_VALID_TAG=1, + /* ENTITY tags */ ISNS_ENTITY_ID=ISNS_START_VALID_TAG, /* 1 */ ISNS_ENTITY_TYPE, *************** *** 186,190 **** ISNS_TIMESTAMP, ISNS_PROT_VER, ! ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ISNS_ENTITY_IDX, ISNS_ENTITY_NEXT_IDX, --- 187,191 ---- ISNS_TIMESTAMP, ISNS_PROT_VER, ! ISNS_ENTITY_PERIOD, /* REGISTRATION PERIOD */ ISNS_ENTITY_IDX, ISNS_ENTITY_NEXT_IDX, *************** *** 192,195 **** --- 193,197 ---- ISNS_ENTITY_CERT, + /* PORT tags */ ISNS_PORTAL_IP=16, /* 16 */ ISNS_PORTAL_PORT, *************** *** 197,206 **** ISNS_ESI_INTERVAL, ISNS_ESI_PORT, ! ISNS_PORTAL_GROUP, /* tag was removed from RFC spec */ ISNS_PORTAL_IDX=22, ! ISNS_SCN_PORT=23, ISNS_PORTAL_SECURITY_BITMAP=27, ISNS_PORTAL_CERT=31, ISNS_ISCSI_NODE_ID=32, /* 32 */ ISNS_ISCSI_TYPE, --- 199,210 ---- ISNS_ESI_INTERVAL, ISNS_ESI_PORT, ! ISNS_PORTAL_GROUP, /* tag was removed from RFC spec */ ISNS_PORTAL_IDX=22, ! ISNS_SCN_PORT, ! ISNS_PORTAL_NEXT_IDX, ISNS_PORTAL_SECURITY_BITMAP=27, ISNS_PORTAL_CERT=31, + /* ISCSI node tags */ ISNS_ISCSI_NODE_ID=32, /* 32 */ ISNS_ISCSI_TYPE, *************** *** 208,218 **** ISNS_ISCSI_SCN_BITMAP, ISNS_ISCSI_IDX, ISNS_ISCSI_CERT=40, ISNS_PORTAL_GROUP_ISCSI_NAME=48, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_PORT, ! ISNS_PORTAL_GROUP_TAG=51, ISNS_PORT_NAME=64, /* 64 */ ISNS_PORT_ID, --- 212,228 ---- ISNS_ISCSI_SCN_BITMAP, ISNS_ISCSI_IDX, + ISNS_WWNN_TOKEN, + ISNS_ISCSI_NEXT_IDX, ISNS_ISCSI_CERT=40, + /* PORTAL_GROUP tags */ ISNS_PORTAL_GROUP_ISCSI_NAME=48, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_PORT, ! ISNS_PORTAL_GROUP_TAG, ! ISNS_PORTAL_GROUP_IDX, ! ISNS_PORTAL_GROUP_NEXT_IDX, + /* FC */ ISNS_PORT_NAME=64, /* 64 */ ISNS_PORT_ID, *************** *** 229,234 **** ISNS_IFCP_NODE_CERT=80, iSNS_FC4_TYPE_QUERY_KEY=95, ! ! ISNS_NODE_NAME=96, ISNS_NODE_SYM_NAME, ISNS_FC_NODE_IP, --- 239,243 ---- ISNS_IFCP_NODE_CERT=80, iSNS_FC4_TYPE_QUERY_KEY=95, ! ISNS_NODE_NAME, ISNS_NODE_SYM_NAME, ISNS_FC_NODE_IP, *************** *** 236,249 **** ISNS_FC_NODE_CERT, - ISNS_DDS_ID=101, - ISNS_DDS_SYM_NAME, - ISNS_DDS_STATUS, - ISNS_DD_ID, - ISNS_DD_SYM_NAME, - ISNS_DD_ISCSI_MEMBER_IDX, - ISNS_DD_ISCSI_MEMBER, - ISNS_DD_IFCP_MEMBER, - ISNS_DD_FEATURE_BITMAP, - /* Server specific tags */ ISNS_VENDOR_ID = 131, --- 245,248 ---- *************** *** 261,265 **** ISNS_DD_ACTIVE, ISNS_NODE_ACTIVE, ! ISNS_END_VALID_TAG } ISNS_TAG; --- 260,281 ---- ISNS_DD_ACTIVE, ISNS_NODE_ACTIVE, ! ISNS_END_VALID_TAG, ! ! /* DDS tags */ ! ISNS_DDS_ID=2049, ! ISNS_DDS_SYM_NAME, ! ISNS_DDS_STATUS, ! ! /* DD tags */ ! ISNS_DD_ID=2065, ! ISNS_DD_SYM_NAME, ! ISNS_DD_ISCSI_MEMBER_IDX, ! ISNS_DD_ISCSI_MEMBER, ! ISNS_DD_IFCP_MEMBER, ! ISNS_DD_PORTAL_MEMBER_IDX, ! ISNS_DD_PORTAL_IP_ADDR, ! ISNS_DD_PORTAL_TCPUDP, ! ISNS_DD_FEATURE_BITMAP=2078, ! ISNS_DD_NEXT_ID } ISNS_TAG; |
From: Robert W. <wrw...@us...> - 2007-08-24 23:27:16
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv13158/isnsclient/include Removed Files: iSNSdefs.h Log Message: update isns protocol message tags to match rfc spec --- iSNSdefs.h DELETED --- |
From: Robert W. <wrw...@us...> - 2007-08-24 22:51:42
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31084/include Modified Files: iSNSdb.h Added Files: iSNSobjects.h Log Message: abstracting read/write objects to database --- NEW FILE: iSNSobjects.h --- /*********************************************************************** Copyright (c) 2007, Novell, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Novell, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Novell, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ /* * This file contains definitions related to read and writing of database objects * */ #ifndef _SNSobjects_h_ #define _SNSobjects_h_ int read_ISCSIObject (char *p_id, SOIP_Iscsi ** p_entity, SOIP_DB_Entry *p_entry); int read_EntityObject (char *p_entity_id, SOIP_Entity ** p_entity, SOIP_DB_Entry *p_entry); int read_DDObject (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); int read_DDSObject (int id, SOIP_Dds ** p_dds, SOIP_DB_Entry * p_entry); int write_ISCSIObject (char *p_id, SOIP_DB_Entry p_entry); int write_EntityObject (char *p_entity_id, SOIP_DB_Entry p_entry); int write_DDObject (int id, SOIP_DB_Entry p_entry); int write_DDSObject (int id, SOIP_DB_Entry p_entry); int delete_ISCSIObject (char * p_id); int delete_EntityObject (char * p_entity_id); int delete_DDObject (int id); int delete_DDSObject (int id); #endif Index: iSNSdb.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdb.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSdb.h 23 Aug 2007 02:50:20 -0000 1.10 --- iSNSdb.h 24 Aug 2007 22:51:34 -0000 1.11 *************** *** 78,88 **** int - SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, - SOIP_DB_Entry * p_entry); - - int - SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - - int ISNSdbRead (ISNS_DBKey *key, SOIP_DB_Entry *entry); --- 78,81 ---- |
From: Robert W. <wrw...@us...> - 2007-08-24 22:51:42
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31084 Modified Files: Makefile Log Message: abstracting read/write objects to database Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile 7 Aug 2007 14:41:47 -0000 1.10 --- Makefile 24 Aug 2007 22:51:34 -0000 1.11 *************** *** 64,67 **** --- 64,68 ---- OBJECTS += iSNSList.o OBJECTS += iSNSconfig.o + OBJECTS += iSNSobjects.o OPTFLAGS ?= -g -O2 *************** *** 148,151 **** --- 149,156 ---- $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + iSNSobjects.o : $(SRCDIR)iSNSobjects.c + + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + clean : rm $(OBJECTS) isnsd |
From: Robert W. <wrw...@us...> - 2007-08-24 22:51:38
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31084/src Modified Files: iSNSdb.c iSNSdereg.c iSNSquery.c iSNSreg.c iSNSscn.c Added Files: iSNSobjects.c Log Message: abstracting read/write objects to database --- NEW FILE: iSNSobjects.c --- /*********************************************************************** Copyright (c) 2007, Novell, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Novell, Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NOVELL, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ /* * This file contains source code for managing read and writing of iSNS objects * to the database * */ #include "iSNS.h" #include "iSNSdb.h" #include "iSNSobjects.h" #include "iSNStypes.h" #include "iSNSmsg.h" #include "iSNSdebug.h" /* Global */ extern int isns_db_debug; /********************************************************************* read_ISCSIObject *********************************************************************/ int read_ISCSIObject (char *p_id, SOIP_Iscsi **p_node, SOIP_DB_Entry *p_entry) { ISNS_DBKey key; int rval; if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) return (ERROR); key.tag = ISCSI_ID_KEY; strcpy(key.val.node_key.v, p_id); rval = ISNSdbRead(&key,p_entry); *p_node = (SOIP_Iscsi *)&p_entry->data; return rval; } /********************************************************************* read_EntityObject Fetches an entity from the database PARAMETERS: 1. p_entity_id - Entity ID. 2. p_entity - Address where to place results 2. p_entry - ENTRY Record RETURNS: 1. p_entity - will point to entry. Returns "no_error" if successful. *********************************************************************/ int read_EntityObject (char *p_entity_id, SOIP_Entity **p_entity, SOIP_DB_Entry *p_entry) { ISNS_DBKey key; int rval; if ( (p_entity_id == NULL ) || (strlen(p_entity_id) <= 0) ) return (ERROR); key.tag = ENTITY_ID_KEY; strcpy(key.val.entity_key.id,p_entity_id); rval = ISNSdbRead(&key,p_entry); *p_entity = (SOIP_Entity *)&p_entry->data; return rval; } /********************************************************************* read_DDObject Reads a DD object from the database *********************************************************************/ int read_DDObject (int id, SOIP_Dd **p_dd, SOIP_DB_Entry *p_entry) { ISNS_DBKey key; int rval; if (id == 0) return (ERROR); key.tag = DD_ID_KEY; key.val.dd_key.id = id; rval = ISNSdbRead(&key,p_entry); *p_dd = (SOIP_Dd *)&p_entry->data; return rval; } /********************************************************************* read_DDSObject Reads a DDS object from the database *********************************************************************/ int read_DDSObject (int id, SOIP_Dds **p_dds, SOIP_DB_Entry *p_entry) { ISNS_DBKey key; int rval; if (id == 0) return (ERROR); key.tag = DDS_ID_KEY; key.val.dds_key.id = id; rval = ISNSdbRead(&key,p_entry); *p_dds = (SOIP_Dds *)&p_entry->data; return rval; } /********************************************************************* write_ISCSIObject Reads a ISCSI object from the database *********************************************************************/ int write_ISCSIObject (char *p_id, SOIP_DB_Entry p_entry) { ISNS_DBKey key; int rval; if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) return (ERROR); key.tag = ISCSI_ID_KEY; strcpy(key.val.node_key.v,p_id); rval = ISNSdbWrite(&key, p_entry); return rval; } /********************************************************************* write_EntityObject Reads a Entity object from the database *********************************************************************/ int write_EntityObject (char *p_entity_id, SOIP_DB_Entry p_entry) { ISNS_DBKey key; int rval; if ( (p_entity_id == NULL ) || (strlen(p_entity_id) <= 0) ) return (ERROR); key.tag = ENTITY_ID_KEY; strcpy(key.val.entity_key.id,p_entity_id); rval = ISNSdbWrite(&key, p_entry); return rval; } /********************************************************************* write_DDObject Reads a DD object from the database *********************************************************************/ int write_DDObject (int id, SOIP_DB_Entry p_entry) { ISNS_DBKey key; int rval; if (id == 0) return (ERROR); key.tag = DD_ID_KEY; key.val.dd_key.id = id; rval = ISNSdbWrite(&key, p_entry); return rval; } /********************************************************************* write_DDSObject Reads a DDS object from the database *********************************************************************/ int write_DDSObject (int id, SOIP_DB_Entry p_entry) { ISNS_DBKey key; int rval; if (id == 0) return (ERROR); key.tag = DDS_ID_KEY; key.val.dds_key.id = id; rval = ISNSdbWrite(&key, p_entry); return rval; } /********************************************************************* delete_DDObject delete a DD object from the database *********************************************************************/ int delete_DDObject (int id) { ISNS_DBKey key; int rval; if (id == 0) return (ERROR); key.tag = DD_ID_KEY; key.val.dd_key.id = id; rval = ISNSdbDelete(&key); return rval; } /********************************************************************* delete_DDSObject delete a DDS object from the database *********************************************************************/ int delete_DDSObject (int id) { ISNS_DBKey key; int rval; if (id == 0) return (ERROR); key.tag = DDS_ID_KEY; key.val.dds_key.id = id; rval = ISNSdbDelete(&key); return rval; } /********************************************************************* delete_ISCSIObject delete a ISCSI object from the database *********************************************************************/ int delete_ISCSIObject (char *p_id) { ISNS_DBKey key; int rval; if ( (p_id == NULL ) || (strlen(p_id) <= 0) ) return (ERROR); key.tag = ISCSI_ID_KEY; strcpy(key.val.node_key.v,p_id); rval = ISNSdbDelete(&key); return rval; } /********************************************************************* delete_EntityObject delete a Enity object from the database *********************************************************************/ int delete_EntityObject (char *p_entity_id) { ISNS_DBKey key; int rval; if ( (p_entity_id == NULL ) || (strlen(p_entity_id) <= 0) ) return (ERROR); key.tag = ENTITY_ID_KEY; strcpy(key.val.entity_key.id,p_entity_id); rval = ISNSdbDelete(&key); return rval; } Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** iSNSquery.c 23 Aug 2007 22:31:07 -0000 1.27 --- iSNSquery.c 24 Aug 2007 22:51:34 -0000 1.28 *************** *** 41,44 **** --- 41,45 ---- #include "iSNSList.h" #include "iSNSdb.h" + #include "iSNSobjects.h" #include "iSNSquery.h" #include "iSNSresponse.h" *************** *** 298,302 **** __ISNS_COPY (db_entity_id.id, sizeof(db_entity_id.id), &key->val, key->len); ! if (ISNS_NO_ERR != SNSdbFetchEntity (db_entity_id.id, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); --- 299,303 ---- __ISNS_COPY (db_entity_id.id, sizeof(db_entity_id.id), &key->val, key->len); ! if (ISNS_NO_ERR != read_EntityObject (db_entity_id.id, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); *************** *** 340,344 **** /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity ( ptr, &p_entity, &entry )) { return (ISNS_INVALID_QUERY_ERR); --- 341,345 ---- /* Fetch entity from hash */ ! if (ISNS_NO_ERR != read_EntityObject ( ptr, &p_entity, &entry )) { return (ISNS_INVALID_QUERY_ERR); *************** *** 378,382 **** /* Fetch entity from hash */ if (ISNS_NO_ERR != ! SNSdbFetchEntity (p_portal->entity_id.id, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); --- 379,383 ---- /* Fetch entity from hash */ if (ISNS_NO_ERR != ! read_EntityObject (p_portal->entity_id.id, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); *************** *** 406,410 **** /* Fetch entity from hash */ if (ISNS_NO_ERR != ! SNSdbFetchEntity (p_port->entity_id.id, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); --- 407,411 ---- /* Fetch entity from hash */ if (ISNS_NO_ERR != ! read_EntityObject (p_port->entity_id.id, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); *************** *** 457,475 **** } ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; ! p_node = (SOIP_Iscsi *)&entry.data.node; ! ! /* Fetch entity from hash */ ! if (ISNS_NO_ERR != ! SNSdbFetchEntity (p_node->entity_id.id, &p_entity, &entry)) ! { ! return (ISNS_UNKNOWN_ERR); ! } rval = Check_Permission (src_attr, ENTITY_ID_KEY, p_entity); --- 458,468 ---- } ! rval = read_ISCSIObject(db_node_name.v, &p_node, &entry); if (rval != SUCCESS) return rval; ! rval = read_EntityObject (p_node->entity_id.id, &p_entity, &entry); ! if (rval != SUCCESS) ! return rval; rval = Check_Permission (src_attr, ENTITY_ID_KEY, p_entity); *************** *** 483,498 **** else { - ISNS_DBKey key = { 0 }; /* Return all entity */ ! ! /* Get first entity id */ key.tag = ENTITY_ID_KEY; - key.len = 0; while (SNSdbGetNextOfKey (&key) == SUCCESS) { ! /* Fetch entity from hash */ ! ! if (ISNS_NO_ERR != SNSdbFetchEntity (key.val.entity_key.id, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); --- 476,486 ---- else { /* Return all entity */ ! ISNS_DBKey key = { 0 }; key.tag = ENTITY_ID_KEY; while (SNSdbGetNextOfKey (&key) == SUCCESS) { ! if (ISNS_NO_ERR != read_EntityObject (key.val.entity_key.id, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); *************** *** 523,541 **** { SOIP_Dds *p_dds; - SOIP_DD_Key dds_key; - ISNS_DBKey key; int rval; ! dds_key.id = id; ! key.tag = DDS_ID_KEY; ! key.val.dds_key.id = id; ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return rval; - p_dds = (SOIP_Dds *)&entry.data; - - /* ISNSDisplay_DDS ( p_dds, HI_DETAIL ); */ - ISNSdbProcessDDSOpAttr(p_msg, (ISNS_Attr **) attr_indx, p_dds); return (ISNS_NO_ERR); --- 511,520 ---- { SOIP_Dds *p_dds; int rval; ! rval = read_DDSObject(id, &p_dds, &entry); if (rval != SUCCESS) return rval; ISNSdbProcessDDSOpAttr(p_msg, (ISNS_Attr **) attr_indx, p_dds); return (ISNS_NO_ERR); *************** *** 627,634 **** else { - ISNS_DBKey key = { 0 }; /* retrieve all DDS */ key.tag = DDS_ID_KEY; - key.len = DDS_KEY_SIZE; while (SNSdbGetNextOfKey (&key) == SUCCESS) --- 606,613 ---- else { /* retrieve all DDS */ + + ISNS_DBKey key = { 0 }; key.tag = DDS_ID_KEY; while (SNSdbGetNextOfKey (&key) == SUCCESS) *************** *** 672,694 **** { SOIP_Dd *p_dd; - SOIP_DD_Key dd_key; - ISNS_DBKey key; int rval; __DEBUG (isns_query_debug &1, SNSdbGetAttrDDEntry); ! dd_key.id = id; ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = id; ! rval = ISNSdbRead(&key,&entry); ! if (rval != SUCCESS) ! return rval; ! ! p_dd = (SOIP_Dd *)&entry.data; ! ! /* ISNSDisplay_DD ( p_dd, HI_DETAIL ); */ ! ISNSdbProcessDDOpAttr( p_msg, (ISNS_Attr **) attr_indx, p_dd ); ! return ( ISNS_NO_ERR ); } --- 651,664 ---- { SOIP_Dd *p_dd; int rval; __DEBUG (isns_query_debug &1, SNSdbGetAttrDDEntry); ! rval = read_DDObject(id, &p_dd, &entry); ! if (rval == SUCCESS) ! ISNSdbProcessDDOpAttr( p_msg, (ISNS_Attr **) attr_indx, p_dd ); ! ! return ( rval ); } *************** *** 772,786 **** { key = (ISNS_Key *)(key_indx[ddsKeyIndex]); - /* Fetch the DDS */ dds_key.id = key->val.dd_id; ! ISNS_DBKey read_key; ! read_key.tag = DDS_ID_KEY; ! read_key.val.dds_key.id = dds_key.id; ! rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) return rval; - p_dds = (SOIP_Dds *)&entry3.data; - pnode=NULL; while ((pnode=GetNextNode(&p_dds->dd_list, pnode))) --- 742,750 ---- { key = (ISNS_Key *)(key_indx[ddsKeyIndex]); dds_key.id = key->val.dd_id; ! rval = read_DDSObject(dds_key.id, &p_dds, &entry3); if (rval != SUCCESS) return rval; pnode=NULL; while ((pnode=GetNextNode(&p_dds->dd_list, pnode))) *************** *** 799,812 **** key = (ISNS_Key *)(key_indx[nodeKeyIndex]); ! /* Fetch the node */ ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,(char *)&key->val); ! rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&entry3.data.node; - pnode=NULL; while ((pnode=GetNextNode(&p_node->dd_id_list, pnode))) --- 763,770 ---- key = (ISNS_Key *)(key_indx[nodeKeyIndex]); ! rval = read_ISCSIObject((char *)&key->val, &p_node, &entry3); if (rval != SUCCESS) return rval; pnode=NULL; while ((pnode=GetNextNode(&p_node->dd_id_list, pnode))) *************** *** 822,832 **** else { - ISNS_DBKey key = { 0 }; - /* retrieve all DD */ ! ! /* Get first entity id */ key.tag = DD_ID_KEY; - key.len = DD_KEY_SIZE; while (SNSdbGetNextOfKey (&key) == SUCCESS) --- 780,786 ---- else { /* retrieve all DD */ ! ISNS_DBKey key = { 0 }; key.tag = DD_ID_KEY; while (SNSdbGetNextOfKey (&key) == SUCCESS) *************** *** 947,955 **** else { - ISNS_DBKey key = { 0 }; - /* Search the node table */ key.tag = NODE_NAME_KEY; - key.len = DB_NODE_NAME_SIZE; while (SNSdbGetNextOfKey (&key) == SUCCESS) --- 901,907 ---- else { /* Search the node table */ + ISNS_DBKey key = { 0 }; key.tag = NODE_NAME_KEY; while (SNSdbGetNextOfKey (&key) == SUCCESS) *************** *** 1116,1120 **** { /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity ((char *)&key->val, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); --- 1068,1072 ---- { /* Fetch entity from hash */ ! if (ISNS_NO_ERR != read_EntityObject ((char *)&key->val, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); *************** *** 1157,1161 **** /* Fetch Entity */ if (ISNS_NO_ERR != ! SNSdbFetchEntity (p_port->entity_id.id, &p_entity, &entry)) { return (ERROR); --- 1109,1113 ---- /* Fetch Entity */ if (ISNS_NO_ERR != ! read_EntityObject (p_port->entity_id.id, &p_entity, &entry)) { return (ERROR); *************** *** 1194,1205 **** __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - - p_node = (SOIP_Iscsi *)&entry.data; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); --- 1146,1152 ---- __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ! rval = read_ISCSIObject(db_node_name.v, &p_node, &entry); if (rval != SUCCESS) return rval; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); *************** *** 1210,1219 **** } ! /* Fetch Entity */ ! if (ISNS_NO_ERR != ! SNSdbFetchEntity (p_node->entity_id.id, &p_entity, &entry)) ! { ! return (ERROR); ! } /* Cycle through all portal */ --- 1157,1163 ---- } ! rval = read_EntityObject (p_node->entity_id.id, &p_entity, &entry); ! if (rval != SUCCESS) ! return rval; /* Cycle through all portal */ *************** *** 1238,1244 **** /* No Key */ p_portal_name = NULL; - key2.tag = PORTAL_ID_KEY; ! key2.len = sizeof (SOIP_Portal_Key); while (SNSdbGetNextOfKey (&key2) == SUCCESS) --- 1182,1187 ---- /* No Key */ p_portal_name = NULL; key2.tag = PORTAL_ID_KEY; ! key2.len = 0; while (SNSdbGetNextOfKey (&key2) == SUCCESS) *************** *** 1410,1422 **** strncpy ( db_entity_id.id, (char *)&key->val, sizeof(db_entity_id.id) ); ! ISNS_DBKey read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.node_key.v,db_entity_id.id); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_entity = &entry.data.entity; - /* Scan the entity's port list */ pnode=NULL; --- 1353,1360 ---- strncpy ( db_entity_id.id, (char *)&key->val, sizeof(db_entity_id.id) ); ! rval = read_EntityObject (db_entity_id.id, &p_entity, &entry); if (rval != SUCCESS) return rval; /* Scan the entity's port list */ pnode=NULL; *************** *** 1467,1480 **** { ! /* Fetch entity from hash */ ! ISNS_DBKey read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_key.id,p_portal->entity_id.id); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_entity = &entry.data.entity; - /* Scan the entity's port list */ pnode=NULL; --- 1405,1412 ---- { ! rval = read_EntityObject(p_portal->entity_id.id, &p_entity, &entry); if (rval != SUCCESS) return rval; /* Scan the entity's port list */ pnode=NULL; *************** *** 1506,1515 **** else { ISNS_DBKey key = { 0 }; - key.tag = PORT_NAME_KEY; - key.len = PORT_NAME_SIZE; - /* Return all Ports */ while (SNSdbGetNextOfKey (&key) == SUCCESS) { --- 1438,1445 ---- else { + /* Return all Ports */ ISNS_DBKey key = { 0 }; key.tag = PORT_NAME_KEY; while (SNSdbGetNextOfKey (&key) == SUCCESS) { *************** *** 1614,1624 **** __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&entry.data.node; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); --- 1544,1550 ---- __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ! rval = read_ISCSIObject(db_node_name.v, &p_node, &entry); if (rval != SUCCESS) return rval; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); *************** *** 1661,1673 **** strncpy ((char *) db_node_name.v, ptr, sizeof(db_node_name.v) ); ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&entry.data.node; - rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); if (rval == SUCCESS) --- 1587,1594 ---- strncpy ((char *) db_node_name.v, ptr, sizeof(db_node_name.v) ); ! rval = read_ISCSIObject(db_node_name.v, &p_node, &entry); if (rval != SUCCESS) return rval; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); if (rval == SUCCESS) *************** *** 1686,1690 **** key = (ISNS_Key *) (key_indx[entityKeyIndex]); ! rval = SNSdbFetchEntity((char *)&key->val, &p_entity, &entry); if (rval) --- 1607,1611 ---- key = (ISNS_Key *) (key_indx[entityKeyIndex]); ! rval = read_EntityObject((char *)&key->val, &p_entity, &entry); if (rval) *************** *** 1703,1716 **** { /* Fetch the iSCSI Node */ ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,GetNodeData(pnode)); ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return rval; - /* We found a candidate */ - p_node = (SOIP_Iscsi *)&entry2.data; - rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); if (rval == SUCCESS) --- 1624,1631 ---- { /* Fetch the iSCSI Node */ ! rval = read_ISCSIObject(GetNodeData(pnode), &p_node, &entry2); if (rval != SUCCESS) return rval; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); if (rval == SUCCESS) *************** *** 1754,1767 **** { ! /* Fetch ENTITY */ ! ISNS_DBKey read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_key.id,p_portal->entity_id.id); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_entity = &entry.data.entity; - /* Scan the entity's iSCSI List */ pnode=NULL; --- 1669,1676 ---- { ! rval = read_EntityObject(p_portal->entity_id.id, &p_entity, &entry); if (rval != SUCCESS) return rval; /* Scan the entity's iSCSI List */ pnode=NULL; *************** *** 1769,1782 **** { /* Fetch the iSCSI Node */ ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,GetNodeData(pnode)); ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return rval; - /* We found a candidate */ - p_node = (SOIP_Iscsi *)&entry2.data; - rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); if (rval == SUCCESS) --- 1678,1685 ---- { /* Fetch the iSCSI Node */ ! rval = read_ISCSIObject(GetNodeData(pnode), &p_node, &entry2); if (rval != SUCCESS) return rval; rval = Check_Permission (src_attr, ISCSI_ID_KEY, p_node); if (rval == SUCCESS) *************** *** 1791,1800 **** else { ISNS_DBKey qkey = { 0 }; __DEBUG (isns_query_debug &1,search node table); - - /* Search the node table */ - qkey.len = 0; qkey.tag = ISCSI_ID_KEY; --- 1694,1701 ---- else { + /* Search the node table */ ISNS_DBKey qkey = { 0 }; __DEBUG (isns_query_debug &1,search node table); qkey.tag = ISCSI_ID_KEY; *************** *** 2138,2142 **** return (ISNS_NO_SUCH_ENTRY_ERR); } ! rval = SNSdbFetchEntity(qkey.val.entity_key.id, &p_entity, &entry); if (rval) --- 2039,2043 ---- return (ISNS_NO_SUCH_ENTRY_ERR); } ! rval = read_EntityObject(qkey.val.entity_key.id, &p_entity, &entry); if (rval) *************** *** 2315,2319 **** ISNS_Attr *attr_indx[SNS_MAX_ATTRS]; ISNS_Attr *key_indx[SNS_MAX_ATTRS]; - ISNS_DBKey key; int rval; --- 2216,2219 ---- *************** *** 2329,2342 **** p_attr=(ISNS_Attr *)key_indx[ddsKeyIndex]; - /* Fetch DDS */ dds_key.id = p_attr->val.dds_id; ! key.tag = DDS_ID_KEY; ! key.val.dds_key.id = dds_key.id; ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return rval; - p_dds = (SOIP_Dds *)&entry.data; - /* Append Keys */ --- 2229,2237 ---- p_attr=(ISNS_Attr *)key_indx[ddsKeyIndex]; dds_key.id = p_attr->val.dds_id; ! rval = read_DDSObject(dds_key.id, &p_dds, &entry); if (rval != SUCCESS) return rval; /* Append Keys */ *************** *** 2409,2413 **** /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity ( ptr, &p_entity, &entry )) { return (ISNS_INVALID_QUERY_ERR); --- 2304,2308 ---- /* Fetch entity from hash */ ! if (ISNS_NO_ERR != read_EntityObject ( ptr, &p_entity, &entry )) { return (ISNS_INVALID_QUERY_ERR); *************** *** 2462,2466 **** ISNS_Attr *p_attr; SOIP_Dd *p_dd; - SOIP_DD_Key dd_key; ISNS_LIST_NODE *plnode; ISNS_Attr *src_attr; --- 2357,2360 ---- *************** *** 2481,2495 **** p_attr=(ISNS_Attr *)key_indx[ddKeyIndex]; ! /* Fetch DDS */ ! dd_key.id = p_attr->val.dd_id; ! ISNS_DBKey read_key; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&entry.data; - /* Append Keys */ --- 2375,2382 ---- p_attr=(ISNS_Attr *)key_indx[ddKeyIndex]; ! rval = read_DDObject(p_attr->val.dd_id, &p_dd, &entry); if (rval != SUCCESS) return rval; /* Append Keys */ *************** *** 2571,2575 **** { SOIP_Dd *p_dd; - ISNS_DBKey read_key; SOIP_DB_Entry lentry; int rval; --- 2458,2461 ---- *************** *** 2577,2587 **** if (dd_id_Flag != -1 ) ISNSAppendAttr (p_msg, ISNS_DD_ID, ISNS_DD_ID_SIZE, NULL, *(uint32_t *)GetNodeData(pnode)); ! ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = *(uint32_t *)GetNodeData(pnode); ! rval = ISNSdbRead(&read_key,&lentry); if (rval == SUCCESS) { - p_dd = (SOIP_Dd *)&lentry.data; ISNSAppendAttr (p_msg, ISNS_DD_SYM_NAME, PAD4 (strlen (p_dd->sym_name)), p_dd->sym_name, 0); --- 2463,2469 ---- if (dd_id_Flag != -1 ) ISNSAppendAttr (p_msg, ISNS_DD_ID, ISNS_DD_ID_SIZE, NULL, *(uint32_t *)GetNodeData(pnode)); ! rval = read_DDObject(*(uint32_t *)GetNodeData(pnode), &p_dd, &lentry); if (rval == SUCCESS) { ISNSAppendAttr (p_msg, ISNS_DD_SYM_NAME, PAD4 (strlen (p_dd->sym_name)), p_dd->sym_name, 0); *************** *** 2648,2658 **** int rval; SOIP_Dds *p_dds; ! ISNS_DBKey key; ! key.tag = DDS_ID_KEY; ! key.val.dds_key.id = *(uint32_t *)GetNodeData(pnode); ! rval = ISNSdbRead(&key,&lentry); if (rval == SUCCESS) { - p_dds = (SOIP_Dds *)&lentry.data; ISNSAppendAttr (p_msg, ISNS_DDS_SYM_NAME, PAD4(strlen(p_dds->sym_name)),p_dds->sym_name,0); } --- 2530,2536 ---- int rval; SOIP_Dds *p_dds; ! rval = read_DDSObject(*(uint32_t *)GetNodeData(pnode), &p_dds, &lentry); if (rval == SUCCESS) { ISNSAppendAttr (p_msg, ISNS_DDS_SYM_NAME, PAD4(strlen(p_dds->sym_name)),p_dds->sym_name,0); } *************** *** 2761,2765 **** if ( fetchEntityFlag || fetchPortalFlag ) { ! if ( SUCCESS != SNSdbFetchEntity ( p_node->entity_id.id, &p_entity, &entry4 ) ) return ( ISNS_UNKNOWN_ERR ); } --- 2639,2643 ---- if ( fetchEntityFlag || fetchPortalFlag ) { ! if ( SUCCESS != read_EntityObject ( p_node->entity_id.id, &p_entity, &entry4 ) ) return ( ISNS_UNKNOWN_ERR ); } *************** *** 3275,3292 **** { SOIP_Dds *p_dds; - SOIP_DD_Key dds_key; SOIP_DB_Entry lentry; - ISNS_DBKey key; int rval; ! dds_key.id = dds_id; ! key.tag = DDS_ID_KEY; ! key.val.dds_key.id = dds_id; ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_dds = (SOIP_Dds *)&lentry.data; - return (p_dds->status); } --- 3153,3163 ---- { SOIP_Dds *p_dds; SOIP_DB_Entry lentry; int rval; ! rval = read_DDSObject(dds_id, &p_dds, &lentry); if (rval != SUCCESS) return rval; return (p_dds->status); } *************** *** 3302,3306 **** ISNS_LIST_NODE *pnode; ! if (SUCCESS != SNSdbFetchDD (dd_id, &p_dd, &lentry)) return (FALSE); --- 3173,3177 ---- ISNS_LIST_NODE *pnode; ! if (SUCCESS != read_DDObject (dd_id, &p_dd, &lentry)) return (FALSE); *************** *** 3352,3366 **** } - /* Fetch DD */ dd_key.id = *(uint32_t *)GetNodeData(pnode); ! ISNS_DBKey read_key; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&read_key,&lentry2); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&lentry2.data; - if (p_dd->activeFlag || flag) Append_DD_to_List (p_dlist, dd_key.id); --- 3223,3231 ---- } dd_key.id = *(uint32_t *)GetNodeData(pnode); ! rval = read_DDObject(dd_key.id, &p_dd, &lentry2); if (rval != SUCCESS) return rval; if (p_dd->activeFlag || flag) Append_DD_to_List (p_dlist, dd_key.id); *************** *** 3408,3412 **** { /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity (p_entity_name, &p_entity, &lentry)) { return (ERROR); --- 3273,3277 ---- { /* Fetch entity from hash */ ! if (ISNS_NO_ERR != read_EntityObject (p_entity_name, &p_entity, &lentry)) { return (ERROR); *************** *** 3453,3469 **** SOIP_Iscsi *p_node; SOIP_DB_Entry lentry; - ISNS_DBKey key; int rval; __DEBUG(isns_query_debug & 1, (Get_Active_DD_List_From_ISCSI_Node nodename=%s),nodename); ! /* Fetch the node */ ! key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,nodename); ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&lentry.data.node; Get_Active_DD_List (&p_node->dd_id_list, p_dlist, flag); --- 3318,3329 ---- SOIP_Iscsi *p_node; SOIP_DB_Entry lentry; int rval; __DEBUG(isns_query_debug & 1, (Get_Active_DD_List_From_ISCSI_Node nodename=%s),nodename); ! rval = read_ISCSIObject(nodename, &p_node, &lentry); if (rval != SUCCESS) return rval; Get_Active_DD_List (&p_node->dd_id_list, p_dlist, flag); *************** *** 3520,3529 **** { SOIP_DB_Entry lentry; SOIP_Entity *p_entity; - SOIP_Entity_Key db_entity; SOIP_ISCSI_Node_Id db_node_name; SOIP_Iscsi *p_node; time_t t; - ISNS_DBKey key; int rval; --- 3380,3388 ---- { SOIP_DB_Entry lentry; + SOIP_DB_Entry lentry2; SOIP_Entity *p_entity; SOIP_ISCSI_Node_Id db_node_name; SOIP_Iscsi *p_node; time_t t; int rval; *************** *** 3531,3537 **** return (SUCCESS); - /* Fetch Node */ - memset(&db_entity, 0, sizeof(db_entity)); - if ( src_attr->tag == ISNS_ISCSI_NODE_ID ) { --- 3390,3393 ---- *************** *** 3539,3569 **** strncpy ( (char *) db_node_name.v, (char *)&src_attr->val, sizeof(db_node_name.v) ); ! key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&key,&lentry); ! p_node = (SOIP_Iscsi *)&lentry.data.node; ! strncpy(db_entity.id, p_node->entity_id.id, sizeof(db_entity.id)); } else { ! __DEBUG(isns_query_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } - /* Fetch entity from hash */ - if (ISNS_NO_ERR != SNSdbFetchEntity (db_entity.id, &p_entity, &lentry)) - { - return ( ERROR ); - } - - /* Fetch Entity */ - /* Update Time Stamp */ - p_entity->timestamp.t_time = time (&t); - - key.tag = ENTITY_ID_KEY; - strcpy(key.val.entity_key.id,db_entity.id); - ISNSdbWrite(&key,lentry); - return ( SUCCESS ); } --- 3395,3416 ---- strncpy ( (char *) db_node_name.v, (char *)&src_attr->val, sizeof(db_node_name.v) ); ! rval = read_ISCSIObject(db_node_name.v, &p_node, &lentry); ! if (rval != SUCCESS) ! return (ERROR); ! rval = read_EntityObject (p_node->entity_id.id, &p_entity, &lentry2); ! if (rval != SUCCESS) ! return ( ERROR ); ! ! /* Update Time Stamp */ ! p_entity->timestamp.t_time = time (&t); ! write_EntityObject(p_node->entity_id.id, lentry2); } else { ! __LOG_INFO ("src_attr->tag is not a iSCSI node and should be"); return (ERROR); } return ( SUCCESS ); } Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** iSNSdereg.c 13 Aug 2007 22:56:45 -0000 1.26 --- iSNSdereg.c 24 Aug 2007 22:51:34 -0000 1.27 *************** *** 41,44 **** --- 41,46 ---- #include "iSNSList.h" #include "iSNSdb.h" + #include "iSNSobjects.h" + #include "iSNSdb.h" #include "iSNSreg.h" #include "iSNSquery.h" *************** *** 197,213 **** int updated_dd_list_size; int memberRemovedFlag; - ISNS_DBKey delete_key; - ISNS_DBKey read_key; - __DEBUG (isns_dereg_debug &1, RemoveAttrDSS_Entry); dds_key.id = id; ! read_key.tag = DDS_ID_KEY; ! read_key.val.dds_key.id = id; ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return (rval); - p_dds = (SOIP_Dds *)&entry.data; /* Remove DDS from DD's DDS List */ --- 199,209 ---- int updated_dd_list_size; int memberRemovedFlag; __DEBUG (isns_dereg_debug &1, RemoveAttrDSS_Entry); dds_key.id = id; ! rval = read_DDSObject(id, &p_dds, &entry); if (rval != SUCCESS) return (rval); /* Remove DDS from DD's DDS List */ *************** *** 220,231 **** { dd_key.id = *(uint32_t *)GetNodeData(pnode); ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return (rval); - p_dd = (SOIP_Dd *)&entry2.data; - isActiveFlag = IsDDActive( dd_key.id, p_dds->id ); --- 216,223 ---- { dd_key.id = *(uint32_t *)GetNodeData(pnode); ! rval = read_DDObject(dd_key.id, &p_dd, &entry2); if (rval != SUCCESS) return (rval); isActiveFlag = IsDDActive( dd_key.id, p_dds->id ); *************** *** 247,254 **** /* Store Entry */ ! ISNS_DBKey update_key; ! update_key.tag = DD_ID_KEY; ! update_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbWrite(&update_key,entry2); } --- 239,243 ---- /* Store Entry */ ! write_DDObject(dd_key.id,entry2); } *************** *** 256,272 **** { dd_key.id = dlist_node[ count ]; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! ISNSdbRead(&read_key,&entry2); ! p_dd = (SOIP_Dd *)&entry2.data; ! ! change_dd_member_active_flag( p_dd ); } DeleteList(&p_dds->dd_list); ! delete_key.tag = DDS_ID_KEY; ! delete_key.val.dds_key.id = dds_key.id; ! if ( ISNSdbDelete (&delete_key) != SUCCESS) { __DEBUG (isns_dereg_debug & 1, (DDS Removal failed, %u), dds_key.id); --- 245,256 ---- { dd_key.id = dlist_node[ count ]; ! rval = read_DDObject(dd_key.id, &p_dd, &entry2); ! if (rval == SUCCESS) ! change_dd_member_active_flag( p_dd ); } DeleteList(&p_dds->dd_list); ! if ( delete_DDSObject (dds_key.id) != SUCCESS) { __DEBUG (isns_dereg_debug & 1, (DDS Removal failed, %u), dds_key.id); *************** *** 299,303 **** int updated_dd_list_size; int memberRemovedFlag; - ISNS_DBKey read_key; --- 283,286 ---- *************** *** 305,316 **** dds_key.id = id; ! read_key.tag = DDS_ID_KEY; ! read_key.val.dds_key.id = id; ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return (rval); - p_dds = (SOIP_Dds *)&entry.data; - /* Remove DDS from DD's DDS List */ memberRemovedFlag = FALSE; --- 288,295 ---- dds_key.id = id; ! rval = read_DDSObject(dds_key.id, &p_dds, &entry); if (rval != SUCCESS) return (rval); /* Remove DDS from DD's DDS List */ memberRemovedFlag = FALSE; *************** *** 328,338 **** dd_key.id = key->val.dd_id; ! ISNS_DBKey read_key; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) return (rval); - p_dd = (SOIP_Dd *)&entry2.data; pnode=NULL; --- 307,313 ---- dd_key.id = key->val.dd_id; ! rval = read_DDObject(dd_key.id, &p_dd, &entry2); if (rval != SUCCESS) return (rval); pnode=NULL; *************** *** 352,359 **** /* Store Entry */ ! ISNS_DBKey update_key; ! update_key.tag = DD_ID_KEY; ! update_key.val.dd_key.id = dd_key.id; ! ISNSdbWrite(&update_key,entry2); } } --- 327,331 ---- /* Store Entry */ ! write_DDObject(dd_key.id,entry2); } } *************** *** 365,385 **** dd_key.id = dlist_node[ kk ]; ! ISNS_DBKey read_key; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&read_key,&entry2); ! if (rval != SUCCESS) ! return (rval); ! ! p_dd = (SOIP_Dd *)&entry2.data; ! ! change_dd_member_active_flag( p_dd ); } /* Store Entry */ ! ISNS_DBKey add_key; ! add_key.tag = DDS_ID_KEY; ! add_key.val.dds_key.id = id; ! rval = ISNSdbWrite(&add_key,entry); return (ISNS_NO_ERR); } --- 337,347 ---- dd_key.id = dlist_node[ kk ]; ! rval = read_DDObject(dd_key.id, &p_dd, &entry2); ! if (rval == SUCCESS) ! change_dd_member_active_flag( p_dd ); } /* Store Entry */ ! rval = write_DDSObject(id, entry); return (ISNS_NO_ERR); } *************** *** 529,545 **** __DEBUG ( isns_dereg_debug & 1, (Deregistering Entity %s),p_entity_id); - /* - Validate the src attr has permission to delete the node - The src is an entity verify that it is the same as the entity to delete. - */ - /* read entity from database */ ! key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_key.id,p_entity_id); ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return rval; - p_entity = &entry.data.entity; - /* Remove Portals */ --- 491,498 ---- __DEBUG ( isns_dereg_debug & 1, (Deregistering Entity %s),p_entity_id); /* read entity from database */ ! rval = read_EntityObject(p_entity_id, &p_entity, &entry); if (rval != SUCCESS) return rval; /* Remove Portals */ *************** *** 593,597 **** /* Remove Entity */ ! rval = ISNSdbDelete (&key); iSNS_stats.num_entity--; --- 546,550 ---- /* Remove Entity */ ! rval = delete_EntityObject(key.val.entity_key.id); iSNS_stats.num_entity--; *************** *** 717,728 **** /* Remove Port from entity's List */ ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.port_name.v,p_ifcp_node->entity_id.id); ! rval = ISNSdbRead(&read_key,&entry4); if (rval != SUCCESS) return rval; - p_entity = &entry4.data.entity; - pnode=NULL; if ((pnode=FindNode(&p_entity->ifcp_node_list, ifcp_node_key, PORT_NAME_SIZE))) --- 670,677 ---- /* Remove Port from entity's List */ ! rval = read_EntityObject(p_ifcp_node->entity_id.id, &p_entity, &entry4); if (rval != SUCCESS) return rval; pnode=NULL; if ((pnode=FindNode(&p_entity->ifcp_node_list, ifcp_node_key, PORT_NAME_SIZE))) *************** *** 731,738 **** } ! ISNS_DBKey key; ! key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_key.id,p_ifcp_node->entity_id.id); ! rval = ISNSdbWrite(&key,entry4); if (IsEmptyList(&p_entity->ifcp_node_list) && src_attr != NULL) --- 680,684 ---- } ! rval = write_EntityObject(p_ifcp_node->entity_id.id, entry4); if (IsEmptyList(&p_entity->ifcp_node_list) && src_attr != NULL) *************** *** 1022,1027 **** SOIP_DD_Key dd_key; ISNS_LIST_NODE *pnode; - ISNS_DBKey key; - ISNS_DBKey entity_key; ISNS_DBKey remove_key; --- 968,971 ---- *************** *** 1032,1043 **** scn_bitmap = 0; ! key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,iscsi_node_key); ! rval = ISNSdbRead(&key,&entry2); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&entry2.data; - /* Validate the src attr has permission to delete the node --- 976,983 ---- scn_bitmap = 0; ! rval = read_ISCSIObject(iscsi_node_key, &p_node, &entry2); if (rval != SUCCESS) return rval; /* Validate the src attr has permission to delete the node *************** *** 1055,1086 **** { dd_key.id = *(uint32_t *)GetNodeData(pnode); ! ISNS_DBKey read_key; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&read_key,&entry5); ! if (rval != SUCCESS) ! return rval; ! ! p_dd = (SOIP_Dd *)&entry5.data; ! ! Disable_DD_Member (p_dd, p_node->id.v, ISNS_DD_ISCSI_MEMBER); ! ! /* Store Entry */ ! ISNS_DBKey key; ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = dd_key.id; ! rval = ISNSdbWrite(&key,entry5); } /* read entity from database */ ! entity_key.tag = ENTITY_ID_KEY; ! strcpy(entity_key.val.entity_key.id,p_node->entity_id.id); ! rval = ISNSdbRead(&entity_key,&entry4); if (rval != SUCCESS) return ERROR; - p_entity = &entry4.data.entity; - /* Remove ISCSI Node from ENTITY */ if ((pnode = FindNode(&p_entity->iscsi_node_list, iscsi_node_key, PAD4(strlen(iscsi_node_key))))) --- 995,1013 ---- { dd_key.id = *(uint32_t *)GetNodeData(pnode); + rval = read_DDObject(dd_key.id, &p_dd, &entry5); + if (rval == SUCCESS) + { + Disable_DD_Member (p_dd, p_node->id.v, ISNS_DD_ISCSI_MEMBER); ! /* Store Entry */ ! write_DDObject(dd_key.id, entry5); ! } } /* read entity from database */ ! rval = read_EntityObject(p_node->entity_id.id, &p_entity, &entry4); if (rval != SUCCESS) return ERROR; /* Remove ISCSI Node from ENTITY */ if ((pnode = FindNode(&p_entity->iscsi_node_list, iscsi_node_key, PAD4(strlen(iscsi_node_key))))) *************** *** 1090,1094 **** /* update entity in database by doing a write */ ! rval = ISNSdbWrite(&entity_key,entry4); /* Delete the iSCSI Node */ --- 1017,1021 ---- /* update entity in database by doing a write */ ! rval = write_EntityObject(p_node->entity_id.id, entry4); /* Delete the iSCSI Node */ *************** *** 1104,1108 **** send_iscsi_scn_to_members ( NULL, iscsi_node_key, p_scn_all_msg_buffer, ISNS_SCN_OBJ_REMOVED ); ! rval = ISNSdbDelete(&key); if (rval != SUCCESS) { --- 1031,1035 ---- send_iscsi_scn_to_members ( NULL, iscsi_node_key, p_scn_all_msg_buffer, ISNS_SCN_OBJ_REMOVED ); ! rval = delete_ISCSIObject(iscsi_node_key); if (rval != SUCCESS) { *************** *** 1227,1238 **** iSNS_stats.num_portals--; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_key.id,p_portal->entity_id.id); ! rval = ISNSdbRead(&read_key,&entry4); if (rval != SUCCESS) return rval; - p_entity = &entry4.data.entity; - /* Remove Portals */ __ISNS_COPY (&portalListEntry.portal_ip_port, sizeof(portalListEntry.portal_ip_port), portal_key, --- 1154,1161 ---- iSNS_stats.num_portals--; ! rval = read_EntityObject(p_portal->entity_id.id, &p_entity, &entry4); if (rval != SUCCESS) return rval; /* Remove Portals */ __ISNS_COPY (&portalListEntry.portal_ip_port, sizeof(portalListEntry.portal_ip_port), portal_key, *************** *** 1299,1316 **** ISNS_LIST_NODE *pnode; int memberRemovedFlag; - ISNS_DBKey delete_key; - ISNS_DBKey key; - dd_key.id = id; ! ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = id; ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&entry.data; - /* Remove DD Members */ pnode = NULL; --- 1222,1231 ---- ISNS_LIST_NODE *pnode; int memberRemovedFlag; dd_key.id = id; ! rval = read_DDObject(dd_key.id, &p_dd, &entry); if (rval != SUCCESS) return rval; /* Remove DD Members */ pnode = NULL; *************** *** 1362,1377 **** SOIP_DD_Key dds_key; ISNS_LIST_NODE *pnode2; - ISNS_DBKey key; dds_key.id = *(uint32_t *) GetNodeData(pnode); ! ! key.tag = DDS_ID_KEY; ! key.val.dds_key.id = dds_key.id; ! rval = ISNSdbRead(&key,&entry2); if (rval != SUCCESS) return rval; - p_dds = (SOIP_Dds *)&entry2.data; - if ((pnode2 = FindNode(&p_dds->dd_list, (char *)&p_dd->id, sizeof(p_dd->id)))) { --- 1277,1286 ---- SOIP_DD_Key dds_key; ISNS_LIST_NODE *pnode2; dds_key.id = *(uint32_t *) GetNodeData(pnode); ! rval = read_DDSObject(dds_key.id, &p_dds, &entry2); if (rval != SUCCESS) return rval; if ((pnode2 = FindNode(&p_dds->dd_list, (char *)&p_dd->id, sizeof(p_dd->id)))) { *************** *** 1380,1386 **** /* Store Entry */ ! key.tag = DDS_ID_KEY; ! key.val.dds_key.id = dds_key.id; ! rval = ISNSdbWrite(&key,entry2); } --- 1289,1293 ---- /* Store Entry */ ! rval = write_DDSObject(dds_key.id, entry2); } *************** *** 1388,1394 **** DeleteList( &p_dd->dds_list ); ! delete_key.tag=DD_ID_KEY; ! delete_key.val.dd_key.id = dd_key.id; ! if ( ISNSdbDelete(&delete_key) == ERROR ) { __DEBUG ( isns_dereg_debug & 1, (DD Removal failed %u), dd_key.id ); --- 1295,1299 ---- DeleteList( &p_dd->dds_list ); ! if ( delete_DDObject(dd_key.id) != SUCCESS ) { __DEBUG ( isns_dereg_debug & 1, (DD Removal failed %u), dd_key.id ); *************** *** 1414,1431 **** SOIP_DD_Key dd_key; int removeMemberFlag; - ISNS_DBKey key; __DEBUG (isns_dereg_debug & 1, "Entering RemoveDD_Member()\n"); dd_key.id = id; ! ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&key,&entry); if (rval !=SUCCESS) return rval; - p_dd = (SOIP_Dd *)&entry.data; - /* Prepare the SCN */ memset(p_scn_all_msg_buffer, 0, sizeof(ISNS_Msg)); --- 1319,1330 ---- SOIP_DD_Key dd_key; int removeMemberFlag; __DEBUG (isns_dereg_debug & 1, "Entering RemoveDD_Member()\n"); dd_key.id = id; ! rval = read_DDObject(dd_key.id, &p_dd, &entry); if (rval !=SUCCESS) return rval; /* Prepare the SCN */ memset(p_scn_all_msg_buffer, 0, sizeof(ISNS_Msg)); *************** *** 1473,1479 **** /* Store Entry */ ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = dd_key.id; ! rval = ISNSdbWrite(&key,entry); return ( ISNS_NO_ERR ); --- 1372,1376 ---- /* Store Entry */ ! write_DDObject(dd_key.id, entry); return ( ISNS_NO_ERR ); *************** *** 1533,1547 **** int activeFlag; SOIP_DD_Key dd_key; - ISNS_DBKey key; int rval; ! key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,p_node_name); ! rval = ISNSdbRead(&key,&lentry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&lentry.data; - if ((p_lnode=FindNode(&p_node->dd_id_list, (char *)&p_dd->id, sizeof(p_dd->id)))) { --- 1430,1439 ---- int activeFlag; SOIP_DD_Key dd_key; int rval; ! rval = read_ISCSIObject(p_node_name, &p_node, &lentry); if (rval != SUCCESS) return rval; if ((p_lnode=FindNode(&p_node->dd_id_list, (char *)&p_dd->id, sizeof(p_dd->id)))) { *************** *** 1560,1574 **** dd_key.id = id; ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = id; ! rval = ISNSdbRead(&key,&lentry2); ! if (rval != SUCCESS) ! return rval; ! p_dd2 = (SOIP_Dd *)&lentry2.data; ! ! if (p_dd2->activeFlag) ! { activeFlag = TRUE; ! } } --- 1452,1461 ---- dd_key.id = id; ! rval = read_DDObject(dd_key.id, &p_dd2, &lentry2); ! if (rval == SUCCESS) ! if (p_dd2->activeFlag) ! { activeFlag = TRUE; ! } } *************** *** 1576,1582 **** } ! key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,p_node_name); ! ISNSdbWrite(&key,lentry); return (ISNS_NO_ERR); --- 1463,1467 ---- } ! write_ISCSIObject(p_node_name, lentry); return (ISNS_NO_ERR); *************** *** 1716,1736 **** __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ! ISNS_DBKey read_key; ! read_key.tag = ISCSI_ID_KEY; ! strcpy(read_key.val.node_key.v,db_node_name.v); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; - p_node = (SOIP_Iscsi *)&entry.data; - p_node->scn_bitmap=0; p_node->scn_sockfd = 0; /* Store the node */ ! ISNS_DBKey key; ! key.tag = ISCSI_ID_KEY; ! strcpy(key.val.node_key.v,db_node_name.v); ! ISNSdbWrite(&key,entry); } else if (ifcpKeyIndex != -1) --- 1601,1613 ---- __ISNS_COPY (db_node_name.v, sizeof(db_node_name.v), &key->val, key->len); ! rval = read_ISCSIObject(db_node_name.v, &p_node, &entry); if (rval != SUCCESS) return rval; p_node->scn_bitmap=0; p_node->scn_sockfd = 0; /* Store the node */ ! write_ISCSIObject(db_node_name.v, entry); } else if (ifcpKeyIndex != -1) *************** *** 1763,1767 **** /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity ((char *) &key->val, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); --- 1640,1644 ---- /* Fetch entity from hash */ ! if (ISNS_NO_ERR != read_EntityObject ((char *) &key->val, &p_entity, &entry)) { return (ISNS_NO_SUCH_ENTRY_ERR); *************** *** 1772,1779 **** /* Store the node */ ! ISNS_DBKey key; ! key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_key.id,p_entity->eid.id); ! ISNSdbWrite(&key,entry); return (ISNS_NO_ERR); --- 1649,1653 ---- /* Store the node */ ! write_EntityObject(p_entity->eid.id, entry); return (ISNS_NO_ERR); *************** *** 1828,1832 **** /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity (key.val.entity_key.id, &p_entity, &entry)) { return; --- 1702,1706 ---- /* Fetch entity from hash */ ! if (ISNS_NO_ERR != read_EntityObject (key.val.entity_key.id, &p_entity, &entry)) { return; Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** iSNSreg.c 23 Aug 2007 02:50:21 -0000 1.29 --- iSNSreg.c 24 Aug 2007 22:51:34 -0000 1.30 *************** *** 42,45 **** --- 42,46 ---- #include "iSNSList.h" #include "iSNSdb.h" + #include "iSNSobjects.h" #include "iSNSreg.h" #include "iSNSscn.h" *************** *** 440,448 **** __DEBUG (isns_reg_debug &1,Fetch entity); strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); ! ISNS_DBKey read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_key.id,db_entity_id.id); ! rval = ISNSdbRead(&read_key,&entry); ! if ( rval != SUCCESS) { --- 441,445 ---- __DEBUG (isns_reg_debug &1,Fetch entity); strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); ! rval = read_EntityObject(db_entity_id.id, &p_entity, &entry); if ( rval != SUCCESS) { *************** *** 451,456 **** } - p_entity = &entry.data.entity; - foundFlag = FALSE; pnode = NULL; --- 448,451 ---- *************** *** 503,507 **** { attr = (ISNS_Attr *)(key_indx[ eidKeyIndex ]); ! if ( SNSdbFetchEntity ((char *)&attr->val, &p_entity, &entry) ) { return (ISNS_INVALID_REG_ERR); --- 498,502 ---- { attr = (ISNS_Attr *)(key_indx[ eidKeyIndex ]); ! if ( read_EntityObject ((char *)&attr->val, &p_entity, &entry) ) { return (ISNS_INVALID_REG_ERR); *************** *** 619,623 **** if (newPortalRegFlag || updateFlag) { ! if ( SNSdbFetchEntity ((char *)p_portal->entity_id.id, &p_entity, &entry) ) return ( ERROR ); --- 614,618 ---- if (newPortalRegFlag || updateFlag) { ! if ( read_EntityObject ((char *)p_portal->entity_id.id, &p_entity, &entry) ) return ( ERROR ); *************** *** 979,983 **** SOIP_Dd *p_dd; SOIP_DD_Key dds_key; - SOIP_DD_Key dd_key; ISNS_LIST_NODE *pnode; ISNS_Attr *src_attr; --- 974,977 ---- *************** *** 986,991 **** int symIndex; char *p_sym; - ISNS_DBKey add_key; - ISNS_DBKey update_key; __DEBUG (isns_reg_debug & 1, (Registering DDS)); --- 980,983 ---- *************** *** 1070,1080 **** } ! ISNS_DBKey read_key; ! read_key.tag = DDS_ID_KEY; ! read_key.val.dds_key.id = dds_key.id; ! rval = ISNSdbRead(&read_key,&entry); ! ! p_dds = (SOIP_Dds *)&entry.data; ! if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { --- 1062,1066 ---- } ! rval = read_DDSObject(dds_key.id, &p_dds, &entry); if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { *************** *** 1184,1191 **** } /* Store Entry */ ! /* ISNSDisplay_DDS ( p_dds, HI_DETAIL ); */ ! add_key.tag = DDS_ID_KEY; ! add_key.val.dds_key.id = dds_key.id; ! rval = ISNSdbWrite (&add_key,entry); if ( newRegFlag ) iSNS_stats.num_dds++; --- 1170,1174 ---- } /* Store Entry */ ! rval = write_DDSObject(dds_key.id, entry); if ( newRegFlag ) iSNS_stats.num_dds++; *************** *** 1206,1219 **** /* Change status for all DD */ ! dd_key.id = dd_id; ! ISNS_DBKey key; ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&entry.data; - newState = IsDDActive ( dd_id, 0 ); --- 1189,1196 ---- /* Change status for all DD */ ! rval = read_DDObject(dd_id, &p_dd, &entry); if (rval != SUCCESS) return rval; newState = IsDDActive ( dd_id, 0 ); *************** *** 1226,1232 **** /* Store Entry */ ! update_key.tag = DD_ID_KEY; ! update_key.val.dd_key.id = dd_id; ! ISNSdbWrite(&update_key,entry); } } --- 1203,1207 ---- /* Store Entry */ ! write_DDObject(dd_id, entry); } } *************** *** 1238,1251 **** break; ! dd_key.id = dlist_node[ count ]; ! ISNS_DBKey key; ! key.tag = DD_ID_KEY; ! key.val.dd_key.id = dd_key.id; ! rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) return rval; - p_dd = (SOIP_Dd *)&entry.data; - /* Change all members to new state */ change_dd_member_active_flag( p_dd ); --- 1213,1220 ---- break; ! rval = read_DDObject(dlist_node[count], &p_dd, &entry); i... [truncated message content] |
From: Robert W. <wrw...@us...> - 2007-08-23 22:31:10
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19323/isnsserver/src Modified Files: iSNSLinux.c iSNSMain.c iSNSquery.c Log Message: change minor debug statements Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** iSNSLinux.c 23 Aug 2007 20:02:11 -0000 1.15 --- iSNSLinux.c 23 Aug 2007 22:31:07 -0000 1.16 *************** *** 412,420 **** isns_list_debug = -1; } else if (!strcmp(type,"reg")) { isns_reg_debug = -1; isns_dereg_debug = -1; - isns_query_debug = -1; } else if (!strcmp(type,"fsm")) --- 412,423 ---- isns_list_debug = -1; } + else if (!strcmp(type,"query")) + { + isns_query_debug = -1; + } else if (!strcmp(type,"reg")) { isns_reg_debug = -1; isns_dereg_debug = -1; } else if (!strcmp(type,"fsm")) Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** iSNSquery.c 23 Aug 2007 04:00:52 -0000 1.26 --- iSNSquery.c 23 Aug 2007 22:31:07 -0000 1.27 *************** *** 1553,1556 **** --- 1553,1557 ---- ISNS_LIST_NODE *pnode; int rval; + int rc; __DEBUG (isns_query_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); *************** *** 1807,1810 **** --- 1808,1813 ---- { key = (ISNS_Key *)(key_indx[nodeTypeKeyIndex]); + __DEBUG(isns_query_debug &1, key->val.node_type:%i p_node->type:%i,key->val.node_type,p_node->type); + if (!(*(uint32_t *) &key->val & p_node->type)) continue; *************** *** 1828,1838 **** } } ! if (!foundFlag) ! return (ISNS_NO_SUCH_ENTRY_ERR); ! __DEBUG (isns_query_debug &1,return from GetAttrISCSI); ! return ISNS_NO_ERR; } --- 1831,1842 ---- } } ! ! rc = ISNS_NO_ERR; if (!foundFlag) ! rc = ISNS_NO_SUCH_ENTRY_ERR; ! __DEBUG (isns_query_debug &1,return from GetAttrISCSI rc:%i,rc); ! return rc; } Index: iSNSMain.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSMain.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** iSNSMain.c 7 Aug 2007 14:41:47 -0000 1.15 --- iSNSMain.c 23 Aug 2007 22:31:07 -0000 1.16 *************** *** 271,275 **** inet_ntoa_b (source_ip, dot_not_addr); ! __DEBUG(isns_main_debug &1,"SNSProcessRequest type: 0x%x - %s",msg_type,FuncIDText(msg_type)); switch (msg_type) --- 271,275 ---- inet_ntoa_b (source_ip, dot_not_addr); ! __DEBUG(isns_main_debug &1,"ProcessRequest type:0x%x-%s",msg_type,FuncIDText(msg_type)); switch (msg_type) |
From: Robert W. <wrw...@us...> - 2007-08-23 22:31:10
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19323/isnsserver/include Modified Files: iSNStypes.h Log Message: change minor debug statements Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** iSNStypes.h 13 Aug 2007 22:56:44 -0000 1.16 --- iSNStypes.h 23 Aug 2007 22:31:06 -0000 1.17 *************** *** 728,731 **** --- 728,732 ---- union { uint32_t index; + uint32_t node_type; uint32_t ip_port; uint32_t dds_id; |
From: Robert W. <wrw...@us...> - 2007-08-23 20:02:18
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24581/src Modified Files: iSNSLinux.c iSNScomm.c iSNSparse.c iSNStrcv.c Log Message: fixed error in rcv buffer pointers Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** iSNSparse.c 23 Aug 2007 02:50:20 -0000 1.22 --- iSNSparse.c 23 Aug 2007 20:02:11 -0000 1.23 *************** *** 70,85 **** key_index[ii] = NULL; ! if ((msg->hdr.type > ISNS_END_VALID_REQ_FUNC_ID) ! && (msg->hdr.type < ISNS_START_VALID_RES_FUNC_ID)) ! return (SUCCESS); - if (msg->hdr.type == ISNS_HEART_BEAT) - return (SUCCESS); switch (msg->hdr.type) { case ISNS_REG_DEV_ATTR_REQ: case ISNS_ESI: - case ISNS_ESI_RSP: - case ISNS_SCN_RES: case ISNS_SCN: case ISNS_DEV_GET_NXT_REQ: --- 70,86 ---- key_index[ii] = NULL; ! //if ((msg->hdr.type > ISNS_END_VALID_REQ_FUNC_ID) ! // && (msg->hdr.type < ISNS_START_VALID_RES_FUNC_ID)) ! // return (SUCCESS); ! // ! //if (msg->hdr.type == ISNS_HEART_BEAT) ! // return (SUCCESS); switch (msg->hdr.type) { + case ISNS_HEART_BEAT: + return (SUCCESS); case ISNS_REG_DEV_ATTR_REQ: case ISNS_ESI: case ISNS_SCN: case ISNS_DEV_GET_NXT_REQ: *************** *** 96,101 **** --- 97,117 ---- case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: case ISNS_ENTITY_GET_NXT_PORTAL_REQ: + + case ISNS_REG_DEV_ATTR_RES: case ISNS_DEV_ATTR_QRY_RES: + case ISNS_DEV_GET_NXT_RES: case ISNS_DEREG_DEV_RES: + case ISNS_SCN_REG_RES: + case ISNS_SCN_DEREG_RES: + case ISNS_SCN_EVENT_RES: + case ISNS_SCN_RES: + case ISNS_REG_DD_RES: + case ISNS_DEREG_DD_RES: + case ISNS_REG_DDS_RES: + case ISNS_DEREG_DDS_RES: + case ISNS_ESI_RSP: + case ISNS_DDS_GET_NXT_MEMBER_RES: + case ISNS_DD_GET_NXT_ISCSI_MEMBER_RES: + case ISNS_ENTITY_GET_NXT_PORTAL_RES: parse_status = ISNSProfileKeysAttr (msg, attr_index, &num_attrs, key_index, &num_keys, (ISNS_Attr **)src_attr); *************** *** 104,112 **** break; default: ! if (msg->hdr.type & 0x8000) ! return (SUCCESS); ! parse_status = ERROR; ! __LOG_ERROR ("ISNSParseMSG error for msg->hdr.type=0x%x\n",msg->hdr.type); break; } --- 120,127 ---- break; default: ! //if (msg->hdr.type & 0x8000) ! // return (SUCCESS); parse_status = ERROR; ! __LOG_ERROR ("ISNSParseMSG error for msg->hdr.type=0x%x unimplemented message type\n",msg->hdr.type); break; } Index: iSNScomm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNScomm.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNScomm.c 7 Aug 2007 14:41:47 -0000 1.11 --- iSNScomm.c 23 Aug 2007 20:02:11 -0000 1.12 *************** *** 397,400 **** --- 397,402 ---- char dot_not_addr[INET_ADDR_LEN]; + __DEBUG (sns_comm_debug &1,ISNSSendMsg_TCP); + SNSConvertPayloadHTON(&p_md->msg); *************** *** 419,422 **** --- 421,425 ---- } + __DEBUG (sns_comm_debug &1,ISNSSendMsg_TCP finished); return (SUCCESS); } Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNSLinux.c 23 Aug 2007 02:50:20 -0000 1.14 --- iSNSLinux.c 23 Aug 2007 20:02:11 -0000 1.15 *************** *** 211,216 **** } ! rc = mkdir("/var/opt/isns",0777); ! rc = chdir("/var/opt/isns"); if (daemon_state == TRUE) --- 211,216 ---- } ! rc = mkdir("/var/isns",0777); ! rc = chdir("/var/isns"); if (daemon_state == TRUE) Index: iSNStrcv.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNStrcv.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNStrcv.c 23 Aug 2007 02:50:21 -0000 1.7 --- iSNStrcv.c 23 Aug 2007 20:02:11 -0000 1.8 *************** *** 227,237 **** /* Parse Msg */ ! while (pending>=sizeof(SNS_Msg_Hdr)) { p_msg=(struct sns_msg_hdr *)&buffer[startIndex]; msg_size=sizeof(SNS_Msg_Hdr)+ntohs(p_msg->msg_len); ! if (pending<msg_size) break; p_msg->type = ntohs (p_msg->type); --- 227,242 ---- /* Parse Msg */ ! __DEBUG(sns_tcp_debug &1,"recvsize:%i pending:%i",i,pending); ! ! while ( pending >= sizeof(SNS_Msg_Hdr) ) { p_msg=(struct sns_msg_hdr *)&buffer[startIndex]; msg_size=sizeof(SNS_Msg_Hdr)+ntohs(p_msg->msg_len); ! if ( pending < msg_size) ! { ! __DEBUG(sns_tcp_debug &1,"pending:%i is less than msg_size:%i",pending,msg_size); break; + } p_msg->type = ntohs (p_msg->type); *************** *** 250,258 **** memcpy(&md.msg, p_msg, msg_size); ! __DEBUG(sns_tcp_debug &1, (TCP rcv size %d), msg_size); while (!sns_ready) { sleep(1); } SendIPCMessage(SNS_EP, (void *)&md, sizeof(SNS_Msg_Cb) + sizeof(SNS_Msg_Hdr) + p_msg->msg_len, 0); --- 255,264 ---- memcpy(&md.msg, p_msg, msg_size); ! __DEBUG(sns_tcp_debug &1, (ISNSPDU rcv size %d), msg_size); while (!sns_ready) { sleep(1); } + __DEBUG(sns_tcp_debug &1,SendIPCMessage msg_len:%i,p_msg->msg_len); SendIPCMessage(SNS_EP, (void *)&md, sizeof(SNS_Msg_Cb) + sizeof(SNS_Msg_Hdr) + p_msg->msg_len, 0); *************** *** 266,269 **** --- 272,285 ---- endIndex=0; } + else + { + __DEBUG(sns_tcp_debug &1,??? pending non-zero:%i,pending); + /* copy buffer from StartIndex begining of buffer with size of pending */ + memcpy(buffer, &buffer[startIndex], pending); + + /* set endIndex=pending set startIndex = 0 */ + endIndex = pending; + startIndex = 0; + } } |
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4250/src Modified Files: custom.c entity.c fcnode.c ifcp.c iscsi.c isns.c parse.c payloads.c portal.c util.c Log Message: move functions to correct modules Index: payloads.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/payloads.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** payloads.c 23 Aug 2007 02:50:20 -0000 1.6 --- payloads.c 23 Aug 2007 05:21:00 -0000 1.7 *************** *** 34,40 **** #include "comm.h" #include "util.h" ! #include "iscsi.h" ! #include "entity.h" ! #include "portal.h" static ISNS_CMD cmd; --- 34,38 ---- #include "comm.h" #include "util.h" ! #include "parse.h" static ISNS_CMD cmd; Index: portal.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/portal.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** portal.c 23 Aug 2007 04:00:52 -0000 1.11 --- portal.c 23 Aug 2007 05:21:00 -0000 1.12 *************** *** 34,37 **** --- 34,38 ---- #include "comm.h" #include "util.h" + #include "parse.h" static ISNS_CMD cmd; *************** *** 96,163 **** /***********************************************************************/ - /* Parses a portal response */ - /***********************************************************************/ - void - ParsePortalQuery (char *buffer) - { - ISNS_Attr *p_attr; - ISNS_HDR *pdu; - char *ptr; - - pdu = (struct isns_hdr *)buffer; - ptr = buffer + sizeof (ISNS_HDR) + 4; - while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) - { - p_attr = (struct ISNS_attr *)ptr; - p_attr->tag = htonl (p_attr->tag); - p_attr->len = htonl (p_attr->len); - switch (p_attr->tag) - { - case ISNS_PORTAL_IP: - { - struct in_addr ip; - printf ("---------------------------------\n"); - ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); - printf ("Portal IP : %s.\n", inet_ntoa (ip)); - } - break; - case ISNS_PORTAL_PORT: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Portal Port : %d.\n", p_attr->val.etype & 0xFFFF); - printf ("Portal Type : %s.\n", - p_attr->val.etype & 0x10000 ? "UDP" : "TCP"); - break; - case ISNS_PORTAL_SYM_NAME: - printf ("Portal Sym Name: %s\n",(char *)&p_attr->val); - break; - case ISNS_ENTITY_ID: - printf ("Entity ID : %s\n",(char *)&p_attr->val); - break; - case ISNS_ENTITY_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Entity Index: %d.\n", p_attr->val.etype); - break; - case ISNS_ESI_PORT: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("ESI/SCN UDP Port : %d.\n", p_attr->val.etype & 0xFFFF); - break; - case ISNS_ESI_INTERVAL: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("ESI Interval : %d.\n", p_attr->val.etype); - break; - case ISNS_PORTAL_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Portal Index: %d.\n", p_attr->val.etype); - break; - case ISNS_DELIMITER: - break; - default: - break; - } - ptr = (char *) ptr + p_attr->len + 8; - } - } - - /***********************************************************************/ /* Queries for portals */ /***********************************************************************/ --- 97,100 ---- Index: fcnode.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/fcnode.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fcnode.c 14 Aug 2007 03:43:55 -0000 1.4 --- fcnode.c 23 Aug 2007 05:21:00 -0000 1.5 *************** *** 34,37 **** --- 34,38 ---- #include "comm.h" #include "util.h" + #include "parse.h" extern int replaceFlag; Index: iscsi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/iscsi.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iscsi.c 23 Aug 2007 02:50:20 -0000 1.11 --- iscsi.c 23 Aug 2007 05:21:00 -0000 1.12 *************** *** 37,40 **** --- 37,41 ---- #include "comm.h" #include "util.h" + #include "parse.h" static ISNS_CMD cmd; /* Used for msgs */ *************** *** 373,460 **** } - /*********************************************** - This will parse the response msg from an iSCSI - query msg. - ***********************************************/ - void - ParseISCSIQuery (char *buffer) - { - ISNS_Attr *p_attr; - ISNS_HDR *pdu; - char *ptr; - - pdu = (struct isns_hdr *)buffer; - ptr = buffer + sizeof (ISNS_HDR) + 4 /* Error Code Length */; - - while (ptr < (char *) buffer + sizeof (ISNS_HDR) + pdu->len) - { - p_attr = (struct ISNS_attr *)ptr; - p_attr->tag = htonl (p_attr->tag); - p_attr->len = htonl (p_attr->len); - /*Attributes can come back in any order */ - switch (p_attr->tag) - { - case ISNS_ISCSI_NODE_ID: - printf ("---------------------------------\n"); - printf ("iSCSI ID : %s\n",(char *)&p_attr->val); - break; - case ISNS_ISCSI_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("iSCSI Index: %d\n", p_attr->val.etype); - break; - case ISNS_ISCSI_TYPE: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Type: %#x (", p_attr->val.etype); - if (p_attr->val.etype & 1) - printf ("Target"); - if (p_attr->val.etype & 2) - printf ("Initiator"); - printf (")\n"); - break; - case ISNS_ISCSI_ALIAS: - printf ("Alias : %s\n",(char *)&p_attr->val); - break; - case ISNS_DD_ID: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("DD ID : %d\n", p_attr->val.etype); - break; - case ISNS_ENTITY_ID: - printf ("Entity ID : %s\n",(char *)&p_attr->val); - break; - case ISNS_ENTITY_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Entity Idx : %d\n", p_attr->val.etype); - break; - case ISNS_PORTAL_IP: - { - struct in_addr ip; - ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); - printf ("Portal IP : %s.\n", inet_ntoa (ip)); - } - break; - case ISNS_PORTAL_PORT: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Portal Port : %d.\n", p_attr->val.etype & 0xFFFF); - printf ("Portal Type : %s.\n", - p_attr->val.etype & 0x10000 ? "UDP" : "TCP"); - break; - - case ISNS_PORTAL_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Portal Idx : %d\n", p_attr->val.etype); - break; - case ISNS_PROT_VER: - p_attr->val.ver.max = ntohs (p_attr->val.ver.max); - p_attr->val.ver.min = ntohs (p_attr->val.ver.min); - printf ("Version: Max=%d, Min=%d.\n", p_attr->val.ver.max, - p_attr->val.ver.min); - break; - default: - break; - } - ptr = (char *) ptr + p_attr->len + 8/* Size of tag and length fields*/; - } - } - /***************************************************** This will add an iSCSI node to a DD. --- 374,377 ---- Index: isns.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/isns.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** isns.c 23 Aug 2007 04:00:52 -0000 1.13 --- isns.c 23 Aug 2007 05:21:00 -0000 1.14 *************** *** 34,37 **** --- 34,38 ---- #include "comm.h" #include "util.h" + #include "parse.h" *************** *** 39,43 **** static ISNS_CMD cmd; /* Used by functions for msgs. */ - static int currentXid = 0; /* current XID */ int enableESIFlag; /* Set to non-zero when enable ESI reponse. */ --- 40,43 ---- *************** *** 54,82 **** - /* Generates a new transaction id (xid) */ - static int - GetXid (void) - { - currentXid++; - - return (currentXid); - - } - /*********************************************************************/ - /* Zeros out the message and puts a hdr in */ - /*********************************************************************/ - void - ISNSCreateHdr (ISNS_FUNC_ID func_id, ISNS_CMD * cmd, int b_size, int flags) - { - memset (cmd, 0, b_size); - cmd->hdr.len = 0; - cmd->hdr.flags = - htons ((short)(flags | ISNS_FLAG_FIRST_PDU | ISNS_FLAG_LAST_PDU | - ISNS_FLAG_SND_CLIENT)); - cmd->hdr.version = htons ((short)ISNSP_VERSION); - cmd->hdr.func_id = htons ((short)func_id); - cmd->hdr.xid = htons ((short)GetXid ()); - } - /*********************************************************************/ /* Same as ISNSCreateHdr() but also zeros out the src field */ --- 54,57 ---- *************** *** 91,236 **** /*********************************************************************/ - /* Appends an attribute to a msg. Does the necessary, byte - conversions */ - /*********************************************************************/ - void - ISNSAppendAttr (ISNS_CMD * cmd, ISNS_TAG tag, int len, char *ptr, int val) - { - ISNS_TLV_P tlvp = (ISNS_TLV_P)((char *) cmd + cmd->hdr.len + sizeof (ISNS_HDR)); - - /* Attr */ - tlvp->attrib_id = htonl (tag); - tlvp->attrib_len = htonl (len); - if (ptr != NULL) - memcpy (&tlvp->attrib_val, ptr, len); - else - { - switch (len) - { - case 0: - break; - case 2: - *(uint16_t *) & tlvp->attrib_val = htons ((short)val); - break; - case 4: - *(uint32_t *) & tlvp->attrib_val = htonl (val); - break; - default: - break; - } - } - cmd->hdr.len += ISNS_TAG_LEN + ISNS_LEN_LEN + len; - } - - /*********************************************************************/ - /* Appends the SRC field */ - /*********************************************************************/ - int - GetSrc (ISNS_CMD * p_cmd, int flags) - { - char cmdLine[256]; - int src_type; - - src_type = 0; - if (0 != GetInput (cmdLine,"SRC type", - "*1:Control Node 2:iSCSI Node 3:iFCP Node", sizeof (cmdLine))) - { - src_type = atoi (cmdLine); - } - - switch (src_type) - { - case 0: - ISNSAppendAttr (p_cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); - break; - - case 1: - if (0 == GetInput (cmdLine, "SRC: Control Node Id", "(none)",sizeof (cmdLine))) - { - printf ("***ERROR: You must enter an Node Id.\n"); - return (-1); - } - - ISNSAppendAttr (p_cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (cmdLine)),cmdLine, 0); - - break; - - case 2: - if (0 == GetInput (cmdLine, "SRC: iSCSI Node Id", "(none)", sizeof (cmdLine))) - { - printf ("***ERROR: You must enter an iSCSI Node Id.\n"); - return (-1); - } - - ISNSAppendAttr (p_cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (cmdLine)),cmdLine, 0); - - break; - - case 3: - if (0 == GetHexInput (cmdLine, "SRC: iFCP Node WWPN", NULL, sizeof (cmdLine))) - { - printf ("***ERROR: You must enter an iFCP Node WWPN.\n"); - return (-1); - } - ISNSAppendAttr (p_cmd, ISNS_PORT_NAME, 8, cmdLine, 0); - - break; - default: - return (-1); - } - - return (0); - } - - - /*********************************************************************/ - /* Parses a DDS Query */ - /*********************************************************************/ - void - ParseDDSQuery (char *buffer) - { - ISNS_Attr *p_attr; - ISNS_HDR *pdu; - char *ptr; - - pdu = (struct isns_hdr *)buffer; - ptr = buffer + sizeof (ISNS_HDR) + 4; - while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) - { - p_attr = (struct ISNS_attr *)ptr; - p_attr->tag = ntohl (p_attr->tag); - p_attr->len = ntohl (p_attr->len); - switch (p_attr->tag) - { - case ISNS_DDS_ID: - printf ("---------------------------------\n"); - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("DDS ID : %d\n", p_attr->val.etype); - break; - case ISNS_DDS_SYM_NAME: - printf ("DDS Sym Name : %s\n",(char *)&p_attr->val); - break; - case ISNS_DDS_STATUS: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Status: %s\n", p_attr->val.etype?"Active":"Disabled"); - break; - case ISNS_DD_ID: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf (" DD ID : %d\n", p_attr->val.etype); - break; - case ISNS_DD_SYM_NAME: - printf (" DD Sym Name : %s\n",(char *)&p_attr->val); - break; - case ISNS_DD_ACTIVE: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Status: %s\n", p_attr->val.etype?"Active":"Disabled"); - default: - break; - } - ptr = (char *) ptr + p_attr->len + 8; - } - } - - /*********************************************************************/ /* Queries for DDS */ /*********************************************************************/ --- 66,69 ---- *************** *** 299,360 **** ParseDDSQuery (buffer); } - /*********************************************************************/ - /* Parses a DD Query Response */ - /*********************************************************************/ - void - ParseDDQuery (char *buffer) - { - ISNS_Attr *p_attr; - ISNS_HDR *pdu; - char *ptr; - - pdu = (struct isns_hdr *)buffer; - ptr = buffer + sizeof (ISNS_HDR) + 4; - if (pdu->len > MAX_PAYLOAD_SIZE) - printf("ERROR pdu->len:%d\n",pdu->len); - - while (ptr < (buffer + sizeof (ISNS_HDR) + pdu->len) ) - { - p_attr = (struct ISNS_attr *)ptr; - p_attr->tag = ntohl (p_attr->tag); - p_attr->len = ntohl (p_attr->len); - switch (p_attr->tag) - { - case ISNS_DD_ID: - printf ("---------------------------------\n"); - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("DD ID : %d\n", p_attr->val.etype); - break; - case ISNS_DD_SYM_NAME: - printf ("DD Sym Name : %s\n",(char *)&p_attr->val); - break; - case ISNS_DDS_ID: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf (" DDS ID : %d\n", p_attr->val.etype); - break; - case ISNS_DDS_SYM_NAME: - printf (" DDS Sym Name : %s\n",(char *)&p_attr->val); - break; - case ISNS_DD_ISCSI_MEMBER_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf (" DD iSCSI Member Index : %d\n", p_attr->val.etype); - break; - case ISNS_DD_ISCSI_MEMBER: - printf (" DD iSCSI Member : %s\n",(char *)&p_attr->val); - break; - case ISNS_DD_IFCP_MEMBER: - { - char buffer2[256]; - memset (buffer2, 0, sizeof (buffer2)); - printf (" iFCP WWPN : %s\n", - HexToAscii ((char *)&p_attr->val, p_attr->len, buffer2)); - break; - } - default: - break; - } - ptr = (char *) ptr + p_attr->len + 8; - } - } /*********************************************************************/ --- 132,135 ---- *************** *** 428,431 **** --- 203,207 ---- ParseDDQuery (buffer); } + /*********************************************************************/ /* Registers DDS */ *************** *** 993,1041 **** /*********************************************************************/ - /* Parses an ESI */ - /*********************************************************************/ - void - ParseESI (char *buffer) - { - ISNS_Attr *p_attr; - ISNS_HDR *pdu; - char *ptr; - - printf ("Parsing ESI.\n"); - pdu = (struct isns_hdr *)buffer; - ptr = buffer + sizeof (ISNS_HDR); - pdu->len = htons (pdu->len); - while (ptr < (char *) buffer + sizeof (ISNS_HDR) + pdu->len) - { - p_attr = (struct ISNS_attr *)ptr; - p_attr->tag = ntohl (p_attr->tag); - p_attr->len = ntohl (p_attr->len); - switch (p_attr->tag) - { - case ISNS_ENTITY_ID: - printf ("---------------------------------\n"); - printf ("Entity ID : %s\n",(char *)&p_attr->val); - break; - case ISNS_PORTAL_IP: - { - struct in_addr ip; - ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); - printf ("Portal IP : %s.\n", inet_ntoa (ip)); - } - break; - case ISNS_PORTAL_PORT: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Portal Port : %d.\n", p_attr->val.etype & 0xFFFF); - printf ("Portal Port Type : %s.\n", - p_attr->val.etype & 0x10000 ? "UDP" : "TCP"); - break; - default: - break; - } - ptr = (char *) ptr + p_attr->len + 8; - } - } - - /*********************************************************************/ /* Sends an ESI response */ /*********************************************************************/ --- 769,772 ---- Index: util.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/util.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** util.c 2 Feb 2007 23:21:38 -0000 1.5 --- util.c 23 Aug 2007 05:21:00 -0000 1.6 *************** *** 276,279 **** --- 276,338 ---- } + /*********************************************************************/ + /* Get the =SRC field */ + /*********************************************************************/ + int + GetSrc (ISNS_CMD * p_cmd, int flags) + { + char cmdLine[256]; + int src_type; + + src_type = 0; + if (0 != GetInput (cmdLine,"SRC type", + "*1:Control Node 2:iSCSI Node 3:iFCP Node", sizeof (cmdLine))) + { + src_type = atoi (cmdLine); + } + + switch (src_type) + { + case 0: + ISNSAppendAttr (p_cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (CONTROL_NODE)),CONTROL_NODE, 0); + break; + + case 1: + if (0 == GetInput (cmdLine, "SRC: Control Node Id", "(none)",sizeof (cmdLine))) + { + printf ("***ERROR: You must enter an Node Id.\n"); + return (-1); + } + + ISNSAppendAttr (p_cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (cmdLine)),cmdLine, 0); + + break; + + case 2: + if (0 == GetInput (cmdLine, "SRC: iSCSI Node Id", "(none)", sizeof (cmdLine))) + { + printf ("***ERROR: You must enter an iSCSI Node Id.\n"); + return (-1); + } + + ISNSAppendAttr (p_cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (cmdLine)),cmdLine, 0); + + break; + + case 3: + if (0 == GetHexInput (cmdLine, "SRC: iFCP Node WWPN", NULL, sizeof (cmdLine))) + { + printf ("***ERROR: You must enter an iFCP Node WWPN.\n"); + return (-1); + } + ISNSAppendAttr (p_cmd, ISNS_PORT_NAME, 8, cmdLine, 0); + + break; + default: + return (-1); + } + + return (0); + } Index: entity.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/entity.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** entity.c 23 Aug 2007 04:00:52 -0000 1.11 --- entity.c 23 Aug 2007 05:21:00 -0000 1.12 *************** *** 34,37 **** --- 34,38 ---- #include "comm.h" #include "util.h" + #include "parse.h" *************** *** 85,152 **** /***********************************************************************/ - /* Parses an entity query response */ - /***********************************************************************/ - void - ParseEntityQuery (char *buffer) - { - ISNS_Attr *p_attr; - ISNS_HDR *pdu; - char *ptr; - - pdu = (struct isns_hdr *)buffer; - ptr = buffer + sizeof (ISNS_HDR) + 4; - while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) - { - p_attr = (struct ISNS_attr *)ptr; - p_attr->tag = htonl (p_attr->tag); - p_attr->len = htonl (p_attr->len); - switch (p_attr->tag) - { - case ISNS_ENTITY_ID: - printf ("---------------------------------\n"); - printf ("Entity ID : %s\n",(char *)&p_attr->val); - break; - case ISNS_ENTITY_TYPE: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Entity Type: %d\n", p_attr->val.etype); - break; - case ISNS_MGMT_IP: - { - struct in_addr ip; - ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); - printf ("Mgmt IP: %s.\n", inet_ntoa (ip)); - } - break; - case ISNS_TIMESTAMP: - { - time_t timevalue; - timevalue = ntohl (p_attr->val.timestamp.t_time); - printf ("TimeStamp: %s", ctime (&timevalue)); - break; - } - case ISNS_PROT_VER: - p_attr->val.ver.max = ntohs (p_attr->val.ver.max); - p_attr->val.ver.min = ntohs (p_attr->val.ver.min); - printf ("Version: Max=%d, Min=%d.\n", p_attr->val.ver.max, - p_attr->val.ver.min); - break; - case ISNS_ENTITY_PERIOD: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Period: %d secs.\n", p_attr->val.etype); - break; - case ISNS_ENTITY_IDX: - p_attr->val.etype = ntohl (p_attr->val.etype); - printf ("Entity Index: %d.\n", p_attr->val.etype); - break; - case ISNS_DELIMITER: - break; - default: - break; - } - ptr = (char *) ptr + p_attr->len + 8; - } - } - - /***********************************************************************/ /* Queries for entities */ /***********************************************************************/ --- 86,89 ---- Index: parse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/parse.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** parse.c 13 Aug 2007 22:56:44 -0000 1.8 --- parse.c 23 Aug 2007 05:21:00 -0000 1.9 *************** *** 32,37 **** --- 32,100 ---- ***********************************************************************/ #include "isns.h" + #include "util.h" #include "parse.h" + static int currentXid = 0; + + /* Generates a new transaction id (xid) */ + static int + GetXid (void) + { + currentXid++; + + return (currentXid); + + } + + /*********************************************************************/ + /* Zeros out the message and puts a hdr in */ + /*********************************************************************/ + void + ISNSCreateHdr (ISNS_FUNC_ID func_id, ISNS_CMD * cmd, int b_size, int flags) + { + memset (cmd, 0, b_size); + cmd->hdr.len = 0; + cmd->hdr.flags = + htons ((short)(flags | ISNS_FLAG_FIRST_PDU | ISNS_FLAG_LAST_PDU | + ISNS_FLAG_SND_CLIENT)); + cmd->hdr.version = htons ((short)ISNSP_VERSION); + cmd->hdr.func_id = htons ((short)func_id); + cmd->hdr.xid = htons ((short)GetXid ()); + } + + /*********************************************************************/ + /* Appends an attribute to a msg. Does the necessary, byte + conversions */ + /*********************************************************************/ + void + ISNSAppendAttr (ISNS_CMD * cmd, ISNS_TAG tag, int len, char *ptr, int val) + { + ISNS_TLV_P tlvp = (ISNS_TLV_P)((char *) cmd + cmd->hdr.len + sizeof (ISNS_HDR)); + + /* Attr */ + tlvp->attrib_id = htonl (tag); + tlvp->attrib_len = htonl (len); + if (ptr != NULL) + memcpy (&tlvp->attrib_val, ptr, len); + else + { + switch (len) + { + case 0: + break; + case 2: + *(uint16_t *) & tlvp->attrib_val = htons ((short)val); + break; + case 4: + *(uint32_t *) & tlvp->attrib_val = htonl (val); + break; + default: + break; + } + } + cmd->hdr.len += ISNS_TAG_LEN + ISNS_LEN_LEN + len; + } + + void ipaddrchar(void * ipaddrhex, void * ipaddrstr) { *************** *** 346,349 **** --- 409,780 ---- + /******************************************************************** + * Functions to parse and print query results + *********************************************************************/ + + /***********************************************************************/ + /* Parses an entity query response */ + /***********************************************************************/ + void + ParseEntityQuery (char *buffer) + { + ISNS_Attr *p_attr; + ISNS_HDR *pdu; + char *ptr; + + pdu = (struct isns_hdr *)buffer; + ptr = buffer + sizeof (ISNS_HDR) + 4; + while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) + { + p_attr = (struct ISNS_attr *)ptr; + p_attr->tag = htonl (p_attr->tag); + p_attr->len = htonl (p_attr->len); + switch (p_attr->tag) + { + case ISNS_ENTITY_ID: + printf ("---------------------------------\n"); + printf ("Entity ID : %s\n",(char *)&p_attr->val); + break; + case ISNS_ENTITY_TYPE: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Entity Type: %d\n", p_attr->val.etype); + break; + case ISNS_MGMT_IP: + { + struct in_addr ip; + ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); + printf ("Mgmt IP: %s.\n", inet_ntoa (ip)); + } + break; + case ISNS_TIMESTAMP: + { + time_t timevalue; + timevalue = ntohl (p_attr->val.timestamp.t_time); + printf ("TimeStamp: %s", ctime (&timevalue)); + break; + } + case ISNS_PROT_VER: + p_attr->val.ver.max = ntohs (p_attr->val.ver.max); + p_attr->val.ver.min = ntohs (p_attr->val.ver.min); + printf ("Version: Max=%d, Min=%d.\n", p_attr->val.ver.max, + p_attr->val.ver.min); + break; + case ISNS_ENTITY_PERIOD: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Period: %d secs.\n", p_attr->val.etype); + break; + case ISNS_ENTITY_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Entity Index: %d.\n", p_attr->val.etype); + break; + case ISNS_DELIMITER: + break; + default: + break; + } + ptr = (char *) ptr + p_attr->len + 8; + } + } + + /*********************************************** + This will parse the response msg from an iSCSI + query msg. + ***********************************************/ + void + ParseISCSIQuery (char *buffer) + { + ISNS_Attr *p_attr; + ISNS_HDR *pdu; + char *ptr; + + pdu = (struct isns_hdr *)buffer; + ptr = buffer + sizeof (ISNS_HDR) + 4 /* Error Code Length */; + + while (ptr < (char *) buffer + sizeof (ISNS_HDR) + pdu->len) + { + p_attr = (struct ISNS_attr *)ptr; + p_attr->tag = htonl (p_attr->tag); + p_attr->len = htonl (p_attr->len); + /*Attributes can come back in any order */ + switch (p_attr->tag) + { + case ISNS_ISCSI_NODE_ID: + printf ("---------------------------------\n"); + printf ("iSCSI ID : %s\n",(char *)&p_attr->val); + break; + case ISNS_ISCSI_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("iSCSI Index: %d\n", p_attr->val.etype); + break; + case ISNS_ISCSI_TYPE: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Type: %#x (", p_attr->val.etype); + if (p_attr->val.etype & 1) + printf ("Target"); + if (p_attr->val.etype & 2) + printf ("Initiator"); + printf (")\n"); + break; + case ISNS_ISCSI_ALIAS: + printf ("Alias : %s\n",(char *)&p_attr->val); + break; + case ISNS_DD_ID: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("DD ID : %d\n", p_attr->val.etype); + break; + case ISNS_ENTITY_ID: + printf ("Entity ID : %s\n",(char *)&p_attr->val); + break; + case ISNS_ENTITY_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Entity Idx : %d\n", p_attr->val.etype); + break; + case ISNS_PORTAL_IP: + { + struct in_addr ip; + ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); + printf ("Portal IP : %s.\n", inet_ntoa (ip)); + } + break; + case ISNS_PORTAL_PORT: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Portal Port : %d.\n", p_attr->val.etype & 0xFFFF); + printf ("Portal Type : %s.\n", + p_attr->val.etype & 0x10000 ? "UDP" : "TCP"); + break; + + case ISNS_PORTAL_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Portal Idx : %d\n", p_attr->val.etype); + break; + case ISNS_PROT_VER: + p_attr->val.ver.max = ntohs (p_attr->val.ver.max); + p_attr->val.ver.min = ntohs (p_attr->val.ver.min); + printf ("Version: Max=%d, Min=%d.\n", p_attr->val.ver.max, + p_attr->val.ver.min); + break; + default: + break; + } + ptr = (char *) ptr + p_attr->len + 8/* Size of tag and length fields*/; + } + } + + /***********************************************************************/ + /* Parses a portal response */ + /***********************************************************************/ + void + ParsePortalQuery (char *buffer) + { + ISNS_Attr *p_attr; + ISNS_HDR *pdu; + char *ptr; + + pdu = (struct isns_hdr *)buffer; + ptr = buffer + sizeof (ISNS_HDR) + 4; + while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) + { + p_attr = (struct ISNS_attr *)ptr; + p_attr->tag = htonl (p_attr->tag); + p_attr->len = htonl (p_attr->len); + switch (p_attr->tag) + { + case ISNS_PORTAL_IP: + { + struct in_addr ip; + printf ("---------------------------------\n"); + ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); + printf ("Portal IP : %s.\n", inet_ntoa (ip)); + } + break; + case ISNS_PORTAL_PORT: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Portal Port : %d.\n", p_attr->val.etype & 0xFFFF); + printf ("Portal Type : %s.\n", + p_attr->val.etype & 0x10000 ? "UDP" : "TCP"); + break; + case ISNS_PORTAL_SYM_NAME: + printf ("Portal Sym Name: %s\n",(char *)&p_attr->val); + break; + case ISNS_ENTITY_ID: + printf ("Entity ID : %s\n",(char *)&p_attr->val); + break; + case ISNS_ENTITY_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Entity Index: %d.\n", p_attr->val.etype); + break; + case ISNS_ESI_PORT: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("ESI/SCN UDP Port : %d.\n", p_attr->val.etype & 0xFFFF); + break; + case ISNS_ESI_INTERVAL: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("ESI Interval : %d.\n", p_attr->val.etype); + break; + case ISNS_PORTAL_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Portal Index: %d.\n", p_attr->val.etype); + break; + case ISNS_DELIMITER: + break; + default: + break; + } + ptr = (char *) ptr + p_attr->len + 8; + } + } + + + /*********************************************************************/ + /* Parses an ESI */ + /*********************************************************************/ + void + ParseESI (char *buffer) + { + ISNS_Attr *p_attr; + ISNS_HDR *pdu; + char *ptr; + + printf ("Parsing ESI.\n"); + pdu = (struct isns_hdr *)buffer; + ptr = buffer + sizeof (ISNS_HDR); + pdu->len = htons (pdu->len); + while (ptr < (char *) buffer + sizeof (ISNS_HDR) + pdu->len) + { + p_attr = (struct ISNS_attr *)ptr; + p_attr->tag = ntohl (p_attr->tag); + p_attr->len = ntohl (p_attr->len); + switch (p_attr->tag) + { + case ISNS_ENTITY_ID: + printf ("---------------------------------\n"); + printf ("Entity ID : %s\n",(char *)&p_attr->val); + break; + case ISNS_PORTAL_IP: + { + struct in_addr ip; + ip.s_addr = *(uint32_t *) ((char *) &p_attr->val + 12); + printf ("Portal IP : %s.\n", inet_ntoa (ip)); + } + break; + case ISNS_PORTAL_PORT: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Portal Port : %d.\n", p_attr->val.etype & 0xFFFF); + printf ("Portal Port Type : %s.\n", + p_attr->val.etype & 0x10000 ? "UDP" : "TCP"); + break; + default: + break; + } + ptr = (char *) ptr + p_attr->len + 8; + } + } + + /*********************************************************************/ + /* Parses a DDS Query */ + /*********************************************************************/ + void + ParseDDSQuery (char *buffer) + { + ISNS_Attr *p_attr; + ISNS_HDR *pdu; + char *ptr; + + pdu = (struct isns_hdr *)buffer; + ptr = buffer + sizeof (ISNS_HDR) + 4; + while (ptr < buffer + sizeof (ISNS_HDR) + pdu->len) + { + p_attr = (struct ISNS_attr *)ptr; + p_attr->tag = ntohl (p_attr->tag); + p_attr->len = ntohl (p_attr->len); + switch (p_attr->tag) + { + case ISNS_DDS_ID: + printf ("---------------------------------\n"); + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("DDS ID : %d\n", p_attr->val.etype); + break; + case ISNS_DDS_SYM_NAME: + printf ("DDS Sym Name : %s\n",(char *)&p_attr->val); + break; + case ISNS_DDS_STATUS: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Status: %s\n", p_attr->val.etype?"Active":"Disabled"); + break; + case ISNS_DD_ID: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf (" DD ID : %d\n", p_attr->val.etype); + break; + case ISNS_DD_SYM_NAME: + printf (" DD Sym Name : %s\n",(char *)&p_attr->val); + break; + case ISNS_DD_ACTIVE: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("Status: %s\n", p_attr->val.etype?"Active":"Disabled"); + default: + break; + } + ptr = (char *) ptr + p_attr->len + 8; + } + } + + /*********************************************************************/ + /* Parses a DD Query Response */ + /*********************************************************************/ + void + ParseDDQuery (char *buffer) + { + ISNS_Attr *p_attr; + ISNS_HDR *pdu; + char *ptr; + + pdu = (struct isns_hdr *)buffer; + ptr = buffer + sizeof (ISNS_HDR) + 4; + if (pdu->len > MAX_PAYLOAD_SIZE) + printf("ERROR pdu->len:%d\n",pdu->len); + + while (ptr < (buffer + sizeof (ISNS_HDR) + pdu->len) ) + { + p_attr = (struct ISNS_attr *)ptr; + p_attr->tag = ntohl (p_attr->tag); + p_attr->len = ntohl (p_attr->len); + switch (p_attr->tag) + { + case ISNS_DD_ID: + printf ("---------------------------------\n"); + p_attr->val.etype = ntohl (p_attr->val.etype); + printf ("DD ID : %d\n", p_attr->val.etype); + break; + case ISNS_DD_SYM_NAME: + printf ("DD Sym Name : %s\n",(char *)&p_attr->val); + break; + case ISNS_DDS_ID: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf (" DDS ID : %d\n", p_attr->val.etype); + break; + case ISNS_DDS_SYM_NAME: + printf (" DDS Sym Name : %s\n",(char *)&p_attr->val); + break; + case ISNS_DD_ISCSI_MEMBER_IDX: + p_attr->val.etype = ntohl (p_attr->val.etype); + printf (" DD iSCSI Member Index : %d\n", p_attr->val.etype); + break; + case ISNS_DD_ISCSI_MEMBER: + printf (" DD iSCSI Member : %s\n",(char *)&p_attr->val); + break; + case ISNS_DD_IFCP_MEMBER: + { + char buffer2[256]; + memset (buffer2, 0, sizeof (buffer2)); + printf (" iFCP WWPN : %s\n", + HexToAscii ((char *)&p_attr->val, p_attr->len, buffer2)); + break; + } + default: + break; + } + ptr = (char *) ptr + p_attr->len + 8; + } + } Index: custom.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/custom.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** custom.c 2 Apr 2002 20:56:54 -0000 1.2 --- custom.c 23 Aug 2007 05:21:00 -0000 1.3 *************** *** 45,48 **** --- 45,49 ---- #include "util.h" #include "comm.h" + #include "parse.h" #include "custom.h" Index: ifcp.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/ifcp.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ifcp.c 14 Aug 2007 03:43:55 -0000 1.5 --- ifcp.c 23 Aug 2007 05:21:00 -0000 1.6 *************** *** 34,37 **** --- 34,38 ---- #include "comm.h" #include "util.h" + #include "parse.h" |
From: Robert W. <wrw...@us...> - 2007-08-23 05:21:04
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4250/include Modified Files: entity.h iscsi.h isns.h parse.h portal.h util.h Log Message: move functions to correct modules Index: iscsi.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/iscsi.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iscsi.h 2 Apr 2002 20:56:54 -0000 1.2 --- iscsi.h 23 Aug 2007 05:21:00 -0000 1.3 *************** *** 44,49 **** void DeRegisterISCSI(void); - void ParseISCSIQuery(char *buffer); - void GetISCSI(void); --- 44,47 ---- Index: portal.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/portal.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** portal.h 2 Apr 2002 20:56:54 -0000 1.2 --- portal.h 23 Aug 2007 05:21:00 -0000 1.3 *************** *** 36,41 **** void DeRegisterPortal(void); - void ParsePortalQuery(char *buffer); - void GetPortals(void); --- 36,39 ---- Index: util.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/util.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** util.h 2 Apr 2002 20:56:54 -0000 1.2 --- util.h 23 Aug 2007 05:21:00 -0000 1.3 *************** *** 56,59 **** --- 56,61 ---- int GetCommand(void); + int GetSrc(ISNS_CMD *p_cmd, int flags); + #endif Index: isns.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/isns.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** isns.h 13 Aug 2007 22:56:44 -0000 1.5 --- isns.h 23 Aug 2007 05:21:00 -0000 1.6 *************** *** 212,229 **** #define ISNSP_VERSION 1 - void ISNSCreateHdr(ISNS_FUNC_ID func_id, ISNS_CMD *cmd, int b_size, int flags); - void ISNSInsertQryHdr(ISNS_FUNC_ID func_id, ISNS_CMD *cmd); - void ISNSAppendAttr(ISNS_CMD *cmd, ISNS_TAG tag, int len, char *ptr, int val); - - int GetSrc(ISNS_CMD *p_cmd, int flags); - - void ParseDDSQuery(char *buffer); - void GetDDS(void); - void ParseDDQuery(char *buffer); - void GetDD(void); --- 212,219 ---- *************** *** 252,257 **** void Send_SCN_Event(void); - void ParseESI(char *buffer); - int Send_ESI_Response(ISNS_CMD *p_cmd, int size); --- 242,245 ---- Index: parse.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/parse.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** parse.h 2 Apr 2002 20:56:54 -0000 1.2 --- parse.h 23 Aug 2007 05:21:00 -0000 1.3 *************** *** 35,48 **** #define __PARSE_H void ipaddrchar(void * ipaddrhex, void * ipaddrstr); char * FuncIDText (uint16_t funcid); - char * isnsTagText (uint32_t tagid); - char * errorText(int errorCode); ! void ! ParsePDU (char *buffer); #endif --- 35,55 ---- #define __PARSE_H + void ISNSCreateHdr(ISNS_FUNC_ID func_id, ISNS_CMD *cmd, int b_size, int flags); + void ISNSAppendAttr(ISNS_CMD *cmd, ISNS_TAG tag, int len, char *ptr, int val); + void ipaddrchar(void * ipaddrhex, void * ipaddrstr); char * FuncIDText (uint16_t funcid); char * isnsTagText (uint32_t tagid); char * errorText(int errorCode); ! void ParsePDU (char *buffer); ! ! void ParseEntityQuery (char *buffer); ! void ParseISCSIQuery (char *buffer); ! void ParsePortalQuery (char *buffer); ! void ParseESI (char *buffer); ! void ParseDDQuery (char *buffer); ! void ParseDDSQuery (char *buffer); #endif Index: entity.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/include/entity.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** entity.h 2 Apr 2002 20:56:54 -0000 1.2 --- entity.h 23 Aug 2007 05:21:00 -0000 1.3 *************** *** 36,41 **** void DeRegisterEntity(void); - void ParseEntityQuery(char *buffer); - void GetEntities(void); --- 36,39 ---- |
From: Robert W. <wrw...@us...> - 2007-08-23 04:00:59
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30868/isnsclient/src Modified Files: entity.c isns.c portal.c Log Message: fixed dd query returning incorrect MEMBER_IDX tags Index: isns.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/isns.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** isns.c 23 Aug 2007 02:50:20 -0000 1.12 --- isns.c 23 Aug 2007 04:00:52 -0000 1.13 *************** *** 134,138 **** src_type = 0; if (0 != GetInput (cmdLine,"SRC type", ! "*Default Control Node *1:Control Node 2:iSCSI Node 3:iFCP Node", sizeof (cmdLine))) { src_type = atoi (cmdLine); --- 134,138 ---- src_type = 0; if (0 != GetInput (cmdLine,"SRC type", ! "*1:Control Node 2:iSCSI Node 3:iFCP Node", sizeof (cmdLine))) { src_type = atoi (cmdLine); Index: portal.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/portal.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** portal.c 14 Aug 2007 03:43:55 -0000 1.10 --- portal.c 23 Aug 2007 04:00:52 -0000 1.11 *************** *** 245,251 **** --- 245,255 ---- break; default: + ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 0, NULL, 0); break; } } + else + ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 0, NULL, 0); + ISNSAppendAttr (&cmd, 0, 0, NULL, 0); Index: entity.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/entity.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** entity.c 23 Aug 2007 02:50:20 -0000 1.10 --- entity.c 23 Aug 2007 04:00:52 -0000 1.11 *************** *** 159,162 **** --- 159,163 ---- ISNS_CMD cmd; int key_type = 0; + int added = FALSE; printf ("Query For Entities.\n"); *************** *** 192,197 **** --- 193,200 ---- ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (cmdLine)), cmdLine, 0); + added = TRUE; } else + if (!added) ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, 0, NULL, 0); |
From: Robert W. <wrw...@us...> - 2007-08-23 04:00:59
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30868/isnsserver/src Modified Files: iSNSquery.c Log Message: fixed dd query returning incorrect MEMBER_IDX tags Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** iSNSquery.c 23 Aug 2007 02:50:20 -0000 1.25 --- iSNSquery.c 23 Aug 2007 04:00:52 -0000 1.26 *************** *** 2661,2674 **** p_member=(SOIP_Dd_Member *)GetNodeData(pnode); if (p_member->type == ISNS_DD_ISCSI_MEMBER) ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (p_member->node_id)), p_member->node_id, 0); ! ! index_Flag = ISNSFindTag (0, ISNS_DD_ISCSI_MEMBER_IDX, attr_indx); ! if (index_Flag != -1 ) ! if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, NULL, p_member->node_idx); } break; --- 2661,2675 ---- p_member=(SOIP_Dd_Member *)GetNodeData(pnode); if (p_member->type == ISNS_DD_ISCSI_MEMBER) + { ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (p_member->node_id)), p_member->node_id, 0); ! index_Flag = ISNSFindTag (0, ISNS_DD_ISCSI_MEMBER_IDX, attr_indx); ! if (index_Flag != -1 ) ! if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, NULL, p_member->node_idx); + } } break; *************** *** 2679,2691 **** p_member=(SOIP_Dd_Member *)GetNodeData(pnode); if (p_member->type == ISNS_DD_IFCP_MEMBER) ISNSAppendAttr (p_msg, ISNS_DD_IFCP_MEMBER, ISNS_PORT_NAME_SIZE, p_member->node_id, 0); ! index_Flag = ISNSFindTag (0, ISNS_DD_ISCSI_MEMBER_IDX, attr_indx); ! if (index_Flag != -1 ) ! if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, NULL, p_member->node_idx); } break; --- 2680,2694 ---- p_member=(SOIP_Dd_Member *)GetNodeData(pnode); if (p_member->type == ISNS_DD_IFCP_MEMBER) + { ISNSAppendAttr (p_msg, ISNS_DD_IFCP_MEMBER, ISNS_PORT_NAME_SIZE, p_member->node_id, 0); ! index_Flag = ISNSFindTag (0, ISNS_DD_ISCSI_MEMBER_IDX, attr_indx); ! if (index_Flag != -1 ) ! if (p_member->type == ISNS_DD_ISCSI_MEMBER) ! ISNSAppendAttr (p_msg, ISNS_DD_ISCSI_MEMBER_IDX, ISNS_DD_ISCSI_MEMBER_IDX_SIZE, NULL, p_member->node_idx); + } } break; *************** *** 3060,3063 **** --- 3063,3068 ---- ISNS_Attr *q_attr; + __DEBUG (isns_query_debug &1, ISNSdbProcessEntityOpAttr); + for (ii = 0; ii < MAX_PARSE_ATTRS && attr_indx[ii]; ii++) { |