43 #include <sys/types.h> 51 u8 * file_name),
void *arg,
59 d = opendir (dir_name);
75 if (e->d_type == DT_DIR
76 && (!strncmp (e->d_name,
".", 1) ||
77 !strncmp (e->d_name,
"..", 2)))
82 if (e->d_type == DT_DIR)
86 s =
format (s,
"%s/%s", dir_name, e->d_name);
87 t =
format (t,
"%s", e->d_name);
88 error = f (arg, s, t);
111 if (c && path[i] ==
'/')
114 if ((mkdir (c, 0755)) && (errno != EEXIST))
125 if ((mkdir (path, 0755)) && (errno != EEXIST))
139 const char *
path,
u8 ** full_path)
142 char *last_slash = 0;
148 else if (strncmp (path,
"../", 3) == 0 || strstr (path,
"/../"))
152 else if (path[0] ==
'/')
159 "file %s is not in runtime directory %s",
162 fp =
format (0,
"%s%c", path,
'\0');
171 if ((last_slash = strrchr ((
char *) fp,
'/')) != NULL)
176 if (last_slash != NULL)
clib_error_t * vlib_unix_validate_runtime_file(unix_main_t *um, const char *path, u8 **full_path)
clib_error_t * vlib_unix_recursive_mkdir(char *path)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
description fragment has unexpected format
#define clib_error_return(e, args...)
#define clib_error_return_unix(e, args...)
sll srl srl sll sra u16x4 i
#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)