VirtualBox

source: vbox/trunk/src/VBox/Main/HardDiskAttachmentImpl.cpp@ 4615

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek 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
18#include "HardDiskAttachmentImpl.h"
19#include "HardDiskImpl.h"
20
21#include "Logging.h"
22
23// constructor / destructor
24/////////////////////////////////////////////////////////////////////////////
25
26DEFINE_EMPTY_CTOR_DTOR (HardDiskAttachment)
27
28HRESULT HardDiskAttachment::FinalConstruct()
29{
30 mController = DiskControllerType_InvalidController;
31 mDeviceNumber = 0;
32
33 return S_OK;
34}
35
36void HardDiskAttachment::FinalRelease()
37{
38}
39
40// public initializer/uninitializer for internal purposes only
41/////////////////////////////////////////////////////////////////////////////
42
43/**
44 * Initializes the hard disk attachment object.
45 * The initialized object becomes immediately dirty
46 *
47 * @param aHD hard disk object
48 * @param aCtl controller type
49 * @param aDev device number on the controller
50 * @param aDirty whether the attachment is initially dirty or not
51 */
52HRESULT HardDiskAttachment::init (HardDisk *aHD, DiskControllerType_T aCtl, LONG aDev,
53 BOOL aDirty)
54{
55 ComAssertRet (aHD, E_INVALIDARG);
56
57 AutoLock alock (this);
58
59 mDirty = aDirty;
60
61 mHardDisk = aHD;
62 mController = aCtl;
63 mDeviceNumber = aDev;
64
65 setReady (true);
66 return S_OK;
67}
68
69// IHardDiskAttachment properties
70/////////////////////////////////////////////////////////////////////////////
71
72STDMETHODIMP HardDiskAttachment::COMGETTER(HardDisk) (IHardDisk **aHardDisk)
73{
74 if (!aHardDisk)
75 return E_POINTER;
76
77 AutoLock alock (this);
78 CHECK_READY();
79
80 ComAssertRet (!!mHardDisk, E_FAIL);
81
82 mHardDisk.queryInterfaceTo (aHardDisk);
83 return S_OK;
84}
85
86STDMETHODIMP HardDiskAttachment::COMGETTER(Controller) (DiskControllerType_T *aController)
87{
88 if (!aController)
89 return E_POINTER;
90
91 AutoLock alock (this);
92 CHECK_READY();
93
94 *aController = mController;
95 return S_OK;
96}
97
98STDMETHODIMP HardDiskAttachment::COMGETTER(DeviceNumber) (LONG *aDeviceNumber)
99{
100 if (!aDeviceNumber)
101 return E_INVALIDARG;
102
103 AutoLock alock (this);
104 CHECK_READY();
105
106 *aDeviceNumber = mDeviceNumber;
107 return S_OK;
108}
109
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