VirtualBox

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

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

InnoTek -> innotek: all the headers and comments.

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