* Failure: set errno, return -1
*/
static int mh_statvfs(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
struct vfs_statvfs_struct *statbuf)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
- DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
+ DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n",
+ smb_fname->base_name));
- if (!is_in_media_files(path))
+ if (!is_in_media_files(smb_fname->base_name))
{
- status = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
+ status = SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_STATVFS(handle, clientPath, statbuf);
+ status = SMB_VFS_NEXT_STATVFS(handle, clientFname, statbuf);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
- DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
+ DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n",
+ smb_fname->base_name));
return status;
}
* Success: return 0
* Failure: set errno, return -1
*/
+
static int mh_symlink(vfs_handle_struct *handle,
- const char *oldpath,
- const char *newpath)
+ const char *link_contents,
+ const struct smb_filename *new_smb_fname)
{
- int status;
- char *oldClientPath;
- char *newClientPath;
- TALLOC_CTX *ctx;
+ int status = -1;
+ char *client_link_contents = NULL;
+ struct smb_filename *newclientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_symlink\n"));
- if (!is_in_media_files(oldpath) && !is_in_media_files(newpath))
- {
- status = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
+ if (!is_in_media_files(link_contents) &&
+ !is_in_media_files(new_smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_SYMLINK(handle,
+ link_contents,
+ new_smb_fname);
goto out;
}
- oldClientPath = NULL;
- newClientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- oldpath,
- &oldClientPath)))
- {
+ if ((status = alloc_get_client_path(handle, talloc_tos(),
+ link_contents,
+ &client_link_contents))) {
goto err;
}
-
- if ((status = alloc_get_client_path(handle, ctx,
- newpath,
- &newClientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+ new_smb_fname,
+ &newclientFname))) {
goto err;
}
status = SMB_VFS_NEXT_SYMLINK(handle,
- oldClientPath,
- newClientPath);
-
+ client_link_contents,
+ newclientFname);
err:
- TALLOC_FREE(newClientPath);
- TALLOC_FREE(oldClientPath);
+ TALLOC_FREE(client_link_contents);
+ TALLOC_FREE(newclientFname);
out:
return status;
}
* Failure: set errno, return -1
*/
static int mh_readlink(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
char *buf,
size_t bufsiz)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_readlink\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+ smb_fname,
+ &clientFname))) {
goto err;
}
- status = SMB_VFS_NEXT_READLINK(handle, clientPath, buf, bufsiz);
+ status = SMB_VFS_NEXT_READLINK(handle, clientFname, buf, bufsiz);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
* Failure: set errno, return -1
*/
static int mh_link(vfs_handle_struct *handle,
- const char *oldpath,
- const char *newpath)
+ const struct smb_filename *old_smb_fname,
+ const struct smb_filename *new_smb_fname)
{
int status;
- char *oldClientPath;
- char *newClientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *oldclientFname = NULL;
+ struct smb_filename *newclientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_link\n"));
- if (!is_in_media_files(oldpath) && !is_in_media_files(newpath))
- {
- status = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
+ if (!is_in_media_files(old_smb_fname->base_name) &&
+ !is_in_media_files(new_smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_LINK(handle,
+ old_smb_fname,
+ new_smb_fname);
goto out;
}
- oldClientPath = NULL;
- newClientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- oldpath,
- &oldClientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+ old_smb_fname,
+ &oldclientFname))) {
goto err;
}
-
- if ((status = alloc_get_client_path(handle, ctx,
- newpath,
- &newClientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+ new_smb_fname,
+ &newclientFname))) {
goto err;
}
- status = SMB_VFS_NEXT_LINK(handle, oldClientPath, newClientPath);
+ status = SMB_VFS_NEXT_LINK(handle, oldclientFname, newclientFname);
err:
- TALLOC_FREE(newClientPath);
- TALLOC_FREE(oldClientPath);
+ TALLOC_FREE(newclientFname);
+ TALLOC_FREE(oldclientFname);
out:
return status;
}
* Failure: set errno, return -1
*/
static int mh_mknod(vfs_handle_struct *handle,
- const char *pathname,
+ const struct smb_filename *smb_fname,
mode_t mode,
SMB_DEV_T dev)
{
int status;
- char *clientPath;
+ struct smb_filename *clientFname = NULL;
TALLOC_CTX *ctx;
DEBUG(MH_INFO_DEBUG, ("Entering mh_mknod\n"));
- if (!is_in_media_files(pathname))
- {
- status = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
goto out;
}
- clientPath = NULL;
ctx = talloc_tos();
- if ((status = alloc_get_client_path(handle, ctx,
- pathname,
- &clientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, ctx,
+ smb_fname,
+ &clientFname))) {
goto err;
}
- status = SMB_VFS_NEXT_MKNOD(handle, clientPath, mode, dev);
+ status = SMB_VFS_NEXT_MKNOD(handle, clientFname, mode, dev);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
* Failure: set errno, return -1
*/
static int mh_chflags(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
unsigned int flags)
{
int status;
- char *clientPath;
+ struct smb_filename *clientFname = NULL;
TALLOC_CTX *ctx;
DEBUG(MH_INFO_DEBUG, ("Entering mh_chflags\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
goto out;
}
- clientPath = NULL;
ctx = talloc_tos();
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, ctx,
+ smb_fname,
+ &clientFname))) {
goto err;
}
- status = SMB_VFS_NEXT_CHFLAGS(handle, clientPath, flags);
+ status = SMB_VFS_NEXT_CHFLAGS(handle, clientFname, flags);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
* In this case, "name" is an attr name.
*/
static ssize_t mh_getxattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
const char *name,
void *value,
size_t size)
{
+ int status;
+ struct smb_filename *clientFname = NULL;
ssize_t ret;
- char *clientPath;
- TALLOC_CTX *ctx;
DEBUG(MH_INFO_DEBUG, ("Entering mh_getxattr\n"));
- if (!is_in_media_files(path))
- {
- ret = SMB_VFS_NEXT_GETXATTR(handle, path, name, value,
- size);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ ret = SMB_VFS_NEXT_GETXATTR(handle, smb_fname,
+ name, value, size);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, ctx,
- path,
- &clientPath))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
ret = -1;
goto err;
}
-
- ret = SMB_VFS_NEXT_GETXATTR(handle, clientPath, name, value, size);
+ ret = SMB_VFS_NEXT_GETXATTR(handle, clientFname, name, value, size);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return ret;
}
* Failure: set errno, return -1
*/
static ssize_t mh_listxattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
char *list,
size_t size)
{
ssize_t ret;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
+ int status;
DEBUG(MH_INFO_DEBUG, ("Entering mh_listxattr\n"));
- if (!is_in_media_files(path))
- {
- ret = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ ret = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, ctx,
- path,
- &clientPath))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
ret = -1;
goto err;
}
- ret = SMB_VFS_NEXT_LISTXATTR(handle, clientPath, list, size);
+ ret = SMB_VFS_NEXT_LISTXATTR(handle, clientFname, list, size);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return ret;
}
* In this case, "name" is an attr name.
*/
static int mh_removexattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
const char *name)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_removexattr\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
-
- status = SMB_VFS_NEXT_REMOVEXATTR(handle, clientPath, name);
+ status = SMB_VFS_NEXT_REMOVEXATTR(handle, clientFname, name);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
* In this case, "name" is an attr name.
*/
static int mh_setxattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
const char *name,
const void *value,
size_t size,
int flags)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_setxattr\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_SETXATTR(handle, path, name, value,
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value,
size, flags);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
-
- status = SMB_VFS_NEXT_SETXATTR(handle, clientPath, name, value,
+ status = SMB_VFS_NEXT_SETXATTR(handle, clientFname, name, value,
size, flags);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}