Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145672396
D45441.1778428867.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45441.1778428867.diff
View Options
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
--- a/sbin/ifconfig/ifconfig.h
+++ b/sbin/ifconfig/ifconfig.h
@@ -260,6 +260,8 @@
void setifcapnv(if_ctx *ctx, const char *vname, const char *arg);
void Perror(const char *cmd);
+void print_bits(const char *btype, uint32_t *v, const int v_count,
+ const char **names, const int n_count);
void printb(const char *s, unsigned value, const char *bits);
void ifmaybeload(struct ifconfig_args *args, const char *name);
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1877,6 +1877,29 @@
Perrorc(cmd, errno);
}
+void
+print_bits(const char *btype, uint32_t *v, const int v_count,
+ const char **names, const int n_count)
+{
+ int num = 0;
+
+ for (int i = 0; i < v_count * 32; i++) {
+ bool is_set = v[i / 32] & (1U << (i % 32));
+ if (is_set) {
+ if (num++ == 0)
+ printf("<");
+ if (num != 1)
+ printf(",");
+ if (i < n_count)
+ printf("%s", names[i]);
+ else
+ printf("%s_%d", btype, i);
+ }
+ }
+ if (num > 0)
+ printf(">");
+}
+
/*
* Print a value a la the %b format of the kernel's printf
*/
diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -81,29 +81,6 @@
"LOWER_UP", /* 24:0x1000000 IFF_NETLINK_1*/
};
-static void
-print_bits(const char *btype, uint32_t *v, const int v_count,
- const char **names, const int n_count)
-{
- int num = 0;
-
- for (int i = 0; i < v_count * 32; i++) {
- bool is_set = v[i / 32] & (1U << (i % 32));
- if (is_set) {
- if (num++ == 0)
- printf("<");
- if (num != 1)
- printf(",");
- if (i < n_count)
- printf("%s", names[i]);
- else
- printf("%s_%d", btype, i);
- }
- }
- if (num > 0)
- printf(">");
-}
-
static void
nl_init_socket(struct snl_state *ss)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 10, 4:01 PM (15 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28637709
Default Alt Text
D45441.1778428867.diff (1 KB)
Attached To
Mode
D45441: Summary: Migrate from printb to print_bits for locally defined bit fields.
Attached
Detach File
Event Timeline
Log In to Comment