X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibudev%2Flibudev-util.c;h=f3fdf3b5aa7843fd91789ab732ec370002f1150f;hp=93e78d5d0798865ca03c9f9af39f4fa959343ce8;hb=ba7408a6e9fa2f79f7e69052de78f82e12c613f6;hpb=a56ba6158b9649e01226dfaf3ff7082c82571090 diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c index 93e78d5d0..f3fdf3b5a 100644 --- a/src/libudev/libudev-util.c +++ b/src/libudev/libudev-util.c @@ -45,38 +45,6 @@ * Utilities useful when dealing with devices and device node names. */ -int util_delete_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - int err = 0; - - if (path[0] == '/') - while(path[1] == '/') - path++; - strscpy(p, sizeof(p), path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - for (;;) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - err = rmdir(p); - if (err < 0) { - if (errno == ENOENT) - err = 0; - break; - } - } - return err; -} - /* handle "[/]" format */ int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value) @@ -194,13 +162,8 @@ int util_log_priority(const char *priority) prio = strtol(priority, &endptr, 10); if (endptr[0] == '\0' || isspace(endptr[0])) return prio; - if (startswith(priority, "err")) - return LOG_ERR; - if (startswith(priority, "info")) - return LOG_INFO; - if (startswith(priority, "debug")) - return LOG_DEBUG; - return 0; + + return log_level_from_string(priority); } size_t util_path_encode(const char *src, char *dest, size_t size) @@ -351,28 +314,3 @@ uint64_t util_string_bloom64(const char *str) bits |= 1LLU << ((hash >> 18) & 63); return bits; } - -ssize_t print_kmsg(const char *fmt, ...) -{ - _cleanup_close_ int fd = -1; - va_list ap; - char text[1024]; - ssize_t len; - ssize_t ret; - - fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC); - if (fd < 0) - return -errno; - - len = snprintf(text, sizeof(text), "<30>systemd-udevd[%u]: ", getpid()); - - va_start(ap, fmt); - len += vsnprintf(text + len, sizeof(text) - len, fmt, ap); - va_end(ap); - - ret = write(fd, text, len); - if (ret < 0) - return -errno; - - return ret; -}