diff --git a/src/container.c b/src/container.c index cd699e8..aaea760 100644 --- a/src/container.c +++ b/src/container.c @@ -14,6 +14,7 @@ #include #include +#include "util.h" #include "hyper.h" static int container_setup_env(struct hyper_container *container) @@ -189,28 +190,6 @@ static int container_setup_tty(int fd, struct hyper_container *container) return hyper_dup_exec_tty(fd, &container->exec); } -static int hyper_list_dir(char *path) -{ - struct dirent **list; - struct dirent *dir; - int i, num; - - fprintf(stdout, "list %s\n", path); - num = scandir(path, &list, NULL, NULL); - if (num < 0) { - perror("scan path failed"); - return -1; - } - - for (i = 0; i < num; i++) { - dir = list[i]; - fprintf(stdout, "%s get %s\n", path, dir->d_name); - } - - free(list); - return 0; -} - static int hyper_rescan_scsi(void) { struct dirent **list; diff --git a/src/util.c b/src/util.c index adf0a0c..7367d67 100644 --- a/src/util.c +++ b/src/util.c @@ -22,6 +22,28 @@ char *read_cmdline(void) return NULL; } +int hyper_list_dir(char *path) +{ + struct dirent **list; + struct dirent *dir; + int i, num; + + fprintf(stdout, "list %s\n", path); + num = scandir(path, &list, NULL, NULL); + if (num < 0) { + perror("scan path failed"); + return -1; + } + + for (i = 0; i < num; i++) { + dir = list[i]; + fprintf(stdout, "%s get %s\n", path, dir->d_name); + } + + free(list); + return 0; +} + int hyper_mkdir(char *hyper_path) { struct stat st; diff --git a/src/util.h b/src/util.h index 9f7708a..586c50f 100644 --- a/src/util.h +++ b/src/util.h @@ -4,6 +4,7 @@ #include "hyper.h" char *read_cmdline(void); +int hyper_list_dir(char *path); int hyper_mkdir(char *path); int hyper_open_channel(char *channel, int mode); int hyper_open_serial_dev(char *tty);