From: Yu Watanabe Date: Fri, 2 Sep 2022 15:39:07 +0000 (+0900) Subject: loop-util: rename loopdev -> node X-Git-Tag: v252-rc1~271^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=672780cde1b9f10a01991660d8c3f7e7b3e55253;p=thirdparty%2Fsystemd.git loop-util: rename loopdev -> node Preparation for the next commit. No functional change. --- diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index 32941c7fa1f..440a196eb33 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -358,7 +358,7 @@ static int loop_device_make_internal( LoopDevice **ret) { _cleanup_close_ int direct_io_fd = -1, lock_fd = -1; - _cleanup_free_ char *loopdev = NULL; + _cleanup_free_ char *node = NULL; bool try_loop_configure = true; struct loop_config config; LoopDevice *d = NULL; @@ -390,7 +390,7 @@ static int loop_device_make_internal( #endif nr = config.info.lo_number; - if (asprintf(&loopdev, "/dev/loop%i", nr) < 0) + if (asprintf(&node, "/dev/loop%i", nr) < 0) return -ENOMEM; } @@ -420,7 +420,7 @@ static int loop_device_make_internal( .fd = TAKE_FD(copy), .lock_fd = TAKE_FD(lock_fd), .nr = nr, - .node = TAKE_PTR(loopdev), + .node = TAKE_PTR(node), .relinquished = true, /* It's not allocated by us, don't destroy it when this object is freed */ .devno = st.st_rdev, .diskseq = diskseq, @@ -501,10 +501,10 @@ static int loop_device_make_internal( if (nr < 0) return -errno; - if (asprintf(&loopdev, "/dev/loop%i", nr) < 0) + if (asprintf(&node, "/dev/loop%i", nr) < 0) return -ENOMEM; - loop = open(loopdev, O_CLOEXEC|O_NONBLOCK|O_NOCTTY|open_flags); + loop = open(node, O_CLOEXEC|O_NONBLOCK|O_NOCTTY|open_flags); if (loop < 0) { /* Somebody might've gotten the same number from the kernel, used the device, * and called LOOP_CTL_REMOVE on it. Let's retry with a new number. */ @@ -532,7 +532,7 @@ static int loop_device_make_internal( /* Now close the loop device explicitly. This will release any lock acquired by * attach_empty_file() or similar, while we sleep below. */ loop = safe_close(loop); - loopdev = mfree(loopdev); + node = mfree(node); /* Wait some random time, to make collision less likely. Let's pick a random time in the * range 0ms…250ms, linearly scaled by the number of failed attempts. */ @@ -591,7 +591,7 @@ static int loop_device_make_internal( *d = (LoopDevice) { .fd = TAKE_FD(loop_with_fd), .lock_fd = TAKE_FD(lock_fd), - .node = TAKE_PTR(loopdev), + .node = TAKE_PTR(node), .nr = nr, .devno = st.st_rdev, .diskseq = diskseq,