43 #include <sys/types.h> 51 u8 * file_name),
void *arg,
59 d = opendir (dir_name);
75 if (e->d_type == DT_DIR
76 && (!strcmp (e->d_name,
".") || !strcmp (e->d_name,
"..")))
81 if (e->d_type == DT_DIR)
85 s =
format (s,
"%s/%s", dir_name, e->d_name);
86 t =
format (t,
"%s", e->d_name);
87 error = f (arg, s, t);
108 fd = open (file_name, O_WRONLY);
117 if (write (fd, s,
vec_len (s)) < 0)
134 fd = open (file_name, O_RDONLY);
140 sz = read (fd, s,
vec_len (s));
173 r = readlink (link, buffer,
sizeof (buffer) - 1);
179 p = strrchr (buffer,
'/');
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u8 * vlib_sysfs_link_to_name(char *link)
clib_error_t * vlib_sysfs_read(char *file_name, char *fmt,...)
#define clib_error_return_unix(e, args...)
clib_error_t * foreach_directory_file(char *dir_name, clib_error_t *(*f)(void *arg, u8 *path_name, u8 *file_name), void *arg, int scan_dirs)
#define vec_free(V)
Free vector's memory (no header).
#define clib_unix_warning(format, args...)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * vlib_sysfs_write(char *file_name, char *fmt,...)
#define clib_error_return(e, args...)