Skip to content

Commit

Permalink
FUSE - Add removable drive option and use local drive as default type…
Browse files Browse the repository at this point in the history
… now.
  • Loading branch information
Liryna committed Nov 27, 2020
1 parent 094d53b commit feeacb5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions dokan_fuse/include/dokanfuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct fuse_config
int readonly;
int setsignals;
unsigned int timeoutInSec;
int removableDrive;
int networkDrive;
unsigned long allocationUnitSize;
unsigned long sectorSize;
Expand Down
18 changes: 12 additions & 6 deletions dokan_fuse/src/dokanfuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,16 @@ int do_fuse_loop(struct fuse *fs, bool mt) {
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;
if (fs->conf.removableDrive) {
dokanOptions->Options |= DOKAN_OPTION_REMOVABLE;
}
if (fs->conf.networkDrive) {
dokanOptions->Options |= DOKAN_OPTION_NETWORK;
wchar_t uncName[MAX_PATH + 1];
if (fs->conf.networkDrive && fs->conf.uncname) {
mbstowcs(uncName, fs->conf.uncname, MAX_PATH);
dokanOptions->UNCName = uncName;
}
}
}

Expand Down Expand Up @@ -607,6 +611,7 @@ static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("sector_size=%lu", sectorSize, 0),
FUSE_LIB_OPT("-n", networkDrive, 1),
FUSE_LIB_OPT("-m", mountManager, 1),
FUSE_LIB_OPT("-p", removableDrive, 1),
FUSE_OPT_END};

static void fuse_lib_help(void) {
Expand All @@ -624,6 +629,7 @@ static void fuse_lib_help(void) {
" -o sector_size=M set sector size\n"
" -n use network drive\n"
" -m use mount manager\n"
" -p use removable drive\n"
"\n");
}

Expand Down

0 comments on commit feeacb5

Please sign in to comment.