Re: [PATCH v3 1/2] loop.4: add some details about lo_flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Yang Xu,

On 9/9/20 2:05 PM, Yang Xu wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@xxxxxxxxxxxxxx>
> ---
>  man4/loop.4 | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/man4/loop.4 b/man4/loop.4
> index f4cf48043..5cc9a7e79 100644
> --- a/man4/loop.4
> +++ b/man4/loop.4
> @@ -136,6 +136,14 @@ Allow automatic partition scanning.
>  Use direct I/O mode to access the backing file.
>  .RE
>  .TP
> +The
> +.BR LOOP_SET_STATUS
> +can neither set the
> +.BR LO_FLAGS_READ_ONLY
> +nor
> +.BR LO_FLAGS_DIRECT_IO
> +lo_flags because they are exclusively set from kernel.
> +.TP
>  .B LOOP_GET_STATUS
>  Get the status of the loop device.
>  The (third)

Looking at the kernel code:

[[
> /* LO_FLAGS that can be set using LOOP_SET_STATUS(64) */
#define LOOP_SET_STATUS_SETTABLE_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN)

/* LO_FLAGS that can be cleared using LOOP_SET_STATUS(64) */
#define LOOP_SET_STATUS_CLEARABLE_FLAGS (LO_FLAGS_AUTOCLEAR)

/* LO_FLAGS that can be set using LOOP_CONFIGURE */
#define LOOP_CONFIGURE_SETTABLE_FLAGS (LO_FLAGS_READ_ONLY | LO_FLAGS_AUTOCLEAR \
                                       | LO_FLAGS_PARTSCAN | LO_FLAGS_DIRECT_IO)
]]

and

[[
        /* Mask out flags that can't be set using LOOP_SET_STATUS. */
        lo->lo_flags &= LOOP_SET_STATUS_SETTABLE_FLAGS;
        /* For those flags, use the previous values instead */
        lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_SETTABLE_FLAGS;
        /* For flags that can't be cleared, use previous values too */
        lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
]]

would it not be clearer and simpler just to say something like:

[[
The only lo_flags that can be modified using LOOP_SET_STATUS are
LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN.
]]

?

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux