mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #171: fixed remained plain int types in VFS.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
3322964fbf
commit
17d8107e8d
@ -899,10 +899,10 @@ strip_ctrl_codes (char *s)
|
||||
|
||||
#ifndef ENABLE_VFS
|
||||
char *
|
||||
get_current_wd (char *buffer, int size)
|
||||
get_current_wd (char *buffer, size_t size)
|
||||
{
|
||||
char *p;
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
p = g_get_current_dir ();
|
||||
len = strlen (p) + 1;
|
||||
|
@ -164,7 +164,7 @@ void custom_canonicalize_pathname (char *, CANON_PATH_FLAGS);
|
||||
void canonicalize_pathname (char *);
|
||||
|
||||
/* Misc Unix functions */
|
||||
char *get_current_wd (char *buffer, int size);
|
||||
char *get_current_wd (char *buffer, size_t size);
|
||||
int my_mkdir (const char *s, mode_t mode);
|
||||
int my_rmdir (const char *s);
|
||||
|
||||
|
@ -107,7 +107,7 @@ static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super);
|
||||
static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super);
|
||||
static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *super);
|
||||
static ssize_t cpio_read_crc_head(struct vfs_class *me, struct vfs_s_super *super);
|
||||
static ssize_t cpio_read(void *fh, char *buffer, int count);
|
||||
static ssize_t cpio_read(void *fh, char *buffer, size_t count);
|
||||
|
||||
#define CPIO_POS(super) cpio_position
|
||||
/* If some time reentrancy should be needed change it to */
|
||||
@ -663,26 +663,27 @@ cpio_super_same (struct vfs_class *me, struct vfs_s_super *parc,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ssize_t cpio_read(void *fh, char *buffer, int count)
|
||||
static ssize_t cpio_read(void *fh, char *buffer, size_t count)
|
||||
{
|
||||
off_t begin = FH->ino->data_offset;
|
||||
int fd = FH_SUPER->u.arch.fd;
|
||||
struct vfs_class *me = FH_SUPER->me;
|
||||
ssize_t res;
|
||||
|
||||
if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
|
||||
begin + FH->pos) ERRNOR (EIO, -1);
|
||||
|
||||
count = MIN(count, FH->ino->st.st_size - FH->pos);
|
||||
count = MIN(count, (size_t)(FH->ino->st.st_size - FH->pos));
|
||||
|
||||
count = mc_read (fd, buffer, count);
|
||||
if (count == -1)
|
||||
res = mc_read (fd, buffer, count);
|
||||
if (res == -1)
|
||||
ERRNOR (errno, -1);
|
||||
|
||||
FH->pos += count;
|
||||
return count;
|
||||
FH->pos += res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
|
||||
static int cpio_fh_open(struct vfs_class *me, struct vfs_s_fh *fh, int flags, mode_t mode)
|
||||
{
|
||||
(void) fh;
|
||||
(void) mode;
|
||||
|
@ -755,7 +755,7 @@ vfs_s_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
}
|
||||
|
||||
void *
|
||||
vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
vfs_s_open (struct vfs_class *me, const char *file, int flags, mode_t mode)
|
||||
{
|
||||
int was_changed = 0;
|
||||
struct vfs_s_fh *fh;
|
||||
@ -848,7 +848,7 @@ vfs_s_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
vfs_s_read (void *fh, char *buffer, int count)
|
||||
vfs_s_read (void *fh, char *buffer, size_t count)
|
||||
{
|
||||
int n;
|
||||
struct vfs_class *me = FH_SUPER->me;
|
||||
@ -877,7 +877,7 @@ vfs_s_read (void *fh, char *buffer, int count)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
vfs_s_write (void *fh, const char *buffer, int count)
|
||||
vfs_s_write (void *fh, const char *buffer, size_t count)
|
||||
{
|
||||
int n;
|
||||
struct vfs_class *me = FH_SUPER->me;
|
||||
@ -907,7 +907,7 @@ vfs_s_lseek (void *fh, off_t offset, int whence)
|
||||
|
||||
if (FH->handle != -1)
|
||||
{ /* If we have local file opened, we want to work with it */
|
||||
int retval = lseek (FH->handle, offset, whence);
|
||||
off_t retval = lseek (FH->handle, offset, whence);
|
||||
if (retval == -1)
|
||||
FH->ino->super->me->verrno = errno;
|
||||
return retval;
|
||||
|
@ -805,7 +805,7 @@ extfs_run (struct vfs_class *me, const char *file)
|
||||
}
|
||||
|
||||
static void *
|
||||
extfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
extfs_open (struct vfs_class *me, const char *file, int flags, mode_t mode)
|
||||
{
|
||||
struct pseudofile *extfs_info;
|
||||
struct archive *archive = NULL;
|
||||
@ -881,7 +881,7 @@ extfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
extfs_read (void *data, char *buffer, int count)
|
||||
extfs_read (void *data, char *buffer, size_t count)
|
||||
{
|
||||
struct pseudofile *file = (struct pseudofile *) data;
|
||||
|
||||
@ -1091,7 +1091,7 @@ extfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
}
|
||||
|
||||
static int
|
||||
extfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
extfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
(void) me;
|
||||
(void) path;
|
||||
@ -1110,7 +1110,7 @@ extfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
extfs_write (void *data, const char *buf, int nbyte)
|
||||
extfs_write (void *data, const char *buf, size_t nbyte)
|
||||
{
|
||||
struct pseudofile *file = (struct pseudofile *) data;
|
||||
|
||||
|
@ -929,13 +929,13 @@ fish_linear_abort (struct vfs_class *me, struct vfs_s_fh *fh)
|
||||
}
|
||||
|
||||
static int
|
||||
fish_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len)
|
||||
fish_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, size_t len)
|
||||
{
|
||||
struct vfs_s_super *super = FH_SUPER;
|
||||
int n = 0;
|
||||
len = MIN (fh->u.fish.total - fh->u.fish.got, len);
|
||||
ssize_t n = 0;
|
||||
len = MIN ((size_t)(fh->u.fish.total - fh->u.fish.got), len);
|
||||
tty_disable_interrupt_key ();
|
||||
while (len && ((n = read (SUP.sockr, buf, len)) < 0))
|
||||
while (len != 0 && ((n = read (SUP.sockr, buf, len)) < 0))
|
||||
{
|
||||
if ((errno == EINTR) && !tty_got_interrupt ())
|
||||
continue;
|
||||
@ -1128,7 +1128,7 @@ fish_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
}
|
||||
|
||||
static int
|
||||
fish_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
fish_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
char *sowner, *sgroup;
|
||||
struct passwd *pw;
|
||||
@ -1228,7 +1228,7 @@ fish_rmdir (struct vfs_class *me, const char *path)
|
||||
}
|
||||
|
||||
static int
|
||||
fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
|
||||
fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, mode_t mode)
|
||||
{
|
||||
(void) mode;
|
||||
|
||||
@ -1292,7 +1292,7 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
}
|
||||
|
||||
static void *
|
||||
fish_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
fish_open (struct vfs_class *me, const char *file, int flags, mode_t mode)
|
||||
{
|
||||
/*
|
||||
sorry, i've places hack here
|
||||
|
@ -1694,9 +1694,9 @@ ftpfs_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
|
||||
}
|
||||
|
||||
static int
|
||||
ftpfs_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len)
|
||||
ftpfs_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, size_t len)
|
||||
{
|
||||
int n;
|
||||
ssize_t n;
|
||||
struct vfs_s_super *super = FH_SUPER;
|
||||
|
||||
while ((n = read (FH_SOCK, buf, len)) < 0)
|
||||
@ -1709,7 +1709,7 @@ ftpfs_linear_read (struct vfs_class *me, struct vfs_s_fh *fh, void *buf, int len
|
||||
if (n < 0)
|
||||
ftpfs_linear_abort (me, fh);
|
||||
|
||||
if (!n)
|
||||
if (n == 0)
|
||||
{
|
||||
SUP.ctl_connection_busy = 0;
|
||||
close (FH_SOCK);
|
||||
@ -1825,7 +1825,7 @@ ftpfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
}
|
||||
|
||||
static int
|
||||
ftpfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
ftpfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
#if 0
|
||||
ftpfs_errno = EPERM;
|
||||
@ -1908,7 +1908,7 @@ ftpfs_rmdir (struct vfs_class *me, const char *path)
|
||||
}
|
||||
|
||||
static int
|
||||
ftpfs_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
|
||||
ftpfs_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, mode_t mode)
|
||||
{
|
||||
(void) mode;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
static struct vfs_class vfs_local_ops;
|
||||
|
||||
static void *
|
||||
local_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
local_open (struct vfs_class *me, const char *file, int flags, mode_t mode)
|
||||
{
|
||||
int *local_info;
|
||||
int fd;
|
||||
@ -48,7 +48,7 @@ local_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
}
|
||||
|
||||
ssize_t
|
||||
local_read (void *data, char *buffer, int count)
|
||||
local_read (void *data, char *buffer, size_t count)
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -157,7 +157,7 @@ local_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
}
|
||||
|
||||
static int
|
||||
local_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
local_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
@ -197,14 +197,14 @@ local_symlink (struct vfs_class *me, const char *n1, const char *n2)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
local_write (void *data, const char *buf, int nbyte)
|
||||
local_write (void *data, const char *buf, size_t nbyte)
|
||||
{
|
||||
int fd;
|
||||
int n;
|
||||
|
||||
if (!data)
|
||||
return -1;
|
||||
|
||||
|
||||
fd = * (int *) data;
|
||||
while ((n = write (fd, buf, nbyte)) == -1){
|
||||
#ifdef EAGAIN
|
||||
@ -243,7 +243,7 @@ local_lseek (void *data, off_t offset, int whence)
|
||||
}
|
||||
|
||||
static int
|
||||
local_mknod (struct vfs_class *me, const char *path, int mode, int dev)
|
||||
local_mknod (struct vfs_class *me, const char *path, mode_t mode, dev_t dev)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
|
@ -14,7 +14,7 @@ extern void init_localfs (void);
|
||||
/* these functions are used by other filesystems, so they are
|
||||
* published here. */
|
||||
extern int local_close (void *data);
|
||||
extern ssize_t local_read (void *data, char *buffer, int count);
|
||||
extern ssize_t local_read (void *data, char *buffer, size_t count);
|
||||
extern int local_fstat (void *data, struct stat *buf);
|
||||
extern int local_errno (struct vfs_class *me);
|
||||
extern off_t local_lseek (void *data, off_t offset, int whence);
|
||||
|
@ -205,7 +205,7 @@ sfs_redirect (struct vfs_class *me, const char *name)
|
||||
}
|
||||
|
||||
static void *
|
||||
sfs_open (struct vfs_class *me, const char *path, int flags, int mode)
|
||||
sfs_open (struct vfs_class *me, const char *path, int flags, mode_t mode)
|
||||
{
|
||||
int *sfs_info;
|
||||
int fd;
|
||||
@ -243,7 +243,7 @@ static int sfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
return chmod (path, mode);
|
||||
}
|
||||
|
||||
static int sfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
static int sfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
path = sfs_redirect (me, path);
|
||||
return chown (path, owner, group);
|
||||
|
@ -359,7 +359,7 @@ smbfs_init (struct vfs_class * me)
|
||||
static void
|
||||
smbfs_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
char *path;
|
||||
|
||||
(void) me;
|
||||
@ -381,12 +381,12 @@ smbfs_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
/* does same as do_get() in client.c */
|
||||
/* called from vfs.c:1080, count = buffer size */
|
||||
static ssize_t
|
||||
smbfs_read (void *data, char *buffer, int count)
|
||||
smbfs_read (void *data, char *buffer, size_t count)
|
||||
{
|
||||
smbfs_handle *info = (smbfs_handle *) data;
|
||||
int n;
|
||||
ssize_t n;
|
||||
|
||||
DEBUG(3, ("smbfs_read(fnum:%d, nread:%d, count:%d)\n",
|
||||
DEBUG(3, ("smbfs_read(fnum:%d, nread:%d, count:%zu)\n",
|
||||
info->fnum, (int)info->nread, count));
|
||||
n = cli_read(info->cli, info->fnum, buffer, info->nread, count);
|
||||
if (n > 0)
|
||||
@ -395,12 +395,12 @@ smbfs_read (void *data, char *buffer, int count)
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
smbfs_write (void *data, const char *buf, int nbyte)
|
||||
smbfs_write (void *data, const char *buf, size_t nbyte)
|
||||
{
|
||||
smbfs_handle *info = (smbfs_handle *) data;
|
||||
int n;
|
||||
ssize_t n;
|
||||
|
||||
DEBUG(3, ("smbfs_write(fnum:%d, nread:%d, nbyte:%d)\n",
|
||||
DEBUG(3, ("smbfs_write(fnum:%d, nread:%d, nbyte:%zu)\n",
|
||||
info->fnum, (int)info->nread, nbyte));
|
||||
n = cli_write(info->cli, info->fnum, 0, buf, info->nread, nbyte);
|
||||
if (n > 0)
|
||||
@ -882,7 +882,7 @@ smbfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
}
|
||||
|
||||
static int
|
||||
smbfs_chown (struct vfs_class *me, const char *path, int owner, int group)
|
||||
smbfs_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
@ -908,8 +908,7 @@ smbfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
(void) me;
|
||||
|
||||
DEBUG (3,
|
||||
("smbfs_readlink(path:%s, buf:%s, size:%d)\n", path, buf,
|
||||
(int) size));
|
||||
("smbfs_readlink(path:%s, buf:%s, size:%zu)\n", path, buf, size));
|
||||
my_errno = EOPNOTSUPP;
|
||||
return -1; /* no symlinks on smb filesystem? */
|
||||
}
|
||||
@ -1673,11 +1672,11 @@ smbfs_lseek (void *data, off_t offset, int whence)
|
||||
}
|
||||
|
||||
static int
|
||||
smbfs_mknod (struct vfs_class *me, const char *path, int mode, int dev)
|
||||
smbfs_mknod (struct vfs_class *me, const char *path, mode_t mode, dev_t dev)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
DEBUG(3, ("smbfs_mknod(path:%s, mode:%d, dev:%d)\n", path, mode, dev));
|
||||
DEBUG(3, ("smbfs_mknod(path:%s, mode:%d, dev:%zu)\n", path, mode, dev));
|
||||
my_errno = EOPNOTSUPP;
|
||||
return -1;
|
||||
}
|
||||
@ -1759,7 +1758,7 @@ static void
|
||||
smbfs_forget (const char *path)
|
||||
{
|
||||
char *host, *user, *p;
|
||||
int port, i;
|
||||
int port;
|
||||
|
||||
if (strncmp (path, URL_HEADER, HEADER_LEN))
|
||||
return;
|
||||
@ -1771,7 +1770,10 @@ smbfs_forget (const char *path)
|
||||
path += 2;
|
||||
|
||||
if ((p = smbfs_get_host_and_username (&path, &host, &user, &port, NULL))) {
|
||||
size_t i;
|
||||
|
||||
g_free (p);
|
||||
|
||||
for (i = 0; i < SMBFS_MAX_CONNECTIONS; i++) {
|
||||
if (smbfs_connections[i].cli
|
||||
&& (strcmp (host, smbfs_connections[i].host) == 0)
|
||||
@ -1808,7 +1810,7 @@ smbfs_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
|
||||
|
||||
static smbfs_handle *
|
||||
smbfs_open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int mode)
|
||||
smbfs_open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, mode_t mode)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
@ -1863,7 +1865,7 @@ smbfs_open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int m
|
||||
}
|
||||
|
||||
static void *
|
||||
smbfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
||||
smbfs_open (struct vfs_class *me, const char *file, int flags, mode_t mode)
|
||||
{
|
||||
char *remote_file;
|
||||
void *ret;
|
||||
|
@ -762,26 +762,27 @@ tar_super_same (struct vfs_class *me, struct vfs_s_super *parc,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ssize_t tar_read (void *fh, char *buffer, int count)
|
||||
static ssize_t tar_read (void *fh, char *buffer, size_t count)
|
||||
{
|
||||
off_t begin = FH->ino->data_offset;
|
||||
int fd = FH_SUPER->u.arch.fd;
|
||||
struct vfs_class *me = FH_SUPER->me;
|
||||
ssize_t res;
|
||||
|
||||
if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
|
||||
begin + FH->pos) ERRNOR (EIO, -1);
|
||||
|
||||
count = MIN(count, FH->ino->st.st_size - FH->pos);
|
||||
count = MIN (count, (size_t)(FH->ino->st.st_size - FH->pos));
|
||||
|
||||
count = mc_read (fd, buffer, count);
|
||||
if (count == -1)
|
||||
res = mc_read (fd, buffer, count);
|
||||
if (res == -1)
|
||||
ERRNOR (errno, -1);
|
||||
|
||||
FH->pos += count;
|
||||
return count;
|
||||
FH->pos += res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int tar_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode)
|
||||
static int tar_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, mode_t mode)
|
||||
{
|
||||
(void) fh;
|
||||
(void) mode;
|
||||
|
@ -410,12 +410,12 @@ typedef struct
|
||||
|
||||
/* Used by undelfs_read: */
|
||||
char *dest_buffer; /* destination buffer */
|
||||
int count; /* bytes to read */
|
||||
size_t count; /* bytes to read */
|
||||
} undelfs_file;
|
||||
|
||||
/* We do not support lseek */
|
||||
static void *
|
||||
undelfs_open (struct vfs_class *me, const char *fname, int flags, int mode)
|
||||
undelfs_open (struct vfs_class *me, const char *fname, int flags, mode_t mode)
|
||||
{
|
||||
char *file, *f;
|
||||
ext2_ino_t inode, i;
|
||||
@ -554,7 +554,7 @@ undelfs_dump_read (ext2_filsys param_fs, blk_t * blocknr, int blockcnt, void *pr
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
undelfs_read (void *vfs_info, char *buffer, int count)
|
||||
undelfs_read (void *vfs_info, char *buffer, size_t count)
|
||||
{
|
||||
undelfs_file *p = vfs_info;
|
||||
int retval;
|
||||
|
@ -10,6 +10,9 @@
|
||||
#ifdef ENABLE_VFS
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <stddef.h>
|
||||
#include <utime.h>
|
||||
@ -51,10 +54,10 @@ struct vfs_class {
|
||||
int (*which) (struct vfs_class *me, const char *path);
|
||||
|
||||
void *(*open) (struct vfs_class *me, const char *fname, int flags,
|
||||
int mode);
|
||||
mode_t mode);
|
||||
int (*close) (void *vfs_info);
|
||||
ssize_t (*read) (void *vfs_info, char *buffer, int count);
|
||||
ssize_t (*write) (void *vfs_info, const char *buf, int count);
|
||||
ssize_t (*read) (void *vfs_info, char *buffer, size_t count);
|
||||
ssize_t (*write) (void *vfs_info, const char *buf, size_t count);
|
||||
|
||||
void *(*opendir) (struct vfs_class *me, const char *dirname);
|
||||
void *(*readdir) (void *vfs_info);
|
||||
@ -65,7 +68,7 @@ struct vfs_class {
|
||||
int (*fstat) (void *vfs_info, struct stat * buf);
|
||||
|
||||
int (*chmod) (struct vfs_class *me, const char *path, int mode);
|
||||
int (*chown) (struct vfs_class *me, const char *path, int owner, int group);
|
||||
int (*chown) (struct vfs_class *me, const char *path, uid_t owner, gid_t group);
|
||||
int (*utime) (struct vfs_class *me, const char *path,
|
||||
struct utimbuf * times);
|
||||
|
||||
@ -78,7 +81,7 @@ struct vfs_class {
|
||||
int (*chdir) (struct vfs_class *me, const char *path);
|
||||
int (*ferrno) (struct vfs_class *me);
|
||||
off_t (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||
int (*mknod) (struct vfs_class *me, const char *path, int mode, int dev);
|
||||
int (*mknod) (struct vfs_class *me, const char *path, mode_t mode, dev_t dev);
|
||||
|
||||
vfsid (*getid) (struct vfs_class *me, const char *path);
|
||||
|
||||
@ -133,7 +136,7 @@ int vfs_file_class_flags (const char *filename);
|
||||
void vfs_fill_names (fill_names_f);
|
||||
|
||||
/* vfs/direntry.c: */
|
||||
void *vfs_s_open (struct vfs_class *, const char *, int, int);
|
||||
void *vfs_s_open (struct vfs_class *me, const char *file, int flags, mode_t mode);
|
||||
|
||||
void init_cpiofs (void);
|
||||
void init_extfs (void);
|
||||
|
@ -601,7 +601,7 @@ int mc_##name inarg \
|
||||
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vfs, mpath, mode))
|
||||
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vfs, mpath, owner, group))
|
||||
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vfs, mpath, times))
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, int bufsiz), (vfs, mpath, buf, bufsiz))
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vfs, mpath, buf, bufsiz))
|
||||
MC_NAMEOP (unlink, (const char *path), (vfs, mpath))
|
||||
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vfs, mpath, mode))
|
||||
MC_NAMEOP (rmdir, (const char *path), (vfs, mpath))
|
||||
@ -657,8 +657,8 @@ ssize_t mc_##name inarg \
|
||||
return result; \
|
||||
}
|
||||
|
||||
MC_HANDLEOP (read, (int handle, void *buffer, int count), (vfs_info (handle), buffer, count))
|
||||
MC_HANDLEOP (write, (int handle, const void *buf, int nbyte), (vfs_info (handle), buf, nbyte))
|
||||
MC_HANDLEOP (read, (int handle, void *buffer, size_t count), (vfs_info (handle), buffer, count))
|
||||
MC_HANDLEOP (write, (int handle, const void *buf, size_t nbyte), (vfs_info (handle), buf, nbyte))
|
||||
|
||||
#define MC_RENAMEOP(name) \
|
||||
int mc_##name (const char *fname1, const char *fname2) \
|
||||
@ -690,7 +690,8 @@ int mc_##name (const char *fname1, const char *fname2) \
|
||||
return result; \
|
||||
}
|
||||
|
||||
MC_RENAMEOP (link) MC_RENAMEOP (rename)
|
||||
MC_RENAMEOP (link)
|
||||
MC_RENAMEOP (rename)
|
||||
|
||||
int
|
||||
mc_ctl (int handle, int ctlop, void *arg)
|
||||
@ -1020,7 +1021,7 @@ vfs_setup_wd (void)
|
||||
* from the OS. Put directory to the provided buffer.
|
||||
*/
|
||||
char *
|
||||
mc_get_current_wd (char *buffer, int size)
|
||||
mc_get_current_wd (char *buffer, size_t size)
|
||||
{
|
||||
const char *cwd = _vfs_get_cwd ();
|
||||
|
||||
@ -1041,7 +1042,7 @@ off_t
|
||||
mc_lseek (int fd, off_t offset, int whence)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
int result;
|
||||
off_t result;
|
||||
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
@ -1253,10 +1254,11 @@ static int
|
||||
mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||
const char *local, int has_changed)
|
||||
{
|
||||
int fdin = -1, fdout = -1, i;
|
||||
int fdin = -1, fdout = -1;
|
||||
if (has_changed)
|
||||
{
|
||||
char buffer[8192];
|
||||
ssize_t i;
|
||||
|
||||
if (!vfs->write)
|
||||
goto failed;
|
||||
@ -1268,10 +1270,8 @@ mc_def_ungetlocalcopy (struct vfs_class *vfs, const char *filename,
|
||||
if (fdout == -1)
|
||||
goto failed;
|
||||
while ((i = read (fdin, buffer, sizeof (buffer))) > 0)
|
||||
{
|
||||
if (mc_write (fdout, buffer, i) != i)
|
||||
if (mc_write (fdout, buffer, (size_t) i) != i)
|
||||
goto failed;
|
||||
}
|
||||
if (i == -1)
|
||||
goto failed;
|
||||
|
||||
|
@ -29,10 +29,10 @@ void vfs_shut (void);
|
||||
|
||||
int vfs_current_is_local (void);
|
||||
int vfs_file_is_local (const char *filename);
|
||||
ssize_t mc_read (int handle, void *buffer, int count);
|
||||
ssize_t mc_write (int handle, const void *buffer, int count);
|
||||
ssize_t mc_read (int handle, void *buffer, size_t count);
|
||||
ssize_t mc_write (int handle, const void *buffer, size_t count);
|
||||
int mc_utime (const char *path, struct utimbuf *times);
|
||||
int mc_readlink (const char *path, char *buf, int bufsiz);
|
||||
int mc_readlink (const char *path, char *buf, size_t bufsiz);
|
||||
int mc_ungetlocalcopy (const char *pathname, const char *local, int has_changed);
|
||||
int mc_close (int handle);
|
||||
off_t mc_lseek (int fd, off_t offset, int whence);
|
||||
@ -40,7 +40,7 @@ DIR *mc_opendir (const char *dirname);
|
||||
struct dirent *mc_readdir (DIR * dirp);
|
||||
int mc_closedir (DIR * dir);
|
||||
int mc_stat (const char *path, struct stat *buf);
|
||||
int mc_mknod (const char *, mode_t, dev_t);
|
||||
int mc_mknod (const char *path, mode_t mode, dev_t dev);
|
||||
int mc_link (const char *name1, const char *name2);
|
||||
int mc_mkdir (const char *path, mode_t mode);
|
||||
int mc_rmdir (const char *path);
|
||||
@ -55,7 +55,7 @@ int mc_unlink (const char *path);
|
||||
int mc_ctl (int fd, int ctlop, void *arg);
|
||||
int mc_setctl (const char *path, int ctlop, void *arg);
|
||||
int mc_open (const char *filename, int flags, ...);
|
||||
char *mc_get_current_wd (char *buffer, int bufsize);
|
||||
char *mc_get_current_wd (char *buffer, size_t bufsize);
|
||||
char *vfs_canon (const char *path);
|
||||
char *mc_getlocalcopy (const char *pathname);
|
||||
char *vfs_strip_suffix_from_filename (const char *filename);
|
||||
|
@ -174,7 +174,7 @@ struct vfs_s_subclass
|
||||
const char *archive_name, char *op);
|
||||
void (*free_archive) (struct vfs_class * me, struct vfs_s_super * psup);
|
||||
|
||||
int (*fh_open) (struct vfs_class * me, struct vfs_s_fh * fh, int flags, int mode);
|
||||
int (*fh_open) (struct vfs_class * me, struct vfs_s_fh * fh, int flags, mode_t mode);
|
||||
int (*fh_close) (struct vfs_class * me, struct vfs_s_fh * fh);
|
||||
|
||||
struct vfs_s_entry *(*find_entry) (struct vfs_class * me,
|
||||
@ -185,7 +185,7 @@ struct vfs_s_subclass
|
||||
int (*file_store) (struct vfs_class * me, struct vfs_s_fh * fh, char *path, char *localname);
|
||||
|
||||
int (*linear_start) (struct vfs_class * me, struct vfs_s_fh * fh, off_t from);
|
||||
int (*linear_read) (struct vfs_class * me, struct vfs_s_fh * fh, void *buf, int len);
|
||||
int (*linear_read) (struct vfs_class * me, struct vfs_s_fh * fh, void *buf, size_t len);
|
||||
void (*linear_close) (struct vfs_class * me, struct vfs_s_fh * fh);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user