]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: fd: remove FD_POLL_DATA and FD_POLL_STICKY
authorWilly Tarreau <w@1wt.eu>
Tue, 6 Apr 2021 14:48:02 +0000 (16:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Apr 2021 13:08:40 +0000 (15:08 +0200)
The former was not used and the second was used only as a positive mask
of the flags to keep instead of having the flags that are updated. Both
were removed in favor of a new FD_POLL_UPDT_MASK that only mentions the
updated flags. This will ease merging of state and ev later.

include/haproxy/fd-t.h
include/haproxy/fd.h

index 2b51125c929dcd3ed8972e47cb82753d81c719c7..53bc528a67bca2a3ac8c68b3ce092732e10d6cdf 100644 (file)
@@ -42,8 +42,7 @@ enum {
 #define FD_POLL_ERR    0x08
 #define FD_POLL_HUP    0x10
 
-#define FD_POLL_DATA    (FD_POLL_IN  | FD_POLL_OUT)
-#define FD_POLL_STICKY  (FD_POLL_ERR | FD_POLL_HUP)
+#define FD_POLL_UPDT_MASK   (FD_POLL_IN | FD_POLL_PRI | FD_POLL_OUT)
 
 /* FD_EV_* are the values used in fdtab[].state to define the polling states in
  * each direction. Most of them are manipulated using test-and-set operations
index 7e0863cdeb63953670a94e4ed3b0f3d038c5895c..09fe24cfd3b910a7ba38e3b742876a6a46475571 100644 (file)
@@ -386,12 +386,12 @@ static inline void fd_update_events(int fd, unsigned char evts)
        }
 
        old = fdtab[fd].ev;
-       new = (old & FD_POLL_STICKY) | new_flags;
+       new = (old & ~FD_POLL_UPDT_MASK) | new_flags;
 
        if (unlikely(locked)) {
                /* Locked FDs (those with more than 2 threads) are atomically updated */
                while (unlikely(new != old && !_HA_ATOMIC_CAS(&fdtab[fd].ev, &old, new)))
-                       new = (old & FD_POLL_STICKY) | new_flags;
+                       new = (old & ~FD_POLL_UPDT_MASK) | new_flags;
        } else {
                if (new != old)
                        fdtab[fd].ev = new;