mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
scst_local: Make the SCSI host number available in sysfs
An example for the following SCST configuration:
TARGET_DRIVER scst_local {
TARGET scst_local_tgt {
session_name scst_local_host
LUN 0 dummy
LUN 1 test1
LUN 2 test2
}
}
$ cat /sys/kernel/scst_tgt/targets/scst_local/scst_local_tgt/sessions/scst_local_host/host_no
9
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9488 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -483,6 +483,19 @@ static const struct attribute *scst_local_tgt_attrs[] = {
|
||||
** Session attributes
|
||||
**/
|
||||
|
||||
static ssize_t host_no_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
struct scst_session *scst_sess =
|
||||
container_of(kobj, struct scst_session, sess_kobj);
|
||||
struct scst_local_sess *sess = scst_sess_get_tgt_priv(scst_sess);
|
||||
struct Scsi_Host *host = sess->shost;
|
||||
|
||||
return host ? snprintf(buf, PAGE_SIZE, "%u\n", host->host_no) : -EINVAL;
|
||||
}
|
||||
|
||||
static struct kobj_attribute scst_local_host_no_attr = __ATTR_RO(host_no);
|
||||
|
||||
static ssize_t scst_local_transport_id_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
@@ -571,6 +584,7 @@ static struct kobj_attribute scst_local_transport_id_attr =
|
||||
scst_local_transport_id_store);
|
||||
|
||||
static const struct attribute *scst_local_sess_attrs[] = {
|
||||
&scst_local_host_no_attr.attr,
|
||||
&scst_local_transport_id_attr.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user