Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Dmitry Yusupov
On Mon, 2005-04-11 at 22:35 -0700, Greg KH wrote:
> On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
> > +typedef uint64_t iscsi_snx_t;  /* iSCSI Data-Path session 
> > handle */
> > +typedef uint64_t iscsi_cnx_t;  /* iSCSI Data-Path connection 
> > handle */
> 
> Do you really have to create a new typedef?  Please reconsider.  Just
> use u64 everywhere, unless you need to do type checking...

it is a handle and it is used as a parameter in exported API. yes. type
checking exactly the reason.

Dima


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Christoph Hellwig
On Tue, Apr 12, 2005 at 12:45:14AM -0700, Greg KH wrote:
> Um, why?  We've been down this road before, and for types that cross the
> boundry, we _must_ use the __ version of the kernel types, not the
> uint32_t stuff.

That's total bullshit.  C99 types just work in both the kernel and userland,
while __u* types need to be typedefed to these exact C99 everywhere in
userland bnecause they're only provided in kernelspace.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Greg KH
On Tue, Apr 12, 2005 at 08:27:33AM +0100, Christoph Hellwig wrote:
> On Mon, Apr 11, 2005 at 10:36:51PM -0700, Greg KH wrote:
> > On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
> > >   Common header files:
> > >   - iscsi_ifev.h (user/kernel events).
> > 
> > These structures cross the user/kernel boundry?  If so, they _must_ use
> > the __u32 and friends types, not the horrible uint32_t mess...
> 
> No, C99 are just fine.

Um, why?  We've been down this road before, and for types that cross the
boundry, we _must_ use the __ version of the kernel types, not the
uint32_t stuff.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Christoph Hellwig
On Mon, Apr 11, 2005 at 10:36:51PM -0700, Greg KH wrote:
> On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
> >   Common header files:
> >   - iscsi_ifev.h (user/kernel events).
> 
> These structures cross the user/kernel boundry?  If so, they _must_ use
> the __u32 and friends types, not the horrible uint32_t mess...

No, C99 are just fine.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Christoph Hellwig
On Mon, Apr 11, 2005 at 10:36:51PM -0700, Greg KH wrote:
 On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
Common header files:
- iscsi_ifev.h (user/kernel events).
 
 These structures cross the user/kernel boundry?  If so, they _must_ use
 the __u32 and friends types, not the horrible uint32_t mess...

No, C99 are just fine.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Greg KH
On Tue, Apr 12, 2005 at 08:27:33AM +0100, Christoph Hellwig wrote:
 On Mon, Apr 11, 2005 at 10:36:51PM -0700, Greg KH wrote:
  On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
 Common header files:
 - iscsi_ifev.h (user/kernel events).
  
  These structures cross the user/kernel boundry?  If so, they _must_ use
  the __u32 and friends types, not the horrible uint32_t mess...
 
 No, C99 are just fine.

Um, why?  We've been down this road before, and for types that cross the
boundry, we _must_ use the __ version of the kernel types, not the
uint32_t stuff.

thanks,

greg k-h
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Christoph Hellwig
On Tue, Apr 12, 2005 at 12:45:14AM -0700, Greg KH wrote:
 Um, why?  We've been down this road before, and for types that cross the
 boundry, we _must_ use the __ version of the kernel types, not the
 uint32_t stuff.

That's total bullshit.  C99 types just work in both the kernel and userland,
while __u* types need to be typedefed to these exact C99 everywhere in
userland bnecause they're only provided in kernelspace.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-12 Thread Dmitry Yusupov
On Mon, 2005-04-11 at 22:35 -0700, Greg KH wrote:
 On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
  +typedef uint64_t iscsi_snx_t;  /* iSCSI Data-Path session 
  handle */
  +typedef uint64_t iscsi_cnx_t;  /* iSCSI Data-Path connection 
  handle */
 
 Do you really have to create a new typedef?  Please reconsider.  Just
 use u64 everywhere, unless you need to do type checking...

it is a handle and it is used as a parameter in exported API. yes. type
checking exactly the reason.

Dima


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Greg KH
On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
>   Common header files:
>   - iscsi_ifev.h (user/kernel events).

These structures cross the user/kernel boundry?  If so, they _must_ use
the __u32 and friends types, not the horrible uint32_t mess...

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Greg KH
> +struct iscsi_hdr {
> + uint8_t opcode;
> + uint8_t flags;  /* Final bit */
> + uint8_t rsvd2[2];
> + uint8_t hlength;/* AHSs total length */
> + uint8_t dlength[3]; /* Data length */
> + uint8_t lun[8];
> + uint32_titt;/* Initiator Task Tag */
> + uint32_tttt;/* Target Task Tag */
> + uint32_tstatsn;
> + uint32_texp_statsn;
> + uint8_t other[16];

Please use u8 and u32 instead of the types you used here.  See the lkml
archives for many threads about this topic.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Greg KH
On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
> +typedef uint64_t iscsi_snx_t;/* iSCSI Data-Path session 
> handle */
> +typedef uint64_t iscsi_cnx_t;/* iSCSI Data-Path connection 
> handle */

Do you really have to create a new typedef?  Please reconsider.  Just
use u64 everywhere, unless you need to do type checking...

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Alex Aizman
  Common header files:
  - iscsi_ifev.h (user/kernel events).
  - iscsi_if.h (user/kernel #defines);
  - iscsi_iftrans.h (iscsi transport interface);
  - iscsi_proto.h (RFC3720 #defines and types).
  Signed-off-by: Alex Aizman <[EMAIL PROTECTED]>
  Signed-off-by: Dmitry Yusupov <[EMAIL PROTECTED]>






diff -Nru linux-2.6.12-rc2.orig/include/scsi/iscsi_ifev.h 
linux-2.6.12-rc2.dima/include/scsi/iscsi_ifev.h
--- linux-2.6.12-rc2.orig/include/scsi/iscsi_ifev.h 1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.12-rc2.dima/include/scsi/iscsi_ifev.h 2005-04-11 
18:13:12.0 -0700
@@ -0,0 +1,118 @@
+/*
+ * iSCSI Kernel/User Interface Events
+ *
+ * Copyright (C) 2005 Dmitry Yusupov, Alex Aizman
+ * maintained by [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+
+#ifndef ISCSI_IFEV_H
+#define ISCSI_IFEV_H
+
+enum iscsi_uevent_e {
+   ISCSI_UEVENT_UNKNOWN= 0,
+
+   /* down events */
+   ISCSI_UEVENT_CREATE_SESSION = UEVENT_BASE + 1,
+   ISCSI_UEVENT_DESTROY_SESSION= UEVENT_BASE + 2,
+   ISCSI_UEVENT_CREATE_CNX = UEVENT_BASE + 3,
+   ISCSI_UEVENT_DESTROY_CNX= UEVENT_BASE + 4,
+   ISCSI_UEVENT_BIND_CNX   = UEVENT_BASE + 5,
+   ISCSI_UEVENT_SET_PARAM  = UEVENT_BASE + 6,
+   ISCSI_UEVENT_START_CNX  = UEVENT_BASE + 7,
+   ISCSI_UEVENT_STOP_CNX   = UEVENT_BASE + 8,
+   ISCSI_UEVENT_SEND_PDU   = UEVENT_BASE + 9,
+   ISCSI_UEVENT_TRANS_LIST = UEVENT_BASE + 10,
+
+   /* up events */
+   ISCSI_KEVENT_RECV_PDU   = KEVENT_BASE + 1,
+   ISCSI_KEVENT_CNX_ERROR  = KEVENT_BASE + 2,
+   ISCSI_KEVENT_IF_ERROR   = KEVENT_BASE + 3,
+};
+
+struct iscsi_uevent {
+   uint32_t type; /* k/u events type */
+   uint32_t iferror; /* carries interface or resource errors */
+   uint64_t transport_handle;
+
+   union {
+   /* messages u -> k */
+   struct msg_create_session {
+   uint64_tsession_handle;
+   uint32_tinitial_cmdsn;
+   } c_session;
+   struct msg_destroy_session {
+   uint64_tsession_handle;
+   uint32_tsid;
+   } d_session;
+   struct msg_create_cnx {
+   uint64_tsession_handle;
+   uint64_tcnx_handle;
+   uint32_tcid;
+   uint32_tsid;
+   } c_cnx;
+   struct msg_bind_cnx {
+   uint64_tsession_handle;
+   uint64_tcnx_handle;
+   uint32_ttransport_fd;
+   uint32_tis_leading;
+   } b_cnx;
+   struct msg_destroy_cnx {
+   uint64_tcnx_handle;
+   uint32_tcid;
+   } d_cnx;
+   struct msg_send_pdu {
+   uint32_thdr_size;
+   uint32_tdata_size;
+   uint64_tcnx_handle;
+   } send_pdu;
+   struct msg_set_param {
+   uint64_tcnx_handle;
+   uint32_tparam; /* enum iscsi_param */
+   uint32_tvalue;
+   } set_param;
+   struct msg_start_cnx {
+   uint64_tcnx_handle;
+   } start_cnx;
+   struct msg_stop_cnx {
+   uint64_tcnx_handle;
+   uint32_tflag;
+   } stop_cnx;
+   } u;
+   union {
+   /* messages k -> u */
+   uint64_thandle;
+   int retcode;
+   struct msg_create_session_ret {
+   uint64_thandle;
+   uint32_tsid;
+   } c_session_ret;
+   struct msg_recv_req {
+   uint64_trecv_handle;
+   uint64_tcnx_handle;
+   } recv_req;
+   struct msg_cnx_error {
+   uint64_t

[ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Alex Aizman
  Common header files:
  - iscsi_ifev.h (user/kernel events).
  - iscsi_if.h (user/kernel #defines);
  - iscsi_iftrans.h (iscsi transport interface);
  - iscsi_proto.h (RFC3720 #defines and types).
  Signed-off-by: Alex Aizman [EMAIL PROTECTED]
  Signed-off-by: Dmitry Yusupov [EMAIL PROTECTED]






diff -Nru linux-2.6.12-rc2.orig/include/scsi/iscsi_ifev.h 
linux-2.6.12-rc2.dima/include/scsi/iscsi_ifev.h
--- linux-2.6.12-rc2.orig/include/scsi/iscsi_ifev.h 1969-12-31 
16:00:00.0 -0800
+++ linux-2.6.12-rc2.dima/include/scsi/iscsi_ifev.h 2005-04-11 
18:13:12.0 -0700
@@ -0,0 +1,118 @@
+/*
+ * iSCSI Kernel/User Interface Events
+ *
+ * Copyright (C) 2005 Dmitry Yusupov, Alex Aizman
+ * maintained by [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+
+#ifndef ISCSI_IFEV_H
+#define ISCSI_IFEV_H
+
+enum iscsi_uevent_e {
+   ISCSI_UEVENT_UNKNOWN= 0,
+
+   /* down events */
+   ISCSI_UEVENT_CREATE_SESSION = UEVENT_BASE + 1,
+   ISCSI_UEVENT_DESTROY_SESSION= UEVENT_BASE + 2,
+   ISCSI_UEVENT_CREATE_CNX = UEVENT_BASE + 3,
+   ISCSI_UEVENT_DESTROY_CNX= UEVENT_BASE + 4,
+   ISCSI_UEVENT_BIND_CNX   = UEVENT_BASE + 5,
+   ISCSI_UEVENT_SET_PARAM  = UEVENT_BASE + 6,
+   ISCSI_UEVENT_START_CNX  = UEVENT_BASE + 7,
+   ISCSI_UEVENT_STOP_CNX   = UEVENT_BASE + 8,
+   ISCSI_UEVENT_SEND_PDU   = UEVENT_BASE + 9,
+   ISCSI_UEVENT_TRANS_LIST = UEVENT_BASE + 10,
+
+   /* up events */
+   ISCSI_KEVENT_RECV_PDU   = KEVENT_BASE + 1,
+   ISCSI_KEVENT_CNX_ERROR  = KEVENT_BASE + 2,
+   ISCSI_KEVENT_IF_ERROR   = KEVENT_BASE + 3,
+};
+
+struct iscsi_uevent {
+   uint32_t type; /* k/u events type */
+   uint32_t iferror; /* carries interface or resource errors */
+   uint64_t transport_handle;
+
+   union {
+   /* messages u - k */
+   struct msg_create_session {
+   uint64_tsession_handle;
+   uint32_tinitial_cmdsn;
+   } c_session;
+   struct msg_destroy_session {
+   uint64_tsession_handle;
+   uint32_tsid;
+   } d_session;
+   struct msg_create_cnx {
+   uint64_tsession_handle;
+   uint64_tcnx_handle;
+   uint32_tcid;
+   uint32_tsid;
+   } c_cnx;
+   struct msg_bind_cnx {
+   uint64_tsession_handle;
+   uint64_tcnx_handle;
+   uint32_ttransport_fd;
+   uint32_tis_leading;
+   } b_cnx;
+   struct msg_destroy_cnx {
+   uint64_tcnx_handle;
+   uint32_tcid;
+   } d_cnx;
+   struct msg_send_pdu {
+   uint32_thdr_size;
+   uint32_tdata_size;
+   uint64_tcnx_handle;
+   } send_pdu;
+   struct msg_set_param {
+   uint64_tcnx_handle;
+   uint32_tparam; /* enum iscsi_param */
+   uint32_tvalue;
+   } set_param;
+   struct msg_start_cnx {
+   uint64_tcnx_handle;
+   } start_cnx;
+   struct msg_stop_cnx {
+   uint64_tcnx_handle;
+   uint32_tflag;
+   } stop_cnx;
+   } u;
+   union {
+   /* messages k - u */
+   uint64_thandle;
+   int retcode;
+   struct msg_create_session_ret {
+   uint64_thandle;
+   uint32_tsid;
+   } c_session_ret;
+   struct msg_recv_req {
+   uint64_trecv_handle;
+   uint64_tcnx_handle;
+   } recv_req;
+   struct msg_cnx_error {
+   uint64_tcnx_handle;

Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Greg KH
 +struct iscsi_hdr {
 + uint8_t opcode;
 + uint8_t flags;  /* Final bit */
 + uint8_t rsvd2[2];
 + uint8_t hlength;/* AHSs total length */
 + uint8_t dlength[3]; /* Data length */
 + uint8_t lun[8];
 + uint32_titt;/* Initiator Task Tag */
 + uint32_tttt;/* Target Task Tag */
 + uint32_tstatsn;
 + uint32_texp_statsn;
 + uint8_t other[16];

Please use u8 and u32 instead of the types you used here.  See the lkml
archives for many threads about this topic.

thanks,

greg k-h
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Greg KH
On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
 +typedef uint64_t iscsi_snx_t;/* iSCSI Data-Path session 
 handle */
 +typedef uint64_t iscsi_cnx_t;/* iSCSI Data-Path connection 
 handle */

Do you really have to create a new typedef?  Please reconsider.  Just
use u64 everywhere, unless you need to do type checking...

thanks,

greg k-h
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ANNOUNCE 2/6] Linux-iSCSI High-Performance Initiator

2005-04-11 Thread Greg KH
On Mon, Apr 11, 2005 at 08:24:08PM -0700, Alex Aizman wrote:
   Common header files:
   - iscsi_ifev.h (user/kernel events).

These structures cross the user/kernel boundry?  If so, they _must_ use
the __u32 and friends types, not the horrible uint32_t mess...

thanks,

greg k-h
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/