[Ocfs2-tools-devel] [PATCH 1/1] wireshark-ocfs2: add dlm_migrate_request message support in dissector.
Sunil Mushran
sunil.mushran at oracle.com
Mon Jul 6 15:55:04 PDT 2009
Why not use dlm_node_idx_handler() for master and new_master?
Here master means the master node number.
Jeff Liu wrote:
> this patch add dlm_migrate_request message handler in dissector.
>
> dissect this message as:
>
> ocfs2
> Magic: Request (0xfa55)
> Len: 72
> Type: Migrate Request (508)
> Pad: 0x0000
> Sys Status: DLM_NORMAL (0)
> Status: 0
> Key: 0x74e320eb
> Num: 0
> Payload1: 03061F00000000004F303030303030303030303030303030
> Payload2: 303137613030393030303030303030000000000000000000
> Payload3: 000000000000000000000000000000000000000000000000
> Master: 3
> New Master: 6
> Namelen: 31
> Name: O000000000000000017a00900000000
>
> Signed-off-by: Jeff Liu <jeff.liu at oracle.com>
> ---
> epan/dissectors/packet-ocfs2.c | 61 +++++++++++++++++++++++++++++----------
> 1 files changed, 45 insertions(+), 16 deletions(-)
>
> diff --git a/epan/dissectors/packet-ocfs2.c b/epan/dissectors/packet-ocfs2.c
> index bd2d2b7..e754d2d 100644
> --- a/epan/dissectors/packet-ocfs2.c
> +++ b/epan/dissectors/packet-ocfs2.c
> @@ -99,6 +99,8 @@ static int hf_msg_payload4 = -1;
> static int hf_msg_payload5 = -1;
> static int hf_msg_payload6 = -1;
>
> +static int hf_dlm_master = -1;
> +static int hf_dlm_new_master = -1;
> static int hf_dlm_node_idx = -1;
> static int hf_dlm_flags = -1;
> static int hf_dlm_am_flags = -1;
> @@ -663,6 +665,18 @@ void dlm_node_idx_handler(proto_tree *tree, tvbuff_t *tvb, guint offset, void *p
> // TODO: look into printing the hostname by working with o2cb stuff
> proto_tree_add_item(tree, *fld->hf_index, tvb, offset + fld->offset, fld->len, FALSE);
> }
> +void dlm_master_handler(proto_tree *tree, tvbuff_t *tvb, guint offset,
> + void *priv, struct dlm_msg_field_def *fld)
> +{
> + proto_tree_add_item(tree, *fld->hf_index, tvb, offset + fld->offset,
> + fld->len, FALSE);
> +}
> +void dlm_new_master_handler(proto_tree *tree, tvbuff_t *tvb, guint offset,
> + void *priv, struct dlm_msg_field_def *fld)
> +{
> + proto_tree_add_item(tree, *fld->hf_index, tvb, offset + fld->offset,
> + fld->len, FALSE);
> +}
>
>
> /* DLM structures */
> @@ -734,6 +748,14 @@ struct dlm_lock_request
> guint16 pad1; // unused
> guint32 pad2; // unused
> };
> +struct dlm_migrate_request {
> + guint8 master;
> + guint8 new_master;
> + guint8 namelen;
> + guint8 pad1;
> + guint32 pad2;
> + guint8 name[O2NM_MAX_NAME_LEN];
> +};
> struct dlm_reco_data_done
> {
> guint8 node_idx;
> @@ -865,6 +887,23 @@ static struct dlm_msg_struct_def dlm_struct_defs[] = {
> { "dead_node", &hf_dlm_dead_node, FIELD_OFFSET_AND_SIZE(struct dlm_lock_request,dead_node), dlm_node_idx_handler},
> { DLM_MSG_STRUCT_DEF_END } }
> },
> +{ "dlm_migrate_request", "DLM Migrate Request", DLM_MIGRATE_REQUEST_MSG,
> + &ett_dlm_migrate_request, {
> + { "master", &hf_dlm_master,
> + FIELD_OFFSET_AND_SIZE(struct dlm_migrate_request, master),
> + dlm_master_handler},
> + { "new_master", &hf_dlm_new_master,
> + FIELD_OFFSET_AND_SIZE(struct dlm_migrate_request, new_master),
> + dlm_new_master_handler},
> + { "namelen", &hf_dlm_namelen,
> + FIELD_OFFSET_AND_SIZE(struct dlm_migrate_request, namelen),
> + dlm_namelen_handler},
> + { "name", &hf_dlm_name,
> + FIELD_OFFSET_AND_SIZE(struct dlm_migrate_request, name),
> + dlm_name_handler},
> + { DLM_MSG_STRUCT_DEF_END }
> + }
> +},
> { "dlm_reco_data_done", "DLM Recovery Data Done (recovery)", DLM_RECO_DATA_DONE_MSG, &ett_dlm_recovery_data_done, {
> { "node_idx", &hf_dlm_node_idx, FIELD_OFFSET_AND_SIZE(struct dlm_reco_data_done,node_idx), dlm_node_idx_handler},
> { "dead_node", &hf_dlm_dead_node, FIELD_OFFSET_AND_SIZE(struct dlm_reco_data_done,dead_node), dlm_node_idx_handler},
> @@ -911,22 +950,6 @@ static struct dlm_msg_struct_def dlm_struct_defs[] = {
> * unimplemented cuz i forgot about these
> */
>
> -struct dlm_migrate_request
> -{
> - guint8 master;
> - guint8 new_master;
> - guint8 namelen;
> - guint8 pad1;
> - guint32 pad2;
> - guint8 name[O2NM_MAX_NAME_LEN];
> -};
> -{ "dlm_migrate_request", "DLM Migrate Request", DLM_MIGRATE_REQUEST_MSG,
> - { "master", &hf_dlm_node_idx, FIELD_OFFSET_AND_SIZE(struct dlm_finalize_reco,node_idx), dlm_node_idx_handler, NULL },
> - { "dead_node", &hf_dlm_dead_node, FIELD_OFFSET_AND_SIZE(struct dlm_finalize_reco,dead_node), dlm_node_idx_handler, NULL },
> - { "flags", &hf_dlm_flags, FIELD_OFFSET_AND_SIZE(struct dlm_finalize_reco,flags), dlm_fr_flags_handler, NULL },
> - { DLM_MSG_STRUCT_DEF_END }
> -},
> -
> struct dlm_master_requery
> {
> guint8 pad1;
> @@ -1255,6 +1278,12 @@ void proto_register_ocfs2(void)
> { &hf_msg_payload6, { "Payload6", "ocfs2.msg.payload",
> FT_BYTES, BASE_HEX, NULL, 0x0,
> "Payload 6", HFILL } },
> + { &hf_dlm_master, { "Master", "ocfs2.dlm.master",
> + FT_UINT8, BASE_DEC, NULL, 0x0,
> + "Master", HFILL } },
> + { &hf_dlm_new_master, { "New Master", "ocfs2.dlm.new_master",
> + FT_UINT8, BASE_DEC, NULL, 0x0,
> + "New Master", HFILL } },
> { &hf_dlm_node_idx, { "Node Index", "ocfs2.dlm.node_idx",
> FT_UINT8, BASE_DEC, NULL, 0x0,
> "Node index", HFILL } },
>
More information about the Ocfs2-tools-devel
mailing list