Search code examples
c++fuse

What is FUSE_NOTIFY_CODE_MAX and why it is not initialized?


I'm studying sources of the FUSE to get a general understanding of how it works. Unfortunately I'm not a C++ programmer which makes the task harder. I have found this struct in fuse_kernel.h and don't understand it's element purpose. What is FUSE_NOTIFY_CODE_MAX and why it is not initialized?

enum fuse_notify_code {
  FUSE_NOTIFY_POLL   = 1,
  FUSE_NOTIFY_INVAL_INODE = 2,
  FUSE_NOTIFY_INVAL_ENTRY = 3,
  FUSE_NOTIFY_STORE = 4,
  FUSE_NOTIFY_RETRIEVE = 5,
  FUSE_NOTIFY_DELETE = 6,
  FUSE_NOTIFY_CODE_MAX,
};

Solution

  • It's the largest value that the enumeration has, and it is initialised, although not explicitly:

    If you don't specify an explicit value for an enumeration, then it takes a value of one greater than the previous one in the list. (If an enumeration has no explicit values then the first eumeration will have a value of zero).

    It's rather nice that the author of the enumeration has not hardcoded that number.