Re: [PATCH 2/2] RFC: iscsi ibft: convert iscsi_ibft module to iscsi boot lib

2010-04-13 Thread Konrad Rzeszutek Wilk
On Monday 12 April 2010 14:06:18 you wrote:
 From: Mike Christie micha...@cs.wisc.edu

 This patch just converts the iscsi_ibft module to the
 iscsi boot sysfs lib module.

 This patch was made over the ibft-2.6 tree's ibft-1.03 branch:
 http://git.kernel.org/?p=linux/kernel/git/konrad/ibft-2.6.git;a=shortlog;h=
refs/heads/ibft-1.03

 Signed-off-by: Mike Christie micha...@cs.wisc.edu

I've only two comments:

.. snip..
  /*
 + * Helper routiners to check to determine if the entry is valid
 + * in the proper iBFT structure.
 + */
 +static mode_t ibft_check_nic_for(void *data, int type)
 +{
 + struct ibft_kobject *entry = data;
 + struct ibft_nic *nic = entry-nic;
 + mode_t rc = 0;
 +
 + switch (type) {
 + case ISCSI_BOOT_ETH_INDEX:
 + case ISCSI_BOOT_ETH_FLAGS:
 + rc = 1;

Did you mean for that value?
 + break;
 + case ISCSI_BOOT_ETH_IP_ADDR:
 + if (memcmp(nic-ip_addr, nulls, sizeof(nic-ip_addr)))
 + rc = S_IRUGO;
 + break;
 + case ISCSI_BOOT_ETH_SUBNET_MASK:
 + if (nic-subnet_mask_prefix)
 + rc = S_IRUGO;
 + break;
 + case ISCSI_BOOT_ETH_ORIGIN:
 + rc = 1;

and this one as well?

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: [PATCH 2/2] RFC: iscsi ibft: convert iscsi_ibft module to iscsi boot lib

2010-04-13 Thread Konrad Rzeszutek Wilk
On Monday 12 April 2010 22:32:33 Mike Christie wrote:
 On 04/12/2010 09:21 PM, Konrad Rzeszutek Wilk wrote:
  + * Helper routiners to check to determine if the entry is valid
  + * in the proper iBFT structure.
  + */
  +static mode_t ibft_check_nic_for(void *data, int type)
  +{
  +  struct ibft_kobject *entry = data;
  +  struct ibft_nic *nic = entry-nic;
  +  mode_t rc = 0;
  +
  +  switch (type) {
  +  case ISCSI_BOOT_ETH_INDEX:
  +  case ISCSI_BOOT_ETH_FLAGS:
  +  rc = 1;
 
  Did you mean for that value?
 
  +  break;
  +  case ISCSI_BOOT_ETH_IP_ADDR:
  +  if (memcmp(nic-ip_addr, nulls, sizeof(nic-ip_addr)))
  +  rc = S_IRUGO;
  +  break;
  +  case ISCSI_BOOT_ETH_SUBNET_MASK:
  +  if (nic-subnet_mask_prefix)
  +  rc = S_IRUGO;
  +  break;
  +  case ISCSI_BOOT_ETH_ORIGIN:
  +  rc = 1;
 
  and this one as well?

 I did not. They should be S_IRUGO. Do you want me to resubmit the
 patches or are you just going to edit those two lines if you merge them?

No need to resend them (unless Peter eyes found something I missed).

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



Re: [PATCH 2/2] RFC: iscsi ibft: convert iscsi_ibft module to iscsi boot lib

2010-04-13 Thread Peter Jones
On 04/12/2010 10:36 PM, Konrad Rzeszutek Wilk wrote:
 On Monday 12 April 2010 22:32:33 Mike Christie wrote:
 On 04/12/2010 09:21 PM, Konrad Rzeszutek Wilk wrote:
 + * Helper routiners to check to determine if the entry is valid
 + * in the proper iBFT structure.
 + */
 +static mode_t ibft_check_nic_for(void *data, int type)
 +{
 +  struct ibft_kobject *entry = data;
 +  struct ibft_nic *nic = entry-nic;
 +  mode_t rc = 0;
 +
 +  switch (type) {
 +  case ISCSI_BOOT_ETH_INDEX:
 +  case ISCSI_BOOT_ETH_FLAGS:
 +  rc = 1;

 Did you mean for that value?

 +  break;
 +  case ISCSI_BOOT_ETH_IP_ADDR:
 +  if (memcmp(nic-ip_addr, nulls, sizeof(nic-ip_addr)))
 +  rc = S_IRUGO;
 +  break;
 +  case ISCSI_BOOT_ETH_SUBNET_MASK:
 +  if (nic-subnet_mask_prefix)
 +  rc = S_IRUGO;
 +  break;
 +  case ISCSI_BOOT_ETH_ORIGIN:
 +  rc = 1;

 and this one as well?

 I did not. They should be S_IRUGO. Do you want me to resubmit the
 patches or are you just going to edit those two lines if you merge them?
 
 No need to resend them (unless Peter eyes found something I missed).

Nope, that's all I see.

-- 
Peter

Sanity's just a one trick pony anyway.  You only get one trick -- rational
thinking -- but when you're good and crazy, the sky's the limit!
-- The Tick

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH 2/2] RFC: iscsi ibft: convert iscsi_ibft module to iscsi boot lib

2010-04-12 Thread michaelc
From: Mike Christie micha...@cs.wisc.edu

This patch just converts the iscsi_ibft module to the
iscsi boot sysfs lib module.

This patch was made over the ibft-2.6 tree's ibft-1.03 branch:
http://git.kernel.org/?p=linux/kernel/git/konrad/ibft-2.6.git;a=shortlog;h=refs/heads/ibft-1.03

Signed-off-by: Mike Christie micha...@cs.wisc.edu
---
 drivers/firmware/Kconfig  |1 +
 drivers/firmware/iscsi_ibft.c |  698 +++--
 2 files changed, 248 insertions(+), 451 deletions(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 571d218..a6c670b 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -132,6 +132,7 @@ config ISCSI_BOOT_SYSFS
 
 config ISCSI_IBFT
tristate iSCSI Boot Firmware Table Attributes module
+   select ISCSI_BOOT_SYSFS
depends on ISCSI_IBFT_FIND
default n
help
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index b3ab24f..6d262be 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -82,6 +82,7 @@
 #include linux/string.h
 #include linux/types.h
 #include linux/acpi.h
+#include linux/iscsi_boot_sysfs.h
 
 #define IBFT_ISCSI_VERSION 0.5.0
 #define IBFT_ISCSI_DATE 2010-Feb-25
@@ -170,74 +171,6 @@ enum ibft_id {
 };
 
 /*
- * We do not support the other types, hence the usage of NULL.
- * This maps to the enum ibft_id.
- */
-static const char *ibft_id_names[] =
-   {NULL, NULL, initiator, ethernet%d, target%d, NULL, NULL};
-
-/*
- * The text attributes names for each of the kobjects.
-*/
-enum ibft_eth_properties_enum {
-   ibft_eth_index,
-   ibft_eth_flags,
-   ibft_eth_ip_addr,
-   ibft_eth_subnet_mask,
-   ibft_eth_origin,
-   ibft_eth_gateway,
-   ibft_eth_primary_dns,
-   ibft_eth_secondary_dns,
-   ibft_eth_dhcp,
-   ibft_eth_vlan,
-   ibft_eth_mac,
-   /* ibft_eth_pci_bdf - this is replaced by link to the device itself. */
-   ibft_eth_hostname,
-   ibft_eth_end_marker,
-};
-
-static const char *ibft_eth_properties[] =
-   {index, flags, ip-addr, subnet-mask, origin, gateway,
-   primary-dns, secondary-dns, dhcp, vlan, mac, hostname,
-   NULL};
-
-enum ibft_tgt_properties_enum {
-   ibft_tgt_index,
-   ibft_tgt_flags,
-   ibft_tgt_ip_addr,
-   ibft_tgt_port,
-   ibft_tgt_lun,
-   ibft_tgt_chap_type,
-   ibft_tgt_nic_assoc,
-   ibft_tgt_name,
-   ibft_tgt_chap_name,
-   ibft_tgt_chap_secret,
-   ibft_tgt_rev_chap_name,
-   ibft_tgt_rev_chap_secret,
-   ibft_tgt_end_marker,
-};
-
-static const char *ibft_tgt_properties[] =
-   {index, flags, ip-addr, port, lun, chap-type, nic-assoc,
-   target-name, chap-name, chap-secret, rev-chap-name,
-   rev-chap-name-secret, NULL};
-
-enum ibft_initiator_properties_enum {
-   ibft_init_index,
-   ibft_init_flags,
-   ibft_init_isns_server,
-   ibft_init_slp_server,
-   ibft_init_pri_radius_server,
-   ibft_init_sec_radius_server,
-   ibft_init_initiator_name,
-   ibft_init_end_marker,
-};
-
-static const char *ibft_initiator_properties[] =
-   {index, flags, isns-server, slp-server, pri-radius-server,
-   sec-radius-server, initiator-name, NULL};
-
-/*
  * The kobject and attribute structures.
  */
 
@@ -249,29 +182,9 @@ struct ibft_kobject {
struct ibft_tgt *tgt;
struct ibft_hdr *hdr;
};
-   struct kobject kobj;
-   struct list_head node;
 };
 
-struct ibft_attribute {
-   struct attribute attr;
-   ssize_t (*show) (struct  ibft_kobject *entry,
-struct ibft_attribute *attr, char *buf);
-   union {
-   struct ibft_initiator *initiator;
-   struct ibft_nic *nic;
-   struct ibft_tgt *tgt;
-   struct ibft_hdr *hdr;
-   };
-   struct kobject *kobj;
-   int type; /* The enum of the type. This can be any value of:
-   ibft_eth_properties_enum, ibft_tgt_properties_enum,
-   or ibft_initiator_properties_enum. */
-   struct list_head node;
-};
-
-static LIST_HEAD(ibft_attr_list);
-static LIST_HEAD(ibft_kobject_list);
+static struct iscsi_boot_kset *boot_kset;
 
 static const char nulls[16];
 
@@ -310,35 +223,27 @@ static ssize_t sprintf_string(char *str, int len, char 
*buf)
 static int ibft_verify_hdr(char *t, struct ibft_hdr *hdr, int id, int length)
 {
if (hdr-id != id) {
-   printk(KERN_ERR iBFT error: We expected the  \
+   printk(KERN_ERR iBFT error: We expected the %s  \
field header.id to have %d but  \
-   found %d instead!\n, id, hdr-id);
+   found %d instead!\n, t, id, hdr-id);
return -ENODEV;
}
if (hdr-length != length) {
-   printk(KERN_ERR iBFT error: We expected the  \
+  

Re: [PATCH 2/2] RFC: iscsi ibft: convert iscsi_ibft module to iscsi boot lib

2010-04-12 Thread Mike Christie

On 04/12/2010 09:21 PM, Konrad Rzeszutek Wilk wrote:

+ * Helper routiners to check to determine if the entry is valid
+ * in the proper iBFT structure.
+ */
+static mode_t ibft_check_nic_for(void *data, int type)
+{
+   struct ibft_kobject *entry = data;
+   struct ibft_nic *nic = entry-nic;
+   mode_t rc = 0;
+
+   switch (type) {
+   case ISCSI_BOOT_ETH_INDEX:
+   case ISCSI_BOOT_ETH_FLAGS:
+   rc = 1;


Did you mean for that value?

+   break;
+   case ISCSI_BOOT_ETH_IP_ADDR:
+   if (memcmp(nic-ip_addr, nulls, sizeof(nic-ip_addr)))
+   rc = S_IRUGO;
+   break;
+   case ISCSI_BOOT_ETH_SUBNET_MASK:
+   if (nic-subnet_mask_prefix)
+   rc = S_IRUGO;
+   break;
+   case ISCSI_BOOT_ETH_ORIGIN:
+   rc = 1;


and this one as well?


I did not. They should be S_IRUGO. Do you want me to resubmit the 
patches or are you just going to edit those two lines if you merge them?


--
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.