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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_system_automounter_h__
#define mozilla_system_automounter_h__
#include <stdint.h>
class nsCString;
namespace mozilla {
namespace system {
// AutoMounter modes
#define AUTOMOUNTER_DISABLE 0
#define AUTOMOUNTER_ENABLE_UMS 1
#define AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED 2
#define AUTOMOUNTER_ENABLE_MTP 3
// Automounter statuses
#define AUTOMOUNTER_STATUS_DISABLED 0
#define AUTOMOUNTER_STATUS_ENABLED 1
#define AUTOMOUNTER_STATUS_FILES_OPEN 2
/**
* Initialize the automounter. This causes some of the phone's
* directories to show up on the host when the phone is plugged
* into the host via USB.
*
* When the AutoMounter starts, it will poll the current state
* of affairs (usb cable plugged in, automounter enabled, etc)
* and try to make the state of the volumes match.
*/
void
InitAutoMounter();
/**
* Sets the enabled state of the automounter.
*
* This will in turn cause the automounter to re-evaluate
* whether it should mount/unmount/share/unshare volumes.
*/
void
SetAutoMounterMode(int32_t aMode);
/**
* Reports the status of the automounter.
*/
int32_t
GetAutoMounterStatus();
/**
* Sets the sharing mode of an individual volume.
*
* If a volume is enabled for sharing, and the autmounter
* is in a state to share, then the volume will be shared
* with the PC.
*/
void
SetAutoMounterSharingMode(const nsCString& aVolumeName, bool aAllowSharing);
/**
* Formats the volume with specified volume name.
*
* If the volume is ready to format, automounter
* will unmount it, format it and then mount it again.
*/
void
AutoMounterFormatVolume(const nsCString& aVolumeName);
/**
* Mounts the volume with specified volume name.
*
* If the volume is already unmounted, automounter
* will mount it. Otherwise automounter will skip this.
*/
void
AutoMounterMountVolume(const nsCString& aVolumeName);
/**
* Unmounts the volume with specified volume name.
*
* If the volume is already mounted, automounter
* will unmount it. Otherwise automounter will skip this.
*/
void
AutoMounterUnmountVolume(const nsCString& aVolumeName);
/**
* Shuts down the automounter.
*
* This leaves the volumes in whatever state they're in.
*/
void
ShutdownAutoMounter();
} // system
} // mozilla
#endif // mozilla_system_automounter_h__
|