From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eudev:master commit in: src/udev/
Date: Mon, 23 Aug 2021 16:06:54 +0000 (UTC) [thread overview]
Message-ID: <1629734809.226a9f4dedae29d22e333c215d32d25292da0a78.blueness@gentoo> (raw)
commit: 226a9f4dedae29d22e333c215d32d25292da0a78
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 23 16:06:49 2021 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Aug 23 16:06:49 2021 +0000
URL: https://gitweb.gentoo.org/proj/eudev.git/commit/?id=226a9f4d
src/udev/udev-event.c: clean up whitespaces
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
src/udev/udev-event.c | 72 +++++++++++++++++++++++++--------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 64cc69cbc..1c1b0d273 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -813,7 +813,7 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
int sk;
struct ifreq ifr;
- log_debug("changing net interface name from '%s' to '%s'\n",oldname,name);
+ log_debug("changing net interface name from '%s' to '%s'\n",oldname,name);
sk = socket(PF_INET, SOCK_DGRAM, 0);
if (sk < 0)
@@ -825,61 +825,61 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char *
r = ioctl(sk, SIOCSIFNAME, &ifr);
#ifdef ENABLE_RULE_GENERATOR
- int loop;
+ int loop;
struct ifreq ifr_tmp;
- if (r == 0) {
- log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
- goto out;
- }
- /* keep trying if the destination interface name already exists */
- log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
- ifr.ifr_name, ifr.ifr_newname);
+ if (r == 0) {
+ log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+ goto out;
+ }
+ /* keep trying if the destination interface name already exists */
+ log_debug("collision on rename of network interface %s to %s , retrying until timeout\n",
+ ifr.ifr_name, ifr.ifr_newname);
- /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
+ /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */
memzero(&ifr_tmp, sizeof(struct ifreq));
strscpy(ifr_tmp.ifr_name, IFNAMSIZ, oldname);
- snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
+ snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname);
r = ioctl(sk, SIOCSIFNAME, &ifr_tmp);
- log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
-
- /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
+ log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname);
+
+ /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */
strscpy(ifr.ifr_name, IFNAMSIZ, ifr_tmp.ifr_newname);
- r = -errno;
- if (r != -EEXIST)
- goto out;
+ r = -errno;
+ if (r != -EEXIST)
+ goto out;
- /* wait a maximum of 90 seconds for our target to become available */
- loop = 90 * 20;
- while (loop--) {
- const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
+ /* wait a maximum of 90 seconds for our target to become available */
+ loop = 90 * 20;
+ while (loop--) {
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
- nanosleep(&duration, NULL);
+ nanosleep(&duration, NULL);
- r = ioctl(sk, SIOCSIFNAME, &ifr);
- if (r == 0) {
- log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
- break;
- }
- r = -errno;
- if (r != -EEXIST)
- break;
- }
+ r = ioctl(sk, SIOCSIFNAME, &ifr);
+ if (r == 0) {
+ log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+ break;
+ }
+ r = -errno;
+ if (r != -EEXIST)
+ break;
+ }
out:
#endif
- if (r < 0)
+ if (r < 0)
log_error_errno(-errno, "Error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
- else
- log_debug("renamed network interface '%s' to '%s'", oldname, name);
+ else
+ log_debug("renamed network interface '%s' to '%s'", oldname, name);
close(sk);
return r;
}
static int rename_netif(struct udev_event *event) {
- return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name);
+ return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name);
}
void udev_event_execute_rules(struct udev_event *event,
@@ -944,7 +944,7 @@ void udev_event_execute_rules(struct udev_event *event,
*/
#ifdef ENABLE_RULE_GENERATOR
- int r;
+ int r;
if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") &&
(event->name == NULL && (r=udev_rules_assigning_name_to(rules,udev_device_get_sysname(dev))) > 0 ||
event->name != NULL && !streq(event->name, udev_device_get_sysname(dev)))) {
next reply other threads:[~2021-08-23 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 16:06 Anthony G. Basile [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-08-23 16:03 [gentoo-commits] proj/eudev:master commit in: src/udev/ Anthony G. Basile
2021-08-23 15:55 Anthony G. Basile
2021-02-09 19:08 Anthony G. Basile
2021-02-09 19:08 Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1629734809.226a9f4dedae29d22e333c215d32d25292da0a78.blueness@gentoo \
--to=blueness@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox