Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3dc9046f
Commit
3dc9046f
authored
Feb 19, 2004
by
Ben Collins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IEEE1394/SBP2(r1139): Some cleanups, and a better, more unique id for ieee1394_id attribute.
parent
b8984674
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
drivers/ieee1394/sbp2.c
drivers/ieee1394/sbp2.c
+27
-19
drivers/ieee1394/sbp2.h
drivers/ieee1394/sbp2.h
+1
-0
No files found.
drivers/ieee1394/sbp2.c
View file @
3dc9046f
...
@@ -1532,20 +1532,31 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id)
...
@@ -1532,20 +1532,31 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id)
}
}
static
void
sbp2_prep_scsi_id
(
struct
scsi_id_instance_data
*
scsi_id
,
static
struct
scsi_id_instance_data
*
sbp2_alloc_scsi_id
(
struct
scsi_id_group
*
scsi_group
,
struct
unit_directory
*
ud
,
struct
unit_directory
*
ud
,
struct
sbp2scsi_host_info
*
hi
)
struct
sbp2scsi_host_info
*
hi
)
{
{
struct
scsi_id_instance_data
*
scsi_id
=
kmalloc
(
sizeof
(
*
scsi_id
),
GFP_KERNEL
);
if
(
!
scsi_id
)
return
NULL
;
memset
(
scsi_id
,
0
,
sizeof
(
*
scsi_id
));
memset
(
scsi_id
,
0
,
sizeof
(
*
scsi_id
));
scsi_id
->
ne
=
ud
->
ne
;
scsi_id
->
ne
=
ud
->
ne
;
scsi_id
->
hi
=
hi
;
scsi_id
->
hi
=
hi
;
scsi_id
->
ud
=
ud
;
scsi_id
->
speed_code
=
IEEE1394_SPEED_100
;
scsi_id
->
speed_code
=
IEEE1394_SPEED_100
;
scsi_id
->
max_payload_size
=
sbp2_speedto_max_payload
[
IEEE1394_SPEED_100
];
scsi_id
->
max_payload_size
=
sbp2_speedto_max_payload
[
IEEE1394_SPEED_100
];
atomic_set
(
&
scsi_id
->
sbp2_login_complete
,
0
);
atomic_set
(
&
scsi_id
->
sbp2_login_complete
,
0
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_inuse
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_inuse
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_completed
);
INIT_LIST_HEAD
(
&
scsi_id
->
sbp2_command_orb_completed
);
scsi_id
->
sbp2_command_orb_lock
=
SPIN_LOCK_UNLOCKED
;
scsi_id
->
sbp2_command_orb_lock
=
SPIN_LOCK_UNLOCKED
;
scsi_id
->
sbp2_device_type_and_lun
=
SBP2_DEVICE_TYPE_LUN_UNINITIALIZED
;
list_add_tail
(
&
scsi_id
->
list
,
&
scsi_group
->
scsi_id_list
);
return
scsi_id
;
}
}
/*
/*
...
@@ -1590,17 +1601,13 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
...
@@ -1590,17 +1601,13 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
* Device type and lun (used for
* Device type and lun (used for
* detemining type of sbp2 device)
* detemining type of sbp2 device)
*/
*/
scsi_id
=
kmalloc
(
sizeof
(
*
scsi_id
),
GFP_KERNEL
);
scsi_id
=
sbp2_alloc_scsi_id
(
scsi_group
,
ud
,
hi
);
if
(
!
scsi_id
)
{
if
(
!
scsi_id
)
{
SBP2_ERR
(
"Out of memory adding scsi_id, not all LUN's will be added"
);
SBP2_ERR
(
"Out of memory adding scsi_id, not all LUN's will be added"
);
break
;
break
;
}
}
sbp2_prep_scsi_id
(
scsi_id
,
ud
,
hi
);
scsi_id
->
sbp2_device_type_and_lun
=
kv
->
value
.
immediate
;
scsi_id
->
sbp2_device_type_and_lun
=
kv
->
value
.
immediate
;
SBP2_DEBUG
(
"sbp2_device_type_and_lun = %x"
,
(
unsigned
int
)
scsi_id
->
sbp2_device_type_and_lun
);
list_add_tail
(
&
scsi_id
->
list
,
&
scsi_group
->
scsi_id_list
);
}
}
break
;
break
;
...
@@ -1689,16 +1696,11 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
...
@@ -1689,16 +1696,11 @@ static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
/* If our list is empty, add a base scsi_id (happens in a normal
/* If our list is empty, add a base scsi_id (happens in a normal
* case where there is no logical_unit_number entry */
* case where there is no logical_unit_number entry */
if
(
list_empty
(
&
scsi_group
->
scsi_id_list
))
{
if
(
list_empty
(
&
scsi_group
->
scsi_id_list
))
{
scsi_id
=
kmalloc
(
sizeof
(
*
scsi_id
),
GFP_KERNEL
);
scsi_id
=
sbp2_alloc_scsi_id
(
scsi_group
,
ud
,
hi
);
if
(
!
scsi_id
)
{
if
(
!
scsi_id
)
{
SBP2_ERR
(
"Out of memory adding scsi_id"
);
SBP2_ERR
(
"Out of memory adding scsi_id"
);
return
;
return
;
}
}
sbp2_prep_scsi_id
(
scsi_id
,
ud
,
hi
);
scsi_id
->
sbp2_device_type_and_lun
=
SBP2_DEVICE_TYPE_LUN_UNINITIALIZED
;
list_add_tail
(
&
scsi_id
->
list
,
&
scsi_group
->
scsi_id_list
);
}
}
/* Update the generic fields in all the LUN's */
/* Update the generic fields in all the LUN's */
...
@@ -2866,10 +2868,11 @@ static const char *sbp2scsi_info (struct Scsi_Host *host)
...
@@ -2866,10 +2868,11 @@ static const char *sbp2scsi_info (struct Scsi_Host *host)
return
"SCSI emulation for IEEE-1394 SBP-2 Devices"
;
return
"SCSI emulation for IEEE-1394 SBP-2 Devices"
;
}
}
static
ssize_t
sbp2_sysfs_ieee1394_
gu
id_show
(
struct
device
*
dev
,
char
*
buf
)
static
ssize_t
sbp2_sysfs_ieee1394_id_show
(
struct
device
*
dev
,
char
*
buf
)
{
{
struct
scsi_device
*
sdev
;
struct
scsi_device
*
sdev
;
struct
scsi_id_instance_data
*
scsi_id
;
struct
scsi_id_instance_data
*
scsi_id
;
int
lun
;
if
(
!
(
sdev
=
to_scsi_device
(
dev
)))
if
(
!
(
sdev
=
to_scsi_device
(
dev
)))
return
0
;
return
0
;
...
@@ -2877,13 +2880,18 @@ static ssize_t sbp2_sysfs_ieee1394_guid_show(struct device *dev, char *buf)
...
@@ -2877,13 +2880,18 @@ static ssize_t sbp2_sysfs_ieee1394_guid_show(struct device *dev, char *buf)
if
(
!
(
scsi_id
=
sdev
->
hostdata
))
if
(
!
(
scsi_id
=
sdev
->
hostdata
))
return
0
;
return
0
;
return
sprintf
(
buf
,
"%016Lx
\n
"
,
(
unsigned
long
long
)
scsi_id
->
ne
->
guid
);
if
(
scsi_id
->
sbp2_device_type_and_lun
==
SBP2_DEVICE_TYPE_LUN_UNINITIALIZED
)
}
lun
=
0
;
else
lun
=
ORB_SET_LUN
(
scsi_id
->
sbp2_device_type_and_lun
);
static
DEVICE_ATTR
(
ieee1394_guid
,
S_IRUGO
,
sbp2_sysfs_ieee1394_guid_show
,
NULL
);
return
sprintf
(
buf
,
"%016Lx:%d:%d
\n
"
,
(
unsigned
long
long
)
scsi_id
->
ne
->
guid
,
scsi_id
->
ud
->
id
,
lun
);
}
static
DEVICE_ATTR
(
ieee1394_id
,
S_IRUGO
,
sbp2_sysfs_ieee1394_id_show
,
NULL
);
static
struct
device_attribute
*
sbp2_sysfs_sdev_attrs
[]
=
{
static
struct
device_attribute
*
sbp2_sysfs_sdev_attrs
[]
=
{
&
dev_attr_ieee1394_
gu
id
,
&
dev_attr_ieee1394_id
,
NULL
NULL
};
};
...
...
drivers/ieee1394/sbp2.h
View file @
3dc9046f
...
@@ -406,6 +406,7 @@ struct scsi_id_instance_data {
...
@@ -406,6 +406,7 @@ struct scsi_id_instance_data {
/* Node entry, as retrieved from NodeMgr entries */
/* Node entry, as retrieved from NodeMgr entries */
struct
node_entry
*
ne
;
struct
node_entry
*
ne
;
struct
unit_directory
*
ud
;
/* A backlink to our host_info */
/* A backlink to our host_info */
struct
sbp2scsi_host_info
*
hi
;
struct
sbp2scsi_host_info
*
hi
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment