On Thu, Mar 15, 2007 at 06:11:55PM +0900, Magnus Damm wrote: > On Thu, 2007-03-15 at 14:30 +0530, Vivek Goyal wrote: > > On Thu, Mar 15, 2007 at 05:53:19PM +0900, Magnus Damm wrote: > > > Move memory range variables > > > > > > The common kexec code is currently using two global variables to keep > > > track of memory ranges. Other data is kept in a per-instance structure. > > > This mix is of per-instance and global variables is confusing and leads > > > to messy code in general. So let's not. > > > > > > > These two variable are static and limited to usage by this file only. > > Moving to kexec_info makes them visible to everybody and they don't have > > to. > > > > Not sure how does it make code better. I think we don't have to do this. > > Haha, I _knew_ that you would say that. =) > > Yes, the variables are limited to that file only. But I do think it is > bad coding practice to use a mix of static/global and per-instance > variables. And it is being done all over kexec-tools. > > Such coding practice IMO leads to messy code and people cooking pasta by > calling stuff from everywhere. For instance, try to follow the setup and > use of the structure memory_range in kexec-ia64.c. It's a mess.
That's fine but that's the fundamental difference between global variables and static global variables. What you seem to be suggesting that lets take out all the static global variables and make them pure global by putting in a common structure which is passed around. IMHO, does not make much sense to me. If some variables are limited to a file and not truly global, we don't have to make them visible to everybody. This will also lead to unrequired burden on stack as so many functions pass around kexec_info. What others think? Thanks Vivek _______________________________________________ fastboot mailing list [email protected] https://lists.osdl.org/mailman/listinfo/fastboot
