Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-11432

enum constants like lnet_msg_type in LNet should have specific values

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • Lustre 2.17.0
    • None
    • 3
    • 9223372036854775807

      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."

            argupta Aryan Gupta (Inactive)
            sharmaso Sonia Sharma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: