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);
110 if (c && path[i] ==
'/')
113 if ((mkdir (c, 0755)) && (errno != EEXIST))
124 if ((mkdir (path, 0755)) && (errno != EEXIST))
138 const char *path,
u8 ** full_path)
141 char *last_slash = 0;
147 else if (strncmp (path,
"../", 3) == 0 || strstr (path,
"/../"))
151 else if (path[0] ==
'/')
158 "file %s is not in runtime directory %s",
161 fp =
format (0,
"%s%c", path,
'\0');
170 if ((last_slash = strrchr ((
char *) fp,
'/')) !=
NULL)
175 if (last_slash !=
NULL)
clib_error_t * vlib_unix_validate_runtime_file(unix_main_t *um, const char *path, u8 **full_path)
sll srl srl sll sra u16x4 i
clib_error_t * vlib_unix_recursive_mkdir(char *path)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define clib_error_return(e, args...)
#define clib_error_return_unix(e, args...)
#define vec_free(V)
Free vector's memory (no header).
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)