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 16#ifndef BASE_STARTUP_INITLITE_UEVENTD_UTILS_H 17#define BASE_STARTUP_INITLITE_UEVENTD_UTILS_H 18#include <fcntl.h> 19#include <string.h> 20#include <sys/stat.h> 21#include "init_utils.h" 22 23#define DEVICE_FILE_SIZE 128U 24#define SYSPATH_SIZE 512U 25#define BLOCKDEVICE_LINKS 4 26 27#define STARTSWITH(str, prefix) (strncmp((str), (prefix), strlen(prefix)) == 0) 28#define STRINGEQUAL(src, tgt) (strcmp((src), (tgt)) == 0) 29#define INVALIDSTRING(str) ((str) == NULL || *(str) == '\0') 30 31#define DIRMODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) 32// Default device mode is 0660 33#define DEVMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) 34 35#endif // BASE_STARTUP_INITLITE_UEVENTD_UTILS_H