diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-24 01:07:16 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:10:15 +0200 |
commit | 793a06d984511593c6375d219b38cc84f5a71aff (patch) | |
tree | 7cdd18dffcd3ccb3e1272263008c42b835634332 /fs/bcachefs/checksum.c | |
parent | bcachefs: Ignore unknown mount options (diff) | |
download | linux-793a06d984511593c6375d219b38cc84f5a71aff.tar.xz linux-793a06d984511593c6375d219b38cc84f5a71aff.zip |
bcachefs: Fixes for building in userspace
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/checksum.c')
-rw-r--r-- | fs/bcachefs/checksum.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c index c70262b7fd6e..1948119edbf4 100644 --- a/fs/bcachefs/checksum.c +++ b/fs/bcachefs/checksum.c @@ -559,6 +559,26 @@ int bch2_request_key(struct bch_sb *sb, struct bch_key *key) return ret; } +#ifndef __KERNEL__ +int bch2_revoke_key(struct bch_sb *sb) +{ + key_serial_t key_id; + struct printbuf key_description = PRINTBUF; + + prt_printf(&key_description, "bcachefs:"); + pr_uuid(&key_description, sb->user_uuid.b); + + key_id = request_key("user", key_description.buf, NULL, KEY_SPEC_USER_KEYRING); + printbuf_exit(&key_description); + if (key_id < 0) + return errno; + + keyctl_revoke(key_id); + + return 0; +} +#endif + int bch2_decrypt_sb_key(struct bch_fs *c, struct bch_sb_field_crypt *crypt, struct bch_key *key) |