VirtualBox

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

Last change on this file since 56967 was 56967, checked in by vboxsync, 9 years ago

Devices/Storage: Keep track of used host block devices and prevent the host from opening any device while it is still in use by VBox on OS X

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: HBDMgmt.h 56967 2015-07-17 13:07:09Z vboxsync $ */
2/** @file
3 * VBox storage devices: Host block device management API.
4 */
5
6/*
7 * Copyright (C) 2015 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#ifndef __HBDMgmt_h
18#define __HBDMgmt_h
19
20#include <VBox/cdefs.h>
21
22RT_C_DECLS_BEGIN
23
24/**
25 * Opaque host block device manager.
26 */
27typedef struct HBDMGRINT *HBDMGR;
28/** Pointer to a block device manager. */
29typedef HBDMGR *PHBDMGR;
30
31/* NIL HBD manager handle. */
32#define NIL_HBDMGR ((HBDMGR)0)
33
34/**
35 * Creates host block device manager.
36 *
37 * @returns VBox status code.
38 * @param phHbdMgr Where to store the handle to the block device manager on success.
39 */
40DECLHIDDEN(int) HBDMgrCreate(PHBDMGR phHbdMgr);
41
42/**
43 * Destroys the given block device manager unclaiming all managed block devices.
44 *
45 * @returns nothing.
46 * @param hHbdMgr The block device manager.
47 */
48DECLHIDDEN(void) HBDMgrDestroy(HBDMGR hHbdMgr);
49
50/**
51 * Returns whether a given filename resembles a block device which can
52 * be managed by this API.
53 *
54 * @returns true if the given filename point to a block device manageable
55 * by the given manager
56 * false otherwise.
57 * @param pszFilename The block device to check.
58 */
59DECLHIDDEN(bool) HBDMgrIsBlockDevice(const char *pszFilename);
60
61/**
62 * Prepares the given block device for use by unmounting and claiming it for exclusive use.
63 *
64 * @returns VBox status code.
65 * @param hHbdMgr The block device manager.
66 * @param pszFilename The block device to claim.
67 */
68DECLHIDDEN(int) HBDMgrClaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename);
69
70/**
71 * Unclaims the given block device.
72 *
73 * @returns VBox status code.
74 * @param hHbdMgr The block device manager.
75 * @param pszFilename The block device to unclaim.
76 */
77DECLHIDDEN(int) HBDMgrUnclaimBlockDevice(HBDMGR hHbdMgr, const char *pszFilename);
78
79/**
80 * Returns whether the given block device is claimed by the manager.
81 *
82 * @returns true if the block device is claimed, false otherwisw.
83 * @param hHbdMgr The block device manager.
84 * @param pszFilename The block device to check.
85 */
86DECLHIDDEN(bool) HBDMgrIsBlockDeviceClaimed(HBDMGR hHbdMgr, const char *pszFilename);
87
88RT_C_DECLS_END
89
90#endif /* __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