/* device attribute for showing all segments in a device  */
static ssize_t dcssblk_seglist_show(struct device *dev, struct device_attribute *attr, char *buf)
/* device attribute for showing all segments in a device  */
static ssize_t dcssblk_seglist_show(struct device *dev, struct device_attribute *attr, char *buf)
{
	int i;
	struct dcssblk_dev_info *dev_info;
	struct segment_info *entry;
	down_read(&dcssblk_devices_sem);
	dev_info = container_of(dev, struct dcssblk_dev_info, dev);
	i = 0;
	buf[0] = '\0';
	list_for_each_entry(entry, &dev_info->seg_list, lh) {
		strcpy(&buf[i], entry->segment_name);
		i += strlen(entry->segment_name);
		buf[i] = '\n';
		i++;
	}
	up_read(&dcssblk_devices_sem);
	return i;
}