Bug 1399 - add statfs extension to sftp-server
Summary: add statfs extension to sftp-server
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp-server (show other bugs)
Version: -current
Hardware: All All
: P2 enhancement
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_5_1
  Show dependency treegraph
 
Reported: 2007-12-11 07:52 AEDT by Miklos Szeredi
Modified: 2008-07-22 12:20 AEST (History)
1 user (show)

See Also:


Attachments
[PATCH] add statfs extension to sftp-server (1.68 KB, patch)
2007-12-11 08:01 AEDT, Miklos Szeredi
no flags Details | Diff
statvfs support for client and server (16.26 KB, patch)
2008-03-24 00:09 AEDT, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Szeredi 2007-12-11 07:52:32 AEDT
This is needed to be able to support statfs operation on an SSH
filesystem (http://fuse.sourceforge.net/sshfs.html).

It uses and sends only those fields of struct statfs which are common
with struct statvfs as defined by POSIX, and which are shared among
most UNIX-like systems.

The SSH_FXP_EXTENDED message type is used, so this change is backward
compatible and conforms to the protocol specification.
Comment 1 Miklos Szeredi 2007-12-11 08:01:58 AEDT
Created attachment 1393 [details]
[PATCH] add statfs extension to sftp-server
Comment 2 Damien Miller 2008-01-20 08:14:10 AEDT
Wouldn't this be better as a statvfs method? OpenBSD doesn't yet support it, but it will soon.
Comment 3 Miklos Szeredi 2008-01-22 08:13:25 AEDT
Sure, I'll update the patch to use statvfs.  When is this support planned?
Comment 4 Damien Miller 2008-03-24 00:09:42 AEDT
Created attachment 1475 [details]
statvfs support for client and server

This diff implements a statvfs@openssh.com method in the server and adds a "df" command to the client to use it:

sftp> df
        Size         Used        Avail       (root)    %Capacity
    33003120     11227184     20125792     21775936          34%
sftp> df -h
    Size     Used    Avail   (root)    %Capacity
  31.5GB   10.7GB   19.2GB   20.8GB          34%
sftp> df -i
     Inodes        Used       Avail      (root)    %Capacity
     545662      110326      435336      435336          20%
Comment 5 Miklos Szeredi 2008-03-28 02:55:03 AEDT
Thanks.

One small comment about the patch:

This line in process_extended_fstatvfs() is wrong, it shouldn't be there:

+	id = get_int();
Comment 6 Damien Miller 2008-04-18 22:33:15 AEST
Patch committed (with the suggested fix), this will be in OpenSSH 5.1.

Thanks!
Comment 7 Damien Miller 2008-04-18 22:44:09 AEST
Patch committed (with the suggested fix), this will be in OpenSSH 5.1.

Thanks!
Comment 8 Damien Miller 2008-07-22 12:20:34 AEST
Mass update RESOLVED->CLOSED after release of openssh-5.1