aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-scsi-osd.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-07-08 14:47:17 -0400
committerMichael Mann <mmann78@netscape.net>2014-07-09 00:25:04 +0000
commit6691293a655645dcd98c9cb55618b8e41bef41a4 (patch)
tree495dccc6e708c0f22c129ccbe4dd495a1716f585 /epan/dissectors/packet-scsi-osd.c
parentcfee2019c63f33cff3564c2266c9586c86b61baa (diff)
convert to proto_tree_add_subtree[_format]
Change-Id: I8d66b1bc7dbdfee3d4bf6fd3b3c21c6323b66f44 Reviewed-on: https://code.wireshark.org/review/2946 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-scsi-osd.c')
-rw-r--r--epan/dissectors/packet-scsi-osd.c56
1 files changed, 20 insertions, 36 deletions
diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c
index 73a71fd2aa..052ea1fcb7 100644
--- a/epan/dissectors/packet-scsi-osd.c
+++ b/epan/dissectors/packet-scsi-osd.c
@@ -544,8 +544,7 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset,
}
if ((guint32)(offset-start_offset)+attribute_entry_length>length) break;
- ti = proto_tree_add_text(tree, tvb, offset, attribute_entry_length, "Attribute:");
- tt = proto_item_add_subtree(ti, ett_osd_attribute);
+ tt = proto_tree_add_subtree(tree, tvb, offset, attribute_entry_length, ett_osd_attribute, &ti, "Attribute:");
switch (type) {
case 0x01: /* retrieving attributes 7.1.3.2 */
@@ -589,16 +588,14 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset,
static void
dissect_osd_option(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
{
- proto_tree *tree = NULL;
- proto_item *it = NULL;
+ proto_tree *tree;
+ proto_item *it;
guint8 option;
option = tvb_get_guint8(tvb, offset);
- if (parent_tree) {
- it = proto_tree_add_item(parent_tree, hf_scsi_osd_option, tvb, offset, 1, ENC_BIG_ENDIAN);
- tree = proto_item_add_subtree(it, ett_osd_option);
- }
+ it = proto_tree_add_item(parent_tree, hf_scsi_osd_option, tvb, offset, 1, ENC_BIG_ENDIAN);
+ tree = proto_item_add_subtree(it, ett_osd_option);
proto_tree_add_item(tree, hf_scsi_osd_option_dpo, tvb, offset, 1, ENC_BIG_ENDIAN);
if (option&0x10) {
@@ -689,16 +686,12 @@ static int
dissect_osd_attribute_parameters(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *parent_tree, scsi_task_data_t *cdata)
{
guint8 gsatype = 0;
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_tree *tree;
scsi_osd_extra_data_t *extra_data = NULL;
gboolean osd2;
- if (parent_tree) {
- item = proto_tree_add_text(parent_tree, tvb, offset, 28,
- "Attribute Parameters");
- tree = proto_item_add_subtree(item, ett_osd_attribute_parameters);
- }
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 28,
+ ett_osd_attribute_parameters, NULL, "Attribute Parameters");
if (cdata && cdata->itlq && cdata->itlq->extra_data) {
extra_data = (scsi_osd_extra_data_t *)cdata->itlq->extra_data;
@@ -792,7 +785,6 @@ dissect_osd_attribute_data_out(packet_info *pinfo, tvbuff_t *tvb, int offset _U_
{
guint8 gsatype = 0;
proto_tree *subtree;
- proto_item *item;
scsi_osd_extra_data_t *extra_data = NULL;
if (cdata && cdata->itlq && cdata->itlq->extra_data) {
@@ -808,13 +800,13 @@ dissect_osd_attribute_data_out(packet_info *pinfo, tvbuff_t *tvb, int offset _U_
break;
case 3: /* 5.2.2.3 attribute list */
if (extra_data->u.al.get_list_length) {
- item = proto_tree_add_text(tree, tvb, extra_data->u.al.get_list_offset, extra_data->u.al.get_list_length, "Get Attributes Segment");
- subtree= proto_item_add_subtree(item, ett_osd_get_attributes);
+ subtree = proto_tree_add_subtree(tree, tvb, extra_data->u.al.get_list_offset, extra_data->u.al.get_list_length,
+ ett_osd_get_attributes, NULL, "Get Attributes Segment");
dissect_osd_attributes_list(pinfo, tvb, extra_data->u.al.get_list_offset, subtree, lun_info, extra_data->osd2);
}
if (extra_data->u.al.set_list_length) {
- item = proto_tree_add_text(tree, tvb, extra_data->u.al.set_list_offset, extra_data->u.al.set_list_length, "Set Attributes Segment");
- subtree= proto_item_add_subtree(item, ett_osd_set_attributes);
+ subtree = proto_tree_add_subtree(tree, tvb, extra_data->u.al.set_list_offset, extra_data->u.al.set_list_length,
+ ett_osd_get_attributes, NULL, "Set Attributes Segment");
dissect_osd_attributes_list(pinfo, tvb, extra_data->u.al.set_list_offset, subtree, lun_info, extra_data->osd2);
}
break;
@@ -1113,15 +1105,11 @@ dissect_osd_permissions(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
static void
dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_tree *tree;
guint8 format;
- if (parent_tree) {
- item = proto_tree_add_text(parent_tree, tvb, offset, 80,
- "Capability");
- tree = proto_item_add_subtree(item, ett_osd_capability);
- }
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 80,
+ ett_osd_capability, NULL, "Capability");
/* capability format */
proto_tree_add_item(tree, hf_scsi_osd_capability_format, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1186,14 +1174,10 @@ dissect_osd_capability(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
static int
dissect_osd_security_parameters(tvbuff_t *tvb, int offset, proto_tree *parent_tree)
{
- proto_item *item = NULL;
- proto_tree *tree = NULL;
+ proto_tree *tree;
- if (parent_tree) {
- item = proto_tree_add_text(parent_tree, tvb, offset, 40,
- "Security Parameters");
- tree = proto_item_add_subtree(item, ett_osd_security_parameters);
- }
+ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 40,
+ ett_osd_security_parameters, NULL, "Security Parameters");
/* request integrity check value */
proto_tree_add_item(tree, hf_scsi_osd_ricv, tvb, offset, 20, ENC_NA);
@@ -1695,8 +1679,8 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (attr_list_end>additional_length+8) break;
while (offset+16<attr_list_end) {
guint32 attribute_length = tvb_get_ntohs(tvb, offset+14);
- proto_item *att_item = proto_tree_add_text(subtree, tvb, offset, 16+attribute_length, "Attribute:");
- proto_tree *att_tree = proto_item_add_subtree(att_item, ett_osd_attribute);
+ proto_item *att_item;
+ proto_tree *att_tree = proto_tree_add_subtree(subtree, tvb, offset, 16+attribute_length, ett_osd_attribute, &att_item, "Attribute:");
offset = dissect_osd_attribute_list_entry(pinfo, tvb, att_tree, att_item, offset, lun_info, TRUE);
}
offset = attr_list_end;