Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eudev:master commit in: src/udev/
Date: Mon, 23 Aug 2021 16:06:58
Message-Id: 1629734809.226a9f4dedae29d22e333c215d32d25292da0a78.blueness@gentoo
1 commit: 226a9f4dedae29d22e333c215d32d25292da0a78
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 23 16:06:49 2021 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 23 16:06:49 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/eudev.git/commit/?id=226a9f4d
7
8 src/udev/udev-event.c: clean up whitespaces
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11
12 src/udev/udev-event.c | 72 +++++++++++++++++++++++++--------------------------
13 1 file changed, 36 insertions(+), 36 deletions(-)
14
15 diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
16 index 64cc69cbc..1c1b0d273 100644
17 --- a/src/udev/udev-event.c
18 +++ b/src/udev/udev-event.c
19 @@ -813,7 +813,7 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
20 int sk;
21 struct ifreq ifr;
22
23 - log_debug("changing net interface name from '%s' to '%s'\n",oldname,name);
24 + log_debug("changing net interface name from '%s' to '%s'\n",oldname,name);
25
26 sk = socket(PF_INET, SOCK_DGRAM, 0);
27 if (sk < 0)
28 @@ -825,61 +825,61 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
29 r = ioctl(sk, SIOCSIFNAME, &ifr);
30
31 #ifdef ENABLE_RULE_GENERATOR
32 - int loop;
33 + int loop;
34 struct ifreq ifr_tmp;
35
36 - if (r == 0) {
37 - log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
38 - goto out;
39 - }
40 - /* keep trying if the destination interface name already exists */
41 - log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
42 - ifr.ifr_name, ifr.ifr_newname);
43 + if (r == 0) {
44 + log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
45 + goto out;
46 + }
47 + /* keep trying if the destination interface name already exists */
48 + log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
49 + ifr.ifr_name, ifr.ifr_newname);
50
51 - /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
52 + /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
53 memzero(&ifr_tmp, sizeof(struct ifreq));
54 strscpy(ifr_tmp.ifr_name, IFNAMSIZ, oldname);
55 - snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
56 + snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
57 r = ioctl(sk, SIOCSIFNAME, &ifr_tmp);
58 - log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
59 -
60 - /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
61 + log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
62 +
63 + /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
64 strscpy(ifr.ifr_name, IFNAMSIZ, ifr_tmp.ifr_newname);
65
66 - r = -errno;
67 - if (r != -EEXIST)
68 - goto out;
69 + r = -errno;
70 + if (r != -EEXIST)
71 + goto out;
72
73 - /* wait a maximum of 90 seconds for our target to become available */
74 - loop = 90 * 20;
75 - while (loop--) {
76 - const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
77 + /* wait a maximum of 90 seconds for our target to become available */
78 + loop = 90 * 20;
79 + while (loop--) {
80 + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
81
82 - nanosleep(&duration, NULL);
83 + nanosleep(&duration, NULL);
84
85 - r = ioctl(sk, SIOCSIFNAME, &ifr);
86 - if (r == 0) {
87 - log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
88 - break;
89 - }
90 - r = -errno;
91 - if (r != -EEXIST)
92 - break;
93 - }
94 + r = ioctl(sk, SIOCSIFNAME, &ifr);
95 + if (r == 0) {
96 + log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
97 + break;
98 + }
99 + r = -errno;
100 + if (r != -EEXIST)
101 + break;
102 + }
103
104 out:
105 #endif
106 - if (r < 0)
107 + if (r < 0)
108 log_error_errno(-errno, "Error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
109 - else
110 - log_debug("renamed network interface '%s' to '%s'", oldname, name);
111 + else
112 + log_debug("renamed network interface '%s' to '%s'", oldname, name);
113
114 close(sk);
115 return r;
116 }
117
118 static int rename_netif(struct udev_event *event) {
119 - return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name);
120 + return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name);
121 }
122
123 void udev_event_execute_rules(struct udev_event *event,
124 @@ -944,7 +944,7 @@ void udev_event_execute_rules(struct udev_event *event,
125 */
126
127 #ifdef ENABLE_RULE_GENERATOR
128 - int r;
129 + int r;
130 if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") &&
131 (event->name == NULL && (r=udev_rules_assigning_name_to(rules,udev_device_get_sysname(dev))) > 0 ||
132 event->name != NULL && !streq(event->name, udev_device_get_sysname(dev)))) {