mirror of https://github.com/MidnightCommander/mc
sftpfs: define st_blksize and st_blocks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
a8a8e85279
commit
95556224a6
|
@ -217,7 +217,10 @@ sftpfs_fstat (void *data, struct stat *buf, GError ** mcerror)
|
|||
}
|
||||
|
||||
if ((attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) != 0)
|
||||
{
|
||||
buf->st_size = attrs.filesize;
|
||||
sftpfs_blksize (buf);
|
||||
}
|
||||
|
||||
if ((attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) != 0)
|
||||
buf->st_mode = attrs.permissions;
|
||||
|
|
|
@ -119,6 +119,22 @@ sftpfs_waitsocket (sftpfs_super_data_t * super_data, GError ** mcerror)
|
|||
return select (super_data->socket_handle + 1, readfd, writefd, NULL, &timeout);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* Adjust block size and number of blocks */
|
||||
|
||||
void
|
||||
sftpfs_blksize (struct stat *s)
|
||||
{
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
s->st_blksize = LIBSSH2_CHANNEL_WINDOW_DEFAULT; /* FIXME */
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
/* In according to stat(2), this is the size in 512-byte units */
|
||||
s->st_blocks = 1 + ((s->st_size - 1) / 512);
|
||||
#endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
|
||||
#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Getting information about a symbolic link.
|
||||
|
@ -188,7 +204,10 @@ sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
|
|||
}
|
||||
|
||||
if ((attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) != 0)
|
||||
{
|
||||
buf->st_size = attrs.filesize;
|
||||
sftpfs_blksize (buf);
|
||||
}
|
||||
|
||||
if ((attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) != 0)
|
||||
buf->st_mode = attrs.permissions;
|
||||
|
@ -267,7 +286,10 @@ sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
|
|||
}
|
||||
|
||||
if ((attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) != 0)
|
||||
{
|
||||
buf->st_size = attrs.filesize;
|
||||
sftpfs_blksize (buf);
|
||||
}
|
||||
|
||||
if ((attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) != 0)
|
||||
buf->st_mode = attrs.permissions;
|
||||
|
|
|
@ -71,6 +71,7 @@ void sftpfs_ssherror_to_gliberror (sftpfs_super_data_t * super_data, int libssh_
|
|||
int sftpfs_waitsocket (sftpfs_super_data_t * super_data, GError ** mcerror);
|
||||
|
||||
const char *sftpfs_fix_filename (const char *file_name);
|
||||
void sftpfs_blksize (struct stat *s);
|
||||
int sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror);
|
||||
int sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror);
|
||||
int sftpfs_readlink (const vfs_path_t * vpath, char *buf, size_t size, GError ** mcerror);
|
||||
|
|
Loading…
Reference in New Issue