libaaruformat 1.0 Aaru Data Preservation Suite - Format Library

Loading...
Searching...
No Matches
lisa_tag.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2025 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
26
27#ifndef LIBAARUFORMAT_LISA_TAG_H
28#define LIBAARUFORMAT_LISA_TAG_H
29
30#include <stdint.h>
31
32#pragma pack(push, 1)
33
34 typedef struct sony_tag
35{
36 uint16_t version;
37 uint8_t kind : 2;
38 uint8_t reserved : 6;
39 uint8_t volume;
40 int16_t file_id;
41 uint16_t rel_page;
42 uint16_t next_block;
43 uint16_t prev_block;
44} sony_tag;
45
46 typedef struct profile_tag
47{
48 uint16_t version;
49 uint8_t kind : 2;
50 uint8_t reserved : 6;
51 uint8_t volume;
52 int16_t file_id;
53 uint8_t valid_chk : 1;
54 uint16_t used_bytes : 15;
55 uint32_t abs_page;
56 uint8_t checksum;
57 uint16_t rel_page;
58 uint32_t next_block;
59 uint32_t prev_block;
60} profile_tag;
61
62 typedef struct priam_tag
63{
64 uint16_t version;
65 uint8_t kind : 2;
66 uint8_t reserved : 6;
67 uint8_t volume;
68 int16_t file_id;
69 uint8_t valid_chk : 1;
70 uint16_t used_bytes : 15;
71 uint32_t abs_page;
72 uint8_t checksum;
73 uint16_t rel_page;
74 uint32_t next_block;
75 uint32_t prev_block;
76 uint32_t disk_size;
77} priam_tag;
78
79#pragma pack(pop)
80
81 sony_tag bytes_to_sony_tag(const uint8_t *bytes);
82 profile_tag bytes_to_profile_tag(const uint8_t *bytes);
83 priam_tag bytes_to_priam_tag(const uint8_t *bytes);
84uint8_t *sony_tag_to_bytes(sony_tag tag);
85uint8_t *profile_tag_to_bytes(profile_tag tag);
86uint8_t *priam_tag_to_bytes(priam_tag tag);
87
88 profile_tag sony_tag_to_profile(sony_tag tag);
89 profile_tag priam_tag_to_profile(priam_tag tag);
90 priam_tag sony_tag_to_priam(sony_tag tag);
91 priam_tag profile_tag_to_priam(profile_tag tag);
92 sony_tag profile_tag_to_sony(profile_tag tag);
93 sony_tag priam_tag_to_sony(priam_tag tag);
94
95#endif // LIBAARUFORMAT_LISA_TAG_H
priam_tag_to_bytes
uint8_t * priam_tag_to_bytes(priam_tag tag)
Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.
Definition lisa_tag.c:409
bytes_to_priam_tag
priam_tag bytes_to_priam_tag(const uint8_t *bytes)
Parse a 24-byte Priam tag record into a priam_tag structure.
Definition lisa_tag.c:112
profile_tag_to_sony
sony_tag profile_tag_to_sony(profile_tag tag)
Convert a profile_tag to a sony_tag.
Definition lisa_tag.c:257
sony_tag_to_bytes
uint8_t * sony_tag_to_bytes(sony_tag tag)
Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.
Definition lisa_tag.c:466
priam_tag_to_profile
profile_tag priam_tag_to_profile(priam_tag tag)
Convert a priam_tag to a profile_tag.
Definition lisa_tag.c:325
profile_tag_to_bytes
uint8_t * profile_tag_to_bytes(profile_tag tag)
Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.
Definition lisa_tag.c:357
sony_tag_to_profile
profile_tag sony_tag_to_profile(sony_tag tag)
Convert a sony_tag to a profile_tag representation.
Definition lisa_tag.c:173
bytes_to_sony_tag
sony_tag bytes_to_sony_tag(const uint8_t *bytes)
Parse a 12-byte Sony tag record into a sony_tag structure.
Definition lisa_tag.c:82
bytes_to_profile_tag
profile_tag bytes_to_profile_tag(const uint8_t *bytes)
Parse a 20-byte Profile tag record into a profile_tag structure.
Definition lisa_tag.c:142
sony_tag_to_priam
priam_tag sony_tag_to_priam(sony_tag tag)
Convert a sony_tag to a priam_tag representation.
Definition lisa_tag.c:201
profile_tag_to_priam
priam_tag profile_tag_to_priam(profile_tag tag)
Convert a profile_tag to a priam_tag.
Definition lisa_tag.c:228
priam_tag_to_sony
sony_tag priam_tag_to_sony(priam_tag tag)
Convert a priam_tag to a sony_tag.
Definition lisa_tag.c:291
priam_tag
Definition lisa_tag.h:63
priam_tag::reserved
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:66
priam_tag::file_id
int16_t file_id
0x04, file ID
Definition lisa_tag.h:68
priam_tag::next_block
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:74
priam_tag::prev_block
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:75
priam_tag::disk_size
uint32_t disk_size
0x14, disk size
Definition lisa_tag.h:76
priam_tag::checksum
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:72
priam_tag::abs_page
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:71
priam_tag::valid_chk
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:69
priam_tag::kind
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:65
priam_tag::used_bytes
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:70
priam_tag::volume
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:67
priam_tag::version
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:64
priam_tag::rel_page
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:73
profile_tag
Definition lisa_tag.h:47
profile_tag::checksum
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:56
profile_tag::rel_page
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:57
profile_tag::used_bytes
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:54
profile_tag::valid_chk
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:53
profile_tag::abs_page
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:55
profile_tag::reserved
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:50
profile_tag::next_block
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:58
profile_tag::volume
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:51
profile_tag::kind
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:49
profile_tag::file_id
int16_t file_id
0x04, file ID
Definition lisa_tag.h:52
profile_tag::version
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:48
profile_tag::prev_block
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:59
sony_tag
Definition lisa_tag.h:35
sony_tag::volume
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:39
sony_tag::file_id
int16_t file_id
0x04, file ID
Definition lisa_tag.h:40
sony_tag::version
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:36
sony_tag::rel_page
uint16_t rel_page
0x06, relative page number
Definition lisa_tag.h:41
sony_tag::next_block
uint16_t next_block
0x08, next block, 0x7FF if it's last block, 0x8000 set if block is valid
Definition lisa_tag.h:42
sony_tag::reserved
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:38
sony_tag::kind
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:37
sony_tag::prev_block
uint16_t prev_block
0x0A, previous block, 0x7FF if it's first block
Definition lisa_tag.h:43