From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rd2yU-0000xd-6q for qemu-devel@nongnu.org; Tue, 20 Dec 2011 11:55:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rd2yO-0007Hh-5W for qemu-devel@nongnu.org; Tue, 20 Dec 2011 11:55:34 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:65086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rd2yN-0007HY-WA for qemu-devel@nongnu.org; Tue, 20 Dec 2011 11:55:28 -0500 Received: by iagj37 with SMTP id j37so11829665iag.4 for ; Tue, 20 Dec 2011 08:55:26 -0800 (PST) Message-ID: <4EF0BDFA.7060600@codemonkey.ws> Date: Tue, 20 Dec 2011 10:55:22 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1324399916-21315-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1324399916-21315-1-git-send-email-aliguori@us.ibm.com> Content-Type: multipart/mixed; boundary="------------000301060206070501020202" Subject: Re: [Qemu-devel] [PATCH 00/27] qom: add QEMU Object Model type hierarchy to qdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , qemu-devel@nongnu.org, Markus Armbruster This is a multi-part message in MIME format. --------------000301060206070501020202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 12/20/2011 10:51 AM, Anthony Liguori wrote: > This is series 2/4 of the QOM refactoring. These series are divided up based > on the major scripted code conversions. Dang, this should have been an RFC, apologies. > > This series makes qdev a proper Object and converts qdev's type inheritance to > QOM inheritance. > > The first half of the series are manual cleanups/refactorings. The second half > is mostly scripted conversion, separated out into reviewable and bisectable > chunks. > > There are a number of patches prefixed with 'not-for-upstream'. As is not > surprising with a refactoring like this, it turned up some interesting corner > cases. Part of the purpose of this RFC is to get some feedback on how to best > handle these cases. > > I've tested this series extensively for the pc target including bisectability. > I've tested this series extensively for the pc target including bisectability. > I have not tested any other targets yet so your mileage may vary. > > This is also available at: > > https://github.com/aliguori/qemu/tree/qom-upstream.5 > > For full context, the whole tree is located at: > > https://github.com/aliguori/qemu/commits/qom-rebase.6 > > I'll reply to this note with a code of the patch monkey script I used for much > of this series. Attached here. Regards, Anthony Liguori > --------------000301060206070501020202 Content-Type: text/x-python; name="patch-monkey.py" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-monkey.py" import sys info = 'SSISlaveInfo' klass = 'SSISlaveClass' cast = 'SSI_SLAVE_CLASS' lines = sys.stdin.read().split('\n') i = 0 while i < len(lines): line = lines[i] i += 1 if line.startswith('static %s ' % info): if not line.endswith('info = {'): raise Exception('Cannot process this form "%s"' % line) name = line.split()[2][:-5] items = [] processed_lines = [] while i < len(lines) and lines[i] != '};': line = lines[i] i += 1 processed_lines.append(line) if line.strip() == '' or line.strip().startswith('/*'): continue try: key, value = map(lambda x: x.strip(), line.split('=', 1)) if value.endswith(','): value = value[:-1] except: sys.stdout.write('\n'.join(processed_lines)) raise if key == '.qdev.props' and value.startswith('('): properties = [] while i < len(lines) and lines[i].strip() not in ['},', '}']: line = lines[i] i += 1 line = line.strip() if line.endswith(','): line = line[:-1] properties.append(line) if i == len(lines): raise Exception('Cannot find end of properties') i += 1 value = properties items.append((key, value)) if i == len(lines): raise Exception('Cannot find end of type info') i += 1 props = filter(lambda (x,y): x == '.qdev.props', items) if len(props) and type(props[0][1]) == list: print 'static Property %s_properties[] = {' % name for prop in props[0][1]: print ' %s,' % prop print '};' print print '''static void %s_class_init(ObjectClass *klass, void *data) { %s *k = %s(klass); ''' % (name, klass, cast) for key, value in items: if key.startswith('.qdev.'): continue print ' k->%s = %s;' % (key[1:], value) print '''} static DeviceInfo %s_info = {''' % name for key, value in items: if not key.startswith('.qdev.'): continue if key == '.qdev.props' and type(value) == list: print ' .props = %s_properties,' % name else: print ' %s = %s,' % (key[5:], value) print ' .class_init = %s_class_init,' % (name) print '};' elif i < len(lines): print line --------------000301060206070501020202--