VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/HBDMgmt.h@ 106061

Last change on this file since 106061 was 106061, checked in by vboxsync, 2 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.0 KB
Line 
1/* $Id: HBDMgmt.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox storage devices: Host block device management API.
4 */
5
6/*
7 * Copyright (C) 2015-2024 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 VBOX_INCLUDED_SRC_Storage_HBDMgmt_h
29#define VBOX_INCLUDED_SRC_Storage_HBDMgmt_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/cdefs.h>
35
36RT_C_DECLS_BEGIN
37
38/**
39 * Opaque host block device manager.
40 */
41typedef struct HBDMGRINT *HBDMGR;
42/** Pointer to a block device manager. */
43typedef HBDMGR *PHBDMGR;
44
45/* NIL HBD manager handle. */
46#define NIL_HBDMGR ((HBDMGR)0)
47
48/**
49 * Creates host block device manager.
50 *
51 * @returns VBox status code.
52 * @param phHbdMgr Where to store the handle to the block device manager on success.
53 */
54DECLHIDDEN(int) HBDMgrCreate(PHBDMGR phHbdMgr);
55
56/**
57 * Destroys the given block device manager unclaiming all managed block devices.
58 *
59 * @param hHbdMgr The block device manager.
60 */
61DECLHIDDEN(void) HBDMgrDestroy(HBDMGR hHbdMgr);
62
63/**
64 * Returns whether a given filename resembles a block device which can
65 * be managed by this API.
66 *
67 * @returns true if the given filename point to a block device manageable
68 * by the given manager
69 * false otherwise.
70 * @param pszFilename The block device to check.
71 */
72DECLHIDDEN(bool) HBDMgrIsBlockDevice(const char *pszFilename);
73
74/**
75 * Prepares the given block device for use by unmounting and claiming it for exclusive use.
76 *
77 * @returns VBox status code.
78 * @param hHbdMgr The block device manager.
79 * @param pszFilename The block device to claim.
80 */
81DECLHIDDEN(int) HBDMgrClaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename);
82
83/**
84 * Unclaims the given block device.
85 *
86 * @returns VBox status code.
87 * @param hHbdMgr The block device manager.
88 * @param pszFilename The block device to unclaim.
89 */
90DECLHIDDEN(int) HBDMgrUnclaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename);
91
92/**
93 * Returns whether the given block device is claimed by the manager.
94 *
95 * @returns true if the block device is claimed, false otherwisw.
96 * @param hHbdMgr The block device manager.
97 * @param pszFilename The block device to check.
98 */
99DECLHIDDEN(bool) HBDMgrIsBlockDeviceClaimed(HBDMGR hHbdMgr, const char *pszFilename);
100
101RT_C_DECLS_END
102
103#endif /* !VBOX_INCLUDED_SRC_Storage_HBDMgmt_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette