18d05d8e7Sopenharmony_ci/*
28d05d8e7Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
38d05d8e7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48d05d8e7Sopenharmony_ci * you may not use this file except in compliance with the License.
58d05d8e7Sopenharmony_ci * You may obtain a copy of the License at
68d05d8e7Sopenharmony_ci *
78d05d8e7Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88d05d8e7Sopenharmony_ci *
98d05d8e7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108d05d8e7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118d05d8e7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128d05d8e7Sopenharmony_ci * See the License for the specific language governing permissions and
138d05d8e7Sopenharmony_ci * limitations under the License.
148d05d8e7Sopenharmony_ci */
158d05d8e7Sopenharmony_ci
168d05d8e7Sopenharmony_ci#ifndef FILE_ACCESS_UTIL_H
178d05d8e7Sopenharmony_ci#define FILE_ACCESS_UTIL_H
188d05d8e7Sopenharmony_ci
198d05d8e7Sopenharmony_ci#ifdef CHECK_STATUS_RETURN
208d05d8e7Sopenharmony_ci#undef CHECK_STATUS_RETURN
218d05d8e7Sopenharmony_ci#endif
228d05d8e7Sopenharmony_ci
238d05d8e7Sopenharmony_ci#define CHECK_STATUS_RETURN(status, returnContext, fmt, ...) \
248d05d8e7Sopenharmony_ci    if (!(status)) { \
258d05d8e7Sopenharmony_ci        HILOG_ERROR(fmt, ##__VA_ARGS__); \
268d05d8e7Sopenharmony_ci        return returnContext; \
278d05d8e7Sopenharmony_ci    }
288d05d8e7Sopenharmony_ci
298d05d8e7Sopenharmony_ci#endif // FILE_ACCESS_UTIL_H
30