The Pedigree Project 0.1
Archive.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef ARCHIVE_H
21#define ARCHIVE_H
22
23#include "pedigree/kernel/processor/MemoryRegion.h"
24#include "pedigree/kernel/processor/types.h"
25
30class Archive {
31 public:
33 Archive(uint8_t* pPhys, size_t sSize);
36 ~Archive();
37
39 size_t getNumFiles();
40
43 size_t getFileSize(size_t n);
44
47 char* getFileName(size_t n);
48
51 uintptr_t* getFile(size_t n);
52
53 private:
54 struct ArchiveFile {
55 char name[100]; // Filename.
56 char mode[8]; // Permissions.
57 char uid[8]; // User ID.
58 char gid[8]; // Group ID.
59 char size[12]; // Size, in bytes (octal)
60 char mtime[12]; // Modification time.
61 char chksum[8]; // Header checksum.
62 char link; // Link type: 0 = regular file, 1 = hard link, 2 = symlink.
63 char linkname[100]; // Linked-to file name.
64 };
65
66 ArchiveFile* getFirst();
67 ArchiveFile* getNext(ArchiveFile* pFile);
68 ArchiveFile* get(size_t n);
69
70 uint8_t* m_pBase;
71 MemoryRegion m_Region;
72};
73
74#endif
~Archive()
Definition Archive.cc:47
uintptr_t * getFile(size_t n)
Definition Archive.cc:71
size_t getNumFiles()
Definition Archive.cc:51
char * getFileName(size_t n)
Definition Archive.cc:67
size_t getFileSize(size_t n)
Definition Archive.cc:61
Special memory entity in the kernel's virtual address space.