Break ioctl() up into smaller syscalls
This commit is contained in:
@ -5,8 +5,8 @@
|
||||
int showtree(char *root, int indent) {
|
||||
#define INDENT() for (size_t i = 0; i < indent; i++) uprintf(" ")
|
||||
|
||||
IoctlStat statbuf; ZERO(&statbuf);
|
||||
if (ioctl(IOCTL_NOHANDLE, IOCTL_STAT, (uint64_t)&statbuf, (uint64_t)root, 0) != E_OK) {
|
||||
FsStat statbuf; ZERO(&statbuf);
|
||||
if (fs_stat(root, &statbuf) != E_OK) {
|
||||
uprintf("fs: could not stat %s\n", root);
|
||||
return -1;
|
||||
}
|
||||
@ -18,16 +18,16 @@ int showtree(char *root, int indent) {
|
||||
}
|
||||
|
||||
|
||||
if (statbuf.type == IOCTLSTAT_FILE) {
|
||||
if (statbuf.type == FSSTAT_FILE) {
|
||||
return 0;
|
||||
}
|
||||
if (statbuf.type == IOCTLSTAT_DIR) {
|
||||
IoctlDirent *dirents = (IoctlDirent *)umalloc(statbuf.size * sizeof(*dirents));
|
||||
if (statbuf.type == FSSTAT_DIR) {
|
||||
FsDirent *dirents = (FsDirent *)umalloc(statbuf.size * sizeof(*dirents));
|
||||
|
||||
for (size_t i = 0; i < statbuf.size; i++) {
|
||||
ioctl(IOCTL_NOHANDLE, IOCTL_FETCHDIRENT, (uint64_t)root, (uint64_t)&dirents[i], i);
|
||||
fs_fetchdirent(root, &dirents[i], i);
|
||||
|
||||
IoctlDirent *dirent = &dirents[i];
|
||||
FsDirent *dirent = &dirents[i];
|
||||
|
||||
if (string_strcmp(dirent->name, ".") == 0 || string_strcmp(dirent->name, "..") == 0) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user