* Cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32310 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-08-13 13:33:08 +00:00
parent 6ebdef0c29
commit 801535c8ed
2 changed files with 509 additions and 522 deletions
File diff suppressed because it is too large Load Diff
@@ -1,18 +1,14 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2003-2009, Haiku, Inc.
// by the OpenBeOS license. * Distributed under the terms of the MIT license.
// *
// Copyright (c) 2003 Tyler Dauwalder, [email protected] * Authors:
//--------------------------------------------------------------------- * Tyler Akidau, [email protected]
/*! */
\file Disc.cpp
Disc class, used to enumerate the CD/DVD sessions.
*/
#ifndef _DISC_H #ifndef _DISC_H
#define _DISC_H #define _DISC_H
#include <errno.h> #include <errno.h>
#include <new> #include <new>
#include <stdlib.h> #include <stdlib.h>
@@ -26,62 +22,71 @@
#include "Debug.h" #include "Debug.h"
#include "scsi-mmc.h" #include "scsi-mmc.h"
class List; class List;
class Session; class Session;
/*! \brief A class that encapsulates a complete, parsed, and error /*! \brief A class that encapsulates a complete, parsed, and error
checked table of contents for a CD-ROM. checked table of contents for a CD-ROM.
*/ */
class Disc { class Disc {
public: public:
Disc(int fd); Disc(int fd);
~Disc(); ~Disc();
status_t InitCheck(); status_t InitCheck();
Session* GetSession(int32 index); Session* GetSession(int32 index);
void Dump(); void Dump();
// CDs and DVDs are required to have a block size of 2K by // CDs and DVDs are required to have a block size of 2K by
// the SCSI-3 standard // the SCSI-3 standard
static const int kBlockSize = 2048; static const int kBlockSize = 2048;
private: private:
status_t _ParseTableOfContents(cdrom_full_table_of_contents_entry entries[], status_t _ParseTableOfContents(
uint32 count); cdrom_full_table_of_contents_entry entries[],
void _SortAndRemoveDuplicates(); uint32 count);
status_t _CheckForErrorsAndWarnings(); void _SortAndRemoveDuplicates();
status_t _CheckForErrorsAndWarnings();
status_t fInitStatus; status_t fInitStatus;
List *fSessionList; List* fSessionList;
}; };
/*! \brief Encapsulates the pertinent information for a given session /*! \brief Encapsulates the pertinent information for a given session
on a Disc. on a Disc.
*/ */
class Session { class Session {
public: public:
~Session(); ~Session();
off_t Offset() { return fOffset; }
off_t Size() { return fSize; }
uint32 BlockSize() { return fBlockSize; }
int32 Index() { return fIndex; }
uint32 Flags() { return fFlags; }
const char* Type() { return fType; }
off_t Offset() { return fOffset; }
off_t Size() { return fSize; }
uint32 BlockSize() { return fBlockSize; }
int32 Index() { return fIndex; }
uint32 Flags() { return fFlags; }
const char* Type() { return fType; }
private: private:
friend class Disc; friend class Disc;
Session(off_t offset, off_t size, uint32 blockSize, int32 index,
uint32 flags, const char *type);
Session(const Session &ref); // not implemented
Session& operator=(const Session &ref); // not implemented
off_t fOffset; Session(off_t offset, off_t size, uint32 blockSize,
off_t fSize; int32 index, uint32 flags, const char* type);
uint32 fBlockSize;
int32 fIndex; Session(const Session& ref);
uint32 fFlags; // not implemented
char *fType; Session& operator=(const Session& ref);
// not implemented
off_t fOffset;
off_t fSize;
uint32 fBlockSize;
int32 fIndex;
uint32 fFlags;
char* fType;
}; };
#endif // _DISC_H #endif // _DISC_H