BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / partitioning_systems / session / Disc.h
blob01b58c2f5ab2d493d9035dc7ffab13d2c1059abd
1 /*
2 * Copyright 2003-2011, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
5 * Authors:
6 * Tyler Akidau, haiku@akidau.net
7 */
8 #ifndef _DISC_H
9 #define _DISC_H
12 #include <errno.h>
13 #include <new>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <unistd.h>
18 #include <ByteOrder.h>
19 #include <KernelExport.h>
20 #include <scsi.h>
22 #include "Debug.h"
23 #include "scsi-mmc.h"
26 class List;
27 class Session;
30 /*! \brief A class that encapsulates a complete, parsed, and error
31 checked table of contents for a CD-ROM.
33 class Disc {
34 public:
35 Disc(int fd);
36 ~Disc();
38 status_t InitCheck();
39 Session* GetSession(int32 index);
41 void Dump();
43 // CDs and DVDs are required to have a block size of 2K by
44 // the SCSI-3 standard
45 static const int kBlockSize = 2048;
47 private:
48 uint32 _AdjustForYellowBook(
49 cdrom_full_table_of_contents_entry
50 entries[],
51 uint32 count);
52 status_t _ParseTableOfContents(
53 cdrom_full_table_of_contents_entry
54 entries[],
55 uint32 count);
56 void _SortAndRemoveDuplicates();
57 status_t _CheckForErrorsAndWarnings();
59 private:
60 status_t fInitStatus;
61 List* fSessionList;
65 /*! \brief Encapsulates the pertinent information for a given session
66 on a Disc.
68 class Session {
69 public:
70 ~Session();
72 off_t Offset() { return fOffset; }
73 off_t Size() { return fSize; }
74 uint32 BlockSize() { return fBlockSize; }
75 int32 Index() { return fIndex; }
76 uint32 Flags() { return fFlags; }
77 const char* Type() { return fType; }
79 private:
80 friend class Disc;
82 Session(off_t offset, off_t size,
83 uint32 blockSize, int32 index, uint32 flags,
84 const char* type);
86 Session(const Session& other);
87 // not implemented
88 Session& operator=(const Session& other);
89 // not implemented
91 private:
92 off_t fOffset;
93 off_t fSize;
94 uint32 fBlockSize;
95 int32 fIndex;
96 uint32 fFlags;
97 char* fType;
101 #endif // _DISC_H