VFS-plugins: remove usage of vpath->unparsed from 'local' plugin

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2011-04-30 22:48:32 +03:00
parent 7745006b60
commit c6796f790d

View File

@ -63,8 +63,9 @@ local_open (const vfs_path_t * vpath, int flags, mode_t mode)
{
int *local_info;
int fd;
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
fd = open (vpath->unparsed, NO_LINEAR (flags), mode);
fd = open (path_element->path, NO_LINEAR (flags), mode);
if (fd == -1)
return 0;
@ -81,8 +82,9 @@ local_opendir (const vfs_path_t * vpath)
{
DIR **local_info;
DIR *dir;
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
dir = opendir (vpath->unparsed);
dir = opendir (path_element->path);
if (!dir)
return 0;
@ -117,7 +119,9 @@ local_closedir (void *data)
static int
local_stat (const vfs_path_t * vpath, struct stat *buf)
{
return stat (vpath->unparsed, buf);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return stat (path_element->path, buf);
}
/* --------------------------------------------------------------------------------------------- */
@ -125,10 +129,12 @@ local_stat (const vfs_path_t * vpath, struct stat *buf)
static int
local_lstat (const vfs_path_t * vpath, struct stat *buf)
{
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
#ifndef HAVE_STATLSTAT
return lstat (vpath->unparsed, buf);
return lstat (path_element->path, buf);
#else
return statlstat (vpath->unparsed, buf);
return statlstat (path_element->path, buf);
#endif
}
@ -137,7 +143,9 @@ local_lstat (const vfs_path_t * vpath, struct stat *buf)
static int
local_chmod (const vfs_path_t * vpath, int mode)
{
return chmod (vpath->unparsed, mode);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return chmod (path_element->path, mode);
}
/* --------------------------------------------------------------------------------------------- */
@ -145,7 +153,9 @@ local_chmod (const vfs_path_t * vpath, int mode)
static int
local_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
{
return chown (vpath->unparsed, owner, group);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return chown (path_element->path, owner, group);
}
/* --------------------------------------------------------------------------------------------- */
@ -153,7 +163,9 @@ local_chown (const vfs_path_t * vpath, uid_t owner, gid_t group)
static int
local_utime (const vfs_path_t * vpath, struct utimbuf *times)
{
return utime (vpath->unparsed, times);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return utime (path_element->path, times);
}
/* --------------------------------------------------------------------------------------------- */
@ -161,7 +173,9 @@ local_utime (const vfs_path_t * vpath, struct utimbuf *times)
static int
local_readlink (const vfs_path_t * vpath, char *buf, size_t size)
{
return readlink (vpath->unparsed, buf, size);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return readlink (path_element->path, buf, size);
}
/* --------------------------------------------------------------------------------------------- */
@ -169,7 +183,9 @@ local_readlink (const vfs_path_t * vpath, char *buf, size_t size)
static int
local_unlink (const vfs_path_t * vpath)
{
return unlink (vpath->unparsed);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return unlink (path_element->path);
}
/* --------------------------------------------------------------------------------------------- */
@ -177,7 +193,10 @@ local_unlink (const vfs_path_t * vpath)
static int
local_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
return symlink (vpath1->unparsed, vpath2->unparsed);
vfs_path_element_t *path_element1 = vfs_path_get_by_index (vpath1, -1);
vfs_path_element_t *path_element2 = vfs_path_get_by_index (vpath2, -1);
return symlink (path_element1->path, path_element2->path);
}
/* --------------------------------------------------------------------------------------------- */
@ -212,7 +231,10 @@ local_write (void *data, const char *buf, size_t nbyte)
static int
local_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
return rename (vpath1->unparsed, vpath2->unparsed);
vfs_path_element_t *path_element1 = vfs_path_get_by_index (vpath1, -1);
vfs_path_element_t *path_element2 = vfs_path_get_by_index (vpath2, -1);
return rename (path_element1->path, path_element2->path);
}
/* --------------------------------------------------------------------------------------------- */
@ -220,7 +242,9 @@ local_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
static int
local_chdir (const vfs_path_t * vpath)
{
return chdir (vpath->unparsed);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return chdir (path_element->path);
}
/* --------------------------------------------------------------------------------------------- */
@ -228,7 +252,9 @@ local_chdir (const vfs_path_t * vpath)
static int
local_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev)
{
return mknod (vpath->unparsed, mode, dev);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return mknod (path_element->path, mode, dev);
}
/* --------------------------------------------------------------------------------------------- */
@ -236,7 +262,10 @@ local_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev)
static int
local_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
{
return link (vpath1->unparsed, vpath2->unparsed);
vfs_path_element_t *path_element1 = vfs_path_get_by_index (vpath1, -1);
vfs_path_element_t *path_element2 = vfs_path_get_by_index (vpath2, -1);
return link (path_element1->path, path_element2->path);
}
/* --------------------------------------------------------------------------------------------- */
@ -244,7 +273,9 @@ local_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
static int
local_mkdir (const vfs_path_t * vpath, mode_t mode)
{
return mkdir (vpath->unparsed, mode);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return mkdir (path_element->path, mode);
}
/* --------------------------------------------------------------------------------------------- */
@ -252,7 +283,9 @@ local_mkdir (const vfs_path_t * vpath, mode_t mode)
static int
local_rmdir (const vfs_path_t * vpath)
{
return rmdir (vpath->unparsed);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return rmdir (path_element->path);
}
/* --------------------------------------------------------------------------------------------- */
@ -260,7 +293,9 @@ local_rmdir (const vfs_path_t * vpath)
static char *
local_getlocalcopy (const vfs_path_t * vpath)
{
return g_strdup (vpath->unparsed);
vfs_path_element_t *path_element = vfs_path_get_by_index (vpath, -1);
return g_strdup (path_element->path);
}
/* --------------------------------------------------------------------------------------------- */