memfs: memfs-main.c

This commit is contained in:
Bill Zissimopoulos 2016-04-08 21:30:14 -07:00
parent 9d451f4578
commit bc65c2c34d
2 changed files with 14 additions and 5 deletions

View File

@ -139,6 +139,11 @@ FSP_API VOID FspFileSystemStopDispatcher(FSP_FILE_SYSTEM *FileSystem);
FSP_API VOID FspFileSystemSendResponse(FSP_FILE_SYSTEM *FileSystem, FSP_API VOID FspFileSystemSendResponse(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_RSP *Response); FSP_FSCTL_TRANSACT_RSP *Response);
static inline static inline
PWSTR FspFileSystemMountPoint(FSP_FILE_SYSTEM *FileSystem)
{
return FileSystem->MountPoint;
}
static inline
VOID FspFileSystemEnterOperation(FSP_FILE_SYSTEM *FileSystem, VOID FspFileSystemEnterOperation(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{ {

View File

@ -49,13 +49,14 @@ static void fail(const char *format, ...)
static void usage(void) static void usage(void)
{ {
static char usage[] = "" static char usage[] = ""
"usage: %s OPTIONS MountPoint\n" "usage: %s OPTIONS\n"
"\n" "\n"
"options:\n" "options:\n"
" -t FileInfoTimeout\n" " -t FileInfoTimeout\n"
" -n MaxFileNodes\n" " -n MaxFileNodes\n"
" -s MaxFileSize\n" " -s MaxFileSize\n"
" -u \\\\Volume\\Prefix\n"; " -u \\\\Volume\\Prefix\n"
" -m MountPoint\n";
warn(usage, PROGNAME); warn(usage, PROGNAME);
exit(2); exit(2);
@ -105,6 +106,9 @@ int wmain(int argc, wchar_t **argv)
break; break;
switch (argp[0][1]) switch (argp[0][1])
{ {
case L'm':
MountPoint = argtos(++argp);
break;
case L'n': case L'n':
MaxFileNodes = argtol(++argp, MaxFileNodes); MaxFileNodes = argtol(++argp, MaxFileNodes);
break; break;
@ -124,8 +128,7 @@ int wmain(int argc, wchar_t **argv)
} }
} }
MountPoint = *argp++; if (0 != argp[0])
if (0 == MountPoint || 0 != argp[0])
usage(); usage();
MainEvent = CreateEvent(0, TRUE, FALSE, 0); MainEvent = CreateEvent(0, TRUE, FALSE, 0);
@ -141,8 +144,9 @@ int wmain(int argc, wchar_t **argv)
Result = FspFileSystemSetMountPoint(MemfsFileSystem(Memfs), MountPoint); Result = FspFileSystemSetMountPoint(MemfsFileSystem(Memfs), MountPoint);
if (!NT_SUCCESS(Result)) if (!NT_SUCCESS(Result))
fail("error: cannot mount MEMFS"); fail("error: cannot mount MEMFS");
MountPoint = FspFileSystemMountPoint(MemfsFileSystem(Memfs));
warn("%s -t %ld -n %ld -s %ld%s%S %S", warn("%s -t %ld -n %ld -s %ld%s%S -m %S",
PROGNAME, FileInfoTimeout, MaxFileNodes, MaxFileSize, PROGNAME, FileInfoTimeout, MaxFileNodes, MaxFileSize,
VolumePrefix ? " -u " : "", VolumePrefix ? VolumePrefix : L"", VolumePrefix ? " -u " : "", VolumePrefix ? VolumePrefix : L"",
MountPoint); MountPoint);