summaryrefslogtreecommitdiffstats
path: root/src/dokan/ceph_dokan.h
blob: 5957d4dead11e7aae8901985b11c82267504e0d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (C) 2021 SUSE LINUX GmbH
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software
 * Foundation.  See file COPYING.
 *
*/

#pragma once

#define CEPH_DOKAN_IO_DEFAULT_TIMEOUT 60 * 5 // Seconds

// Avoid conflicting COM types, exposed when using C++.
#define _OLE2_H_

#include <bcrypt.h>  // for typedef of NTSTATUS
#include <dokan.h>

struct Config {
  bool removable = false;
  bool readonly = false;
  bool use_win_mount_mgr = false;
  bool current_session_only = false;
  bool debug = false;
  bool dokan_stderr = false;

  int operation_timeout = CEPH_DOKAN_IO_DEFAULT_TIMEOUT;

  std::wstring mountpoint = L"";
  std::string root_path = "/";

  std::wstring win_vol_name = L"";
  unsigned long win_vol_serial = 0;
  unsigned long max_path_len = 256;
  mode_t file_mode = 0755;
  mode_t dir_mode = 0755;
};

extern Config *g_cfg;

// TODO: list and service commands.
enum class Command {
  None,
  Version,
  Help,
  Map,
  Unmap,
};

void print_usage();
int parse_args(
  std::vector<const char*>& args,
  std::ostream *err_msg,
  Command *command, Config *cfg);
int set_dokan_options(Config *cfg, PDOKAN_OPTIONS dokan_options);