diff --git a/cli/src/ns.c b/cli/src/ns.c index 3f4fb3eb5f23eaeeb363fc32d989a578edeaf169..215389e89446216fd5f12b4a663502619e05a11c 100644 --- a/cli/src/ns.c +++ b/cli/src/ns.c @@ -28,8 +28,8 @@ int GetNsPath(const long pid, const char *nsType, char *buf, const size_t bufSiz if ((nsType == NULL) || (buf == NULL)) { return -1; } - static const char *fmtStr = "/proc/%d/ns/%s"; - return sprintf_s(buf, bufSize, fmtStr, pid, nsType); + static const char *FMT_STR = "/proc/%d/ns/%s"; + return sprintf_s(buf, bufSize, FMT_STR, pid, nsType); } int GetSelfNsPath(const char *nsType, char *buf, const size_t bufSize) @@ -37,8 +37,8 @@ int GetSelfNsPath(const char *nsType, char *buf, const size_t bufSize) if ((nsType == NULL) || (buf == NULL)) { return -1; } - static const char *fmtStr = "/proc/self/ns/%s"; - return sprintf_s(buf, bufSize, fmtStr, nsType); + static const char *FMT_STR = "/proc/self/ns/%s"; + return sprintf_s(buf, bufSize, FMT_STR, nsType); } int EnterNsByFd(int fd, int nsType) diff --git a/cli/src/options.c b/cli/src/options.c index 4ea3f7d6e615369e0ba44d1f02ed6970b9fe3f4d..5b75b32b8c10c9cffc62fe3e886a4d9217d1b7f6 100644 --- a/cli/src/options.c +++ b/cli/src/options.c @@ -43,7 +43,7 @@ void ParseRuntimeOptions(const char *options) g_runtimeOptions.noDrv = false; g_runtimeOptions.isVirtual = false; - static const char *seperator = ","; + static const char *SEPERATOR = ","; char *runtimeOptions = strdup(options); if (runtimeOptions == NULL) { (void)fprintf(stderr, "strdup failed!\n"); @@ -52,9 +52,9 @@ void ParseRuntimeOptions(const char *options) char *context = NULL; char *token = NULL; - for (token = strtok_s(runtimeOptions, seperator, &context); + for (token = strtok_s(runtimeOptions, SEPERATOR, &context); token != NULL; - token = strtok_s(NULL, seperator, &context)) { + token = strtok_s(NULL, SEPERATOR, &context)) { for (int i = 0; g_optionNameFlagTable[i].name != NULL; i++) { if (strcmp((const char *)token, g_optionNameFlagTable[i].name) == 0) { *g_optionNameFlagTable[i].flag = true; diff --git a/cli/src/u_mount.c b/cli/src/u_mount.c index 582f9f6e8261e4df219f0669ebba41c74c2452c7..509d0e3f6a3631080859278cbd8cc96dff83b82d 100644 --- a/cli/src/u_mount.c +++ b/cli/src/u_mount.c @@ -58,18 +58,18 @@ int Mount(const char *src, const char *dst) return -1; } - static const unsigned long mountFlags = MS_BIND; - static const unsigned long remountFlags = MS_BIND | MS_REMOUNT | MS_RDONLY | MS_NOSUID; + static const unsigned long MOUNT_FLAGS = MS_BIND; + static const unsigned long REMOUNT_FLAGS = MS_BIND | MS_REMOUNT | MS_RDONLY | MS_NOSUID; if (!CheckSrcFile(src)) { return -1; } - int ret = mount(src, dst, NULL, mountFlags, NULL); + int ret = mount(src, dst, NULL, MOUNT_FLAGS, NULL); if (ret < 0) { Logger("failed to mount src.", LEVEL_ERROR, SCREEN_YES); return -1; } - ret = mount(NULL, dst, NULL, remountFlags, NULL); + ret = mount(NULL, dst, NULL, REMOUNT_FLAGS, NULL); if (ret < 0) { Logger("failed to re-mount. dst.", LEVEL_ERROR, SCREEN_YES); return -1; diff --git a/runtime/dcmi/dcmi_interface_api.h b/runtime/dcmi/dcmi_interface_api.h index 78dba9f2f0efce1d403959c2cbfbd9833ab1ba51..ae5dcdd4cbbe2cab15c13f31a96416c579bd8553 100644 --- a/runtime/dcmi/dcmi_interface_api.h +++ b/runtime/dcmi/dcmi_interface_api.h @@ -84,14 +84,14 @@ int DcmiGetDeviceLogicId(int *deviceLogicId, int cardId, int deviceId) CALL_FUNC(g_dcmiGetDeviceLogicIdFunc, deviceLogicId, cardId, deviceId); } -int (*g_DcmiCreateVdeviceFunc)(int cardId, int deviceId, - struct DcmiCreateVdevResStru *vdev, - struct DcmiCreateVdevOut *out); +int (*g_dcmiCreateVdeviceFunc)(int cardId, int deviceId, + struct DcmiCreateVdevResStru *vdev, + struct DcmiCreateVdevOut *out); int DcmiCreateVdevice(int cardId, int deviceId, - struct DcmiCreateVdevResStru *vdev, - struct DcmiCreateVdevOut *out) + struct DcmiCreateVdevResStru *vdev, + struct DcmiCreateVdevOut *out) { - CALL_FUNC(g_DcmiCreateVdeviceFunc, cardId, deviceId, vdev, out); + CALL_FUNC(g_dcmiCreateVdeviceFunc, cardId, deviceId, vdev, out); } int (*g_dcmiSetDestroyVdeviceFunc)(int cardId, int deviceId, unsigned int vDevid); @@ -123,7 +123,7 @@ int DcmiInitDl(char *dlPath) { g_dcmiHandle = dlopen("libdcmi.so", RTLD_LAZY | RTLD_GLOBAL); if (g_dcmiHandle == NULL) { - fprintf (stderr, "%s\n", dlerror()); + fprintf(stderr, "%s\n", dlerror()); return SO_NOT_FOUND; } struct link_map *pLinkMap; @@ -146,7 +146,7 @@ int DcmiInitDl(char *dlPath) g_dcmiGetDeviceLogicIdFunc = dlsym(g_dcmiHandle, "dcmi_get_device_logic_id"); - g_DcmiCreateVdeviceFunc = dlsym(g_dcmiHandle, "dcmi_create_vdevice"); + g_dcmiCreateVdeviceFunc = dlsym(g_dcmiHandle, "dcmi_create_vdevice"); g_dcmiSetDestroyVdeviceFunc = dlsym(g_dcmiHandle, "dcmi_set_destroy_vdevice");