[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v8 20/24] x86: L2 CAT: implement set value flow.
On Wed, 2017-03-01 at 14:59 +0800, Yi Sun wrote: > On 17-02-28 15:25:39, Roger Pau Monn� wrote: > > The logic of this function is kind of weird IMHO, you seem to be > > able to return > > an error, and also a parameter that indicates success ("found"). > > Can't this be > > simplified to simply return an error code, and the found parameter > > removed? > > > In find_cos(), compare_val() is called to check if there is already a > COS ID > that all features values are same as input. All features in list > should be > checked. The 'found' is used record the final result, if all features > values are > same as input value array. You can see, after traversal of feature > list, we > return the cos if found is true. > So, you can, for instance, use different error values, and check for which one has been returned in the caller. Like, use ENOENT for 'invalid ID' as you're doing right now, and, say, ESRCH, for 'feature not found'. Is that right? > Of course, I can change the function to remove 'found' from the > parameter. > But is it so necessary? Thanks! > It's hard to tell whether it is "so necessary", but I agree with Roger that it would improve the code. :-) Regards, Dario -- <<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) Attachment:
signature.asc _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |