Re: [PATCH 2/5] bio.h: Declare the arguments of bio iteration functions const

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

 



On Sat, May 16, 2020 at 2:19 AM Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> This change makes it possible to pass 'const struct bio *' arguments to
> these functions.
>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Ming Lei <ming.lei@xxxxxxxxxx>
> Cc: Damien Le Moal <damien.lemoal@xxxxxxx>
> Cc: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
> Cc: Alexander Potapenko <glider@xxxxxxxxxx>
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  include/linux/bio.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index a0ee494a6329..58e6134b1c05 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -70,7 +70,7 @@ static inline bool bio_has_data(struct bio *bio)
>         return false;
>  }
>
> -static inline bool bio_no_advance_iter(struct bio *bio)
> +static inline bool bio_no_advance_iter(const struct bio *bio)
>  {
>         return bio_op(bio) == REQ_OP_DISCARD ||
>                bio_op(bio) == REQ_OP_SECURE_ERASE ||
> @@ -138,8 +138,8 @@ static inline bool bio_next_segment(const struct bio *bio,
>  #define bio_for_each_segment_all(bvl, bio, iter) \
>         for (bvl = bvec_init_iter_all(&iter); bio_next_segment((bio), &iter); )
>
> -static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
> -                                   unsigned bytes)
> +static inline void bio_advance_iter(const struct bio *bio,
> +                                   struct bvec_iter *iter, unsigned bytes)
>  {
>         iter->bi_sector += bytes >> 9;
On a related note, should this 9 be SECTOR_SHIFT?


-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux