Add empty vfs module

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2013-03-07 13:43:41 +03:00
parent 32b2d27819
commit b50a49e698
10 changed files with 399 additions and 0 deletions

View File

@ -572,6 +572,8 @@ src/vfs/local/Makefile
src/vfs/sfs/Makefile src/vfs/sfs/Makefile
src/vfs/smbfs/Makefile
src/vfs/tar/Makefile src/vfs/tar/Makefile
src/vfs/undelfs/Makefile src/vfs/undelfs/Makefile

View File

@ -26,6 +26,7 @@ SUBDIRS += ftpfs
libmc_vfs_la_LIBADD += ftpfs/libvfs-ftpfs.la libmc_vfs_la_LIBADD += ftpfs/libvfs-ftpfs.la
endif endif
if ENABLE_VFS_SFTP if ENABLE_VFS_SFTP
SUBDIRS += sftpfs SUBDIRS += sftpfs
libmc_vfs_la_LIBADD += sftpfs/libvfs-sftpfs.la libmc_vfs_la_LIBADD += sftpfs/libvfs-sftpfs.la
@ -36,6 +37,11 @@ SUBDIRS += sfs
libmc_vfs_la_LIBADD += sfs/libvfs-sfs.la libmc_vfs_la_LIBADD += sfs/libvfs-sfs.la
endif endif
if ENABLE_VFS_SMB
SUBDIRS += smbfs
libmc_vfs_la_LIBADD += smbfs/libvfs-smbfs.la
endif
if ENABLE_VFS_TAR if ENABLE_VFS_TAR
SUBDIRS += tar SUBDIRS += tar
libmc_vfs_la_LIBADD += tar/libvfs-tar.la libmc_vfs_la_LIBADD += tar/libvfs-tar.la

View File

@ -58,6 +58,10 @@
#include "sftpfs/init.h" #include "sftpfs/init.h"
#endif #endif
#ifdef ENABLE_VFS_SMB
#include "smbfs/init.h"
#endif
#ifdef ENABLE_VFS_SFS #ifdef ENABLE_VFS_SFS
#include "sfs/sfs.h" #include "sfs/sfs.h"
#endif #endif
@ -115,6 +119,9 @@ vfs_plugins_init (void)
#ifdef ENABLE_VFS_SFTP #ifdef ENABLE_VFS_SFTP
init_sftpfs (); init_sftpfs ();
#endif /* ENABLE_VFS_SFTP */ #endif /* ENABLE_VFS_SFTP */
#ifdef ENABLE_VFS_SMB
init_smbfs ();
#endif /* ENABLE_VFS_SMB */
#ifdef ENABLE_VFS_FISH #ifdef ENABLE_VFS_FISH
init_fish (); init_fish ();
#endif /* ENABLE_VFS_FISH */ #endif /* ENABLE_VFS_FISH */

View File

@ -0,0 +1,9 @@
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
noinst_LTLIBRARIES = libvfs-smbfs.la
libvfs_smbfs_la_SOURCES = \
init.c init.h \
internal.c internal.h \
vfs_class.c vfs_subclass.c

70
src/vfs/smbfs/init.c Normal file
View File

@ -0,0 +1,70 @@
/* Virtual File System: Samba file system.
The interface function
Copyright (C) 2013
The Free Software Foundation, Inc.
Written by:
Slava Zanko <slavazanko@gmail.com>, 2013
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
The Midnight Commander is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "lib/global.h"
#include "lib/vfs/netutil.h"
#include "internal.h"
#include "init.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/**
* Initialization of Samba Virtual File Sysytem.
*/
void
init_smbfs (void)
{
tcp_init ();
smbfs_init_class ();
smbfs_init_subclass ();
vfs_s_init_class (&smbfs_class, &smbfs_subclass);
smbfs_init_class_callbacks ();
smbfs_init_subclass_callbacks ();
vfs_register_class (&smbfs_class);
}
/* --------------------------------------------------------------------------------------------- */

23
src/vfs/smbfs/init.h Normal file
View File

@ -0,0 +1,23 @@
/**
* \file
* \brief Header: Samba FS
*/
#ifndef MC__VFS_SMBFS_INIT_H
#define MC__VFS_SMBFS_INIT_H
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
void init_smbfs (void);
/*** inline functions ****************************************************************************/
#endif /* MC__VFS_SMBFS_INIT_H */

