qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] DO_UPCAST confusion


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] DO_UPCAST confusion
Date: Thu, 22 Oct 2015 09:26:36 +0200

  Hi,

> >     state = DO_UPCAST(InternalSnapshotState, common, common);
> 
> I much prefer the name container_of() (which is a bit more obvious that
> it is finding the container or derived type that embeds the parent
> type), but if we have to keep the ugly name, could we at least clean up
> the comment to make sense, and fix the name to be DO_DOWNCAST to match
> what it is actually doing?

We don't have to keep it.  DO_UPCAST is there for historical reasons,
was added with qdev.  It used to be used alot more, and the move from
qdev to QOM already killed alot of it.  But so far nobody went out
cleaning up the remaining places.

Feel free to go ahead and zap it.  But if you touch all the places
anyway please I'd much prefer a conversion to container_of() right away
instead of renaming it to something else.

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]