From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25956 invoked by alias); 30 Sep 2011 15:12:33 -0000 Received: (qmail 25947 invoked by uid 22791); 30 Sep 2011 15:12:32 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,LOTS_OF_MONEY,RP_MATCHES_RCVD,SARE_SUB_OBFU_Q0,TW_RK X-Spam-Check-By: sourceware.org Received: from arroyo.ext.ti.com (HELO arroyo.ext.ti.com) (192.94.94.40) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Sep 2011 15:12:18 +0000 Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p8UFCEvM026154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Sep 2011 10:12:15 -0500 Received: from dlep26.itg.ti.com (smtp-le.itg.ti.com [157.170.170.27]) by dlep33.itg.ti.com (8.13.7/8.13.8) with ESMTP id p8UFCESZ005641; Fri, 30 Sep 2011 10:12:14 -0500 (CDT) Received: from dnce72.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id p8UFCE85023966; Fri, 30 Sep 2011 10:12:14 -0500 (CDT) Received: from dnce02.ent.ti.com ([137.167.131.106]) by dnce72.ent.ti.com ([137.167.131.87]) with mapi; Fri, 30 Sep 2011 17:12:14 +0200 From: "Turgis, Frederic" To: Josh Stone CC: SystemTap Content-Class: urn:content-classes:message Date: Fri, 30 Sep 2011 15:12:00 -0000 Subject: RE: container_of - complex indirections - guru code - workqueues Message-ID: <13872098A06B02418CF379A158C0F1460163921DAD@dnce02.ent.ti.com> References: <13872098A06B02418CF379A158C0F14601638252E6@dnce02.ent.ti.com> <4E84D76C.4000007@redhat.com> In-Reply-To: <4E84D76C.4000007@redhat.com> Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2011-q3/txt/msg00417.txt.bz2 > offsetof(type, member) =3D & @cast(0, "type")->member > container_of(ptr, type, member) =3D ptr - & @cast(0, "type")->member Very nice. In fact, I was not aware of the "&" and the 0 of @cast(0, ...) f= rom reading the doc (even if & makes sense and @cast(0,...) is used in taps= et). It opens new ideas to me >> On top of that, I also have the issue that definitions are sometimes >> internal to C file like "struct cpu_workqueue_struct" so I mix guru >> code and @cast (summarized below): Thanks for the rewrite. In fact, I shall better explain this point. "atomic_long_read(& $work->data= )" + "workqueue &=3D %{ WORK_STRUCT_WQ_DATA_MASK %}" are already duplicatio= n of content of get_work_cwq(...), which is static so guru can't call it. S= o I shall duplicate code. But tapset + & + @cast(0, ...) + rest of syntax are powerful enough to avoi= d guru for most of my needs. >Yes, please share -- we like getting new examples, as many >people start by only running those scripts. I will rewrite based on your inputs and share it. This is interesting for w= orkqueues and also in terms in syntax. Eventually new keywords shall be add= ed for syntax itself Regards Fred Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet= . 036 420 040 R.C.S Antibes. Capital de EUR 753.920