From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: [PATCH 1/2] KVM: Remove arch specific components from the general code Date: Fri, 27 Jul 2007 09:54:01 +1000 Message-ID: <1185494042.9484.29.camel@localhost.localdomain> References: <20070726144602.4847.64724.stgit@novell1.haskins.net> <20070726145204.4847.53350.stgit@novell1.haskins.net> <46A8B816.7080303@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Anthony Liguori Return-path: In-Reply-To: <46A8B816.7080303-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org On Thu, 2007-07-26 at 10:04 -0500, Anthony Liguori wrote: > How are you planning on going about switching to container_of()? Commit > this, commit Rusty's stuff, then commit a fix or commit Rusty's stuff, > then update your patch set? My patch is less mature, and am still arguing with Avi about the details. So I'll pull in Gregory's patch and try to work mine on top. They overlap somewhat, but mine should get rid of some of the warts, including converting to container_of, and getting rid of "valid". > > static void svm_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code) > > { > > - vcpu->svm->vmcb->control.event_inj = SVM_EVTINJ_VALID | > > + svm(vcpu)->vmcb->control.event_inj = SVM_EVTINJ_VALID | > > SVM_EVTINJ_VALID_ERR | > > SVM_EVTINJ_TYPE_EXEPT | > > GP_VECTOR; > > - vcpu->svm->vmcb->control.event_inj_err = error_code; > > + svm(vcpu)->vmcb->control.event_inj_err = error_code; > > } > > I'm willing to concede on using the name "svm()" here although I think Kernel convention seems to be converging on "to_", so "to_vcpu_svm" (although "svm_vcpu" rings better than "vcpu_svm" to me, but that's minor). static inline struct vcpu_svm *to_vcpu_svm(struct kvm_vcpu *vcpu) { #if LATER return container_of(vcpu, struct vcpu_svm, vcpu); #else return vcpu->_priv; #endif } Cheers, Rusty. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/