aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/find.c
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2015-07-10 12:14:02 -0500
committerRob Landley <rob@landley.net>2015-07-10 12:14:02 -0500
commitd1a577f7bd2148f29a1dff37684ea9c63024fe6e (patch)
tree23e3feb53c509c5258a3d113790931adaa6a1627 /toys/posix/find.c
parent747e74852b982f8b2c54dc3e3650352843a6bede (diff)
downloadtoybox-d1a577f7bd2148f29a1dff37684ea9c63024fe6e.tar.gz
find: add -inum option
-inum is a commonly implemented extension to search by inode number. Linux's fs-layer tracepoints log many events in terms of inodes, so "find -inum" is useful for mapping those events back to specific files.
Diffstat (limited to 'toys/posix/find.c')
-rw-r--r--toys/posix/find.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 01d29993..a11a910a 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -32,6 +32,7 @@ config FIND
-ctime N created N days ago -mtime N modified N days ago
-newer FILE newer mtime than FILE -mindepth # at least # dirs down
-depth ignore contents of dir -maxdepth # at most # dirs down
+ -inum N inode number N
-type [bcdflps] (block, char, dir, file, symlink, pipe, socket)
Numbers N may be prefixed by a - (less than) or + (greater than):
@@ -341,6 +342,9 @@ static int do_find(struct dirtree *new)
test = compare_numsign(new->st.st_size, 512, ss[1]);
} else if (!strcmp(s, "links")) {
if (check) test = compare_numsign(new->st.st_nlink, 0, ss[1]);
+ } else if (!strcmp(s, "inum")) {
+ if (check)
+ test = compare_numsign(new->st.st_ino, 0, ss[1]);
} else if (!strcmp(s, "mindepth") || !strcmp(s, "maxdepth")) {
if (check) {
struct dirtree *dt = new;