mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-09-06 05:31:58 +00:00
util: move hyper_list_dir into util.c
this function is useful to debug Signed-off-by: Gao feng <feng@hyper.sh>
This commit is contained in:
+1
-22
@@ -14,6 +14,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#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;
|
||||
|
||||
+22
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user