Bug 1399

Summary: add statfs extension to sftp-server
Product: Portable OpenSSH Reporter: Miklos Szeredi <miklos>
Component: sftp-serverAssignee: Damien Miller <djm>
Status: CLOSED FIXED    
Severity: enhancement CC: djm
Priority: P2    
Version: -current   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1452    
Attachments:
Description Flags
[PATCH] add statfs extension to sftp-server
none
statvfs support for client and server none

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