dom/system/gonk/AutoMounter.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/system/gonk/AutoMounter.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,100 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_system_automounter_h__
     1.9 +#define mozilla_system_automounter_h__
    1.10 +
    1.11 +#include <stdint.h>
    1.12 +
    1.13 +class nsCString;
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace system {
    1.17 +
    1.18 +// AutoMounter modes
    1.19 +#define AUTOMOUNTER_DISABLE                 0
    1.20 +#define AUTOMOUNTER_ENABLE                  1
    1.21 +#define AUTOMOUNTER_DISABLE_WHEN_UNPLUGGED  2
    1.22 +
    1.23 +// Automounter statuses
    1.24 +#define AUTOMOUNTER_STATUS_DISABLED         0
    1.25 +#define AUTOMOUNTER_STATUS_ENABLED          1
    1.26 +#define AUTOMOUNTER_STATUS_FILES_OPEN       2
    1.27 +
    1.28 +/**
    1.29 + * Initialize the automounter. This causes some of the phone's
    1.30 + * directories to show up on the host when the phone is plugged
    1.31 + * into the host via USB.
    1.32 + *
    1.33 + * When the AutoMounter starts, it will poll the current state
    1.34 + * of affairs (usb cable plugged in, automounter enabled, etc)
    1.35 + * and try to make the state of the volumes match.
    1.36 + */
    1.37 +void
    1.38 +InitAutoMounter();
    1.39 +
    1.40 +/**
    1.41 + * Sets the enabled state of the automounter.
    1.42 + *
    1.43 + * This will in turn cause the automounter to re-evaluate
    1.44 + * whether it should mount/unmount/share/unshare volumes.
    1.45 + */
    1.46 +void
    1.47 +SetAutoMounterMode(int32_t aMode);
    1.48 +
    1.49 +/**
    1.50 + * Reports the status of the automounter.
    1.51 + */
    1.52 +int32_t
    1.53 +GetAutoMounterStatus();
    1.54 +
    1.55 +/**
    1.56 + * Sets the sharing mode of an individual volume.
    1.57 + *
    1.58 + * If a volume is enabled for sharing, and the autmounter
    1.59 + * is in a state to share, then the volume will be shared
    1.60 + * with the PC.
    1.61 + */
    1.62 +void
    1.63 +SetAutoMounterSharingMode(const nsCString& aVolumeName, bool aAllowSharing);
    1.64 +
    1.65 +/**
    1.66 + * Formats the volume with specified volume name.
    1.67 + *
    1.68 + * If the volume is ready to format, automounter
    1.69 + * will unmount it, format it and then mount it again.
    1.70 + */
    1.71 +void
    1.72 +AutoMounterFormatVolume(const nsCString& aVolumeName);
    1.73 +
    1.74 +/**
    1.75 + * Mounts the volume with specified volume name.
    1.76 + *
    1.77 + * If the volume is already unmounted, automounter
    1.78 + * will mount it. Otherwise automounter will skip this.
    1.79 + */
    1.80 +void
    1.81 +AutoMounterMountVolume(const nsCString& aVolumeName);
    1.82 +
    1.83 +/**
    1.84 + * Unmounts the volume with specified volume name.
    1.85 + *
    1.86 + * If the volume is already mounted, automounter
    1.87 + * will unmount it. Otherwise automounter will skip this.
    1.88 + */
    1.89 +void
    1.90 +AutoMounterUnmountVolume(const nsCString& aVolumeName);
    1.91 +
    1.92 +/**
    1.93 + * Shuts down the automounter.
    1.94 + *
    1.95 + * This leaves the volumes in whatever state they're in.
    1.96 + */
    1.97 +void
    1.98 +ShutdownAutoMounter();
    1.99 +
   1.100 +} // system
   1.101 +} // mozilla
   1.102 +
   1.103 +#endif  // mozilla_system_automounter_h__

mercurial