chattr-util: use BIT_FOREACH where appropriate

This commit is contained in:
Mike Yuan
2024-09-07 14:46:18 +02:00
parent 26f5897767
commit 5bab5e4ac3
+3 -4
View File
@@ -6,6 +6,7 @@
#include <sys/stat.h>
#include <linux/fs.h>
#include "bitfield.h"
#include "chattr-util.h"
#include "errno-util.h"
#include "fd-util.h"
@@ -93,11 +94,9 @@ int chattr_full(
* supported, and we can ignore it too */
unsigned current_attr = old_attr;
for (unsigned i = 0; i < sizeof(unsigned) * 8; i++) {
unsigned new_one, mask_one = 1u << i;
if (!FLAGS_SET(mask, mask_one))
continue;
BIT_FOREACH(i, mask) {
unsigned new_one, mask_one = 1u << i;
new_one = UPDATE_FLAG(current_attr, mask_one, FLAGS_SET(value, mask_one));
if (new_one == current_attr)