1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SELINUX_PARAM_H 17 #define SELINUX_PARAM_H 18 19 #pragma once 20 21 #include <stdbool.h> 22 #include <stdint.h> 23 #include <stdlib.h> 24 #include <string.h> 25 26 #ifdef __cplusplus 27 #if __cplusplus 28 extern "C" { 29 #endif 30 #endif // __cplusplus 31 32 typedef struct SharedMem { 33 uint8_t paramNameSize; 34 uint8_t paramLabelSize; 35 char data[0]; 36 } SharedMem; 37 38 void *InitSharedMem(const char *fileName, uint32_t spaceSize, bool readOnly); 39 void WriteSharedMem(char *sharedMem, const char *data, uint32_t length); 40 char *ReadSharedMem(char *sharedMem, uint32_t length); 41 void UnmapSharedMem(char *sharedMem, uint32_t dataSize); 42 43 #ifdef __cplusplus 44 #if __cplusplus 45 } 46 #endif 47 #endif // __cplusplus 48 #endif // SELINUX_PARAM_H 49