[LU-11432] enum constants like lnet_msg_type in LNet should have specific values Created: 26/Sep/18  Updated: 21/Jan/22

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Sonia Sharma (Inactive) Assignee: Sonia Sharma (Inactive)
Resolution: Unresolved Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

In LNet (lnet-types.h), the enum constants are started from 0 and so the values are given per the position in the struct. It looks like this.

enum lnet_msg_type {
    LNET_MSG_ACK = 0,                          
    LNET_MSG_PUT,
    LNET_MSG_GET,
    LNET_MSG_REPLY,
    LNET_MSG_HELLO,                                                                                    
};

This should be fixed and be given specific values.

As Andreas pointed out - "This avoids bugs in the future if one of these constants is deleted, or if someone accidentally tries to add a value in the middle of the list, which would bump up all of the following values by one and break the network protocol compatibility."



 Comments   
Comment by Gerrit Updater [ 28/Sep/18 ]

Sonia Sharma (sharmaso@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33251
Subject: LU-11432 lnet: Assign specific values to enum constt
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 49676250f1eaffb30d50afee71a990db749bc90d

Generated at Sat Feb 10 02:43:49 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.