63
src/vfs/smbfs/internal.c Normal file
View File

@ -0,0 +1,63 @@
/* Virtual File System: Samba file system.
The internal functions
Copyright (C) 2013
The Free Software Foundation, Inc.
Written by:
Slava Zanko <slavazanko@gmail.com>, 2013
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
The Midnight Commander is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "lib/global.h"
#include "internal.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
smbfs_cb_authdata_provider (const char *server, const char *share,
char *workgroup, int wgmaxlen, char *username, int unmaxlen,
char *password, int pwmaxlen)
{
(void) server;
(void) share;
(void) workgroup;
(void) wgmaxlen;
(void) username;
(void) unmaxlen;
(void) password;
(void) pwmaxlen;
}
/* --------------------------------------------------------------------------------------------- */

39
src/vfs/smbfs/internal.h Normal file
View File

@ -0,0 +1,39 @@
/**
* \file
* \brief Header: SFTP FS
*/
#ifndef MC__VFS_SMBFS_INTERNAL_H
#define MC__VFS_SMBFS_INTERNAL_H
#include <libsmbclient.h>
#include "lib/vfs/vfs.h"
#include "lib/vfs/xdirentry.h"
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
extern struct vfs_class smbfs_class;
extern struct vfs_s_subclass smbfs_subclass;
/*** declarations of public functions ************************************************************/
void smbfs_init_class (void);
void smbfs_init_subclass (void);
void smbfs_init_class_callbacks (void);
void smbfs_init_subclass_callbacks (void);
void
smbfs_cb_authdata_provider (const char *server, const char *share,
char *workgroup, int wgmaxlen, char *username, int unmaxlen,
char *password, int pwmaxlen);
/*** inline functions ****************************************************************************/
#endif /* MC__VFS_SMBFS_INTERNAL_H */

108
src/vfs/smbfs/vfs_class.c Normal file
View File

@ -0,0 +1,108 @@
/* Virtual File System: Samba file system.
The VFS class functions
Copyright (C) 2013
The Free Software Foundation, Inc.
Written by:
Slava Zanko <slavazanko@gmail.com>, 2013
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
The Midnight Commander is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <errno.h>
#include "lib/global.h"
#include "internal.h"
/*** global variables ****************************************************************************/
struct vfs_class smbfs_class;
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/**
* Callback for VFS-class init action.
*
* @param me structure of VFS class
*/
static int
smbfs_cb_init (struct vfs_class *me)
{
(void) me;
if (smbc_init (smbfs_cb_authdata_provider, 0))
{
fprintf (stderr, "smbc_init returned %s (%i)\n", strerror (errno), errno);
return FALSE;
}
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Callback for VFS-class deinit action.
*
* @param me structure of VFS class
*/
static void
smbfs_cb_done (struct vfs_class *me)
{
(void) me;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/**
* Initialization of VFS class structure.
*
* @return the VFS class structure.
*/
void
smbfs_init_class (void)
{
memset (&smbfs_class, 0, sizeof (struct vfs_class));
smbfs_class.name = "smbfs";
smbfs_class.prefix = "smb";
smbfs_class.flags = VFSF_NOLINKS;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Initialization of VFS class callbacks.
*/
void
smbfs_init_class_callbacks (void)
{
smbfs_class.init = smbfs_cb_init;
smbfs_class.done = smbfs_cb_done;
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -0,0 +1,72 @@
/* Virtual File System: Samba file system.
The VFS subclass functions
Copyright (C) 2013
The Free Software Foundation, Inc.
Written by:
Slava Zanko <slavazanko@gmail.com>, 2013
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
The Midnight Commander is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "lib/global.h"
#include "internal.h"
/*** global variables ****************************************************************************/
struct vfs_s_subclass smbfs_subclass;
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/**
* Initialization of VFS subclass structure.
*
* @return VFS subclass structure.
*/
void
smbfs_init_subclass (void)
{
memset (&smbfs_subclass, 0, sizeof (struct vfs_s_subclass));
smbfs_subclass.flags = VFS_S_REMOTE;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Initialization of VFS subclass callbacks.
*/
void
smbfs_init_subclass_callbacks (void)
{
}
/* --------------------------------------------------------------------------------------------- */