VirtualBox

source: vbox/trunk/src/VBox/Main/HostFloppyDriveImpl.cpp@ 2957

Last change on this file since 2957 was 2957, checked in by vboxsync, 17 years ago

Made IHostFloppyDrive use libhal on Linux and added UDI strings to the host floppy and DVD devices

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#include "HostFloppyDriveImpl.h"
23
24// constructor / destructor
25/////////////////////////////////////////////////////////////////////////////
26
27DEFINE_EMPTY_CTOR_DTOR (HostFloppyDrive)
28
29HRESULT HostFloppyDrive::FinalConstruct()
30{
31 return S_OK;
32}
33
34void HostFloppyDrive::FinalRelease()
35{
36 uninit();
37}
38
39// public initializer/uninitializer for internal purposes only
40/////////////////////////////////////////////////////////////////////////////
41
42/**
43 * Initializes the host floppy drive object.
44 *
45 * @param aName Name of the drive.
46 * @param aDescription Human-readable drive description (may be NULL).
47 *
48 * @return COM result indicator.
49 */
50HRESULT HostFloppyDrive::init (INPTR BSTR aName,
51 INPTR BSTR aUdi /* = NULL */,
52 INPTR BSTR aDescription /* = NULL */)
53{
54 ComAssertRet (aName, E_INVALIDARG);
55
56 /* Enclose the state transition NotReady->InInit->Ready */
57 AutoInitSpan autoInitSpan (this);
58 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED);
59
60 unconst (mName) = aName;
61 unconst (mUdi) = aUdi;
62 unconst (mDescription) = aDescription;
63
64 /* Confirm the successful initialization */
65 autoInitSpan.setSucceeded();
66
67 return S_OK;
68}
69
70
71/**
72 * Uninitializes the instance and sets the ready flag to FALSE.
73 * Called either from FinalRelease() or by the parent when it gets destroyed.
74 */
75void HostFloppyDrive::uninit()
76{
77 /* Enclose the state transition Ready->InUninit->NotReady */
78 AutoUninitSpan autoUninitSpan (this);
79 if (autoUninitSpan.uninitDone())
80 return;
81
82 unconst (mName).setNull();
83}
84
85// IHostFloppyDrive properties
86/////////////////////////////////////////////////////////////////////////////
87
88STDMETHODIMP HostFloppyDrive::COMGETTER(Name) (BSTR *aName)
89{
90 if (!aName)
91 return E_POINTER;
92
93 AutoCaller autoCaller (this);
94 CheckComRCReturnRC (autoCaller.rc());
95
96 /* mName is constant during life time, no need to lock */
97
98 mName.cloneTo (aName);
99
100 return S_OK;
101}
102
103/**
104 * Returns a human readable description of the host drive
105 *
106 * @returns COM status code
107 * @param driveDescription address of result pointer
108 */
109STDMETHODIMP HostFloppyDrive::COMGETTER(Description) (BSTR *aDescription)
110{
111 if (!aDescription)
112 return E_POINTER;
113
114 AutoCaller autoCaller (this);
115 CheckComRCReturnRC (autoCaller.rc());
116
117 /* mDescription is constant during life time, no need to lock */
118
119 mDescription.cloneTo (aDescription);
120
121 return S_OK;
122}
123
124/**
125 * Returns the universal device identifier of the host drive
126 *
127 * @returns COM status code
128 * @param driveDescription address of result pointer
129 */
130STDMETHODIMP HostFloppyDrive::COMGETTER(Udi) (BSTR *aUdi)
131{
132 if (!aUdi)
133 return E_POINTER;
134
135 AutoCaller autoCaller (this);
136 CheckComRCReturnRC (autoCaller.rc());
137
138 /* mDescription is constant during life time, no need to lock */
139
140 mUdi.cloneTo (aUdi);
141
142 return S_OK;
143}
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