summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-07-04 08:54:23 -0400
committerFrans Kaashoek <[email protected]>2019-07-04 08:57:23 -0400
commitfab5e7c1de2288e2b9e41f7010ca85f2a641cf63 (patch)
tree02ded2688783b908f1281a09cf6db3cfd53f0b9c
parent6bfb078b146c95918752afd3b3308d748666f4ae (diff)
downloadxv6-labs-fab5e7c1de2288e2b9e41f7010ca85f2a641cf63.tar.gz
xv6-labs-fab5e7c1de2288e2b9e41f7010ca85f2a641cf63.tar.bz2
xv6-labs-fab5e7c1de2288e2b9e41f7010ca85f2a641cf63.zip
Make size in stat.h be a uint64
Supporting print long using %l (a bit of cheat) Modify ls to print size using %l We should probably update size in inode too.
-rw-r--r--kernel/stat.h4
-rw-r--r--user/ls.c2
-rw-r--r--user/printf.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/kernel/stat.h b/kernel/stat.h
index a498321..19543af 100644
--- a/kernel/stat.h
+++ b/kernel/stat.h
@@ -3,9 +3,9 @@
#define T_DEVICE 3 // Device
struct stat {
- short type; // Type of file
int dev; // File system's disk device
uint ino; // Inode number
+ short type; // Type of file
short nlink; // Number of links to file
- uint size; // Size of file in bytes
+ uint64 size; // Size of file in bytes
};
diff --git a/user/ls.c b/user/ls.c
index c649c57..3511d87 100644
--- a/user/ls.c
+++ b/user/ls.c
@@ -43,7 +43,7 @@ ls(char *path)
switch(st.type){
case T_FILE:
- printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
+ printf(1, "%s %d %d %l\n", fmtname(path), st.type, st.ino, st.size);
break;
case T_DIR:
diff --git a/user/printf.c b/user/printf.c
index 0c6b34b..f3b3282 100644
--- a/user/printf.c
+++ b/user/printf.c
@@ -68,6 +68,8 @@ printf(int fd, const char *fmt, ...)
} else if(state == '%'){
if(c == 'd'){
printint(fd, va_arg(ap, int), 10, 1);
+ } else if(c == 'l') {
+ printint(fd, va_arg(ap, uint64), 10, 0);
} else if(c == 'x') {
printint(fd, va_arg(ap, int), 16, 0);
} else if(c == 'p') {