mirror of https://github.com/MidnightCommander/mc
Const-ified the rest of the vfs_class methods.
This commit is contained in:
parent
e0bf99d516
commit
b17b1ac213
|
@ -672,7 +672,7 @@ vfs_s_fstat (void *fh, struct stat *buf)
|
|||
}
|
||||
|
||||
static int
|
||||
vfs_s_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
vfs_s_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ vfs_s_ungetlocalcopy (struct vfs_class *me, const char *path,
|
|||
}
|
||||
|
||||
static int
|
||||
vfs_s_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
vfs_s_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
{
|
||||
switch (ctlop) {
|
||||
case VFS_SETCTL_STALE_DATA:
|
||||
|
|
106
vfs/extfs.c
106
vfs/extfs.c
|
@ -631,7 +631,7 @@ extfs_cmd (const char *extfs_cmd, struct archive *archive,
|
|||
}
|
||||
|
||||
static void
|
||||
extfs_run (char *file)
|
||||
extfs_run (const char *file)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *p, *q, *archive_name, *mc_extfsdir;
|
||||
|
@ -970,25 +970,32 @@ static int extfs_fstat (void *data, struct stat *buf)
|
|||
}
|
||||
|
||||
static int
|
||||
extfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
extfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q;
|
||||
int i;
|
||||
struct entry *entry;
|
||||
char *mpath = g_strdup(path);
|
||||
int result = -1;
|
||||
|
||||
if ((q = extfs_get_path_mangle (path, &archive, 0, 0)) == NULL)
|
||||
return -1;
|
||||
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
||||
goto cleanup;
|
||||
entry = extfs_find_entry (archive->root_entry, q, 0, 0);
|
||||
if (entry == NULL)
|
||||
return -1;
|
||||
if (!S_ISLNK (entry->inode->mode))
|
||||
ERRNOR (EINVAL, -1);
|
||||
goto cleanup;
|
||||
if (!S_ISLNK (entry->inode->mode)) {
|
||||
me->verrno = EINVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
if (size < (i = strlen (entry->inode->linkname))) {
|
||||
i = size;
|
||||
}
|
||||
strncpy (buf, entry->inode->linkname, i);
|
||||
return i;
|
||||
result = i;
|
||||
cleanup:
|
||||
g_free (mpath);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int extfs_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
|
@ -1004,78 +1011,97 @@ static int extfs_write (void *data, const char *buf, int nbyte)
|
|||
return write (file->local_handle, buf, nbyte);
|
||||
}
|
||||
|
||||
static int extfs_unlink (struct vfs_class *me, char *file)
|
||||
static int extfs_unlink (struct vfs_class *me, const char *file)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q;
|
||||
char *q, *mpath = g_strdup(file);
|
||||
struct entry *entry;
|
||||
int result = -1;
|
||||
|
||||
if ((q = extfs_get_path_mangle (file, &archive, 0, 0)) == NULL)
|
||||
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
||||
return -1;
|
||||
entry = extfs_find_entry (archive->root_entry, q, 0, 0);
|
||||
if (entry == NULL)
|
||||
return -1;
|
||||
goto cleanup;
|
||||
if ((entry = extfs_resolve_symlinks (entry)) == NULL)
|
||||
return -1;
|
||||
if (S_ISDIR (entry->inode->mode)) ERRNOR (EISDIR, -1);
|
||||
|
||||
goto cleanup;
|
||||
if (S_ISDIR (entry->inode->mode)) {
|
||||
me->verrno = EISDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
if (extfs_cmd (" rm ", archive, entry, "")){
|
||||
my_errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
extfs_remove_entry (entry);
|
||||
|
||||
return 0;
|
||||
result = 0;
|
||||
cleanup:
|
||||
g_free (mpath);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int extfs_mkdir (struct vfs_class *me, char *path, mode_t mode)
|
||||
static int extfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q;
|
||||
char *q, *mpath = g_strdup(path);
|
||||
struct entry *entry;
|
||||
int result = -1;
|
||||
|
||||
if ((q = extfs_get_path_mangle (path, &archive, 0, 0)) == NULL)
|
||||
return -1;
|
||||
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
||||
goto cleanup;
|
||||
entry = extfs_find_entry (archive->root_entry, q, 0, 0);
|
||||
if (entry != NULL) ERRNOR (EEXIST, -1);
|
||||
if (entry != NULL) {
|
||||
me->verrno = EEXIST;
|
||||
goto cleanup;
|
||||
}
|
||||
entry = extfs_find_entry (archive->root_entry, q, 1, 0);
|
||||
if (entry == NULL)
|
||||
return -1;
|
||||
goto cleanup;
|
||||
if ((entry = extfs_resolve_symlinks (entry)) == NULL)
|
||||
return -1;
|
||||
if (!S_ISDIR (entry->inode->mode)) ERRNOR (ENOTDIR, -1);
|
||||
goto cleanup;
|
||||
if (!S_ISDIR (entry->inode->mode)) {
|
||||
me->verrno = ENOTDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (extfs_cmd (" mkdir ", archive, entry, "")){
|
||||
my_errno = EIO;
|
||||
extfs_remove_entry (entry);
|
||||
return -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
result = 0;
|
||||
cleanup:
|
||||
g_free (mpath);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int extfs_rmdir (struct vfs_class *me, char *path)
|
||||
static int extfs_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q;
|
||||
char *q, *mpath = g_strdup(path);
|
||||
struct entry *entry;
|
||||
int result = -1;
|
||||
|
||||
if ((q = extfs_get_path_mangle (path, &archive, 0, 0)) == NULL)
|
||||
return -1;
|
||||
if ((q = extfs_get_path_mangle (mpath, &archive, 0, 0)) == NULL)
|
||||
goto cleanup;
|
||||
entry = extfs_find_entry (archive->root_entry, q, 0, 0);
|
||||
if (entry == NULL)
|
||||
return -1;
|
||||
goto cleanup;
|
||||
if ((entry = extfs_resolve_symlinks (entry)) == NULL)
|
||||
return -1;
|
||||
if (!S_ISDIR (entry->inode->mode)) ERRNOR (ENOTDIR, -1);
|
||||
goto cleanup;
|
||||
if (!S_ISDIR (entry->inode->mode)) {
|
||||
me->verrno = ENOTDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (extfs_cmd (" rmdir ", archive, entry, "")){
|
||||
my_errno = EIO;
|
||||
return -1;
|
||||
goto cleanup;
|
||||
}
|
||||
extfs_remove_entry (entry);
|
||||
|
||||
return 0;
|
||||
result = 0;
|
||||
cleanup:
|
||||
g_free (mpath);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1323,7 +1349,7 @@ static void extfs_done (struct vfs_class *me)
|
|||
}
|
||||
|
||||
static int
|
||||
extfs_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
extfs_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
{
|
||||
if (ctlop == VFS_SETCTL_RUN) {
|
||||
extfs_run (path);
|
||||
|
|
27
vfs/fish.c
27
vfs/fish.c
|
@ -677,7 +677,7 @@ fish_ctl (void *fh, int ctlop, void *arg)
|
|||
}
|
||||
|
||||
static int
|
||||
fish_send_command(struct vfs_class *me, struct vfs_s_super *super, char *cmd, int flags)
|
||||
fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *cmd, int flags)
|
||||
{
|
||||
int r;
|
||||
|
||||
|
@ -715,20 +715,22 @@ fish_chmod (struct vfs_class *me, const char *path, int mode)
|
|||
}
|
||||
|
||||
#define FISH_OP(name, chk, string) \
|
||||
static int fish_##name (struct vfs_class *me, char *path1, char *path2) \
|
||||
static int fish_##name (struct vfs_class *me, const char *path1, const char *path2) \
|
||||
{ \
|
||||
char buf[BUF_LARGE]; \
|
||||
char *rpath1, *rpath2; \
|
||||
char *rpath1, *rpath2, *mpath1, *mpath2; \
|
||||
struct vfs_s_super *super1, *super2; \
|
||||
if (!(rpath1 = vfs_s_get_path_mangle(me, path1, &super1, 0))) \
|
||||
if (!(rpath1 = vfs_s_get_path_mangle(me, mpath1 = g_strdup(path1), &super1, 0))) \
|
||||
return -1; \
|
||||
if (!(rpath2 = vfs_s_get_path_mangle(me, path2, &super2, 0))) \
|
||||
if (!(rpath2 = vfs_s_get_path_mangle(me, mpath2 = g_strdup(path2), &super2, 0))) \
|
||||
return -1; \
|
||||
rpath1 = name_quote (rpath1, 0); \
|
||||
rpath2 = name_quote (rpath2, 0); \
|
||||
g_snprintf(buf, sizeof(buf), string "\n", rpath1, rpath2, rpath1, rpath2); \
|
||||
g_free (rpath1); \
|
||||
g_free (rpath2); \
|
||||
g_free (mpath1); \
|
||||
g_free (mpath2); \
|
||||
return fish_send_command(me, super2, buf, OPT_FLUSH); \
|
||||
}
|
||||
|
||||
|
@ -740,16 +742,17 @@ FISH_OP(link, XTEST, "#LINK /%s /%s\n"
|
|||
"ln /%s /%s 2>/dev/null\n"
|
||||
"echo '### 000'" )
|
||||
|
||||
static int fish_symlink (struct vfs_class *me, char *setto, char *path)
|
||||
static int fish_symlink (struct vfs_class *me, const char *setto, const char *path)
|
||||
{
|
||||
char *qsetto;
|
||||
PREFIX
|
||||
setto = name_quote (setto, 0);
|
||||
qsetto = name_quote (setto, 0);
|
||||
g_snprintf(buf, sizeof(buf),
|
||||
"#SYMLINK %s /%s\n"
|
||||
"ln -s %s /%s 2>/dev/null\n"
|
||||
"echo '### 000'\n",
|
||||
setto, rpath, setto, rpath);
|
||||
g_free (setto);
|
||||
qsetto, rpath, qsetto, rpath);
|
||||
g_free (qsetto);
|
||||
POSTFIX(OPT_FLUSH);
|
||||
}
|
||||
|
||||
|
@ -787,7 +790,7 @@ fish_chown (struct vfs_class *me, const char *path, int owner, int group)
|
|||
POSTFIX(OPT_FLUSH)
|
||||
}
|
||||
|
||||
static int fish_unlink (struct vfs_class *me, char *path)
|
||||
static int fish_unlink (struct vfs_class *me, const char *path)
|
||||
{
|
||||
PREFIX
|
||||
g_snprintf(buf, sizeof(buf),
|
||||
|
@ -798,7 +801,7 @@ static int fish_unlink (struct vfs_class *me, char *path)
|
|||
POSTFIX(OPT_FLUSH);
|
||||
}
|
||||
|
||||
static int fish_mkdir (struct vfs_class *me, char *path, mode_t mode)
|
||||
static int fish_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
||||
{
|
||||
PREFIX
|
||||
g_snprintf(buf, sizeof(buf),
|
||||
|
@ -809,7 +812,7 @@ static int fish_mkdir (struct vfs_class *me, char *path, mode_t mode)
|
|||
POSTFIX(OPT_FLUSH);
|
||||
}
|
||||
|
||||
static int fish_rmdir (struct vfs_class *me, char *path)
|
||||
static int fish_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
PREFIX
|
||||
g_snprintf(buf, sizeof(buf),
|
||||
|
|
12
vfs/ftpfs.c
12
vfs/ftpfs.c
|
@ -151,7 +151,7 @@ static struct vfs_class vfs_ftpfs_ops;
|
|||
*/
|
||||
|
||||
static char *ftpfs_get_current_directory (struct vfs_class *me, struct vfs_s_super *super);
|
||||
static int ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, char *remote_path);
|
||||
static int ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, const char *remote_path);
|
||||
static int ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 4, 5)));
|
||||
static int ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super);
|
||||
|
@ -1506,7 +1506,7 @@ static int ftpfs_chown (struct vfs_class *me, const char *path, int owner, int g
|
|||
#endif
|
||||
}
|
||||
|
||||
static int ftpfs_unlink (struct vfs_class *me, char *path)
|
||||
static int ftpfs_unlink (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return ftpfs_send_command(me, path, "DELE /%s", OPT_FLUSH);
|
||||
}
|
||||
|
@ -1523,7 +1523,7 @@ ftpfs_is_same_dir (struct vfs_class *me, struct vfs_s_super *super, const char *
|
|||
}
|
||||
|
||||
static int
|
||||
ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, char *remote_path)
|
||||
ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, const char *remote_path)
|
||||
{
|
||||
int r;
|
||||
char *p;
|
||||
|
@ -1545,18 +1545,18 @@ ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, char *rem
|
|||
return r;
|
||||
}
|
||||
|
||||
static int ftpfs_rename (struct vfs_class *me, char *path1, char *path2)
|
||||
static int ftpfs_rename (struct vfs_class *me, const char *path1, const char *path2)
|
||||
{
|
||||
ftpfs_send_command(me, path1, "RNFR /%s", OPT_FLUSH);
|
||||
return ftpfs_send_command(me, path2, "RNTO /%s", OPT_FLUSH);
|
||||
}
|
||||
|
||||
static int ftpfs_mkdir (struct vfs_class *me, char *path, mode_t mode)
|
||||
static int ftpfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
||||
{
|
||||
return ftpfs_send_command(me, path, "MKD /%s", OPT_FLUSH);
|
||||
}
|
||||
|
||||
static int ftpfs_rmdir (struct vfs_class *me, char *path)
|
||||
static int ftpfs_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return ftpfs_send_command(me, path, "RMD /%s", OPT_FLUSH);
|
||||
}
|
||||
|
|
16
vfs/local.c
16
vfs/local.c
|
@ -147,19 +147,19 @@ local_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
|||
}
|
||||
|
||||
static int
|
||||
local_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
local_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
{
|
||||
return readlink (path, buf, size);
|
||||
}
|
||||
|
||||
static int
|
||||
local_unlink (struct vfs_class *me, char *path)
|
||||
local_unlink (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return unlink (path);
|
||||
}
|
||||
|
||||
static int
|
||||
local_symlink (struct vfs_class *me, char *n1, char *n2)
|
||||
local_symlink (struct vfs_class *me, const char *n1, const char *n2)
|
||||
{
|
||||
return symlink (n1, n2);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ local_write (void *data, const char *buf, int nbyte)
|
|||
}
|
||||
|
||||
static int
|
||||
local_rename (struct vfs_class *me, char *a, char *b)
|
||||
local_rename (struct vfs_class *me, const char *a, const char *b)
|
||||
{
|
||||
return rename (a, b);
|
||||
}
|
||||
|
@ -207,25 +207,25 @@ local_lseek (void *data, off_t offset, int whence)
|
|||
}
|
||||
|
||||
static int
|
||||
local_mknod (struct vfs_class *me, char *path, int mode, int dev)
|
||||
local_mknod (struct vfs_class *me, const char *path, int mode, int dev)
|
||||
{
|
||||
return mknod (path, mode, dev);
|
||||
}
|
||||
|
||||
static int
|
||||
local_link (struct vfs_class *me, char *p1, char *p2)
|
||||
local_link (struct vfs_class *me, const char *p1, const char *p2)
|
||||
{
|
||||
return link (p1, p2);
|
||||
}
|
||||
|
||||
static int
|
||||
local_mkdir (struct vfs_class *me, char *path, mode_t mode)
|
||||
local_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
||||
{
|
||||
return mkdir (path, mode);
|
||||
}
|
||||
|
||||
static int
|
||||
local_rmdir (struct vfs_class *me, char *path)
|
||||
local_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return rmdir (path);
|
||||
}
|
||||
|
|
24
vfs/mcfs.c
24
vfs/mcfs.c
|
@ -422,7 +422,7 @@ mcfs_handle_simple_error (int sock, int return_status)
|
|||
|
||||
/* Nice wrappers */
|
||||
static int
|
||||
mcfs_rpc_two_paths (int command, char *s1, char *s2)
|
||||
mcfs_rpc_two_paths (int command, const char *s1, const char *s2)
|
||||
{
|
||||
mcfs_connection *mc;
|
||||
char *r1, *r2;
|
||||
|
@ -443,7 +443,7 @@ mcfs_rpc_two_paths (int command, char *s1, char *s2)
|
|||
}
|
||||
|
||||
static int
|
||||
mcfs_rpc_path (int command, char *path)
|
||||
mcfs_rpc_path (int command, const char *path)
|
||||
{
|
||||
mcfs_connection *mc;
|
||||
char *remote_file;
|
||||
|
@ -963,7 +963,7 @@ mcfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
|||
}
|
||||
|
||||
static int
|
||||
mcfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
mcfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
{
|
||||
char *remote_file, *stat_str;
|
||||
int status, error;
|
||||
|
@ -993,19 +993,19 @@ mcfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
|||
}
|
||||
|
||||
static int
|
||||
mcfs_unlink (struct vfs_class *me, char *path)
|
||||
mcfs_unlink (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return mcfs_rpc_path (MC_UNLINK, path);
|
||||
}
|
||||
|
||||
static int
|
||||
mcfs_symlink (struct vfs_class *me, char *n1, char *n2)
|
||||
mcfs_symlink (struct vfs_class *me, const char *n1, const char *n2)
|
||||
{
|
||||
return mcfs_rpc_two_paths (MC_SYMLINK, n1, n2);
|
||||
}
|
||||
|
||||
static int
|
||||
mcfs_rename (struct vfs_class *me, char *a, char *b)
|
||||
mcfs_rename (struct vfs_class *me, const char *a, const char *b)
|
||||
{
|
||||
return mcfs_rpc_two_paths (MC_RENAME, a, b);
|
||||
}
|
||||
|
@ -1048,25 +1048,25 @@ mcfs_lseek (void *data, off_t offset, int whence)
|
|||
}
|
||||
|
||||
static int
|
||||
mcfs_mknod (struct vfs_class *me, char *path, int mode, int dev)
|
||||
mcfs_mknod (struct vfs_class *me, const char *path, int mode, int dev)
|
||||
{
|
||||
return mcfs_rpc_path_int_int (MC_MKNOD, path, mode, dev);
|
||||
}
|
||||
|
||||
static int
|
||||
mcfs_mkdir (struct vfs_class *me, char *path, mode_t mode)
|
||||
mcfs_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
||||
{
|
||||
return mcfs_rpc_path_int (MC_MKDIR, path, mode);
|
||||
}
|
||||
|
||||
static int
|
||||
mcfs_rmdir (struct vfs_class *me, char *path)
|
||||
mcfs_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
return mcfs_rpc_path (MC_RMDIR, path);
|
||||
}
|
||||
|
||||
static int
|
||||
mcfs_link (struct vfs_class *me, char *p1, char *p2)
|
||||
mcfs_link (struct vfs_class *me, const char *p1, const char *p2)
|
||||
{
|
||||
return mcfs_rpc_two_paths (MC_LINK, p1, p2);
|
||||
}
|
||||
|
@ -1075,7 +1075,7 @@ mcfs_link (struct vfs_class *me, char *p1, char *p2)
|
|||
* now
|
||||
*/
|
||||
static void
|
||||
mcfs_forget (char *path)
|
||||
mcfs_forget (const char *path)
|
||||
{
|
||||
char *host, *user, *pass, *p;
|
||||
int port, i, vers;
|
||||
|
@ -1117,7 +1117,7 @@ mcfs_forget (char *path)
|
|||
}
|
||||
|
||||
static int
|
||||
mcfs_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
mcfs_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
{
|
||||
switch (ctlop) {
|
||||
case VFS_SETCTL_FORGET:
|
||||
|
|
|
@ -234,7 +234,7 @@ static int sfs_utime (struct vfs_class *me, const char *path, struct utimbuf *ti
|
|||
return utime (path, times);
|
||||
}
|
||||
|
||||
static int sfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
static int sfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
{
|
||||
path = sfs_redirect (me, path);
|
||||
return readlink (path, buf, size);
|
||||
|
|
42
vfs/smbfs.c
42
vfs/smbfs.c
|
@ -849,7 +849,7 @@ smbfs_utime (struct vfs_class *me, const char *path, struct utimbuf *times)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
||||
smbfs_readlink (struct vfs_class *me, const char *path, char *buf, int size)
|
||||
{
|
||||
DEBUG(3, ("smbfs_readlink(path:%s, buf:%s, size:%d)\n", path, buf, size));
|
||||
my_errno = EOPNOTSUPP;
|
||||
|
@ -857,7 +857,7 @@ smbfs_readlink (struct vfs_class *me, char *path, char *buf, int size)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_symlink (struct vfs_class *me, char *n1, char *n2)
|
||||
smbfs_symlink (struct vfs_class *me, const char *n1, const char *n2)
|
||||
{
|
||||
DEBUG(3, ("smbfs_symlink(n1:%s, n2:%s)\n", n1, n2));
|
||||
my_errno = EOPNOTSUPP;
|
||||
|
@ -1608,7 +1608,7 @@ smbfs_lseek (void *data, off_t offset, int whence)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_mknod (struct vfs_class *me, char *path, int mode, int dev)
|
||||
smbfs_mknod (struct vfs_class *me, const char *path, int mode, int dev)
|
||||
{
|
||||
DEBUG(3, ("smbfs_mknod(path:%s, mode:%d, dev:%d)\n", path, mode, dev));
|
||||
my_errno = EOPNOTSUPP;
|
||||
|
@ -1616,54 +1616,56 @@ smbfs_mknod (struct vfs_class *me, char *path, int mode, int dev)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_mkdir (struct vfs_class * me, char *path, mode_t mode)
|
||||
smbfs_mkdir (struct vfs_class * me, const char *path, mode_t mode)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
char *remote_file;
|
||||
char *cpath = g_strdup(path);
|
||||
|
||||
DEBUG (3, ("smbfs_mkdir(path:%s, mode:%d)\n", path, (int) mode));
|
||||
if ((remote_file = smbfs_get_path (&sc, path)) == 0)
|
||||
return -1;
|
||||
g_free (remote_file);
|
||||
smbfs_convert_path (&path, FALSE);
|
||||
smbfs_convert_path (&cpath, FALSE);
|
||||
|
||||
if (!cli_mkdir (sc->cli, path)) {
|
||||
if (!cli_mkdir (sc->cli, cpath)) {
|
||||
my_errno = cli_error (sc->cli, NULL, &err, NULL);
|
||||
message (1, MSG_ERROR, _(" Error %s creating directory %s "),
|
||||
cli_errstr (sc->cli), CNV_LANG (path));
|
||||
g_free (path);
|
||||
cli_errstr (sc->cli), CNV_LANG (cpath));
|
||||
g_free (cpath);
|
||||
return -1;
|
||||
}
|
||||
g_free (path);
|
||||
g_free (cpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
smbfs_rmdir (struct vfs_class *me, char *path)
|
||||
smbfs_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
char *remote_file;
|
||||
char *cpath = g_strdup(path);
|
||||
|
||||
DEBUG(3, ("smbfs_rmdir(path:%s)\n", path));
|
||||
if ((remote_file = smbfs_get_path (&sc, path)) == 0)
|
||||
return -1;
|
||||
g_free (remote_file);
|
||||
smbfs_convert_path(&path, FALSE);
|
||||
smbfs_convert_path(&cpath, FALSE);
|
||||
|
||||
if (!cli_rmdir(sc->cli, path)) {
|
||||
if (!cli_rmdir(sc->cli, cpath)) {
|
||||
my_errno = cli_error(sc->cli, NULL, &err, NULL);
|
||||
message (1, MSG_ERROR, _(" Error %s removing directory %s "),
|
||||
cli_errstr(sc->cli), CNV_LANG(path));
|
||||
g_free (path);
|
||||
cli_errstr(sc->cli), CNV_LANG(cpath));
|
||||
g_free (cpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
g_free (cpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
smbfs_link (struct vfs_class *me, char *p1, char *p2)
|
||||
smbfs_link (struct vfs_class *me, const char *p1, const char *p2)
|
||||
{
|
||||
DEBUG (3, ("smbfs_link(p1:%s, p2:%s)\n", p1, p2));
|
||||
my_errno = EOPNOTSUPP;
|
||||
|
@ -1681,7 +1683,7 @@ smbfs_free (vfsid id)
|
|||
* now
|
||||
*/
|
||||
static void
|
||||
smbfs_forget (char *path)
|
||||
smbfs_forget (const char *path)
|
||||
{
|
||||
char *host, *user, *p;
|
||||
int port, i;
|
||||
|
@ -1716,7 +1718,7 @@ smbfs_forget (char *path)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_setctl (struct vfs_class *me, char *path, int ctlop, void *arg)
|
||||
smbfs_setctl (struct vfs_class *me, const char *path, int ctlop, void *arg)
|
||||
{
|
||||
DEBUG (3, ("smbfs_setctl(path:%s, ctlop:%d)\n", path, ctlop));
|
||||
switch (ctlop) {
|
||||
|
@ -1801,7 +1803,7 @@ smbfs_open (struct vfs_class *me, const char *file, int flags, int mode)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_unlink (struct vfs_class *me, char *path)
|
||||
smbfs_unlink (struct vfs_class *me, const char *path)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
char *remote_file, *p;
|
||||
|
@ -1824,7 +1826,7 @@ smbfs_unlink (struct vfs_class *me, char *path)
|
|||
}
|
||||
|
||||
static int
|
||||
smbfs_rename (struct vfs_class *me, char *a, char *b)
|
||||
smbfs_rename (struct vfs_class *me, const char *a, const char *b)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
char *ra, *rb;
|
||||
|
|
18
vfs/vfs.h
18
vfs/vfs.h
|
@ -48,16 +48,16 @@ struct vfs_class {
|
|||
int (*utime) (struct vfs_class *me, const char *path,
|
||||
struct utimbuf * times);
|
||||
|
||||
int (*readlink) (struct vfs_class *me, /*FIXME:const*/ char *path, char *buf,
|
||||
int (*readlink) (struct vfs_class *me, const char *path, char *buf,
|
||||
int size);
|
||||
int (*symlink) (struct vfs_class *me, /*FIXME:const*/ char *n1, /*FIXME:const*/ char *n2);
|
||||
int (*link) (struct vfs_class *me, /*FIXME:const*/ char *p1, /*FIXME:const*/ char *p2);
|
||||
int (*unlink) (struct vfs_class *me, /*FIXME:const*/ char *path);
|
||||
int (*rename) (struct vfs_class *me, /*FIXME:const*/ char *p1, /*FIXME:const*/ char *p2);
|
||||
int (*symlink) (struct vfs_class *me, const char *n1, const char *n2);
|
||||
int (*link) (struct vfs_class *me, const char *p1, const char *p2);
|
||||
int (*unlink) (struct vfs_class *me, const char *path);
|
||||
int (*rename) (struct vfs_class *me, const char *p1, const char *p2);
|
||||
int (*chdir) (struct vfs_class *me, const char *path);
|
||||
int (*ferrno) (struct vfs_class *me);
|
||||
int (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||
int (*mknod) (struct vfs_class *me, /*FIXME:const*/ char *path, int mode, int dev);
|
||||
int (*mknod) (struct vfs_class *me, const char *path, int mode, int dev);
|
||||
|
||||
vfsid (*getid) (struct vfs_class *me, const char *path);
|
||||
|
||||
|
@ -68,11 +68,11 @@ struct vfs_class {
|
|||
int (*ungetlocalcopy) (struct vfs_class *me, const char *filename,
|
||||
const char *local, int has_changed);
|
||||
|
||||
int (*mkdir) (struct vfs_class *me, /*FIXME:const*/ char *path, mode_t mode);
|
||||
int (*rmdir) (struct vfs_class *me, /*FIXME:const*/ char *path);
|
||||
int (*mkdir) (struct vfs_class *me, const char *path, mode_t mode);
|
||||
int (*rmdir) (struct vfs_class *me, const char *path);
|
||||
|
||||
int (*ctl) (void *vfs_info, int ctlop, void *arg);
|
||||
int (*setctl) (struct vfs_class *me, /*FIXME:const*/ char *path, int ctlop,
|
||||
int (*setctl) (struct vfs_class *me, const char *path, int ctlop,
|
||||
void *arg);
|
||||
#ifdef HAVE_MMAP
|
||||
caddr_t (*mmap) (struct vfs_class *me, caddr_t addr, size_t len,
|
||||
|
|
Loading…
Reference in New Issue