~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to src/core/mount.h

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Michael Stapelberg, Daniel Schaal, Ondrej Balaz
  • Date: 2013-09-12 00:13:11 UTC
  • mfrom: (1.1.11) (9.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: package-import@ubuntu.com-20130912001311-dz35it34wr2lbday
Tags: 204-3
[ Michael Biebl ]
* Upload to unstable.
* Use /bin/bash in debug-shell.service as Debian doesn't have /sbin/sushell.
* Only import net.ifaces cmdline property for network devices.
* Generate strict dependencies between the binary packages using a
  shlibs.local file and add an explicit versioned dependency on
  libsystemd-login0 to systemd to ensure packages are upgraded in sync.
  Closes: #719444
* Drop obsolete Replaces: libudev0 from udev package.
* Use correct paths for various binaries, like /sbin/quotaon, which are
  installed in / and not /usr in Debian.  Closes: #721347
* Don't install kernel-install(8) man page since we don't install the
  corresponding binary either.  Closes: #722180
* Cherry-pick upstream fixes to make switching runlevels and starting
  reboot via ctrl-alt-del more robust.
* Cherry-pick upstream fix to properly apply ACLs to Journal files.

[ Michael Stapelberg ]
* Make systemctl enable|disable call update-rc.d for SysV init scripts.
  Closes: #709780
* Don't mount /tmp as tmpfs by default and make it possible to enable this
  feature via "systemctl enable tmp.mount".

[ Daniel Schaal ]
* Add bug-script to systemd and udev.  Closes: #711245

[ Ondrej Balaz ]
* Recognize discard option in /etc/crypttab.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
2
 
 
3
#pragma once
 
4
 
 
5
/***
 
6
  This file is part of systemd.
 
7
 
 
8
  Copyright 2010 Lennart Poettering
 
9
 
 
10
  systemd is free software; you can redistribute it and/or modify it
 
11
  under the terms of the GNU Lesser General Public License as published by
 
12
  the Free Software Foundation; either version 2.1 of the License, or
 
13
  (at your option) any later version.
 
14
 
 
15
  systemd is distributed in the hope that it will be useful, but
 
16
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
18
  Lesser General Public License for more details.
 
19
 
 
20
  You should have received a copy of the GNU Lesser General Public License
 
21
  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 
22
***/
 
23
 
 
24
typedef struct Mount Mount;
 
25
 
 
26
#include "unit.h"
 
27
#include "kill.h"
 
28
 
 
29
typedef enum MountState {
 
30
        MOUNT_DEAD,
 
31
        MOUNT_MOUNTING,               /* /bin/mount is running, but the mount is not done yet. */
 
32
        MOUNT_MOUNTING_DONE,          /* /bin/mount is running, and the mount is done. */
 
33
        MOUNT_MOUNTED,
 
34
        MOUNT_REMOUNTING,
 
35
        MOUNT_UNMOUNTING,
 
36
        MOUNT_MOUNTING_SIGTERM,
 
37
        MOUNT_MOUNTING_SIGKILL,
 
38
        MOUNT_REMOUNTING_SIGTERM,
 
39
        MOUNT_REMOUNTING_SIGKILL,
 
40
        MOUNT_UNMOUNTING_SIGTERM,
 
41
        MOUNT_UNMOUNTING_SIGKILL,
 
42
        MOUNT_FAILED,
 
43
        _MOUNT_STATE_MAX,
 
44
        _MOUNT_STATE_INVALID = -1
 
45
} MountState;
 
46
 
 
47
typedef enum MountExecCommand {
 
48
        MOUNT_EXEC_MOUNT,
 
49
        MOUNT_EXEC_UNMOUNT,
 
50
        MOUNT_EXEC_REMOUNT,
 
51
        _MOUNT_EXEC_COMMAND_MAX,
 
52
        _MOUNT_EXEC_COMMAND_INVALID = -1
 
53
} MountExecCommand;
 
54
 
 
55
typedef struct MountParameters {
 
56
        char *what;
 
57
        char *options;
 
58
        char *fstype;
 
59
        int passno;
 
60
} MountParameters;
 
61
 
 
62
typedef enum MountResult {
 
63
        MOUNT_SUCCESS,
 
64
        MOUNT_FAILURE_RESOURCES,
 
65
        MOUNT_FAILURE_TIMEOUT,
 
66
        MOUNT_FAILURE_EXIT_CODE,
 
67
        MOUNT_FAILURE_SIGNAL,
 
68
        MOUNT_FAILURE_CORE_DUMP,
 
69
        _MOUNT_RESULT_MAX,
 
70
        _MOUNT_RESULT_INVALID = -1
 
71
} MountResult;
 
72
 
 
73
struct Mount {
 
74
        Unit meta;
 
75
 
 
76
        char *where;
 
77
 
 
78
        MountParameters parameters_proc_self_mountinfo;
 
79
        MountParameters parameters_fragment;
 
80
 
 
81
        bool from_proc_self_mountinfo:1;
 
82
        bool from_fragment:1;
 
83
 
 
84
        /* Used while looking for mount points that vanished or got
 
85
         * added from/to /proc/self/mountinfo */
 
86
        bool is_mounted:1;
 
87
        bool just_mounted:1;
 
88
        bool just_changed:1;
 
89
 
 
90
        MountResult result;
 
91
        MountResult reload_result;
 
92
 
 
93
        mode_t directory_mode;
 
94
 
 
95
        usec_t timeout_usec;
 
96
 
 
97
        ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
 
98
        ExecContext exec_context;
 
99
        KillContext kill_context;
 
100
 
 
101
        MountState state, deserialized_state;
 
102
 
 
103
        ExecCommand* control_command;
 
104
        MountExecCommand control_command_id;
 
105
        pid_t control_pid;
 
106
 
 
107
        Watch timer_watch;
 
108
};
 
109
 
 
110
extern const UnitVTable mount_vtable;
 
111
 
 
112
void mount_fd_event(Manager *m, int events);
 
113
 
 
114
const char* mount_state_to_string(MountState i) _const_;
 
115
MountState mount_state_from_string(const char *s) _pure_;
 
116
 
 
117
const char* mount_exec_command_to_string(MountExecCommand i) _const_;
 
118
MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
 
119
 
 
120
const char* mount_result_to_string(MountResult i) _const_;
 
121
MountResult mount_result_from_string(const char *s) _pure_;
 
122
 
 
123
void warn_if_dir_nonempty(const char *unit, const char* where);