VirtualBox

source: vbox/trunk/src/VBox/Main/include/AutostartDb.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/* $Id: AutostartDb.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Main - Autostart database Interfaces.
4 */
5
6/*
7 * Copyright (C) 2012-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_AutostartDb_h
29#define MAIN_INCLUDED_AutostartDb_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <iprt/cdefs.h>
35#include <iprt/types.h>
36#include <iprt/critsect.h>
37
38class AutostartDb
39{
40 public:
41
42 AutostartDb();
43 ~AutostartDb();
44
45 /**
46 * Sets the path to the autostart database.
47 *
48 * @returns VBox status code.
49 * @param pszAutostartDbPathNew Path to the autostart database.
50 */
51 int setAutostartDbPath(const char *pszAutostartDbPathNew);
52
53 /**
54 * Add a autostart VM to the global database.
55 *
56 * @returns VBox status code.
57 * @retval VERR_PATH_NOT_FOUND if the autostart database directory is not set.
58 * @param pszVMId ID of the VM to add.
59 */
60 int addAutostartVM(const char *pszVMId);
61
62 /**
63 * Remove a autostart VM from the global database.
64 *
65 * @returns VBox status code.
66 * @retval VERR_PATH_NOT_FOUND if the autostart database directory is not set.
67 * @param pszVMId ID of the VM to remove.
68 */
69 int removeAutostartVM(const char *pszVMId);
70
71 /**
72 * Add a autostop VM to the global database.
73 *
74 * @returns VBox status code.
75 * @retval VERR_PATH_NOT_FOUND if the autostart database directory is not set.
76 * @param pszVMId ID of the VM to add.
77 */
78 int addAutostopVM(const char *pszVMId);
79
80 /**
81 * Remove a autostop VM from the global database.
82 *
83 * @returns VBox status code.
84 * @retval VERR_PATH_NOT_FOUND if the autostart database directory is not set.
85 * @param pszVMId ID of the VM to remove.
86 */
87 int removeAutostopVM(const char *pszVMId);
88
89 private:
90
91#ifdef RT_OS_LINUX
92 /** Critical section protecting the database against concurrent access. */
93 RTCRITSECT CritSect;
94 /** Path to the autostart database. */
95 char *m_pszAutostartDbPath;
96
97 /**
98 * Autostart database modification worker.
99 *
100 * @returns VBox status code.
101 * @param fAutostart Flag whether the autostart or autostop database is modified.
102 * @param fAddVM Flag whether a VM is added or removed from the database.
103 */
104 int autostartModifyDb(bool fAutostart, bool fAddVM);
105#endif
106};
107
108#endif /* !MAIN_INCLUDED_AutostartDb_h */
109
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use