VirtualBox

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

Last change on this file since 98110 was 98103, checked in by vboxsync, 2 years 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 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox storage devices: Host block device management API.
4 */
5
6/*
7 * Copyright (C) 2015-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 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 * @returns nothing.
60 * @param hHbdMgr The block device manager.
61 */
62DECLHIDDEN(void) HBDMgrDestroy(HBDMGR hHbdMgr);
63
64/**
65 * Returns whether a given filename resembles a block device which can
66 * be managed by this API.
67 *
68 * @returns true if the given filename point to a block device manageable
69 * by the given manager
70 * false otherwise.
71 * @param pszFilename The block device to check.
72 */
73DECLHIDDEN(bool) HBDMgrIsBlockDevice(const char *pszFilename);
74
75/**
76 * Prepares the given block device for use by unmounting and claiming it for exclusive use.
77 *
78 * @returns VBox status code.
79 * @param hHbdMgr The block device manager.
80 * @param pszFilename The block device to claim.
81 */
82DECLHIDDEN(int) HBDMgrClaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename);
83
84/**
85 * Unclaims the given block device.
86 *
87 * @returns VBox status code.
88 * @param hHbdMgr The block device manager.
89 * @param pszFilename The block device to unclaim.
90 */
91DECLHIDDEN(int) HBDMgrUnclaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename);
92
93/**
94 * Returns whether the given block device is claimed by the manager.
95 *
96 * @returns true if the block device is claimed, false otherwisw.
97 * @param hHbdMgr The block device manager.
98 * @param pszFilename The block device to check.
99 */
100DECLHIDDEN(bool) HBDMgrIsBlockDeviceClaimed(HBDMGR hHbdMgr, const char *pszFilename);
101
102RT_C_DECLS_END
103
104#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