-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psh: implement 'du' command #213
base: master
Are you sure you want to change the base?
Conversation
Unit Test Results7 460 tests +6 6 745 ✅ +7 36m 20s ⏱️ - 2m 0s Results for commit cac8d8e. ± Comparison against base commit 1c234da. This pull request removes 1 and adds 7 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
5a996a8
to
04c47cb
Compare
|
||
|
||
if ((curLevel >= du_common.levels) || ((maybePrint) && (curLevel >= 0))) { | ||
printf("%zu\t%s\n", roundPrefix(total), d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this can be used:
phoenix-rtos-utils/psh/pshapp/pshapp.c
Line 210 in 7b6b834
int psh_prefix(unsigned int base, int x, int y, unsigned int prec, char *buff) |
To not reimplement existing functionality
if (!((entry->d_name[0] == '.') && ((entry->d_name[1] == '\0') || ((entry->d_name[1] == '.') && (entry->d_name[2] == '\0'))))) { | ||
const size_t nextPos = makePath(startPos, entry->d_name); | ||
if (nextPos > 0u) { | ||
total += doDirectory(nextPos, curLevel - 1, stbuf.st_dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid recursion
Implements tool that estimates file space usage JIRA: RTOS-745
04c47cb
to
cac8d8e
Compare
Description
The
du
command is used to estimate the space used by a directory or a specific file. The command stands fordisk usage
. When executed,du
traverses the specified directories and prints the sizes of the subdirectories and files (if-a
switch is used) in bytes by default, unless specified otherwise (using switch-k
for kilobytes and-K
for Kibibytes).Motivation and Context
Need tool to print directory structure and files while developing a file system.
JIRA: RTOS-745
Examples
ia32-generic, estimate size in bytes of /usr/bin and /bin directories
kB, all directories
Types of changes
How Has This Been Tested?
imxrt1176-nil
,ia32-generic
Checklist:
Special treatment