chiark / gitweb /
[PATCH] change call_foreach_file to return a list
[elogind.git] / udev_utils.h
index 2f2c2497cbad6afd70559f5165cc688f9fdf5bba..b45500dcff61b63f6d6ff76572b9c672720b41f8 100644 (file)
 
 #include "udev.h"
 
-#define strfieldcpy(to, from) \
-do { \
-       to[sizeof(to)-1] = '\0'; \
-       strncpy(to, from, sizeof(to)-1); \
-} while (0)
-
-#define strfieldcat(to, from) \
-do { \
-       to[sizeof(to)-1] = '\0'; \
-       strncat(to, from, sizeof(to) - strlen(to)-1); \
-} while (0)
-
-#define strfieldcpymax(to, from, maxsize) \
-do { \
-       to[maxsize-1] = '\0'; \
-       strncpy(to, from, maxsize-1); \
-} while (0)
-
-#define strfieldcatmax(to, from, maxsize) \
-do { \
-       to[maxsize-1] = '\0'; \
-       strncat(to, from, maxsize - strlen(to)-1); \
-} while (0)
-
-#define strintcat(to, i) \
-do { \
-       to[sizeof(to)-1] = '\0'; \
-       snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \
-} while (0)
-
-#define strintcatmax(to, i, maxsize) \
-do { \
-       to[maxsize-1] = '\0'; \
-       snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \
-} while (0)
-
-#define foreach_strpart(str, separator, pos, len) \
-       for(pos = str, len = 0; \
-           (pos) < ((str) + strlen(str)); \
-           pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \
-               if (len > 0)
-
-#ifdef asmlinkage
-# undef asmlinkage
-#endif
-#ifdef __i386__
-# define asmlinkage    __attribute__((regparm(0)))
-#endif
-#ifndef asmlinkage
-# define asmlinkage    /* nothing */
-#endif
-
 struct name_entry {
        struct list_head node;
-       char name[NAME_SIZE];
+       char name[PATH_SIZE];
 };
 
 extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem);
@@ -93,6 +41,6 @@ extern void file_unmap(char *buf, size_t bufsize);
 extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
 extern void no_trailing_slash(char *path);
 extern int name_list_add(struct list_head *name_list, const char *name, int sort);
-extern int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string),
-                            struct udevice *udev, const char *dirname, const char *suffix);
+extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix);
+
 #endif