diff options
Diffstat (limited to 'sys/uvm/uvm_swap_encrypt.h')
-rw-r--r-- | sys/uvm/uvm_swap_encrypt.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/uvm/uvm_swap_encrypt.h b/sys/uvm/uvm_swap_encrypt.h index b9ad8df8df1..bb39d18ea96 100644 --- a/sys/uvm/uvm_swap_encrypt.h +++ b/sys/uvm/uvm_swap_encrypt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap_encrypt.h,v 1.13 2024/11/07 06:04:11 jsg Exp $ */ +/* $OpenBSD: uvm_swap_encrypt.h,v 1.14 2024/11/07 09:04:55 jsg Exp $ */ /* * Copyright 1999 Niels Provos <provos@citi.umich.edu> @@ -60,23 +60,25 @@ void swap_decrypt(struct swap_key *,caddr_t, caddr_t, u_int64_t, size_t); void swap_key_cleanup(struct swap_key *); void swap_key_prepare(struct swap_key *, int); -#define SWAP_KEY_GET(s,x) do { \ - if ((x)->refcount == 0) { \ - swap_key_create(x); \ - } \ - (x)->refcount++; \ - } while(0); - -#define SWAP_KEY_PUT(s,x) do { \ - (x)->refcount--; \ - if ((x)->refcount == 0) { \ - swap_key_delete(x); \ - } \ - } while(0); - void swap_key_create(struct swap_key *); void swap_key_delete(struct swap_key *); +static inline void +swap_key_get(struct swap_key *key) +{ + if (key->refcount == 0) + swap_key_create(key); + key->refcount++; +} + +static inline void +swap_key_put(struct swap_key *key) +{ + key->refcount--; + if (key->refcount == 0) + swap_key_delete(key); +} + extern int uvm_doswapencrypt; /* swapencrypt enabled/disabled */ extern int swap_encrypt_initialized; |