mirror of https://github.com/MidnightCommander/mc
Following prototypes of functions was changed in VFS-module API:
* readlink * symlink * rename * link * unlink * mknod Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
1406eb5035
commit
d67da5dfa8
|
@ -565,20 +565,29 @@ vfs_s_fstat (void *fh, struct stat *buf)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
vfs_s_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
vfs_s_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
size_t len;
|
||||
vfs_path_element_t *path_element;
|
||||
|
||||
ino = vfs_s_inode_from_path (me, path, 0);
|
||||
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
|
||||
ino = vfs_s_inode_from_path (path_element->class, vpath->unparsed, 0);
|
||||
if (!ino)
|
||||
return -1;
|
||||
|
||||
if (!S_ISLNK (ino->st.st_mode))
|
||||
ERRNOR (EINVAL, -1);
|
||||
{
|
||||
path_element->class->verrno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ino->linkname == NULL)
|
||||
ERRNOR (EFAULT, -1);
|
||||
{
|
||||
path_element->class->verrno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strlen (ino->linkname);
|
||||
if (size < len)
|
||||
|
|
|
@ -258,11 +258,11 @@ int mc_##name inarg \
|
|||
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vpath, mode))
|
||||
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vpath, owner, group))
|
||||
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vpath, times))
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (path_element->class, vpath->unparsed, buf, bufsiz))
|
||||
MC_NAMEOP (unlink, (const char *path), (path_element->class, vpath->unparsed))
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vpath, buf, bufsiz))
|
||||
MC_NAMEOP (unlink, (const char *path), (vpath))
|
||||
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (path_element->class, vpath->unparsed, mode))
|
||||
MC_NAMEOP (rmdir, (const char *path), (path_element->class, vpath->unparsed))
|
||||
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (path_element->class, vpath->unparsed, mode, dev))
|
||||
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vpath, mode, dev))
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
|
@ -272,37 +272,32 @@ int
|
|||
mc_symlink (const char *name1, const char *path)
|
||||
{
|
||||
int result = -1;
|
||||
vfs_path_t *vpath;
|
||||
vfs_path_element_t *path_element;
|
||||
char *lpath;
|
||||
char *tmp;
|
||||
vfs_path_t *vpath1, *vpath2;
|
||||
|
||||
vpath = vfs_path_from_str (path);
|
||||
if (vpath == NULL)
|
||||
vpath1 = vfs_path_from_str (path);
|
||||
if (vpath1 == NULL)
|
||||
return -1;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
if (path_element == NULL)
|
||||
{
|
||||
vfs_path_free (vpath);
|
||||
return -1;
|
||||
}
|
||||
vpath2 = vfs_path_from_str (name1);
|
||||
|
||||
tmp = g_strdup (name1);
|
||||
lpath = vfs_translate_path_n (tmp);
|
||||
g_free (tmp);
|
||||
|
||||
if (lpath != NULL)
|
||||
if (vpath2 != NULL)
|
||||
{
|
||||
result =
|
||||
path_element->class->symlink !=
|
||||
NULL ? path_element->class->symlink (path_element->class, lpath, vpath->unparsed) : -1;
|
||||
if (result == -1)
|
||||
errno =
|
||||
path_element->class->symlink != NULL ? vfs_ferrno (path_element->class) : E_NOTSUPP;
|
||||
vfs_path_element_t *path_element =
|
||||
vfs_path_get_by_index (vpath1, vfs_path_length (vpath1) - 1);
|
||||
if (path_element != NULL)
|
||||
{
|
||||
result =
|
||||
path_element->class->symlink !=
|
||||
NULL ? path_element->class->symlink (vpath2, vpath1) : -1;
|
||||
|
||||
if (result == -1)
|
||||
errno =
|
||||
path_element->class->symlink !=
|
||||
NULL ? vfs_ferrno (path_element->class) : E_NOTSUPP;
|
||||
}
|
||||
}
|
||||
g_free (lpath);
|
||||
vfs_path_free (vpath);
|
||||
vfs_path_free (vpath1);
|
||||
vfs_path_free (vpath2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -360,7 +355,7 @@ int mc_##name (const char *fname1, const char *fname2) \
|
|||
}\
|
||||
\
|
||||
result = path_element1->class->name != NULL \
|
||||
? path_element1->class->name (path_element1->class, vpath1->unparsed, vpath2->unparsed) \
|
||||
? path_element1->class->name (vpath1, vpath2) \
|
||||
: -1; \
|
||||
if (result == -1) \
|
||||
errno = path_element1->class->name != NULL ? vfs_ferrno (path_element1->class) : E_NOTSUPP; \
|
||||
|
|
|
@ -168,15 +168,15 @@ typedef struct vfs_class
|
|||
int (*chown) (const vfs_path_t * vpath, uid_t owner, gid_t group);
|
||||
int (*utime) (const vfs_path_t * vpath, struct utimbuf * times);
|
||||
|
||||
int (*readlink) (struct vfs_class * me, const char *path, char *buf, size_t size);
|
||||
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 (*readlink) (const vfs_path_t * vpath, char *buf, size_t size);
|
||||
int (*symlink) (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int (*link) (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int (*unlink) (const vfs_path_t * vpath);
|
||||
int (*rename) (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int (*chdir) (const vfs_path_t * vpath);
|
||||
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, mode_t mode, dev_t dev);
|
||||
int (*mknod) (const vfs_path_t * vpath, mode_t mode, dev_t dev);
|
||||
|
||||
vfsid (*getid) (struct vfs_class * me, const char *path);
|
||||
|
||||
|
|
|
@ -1136,17 +1136,20 @@ extfs_fstat (void *data, struct stat *buf)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
extfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
extfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q, *mpath;
|
||||
size_t len;
|
||||
struct entry *entry;
|
||||
int result = -1;
|
||||
vfs_path_element_t *path_element;
|
||||
|
||||
mpath = g_strdup (path);
|
||||
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
|
||||
q = extfs_get_path_mangle (me, mpath, &archive, FALSE);
|
||||
mpath = g_strdup (vpath->unparsed);
|
||||
|
||||
q = extfs_get_path_mangle (path_element->class, mpath, &archive, FALSE);
|
||||
if (q == NULL)
|
||||
goto cleanup;
|
||||
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
||||
|
@ -1154,7 +1157,7 @@ extfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
|||
goto cleanup;
|
||||
if (!S_ISLNK (entry->inode->mode))
|
||||
{
|
||||
me->verrno = EINVAL;
|
||||
path_element->class->verrno = EINVAL;
|
||||
goto cleanup;
|
||||
}
|
||||
len = strlen (entry->inode->linkname);
|
||||
|
@ -1203,16 +1206,17 @@ extfs_write (void *data, const char *buf, size_t nbyte)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
extfs_unlink (struct vfs_class *me, const char *file)
|
||||
extfs_unlink (const vfs_path_t * vpath)
|
||||
{
|
||||
struct archive *archive;
|
||||
char *q, *mpath;
|
||||
struct entry *entry;
|
||||
int result = -1;
|
||||
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
|
||||
mpath = g_strdup (file);
|
||||
mpath = g_strdup (vpath->unparsed);
|
||||
|
||||
q = extfs_get_path_mangle (me, mpath, &archive, FALSE);
|
||||
q = extfs_get_path_mangle (path_element->class, mpath, &archive, FALSE);
|
||||
if (q == NULL)
|
||||
goto cleanup;
|
||||
entry = extfs_find_entry (archive->root_entry, q, FALSE, FALSE);
|
||||
|
@ -1223,7 +1227,7 @@ extfs_unlink (struct vfs_class *me, const char *file)
|
|||
goto cleanup;
|
||||
if (S_ISDIR (entry->inode->mode))
|
||||
{
|
||||
me->verrno = EISDIR;
|
||||
path_element->class->verrno = EISDIR;
|
||||
goto cleanup;
|
||||
}
|
||||
if (extfs_cmd (" rm ", archive, entry, ""))
|
||||
|
|
|
@ -1150,23 +1150,24 @@ fish_send_command (struct vfs_class *me, struct vfs_s_super *super, const char *
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
fish_rename (struct vfs_class *me, const char *path1, const char *path2)
|
||||
fish_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
char buf[BUF_LARGE];
|
||||
const char *crpath1, *crpath2;
|
||||
char *rpath1, *rpath2, *mpath1, *mpath2;
|
||||
struct vfs_s_super *super, *super2;
|
||||
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath1, vfs_path_length (vpath1) - 1);
|
||||
|
||||
mpath1 = g_strdup (path1);
|
||||
crpath1 = vfs_s_get_path_mangle (me, mpath1, &super, 0);
|
||||
mpath1 = g_strdup (vpath1->unparsed);
|
||||
crpath1 = vfs_s_get_path_mangle (path_element->class, mpath1, &super, 0);
|
||||
if (crpath1 == NULL)
|
||||
{
|
||||
g_free (mpath1);
|
||||
return -1;
|
||||
}
|
||||
mpath2 = g_strdup (path2);
|
||||
crpath2 = vfs_s_get_path_mangle (me, mpath2, &super2, 0);
|
||||
mpath2 = g_strdup (vpath2->unparsed);
|
||||
crpath2 = vfs_s_get_path_mangle (path_element->class, mpath2, &super2, 0);
|
||||
if (crpath2 == NULL)
|
||||
{
|
||||
g_free (mpath1);
|
||||
|
@ -1183,29 +1184,33 @@ fish_rename (struct vfs_class *me, const char *path1, const char *path2)
|
|||
g_free (shell_commands);
|
||||
g_free (rpath1);
|
||||
g_free (rpath2);
|
||||
return fish_send_command (me, super2, buf, OPT_FLUSH);
|
||||
return fish_send_command (path_element->class, super2, buf, OPT_FLUSH);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
fish_link (struct vfs_class *me, const char *path1, const char *path2)
|
||||
fish_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
char buf[BUF_LARGE];
|
||||
const char *crpath1, *crpath2;
|
||||
char *rpath1, *rpath2, *mpath1, *mpath2;
|
||||
struct vfs_s_super *super, *super2;
|
||||
vfs_path_element_t *path_element;
|
||||
|
||||
mpath1 = g_strdup (path1);
|
||||
crpath1 = vfs_s_get_path_mangle (me, mpath1, &super, 0);
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath1, vfs_path_length (vpath1) - 1);
|
||||
|
||||
mpath1 = g_strdup (vpath1->unparsed);
|
||||
crpath1 = vfs_s_get_path_mangle (path_element->class, mpath1, &super, 0);
|
||||
if (crpath1 == NULL)
|
||||
{
|
||||
g_free (mpath1);
|
||||
return -1;
|
||||
}
|
||||
mpath2 = g_strdup (path2);
|
||||
crpath2 = vfs_s_get_path_mangle (me, mpath2, &super2, 0);
|
||||
mpath2 = g_strdup (vpath2->unparsed);
|
||||
crpath2 = vfs_s_get_path_mangle (path_element->class, mpath2, &super2, 0);
|
||||
if (crpath2 == NULL)
|
||||
{
|
||||
g_free (mpath1);
|
||||
|
@ -1222,14 +1227,14 @@ fish_link (struct vfs_class *me, const char *path1, const char *path2)
|
|||
g_free (shell_commands);
|
||||
g_free (rpath1);
|
||||
g_free (rpath2);
|
||||
return fish_send_command (me, super2, buf, OPT_FLUSH);
|
||||
return fish_send_command (path_element->class, super2, buf, OPT_FLUSH);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
fish_symlink (struct vfs_class *me, const char *setto, const char *path)
|
||||
fish_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
char *qsetto;
|
||||
gchar *shell_commands = NULL;
|
||||
|
@ -1237,9 +1242,10 @@ fish_symlink (struct vfs_class *me, const char *setto, const char *path)
|
|||
const char *crpath;
|
||||
char *rpath, *mpath;
|
||||
struct vfs_s_super *super;
|
||||
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath1, vfs_path_length (vpath1) - 1);
|
||||
|
||||
mpath = g_strdup (path);
|
||||
crpath = vfs_s_get_path_mangle (me, mpath, &super, 0);
|
||||
mpath = g_strdup (vpath2->unparsed);
|
||||
crpath = vfs_s_get_path_mangle (path_element->class, mpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
{
|
||||
g_free (mpath);
|
||||
|
@ -1248,14 +1254,14 @@ fish_symlink (struct vfs_class *me, const char *setto, const char *path)
|
|||
rpath = strutils_shell_escape (crpath);
|
||||
g_free (mpath);
|
||||
|
||||
qsetto = strutils_shell_escape (setto);
|
||||
qsetto = strutils_shell_escape (vpath1->unparsed);
|
||||
shell_commands = g_strconcat (SUP->scr_env, "FISH_FILEFROM=%s FISH_FILETO=%s;\n",
|
||||
SUP->scr_ln, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, qsetto, rpath);
|
||||
g_free (shell_commands);
|
||||
g_free (qsetto);
|
||||
g_free (rpath);
|
||||
return fish_send_command (me, super, buf, OPT_FLUSH);
|
||||
return fish_send_command (path_element->class, super, buf, OPT_FLUSH);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -1347,18 +1353,33 @@ fish_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
fish_unlink (struct vfs_class *me, const char *path)
|
||||
fish_unlink (const vfs_path_t * vpath)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
|
||||
PREFIX;
|
||||
char buf[BUF_LARGE];
|
||||
const char *crpath;
|
||||
char *rpath, *mpath;
|
||||
struct vfs_s_super *super;
|
||||
vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
mpath = g_strdup (vpath->unparsed);
|
||||
crpath = vfs_s_get_path_mangle (path_element->class, mpath, &super, 0);
|
||||
if (crpath == NULL)
|
||||
{
|
||||
g_free (mpath);
|
||||
return -1;
|
||||
}
|
||||
rpath = strutils_shell_escape (crpath);
|
||||
g_free (mpath);
|
||||
|
||||
shell_commands =
|
||||
g_strconcat (SUP->scr_env, "FISH_FILENAME=%s;\n", SUP->scr_unlink, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||
g_free (shell_commands);
|
||||
g_free (rpath);
|
||||
return fish_send_command (me, super, buf, OPT_FLUSH);
|
||||
return fish_send_command (path_element->class, super, buf, OPT_FLUSH);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -2014,9 +2014,12 @@ ftpfs_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
ftpfs_unlink (struct vfs_class *me, const char *path)
|
||||
ftpfs_unlink (const vfs_path_t * vpath)
|
||||
{
|
||||
return ftpfs_send_command (me, path, "DELE /%s", OPT_FLUSH);
|
||||
vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
return ftpfs_send_command (path_element->class, vpath->unparsed, "DELE /%s", OPT_FLUSH);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -2061,10 +2064,13 @@ ftpfs_chdir_internal (struct vfs_class *me, struct vfs_s_super *super, const cha
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
ftpfs_rename (struct vfs_class *me, const char *path1, const char *path2)
|
||||
ftpfs_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
ftpfs_send_command (me, path1, "RNFR /%s", OPT_FLUSH);
|
||||
return ftpfs_send_command (me, path2, "RNTO /%s", OPT_FLUSH);
|
||||
vfs_path_element_t *path_element;
|
||||
|
||||
path_element = vfs_path_get_by_index (vpath1, vfs_path_length (vpath1) - 1);
|
||||
ftpfs_send_command (path_element->class, vpath1->unparsed, "RNFR /%s", OPT_FLUSH);
|
||||
return ftpfs_send_command (path_element->class, vpath2->unparsed, "RNTO /%s", OPT_FLUSH);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -159,31 +159,25 @@ local_utime (const vfs_path_t * vpath, struct utimbuf *times)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
local_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
return readlink (path, buf, size);
|
||||
return readlink (vpath->unparsed, buf, size);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_unlink (struct vfs_class *me, const char *path)
|
||||
local_unlink (const vfs_path_t * vpath)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
return unlink (path);
|
||||
return unlink (vpath->unparsed);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_symlink (struct vfs_class *me, const char *n1, const char *n2)
|
||||
local_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
return symlink (n1, n2);
|
||||
return symlink (vpath1->unparsed, vpath2->unparsed);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -216,11 +210,9 @@ local_write (void *data, const char *buf, size_t nbyte)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_rename (struct vfs_class *me, const char *a, const char *b)
|
||||
local_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
return rename (a, b);
|
||||
return rename (vpath1->unparsed, vpath2->unparsed);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -234,21 +226,17 @@ local_chdir (const vfs_path_t * vpath)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_mknod (struct vfs_class *me, const char *path, mode_t mode, dev_t dev)
|
||||
local_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
return mknod (path, mode, dev);
|
||||
return mknod (vpath->unparsed, mode, dev);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_link (struct vfs_class *me, const char *p1, const char *p2)
|
||||
local_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
return link (p1, p2);
|
||||
return link (vpath1->unparsed, vpath2->unparsed);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -344,9 +344,11 @@ sfs_utime (const vfs_path_t * vpath, struct utimbuf *times)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
sfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
sfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
||||
{
|
||||
path = sfs_redirect (me, path);
|
||||
const char *path;
|
||||
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, vfs_path_length (vpath) - 1);
|
||||
path = sfs_redirect (path_element->class, vpath->unparsed);
|
||||
return readlink (path, buf, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -997,11 +997,9 @@ smbfs_utime (const vfs_path_t * vpath, struct utimbuf *times)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
||||
smbfs_readlink (const vfs_path_t * vpath, char *buf, size_t size)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
DEBUG (3, ("smbfs_readlink(path:%s, buf:%s, size:%zu)\n", path, buf, size));
|
||||
DEBUG (3, ("smbfs_readlink(path:%s, buf:%s, size:%zu)\n", vpath->unparsed, buf, size));
|
||||
my_errno = EOPNOTSUPP;
|
||||
return -1; /* no symlinks on smb filesystem? */
|
||||
}
|
||||
|
@ -1009,11 +1007,9 @@ smbfs_readlink (struct vfs_class *me, const char *path, char *buf, size_t size)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_symlink (struct vfs_class *me, const char *n1, const char *n2)
|
||||
smbfs_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
DEBUG (3, ("smbfs_symlink(n1:%s, n2:%s)\n", n1, n2));
|
||||
DEBUG (3, ("smbfs_symlink(n1:%s, n2:%s)\n", vpath1->unparsed, vpath2->unparsed));
|
||||
my_errno = EOPNOTSUPP;
|
||||
return -1; /* no symlinks on smb filesystem? */
|
||||
}
|
||||
|
@ -1835,11 +1831,10 @@ smbfs_lseek (void *data, off_t offset, int whence)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_mknod (struct vfs_class *me, const char *path, mode_t mode, dev_t dev)
|
||||
smbfs_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
DEBUG (3, ("smbfs_mknod(path:%s, mode:%d, dev:%u)\n", path, mode, (unsigned int) dev));
|
||||
DEBUG (3,
|
||||
("smbfs_mknod(path:%s, mode:%d, dev:%u)\n", vpath->unparsed, mode, (unsigned int) dev));
|
||||
my_errno = EOPNOTSUPP;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1906,11 +1901,9 @@ smbfs_rmdir (struct vfs_class *me, const char *path)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_link (struct vfs_class *me, const char *p1, const char *p2)
|
||||
smbfs_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
DEBUG (3, ("smbfs_link(p1:%s, p2:%s)\n", p1, p2));
|
||||
DEBUG (3, ("smbfs_link(p1:%s, p2:%s)\n", vpath1->unparsed, vpath2->unparsed));
|
||||
my_errno = EOPNOTSUPP;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2075,14 +2068,12 @@ smbfs_open (const vfs_path_t * vpath, int flags, mode_t mode)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_unlink (struct vfs_class *me, const char *path)
|
||||
smbfs_unlink (const vfs_path_t * vpath)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
char *remote_file;
|
||||
|
||||
(void) me;
|
||||
|
||||
if ((remote_file = smbfs_get_path (&sc, path)) == 0)
|
||||
if ((remote_file = smbfs_get_path (&sc, vpath->unparsed)) == 0)
|
||||
return -1;
|
||||
|
||||
remote_file = free_after (smbfs_convert_path (remote_file, FALSE), remote_file);
|
||||
|
@ -2101,18 +2092,16 @@ smbfs_unlink (struct vfs_class *me, const char *path)
|
|||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_rename (struct vfs_class *me, const char *a, const char *b)
|
||||
smbfs_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
char *ra, *rb;
|
||||
int retval;
|
||||
|
||||
(void) me;
|
||||
|
||||
if ((ra = smbfs_get_path (&sc, a)) == 0)
|
||||
if ((ra = smbfs_get_path (&sc, vpath1->unparsed)) == 0)
|
||||
return -1;
|
||||
|
||||
if ((rb = smbfs_get_path (&sc, b)) == 0)
|
||||
if ((rb = smbfs_get_path (&sc, vpath2->unparsed)) == 0)
|
||||
{
|
||||
g_free (ra);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue