Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2570098rdb; Fri, 8 Dec 2023 11:58:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyg9ZSoRw1f4VyEwhQExNdfwh/wV+uM0/90SCdKdhRKljGWl3A6D/9oE1ked5G6R3CE+ZP X-Received: by 2002:a05:6a00:4b4a:b0:6ce:7faa:29ad with SMTP id kr10-20020a056a004b4a00b006ce7faa29admr606250pfb.10.1702065510241; Fri, 08 Dec 2023 11:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702065510; cv=none; d=google.com; s=arc-20160816; b=zJ6Bb2iqeUPbdNgAU/5sFcCMrclaqc8imBuCGcmcyAd99+NmkQw4aiz7BVKfEEoZEa nkNXdNHs0Myjjno+ehAVXDZPbYo/ob1fWPjPxUsTwFmFHdxkjqSjW7Y7+2FEqQJaG6zH /Ek6Jq2/96xwI9oiNoPQ7Li9Zj6IA4eWE1bmwfEdm1KUZxogGgkL1ipRxkY1r0ILauIr uDytuNQER53baDK/oZWSOzRV8cymVLAleHavR1NdgwbEeSlrZ1oIA0NI/QXR09+U8lsH WIrnB2tP2lkfvOoXYU2jIoltNgWVvYQqjjVFradajc9ZaeA0Y2hzMyrJMncX3B4VVWAw Ft0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=TsaD7mhW8SXQP1nbpaw4AQMft3LLxjzczN7R3X3tAxQ=; fh=3WtdpnaT3x+kS+/7xEipPlscXTITe2NSe8s2CVVwbIk=; b=woxiYTIdreBhlyq4KyXWOc9BRPqmS8I+dHzvIzuKUD8Bp9vcClLOPrw359n78knIQu lnRZ5LlMMf+oPo1CQhlFE76dkeghTHnljrn8bPIgk0v11fBh4lnXs+3uPn07rgHFUide ndTAnLt3nq+viKjlwPCBdeH34491ImdslcnawG8gXkJEQcEDP44+5MGBAez5P/4cJGfC NCgCy4l3MO0/3+ghe5riYjeKS/F3IzMBRrsAzrKT7CzUlgoDE83QyPAGlr7YYy4wD2x5 oBmtui0+9/Fuc+eXFOD1NYY2+Fg5kulDqvtYl8HpV2l5wy0Gz8awTLgCbPmyp8eg7okp 95hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="r8wNqSd/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cj25-20020a056a00299900b006cd905021d4si2011695pfb.367.2023.12.08.11.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 11:58:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="r8wNqSd/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D8AC781EEBE4; Fri, 8 Dec 2023 11:58:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233969AbjLHT6O (ORCPT + 99 others); Fri, 8 Dec 2023 14:58:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjLHT6M (ORCPT ); Fri, 8 Dec 2023 14:58:12 -0500 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F24B6173B for ; Fri, 8 Dec 2023 11:58:16 -0800 (PST) Date: Fri, 8 Dec 2023 14:58:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702065495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TsaD7mhW8SXQP1nbpaw4AQMft3LLxjzczN7R3X3tAxQ=; b=r8wNqSd/u9g5IyjKN6ZrfGfi8UvmYzVZvDTBKpMA8L/A0HyY8PSd9pb9uqtoc8VJzsAm5h NUJSsXmCtd0WZcMtOCo+G6RmAn7Deo0J4prFrniY3miadYKZ1B7nX9m6iODDWndhIpOXF5 MTwcc2S3heTAvuFucv4fGqpPHv3sGkw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Peter Zijlstra Cc: Christian Brauner , Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Alexander Viro , Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Dan Williams , Kees Cook , Matthew Wilcox , Thomas Gleixner , Daniel Xu , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 5/7] rust: file: add `Kuid` wrapper Message-ID: <20231208195809.fzpezhcntqsm2ub3@moria.home.lan> References: <20231129-alice-file-v1-0-f81afe8c7261@google.com> <20231129-alice-file-v1-5-f81afe8c7261@google.com> <20231129-etappen-knapp-08e2e3af539f@brauner> <20231129164815.GI23596@noisy.programming.kicks-ass.net> <20231130-wohle-einfuhr-1708e9c3e596@brauner> <20231206195911.vcp3c6q57zvkm7bf@moria.home.lan> <20231208162616.GH28727@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231208162616.GH28727@noisy.programming.kicks-ass.net> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 08 Dec 2023 11:58:28 -0800 (PST) On Fri, Dec 08, 2023 at 05:26:16PM +0100, Peter Zijlstra wrote: > On Wed, Dec 06, 2023 at 02:59:11PM -0500, Kent Overstreet wrote: > > > I suspect even if the manpower existed to go that route we'd end up > > regretting it, because then the Rust compiler would need to be able to > > handle _all_ the craziness a modern C compiler knows how to do - > > preprocessor magic/devilry isn't even the worst of it, it gets even > > worse when you start to consider things like bitfields and all the crazy > > __attributes__(()) people have invented. > > Dude, clang can already handle all of that. Both rust and clang are > build on top of llvm, they generate the same IR, you can simply feed a > string into libclang and get IR out of it, which you can splice into > your rust generated IR. If only it were that simple :) This is struct definitions we're talking about, not code, so what you want isn't even IR, what you're generating is a memory layout for a type, linked in with all your other type information. And people critize Linux for being a giant monorepo that makes no considerations for making our code reusable in other contexts; clang and LLVM are no different. But that's not really the issue because you're going to need a huge chunk of clang to even parse this stuff, what you really want is a way to invoke clang and dump _type information_ in a standardized, easy to consume way. What you want is actually more akin to the debug info that's generated today. So... yeah, sure, lovely if it existed, but not the world we live in :) (As an aside, I've actually got an outstanding bug filed with rustc because it needs to be able to handle types that are marked both packed and aligned... if anyone in this thread _does_ know some rust compiler folks, we need that for bcachefs on disk format types).