[Commits] : Tuxbox-GIT: apps branch master updated. CVS-Final-568-gc931c9e
Tuxbox Sources
Brought to you by:
dbt1
|
From: GetAway <tux...@ne...> - 2015-05-25 17:49:51
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via c931c9eb31c78842af8b13cfb615daed6635aaf7 (commit)
from 0f0e7bf3f426d9beb188d921db1afa4b581fa4b9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c931c9eb31c78842af8b13cfb615daed6635aaf7
Author: m4...@gm... <m4...@gm...>
Date: Mon May 25 19:48:46 2015 +0200
convert most char[...] configuration values to std::string
based on martii's code with some changes for dbox
use struct for network_nfs stuff
remove deprecated support for smbfs mount
fix MAC editing if saved char is 'A-F'
and first keypress is keydown
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 1d40283..5132b3f 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -962,8 +962,8 @@ int CMovieBrowser::exec(const char* path, const int playstate)
//umount automount dirs
for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- if(g_settings.network_nfs_automount[i])
- umount2(g_settings.network_nfs_local_dir[i],MNT_FORCE);
+ if(g_settings.network_nfs[i].automount)
+ umount2(g_settings.network_nfs[i].local_dir.c_str(), MNT_FORCE);
}
#ifdef ENABLE_GUI_MOUNT
CFSMounter::automount();
@@ -3771,9 +3771,9 @@ CDirMenu::CDirMenu(std::vector<MB_DIR>* dir_list)
{
for(int nfs = 0; nfs < NETWORK_NFS_NR_OF_ENTRIES; nfs++)
{
- if(g_settings.network_nfs_local_dir[nfs][0] != 0)
+ if(!g_settings.network_nfs[nfs].local_dir.empty())
{
- std::string tmp = g_settings.network_nfs_local_dir[nfs];
+ std::string tmp = g_settings.network_nfs[nfs].local_dir;
int result = (*dirList)[i].name.compare( 0,tmp.size(),tmp) ;
//printf("[CDirMenu] (nfs%d) %s == (mb%d) %s (%d)\n",nfs,g_settings.network_nfs_local_dir[nfs],i,(*dirList)[i].name.c_str(),result);
@@ -3809,27 +3809,25 @@ int CDirMenu::exec(CMenuTarget* parent, const std::string & actionKey)
{
if(dirState[number] == DIR_STATE_SERVER_DOWN)
{
- std::string command = "ether-wake ";
- command += g_settings.network_nfs_mac[dirNfsMountNr[number]];
- printf("try to start server: %s\n",command.c_str());
- if(system(command.c_str()) != 0)
+ printf("try to start server: %s %s\n","ether-wake", g_settings.network_nfs[dirNfsMountNr[number]].mac.c_str());
+ if (my_system(2, "ether-wake", g_settings.network_nfs[dirNfsMountNr[number]].mac.c_str()) != 0)
perror("ether-wake failed");
- dirOptionText[number]="STARTE SERVER";
+ dirOptionText[number] = "STARTE SERVER";
}
#ifdef ENABLE_GUI_MOUNT
else if(dirState[number] == DIR_STATE_NOT_MOUNTED)
{
printf("[CDirMenu] try to mount %d,%d\n",number,dirNfsMountNr[number]);
CFSMounter::MountRes res;
- res = CFSMounter::mount( g_settings.network_nfs_ip[dirNfsMountNr[number]].c_str(),
- g_settings.network_nfs_dir[dirNfsMountNr[number]] ,
- g_settings.network_nfs_local_dir[dirNfsMountNr[number]] ,
- (CFSMounter::FSType)g_settings.network_nfs_type[dirNfsMountNr[number]] ,
- g_settings.network_nfs_username[dirNfsMountNr[number]] ,
- g_settings.network_nfs_password[dirNfsMountNr[number]] ,
- g_settings.network_nfs_mount_options1[dirNfsMountNr[number]] ,
- g_settings.network_nfs_mount_options2[dirNfsMountNr[number]] );
+ res = CFSMounter::mount (g_settings.network_nfs[dirNfsMountNr[number]].ip,
+ g_settings.network_nfs[dirNfsMountNr[number]].dir,
+ g_settings.network_nfs[dirNfsMountNr[number]].local_dir,
+ (CFSMounter::FSType)g_settings.network_nfs[dirNfsMountNr[number]].type,
+ g_settings.network_nfs[dirNfsMountNr[number]].username,
+ g_settings.network_nfs[dirNfsMountNr[number]].password,
+ g_settings.network_nfs[dirNfsMountNr[number]].mount_options1,
+ g_settings.network_nfs[dirNfsMountNr[number]].mount_options2 );
if(res == CFSMounter::MRES_OK) // if mount is successful we set the state to active in any case
{
*(*dirList)[number].used = true;
@@ -3872,7 +3870,7 @@ void CDirMenu::updateDirState(void)
// 1st ping server
if(dirNfsMountNr[i] != -1)
{
- int retvalue = pingthost(g_settings.network_nfs_ip[dirNfsMountNr[i]].c_str(), 500); // get ping for 60ms - increased
+ int retvalue = pingthost(g_settings.network_nfs[dirNfsMountNr[i]].ip.c_str(), 500); // get ping for 60ms - increased
if (retvalue == 0)//LOCALE_PING_UNREACHABLE
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_SERVER_DOWN);
@@ -3881,7 +3879,7 @@ void CDirMenu::updateDirState(void)
#ifdef ENABLE_GUI_MOUNT
else if (retvalue == 1)//LOCALE_PING_OK
{
- if(CFSMounter::isMounted (g_settings.network_nfs_local_dir[dirNfsMountNr[i]]) == 0)
+ if(CFSMounter::isMounted (g_settings.network_nfs[dirNfsMountNr[i]].local_dir))
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_NOT_MOUNTED);
dirState[i] = DIR_STATE_NOT_MOUNTED;
diff --git a/tuxbox/neutrino/src/gui/nfs.cpp b/tuxbox/neutrino/src/gui/nfs.cpp
index 0f0cb61..be0c9c3 100644
--- a/tuxbox/neutrino/src/gui/nfs.cpp
+++ b/tuxbox/neutrino/src/gui/nfs.cpp
@@ -61,19 +61,26 @@ CNFSMountGui::CNFSMountGui()
m_nfs_sup = CFSMounter::FS_UNPROBED;
m_cifs_sup = CFSMounter::FS_UNPROBED;
m_lufs_sup = CFSMounter::FS_UNPROBED;
- m_smbfs_sup = CFSMounter::FS_UNPROBED;
-
}
-
-const char * nfs_entry_printf_string[4] =
+std::string CNFSMountGui::getEntryString(int i)
{
- "NFS %s:%s -> %s auto: %4s",
- "CIFS //%s/%s -> %s auto: %4s",
- "FTPFS %s/%s -> %s auto: %4s",
- "SMBFS //%s%s -> %s auto: %4s"
-};
-
+ std::string res;
+ switch(g_settings.network_nfs[i].type) {
+ case CFSMounter::NFS: res = "NFS " + g_settings.network_nfs[i].ip + ":"; break;
+ case CFSMounter::CIFS: res = "CIFS //" + g_settings.network_nfs[i].ip + "/"; break;
+ case CFSMounter::LUFS: res = "FTPS " + g_settings.network_nfs[i].ip + "/"; break;
+ }
+ if (g_settings.network_nfs[i].dir.empty() || g_settings.network_nfs[i].local_dir.empty() || g_settings.network_nfs[i].ip.empty())
+ return "";
+ return res
+ + FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs[i].dir.c_str())
+ + " -> "
+ + FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs[i].local_dir.c_str())
+ + " (auto: "
+ + g_Locale->getText(g_settings.network_nfs[i].automount ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO)
+ + ")";
+}
int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
{
@@ -89,22 +96,14 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
if (m_lufs_sup == CFSMounter::FS_UNPROBED)
m_lufs_sup = CFSMounter::fsSupported(CFSMounter::LUFS);
- if (m_smbfs_sup == CFSMounter::FS_UNPROBED)
- m_smbfs_sup = CFSMounter::fsSupported(CFSMounter::SMBFS);
-
- printf("SUPPORT: NFS: %d, CIFS: %d, LUFS: %d, SMBFS: %d\n", m_nfs_sup, m_cifs_sup, m_lufs_sup, m_smbfs_sup);
+ printf("SUPPORT: NFS: %d, CIFS: %d, LUFS: %d\n", m_nfs_sup, m_cifs_sup, m_lufs_sup);
if (actionKey.empty())
{
parent->hide();
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- sprintf(m_entry[i],
- nfs_entry_printf_string[(g_settings.network_nfs_type[i] == (int) CFSMounter::NFS) ? 0 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::CIFS) ? 1 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::SMBFS) ? 3 : 2))],
- g_settings.network_nfs_ip[i].c_str(),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_dir[i]),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_local_dir[i]),
- g_Locale->getText(g_settings.network_nfs_automount[i] ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO));
+ m_entry[i] = getEntryString(i);
}
returnval = menu();
}
@@ -114,23 +113,18 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
returnval = menuEntry(actionKey[10]-'0');
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- sprintf(m_entry[i],
- nfs_entry_printf_string[(g_settings.network_nfs_type[i] == (int) CFSMounter::NFS) ? 0 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::CIFS) ? 1 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::SMBFS) ? 3 : 2))],
- g_settings.network_nfs_ip[i].c_str(),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_dir[i]),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_local_dir[i]),
- g_Locale->getText(g_settings.network_nfs_automount[i] ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO));
- sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
+ m_entry[i] = getEntryString(i);
+ ISO_8859_1_entry[i] = ZapitTools::UTF8_to_Latin1(m_entry[i].c_str());
}
}
else if(actionKey.substr(0,7)=="domount")
{
int nr=atoi(actionKey.substr(7,1).c_str());
CFSMounter::MountRes mres = CFSMounter::mount(
- g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr],
- g_settings.network_nfs_local_dir[nr], (CFSMounter::FSType) g_settings.network_nfs_type[nr],
- g_settings.network_nfs_username[nr], g_settings.network_nfs_password[nr],
- g_settings.network_nfs_mount_options1[nr], g_settings.network_nfs_mount_options2[nr]);
+ g_settings.network_nfs[nr].ip, g_settings.network_nfs[nr].dir,
+ g_settings.network_nfs[nr].local_dir, (CFSMounter::FSType) g_settings.network_nfs[nr].type,
+ g_settings.network_nfs[nr].username, g_settings.network_nfs[nr].password,
+ g_settings.network_nfs[nr].mount_options1, g_settings.network_nfs[nr].mount_options2);
if (mres == CFSMounter::MRES_OK || mres == CFSMounter::MRES_FS_ALREADY_MOUNTED)
mountMenuEntry[nr]->iconName = NEUTRINO_ICON_MOUNTED;
else
@@ -145,8 +139,8 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
CFileBrowser b;
b.Dir_Mode=true;
- if (b.exec(g_settings.network_nfs_local_dir[nr]))
- strcpy(g_settings.network_nfs_local_dir[nr], b.getSelectedFile()->Name.c_str());
+ if (b.exec(g_settings.network_nfs[nr].local_dir.c_str()))
+ g_settings.network_nfs[nr].local_dir = b.getSelectedFile()->Name;
returnval = menu_return::RETURN_REPAINT;
}
@@ -161,9 +155,9 @@ int CNFSMountGui::menu()
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
std::string s2 = "mountentry" + to_string(i);
- sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
+ ISO_8859_1_entry[i] = ZapitTools::UTF8_to_Latin1(m_entry[i].c_str());
mountMenuEntry[i] = new CMenuForwarder("", true, ISO_8859_1_entry[i], this, s2.c_str());
- if (CFSMounter::isMounted(g_settings.network_nfs_local_dir[i]))
+ if (CFSMounter::isMounted(g_settings.network_nfs[i].local_dir))
mountMenuEntry[i]->iconName = NEUTRINO_ICON_MOUNTED;
else
mountMenuEntry[i]->iconName = NEUTRINO_ICON_NOT_MOUNTED;
@@ -185,78 +179,64 @@ const CMenuOptionChooser::keyval NFS_TYPE_OPTIONS[NFS_TYPE_OPTION_COUNT] =
{
{ CFSMounter::NFS , LOCALE_NFS_TYPE_NFS },
{ CFSMounter::CIFS, LOCALE_NFS_TYPE_CIFS },
- { CFSMounter::LUFS, LOCALE_NFS_TYPE_LUFS },
- { CFSMounter::SMBFS, LOCALE_NFS_TYPE_SMBFS }
+ { CFSMounter::LUFS, LOCALE_NFS_TYPE_LUFS }
};
int CNFSMountGui::menuEntry(int nr)
{
- char *dir,*local_dir, *username, *password, *options1, *options2, *mac;
- int* automount;
- int* type;
- std::string cmd = "domount" + to_string(nr);
- std::string cmd2 = "dir" + to_string(nr);
-
- dir = g_settings.network_nfs_dir[nr];
- local_dir = g_settings.network_nfs_local_dir[nr];
- username = g_settings.network_nfs_username[nr];
- password = g_settings.network_nfs_password[nr];
- automount = &g_settings.network_nfs_automount[nr];
- type = &g_settings.network_nfs_type[nr];
- options1 = g_settings.network_nfs_mount_options1[nr];
- options2 = g_settings.network_nfs_mount_options2[nr];
- mac = g_settings.network_nfs_mac[nr];
-
- /* rewrite fstype in new entries */
- if(strlen(local_dir)==0)
- {
- if(m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_lufs_sup == CFSMounter::FS_UNSUPPORTED && m_smbfs_sup == CFSMounter::FS_UNSUPPORTED)
- *type = (int) CFSMounter::CIFS;
-
- else if(m_lufs_sup != CFSMounter::FS_UNSUPPORTED && m_cifs_sup == CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_smbfs_sup == CFSMounter::FS_UNSUPPORTED)
- *type = (int) CFSMounter::LUFS;
-
- else if(m_smbfs_sup != CFSMounter::FS_UNSUPPORTED && m_cifs_sup == CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_lufs_sup == CFSMounter::FS_UNSUPPORTED)
- *type = (int) CFSMounter::SMBFS;
- }
- bool typeEnabled = (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup != CFSMounter::FS_UNSUPPORTED && m_lufs_sup != CFSMounter::FS_UNSUPPORTED && m_smbfs_sup != CFSMounter::FS_UNSUPPORTED) ||
- (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::CIFS) ||
- (m_nfs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::NFS) ||
- (m_lufs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::LUFS) ||
- (m_smbfs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::SMBFS);
+ /* rewrite fstype in new entries */
+ if(g_settings.network_nfs[nr].local_dir.empty()) {
+ if(m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_lufs_sup == CFSMounter::FS_UNSUPPORTED)
+ g_settings.network_nfs[nr].type = (int) CFSMounter::CIFS;
+ else if(m_lufs_sup != CFSMounter::FS_UNSUPPORTED && m_cifs_sup == CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED)
+ g_settings.network_nfs[nr].type = (int) CFSMounter::LUFS;
+ }
+ bool typeEnabled = (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup != CFSMounter::FS_UNSUPPORTED && m_lufs_sup != CFSMounter::FS_UNSUPPORTED) ||
+ (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && g_settings.network_nfs[nr].type != (int)CFSMounter::CIFS) ||
+ (m_nfs_sup != CFSMounter::FS_UNSUPPORTED && g_settings.network_nfs[nr].type != (int)CFSMounter::NFS) ||
+ (m_lufs_sup != CFSMounter::FS_UNSUPPORTED && g_settings.network_nfs[nr].type != (int)CFSMounter::LUFS);
CMenuWidget mountMenuEntryW(LOCALE_NFS_MOUNT, NEUTRINO_ICON_STREAMING,720);
mountMenuEntryW.addIntroItems();
- CIPInput ipInput(LOCALE_NFS_IP, g_settings.network_nfs_ip[nr]);
- CStringInputSMS dirInput(LOCALE_NFS_DIR, dir, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuOptionChooser *automountInput= new CMenuOptionChooser(LOCALE_NFS_AUTOMOUNT, automount, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
- CStringInputSMS options1Input(LOCALE_NFS_MOUNT_OPTIONS, options1, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
- CMenuForwarder *options1_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options1, &options1Input);
- CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, options2, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
- CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options2, &options2Input);
- CStringInputSMS userInput(LOCALE_NFS_USERNAME, username, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (*type != (int)CFSMounter::NFS), username, &userInput);
- CStringInputSMS passInput(LOCALE_NFS_PASSWORD, password, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type != (int)CFSMounter::NFS), NULL, &passInput);
- CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs_mac[nr]);
- CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput);
- CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs_local_dir[nr])), NULL, this, cmd.c_str());
+
+ CIPInput ipInput(LOCALE_NFS_IP, g_settings.network_nfs[nr].ip);
+ CStringInputSMS dirInput(LOCALE_NFS_DIR, &g_settings.network_nfs[nr].dir, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
+
+ CMenuOptionChooser *automountInput= new CMenuOptionChooser(LOCALE_NFS_AUTOMOUNT, &g_settings.network_nfs[nr].automount, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
+
+ CStringInputSMS options1Input(LOCALE_NFS_MOUNT_OPTIONS, &g_settings.network_nfs[nr].mount_options1, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
+ CMenuForwarder *options1_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, g_settings.network_nfs[nr].mount_options1, &options1Input);
+
+ CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, &g_settings.network_nfs[nr].mount_options2, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
+ CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, g_settings.network_nfs[nr].mount_options2, &options2Input);
+
+ CStringInputSMS userInput(LOCALE_NFS_USERNAME, &g_settings.network_nfs[nr].username, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
+ CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (g_settings.network_nfs[nr].type != (int)CFSMounter::NFS), NULL, &userInput);
+
+ CStringInputSMS passInput(LOCALE_NFS_PASSWORD, &g_settings.network_nfs[nr].password, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
+ CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (g_settings.network_nfs[nr].type != (int)CFSMounter::NFS), NULL, &passInput);
+
+ CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs[nr].mac);
+ CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs[nr].mac, &macInput);
+
+ CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs[nr].local_dir)), NULL, this, ("domount" + to_string(nr)).c_str(), CRCInput::RC_red);
mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
COnOffNotifier notifier(CFSMounter::NFS);
notifier.addItem(username_fwd);
notifier.addItem(password_fwd);
- mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput ));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_DIR , true, dir , &dirInput ));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_LOCALDIR, true, local_dir , this , cmd2.c_str()));
+ mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, &g_settings.network_nfs[nr].type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier ));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs[nr].ip, &ipInput ));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_DIR , true, g_settings.network_nfs[nr].dir, &dirInput ));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_LOCALDIR, true, g_settings.network_nfs[nr].local_dir, this, ("dir" + to_string(nr)).c_str() ));
mountMenuEntryW.addItem(automountInput);
mountMenuEntryW.addItem(options1_fwd);
mountMenuEntryW.addItem(options2_fwd);
mountMenuEntryW.addItem(username_fwd);
mountMenuEntryW.addItem(password_fwd);
mountMenuEntryW.addItem(macInput_fwd);
+ mountMenuEntryW.addItem(GenericMenuSeparatorLine);
mountMenuEntryW.addItem(mountnow_fwd);
int ret = mountMenuEntryW.exec(this,"");
@@ -293,7 +273,7 @@ int CNFSUmountGui::menu()
for (CFSMounter::MountInfos::const_iterator it = infos.begin();
it != infos.end(); ++it)
{
- if(it->type == "nfs" || it->type == "cifs" || it->type == "lufs" || it->type == "smbfs")
+ if(it->type == "nfs" || it->type == "cifs" || it->type == "lufs")
{
count++;
std::string s1 = it->device;
@@ -334,8 +314,8 @@ int CNFSSmallMenu::exec( CMenuTarget* parent, const std::string & actionKey )
//umount automount dirs
for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- if(g_settings.network_nfs_automount[i])
- umount2(g_settings.network_nfs_local_dir[i],MNT_FORCE);
+ if(g_settings.network_nfs[i].automount)
+ umount2(g_settings.network_nfs[i].local_dir.c_str(), MNT_FORCE);
}
CFSMounter::automount();
return menu_return::RETURN_REPAINT;
diff --git a/tuxbox/neutrino/src/gui/nfs.h b/tuxbox/neutrino/src/gui/nfs.h
index ea2c343..d8e0ddb 100644
--- a/tuxbox/neutrino/src/gui/nfs.h
+++ b/tuxbox/neutrino/src/gui/nfs.h
@@ -45,15 +45,16 @@ class CNFSMountGui : public CMenuTarget
int menu();
int menuEntry(int nr);
- char m_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
- char ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
+ std::string m_entry[NETWORK_NFS_NR_OF_ENTRIES];
+ std::string ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES];
+
+ std::string getEntryString(int i);
CMenuForwarder* mountMenuEntry[NETWORK_NFS_NR_OF_ENTRIES];
CFSMounter::FS_Support m_nfs_sup;
CFSMounter::FS_Support m_cifs_sup;
CFSMounter::FS_Support m_lufs_sup;
- CFSMounter::FS_Support m_smbfs_sup;
public:
CNFSMountGui();
diff --git a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
index 8582903..683cac1 100755
--- a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
+++ b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
@@ -166,7 +166,7 @@ void CRecDirChooser::initMenu(void)
//printf("dir %d = nfs: %d\n",i,nfsIndex[i]);
if( nfsIndex[i] != -1)
{
- int retvalue = pingthost(g_settings.network_nfs_ip[nfsIndex[i]].c_str(),60); // send ping and wait 60ms
+ int retvalue = pingthost(g_settings.network_nfs[nfsIndex[i]].ip.c_str(),60); // send ping and wait 60ms
if (retvalue == 0)//LOCALE_PING_UNREACHABLE
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_SERVER_DOWN);
@@ -176,7 +176,7 @@ void CRecDirChooser::initMenu(void)
else if (retvalue == 1)//LOCALE_PING_OK
{
// check if we can get more dir informations
- if( CFSMounter::isMounted (g_settings.network_nfs_local_dir[nfsIndex[i]]) == 0)
+ if (CFSMounter::isMounted (g_settings.network_nfs[nfsIndex[i]].local_dir))
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_NOT_MOUNTED);
get_size = false;
@@ -288,8 +288,8 @@ int getNFSIDOfDir(const char * dir)
bool loop = true;
for (int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES && loop; i++)
{
- if (g_settings.network_nfs_local_dir[i][0] != 0 &&
- strstr(dir,g_settings.network_nfs_local_dir[i]) == dir)
+ if (g_settings.network_nfs[i].local_dir[0] != 0 &&
+ g_settings.network_nfs[i].local_dir == dir)
{
result = i;
loop = false;
@@ -330,7 +330,7 @@ int getFirstFreeRecDirNr(int min_free_gb)
if( nfs_id != -1 )
{
printf("NFS%d", nfs_id);
- int retvalue = pingthost(g_settings.network_nfs_ip[nfs_id].c_str(),60); // ping for 60 ms
+ int retvalue = pingthost(g_settings.network_nfs[nfs_id].ip.c_str(), 60); // ping for 60 ms
if (retvalue == 0) //LOCALE_PING_UNREACHABLE
{
printf(",Server down ");
@@ -338,16 +338,16 @@ int getFirstFreeRecDirNr(int min_free_gb)
#ifdef ENABLE_GUI_MOUNT
else if (retvalue == 1) //LOCALE_PING_OK
{
- if(CFSMounter::isMounted (g_settings.network_nfs_local_dir[nfs_id]) == 0)
+ if (CFSMounter::isMounted (g_settings.network_nfs[nfs_id].local_dir))
{
- CFSMounter::MountRes mres = CFSMounter::mount(g_settings.network_nfs_ip[nfs_id].c_str(),
- g_settings.network_nfs_dir[nfs_id],
- g_settings.network_nfs_local_dir[nfs_id],
- (CFSMounter::FSType) g_settings.network_nfs_type[nfs_id],
- g_settings.network_nfs_username[nfs_id],
- g_settings.network_nfs_password[nfs_id],
- g_settings.network_nfs_mount_options1[nfs_id],
- g_settings.network_nfs_mount_options2[nfs_id]);
+ CFSMounter::MountRes mres = CFSMounter::mount(g_settings.network_nfs[nfs_id].ip,
+ g_settings.network_nfs[nfs_id].dir,
+ g_settings.network_nfs[nfs_id].local_dir,
+ (CFSMounter::FSType) g_settings.network_nfs[nfs_id].type,
+ g_settings.network_nfs[nfs_id].username,
+ g_settings.network_nfs[nfs_id].password,
+ g_settings.network_nfs[nfs_id].mount_options1,
+ g_settings.network_nfs[nfs_id].mount_options2 );
if (mres != CFSMounter::MRES_OK)
{
printf(",mount failed");
diff --git a/tuxbox/neutrino/src/gui/widget/mountchooser.cpp b/tuxbox/neutrino/src/gui/widget/mountchooser.cpp
index deb9c87..1f29061 100644
--- a/tuxbox/neutrino/src/gui/widget/mountchooser.cpp
+++ b/tuxbox/neutrino/src/gui/widget/mountchooser.cpp
@@ -48,21 +48,20 @@ CMountChooser::CMountChooser(const neutrino_locale_t Name, const std::string & I
char indexStr[2];
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- if (g_settings.network_nfs_local_dir[i] != NULL &&
- strcmp(g_settings.network_nfs_local_dir[i],"") != 0 &&
- (strstr(g_settings.network_nfs_mount_options1[i],"rw") != NULL ||
- strstr(g_settings.network_nfs_mount_options2[i],"rw") != NULL))
+ if (!g_settings.network_nfs[i].local_dir.empty() &&
+ (g_settings.network_nfs[i].mount_options1.find("rw") != string::npos ||
+ g_settings.network_nfs[i].mount_options2.find("rw") != string::npos))
{
- std::string s(g_settings.network_nfs_local_dir[i]);
+ std::string s(g_settings.network_nfs[i].local_dir);
s += " (";
- s += g_settings.network_nfs_ip[i];
+ s += g_settings.network_nfs[i].ip;
s += ":";
- s += g_settings.network_nfs_dir[i];
+ s += g_settings.network_nfs[i].dir;
s +=")";
snprintf(indexStr,2,"%d",i);
CMenuForwarder* fw = new CMenuForwarder(s.c_str(), true, NULL, this, (std::string("MID:") + std::string(indexStr)).c_str());
fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
- addItem(fw, (strcmp(selectedLocalDir, g_settings.network_nfs_local_dir[i]) == 0));
+ addItem(fw, selectedLocalDir == g_settings.network_nfs[i].local_dir);
}
}
}
@@ -80,8 +79,9 @@ int CMountChooser::exec(CMenuTarget* parent, const std::string & actionKey)
{
if (index)
*index = mount_id;
- if (localDir)
- strcpy(localDir,g_settings.network_nfs_local_dir[mount_id]);
+
+ if (localDir.empty()) // ???
+ localDir = g_settings.network_nfs[mount_id].local_dir;
}
hide();
return menu_return::RETURN_EXIT;
diff --git a/tuxbox/neutrino/src/gui/widget/mountchooser.h b/tuxbox/neutrino/src/gui/widget/mountchooser.h
index da7a030..d22dd07 100644
--- a/tuxbox/neutrino/src/gui/widget/mountchooser.h
+++ b/tuxbox/neutrino/src/gui/widget/mountchooser.h
@@ -52,7 +52,7 @@ class CMountChooser : public CMenuWidget
{
private:
int * index;
- char * localDir;
+ std::string localDir;
public:
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
index 74c6bdc..7db7e6b 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
@@ -537,40 +537,41 @@ void CDateInput::onAfterExec()
}
//-----------------------------#################################-------------------------------------------------------
-CMACInput::CMACInput(const neutrino_locale_t Name, char* Value, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, CChangeObserver* Observ)
- : CExtendedInput(Name, Value, Hint_1, Hint_2, Observ)
+CMACInput::CMACInput(const neutrino_locale_t Name, std::string & Value, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, CChangeObserver* Observ)
+ : CExtendedInput(Name, MAC, Hint_1, Hint_2, Observ)
{
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ mac = &Value;
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_newLiner(30) );
calculateDialog();
}
void CMACInput::onBeforeExec()
{
- if (value[0] == 0) /* strcmp(value, "") == 0 */
+ if (mac->empty())
{
strcpy(value, "00:00:00:00:00:00");
//printf("[neutrino] value-before(2): %s\n", value);
return;
}
int _mac[6];
- sscanf( value, "%x:%x:%x:%x:%x:%x", &_mac[0], &_mac[1], &_mac[2], &_mac[3], &_mac[4], &_mac[5] );
+ sscanf( mac->c_str(), "%x:%x:%x:%x:%x:%x", &_mac[0], &_mac[1], &_mac[2], &_mac[3], &_mac[4], &_mac[5] );
snprintf(value, 20, "%02x:%02x:%02x:%02x:%02x:%02x", _mac[0], _mac[1], _mac[2], _mac[3], _mac[4], _mac[5]);
}
@@ -580,7 +581,11 @@ void CMACInput::onAfterExec()
sscanf( value, "%x:%x:%x:%x:%x:%x", &_mac[0], &_mac[1], &_mac[2], &_mac[3], &_mac[4], &_mac[5] );
snprintf(value, 20, "%02x:%02x:%02x:%02x:%02x:%02x", _mac[0], _mac[1], _mac[2], _mac[3], _mac[4], _mac[5]);
if(strcmp(value,"00:00:00:00:00:00")==0)
- value[0] = 0; /* strcpy(value, ""); */
+ {
+ (*mac) = "";
+ }
+ else
+ (*mac) = value;
}
//-----------------------------#################################-------------------------------------------------------
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.h b/tuxbox/neutrino/src/gui/widget/stringinput_ext.h
index 5d281d3..d280dcb 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.h
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.h
@@ -181,12 +181,15 @@ class CDateInput : public CExtendedInput
class CMACInput : public CExtendedInput
{
+ char MAC[32];
+ std::string * mac;
+
protected:
virtual void onBeforeExec();
virtual void onAfterExec();
public:
- CMACInput(const neutrino_locale_t Name, char* Value, const neutrino_locale_t Hint_1 = LOCALE_IPSETUP_HINT_1, const neutrino_locale_t Hint_2 = LOCALE_IPSETUP_HINT_2, CChangeObserver* Observ = NULL);
+ CMACInput(const neutrino_locale_t Name, std::string & Value, const neutrino_locale_t Hint_1 = LOCALE_IPSETUP_HINT_1, const neutrino_locale_t Hint_2 = LOCALE_IPSETUP_HINT_2, CChangeObserver* Observ = NULL);
};
//----------------------------------------------------------------------------------------------------
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index 852fb75..451a06e 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -450,16 +450,16 @@ int CNeutrinoApp::loadSetup()
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
std::string i_str(to_string(i));
- g_settings.network_nfs_ip[i] = configfile.getString("network_nfs_ip_" + i_str, "");
- strcpy( g_settings.network_nfs_dir[i] , configfile.getString("network_nfs_dir_" + i_str, "").c_str() );
- strcpy( g_settings.network_nfs_local_dir[i] , configfile.getString("network_nfs_local_dir_" + i_str, "").c_str() );
- g_settings.network_nfs_automount[i] = configfile.getInt32 ("network_nfs_automount_" + i_str, 0);
- g_settings.network_nfs_type[i] = configfile.getInt32 ("network_nfs_type_" + i_str, 0);
- strcpy( g_settings.network_nfs_username[i] , configfile.getString("network_nfs_username_" + i_str, "").c_str() );
- strcpy( g_settings.network_nfs_password[i] , configfile.getString("network_nfs_password_" + i_str, "").c_str() );
- strcpy( g_settings.network_nfs_mount_options1[i], configfile.getString("network_nfs_mount_options1_" + i_str, "ro,soft,udp" ).c_str() );
- strcpy( g_settings.network_nfs_mount_options2[i], configfile.getString("network_nfs_mount_options2_" + i_str, "nolock,rsize=8192,wsize=8192" ).c_str() );
- strcpy( g_settings.network_nfs_mac[i] , configfile.getString("network_nfs_mac" + i_str, "11:22:33:44:55:66").c_str() );
+ g_settings.network_nfs[i].ip = configfile.getString("network_nfs_ip_" + i_str, "");
+ g_settings.network_nfs[i].dir = configfile.getString("network_nfs_dir_" + i_str, "");
+ g_settings.network_nfs[i].local_dir = configfile.getString("network_nfs_local_dir_" + i_str, "");
+ g_settings.network_nfs[i].automount = configfile.getInt32 ("network_nfs_automount_" + i_str, 0);
+ g_settings.network_nfs[i].type = configfile.getInt32 ("network_nfs_type_" + i_str, 0);
+ g_settings.network_nfs[i].username = configfile.getString("network_nfs_username_" + i_str, "");
+ g_settings.network_nfs[i].password = configfile.getString("network_nfs_password_" + i_str, "");
+ g_settings.network_nfs[i].mount_options1 = configfile.getString("network_nfs_mount_options1_" + i_str, "ro,soft,udp" );
+ g_settings.network_nfs[i].mount_options2 = configfile.getString("network_nfs_mount_options2_" + i_str, "nolock,rsize=8192,wsize=8192" );
+ g_settings.network_nfs[i].mac = configfile.getString("network_nfs_mac" + i_str, "11:22:33:44:55:66");
}
g_settings.filesystem_is_utf8 = configfile.getBool("filesystem_is_utf8" , true );
@@ -542,7 +542,7 @@ int CNeutrinoApp::loadSetup()
g_settings.recording_server_ip = configfile.getString("recording_server_ip", "10.10.10.10");
strcpy( g_settings.recording_server_port, configfile.getString( "recording_server_port", "4000").c_str() );
g_settings.recording_server_wakeup = configfile.getInt32( "recording_server_wakeup", 0 );
- strcpy( g_settings.recording_server_mac, configfile.getString( "recording_server_mac", "11:22:33:44:55:66").c_str() );
+ g_settings.recording_server_mac = configfile.getString("recording_server_mac", "11:22:33:44:55:66");
g_settings.recording_vcr_no_scart = configfile.getInt32( "recording_vcr_no_scart", false);
g_settings.recording_max_rectime = configfile.getInt32( "recording_max_rectime", 4 );
strcpy( g_settings.recording_splitsize_default, configfile.getString( "recording_splitsize_default", "2048").c_str() );
@@ -981,16 +981,16 @@ void CNeutrinoApp::saveSetup()
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
std::string i_str(to_string(i));
- configfile.setString("network_nfs_ip_" + i_str , g_settings.network_nfs_ip[i] );
- configfile.setString("network_nfs_dir_" + i_str , g_settings.network_nfs_dir[i] );
- configfile.setString("network_nfs_local_dir_" + i_str , g_settings.network_nfs_local_dir[i] );
- configfile.setInt32 ("network_nfs_automount_" + i_str , g_settings.network_nfs_automount[i]);
- configfile.setInt32 ("network_nfs_type_" + i_str , g_settings.network_nfs_type[i]);
- configfile.setString("network_nfs_username_" + i_str , g_settings.network_nfs_username[i] );
- configfile.setString("network_nfs_password_" + i_str , g_settings.network_nfs_password[i] );
- configfile.setString("network_nfs_mount_options1_" + i_str, g_settings.network_nfs_mount_options1[i]);
- configfile.setString("network_nfs_mount_options2_" + i_str, g_settings.network_nfs_mount_options2[i]);
- configfile.setString("network_nfs_mac_" + i_str , g_settings.network_nfs_mac[i]);
+ configfile.setString("network_nfs_ip_" + i_str , g_settings.network_nfs[i].ip );
+ configfile.setString("network_nfs_dir_" + i_str , g_settings.network_nfs[i].dir );
+ configfile.setString("network_nfs_local_dir_" + i_str , g_settings.network_nfs[i].local_dir );
+ configfile.setInt32 ("network_nfs_automount_" + i_str , g_settings.network_nfs[i].automount );
+ configfile.setInt32 ("network_nfs_type_" + i_str , g_settings.network_nfs[i].type );
+ configfile.setString("network_nfs_username_" + i_str , g_settings.network_nfs[i].username );
+ configfile.setString("network_nfs_password_" + i_str , g_settings.network_nfs[i].password );
+ configfile.setString("network_nfs_mount_options1_" + i_str, g_settings.network_nfs[i].mount_options1 );
+ configfile.setString("network_nfs_mount_options2_" + i_str, g_settings.network_nfs[i].mount_options2 );
+ configfile.setString("network_nfs_mac_" + i_str , g_settings.network_nfs[i].mac );
}
configfile.setBool ( "filesystem_is_utf8" , g_settings.filesystem_is_utf8);
#ifdef ENABLE_SAMBASERVER
@@ -1752,24 +1752,24 @@ bool CNeutrinoApp::doGuiRecord(char * preselectedDir, bool addTimer, char * file
int nfs_nr = getNFSIDOfDir(recDir.c_str());
if(nfs_nr != -1)
{
- recDir = g_settings.network_nfs_local_dir[nfs_nr];
+ recDir = g_settings.network_nfs[nfs_nr].local_dir;
#ifdef ENABLE_GUI_MOUNT
- if (!CFSMounter::isMounted(g_settings.network_nfs_local_dir[nfs_nr]))
+ if (!CFSMounter::isMounted(g_settings.network_nfs[nfs_nr].local_dir))
{
printf("not mounted, try to mount: %d\n",nfs_nr);
CFSMounter::MountRes mres =
- CFSMounter::mount(g_settings.network_nfs_ip[nfs_nr].c_str(),
- g_settings.network_nfs_dir[nfs_nr],
- g_settings.network_nfs_local_dir[nfs_nr],
- (CFSMounter::FSType) g_settings.network_nfs_type[nfs_nr],
- g_settings.network_nfs_username[nfs_nr],
- g_settings.network_nfs_password[nfs_nr],
- g_settings.network_nfs_mount_options1[nfs_nr],
- g_settings.network_nfs_mount_options2[nfs_nr]);
+ CFSMounter::mount(g_settings.network_nfs[nfs_nr].ip,
+ g_settings.network_nfs[nfs_nr].dir,
+ g_settings.network_nfs[nfs_nr].local_dir,
+ (CFSMounter::FSType) g_settings.network_nfs[nfs_nr].type,
+ g_settings.network_nfs[nfs_nr].username,
+ g_settings.network_nfs[nfs_nr].password,
+ g_settings.network_nfs[nfs_nr].mount_options1,
+ g_settings.network_nfs[nfs_nr].mount_options2);
if (mres != CFSMounter::MRES_OK)
{
doRecord = false;
- std::string msg = mntRes2Str(mres) + "\nDir: " + g_settings.network_nfs_local_dir[nfs_nr];
+ std::string msg = mntRes2Str(mres) + "\nDir: " + g_settings.network_nfs[nfs_nr].local_dir;
ShowMsgUTF(LOCALE_MESSAGEBOX_ERROR, msg.c_str(),
CMessageBox::mbrBack, CMessageBox::mbBack,NEUTRINO_ICON_ERROR, 450, 10); // UTF-8
}
@@ -2969,7 +2969,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data)
if( g_settings.recording_server_wakeup )
{
- if (my_system(2, "ether-wake", g_settings.recording_server_mac) != 0)
+ printf("[neutrino] waking up %s (rec-server)\n", g_settings.recording_server_mac.c_str());
+ if (my_system(2, "ether-wake", g_settings.recording_server_mac.c_str()) != 0)
perror("ether-wake failed");
}
if (g_settings.recording_type == RECORDING_FILE)
@@ -2977,10 +2978,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data)
char * recDir = eventinfo->recordingDir;
for (int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- if (strcmp(g_settings.network_nfs_local_dir[i],recDir) == 0)
+ if (g_settings.network_nfs[i].local_dir == recDir)
{
- printf("[neutrino] waking up %s (%s)\n",g_settings.network_nfs_ip[i].c_str(),recDir);
- if (my_system(2, "ether-wake", g_settings.network_nfs_mac[i]) != 0)
+ printf("[neutrino] waking up %s (%s)\n", g_settings.network_nfs[i].ip.c_str(), recDir);
+ if (my_system(2, "ether-wake", g_settings.network_nfs[i].mac.c_str()) != 0)
perror("ether-wake failed");
break;
}
@@ -3897,13 +3898,13 @@ void CNeutrinoApp::startNextRecording()
printf("[neutrino.cpp] trying to mount %s\n",recDir);
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- if (strcmp(g_settings.network_nfs_local_dir[i],recDir) == 0)
+ if (g_settings.network_nfs[i].local_dir == recDir)
{
CFSMounter::MountRes mres =
- CFSMounter::mount(g_settings.network_nfs_ip[i].c_str(), g_settings.network_nfs_dir[i],
- g_settings.network_nfs_local_dir[i], (CFSMounter::FSType) g_settings.network_nfs_type[i],
- g_settings.network_nfs_username[i], g_settings.network_nfs_password[i],
- g_settings.network_nfs_mount_options1[i], g_settings.network_nfs_mount_options2[i]);
+ CFSMounter::mount(g_settings.network_nfs[i].ip, g_settings.network_nfs[i].dir,
+ g_settings.network_nfs[i].local_dir, (CFSMounter::FSType) g_settings.network_nfs[i].type,
+ g_settings.network_nfs[i].username, g_settings.network_nfs[i].password,
+ g_settings.network_nfs[i].mount_options1, g_settings.network_nfs[i].mount_options2);
if (mres == CFSMounter::MRES_OK)
{
printf("[neutrino.cpp] mount successful\n");
diff --git a/tuxbox/neutrino/src/system/fsmounter.cpp b/tuxbox/neutrino/src/system/fsmounter.cpp
index 334d492..c612e02 100644
--- a/tuxbox/neutrino/src/system/fsmounter.cpp
+++ b/tuxbox/neutrino/src/system/fsmounter.cpp
@@ -104,8 +104,6 @@ bool insert_modules(const CFSMounter::FSType fstype)
return (system("insmod cifs") == 0);
else if (fstype == CFSMounter::LUFS)
return (system("insmod lufs") == 0);
- else if (fstype == CFSMounter::SMBFS)
- return (system("insmod smbfs") == 0);
return false;
}
@@ -121,8 +119,6 @@ bool remove_modules(const CFSMounter::FSType fstype)
return (system("rmmod cifs") == 0);
else if (fstype == CFSMounter::LUFS)
return (system("rmmod lufs") == 0);
- else if (fstype == CFSMounter::SMBFS)
- return (system("rmmod smbfs") == 0);
return false;
}
@@ -136,8 +132,6 @@ CFSMounter::FS_Support CFSMounter::fsSupported(const CFSMounter::FSType fstype,
fsname = "cifs";
else if (fstype == CFSMounter::LUFS)
fsname = "lufs";
- else if (fstype == CFSMounter::SMBFS)
- fsname = "smbfs";
if (in_proc_filesystems(fsname))
return CFSMounter::FS_READY;
@@ -163,10 +157,10 @@ CFSMounter::FS_Support CFSMounter::fsSupported(const CFSMounter::FSType fstype,
return CFSMounter::FS_UNSUPPORTED;
}
-bool CFSMounter::isMounted(const char * const local_dir)
+bool CFSMounter::isMounted(const std::string &local_dir)
{
std::ifstream in;
- if (local_dir == NULL)
+ if (local_dir.empty())
return false;
#ifdef PATH_MAX
@@ -174,8 +168,8 @@ bool CFSMounter::isMounted(const char * const local_dir)
#else
char mount_point[4096];
#endif
- if (realpath(local_dir, mount_point) == NULL) {
- printf("[CFSMounter] could not resolve dir: %s: %s\n",local_dir, strerror(errno));
+ if (realpath(local_dir.c_str(), mount_point) == NULL) {
+ printf("[CFSMounter] could not resolve dir: %s: %s\n", local_dir.c_str(), strerror(errno));
return false;
}
in.open("/proc/mounts", std::ifstream::in);
@@ -192,11 +186,11 @@ bool CFSMounter::isMounted(const char * const local_dir)
return false;
}
-CFSMounter::MountRes CFSMounter::mount(const char * const ip, const char * const dir, const char * const local_dir,
- const FSType fstype, const char * const username, const char * const password,
- char * options1, char * options2)
+CFSMounter::MountRes CFSMounter::mount(const std::string &ip, const std::string &dir, const std::string &local_dir,
+ const FSType fstype, const std::string &username, const std::string &password,
+ std::string options1, std::string options2)
{
- std::stringstream cmd;
+ std::string cmd;
pthread_mutex_init(&g_mut, NULL);
pthread_cond_init(&g_cond, NULL);
g_mntstatus=-1;
@@ -209,70 +203,92 @@ CFSMounter::MountRes CFSMounter::mount(const char * const ip, const char * const
return MRES_FS_NOT_SUPPORTED;
}
- printf("[CFSMounter] Mount(%d) %s:%s -> %s\n", (int) fstype, ip, dir, local_dir);
+ printf("[CFSMounter] Mount(%d) %s:%s -> %s\n", (int) fstype, ip.c_str(), dir.c_str(), local_dir.c_str());
if (isMounted(local_dir))
{
- printf("[CFSMounter] FS mount error %s already mounted\n", local_dir);
+ printf("[CFSMounter] FS mount error %s already mounted\n", local_dir.c_str());
return MRES_FS_ALREADY_MOUNTED;
}
- if(options1[0] == '\0')
+ if(options1.empty())
{
- strcpy(options1,options2);
- options2[0] = '\0';
+ options1 = options2;
+ options2 = "";
}
-
- if((options1[0] == '\0') && (options2[0] == '\0'))
+
+ if(options1.empty() && options2.empty())
{
if(fstype == NFS)
{
- strcpy(options1,"ro,soft,udp");
- strcpy(options2,"nolock,rsize=8192,wsize=8192");
+ options1 = "ro,soft,udp";
+ options2 = "nolock,rsize=8192,wsize=8192";
}
else if(fstype == CIFS)
{
- strcpy(options1,"ro");
- strcpy(options2,"");
+ options1 = "ro";
+ options2 = "";
}
else if(fstype == LUFS)
{
- strcpy(options1,"");
- strcpy(options2,"");
- }
- else if(fstype == SMBFS)
- {
- strcpy(options1,"");
- strcpy(options2,"");
+ options1 = "";
+ options2 = "";
}
}
if(fstype == NFS)
{
- cmd << "mount -t nfs " << ip << ":" << dir << " " << local_dir << " -o " << options1;
+ cmd = "mount -t nfs ";
+ cmd += ip;
+ cmd += ':';
+ cmd += dir;
+ cmd += ' ';
+ cmd += local_dir;
+ cmd += " -o ";
+ cmd += options1;
}
else if(fstype == CIFS)
{
- cmd << "mount -t cifs " << ip << "/" << dir << " " << local_dir << " -o username=" << username
- << ",password=" << password << ",unc=//" << ip << "/" << dir << "," << options1;
- }
- else if(fstype == SMBFS)
- {
- cmd << "smbmount //" << ip << "/" << dir << " " << password << " " << "-I" << " " << ip << " "
- << "-U" << " " << username << " " << "-c \"mount " << local_dir << "\"" << " ";
+ cmd = "mount -t cifs //";
+ cmd += ip;
+ cmd += '/';
+ cmd += dir;
+ cmd += ' ';
+ cmd += local_dir;
+ cmd += " -o username=";
+ cmd += username;
+ cmd += ",password=";
+ cmd += password;
+ //cmd += ",unc=//"; for whats needed?
+ //cmd += ip;
+ //cmd += '/';
+ //cmd += dir;
+ //cmd += ',';
+ //cmd += options1;
}
else
{
- cmd << "lufsd none " << local_dir << " -o fs=ftpfs,username=" << username
- << ",password=" << password << ",host=" << ip << ",root=/" << dir << "," << options1;
+ cmd = "lufsd none ";
+ cmd += local_dir;
+ cmd += " -o fs=ftpfs,username=";
+ cmd += username;
+ cmd += ",password=";
+ cmd += password;
+ cmd += ",host=";
+ cmd += ip;
+ cmd += ",root=/";
+ cmd += dir;
+ cmd += ',';
+ cmd += options1;
}
- if (options2[0] !='\0')
+ if (!options2.empty())
{
- cmd << "," << options2;
+ cmd += ',';
+ cmd += options2;
}
- pthread_create(&g_mnt, 0, mount_thread, (void *) cmd.str().c_str());
+ pthread_create(&g_mnt, 0, mount_thread, (void *) cmd.c_str());
struct timespec timeout;
int retcode;
@@ -286,10 +302,11 @@ CFSMounter::MountRes CFSMounter::mount(const char * const ip, const char * const
pthread_cancel(g_mnt);
}
pthread_mutex_unlock(&g_mut);
+ pthread_join(g_mnt, NULL);
if ( g_mntstatus != 0 )
{
- printf("[CFSMounter] FS mount error: \"%s\"\n", cmd.str().c_str());
+ printf("[CFSMounter] FS mount error: \"%s\"\n", cmd.c_str());
return (retcode == ETIMEDOUT) ? MRES_TIMEOUT : MRES_UNKNOWN;
}
return MRES_OK;
@@ -301,12 +318,12 @@ bool CFSMounter::automount()
bool res = true;
for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- if(g_settings.network_nfs_automount[i])
+ if(g_settings.network_nfs[i].automount)
{
- res = (MRES_OK == mount(g_settings.network_nfs_ip[i].c_str(), g_settings.network_nfs_dir[i], g_settings.network_nfs_local_dir[i],
- (FSType) g_settings.network_nfs_type[i], g_settings.network_nfs_username[i],
- g_settings.network_nfs_password[i], g_settings.network_nfs_mount_options1[i],
- g_settings.network_nfs_mount_options2[i])) && res;
+ res = (MRES_OK == mount(g_settings.network_nfs[i].ip, g_settings.network_nfs[i].dir, g_settings.network_nfs[i].local_dir,
+ (FSType) g_settings.network_nfs[i].type, g_settings.network_nfs[i].username,
+ g_settings.network_nfs[i].password, g_settings.network_nfs[i].mount_options1,
+ g_settings.network_nfs[i].mount_options2)) && res;
}
}
return res;
@@ -357,8 +374,7 @@ void CFSMounter::getMountedFS(MountInfos& info)
in.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
if (mi.type == "nfs" ||
mi.type == "cifs" ||
- mi.type == "lufs" ||
- mi.type == "smbfs")
+ mi.type == "lufs" )
{
info.push_back(mi);
printf("[CFSMounter] mounted fs: dev: %s, mp: %s, type: %s\n",
diff --git a/tuxbox/neutrino/src/system/fsmounter.h b/tuxbox/neutrino/src/system/fsmounter.h
index 986ce5a..4f51534 100644
--- a/tuxbox/neutrino/src/system/fsmounter.h
+++ b/tuxbox/neutrino/src/system/fsmounter.h
@@ -60,8 +60,7 @@ class CFSMounter
{
NFS = 0,
CIFS = 1,
- LUFS = 2,
- SMBFS = 3
+ LUFS = 2
};
enum MountRes
@@ -96,10 +95,10 @@ class CFSMounter
*/
public:
CFSMounter();
- static bool isMounted(const char * const local_dir);
- static CFSMounter::MountRes mount(const char * const ip, const char * const dir, const char * const local_dir,
- const FSType fstype, const char * const username, const char * const password,
- char * options1, char * options2);
+ static bool isMounted(const std::string &local_dir);
+ static CFSMounter::MountRes mount(const std::string &ip, const std::string &dir, const std::string &local_dir,
+ const FSType fstype, const std::string &username, const std::string &password,
+ std::string options1, std::string options2);
static bool automount();
static CFSMounter::UMountRes umount(const char * const dir = NULL);
static void getMountedFS(MountInfos& fs);
diff --git a/tuxbox/neutrino/src/system/settings.h b/tuxbox/neutrino/src/system/settings.h
index 17e1ca4..a8e37b9 100644
--- a/tuxbox/neutrino/src/system/settings.h
+++ b/tuxbox/neutrino/src/system/settings.h
@@ -192,16 +192,18 @@ struct SNeutrinoSettings
//network
#define NETWORK_NFS_NR_OF_ENTRIES 8
- std::string network_nfs_ip[NETWORK_NFS_NR_OF_ENTRIES];
- char network_nfs_mac[NETWORK_NFS_NR_OF_ENTRIES][31];
- char network_nfs_local_dir[NETWORK_NFS_NR_OF_ENTRIES][100];
- char network_nfs_dir[NETWORK_NFS_NR_OF_ENTRIES][100];
- int network_nfs_automount[NETWORK_NFS_NR_OF_ENTRIES];
- char network_nfs_mount_options1[NETWORK_NFS_NR_OF_ENTRIES][31];
- char network_nfs_mount_options2[NETWORK_NFS_NR_OF_ENTRIES][31];
- int network_nfs_type[NETWORK_NFS_NR_OF_ENTRIES];
- char network_nfs_username[NETWORK_NFS_NR_OF_ENTRIES][31];
- char network_nfs_password[NETWORK_NFS_NR_OF_ENTRIES][31];
+struct {
+ std::string ip;
+ std::string mac;
+ std::string local_dir;
+ std::string dir;
+ int automount;
+ std::string mount_options1;
+ std::string mount_options2;
+ int type;
+ std::string username;
+ std::string password;
+} network_nfs[NETWORK_NFS_NR_OF_ENTRIES];
//personalization
int personalize_pinstatus;
@@ -261,7 +263,7 @@ struct SNeutrinoSettings
std::string recording_server_ip;
char recording_server_port[10];
int recording_server_wakeup;
- char recording_server_mac[31];
+ std::string recording_server_mac;
int recording_vcr_no_scart;
int recording_max_rectime;
char recording_splitsize_default[10];
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/gui/moviebrowser.cpp | 36 ++---
tuxbox/neutrino/src/gui/nfs.cpp | 162 +++++++++-----------
tuxbox/neutrino/src/gui/nfs.h | 7 +-
tuxbox/neutrino/src/gui/widget/dirchooser.cpp | 28 ++--
tuxbox/neutrino/src/gui/widget/mountchooser.cpp | 20 ++--
tuxbox/neutrino/src/gui/widget/mountchooser.h | 2 +-
tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp | 39 +++--
tuxbox/neutrino/src/gui/widget/stringinput_ext.h | 5 +-
tuxbox/neutrino/src/neutrino.cpp | 83 +++++-----
tuxbox/neutrino/src/system/fsmounter.cpp | 122 +++++++++-------
tuxbox/neutrino/src/system/fsmounter.h | 11 +-
tuxbox/neutrino/src/system/settings.h | 24 ++--
12 files changed, 272 insertions(+), 267 deletions(-)
--
Tuxbox-GIT: apps
|