OSDN Git Service

Set st_blocks field in struct stat (now du utility behaves properly).
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sun, 20 Dec 2009 16:44:47 +0000 (16:44 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Sun, 20 Dec 2009 16:44:47 +0000 (16:44 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@86 60bc1c72-a15a-11de-b98f-4500b42dc123

libexfat/utils.c

index 167b5e9..04d39f3 100644 (file)
@@ -22,6 +22,8 @@ void exfat_stat(const struct exfat* ef, const struct exfat_node* node,
                stbuf->st_mode = S_IFREG | (0777 & ~ef->fmask);
        stbuf->st_nlink = 1;
        stbuf->st_size = node->size;
+       stbuf->st_blocks = DIV_ROUND_UP(node->size, CLUSTER_SIZE(*ef->sb)) *
+               CLUSTER_SIZE(*ef->sb) / 512;
        stbuf->st_mtime = node->mtime;
        stbuf->st_atime = node->atime;
        stbuf->st_ctime = 0; /* unapplicable */