From 42676ca0f638a76369730269b5d8aa590694bcc0 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 23 Aug 2005 15:20:37 +0000 Subject: fix --- ChangeLog | 6 ++++++ sshfs.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index dc2ecb1..ed75569 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-08-17 Miklos Szeredi + + * Try to calculate approximate disk usage of files from their + size, so that 'du' returns meaningful results. Problem reported + by Bernd Amend. + 2005-08-15 Miklos Szeredi * Released 1.2 diff --git a/sshfs.c b/sshfs.c index ad9f550..758d604 100644 --- a/sshfs.c +++ b/sshfs.c @@ -95,6 +95,7 @@ static int sync_write = 0; static int sync_read = 0; static char *base_path; static char *host; +static unsigned blksize = 4096; struct buffer { uint8_t *p; @@ -497,6 +498,10 @@ static int buf_get_attrs(struct buffer *buf, struct stat *stbuf) stbuf->st_mode = mode; stbuf->st_nlink = 1; stbuf->st_size = size; + if (blksize) { + stbuf->st_blksize = blksize; + stbuf->st_blocks = ((size + blksize - 1) & ~(blksize - 1)) >> 9; + } stbuf->st_uid = uid; stbuf->st_gid = gid; stbuf->st_atime = atime; -- cgit v1.2.3