Re: [PATCH untested] iscsi_tcp: Neat picking on code to make it more clear

2008-12-10 Thread Boaz Harrosh

Mike Christie wrote:
 Boaz Harrosh wrote:
 A buffer following an header, in case of a linear allocation
 can be get at by simply doing header_pointer + 1;
 
 I got this part, and it looks nicer.
 
 
 In any way below code loads a local pointer which is never used.
 
 I did not get this part. Do you mean task-hdr is never used? 

Sorry, I meant tcp_task is never used. See below: 

 Also are 
 you saying tcp_task + 1 and task-dd_data + sizeof(*tcp_task) give 
 different values?
 

The current code is fine. Just that I stumbled on it to understand
what's going on.

 
 Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
 ---
  drivers/scsi/iscsi_tcp.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
 index 8685a33..4cfc85a 100644
 --- a/drivers/scsi/iscsi_tcp.c
 +++ b/drivers/scsi/iscsi_tcp.c
 @@ -462,7 +462,7 @@ static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task 
 *task, uint8_t opcode)
  {
  struct iscsi_tcp_task *tcp_task = task-dd_data;
  
 -task-hdr = task-dd_data + sizeof(*tcp_task);

The sizeof(*tcp_task) does not actually use the value of tcp_task and it is
not used elsewhere.

 +task-hdr = tcp_task + 1;
  task-hdr_max = sizeof(struct iscsi_sw_tcp_hdrbuf) - ISCSI_DIGEST_SIZE;
  return 0;
  }
 
 

Boaz

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



Re: [PATCH untested] iscsi_tcp: Neat picking on code to make it more clear

2008-12-10 Thread Mike Christie

Boaz Harrosh wrote:
 Mike Christie wrote:
 Boaz Harrosh wrote:
 A buffer following an header, in case of a linear allocation
 can be get at by simply doing header_pointer + 1;
 I got this part, and it looks nicer.


 In any way below code loads a local pointer which is never used.
 I did not get this part. Do you mean task-hdr is never used? 
 
 Sorry, I meant tcp_task is never used. See below: 
 
 Also are 
 you saying tcp_task + 1 and task-dd_data + sizeof(*tcp_task) give 
 different values?

 
 The current code is fine. Just that I stumbled on it to understand
 what's going on.

ah ok. I am doing a patch to update all the callout and other comments 
now. I forgot to send it before. It should help in the future. Sorry I 
did not do it earlier to help you now.

 
 Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
 ---
  drivers/scsi/iscsi_tcp.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
 index 8685a33..4cfc85a 100644
 --- a/drivers/scsi/iscsi_tcp.c
 +++ b/drivers/scsi/iscsi_tcp.c
 @@ -462,7 +462,7 @@ static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task 
 *task, uint8_t opcode)
  {
 struct iscsi_tcp_task *tcp_task = task-dd_data;
  
 -   task-hdr = task-dd_data + sizeof(*tcp_task);
 
 The sizeof(*tcp_task) does not actually use the value of tcp_task and it is
 not used elsewhere.


Ah yeah, it is weird. I tested your patch and will send it with some 
qla4xxx fixups I have.

Thanks.


 
 +   task-hdr = tcp_task + 1;
 task-hdr_max = sizeof(struct iscsi_sw_tcp_hdrbuf) - ISCSI_DIGEST_SIZE;
 return 0;
  }

 
 Boaz
 
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH untested] iscsi_tcp: Neat picking on code to make it more clear

2008-12-09 Thread Boaz Harrosh


A buffer following an header, in case of a linear allocation
can be get at by simply doing header_pointer + 1;
In any way below code loads a local pointer which is never used.

Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/iscsi_tcp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 8685a33..4cfc85a 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -462,7 +462,7 @@ static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, 
uint8_t opcode)
 {
struct iscsi_tcp_task *tcp_task = task-dd_data;
 
-   task-hdr = task-dd_data + sizeof(*tcp_task);
+   task-hdr = tcp_task + 1;
task-hdr_max = sizeof(struct iscsi_sw_tcp_hdrbuf) - ISCSI_DIGEST_SIZE;
return 0;
 }
-- 
1.6.0.1


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---