public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
* [tools PATCH 0/1] 32-bit build issues
@ 2024-06-20  4:58 David Disseldorp
  2024-06-20  4:58 ` [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn David Disseldorp
  0 siblings, 1 reply; 3+ messages in thread
From: David Disseldorp @ 2024-06-20  4:58 UTC (permalink / raw)
  To: linux-bcachefs

I've run into a few 32-bit arch specific issues when attempting to
package the latest v1.9.1 tools release:
- c_long vs i64 type mixing for keyctl_search()
  * This one looks pretty straightforward, see follow-up PATCH 1/1 mail

- error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
  * maybe related to https://github.com/rust-lang/rust-bindgen/issues/2179
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:32702:1
        |
  32702 | pub struct bkey_inode_buf {
        | ^^^^^^^^^^^^^^^^^^^^^^^^^
        |
  note: `bch_inode_v3` has a `#[repr(align)]` attribute
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:8988:1
        |
  8988  | pub struct bch_inode_v3 {
        | ^^^^^^^^^^^^^^^^^^^^^^^
  note: `bkey_inode_buf` contains a field of type `bkey_i_inode_v3`
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:32703:9
        |
  32703 |     pub inode: bkey_i_inode_v3,
        |         ^^^^^
  note: ...which contains a field of type `bch_inode_v3`
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:28906:9
        |
  28906 |     pub v: bch_inode_v3,
  * see https://build.opensuse.org/public/build/home:ddiss:bcachefs_upstream_vendor/openSUSE_Tumbleweed/i586/bcachefs-tools/_log

- undefined reference to `atomic64_try_cmpxchg'
  * this looks like an arm7l specific regression from the
    atomic64_cmpxchg -> atomic64_try_cmpxchg conversion in 7d79fba1a
  * see https://build.opensuse.org/public/build/home:ddiss:bcachefs_upstream_vendor/openSUSE_Tumbleweed/armv7l/bcachefs-tools/_log

Logs for successful v1.7.0 builds can be found at
https://build.opensuse.org/public/build/filesystems/openSUSE_Tumbleweed/i586/bcachefs-tools/_log
https://build.opensuse.org/public/build/filesystems/openSUSE_Tumbleweed/armv7l/bcachefs-tools/_log

Cheers, David


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn
  2024-06-20  4:58 [tools PATCH 0/1] 32-bit build issues David Disseldorp
@ 2024-06-20  4:58 ` David Disseldorp
  2024-06-20 12:52   ` Kent Overstreet
  0 siblings, 1 reply; 3+ messages in thread
From: David Disseldorp @ 2024-06-20  4:58 UTC (permalink / raw)
  To: linux-bcachefs; +Cc: David Disseldorp

The keyctl_search() C function returns a long, which is already
reflected in the KeyHandle._id type. The search_keyring() helper
function currently returns a Result<i64>, which breaks 32-bit builds for
e.g. armv7l:
  error[E0308]: mismatched types
     --> src/key.rs:121:16
      |
  121 |             Ok(key_id)
      |             -- ^^^^^^ expected `i64`, found `i32`
      |             |
      |             arguments to this enum variant are incorrect
...
  error[E0308]: mismatched types
     --> src/key.rs:135:24
      |
  135 |                 _id:   id,
      |                        ^^ expected `i32`, found `i64`

Fix this by changing search_keyring() to return a Result<c_long>.

Fixes: f72ded6a ("fix(key): search for key in all relevant keyrings")
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 src/key.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/key.rs b/src/key.rs
index 96eb491d..0e061ee5 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -110,7 +110,7 @@ impl KeyHandle {
         }
     }
 
-    fn search_keyring(keyring: i32, key_name: &CStr) -> Result<i64> {
+    fn search_keyring(keyring: i32, key_name: &CStr) -> Result<c_long> {
         let key_name = CStr::as_ptr(key_name);
         let key_type = c_str!("user");
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn
  2024-06-20  4:58 ` [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn David Disseldorp
@ 2024-06-20 12:52   ` Kent Overstreet
  0 siblings, 0 replies; 3+ messages in thread
From: Kent Overstreet @ 2024-06-20 12:52 UTC (permalink / raw)
  To: David Disseldorp; +Cc: linux-bcachefs

On Thu, Jun 20, 2024 at 02:58:05PM +1000, David Disseldorp wrote:
> The keyctl_search() C function returns a long, which is already
> reflected in the KeyHandle._id type. The search_keyring() helper
> function currently returns a Result<i64>, which breaks 32-bit builds for
> e.g. armv7l:
>   error[E0308]: mismatched types
>      --> src/key.rs:121:16
>       |
>   121 |             Ok(key_id)
>       |             -- ^^^^^^ expected `i64`, found `i32`
>       |             |
>       |             arguments to this enum variant are incorrect
> ...
>   error[E0308]: mismatched types
>      --> src/key.rs:135:24
>       |
>   135 |                 _id:   id,
>       |                        ^^ expected `i32`, found `i64`
> 
> Fix this by changing search_keyring() to return a Result<c_long>.
> 
> Fixes: f72ded6a ("fix(key): search for key in all relevant keyrings")
> Signed-off-by: David Disseldorp <ddiss@suse.de>

Thanks, applied

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-20 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20  4:58 [tools PATCH 0/1] 32-bit build issues David Disseldorp
2024-06-20  4:58 ` [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn David Disseldorp
2024-06-20 12:52   ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox