xref: /xnu-11215.1.10/osfmk/kern/exclaves_storage.h (revision 8d741a5de7ff4191bf97d57b9f54c2f6d4a15585)
1 /*
2  * Copyright (c) 2023 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 
29 #pragma once
30 
31 #if CONFIG_EXCLAVES
32 
33 #if __has_include(<Tightbeam/tightbeam.h>)
34 
35 #include <stdint.h>
36 
37 #include <Tightbeam/tightbeam.h>
38 #include <Tightbeam/tightbeam_private.h>
39 
40 #include "kern/exclaves.tightbeam.h"
41 
42 #include "exclaves_resource.h"
43 
44 __BEGIN_DECLS
45 
46 extern tb_error_t
47     exclaves_storage_upcall_root(const uint8_t exclaveid[_Nonnull 32],
48     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_root__result_s));
49 
50 extern tb_error_t
51     exclaves_storage_upcall_open(const enum xnuupcalls_fstag_s fstag,
52     const uint64_t rootid, const uint8_t name[_Nonnull 256],
53     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_open__result_s));
54 
55 extern tb_error_t
56     exclaves_storage_upcall_close(const enum xnuupcalls_fstag_s fstag,
57     const uint64_t fileid,
58     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_close__result_s));
59 
60 extern tb_error_t
61     exclaves_storage_upcall_create(const enum xnuupcalls_fstag_s fstag,
62     const uint64_t rootid, const uint8_t name[_Nonnull 256],
63     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_create__result_s));
64 
65 extern tb_error_t
66     exclaves_storage_upcall_read(const enum xnuupcalls_fstag_s fstag,
67     const uint64_t fileid, const struct xnuupcalls_iodesc_s * _Nonnull descriptor,
68     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_read__result_s));
69 
70 extern tb_error_t
71     exclaves_storage_upcall_write(const enum xnuupcalls_fstag_s fstag,
72     const uint64_t fileid, const struct xnuupcalls_iodesc_s * _Nonnull descriptor,
73     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_write__result_s));
74 
75 extern tb_error_t
76     exclaves_storage_upcall_remove(const enum xnuupcalls_fstag_s fstag,
77     const uint64_t rootid, const uint8_t name[_Nonnull 256],
78     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_remove__result_s));
79 
80 extern tb_error_t
81     exclaves_storage_upcall_sync(const enum xnuupcalls_fstag_s fstag,
82     const enum xnuupcalls_syncop_s op,
83     const uint64_t fileid,
84     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_sync__result_s));
85 
86 extern tb_error_t
87     exclaves_storage_upcall_readdir(const enum xnuupcalls_fstag_s fstag,
88     const uint64_t fileid, const uint64_t buf,
89     const uint32_t length,
90     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_readdir__result_s));
91 
92 extern tb_error_t
93     exclaves_storage_upcall_getsize(const enum xnuupcalls_fstag_s fstag,
94     const uint64_t fileid,
95     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_getsize__result_s));
96 
97 extern tb_error_t
98     exclaves_storage_upcall_sealstate(const enum xnuupcalls_fstag_s fstag,
99     tb_error_t (^_Nonnull completion)(xnuupcalls_xnuupcalls_sealstate__result_s));
100 
101 __END_DECLS
102 
103 #endif /* __has_include(<Tightbeam/tightbeam.h>) */
104 
105 #endif /* CONFIG_EXCLAVES */
106