1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* error.h - This file is part of libsquashfs
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SQFS_ERROR_H
#define SQFS_ERROR_H
/**
* @file error.h
*
* @brief Contains the @ref E_SQFS_ERROR enumerator.
*/
/**
* @enum E_SQFS_ERROR
*
* @brief Error codes that can be returned by various libsquashfs functions.
*/
typedef enum {
/**
* @brief Allocation using malloc or calloc failed (returned NULL).
*/
SQFS_ERROR_ALLOC = -1,
/**
* @brief Generic I/O error if a file read or write operation failed.
*/
SQFS_ERROR_IO = -2,
/**
* @brief Generic compressor error returned if compressing data failed
* (some kind of internal error) or extracting failed (typically
* means the data is corrupted).
*/
SQFS_ERROR_COMRPESSOR = -3,
/**
* @brief An internal error of the "this wasn't supposed to happen"
* kind that cannot easily be mapped to something usefull.
*/
SQFS_ERROR_INTERNAL = -4,
/**
* @brief Attempted to read an on-disk data structure that appears to
* be corrupted, i.e. contains obvious non-sense values.
*/
SQFS_ERROR_CORRUPTED = -5,
/**
* @brief Attempted to use an unsupported feature (e.g. an unknown
* compressor or xattr type).
*/
SQFS_ERROR_UNSUPPORTED = -6,
/**
* @brief Attempted to read a data structure into memory would
* overflow the addressable memory. Usually indicates a
* corrupted or maliciously manipulated SquashFS filesystem.
*/
SQFS_ERROR_OVERFLOW = -7,
/**
* @brief Attempted to perform an out-of-bounds read. If this happens
* when following a reference stored in a data structure, it
* usually indicates a corrupted or maliciously manipulated
* SquashFS filesystem.
*/
SQFS_ERROR_OUT_OF_BOUNDS = -8,
/**
* @brief Specific error when reading the super block.
*
* Could not find the magic.
*/
SFQS_ERROR_SUPER_MAGIC = -9,
/**
* @brief Specific error when reading the super block.
*
* The version indicated be the filesystem is not supported.
*/
SFQS_ERROR_SUPER_VERSION = -10,
/**
* @brief Specific error when reading or initializing the super block.
*
* The block size specified is either not a power of 2, or outside the
* legal range (4k to 1M).
*/
SQFS_ERROR_SUPER_BLOCK_SIZE = -11,
SQFS_ERROR_NOT_DIR = -12,
SQFS_ERROR_NO_ENTRY = -13,
} E_SQFS_ERROR;
#endif /* SQFS_ERROR_H */
|