Re: [PATCH v3] mru: Replace mru.[ch] with list.h implementation

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

 



On Sun, Jan 21, 2018 at 4:38 AM, René Scharfe <l.s.r@xxxxxx> wrote:
>
> Am 20.01.2018 um 23:24 schrieb Gargi Sharma:
> > On Sat, Jan 20, 2018 at 1:02 AM, Eric Wong <e@xxxxxxxxx> wrote:
> >> Gargi Sharma <gs051095@xxxxxxxxx> wrote:
> >>> --- a/list.h
> >>> +++ b/list.h
> >>> @@ -93,6 +93,13 @@ static inline void list_move(struct list_head *elem, struct list_head *head)
> >>>        list_add(elem, head);
> >>>   }
> >>>
> >>> +/* Move to the front of the list. */
> >>> +static inline void list_move_to_front(struct list_head *elem, struct list_head *head)
> >>> +{
> >>> +     list_del(elem);
> >>> +     list_add(elem, head);
> >>> +}
> >>> +
> >>
> >> Since we already have list_move and it does the same thing,
> >> I don't think we need a new function, here.
> >>
> >> Hackers coming from other projects (glibc/urcu/Linux kernel)
> >> might appreciate having fewer differences from what they're used
> >> to.
> >
> > I think the idea behind this function was that it is already being used in two
> > places in the code and might be used in other places in the future. I agree
> > with your stance, but a list_move_to_front is pretty self explanatory and not
> > too different, so it should be alright.
>
> Not sure I understand the point about the function being already used as
> an argument for adding it, but if there is already one which has the
> exact sane behavior (list_move() in this case) then that should be used
> instead of adding a duplicate.

Thanks for bringing this to my attention, René. I can use list_move()
to do the exact
same thing as list_move_to_front(). Will send another version.

Thanks,
Gargi
>
> René
>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux