lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6352B3B2-0B76-4D7A-A377-CEE7AB15E27B@dilger.ca>
Date:   Fri, 18 Nov 2022 07:36:10 -0600
From:   Andreas Dilger <adilger@...ger.ca>
To:     "Ritesh Harjani (IBM)" <ritesh.list@...il.com>
Cc:     Theodore Ts'o <tytso@....edu>, linux-ext4@...r.kernel.org,
        Harshad Shirwadkar <harshadshirwadkar@...il.com>,
        Wang Shilong <wshilong@....com>,
        Andreas Dilger <adilger.kernel@...ger.ca>, Li Xi <lixi@....com>
Subject: Re: [RFCv1 08/72] libext2fs: Add bitmaps merge ops

On Nov 7, 2022, at 06:23, Ritesh Harjani (IBM) <ritesh.list@...il.com> wrote:
> 
> From: Wang Shilong <wshilong@....com>
> 
> Signed-off-by: Li Xi <lixi@....com>
> Signed-off-by: Wang Shilong <wshilong@....com>
> [Note: splitted rb merge tree logic patch such that we
> seperate out libext2fs changes from e2fsck specific changes]
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>

Reviewed-by: Andreas Dilger <adilger@...ger.ca>

> ---
> lib/ext2fs/bitmaps.c      | 10 ++++++++++
> lib/ext2fs/bmap64.h       |  4 ++++
> lib/ext2fs/ext2fs.h       |  8 ++++++++
> lib/ext2fs/gen_bitmap64.c | 29 +++++++++++++++++++++++++++++
> 4 files changed, 51 insertions(+)
> 
> diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
> index 8bfa24b1..9437331e 100644
> --- a/lib/ext2fs/bitmaps.c
> +++ b/lib/ext2fs/bitmaps.c
> @@ -45,6 +45,16 @@ errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
> {
>    return (ext2fs_copy_generic_bmap(src, dest));
> }
> +
> +errcode_t ext2fs_merge_bitmap(ext2fs_generic_bitmap src,
> +                  ext2fs_generic_bitmap dest,
> +                  ext2fs_generic_bitmap dup,
> +                  ext2fs_generic_bitmap dup_allowed)
> +{
> +    return ext2fs_merge_generic_bmap(src, dest, dup,
> +                     dup_allowed);
> +}
> +
> void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map)
> {
>    ext2fs_set_generic_bmap_padding(map);
> diff --git a/lib/ext2fs/bmap64.h b/lib/ext2fs/bmap64.h
> index de334548..555193ee 100644
> --- a/lib/ext2fs/bmap64.h
> +++ b/lib/ext2fs/bmap64.h
> @@ -72,6 +72,10 @@ struct ext2_bitmap_ops {
>    void    (*free_bmap)(ext2fs_generic_bitmap_64 bitmap);
>    errcode_t (*copy_bmap)(ext2fs_generic_bitmap_64 src,
>                 ext2fs_generic_bitmap_64 dest);
> +    errcode_t (*merge_bmap)(ext2fs_generic_bitmap_64 src,
> +                ext2fs_generic_bitmap_64 dest,
> +                ext2fs_generic_bitmap_64 dup,
> +                ext2fs_generic_bitmap_64 dup_allowed);
>    errcode_t (*resize_bmap)(ext2fs_generic_bitmap_64 bitmap,
>                   __u64 new_end,
>                   __u64 new_real_end);
> diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
> index 443f93d2..54aed5d1 100644
> --- a/lib/ext2fs/ext2fs.h
> +++ b/lib/ext2fs/ext2fs.h
> @@ -870,6 +870,10 @@ extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
> extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
> extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
>                    ext2fs_generic_bitmap *dest);
> +extern errcode_t ext2fs_merge_bitmap(ext2fs_generic_bitmap src,
> +                  ext2fs_generic_bitmap dest,
> +                  ext2fs_generic_bitmap dup,
> +                  ext2fs_generic_bitmap dup_allowed);
> extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
>                          const char *descr,
>                          ext2fs_block_bitmap *ret);
> @@ -1467,6 +1471,10 @@ void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
> errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
>                     __u64 new_end,
>                     __u64 new_real_end);
> +errcode_t ext2fs_merge_generic_bmap(ext2fs_generic_bitmap gen_src,
> +                                    ext2fs_generic_bitmap gen_dest,
> +                    ext2fs_generic_bitmap gen_dup,
> +                    ext2fs_generic_bitmap dup_allowed);
> errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
>                      ext2fs_generic_bitmap bm1,
>                      ext2fs_generic_bitmap bm2);
> diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
> index f7710afd..c31f942f 100644
> --- a/lib/ext2fs/gen_bitmap64.c
> +++ b/lib/ext2fs/gen_bitmap64.c
> @@ -346,6 +346,35 @@ errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap gen_src,
>    return 0;
> }
> 
> +errcode_t ext2fs_merge_generic_bmap(ext2fs_generic_bitmap gen_src,
> +                    ext2fs_generic_bitmap gen_dest,
> +                    ext2fs_generic_bitmap gen_dup,
> +                    ext2fs_generic_bitmap gen_dup_allowed)
> +{
> +    ext2fs_generic_bitmap_64 src = (ext2fs_generic_bitmap_64)gen_src;
> +    ext2fs_generic_bitmap_64 dest = (ext2fs_generic_bitmap_64)gen_dest;
> +    ext2fs_generic_bitmap_64 dup = (ext2fs_generic_bitmap_64)gen_dup;
> +    ext2fs_generic_bitmap_64 dup_allowed = (ext2fs_generic_bitmap_64)gen_dup_allowed;
> +
> +    if (!src || !dest)
> +        return EINVAL;
> +
> +    if (!EXT2FS_IS_64_BITMAP(src) || !EXT2FS_IS_64_BITMAP(dest) ||
> +        (dup && !EXT2FS_IS_64_BITMAP(dup)) ||
> +        (dup_allowed && !EXT2FS_IS_64_BITMAP(dup_allowed)))
> +        return EINVAL;
> +
> +    if (src->bitmap_ops != dest->bitmap_ops ||
> +        (dup && src->bitmap_ops != dup->bitmap_ops) ||
> +        (dup_allowed && src->bitmap_ops != dup_allowed->bitmap_ops))
> +        return EINVAL;
> +
> +    if (src->bitmap_ops->merge_bmap == NULL)
> +        return EOPNOTSUPP;
> +
> +    return src->bitmap_ops->merge_bmap(src, dest, dup, dup_allowed);
> +}
> +
> errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap gen_bmap,
>                     __u64 new_end,
>                     __u64 new_real_end)
> -- 
> 2.37.3
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