| | vinyl-cache/bin/vinyld/storage/storage_vai.h |
| 0 |
|
/*- |
| 1 |
|
* Copyright 2025 UPLEX - Nils Goroll Systemoptimierung |
| 2 |
|
* All rights reserved. |
| 3 |
|
* |
| 4 |
|
* Author: Nils Goroll <nils.goroll@uplex.de> |
| 5 |
|
* |
| 6 |
|
* SPDX-License-Identifier: BSD-2-Clause |
| 7 |
|
* |
| 8 |
|
* Redistribution and use in source and binary forms, with or without |
| 9 |
|
* modification, are permitted provided that the following conditions |
| 10 |
|
* are met: |
| 11 |
|
* 1. Redistributions of source code must retain the above copyright |
| 12 |
|
* notice, this list of conditions and the following disclaimer. |
| 13 |
|
* 2. Redistributions in binary form must reproduce the above copyright |
| 14 |
|
* notice, this list of conditions and the following disclaimer in the |
| 15 |
|
* documentation and/or other materials provided with the distribution. |
| 16 |
|
* |
| 17 |
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 18 |
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 |
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 |
|
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE |
| 21 |
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 |
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 23 |
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 24 |
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 25 |
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 |
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 |
|
* SUCH DAMAGE. |
| 28 |
|
* |
| 29 |
|
* This defines the backend interface between the stevedore and the |
| 30 |
|
* pluggable storage implementations. |
| 31 |
|
* |
| 32 |
|
*/ |
| 33 |
|
|
| 34 |
|
static inline viov_lease_t |
| 35 |
8014 |
ptr2lease(const void *ptr) |
| 36 |
|
{ |
| 37 |
8014 |
viov_lease_t r = (viov_lease_t)(uintptr_t)ptr; |
| 38 |
|
|
| 39 |
|
if (sizeof(void *) < 8) //lint !e506 !e774 |
| 40 |
|
r <<= 1; |
| 41 |
|
|
| 42 |
8014 |
return (r); |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
static inline void * |
| 46 |
11904 |
lease2ptr(viov_lease_t l) |
| 47 |
|
{ |
| 48 |
|
|
| 49 |
|
if (sizeof(void *) < 8) //lint !e506 !e774 |
| 50 |
|
l >>= 1; |
| 51 |
|
|
| 52 |
11904 |
return ((void *)(uintptr_t)l); |
| 53 |
|
} |