Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1221669lqe; Mon, 8 Apr 2024 02:26:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlK4sUvUaVsiyIsUv/6+Jolzl9Roh4okT9KMKZYHgefyysjJbnMz+30dE40j0BCoMQDPgs9bjfXpqDF8rEBj6Jwa8gwxf4+DcYP7PX3Q== X-Google-Smtp-Source: AGHT+IEQro4Z9ycaj5pnwj+AXGGZuIROAq08nhKaBBxUBtjGOM4Nfey2hGS1mEb5CClKZSriwr1e X-Received: by 2002:a05:6a00:3a03:b0:6ea:b9ef:f482 with SMTP id fj3-20020a056a003a0300b006eab9eff482mr9858031pfb.24.1712568404092; Mon, 08 Apr 2024 02:26:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712568404; cv=pass; d=google.com; s=arc-20160816; b=EwiAC17h2OClLwp+fZs0MPAYh1FoaWalId1+j5F8TW3f1D+RqKyOS0Z8iQ0/jGXHl1 6CtheqbkpRpVixEAGrV5Tw3SwV5b1QU0A06uemhuuWho+O6h87X588UP88wkvyXOF1+b d0uD+8CC7gvxFdfv2xTWIEWQ87u+jRBL+bFm7dNlCTgli30uGhUXcRdpqKPiOIgd0B7n DwSVEu5WkMcFq0S8Huh1KnImXBaVviZQTjuVMhWrQ82dtK4SBgEIgJAFzlvvD5YV55zC h38jo5n8P2sqpX/GNwvGIIaF4EmdMAcfFOg/v2AGe1I9+kwQJy7YPleZLpgkcLHl3+LJ 1Bcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=oIy9SeLJ1nvzPDO0+gT7LUDRnqZqv1g2qTZnmvRtF8w=; fh=87obiwa1cJ8hB2kBlQYjH1eMXlObt5vDAYdJNXrIlTQ=; b=HSw2T/9kSdvJostu5q7zFyFVRg/1YxYUBO9xqoK9onEEcsP19xcao4C1QTBTM+kC3S hcrb6hZ0T9MOTTYgZ8JWDY9mIRzsq66AECskBOrXkE4ZLfHCOYSsJwWV1LcEKCt24Ya8 a3J1uu+ZdENN9jtjtkoyix/xdJHUpdFhFG6FVB8Oo/bae+DqE7MTBXPH02/2MzCtk+SV YbWM6sRRfBBWBtUO2lJte5J+Zt/IJ/M16WQwpwAOzVM6EwRPXqLJQTxC8AA22y8cT6Fa VFZfqvDtPQprl+MNZMJAFD6D4IIYPNT+tZBa/E2TUJthTZjws+vWLHpEIqThkAeyBGLA jjJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3WaA6Qpf; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135142-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u19-20020a056a00099300b006e8f9f031a4si6134482pfg.258.2024.04.08.02.26.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 02:26:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135142-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3WaA6Qpf; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135142-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B10C62816C6 for ; Mon, 8 Apr 2024 09:26:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DACE347F6A; Mon, 8 Apr 2024 09:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3WaA6Qpf" Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8430247A7D for ; Mon, 8 Apr 2024 09:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712568397; cv=none; b=q+qaJPdyrA/SX4grJwoxkdIKFT59Pj5TgKP58Rjt4/um64VprK8hN2hXdtM3oZmWZfr7ACch6i2gWWyCO51mE+BhXFLmjtt3rFOEqi+oFQnkvu4K3rXKVcRuCruloU3QwgjCHNYMicUdPPa3BvH7nUio/Ik1zuXD+5hOhQLoIgY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712568397; c=relaxed/simple; bh=oFfg9XsxElE7cRN9U3m13pRPYNa0LsdhfdKdd2Ctvkw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=s5GcKJjVCGBH/ac5vC7zknWNIvGM+YVskAPdeYl6PtR3Dh5uB4rXxWcBWMavn8VB+sSRdlTGFklPhu5coLz62mEgjopIS3YKckF7eYSRNADCOp6jUE9kFGjMvok3eDwzZpkQYF50BimsvpMs2C9+klqlxcIdaV47YM1hSHxvglI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3WaA6Qpf; arc=none smtp.client-ip=209.85.221.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-4daa2b076beso1141700e0c.1 for ; Mon, 08 Apr 2024 02:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712568394; x=1713173194; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oIy9SeLJ1nvzPDO0+gT7LUDRnqZqv1g2qTZnmvRtF8w=; b=3WaA6QpftjDJHVSsMe+qcWz50x+ihCAkGZh+u3P3CwtfeEuG8nTgS0uek+mJ3MfFbU Nj+bZVQtfkMHjDv1BIsPNqjSTgVOOP2UK0nDIxBxXXOE3doe9ZJ5htj3mGqyjoAIBQGk g6Kmqd9aLtx67ni/9jciuA+CmaZlDUTUgLB3FY8DTJTdHRcwA8btvKn/fSKDiPi6st8O JwdGdVNLvzrca8Ykee5YoW+97hUZCB/HIB9e53UN1v9X7vEPboSXopJvkZoaH+kPV28M oBe1Ejh51vL93C7Vd/VWXYizchLe31aBRCewg4umCXOSarIN8CZke96MhJT5WTH5Oeke FUkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712568394; x=1713173194; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oIy9SeLJ1nvzPDO0+gT7LUDRnqZqv1g2qTZnmvRtF8w=; b=ng4V1px3hsI+O3aI00+M7mMsw1jVkmQHFwWSxRLwpIFFrHALMX2CRd7zdn0gJoCgTT OSdtSrSlwy8IqUzjeA2FHRTOGd/oMNZln+0oG2j9sZiJATzhzc7LFUTArEFOtml5kZhx 7ldIKy1o39j+Os1/OitIBVjesnbQQAKkJoR7M/skdZ8pHMPRoR0UfxmhVuo7T2mkI53z Kj+i+ZyPkgkKrF1Egs+wtgodMUzEMQxgMfG3y7IuXIENUG50kAXBe1d2xZus3wDclaZi 4ixWJ+Ne8J9hJfWGROhbHXugNnh4K8FjHJZo0s50MkG4eQ7cBuNIlg/gwgBsCZco0tjc fzdg== X-Forwarded-Encrypted: i=1; AJvYcCXFH/iXtZN50vE5+O2utH+7qF+Mb089xSbh4TX6yEhe8204774wd6P2n9dhlf5DTOttlwI/rgwnDWu1lzZRfsrBBpQGRecdLbLnSZu3 X-Gm-Message-State: AOJu0YwVjG6YS3nxq1qL6QzRtw+1pc8btsIfvMDmB2Wj0g3NkqesoVq2 dbR0l4YIdT1+C5IqixOifdeaESDNy40MoxK347WN+D4OUpPhZBvZC/WNqww3Y2vv4ISkmOCwq+C BbIgUGQHr0Z3iTFiecaKd+1F29JT6UI4s+t1K X-Received: by 2002:a05:6122:4809:b0:4d3:35ac:3553 with SMTP id ef9-20020a056122480900b004d335ac3553mr4054281vkb.10.1712568394315; Mon, 08 Apr 2024 02:26:34 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240404-alice-mm-v4-0-49a84242cf02@google.com> <20240404-alice-mm-v4-4-49a84242cf02@google.com> In-Reply-To: From: Alice Ryhl Date: Mon, 8 Apr 2024 11:26:23 +0200 Message-ID: Subject: Re: [PATCH v4 4/4] rust: add abstraction for `struct page` To: Miguel Ojeda Cc: Benno Lossin , Miguel Ojeda , Matthew Wilcox , Al Viro , Andrew Morton , Kees Cook , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Christian Brauner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 8, 2024 at 11:19=E2=80=AFAM Miguel Ojeda wrote: > > On Mon, Apr 8, 2024 at 9:54=E2=80=AFAM Alice Ryhl = wrote: > > > > From bindgen's point of view, this constant is just an integer literal > > with no type information. So I don't see how we can expect it to > > always be generated as a usize? > > In the case of `PAGE_SIZE`, there is type information (`size_t`), > since it comes from the constant helper: > > const size_t RUST_CONST_HELPER_PAGE_SIZE =3D PAGE_SIZE; > > For the other one, `PAGE_SHIFT`, there is also type information > (`int`), but bindgen currently picks a type based on the value for > those (but ideally/eventually bindgen should respect it instead). > > So for the former, the allow and the cast are not needed since we are > already handling it explicitly. And for the latter, if we want to have > it as `usize`, we should have the cast but not the allow, because now > it does `u32`, but if it respected the type, it would be `c_int` or > `i32`. So either way we would need the cast. Good point. Will fix this for next version. Alice