[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH v4 0/9] loop: Micro-refactoring set_loop() and add LOOP_CONFIGURE
From: Xiaoming Ni <nixiaoming () huawei ! com>
Date: 2022-11-21 13:58:10
Message-ID: 20221121135819.413-1-nixiaoming () huawei ! com
[Download RAW message or body]
LOOP_CONFIGURE is added to Linux 5.8
This allows userspace to completely setup a loop device with a single
ioctl, removing the in-between state where the device can be partially
configured - eg the loop device has a backing file associated with it,
but is reading from the wrong offset.
https://lwn.net/Articles/820408/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3448914e8cc5
patch 1-8: To facilitate the addition of new functions, the code of set_loop() is micro-refactored.
function old new delta
set_loop 760 716 -44
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-44) Total: -44 bytes
patch 9: add LOOP_CONFIGURE
Builders can use config to choose which algorithm to build into their busybox binary
---
v4: Fine-tuned based on review comments
patch2: add assert(dev_size >= LOOP_NAMESIZE) in get_next_free_loop().
patch6,8,9: The const modifier is added to the "bb_loop_info *loopinfo" parameter.
v3: http://lists.busybox.net/pipermail/busybox/2022-November/090009.html
Fine-tuned based on review comments
patch2: Rename local variables, use "loopdevno" instead of "i" in get_next_free_loop().
patch7: Reduce indentation using guard statements in do_stat_and_mknod().
patch9: Rename set_loop_configure_old() to set_loop_fd_and_status()
v2: http://lists.busybox.net/pipermail/busybox/2022-November/089990.html
changes in patch9: add config for builder to select
v1: http://lists.busybox.net/pipermail/busybox/2022-November/089969.html
---
Xiaoming Ni (9):
loop:refactor: extract subfunction open_file()
loop:refactor: extract subfunction get_next_free_loop()
loop:refactor: del close_and_try_next_loopN
loop:refactor: extract subfunction set_loop_info()
loop:refactor: extract subfunction set_loop_configure()
loop:refactor: Use a structure to reduce parameters
loop:refactor: Extract subfunction do_stat_and_mknod()
loop:refactor: extract subfunction set_loop_dev()
loop: Add LOOP_CONFIGURE ioctl
libbb/Config.src | 22 ++++
libbb/loop.c | 295 ++++++++++++++++++++++++++++++-----------------
2 files changed, 214 insertions(+), 103 deletions(-)
--
2.27.0
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic