Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | bftw: Always initialize dircache_entry::{dev,ino} | Tavian Barnes | 2016-11-21 | 1 | -6/+7 |
| | | | | | If stat() fails, they won't get filled in otherwise. Then cycle detection would have read uninitialized values. | ||||
* | bftw: Make bftw_flags more similar to fts() options. | Tavian Barnes | 2016-11-21 | 1 | -5/+9 |
| | |||||
* | Check for readdir() errors everywhere. | Tavian Barnes | 2016-11-14 | 1 | -14/+2 |
| | |||||
* | bftw: Keep trailing slashes on the root in BFTW_DEPTH mode. | Tavian Barnes | 2016-11-13 | 1 | -6/+16 |
| | |||||
* | bftw: Don't fail just because we couldn't open/read a directory. | Tavian Barnes | 2016-11-03 | 1 | -3/+3 |
| | | | | | | | With BFTW_RECOVER set, we're not supposed to fail just because a single measly directory couldn't be handled. But using state.error as scratch space made us fail in this case. The end result is that #7 resurfaced, so fix it again. | ||||
* | Implement -ignore_readdir_race. | Tavian Barnes | 2016-10-24 | 1 | -1/+4 |
| | |||||
* | bftw: Add support for some exotic file types, where available. | Tavian Barnes | 2016-10-02 | 1 | -1/+59 |
| | |||||
* | bftw: Handle errors from readdir(). | Tavian Barnes | 2016-10-02 | 1 | -25/+66 |
| | |||||
* | bftw: Fix do/to typo in a comment. | Tavian Barnes | 2016-09-10 | 1 | -1/+1 |
| | |||||
* | bftw: Initialize typeflag to BFTW_UNKNOWN. | Tavian Barnes | 2016-08-24 | 1 | -2/+1 |
| | | | | It was totally broken on filesystems that spit out DT_UNKNOWN. | ||||
* | dstring: Clean up the API a bit. | Tavian Barnes | 2016-05-22 | 1 | -1/+4 |
| | |||||
* | bftw: Use realloc() to grow the dirqueue. | Tavian Barnes | 2016-05-17 | 1 | -13/+11 |
| | |||||
* | bftw: Remove some debugging counters that were left in accidentally. | Tavian Barnes | 2016-05-17 | 1 | -10/+0 |
| | |||||
* | dstring: Split out the dynamic string logic. | Tavian Barnes | 2016-04-13 | 1 | -68/+25 |
| | |||||
* | bftw: Update at_flags when not following a broken symbolic link. | Tavian Barnes | 2016-02-23 | 1 | -1/+2 |
| | |||||
* | bftw: Plug a leak when the root is not a directory. | Tavian Barnes | 2016-02-23 | 1 | -1/+6 |
| | |||||
* | bftw: Use the currently open directory as at_fd in BFTW_CHILD mode. | Tavian Barnes | 2016-02-22 | 1 | -2/+5 |
| | |||||
* | bftw: Use O_CLOEXEC. | Tavian Barnes | 2016-02-21 | 1 | -3/+3 |
| | |||||
* | bftw: Don't store the terminating '\0' in dircache_entry names. | Tavian Barnes | 2016-02-21 | 1 | -2/+1 |
| | |||||
* | bftw: Use a better cache eviction policy. | Tavian Barnes | 2016-02-21 | 1 | -113/+186 |
| | | | | | | Instead of simple LRU, we now evict the open entry with the lowest refcount. This reduces the average number of components passed to openat() by a significant margin, and speeds bfs up by about ~5%. | ||||
* | bftw: Shrink the LRU before finding the parent. | Tavian Barnes | 2016-02-20 | 1 | -10/+6 |
| | | | | Otherwise we might close the found parent. | ||||
* | bftw: Clean up dirqueue implementation a bit. | Tavian Barnes | 2016-02-19 | 1 | -20/+28 |
| | |||||
* | bftw: Don't keep DIR*'s around. | Tavian Barnes | 2016-02-19 | 1 | -40/+75 |
| | | | | | | | | | | | | | | | DIR*'s were being kept around so dirfd(dir) could be passed to future openat() calls. But DIR*'s are big, holding a cache of filenames etc. read by readdir(). Instead, store the raw fd and dup() it to open a DIR* with fdopendir(). This way we can call dirclose() as soon as possible, while still keeping an open fd. Ideally there would be a way to closedir() without invoking close() on the underlying fd, but this is a good approximation. Reduces memory footprint by around 64% in a large directory tree. | ||||
* | bftw: Use a circular buffer to implement the dirqueue. | Tavian Barnes | 2016-02-17 | 1 | -46/+37 |
| | |||||
* | Implement -mount/-xdev. | Tavian Barnes | 2016-02-14 | 1 | -2/+11 |
| | |||||
* | Fix -name handling when the root has trailing slashes. | Tavian Barnes | 2016-02-13 | 1 | -2/+18 |
| | |||||
* | Follow links if appropriate in predicates. | Tavian Barnes | 2016-02-13 | 1 | -5/+3 |
| | |||||
* | Implement -L/-follow. | Tavian Barnes | 2016-02-09 | 1 | -22/+66 |
| | |||||
* | bftw: Don't give up when following a broken symlink. | Tavian Barnes | 2016-02-06 | 1 | -1/+9 |
| | |||||
* | Implement -P and -H. | Tavian Barnes | 2016-02-04 | 1 | -4/+14 |
| | |||||
* | Don't use typedefs to avoid struct/enum tags. | Tavian Barnes | 2016-02-04 | 1 | -66/+62 |
| | |||||
* | bftw: Add missing #include. | Tavian Barnes | 2016-01-30 | 1 | -0/+1 |
| | |||||
* | bftw: Fix fd leak if fdopendir() fails. | Tavian Barnes | 2016-01-30 | 1 | -1/+5 |
| | |||||
* | Optimize -maxdepth in -depth mode. | Tavian Barnes | 2015-09-26 | 1 | -14/+1 |
| | |||||
* | bftw() interface improvements: | Tavian Barnes | 2015-09-26 | 1 | -52/+38 |
| | | | | | | - Use enums instead of ints where it makes sense - Move the file path inside struct BFTW - Expose a fd and relative path for *at() calls | ||||
* | Add -depth support. | Tavian Barnes | 2015-09-08 | 1 | -41/+186 |
| | | | | | | | The resulting order is fairly weird, as files are still returned in breadth-first order, but directories are returned in a backwards order based on when their reference counts drop to zero. But it's good enough for -delete support. | ||||
* | Factor some code out of bftw(). | Tavian Barnes | 2015-09-06 | 1 | -77/+172 |
| | |||||
* | Print the root file/directory too. | Tavian Barnes | 2015-09-02 | 1 | -84/+130 |
| | |||||
* | bftw: Store the paths with a trailing slash. | Tavian Barnes | 2015-08-31 | 1 | -32/+37 |
| | |||||
* | bftw: Fix path size of /. | Tavian Barnes | 2015-08-31 | 1 | -2/+6 |
| | |||||
* | Add -type support. | Tavian Barnes | 2015-08-30 | 1 | -9/+33 |
| | | | | Fixes #2. | ||||
* | Infer the right value for nopenfd, and recover from EMFILE. | Tavian Barnes | 2015-07-27 | 1 | -1/+13 |
| | |||||
* | Recover from errors in diropen(). | Tavian Barnes | 2015-07-25 | 1 | -78/+122 |
| | | | | Fixes #4. | ||||
* | bftw: New struct BFTW type to hold file attributes. | Tavian Barnes | 2015-07-23 | 1 | -22/+27 |
| | | | | | Like nftw()'s struct FTW. level is needed to implement -mindepth/ -maxdepth. | ||||
* | bftw: Assume struct dirent::d_type exists if DT_* are defined. | Tavian Barnes | 2015-07-19 | 1 | -1/+1 |
| | | | | | | | Only glibc defines _DIRENT_HAVE_D_TYPE, but other C libraries have d_type too. This should fix #3. | ||||
* | Assorted optimizations. | Tavian Barnes | 2015-06-23 | 1 | -18/+25 |
| | |||||
* | bftw: Don't add extra slashes. | Tavian Barnes | 2015-06-21 | 1 | -4/+20 |
| | | | | This fixes "bfs /" among other things. | ||||
* | bftw: Add flags parameter and BFTW_STAT flag. | Tavian Barnes | 2015-06-18 | 1 | -4/+8 |
| | |||||
* | Implement bftw(). | Tavian Barnes | 2015-06-14 | 1 | -0/+491 |