aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-05-20 15:00:19 -0500
committerRob Landley <rob@landley.net>2012-05-20 15:00:19 -0500
commit8c4ae8a78eae279db5d5be25f7b4618427844a92 (patch)
treee3502886f1c32517e87163bff5d3e1bf7e5a5f0d /toys
parentbdcb80e9d316863a77ff922e18d32e9024c77c82 (diff)
downloadtoybox-8c4ae8a78eae279db5d5be25f7b4618427844a92.tar.gz
dirtree logic cleanup: switch DIRTREE_NORECURSE and DIRTREE_NOSAVE to DIRTREE_RECURSE and DIRTREE_SAVE.
Diffstat (limited to 'toys')
-rw-r--r--toys/ls.c9
-rw-r--r--toys/mdev.c9
2 files changed, 9 insertions, 9 deletions
diff --git a/toys/ls.c b/toys/ls.c
index 87a39978..5d02023f 100644
--- a/toys/ls.c
+++ b/toys/ls.c
@@ -139,11 +139,10 @@ static int filter(struct dirtree *new)
// TODO should -1f print here to handle enormous dirs without runing
// out of mem?
- if (flags & FLAG_a) return DIRTREE_NORECURSE;
- if (!(flags & FLAG_A) && new->name[0]=='.')
- return DIRTREE_NOSAVE|DIRTREE_NORECURSE;
+ if (flags & FLAG_a) return 0;
+ if (!(flags & FLAG_A) && new->name[0]=='.') return 0;
- return dirtree_isdotdot(new)|DIRTREE_NORECURSE;
+ return dirtree_notdotdot(new);
}
// Display a list of dirtree entries, according to current format
@@ -289,7 +288,7 @@ static void listfiles(int dirfd, struct dirtree *indir)
for (ul = 0; ul<dtlen; free(sort[ul++])) {
// TODO follow symlinks when?
if ((flags & FLAG_d) || !S_ISDIR(sort[ul]->st.st_mode)
- || dirtree_isdotdot(sort[ul])) continue;
+ || !dirtree_notdotdot(sort[ul])) continue;
// Recurse into dirs if at top of the tree or given -R
if (!indir->parent || (flags & FLAG_R))
diff --git a/toys/mdev.c b/toys/mdev.c
index 9fab17d1..b769828f 100644
--- a/toys/mdev.c
+++ b/toys/mdev.c
@@ -36,6 +36,8 @@ config MDEV_CONF
#include "toys.h"
#include "lib/xregcomp.h"
+// todo, open() block devices to trigger partition scanning.
+
// mknod in /dev based on a path like "/sys/block/hda/hda1"
static void make_device(char *path)
{
@@ -180,7 +182,7 @@ static int callback(struct dirtree *node)
{
// Entries in /sys/class/block aren't char devices, so skip 'em. (We'll
// get block devices out of /sys/block.)
- if(!strcmp(node->name, "block")) return DIRTREE_NOSAVE|DIRTREE_NORECURSE;
+ if(!strcmp(node->name, "block")) return 0;
// Does this directory have a "dev" entry in it?
// This is path based because the hotplug callbacks are
@@ -194,9 +196,8 @@ static int callback(struct dirtree *node)
// Circa 2.6.25 the entries more than 2 deep are all either redundant
// (mouse#, event#) or unnamed (every usb_* entry is called "device").
- if (node->parent && node->parent->parent)
- return DIRTREE_NOSAVE|DIRTREE_NORECURSE;
- return DIRTREE_NOSAVE;
+
+ return (node->parent && node->parent->parent) ? 0 : DIRTREE_RECURSE;
}
void mdev_main(void)