8 |
|
|
9 |
|
void Mounter::mount() |
10 |
|
{ |
11 |
< |
cout << "STUB: Mounter.mount()\n"; |
11 |
> |
samba(); |
12 |
> |
|
13 |
> |
if (debug) cerr << "folders = {\n"; |
14 |
> |
|
15 |
> |
for (map<string, Folder>::iterator itor = folders.begin(); itor != |
16 |
> |
folders.end(); itor++) |
17 |
> |
{ |
18 |
> |
if (debug) cerr << " " << itor->first << " = {\n" |
19 |
> |
<< " local = " << itor->second.local << "\n" |
20 |
> |
<< " remote = " << itor->second.remote << "\n" |
21 |
> |
<< " }\n"; |
22 |
> |
|
23 |
> |
mount(itor->first, itor->second.local); |
24 |
> |
} |
25 |
> |
|
26 |
> |
if (debug) cerr << "}\n"; |
27 |
> |
} |
28 |
> |
|
29 |
> |
void Mounter::samba() |
30 |
> |
{ |
31 |
> |
string path = config.root + "/" + host; |
32 |
> |
|
33 |
> |
DIR* dir = opendir(path.c_str()); |
34 |
> |
|
35 |
> |
dirent* file; |
36 |
> |
|
37 |
> |
while ((file = readdir(dir)) != NULL) |
38 |
> |
{ |
39 |
> |
struct stat dir; |
40 |
> |
string folder = path + "/" + file->d_name; |
41 |
> |
|
42 |
> |
stat(folder.c_str(), &dir); |
43 |
> |
|
44 |
> |
if (S_ISDIR(dir.st_mode)) |
45 |
> |
{ |
46 |
> |
string folder = file->d_name; |
47 |
> |
|
48 |
> |
if (folder == "." || folder == "..") continue; |
49 |
> |
|
50 |
> |
string share = folder.find('.') == 0 ? folder.erase(0, 1) + "$" : |
51 |
> |
folder; |
52 |
> |
|
53 |
> |
if (folders.find(share) == folders.end()) |
54 |
> |
{ |
55 |
> |
folders.insert(pair<string, Folder>(share, regular)); |
56 |
> |
} |
57 |
> |
} |
58 |
> |
} |
59 |
> |
|
60 |
> |
closedir(dir); |
61 |
> |
} |
62 |
> |
|
63 |
> |
void Mounter::samba(ipstream& pin) |
64 |
> |
{ |
65 |
> |
// |
66 |
> |
} |
67 |
> |
|
68 |
> |
void Mounter::mount(const string& folder, const string& user) |
69 |
> |
{ |
70 |
> |
// |
71 |
|
} |