1 /* 2 * Copyright (c) 2021 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 #ifndef WAYLAND_DRM_AUTH_H 16 #define WAYLAND_DRM_AUTH_H 17 #include <string.h> 18 #include "libweston/libweston.h" 19 20 #undef LOG_TAG 21 #undef LOG_DOMAIN 22 #define LOG_TAG "DRMAUTH" 23 #define LOG_DOMAIN 0xD001400 24 25 #define FILENAME (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__) 26 27 #ifndef DRMAUTH_LOGD 28 #define DRMAUTH_LOGD(format, ...) \ 29 do { \ 30 HILOG_DEBUG("[%s@%s:%d] " format "\n", __FUNCTION__, FILENAME, __LINE__, ##__VA_ARGS__); \ 31 } while (0) 32 #endif 33 34 #ifndef DRMAUTH_LOGI 35 #define DRMAUTH_LOGI(format, ...) \ 36 do { \ 37 HILOG_INFO("[%s@%s:%d] " format "\n", __FUNCTION__, FILENAME, __LINE__, ##__VA_ARGS__); \ 38 } while (0) 39 #endif 40 41 #ifndef DRMAUTH_LOGW 42 #define DRMAUTH_LOGW(format, ...) \ 43 do { \ 44 HILOG_WARN("[%s@%s:%d] " format "\n", __FUNCTION__, FILENAME, __LINE__, ##__VA_ARGS__); \ 45 } while (0) 46 #endif 47 48 #ifndef DRMAUTH_LOGE 49 #define DRMAUTH_LOGE(format, ...) \ 50 do { \ 51 HILOG_ERROR("[%s@%s:%d] " format "\n", __FUNCTION__, FILENAME, __LINE__, ##__VA_ARGS__); \ 52 } while (0) 53 #endif 54 55 56 #ifndef CHK_RETURN 57 #define CHK_RETURN(val, ret, ...) \ 58 do { \ 59 if (val) { \ 60 __VA_ARGS__; \ 61 return (ret); \ 62 } \ 63 } while (0) 64 #endif 65 66 #ifndef CHK_RETURN_NO_VALUE 67 #define CHK_RETURN_NO_VALUE(val, ret, ...) \ 68 do { \ 69 if (val) { \ 70 __VA_ARGS__; \ 71 return; \ 72 } \ 73 } while (0) 74 #endif 75 76 #endif // WAYLAND_DRM_AUTH_H 77