Skip to content

Commit

Permalink
fuse - Add mount manager option
Browse files Browse the repository at this point in the history
  • Loading branch information
Liryna committed Apr 15, 2020
1 parent 057b63c commit c09d5ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions dokan_fuse/include/dokanfuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct fuse_config
const char *fsname, *volname, *uncname;
int help;
int debug;
int mountManager;
int readonly;
int setsignals;
unsigned int timeoutInSec;
Expand Down
20 changes: 13 additions & 7 deletions dokan_fuse/src/dokanfuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,18 @@ int do_fuse_loop(struct fuse *fs, bool mt) {
return -1;
}
ZeroMemory(dokanOptions, sizeof(DOKAN_OPTIONS));
dokanOptions->Options |=
fs->conf.networkDrive ? DOKAN_OPTION_NETWORK : DOKAN_OPTION_REMOVABLE;
dokanOptions->GlobalContext = reinterpret_cast<ULONG64>(&impl);

wchar_t uncName[MAX_PATH + 1];
if (fs->conf.networkDrive && fs->conf.uncname) {
mbstowcs(uncName, fs->conf.uncname, MAX_PATH);
dokanOptions->UNCName = uncName;
dokanOptions->GlobalContext = reinterpret_cast<ULONG64>(&impl);
if (fs->conf.mountManager)
dokanOptions->Options |= DOKAN_OPTION_MOUNT_MANAGER;
else {
dokanOptions->Options |=
fs->conf.networkDrive ? DOKAN_OPTION_NETWORK : DOKAN_OPTION_REMOVABLE;
wchar_t uncName[MAX_PATH + 1];
if (fs->conf.networkDrive && fs->conf.uncname) {
mbstowcs(uncName, fs->conf.uncname, MAX_PATH);
dokanOptions->UNCName = uncName;
}
}

wchar_t mount[MAX_PATH + 1];
Expand Down Expand Up @@ -599,6 +603,7 @@ static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("alloc_unit_size=%lu", allocationUnitSize, 0),
FUSE_LIB_OPT("sector_size=%lu", sectorSize, 0),
FUSE_LIB_OPT("-n", networkDrive, 1),
FUSE_LIB_OPT("-m", mountManager, 1),
FUSE_OPT_END};

static void fuse_lib_help(void) {
Expand All @@ -615,6 +620,7 @@ static void fuse_lib_help(void) {
" -o alloc_unit_size=M set allocation unit size\n"
" -o sector_size=M set sector size\n"
" -n use network drive\n"
" -m use mount manager\n"
"\n");
}

Expand Down

0 comments on commit c09d5ec

Please sign in to comment.