On Thu, 2013-04-25 at 15:04 -0700, Andy Grover wrote: > rtslib's storageobject.is_configured returns true if <dev>/info is > readable. This doesn't seem to be correct, because configfs makes the > info node right away, not when the device is configured. > > This patch leaves that but returns "UNCONFIGURED" for status in /info. This > will let rtslib tell the difference between a configured and unconfigured > backstore device. > > Also, only call the backstore's show_configfs_dev_params if the device has > been successfully configured. > Instead of messing with /info output, I'd prefer that /enable be changed to readable, and make rtslib.storageobject.is_configured() use this attribute instead. --nab > Signed-off-by: Andy Grover <agrover@xxxxxxxxxx> > --- > drivers/target/target_core_configfs.c | 3 ++- > drivers/target/target_core_transport.c | 4 +++- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c > index 43b7ac6..49ac57e 100644 > --- a/drivers/target/target_core_configfs.c > +++ b/drivers/target/target_core_configfs.c > @@ -1452,7 +1452,8 @@ static ssize_t target_core_show_dev_info(void *p, char *page) > > transport_dump_dev_state(dev, page, &bl); > read_bytes += bl; > - read_bytes += t->show_configfs_dev_params(dev, page+read_bytes); > + if (dev->dev_flags & DF_CONFIGURED) > + read_bytes += t->show_configfs_dev_params(dev, page+read_bytes); > return read_bytes; > } > > diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c > index c3477fa..95b6de0 100644 > --- a/drivers/target/target_core_transport.c > +++ b/drivers/target/target_core_transport.c > @@ -704,7 +704,9 @@ void transport_dump_dev_state( > int *bl) > { > *bl += sprintf(b + *bl, "Status: "); > - if (dev->export_count) > + if (!(dev->dev_flags & DF_CONFIGURED)) > + *bl += sprintf(b + *bl, "UNCONFIGURED"); > + else if (dev->export_count) > *bl += sprintf(b + *bl, "ACTIVATED"); > else > *bl += sprintf(b + *bl, "DEACTIVATED"); -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html