Compare commits
93 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa10f71f4c | |||
| f9e5ee95e9 | |||
| 55a7cae3c2 | |||
| e85067c605 | |||
| 2e3fb90e94 | |||
| 2f5119cd02 | |||
| e63125b3db | |||
| 0217fdd85f | |||
| 0c46d282d1 | |||
| cfc46cbd96 | |||
| 48a02eacc3 | |||
| 4d264a2323 | |||
| a737bbc22b | |||
| 9b3618fdbe | |||
| 3059e42142 | |||
| cafcf8d253 | |||
| 3031a6623e | |||
| 7d20808705 | |||
| 8bfd5feab6 | |||
| e117efd641 | |||
| 84e0a02268 | |||
| a6c9feb4d6 | |||
| bbf76e4925 | |||
| 7f8090bb1f | |||
| 686ef38598 | |||
| 99978800fa | |||
| 3d277807c6 | |||
| 9980b79d45 | |||
| 64d6ee2468 | |||
| bc138e689f | |||
| e24e624dec | |||
| 7a7aae15ec | |||
| 638062c42f | |||
|
|
ce7fcae4a4 | ||
| dcd167b9bb | |||
| 2501f2abd1 | |||
| bd03af35c5 | |||
| b85b3178c3 | |||
| dfa55a7ea0 | |||
| f88e9b013e | |||
| ee7b44b484 | |||
| bc48cda2ec | |||
| 2472e74dd9 | |||
| 5c97d68677 | |||
| e7c51ced1b | |||
| 5cbd362d72 | |||
| b55f82cdd3 | |||
| 8d7d43507a | |||
| 6c774197d8 | |||
| 577ac48908 | |||
| cb532d8389 | |||
| 87f294e019 | |||
| 1b4080d744 | |||
| 858a605753 | |||
| fb50e0fe8e | |||
| 8a152d623f | |||
| 84961924f7 | |||
| 7259d451c4 | |||
| 82bd2939cd | |||
| 82fa4bffbb | |||
| cf7a095dac | |||
| 29d11d5259 | |||
| 742b946935 | |||
| e145dea230 | |||
| fcf61f3348 | |||
| 5701862621 | |||
| 7daf21df00 | |||
| affbdbcf20 | |||
| 87ab05b4c6 | |||
| cf98bb9c9e | |||
| 7bd057156f | |||
| e39769460f | |||
| 3d246fe653 | |||
| c5f0498eef | |||
| 0b15005dbd | |||
| 9ed45938e6 | |||
| a4491447cb | |||
| 7abc4318cf | |||
| e1801d5789 | |||
| f6c9ac66f5 | |||
| 542330f63b | |||
| 001887fd8b | |||
| 39ac8b2797 | |||
| 34b4c1beb2 | |||
| 595f3b00b3 | |||
| ec5a2b97b9 | |||
| 95c100453f | |||
| 157e99a08e | |||
| b1f9e491b3 | |||
| 9313a8ec4a | |||
| 512d35737b | |||
| 9bcde145a5 | |||
| 5d51e44a2c |
48
.github/workflows/build.yml
vendored
48
.github/workflows/build.yml
vendored
@@ -15,22 +15,16 @@ jobs:
|
||||
id: cleanup
|
||||
uses: rokibhasansagar/slimhub_actions@main
|
||||
|
||||
- name: Setup GitHub CLI
|
||||
id: setup-gh
|
||||
- name: Update and setup packages
|
||||
id: general-packages-progress
|
||||
run: |
|
||||
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
|
||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
|
||||
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
|
||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
|
||||
&& sudo apt update \
|
||||
&& sudo apt install gh -y
|
||||
|
||||
- name: Update and setup packages
|
||||
id: general-packages-progress
|
||||
run: |
|
||||
sudo apt update \
|
||||
&& sudo apt upgrade -y \
|
||||
&& sudo apt install make xz-utils aria2 gawk -y
|
||||
&& sudo apt install make xz-utils aria2 gawk gh -y
|
||||
|
||||
- name: Save spefic version variables
|
||||
id: save-vars
|
||||
@@ -43,13 +37,13 @@ jobs:
|
||||
echo "NDK_IS=${NDK_IS}" >> $GITHUB_ENV
|
||||
cd /home
|
||||
sudo git clone https://github.com/ShawkTeam/pmt -b ${PMT_VERSION}
|
||||
sudo chmod 777 pmt
|
||||
sudo chmod -R 777 pmt
|
||||
echo "PMT_SRCDIR=/home/pmt" >> $GITHUB_ENV
|
||||
echo "NDK_DIR=/home/ndk/android-ndk" >> $GITHUB_ENV
|
||||
echo "NDK_IN_DIR=/home/ndk" >> $GITHUB_ENV
|
||||
sudo mkdir -p "/home/ndk" && cd "/home/ndk" && sudo chmod 777 "/home/ndk"
|
||||
|
||||
- name: Download and extract NDK
|
||||
- name: Setup Android NDK
|
||||
id: setup-ndk
|
||||
run: |
|
||||
echo "Downloading NDK ${{ env.NDK_VERSION }}..."
|
||||
@@ -63,11 +57,9 @@ jobs:
|
||||
- name: Build pmt
|
||||
id: build-pmt
|
||||
run: |
|
||||
make gen-ndk-makefiles
|
||||
export NDK_PROJECT_PATH=${PWD}
|
||||
export NDK_ROOT_DIR=${{ env.NDK_DIR }}
|
||||
echo "NDK_ROOT_DIR=${NDK_ROOT_DIR}" >> $GITHUB_ENV
|
||||
bash build/bash/gen-header
|
||||
. build/bash/gen-header
|
||||
cd ${{ env.NDK_DIR }}
|
||||
./ndk-build
|
||||
working-directory: ${{ env.PMT_SRCDIR }}
|
||||
@@ -75,27 +67,19 @@ jobs:
|
||||
- name: Last small transactions
|
||||
id: small-transactions
|
||||
run: |
|
||||
export CC_64="${PWD}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"
|
||||
export CC_32="${PWD}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang"
|
||||
export AR="${PWD}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||
export CC_VERSION=$(${CC_64} --version | head -n 1)
|
||||
echo "CC_VERSION=${CC_VERSION}" >> $GITHUB_ENV
|
||||
export CXX_64="${PWD}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++"
|
||||
export CXX_VERSION=$(${CXX_64} --version | head -n 1)
|
||||
echo "CXX_VERSION=${CXX_VERSION}" >> $GITHUB_ENV
|
||||
. ${{ env.PMT_SRCDIR }}/build/workflow/build.config
|
||||
. ${{ env.PMT_SRCDIR }}/build/workflow/relnotes > /home/pmt/release_body.txt
|
||||
cd ${{ env.PMT_SRCDIR }}
|
||||
zip -rq pmt-objs-local.zip obj/local/arm64-v8a obj/local/armeabi-v7a
|
||||
for arch in arm64-v8a armeabi-v7a; do
|
||||
xz libs/${arch}/pmt
|
||||
mv libs/${arch}/pmt.xz ${PWD}/pmt-${arch}-$(date +%Y%m%d).xz
|
||||
done
|
||||
for CC_COMP in ${CC_64} ${CC_32}; do
|
||||
make clean
|
||||
make CC="${CC_COMP}" AR="${AR}" PMT_EXTRA_CFLAGS="-D__NDK_BUILD"
|
||||
[[ "${CC_COMP}" == *"aarch64"* ]] && make deb FOR_THIS=64
|
||||
[[ "${CC_COMP}" == *"armv7a"* ]] && make deb FOR_THIS=32
|
||||
mv out/debpackage/*.deb .
|
||||
make clean
|
||||
done
|
||||
xz libs/arm64-v8a/pmt
|
||||
xz libs/armeabi-v7a/pmt
|
||||
mv libs/arm64-v8a/pmt.xz ${PWD}/pmt-arm64-v8a-$(date +%Y%m%d).xz
|
||||
mv libs/armeabi-v7a/pmt.xz ${PWD}/pmt-armeabi-v7a-$(date +%Y%m%d).xz
|
||||
cp build/mandoc/mandoc pmt.8
|
||||
gzip -c pmt.8 > mandoc.gz
|
||||
working-directory: ${{ env.NDK_DIR }}
|
||||
|
||||
- name: Upload to release
|
||||
@@ -104,8 +88,8 @@ jobs:
|
||||
with:
|
||||
files: |
|
||||
/home/pmt/pmt*.xz
|
||||
/home/pmt/pmt*.deb
|
||||
/home/pmt/pmt-objs-local.zip
|
||||
/home/pmt/mandoc.gz
|
||||
name: Partition Manager ${{ env.PMT_VERSION }} Release
|
||||
tag_name: ${{ env.PMT_VERSION }}
|
||||
body_path: /home/pmt/release_body.txt
|
||||
|
||||
2
.github/workflows/check_commits.yml
vendored
2
.github/workflows/check_commits.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
id: check-commit-type
|
||||
run: |
|
||||
echo "BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
|
||||
COMM_MSG=$(git log -1 --pretty=%B)
|
||||
readonly COMM_MSG=$(git log -1 --pretty=%B)
|
||||
if [ "${GITHUB_EVENT_NAME}" == "push" ]; then
|
||||
if [[ "${COMM_MSG}" == *"initial"* ]]; then
|
||||
echo "run_builder=true" >> $GITHUB_ENV
|
||||
|
||||
@@ -12,7 +12,7 @@ On this page, I will tell you how to add languages to pmt. This is not a difficu
|
||||
##### Little important notes
|
||||
- You don't have to be a professional to do this thing.
|
||||
- There will be only one place you need to pay attention to, I will explain it.
|
||||
- There is no need to know C.
|
||||
- There is no need to know C/C++.
|
||||
- You can edit existing translations.
|
||||
- You may need ready pmt to understand some things.
|
||||
- If you are on an x86 PC, you can compile and use it, but the functions will never work.
|
||||
@@ -30,12 +30,12 @@ On this page, I will tell you how to add languages to pmt. This is not a difficu
|
||||
~ $
|
||||
|
||||
C / C++
|
||||
const char* _Nonnull missing_operand = "missing operand.";
|
||||
const std::string missing_operand = "missing operand.";
|
||||
const char* _Nonnull missing_operand = "missing operand."; // C -
|
||||
const std::string missing_operand = "missing operand."; // C++ - (not necessarily using 'string' type)
|
||||
|
||||
APPLYING (C / C++):
|
||||
printf("%s\n", missing_operand); // Move to new line with '\n' character
|
||||
std::cout << missing_operand << std::endl; // Move to new line with std::endl
|
||||
printf("%s\n", missing_operand); // C - Move to new line with '\n' character
|
||||
std::cout << missing_operand << std::endl; // C++ - Move to new line with std::endl
|
||||
```
|
||||
|
||||
For example, let's take the output directly in pmt without any arguments and process the variables and structures behind the work.
|
||||
@@ -47,8 +47,8 @@ On this page, I will tell you how to add languages to pmt. This is not a difficu
|
||||
Try `pmt --help' for more information.
|
||||
~ $
|
||||
|
||||
Code pieces (C)
|
||||
struct pmt_langdb_general en = {
|
||||
Code pieces (C++)
|
||||
struct langdb_general en = {
|
||||
// other translations
|
||||
.missing_operand = "missing operand",
|
||||
.try_h = "Try",
|
||||
@@ -57,29 +57,29 @@ On this page, I will tell you how to add languages to pmt. This is not a difficu
|
||||
}
|
||||
|
||||
// pmt code functions [ logging ]
|
||||
LOGE("%s\n%s `%s --help' %s.\n, missing_operand, try_h, argv[0], for_more); // LOGE is error logger (pmt). argv[0] = execution name
|
||||
LOGE("%s\n%s `%s --help' %s.\n, missing_operand, try_h, args[0], for_more); // LOGE is error logger (pmt). args[0] = execution name
|
||||
```
|
||||
|
||||
In short, there are variables for texts. And I made these dynamic by using [struct](https://chatgpt.com/share/a798b57c-7e29-4b17-8887-f230414e57bd) method in C. You just need to add translation :)
|
||||
In short, there are variables for texts. And I made these dynamic by using [struct](https://chatgpt.com/share/a798b57c-7e29-4b17-8887-f230414e57bd) method in C (but C++ is being used. And, it didn't change much about that). You just need to add translation :)
|
||||
|
||||
##### Translating main program texts (relevant part)
|
||||
|
||||
- Let's open our jni/languages.c source file.
|
||||
- Now, let's create the translation with the ready-made struct structure (see jni/include/pmt-stringkeys.h for the structure).
|
||||
- Let's open our jni/PartitionManager/Languages.cpp source file.
|
||||
- Now, let's create the translation with the ready-made struct structure (see include/PartitionManager/StringKeys.h for the structure).
|
||||
```
|
||||
// Main
|
||||
struct pmt_langdb_general <LANGUAGE_PREFIX> = { // LANGUAGE_PREFIX must be the corresponding abbreviation of the language in English. For example, it's like en in English.
|
||||
struct langdb_general Lang<LANGUAGE_PREFIX> = { // LANGUAGE_PREFIX must be the corresponding abbreviation of the language in English. For example, it's like En in English.
|
||||
// translations
|
||||
}
|
||||
|
||||
// Example
|
||||
struct pmt_langdb_general en = {
|
||||
struct langdb_general LangEn = {
|
||||
// translation
|
||||
}
|
||||
```
|
||||
- We need to add some information about the language.
|
||||
```
|
||||
struct pmt_langdb_general <LANGUAGE_PREFIX> = {
|
||||
struct langdb_general Lang<LANGUAGE_PREFIX> = {
|
||||
.lang_by_s = // Names of those who made the translation. It's up to you. Do you use & between more than one person?
|
||||
.language = // Language name. For example English
|
||||
.lang_prefix = // Language prefix. For example en
|
||||
@@ -87,7 +87,7 @@ In short, there are variables for texts. And I made these dynamic by using [stru
|
||||
}
|
||||
|
||||
// Example
|
||||
struct pmt_langdb_general en = {
|
||||
struct langdb_general LangEn = {
|
||||
.lang_by_s = "YZBruh & r0manas",
|
||||
.language = "English",
|
||||
.lang_prefix = "en",
|
||||
@@ -102,15 +102,15 @@ In short, there are variables for texts. And I made these dynamic by using [stru
|
||||
|
||||
##### Document texts translation (relevant part)
|
||||
|
||||
- Let's open our jni/languages.c source file.
|
||||
- Now, let's create the translation with the ready-made struct structure (see jni/include/pmt-stringkeys.h for the structure).
|
||||
- Let's open our jni/PartitionManager/Languages.cpp source file.
|
||||
- Now, let's create the translation with the ready-made struct structure (see include/PartitionManager/StringKeys.h for the structure).
|
||||
```
|
||||
struct pmt_langdb_docs <LANGUAGE_PREFIX>_docs = {
|
||||
struct langdb_docs LangDoc<LANGUAGE_PREFIX> = {
|
||||
// translations
|
||||
}
|
||||
|
||||
// Example
|
||||
struct pmt_langdb_docs en_docs = {
|
||||
struct langdb_docs LangDocEn = {
|
||||
// translations
|
||||
}
|
||||
|
||||
@@ -120,25 +120,20 @@ In short, there are variables for texts. And I made these dynamic by using [stru
|
||||
|
||||
##### General things to do in translation
|
||||
|
||||
- Open jni/languages.c
|
||||
- Go down a bit...
|
||||
```
|
||||
struct pmt_langdb_langs lang[] = {
|
||||
{"en"},
|
||||
{"tr"},
|
||||
// language prefix. {"<LANGUAGE_PREFIX>"},
|
||||
{NULL} // PLEASE DO NOT ADD IT UNDER 'NULL'!
|
||||
};
|
||||
- Open include/PartitionManager/LanguageConfigs.h
|
||||
```
|
||||
// Example
|
||||
struct LanguageConfigs LanguageConfig[] {
|
||||
{"en", "English", Display::LangEn, Display::LangDocEn},
|
||||
{"tr", "Türkçe", Display::LangTr, Display::LangDocTr}
|
||||
};
|
||||
|
||||
// Example
|
||||
struct pmt_langdb_langs lang[] = {
|
||||
{"en"},
|
||||
{"tr"},
|
||||
{"az"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
// Add the language you are translating into these existing language prefixes. I will fix the errors here (if there is an error)
|
||||
// Add the language you are translating into these existing language prefixes. I will fix the errors here (if there is an error)
|
||||
struct LanguageConfigs LanguageConfig[] {
|
||||
{"en", "English", Display::LangEn, Display::LangDocEn},
|
||||
{"tr", "Türkçe", Display::LangTr, Display::LangDocTr},
|
||||
{"az", "Azərbaycan", Display::LangAz, Display::LangDocAz}
|
||||
};
|
||||
```
|
||||
|
||||
##### Notes
|
||||
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,12 +1,11 @@
|
||||
### Version 2.6.0 Changelog
|
||||
### Version 3.0.2 Changelog
|
||||
|
||||
- 'tools.c' cleaned.
|
||||
- Compilation system (make) was subject to a serious update.
|
||||
- Undefined sanitizer added to debug flags.
|
||||
- Dynamic makefiles with separate targets.
|
||||
- Unit was given when the size information was given (M).
|
||||
- use of other compilers from clang was blocked.
|
||||
- The parted terminal has been added
|
||||
- Compatibility has been achieved with versions below Android 10 (since e2fsprogs, android 10+ was required)
|
||||
- Language loader functions improved and dynamized. Adding languages will be easier now
|
||||
- Unnecessary code cleaned up
|
||||
- Minor bug fixes
|
||||
|
||||
```
|
||||
END OF 2.6.0 UPDATE CHANGELOG
|
||||
END OF 3.0.2 UPDATE CHANGELOG
|
||||
```
|
||||
|
||||
80
INSTALLING.md
Executable file
80
INSTALLING.md
Executable file
@@ -0,0 +1,80 @@
|
||||
## Partition Manager Installatation Guide
|
||||
In this guide, I will give a tutorial on how to install `pmt`.
|
||||
|
||||
### On Termux
|
||||
The simplest installation in this guide is the one to be performed on termux. Because I wrote a [**script**](https://github.com/ShawkTeam/pmt/blob/3.0.2/pmt-termux.sh) for it...
|
||||
- First of all, if it is not installed, you should install termux from [**F-Droid**](https://f-droid.org/packages/com.termux/) (I recommend F-Droid).
|
||||
- In general (**if you have installed termux for the first time**), it is recommended to update the packages. You can use the command below;
|
||||
```
|
||||
pkg update && pkg upgrade -y
|
||||
```
|
||||
- Now all you have to do is download the script.
|
||||
```
|
||||
curl -LSs https://github.com/ShawkTeam/pmt/raw/3.0.2/pmt-termux.sh > pmt-termux.sh
|
||||
```
|
||||
- You need to prepare your environment. The script can do this for you;
|
||||
```
|
||||
bash pmt-termux.sh setup
|
||||
```
|
||||
- Now, install `pmt` on Termux...
|
||||
```
|
||||
bash pmt-termux.sh install
|
||||
```
|
||||
- To get information about the script (usage etc.);
|
||||
```
|
||||
bash pmt-termux.sh --help
|
||||
```
|
||||
- From now on, you can use `pmt` on termux. If you reinstall termux or clear its memory, you need to install it again with these steps.
|
||||
- For proper use of pmt, you need to use `tsu`. `tsu` works in a Termux environment, compared to the '`su`' command. We need this too. So, you should use '`tsu`' instead of '`su`' command for root access.
|
||||
```
|
||||
tsu
|
||||
# You have now accessed root!
|
||||
|
||||
# If you don't want to go to the root environment exactly, you can run one-time root-accessible commands with sudo
|
||||
sudo <commands>
|
||||
|
||||
# Example:
|
||||
sudo pmt --help
|
||||
```
|
||||
|
||||
##### **NOTES:**
|
||||
- You must be connected to the **Internet** when performing these operations.
|
||||
- Root access is **not required** during the installation process, do not use it!
|
||||
|
||||
### On Custom Recovery
|
||||
You have 2 options for installing `pmt` on recovery (**one-time**)...
|
||||
- With PC, **needed a compatibility cable**.
|
||||
- Installing it in a recovery that can **decrypt internal storage**.
|
||||
|
||||
##### Installing with PC
|
||||
- You need to install [**platform tools**](https://developer.android.com/tools/releases/platform-tools) or [**minimal ADB**](https://androidmtk.com/download-minimal-adb-and-fastboot-tool) on your computer. And of course, both USB drives (you should find them).
|
||||
- You should download and extract `pmt` from [**publications**](https://github.com/ShawkTeam/pmt/releases) (there are many programs that can do this).
|
||||
- Enter the recovery mode on the device. Connect the USB cable. Make sure that the device is connected.
|
||||
- Now, we need to send the `pmt` to the device and set permissions.
|
||||
```
|
||||
# Send to device
|
||||
adb push <PMT_FILE_PATH> /system/bin/pmt
|
||||
|
||||
# Set permissions for pmt
|
||||
adb shell chmod 755 /system/bin/pmt
|
||||
```
|
||||
- Now you can use `pmt` with the `adb shell` or via the recovery terminal.
|
||||
|
||||
**NOTES:**
|
||||
- You can easily learn how to use ADB from videos on youtube or guides on the Internet.
|
||||
|
||||
##### Non-PC installing method
|
||||
- You should download and extract `pmt` from [**publications**](https://github.com/ShawkTeam/pmt/releases) (there are many programs that can do this, example: [**ZArchiver**](https://play.google.com/store/apps/details?id=ru.zdevs.zarchiver)).
|
||||
- The file you are extracting must be in internal storage!
|
||||
- Enter the recovery mode and go to the terminal;
|
||||
```
|
||||
cp /sdcard/pmt /system/bin
|
||||
chmod 755 /system/bin/pmt
|
||||
```
|
||||
- Now you can use `pmt` with the `adb shell` or via the recovery terminal.
|
||||
|
||||
**NOTES:**
|
||||
- Make sure the internal storage is **mounted**! In short, you can understand this as follows: **do the files in the internal storage appear?**
|
||||
|
||||
### General Notes
|
||||
- Is there a place that you hang out, that you don't understand, that's a **problem**? Contact us from our [**telegram group** (pmt topic)](https://t.me/shawkbuilddiscussion/19875)!
|
||||
26
Makefile
26
Makefile
@@ -1,26 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
THIS_IS = main
|
||||
NDK_PROG ?= false
|
||||
FORCE_GEN ?= false
|
||||
|
||||
# include needed variables
|
||||
include Makefile.inc
|
||||
include $(TOOLS)/gen-makefiles.mk
|
||||
include $(TOOLS)/clean-makefiles.mk
|
||||
|
||||
include $(BUILD)/main.mk
|
||||
128
Makefile.inc
128
Makefile.inc
@@ -1,128 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# speficy
|
||||
VERSION := 2.6.0
|
||||
VERSION_CODE := 260
|
||||
TARGET := pmt
|
||||
|
||||
# device arch info
|
||||
ARCH := $(shell uname -m)
|
||||
|
||||
# current directory
|
||||
OUT_DIRNAME ?= out
|
||||
SOURCE_DIRNAME ?= jni
|
||||
|
||||
# others needed important variables
|
||||
ifeq ($(THIS_IS),src)
|
||||
BUILD := ../build
|
||||
SOURCE_DIR := $(CURDIR)
|
||||
OUT_DIR := ../$(OUT_DIRNAME)
|
||||
DEBUTILS_DIR := $(BUILD)/deb
|
||||
else ifeq ($(THIS_IS),debutils)
|
||||
BUILD := ..
|
||||
SOURCE_DIR := ../../$(SOURCE_DIRNAME)
|
||||
OUT_DIR := ../../$(OUT_DIRNAME)
|
||||
DEBUTILS_DIR := $(BUILD)/deb
|
||||
else ifeq ($(THIS_IS),out)
|
||||
BUILD := ../build
|
||||
SOURCE_DIR := ../$(SOURCE_DIRNAME)
|
||||
OUT_DIR := $(CURDIR)
|
||||
DEBUTILS_DIR := $(BÜILD)/deb
|
||||
else ifeq ($(THIS_IS),main)
|
||||
BUILD := $(CURDIR)/build
|
||||
SOURCE_DIR := $(CURDIR)/$(SOURCE_DIRNAME)
|
||||
OUT_DIR := $(CURDIR)/$(OUT_DIRNAME)
|
||||
DEBUTILS_DIR := $(BUILD)/deb
|
||||
endif
|
||||
|
||||
BINARY_DIR := $(OUT_DIR)/binary
|
||||
PACKAGE_DIR := $(OUT_DIR)/package
|
||||
STATICLIB_DIR := $(OUT_DIR)/static_libs
|
||||
DEB_DIR := $(OUT_DIR)/debpackage
|
||||
TOOLS := $(BUILD)/tools
|
||||
UTILS := $(BUILD)/util
|
||||
BASH_DIR := $(BUILD)/bash
|
||||
OTHERS := $(BUILD)/others
|
||||
TERMUX_USR := /data/data/com.termux/files/usr
|
||||
TERMUX_BIN := $(TERMUX_USR)/bin
|
||||
LINUX_BIN := /usr/bin
|
||||
DEBTERMUX_USR := $(DEBUTILS_DIR)/template$(TERMUX_USR)
|
||||
|
||||
ifneq ($(wildcard $(LINUX_BIN)),)
|
||||
BIN := $(LINUX_BIN)
|
||||
else
|
||||
BIN := $(TERMUX_BIN)
|
||||
endif
|
||||
|
||||
include $(UTILS)/utils.mk
|
||||
|
||||
ifneq ($(shell basename $(SOURCE_DIR)),$(SOURCE_DIRNAME))
|
||||
$(error The index name specified with the current source directory name is not the same! Something's wrong)
|
||||
endif
|
||||
|
||||
ifneq ($(shell basename $(OUT_DIR)),$(OUT_DIRNAME))
|
||||
$(error The index name specified with the current output directory name is not the same! Something's wrong)
|
||||
endif
|
||||
|
||||
# sources
|
||||
SRCS := $(wildcard $(SOURCE_DIR)/*.c)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
STATIC_LIBS := \
|
||||
lib$(TARGET)_root.a \
|
||||
lib$(TARGET)_debugging.a \
|
||||
lib$(TARGET)_listpart.a \
|
||||
lib$(TARGET)_partitiontool.a
|
||||
|
||||
# other directories in the out directory
|
||||
IN_OUT_DIR := \
|
||||
$(BINARY_DIR) \
|
||||
$(PACKAGE_DIR) \
|
||||
$(STATICLIB_DIR)
|
||||
|
||||
# list of file/directory to be checked when the deb pack is created
|
||||
DEB_CHECKS := \
|
||||
$(DEBUTILS_DIR)/ \
|
||||
$(DEBUTILS_DIR)/DEBIAN \
|
||||
$(DEBUTILS_DIR)/DEBIAN/control_32 \
|
||||
$(DEBUTILS_DIR)/DEBIAN/control_64 \
|
||||
$(DEBUTILS_DIR)/mandoc \
|
||||
$(DEBUTILS_DIR)/mandoc/$(TARGET).8.gz \
|
||||
$(DEBUTILS_DIR)/data \
|
||||
$(DEBUTILS_DIR)/data/data \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux/files \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux/files/usr \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux/files/usr/bin \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux/files/usr/share \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux/files/usr/share/man \
|
||||
$(DEBUTILS_DIR)/data/data/com.termux/files/usr/share/man/man8
|
||||
|
||||
# for running make with silent mode
|
||||
MAKE_HIDE := @ $(MAKE)
|
||||
SILENT := -s
|
||||
E := @ echo
|
||||
E_NS := echo
|
||||
P := printf
|
||||
|
||||
# color definations
|
||||
RESET := \033[0m
|
||||
RED := \033[0;31m
|
||||
GREEN := \033[0;32m
|
||||
YELLOW := \033[0;33m
|
||||
|
||||
# end
|
||||
68
README.md
68
README.md
@@ -2,42 +2,56 @@
|
||||
|
||||
[](https://github.com/ShawkTeam/pmt/actions/workflows/check_commits.yml)
|
||||
|
||||
This binary, written in C, is for writing/reading and formatting on Android partitions.
|
||||
## Work continues on the renovated pmt! You can check it out now :) [ShawkTeam/pmt-renovated](https://github.com/ShawkTeam/pmt-renovated)
|
||||
|
||||
#### Presented arguments (options)
|
||||
This binary, written with C++, is for managing (partition) table, writing/reading, formatting and getting size on Android partitions.
|
||||
|
||||
```
|
||||
Usage: pmt backup PARTITION [OUTPUT] [OPTIONS]...
|
||||
or: pmt flash PARTITION FILE [OPTIONS]...
|
||||
or: pmt format PARTITION FILE_SYSTEM[ext/2/3/4] [OPTIONS]...
|
||||
Usage: pmt [OPTIONS] start-parted [DEVICE]...
|
||||
or: pmt [OPTIONS] backup PARTITION [OUTPUT] [OPTIONS]...
|
||||
or: pmt [OPTIONS] flash PARTITION FILE [OPTIONS]...
|
||||
or: pmt [OPTIONS] format PARTITION FILE_SYSTEM[ext/2/3/4] [OPTIONS]...
|
||||
or: pmt [OPTIONS] partition-size PARTITION [OPTIONS]...
|
||||
|
||||
Options:
|
||||
-l, --logical It is meant to determine whether the target partition is logical.
|
||||
-c, --context It is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name).
|
||||
-P, --search-path It is meant to specify a custom partition search path. Only normal partitions (default: /dev/block/by-name).
|
||||
-p, --list List partitions.
|
||||
-s, --silent Information and warning messages are silenced in normal work.
|
||||
-f, --force Force mode. Some things are ignored.
|
||||
-V, --verbose Verbose mode. Print detailed informations etc.
|
||||
-S, --set-lang Set current language.
|
||||
-U, --view-langs See supported languages.
|
||||
-v, --version See version.
|
||||
--help See this help message.
|
||||
|
||||
partition-size flags:
|
||||
--only-size Only the size is displayed, the partition name etc is not displayed.
|
||||
--as-byte Display size as byte.
|
||||
--as-kilobyte Display size as kilobyte.
|
||||
--as-megabyte Display size as megabyte.
|
||||
--as-gigabyte Display size as gigabyte.
|
||||
|
||||
Examples:
|
||||
pmt backup boot_a -c /dev/block/platform/bootdevice/by-name
|
||||
pmt backup boot_a -P /dev/block/platform/bootdevice/by-name
|
||||
pmt flash boot_a /sdcard/twrp/boot.img -c /dev/block/platform/bootdevice/by-name
|
||||
pmt format system_a ext4 --logical
|
||||
pmt -c /dev/block/platform/bootdevice/by-name --list
|
||||
pmt -P /dev/block/platform/bootdevice/by-name --list
|
||||
pmt partition-size boot --as-byte
|
||||
pmt partition-size system --only-size --as-gigabyte --logical
|
||||
|
||||
Report bugs to <t.me/ShawkTeam | Topics | pmt>
|
||||
Report bugs and suggestions to <t.me/ShawkTeam | Topics | pmt>
|
||||
```
|
||||
|
||||
#### Some notes
|
||||
|
||||
- pmt supports multiple languages. [See languages.](https://github.com/ShawkTeam/pmt/blob/2.6.0/LANGUAGES.md)
|
||||
- [Add language.](https://github.com/ShawkTeam/pmt/blob/2.6.0/ADD-LANGUAGES.md)
|
||||
- See the [guide](https://github.com/ShawkTeam/pmt/blob/3.0.2/INSTALLING.md) for installation (`INSTALLING.md`).
|
||||
- pmt supports multiple languages. [See languages.](https://github.com/ShawkTeam/pmt/blob/3.0.2/LANGUAGES.md)
|
||||
- [Add a language!](https://github.com/ShawkTeam/pmt/blob/3.0.2/ADD-LANGUAGES.md)
|
||||
- Feel free to ask any questions you want.
|
||||
- Packages are available in publications.
|
||||
- If the logical partition flag is not used, a classic partition is tried to be processing by default.
|
||||
- [Click to see special version changes.](https://github.com/ShawkTeam/pmt/blob/2.6.0/CHANGELOG.md)
|
||||
- [Click to see special version changes.](https://github.com/ShawkTeam/pmt/blob/3.0.2/CHANGELOG.md)
|
||||
- We are always open to your suggestions and support (developing)!
|
||||
|
||||
### How is it built?
|
||||
@@ -47,16 +61,11 @@ Make or Android NDK is required to build.
|
||||
- [Download Android NDK](https://developer.android.com/ndk/downloads) and extract the NDK package.
|
||||
- Clone this repository. And get access to it.
|
||||
```
|
||||
git clone https://github.com/ShawkTeam/pmt -b 2.6.0
|
||||
git clone https://github.com/ShawkTeam/pmt -b 3.0.2
|
||||
cd pmt
|
||||
```
|
||||
- Set the NDK working directory variable.
|
||||
```
|
||||
make gen-ndk-makefiles
|
||||
# If you fail the audit, etc., use FORCE_GEN.
|
||||
# Example:
|
||||
make gen-ndk-makefiles FORCE_GEN=true
|
||||
|
||||
# Required by Android NDK
|
||||
export NDK_PROJECT_PATH="${PWD}"
|
||||
```
|
||||
@@ -86,29 +95,6 @@ cd "${NDK_PROJECT_PATH}" \
|
||||
pmt pmt
|
||||
```
|
||||
|
||||
##### Build with Makefiles
|
||||
|
||||
```
|
||||
make
|
||||
|
||||
# To specify clang, just use CC=<clang> next to the command (and same logic in AR)
|
||||
# Example:
|
||||
make CC=${PWD}/../toolchain/bin/clang-18
|
||||
make AR=${PWD}/../toolchain/bin/ar
|
||||
make CC=${PWD}/../toolchain/bin/clang-18 AR=${PWD}/../toolchain/bin/ar
|
||||
|
||||
# Use termux :D
|
||||
```
|
||||
- For the make installable debian package:
|
||||
|
||||
```
|
||||
make deb <ARCH_NUM>
|
||||
|
||||
# Examples
|
||||
make deb FOR_THIS=64
|
||||
make deb FOR_THIS=32
|
||||
```
|
||||
|
||||
### Notes
|
||||
If you want to change something, take a look at the configuration. You can change him.
|
||||
it is located in the `build/config` folder. His name is `env.mk`. I gave the information in the file. You can ask more.
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
### Installing pmt deb packages in Termux
|
||||
|
||||
It's pretty simple.
|
||||
|
||||
###### Package selection
|
||||
- If the device is 64 bit, you should choose `arm64-v8a` package. If not, choose `armeabi-v7a` package.
|
||||
- And of course download it.
|
||||
|
||||
###### Setup
|
||||
- Access downloads or wherever the package is located.
|
||||
```
|
||||
# Access downloads
|
||||
cd /sdcard/Download
|
||||
```
|
||||
- Now it's time to set up.
|
||||
```
|
||||
Syntax:
|
||||
apt install ./pmt-<VARIANT>.deb
|
||||
|
||||
Examples:
|
||||
apt install ./pmt-armeabi-v7a.deb
|
||||
apt install ./pmt-arm64-v8a.deb
|
||||
```
|
||||
- And enjoy!
|
||||
@@ -1,6 +0,0 @@
|
||||
NDK_PROG=false
|
||||
FORCE_GEN=false
|
||||
THIS_IS=main
|
||||
UPDATE_MAKEFILES=false
|
||||
SOURCE_DIRNAME=src
|
||||
OUT_DIRNAME=out
|
||||
@@ -1,36 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
[ ! "${THIS_IS}" = "main" ] && abort "The caller is not the main makefile. Something's wrong."
|
||||
|
||||
try_with="Try with force mode (FORCE_GEN=true)."
|
||||
|
||||
if [ "${NDK_PROG}" = "true" ]; then
|
||||
mfiles=("${SOURCE_DIR}/Android.mk" "${SOURCE_DIR}/Application.mk")
|
||||
else
|
||||
mfiles=("${OUT_DIR}/Makefile" "${SOURCE_DIR}/Makefile")
|
||||
fi
|
||||
|
||||
for mfile in ${mfiles[0]} ${mfiles[1]}; do
|
||||
|
||||
[ -f "${mfile}" ] && \
|
||||
if [ "${FORCE_GEN}" = "true" ]; then
|
||||
rm -f "${mfile}"
|
||||
else
|
||||
abort "$(output=$(dirname ${mfile}) && basename "${output}")/$(basename ${mfile}) exits."
|
||||
fi
|
||||
|
||||
done
|
||||
@@ -1,42 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
. build/bash/vars
|
||||
. build/bash/functions
|
||||
|
||||
[ ! "${THIS_IS}" = "main" ] && abort "The caller is not the main makefile. Something's wrong."
|
||||
|
||||
if [ "${NDK_PROG}" = "true" ]; then
|
||||
|
||||
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing Android.mk..."
|
||||
rm -f ${SOURCE_DIR}/Android.mk
|
||||
|
||||
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing Application.mk..."
|
||||
rm -f ${SOURCE_DIR}/Application.mk
|
||||
|
||||
else
|
||||
|
||||
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Info: Main makefile won't be deleted."
|
||||
|
||||
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing output directory makefile..."
|
||||
rm -f ${OUT_DIR}/Makefile
|
||||
|
||||
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Removing source directory makefile"
|
||||
rm -f ${SOURCE_DIR}/Makefile
|
||||
|
||||
fi
|
||||
|
||||
[ "${UPDATE_MAKEFILES}" = "true" ] || print " - Success."
|
||||
@@ -1,37 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
function abort()
|
||||
{
|
||||
[ -n "$1" ] && echo -e " - ${RED}${BOLD}Error:${BOLD_RESET}${RESET} $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function read_file()
|
||||
{
|
||||
cat "$1" >> "$2" || abort "failed to read/write $1/$2"
|
||||
}
|
||||
|
||||
function gen()
|
||||
{
|
||||
[ "${FORCE_GEN}" = "true" -a "${UPDATE_MAKEFILES}" = "true" ] && rm -f "$1"
|
||||
touch "$1" || abort "failed to generate: $1"
|
||||
}
|
||||
|
||||
function print()
|
||||
{
|
||||
echo -e "$1"
|
||||
}
|
||||
@@ -14,16 +14,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
[ -z ${NDK_ROOT_DIR} ] && \
|
||||
echo "Please set NDK_ROOT_DIR variable!" && \
|
||||
exit 1
|
||||
[ -z ${NDK_ROOT_DIR} ] \
|
||||
&& echo "Please set NDK_ROOT_DIR variable!" \
|
||||
&& exit 1
|
||||
|
||||
[ -z ${NDK_PROJECT_PATH} ] && \
|
||||
echo "Please set NDK_PROJECT_PATH variable!" && \
|
||||
exit 1
|
||||
[ -z ${NDK_PROJECT_PATH} ] \
|
||||
&& echo "Please set NDK_PROJECT_PATH variable!" \
|
||||
&& exit 1
|
||||
|
||||
CC_IS="${NDK_ROOT_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"
|
||||
CC_VERS=$(${CC_IS} --version | head -n 1)
|
||||
CXX_IS="${NDK_ROOT_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang++"
|
||||
CXX_VERS=$(${CXX_IS} --version | head -n 1)
|
||||
|
||||
mkdir -p ${NDK_PROJECT_PATH}/include/pmt/generated
|
||||
echo -e "#define __NDK_CC_VERSION__ \"${CC_VERS}\"" > ${NDK_PROJECT_PATH}/include/pmt/generated/clang-version.h
|
||||
mkdir -p ${NDK_PROJECT_PATH}/include/PartitionManager/generated
|
||||
echo -e "#define __NDK_CXX_VERSION__ \"${CXX_VERS}\"" > ${NDK_PROJECT_PATH}/include/PartitionManager/generated/clang-version.h
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
. build/bash/vars
|
||||
. build/bash/functions
|
||||
|
||||
[ ! "${UPDATE_MAKEFILES}" = "true" ] && . build/bash/check-makefiles
|
||||
[ ! "${THIS_IS}" = "main" ] && abort "The caller is not the main makefile. Something's wrong."
|
||||
|
||||
if [ "${UPDATE_MAKEFILES}" = "true" ]; then
|
||||
GENR="Re-generating"
|
||||
else
|
||||
GENR="Generating"
|
||||
fi
|
||||
|
||||
if [ "${NDK_PROG}" = "true" ]; then
|
||||
|
||||
gen "${SOURCE_DIR}/Android.mk"
|
||||
gen "${SOURCE_DIR}/Application.mk"
|
||||
|
||||
else
|
||||
|
||||
gen "${CUR_DIR}/Makefile"
|
||||
gen "${OUT_DIR}/Makefile"
|
||||
gen "${SOURCE_DIR}/Makefile"
|
||||
|
||||
fi
|
||||
|
||||
if [ "${NDK_PROG}" = "true" ]; then
|
||||
|
||||
print " - ${GENR} Android.mk..."
|
||||
read_file "${OTHERS}/makefile.androidmk" "${SOURCE_DIR}/Android.mk"
|
||||
|
||||
print " - ${GENR} Application.mk"
|
||||
read_file "${OTHERS}/makefile.applicationmk" "${SOURCE_DIR}/Application.mk"
|
||||
|
||||
else
|
||||
|
||||
print " - Re-generating main makefile..."
|
||||
rm -f "${CUR_DIR}/Makefile"
|
||||
read_file "${OTHERS}/makefile.main" "${CUR_DIR}/Makefile"
|
||||
|
||||
print " - ${GENR} output directory makefile..."
|
||||
read_file "${OTHERS}/makefile.outdir" "${OUT_DIR}/Makefile"
|
||||
|
||||
print " - ${GENR} source directory makefile..."
|
||||
read_file "${OTHERS}/makefile.sourcedir" "${SOURCE_DIR}/Makefile"
|
||||
|
||||
fi
|
||||
|
||||
print " - Success."
|
||||
@@ -1,33 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
. build/bash/additional-vars
|
||||
|
||||
CUR_DIR=$(pwd)
|
||||
SOURCE_DIR=${CUR_DIR}/${SOURCE_DIRNAME}
|
||||
OUT_DIR=${CUR_DIR}/${OUT_DIRNAME}
|
||||
BUILD=${CUR_DIR}/build
|
||||
BASH_DIR=$(pwd)
|
||||
OTHERS=${BUILD}/others
|
||||
TOOLS=${BUILD}/tools
|
||||
|
||||
# font types, colors etc
|
||||
BOLD="\e[1m"
|
||||
BOLD_RESET="\e[0m"
|
||||
RESET="\033[0m"
|
||||
RED="\033[0;31m"
|
||||
GREEN="\033[0;32m"
|
||||
YELLOW="\033[0;33m"
|
||||
@@ -1 +0,0 @@
|
||||
INSTALL_SUCCESS := true
|
||||
@@ -1,52 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include env.mk
|
||||
|
||||
#########################################
|
||||
# #
|
||||
# Apply Configuration #
|
||||
# #
|
||||
# Warning: please do not edit #
|
||||
# #
|
||||
#########################################
|
||||
|
||||
CC = clang
|
||||
CFLAGS ?= "-O3 -I../include -std=c11 -pedantic -Wall -Wextra -Werror -Wno-nullability-extension -Wno-gnu-zero-variadic-macro-arguments $(PMT_EXTRA_CFLAGS)"
|
||||
|
||||
# set compiler setting (clang-gcc and ar)
|
||||
ifneq ($(PMT_CC),)
|
||||
CC ?= $(PMT_CC)
|
||||
else
|
||||
CC ?= clang
|
||||
endif
|
||||
|
||||
ifneq ($(PMT_AR),)
|
||||
AR ?= $(PMT_AR)
|
||||
else
|
||||
AR ?= ar
|
||||
endif
|
||||
|
||||
# compiler flags settings
|
||||
ifneq ($(PMT_ENABLE_DEBUG),)
|
||||
CFLAGS += -gdwarf-5 -fsanitize=address
|
||||
endif
|
||||
|
||||
# write current env configuration to oldenv.mk
|
||||
all:
|
||||
@ echo "CC := $(CC)" > oldenv.mk
|
||||
@ echo "AR := $(AR)" >> oldenv.mk
|
||||
@ echo "CFLAGS := $(CFLAGS)" >> oldenv.mk
|
||||
@@ -1 +0,0 @@
|
||||
UNINSTALLED_SUCCESS :=
|
||||
@@ -18,21 +18,15 @@
|
||||
# #
|
||||
# Configuration Flags #
|
||||
# #
|
||||
# Warning: you can edit #
|
||||
# you can edit #
|
||||
# #
|
||||
#########################################
|
||||
|
||||
# speficy c compiler (cc)
|
||||
PMT_CC ?=
|
||||
|
||||
# speficy ar
|
||||
PMT_AR ?=
|
||||
|
||||
# addionital compiler flags
|
||||
PMT_EXTRA_CFLAGS ?=
|
||||
PMT_EXTRA_CXXFLAGS ?=
|
||||
|
||||
# debugging mode (binary). it's enabling address sanitizer and source level debug information with dwarf version 5
|
||||
PMT_ENABLE_DEBUG ?=
|
||||
|
||||
#########################################
|
||||
#########################################
|
||||
#########################################
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
Source: pmt
|
||||
Package: pmt
|
||||
Version: 2.6.0
|
||||
Architecture: arm
|
||||
Description: pmt is for reading, writing and formatting partitions of android devices
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Maintainer: YZBruh <yagizzengin73@gmail.com>
|
||||
Standards-Version: 4.5.0
|
||||
@@ -1,9 +0,0 @@
|
||||
Source: pmt
|
||||
Package: pmt
|
||||
Version: 2.6.0
|
||||
Architecture: aarch64
|
||||
Description: pmt is for reading, writing and formatting partitions of android devices
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Maintainer: YZBruh <yagizzengin73@gmail.com>
|
||||
Standards-Version: 4.5.0
|
||||
@@ -1,99 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#####
|
||||
# sub-make for making deb package
|
||||
#####
|
||||
|
||||
THIS_IS := debutils
|
||||
|
||||
# include needed variables
|
||||
include ../../Makefile.inc
|
||||
|
||||
TEMP_DIR := $(DEBUTILS_DIR)/template
|
||||
|
||||
ifeq ($(FOR_THIS),64)
|
||||
DEB_ARCH_NAME := arm64-v8a
|
||||
else ifeq ($(FOR_THIS),32)
|
||||
DEB_ARCH_NAME := armeabi-v7a
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard /dev/block/by-name),)
|
||||
SUDO := su -c
|
||||
else ifeq ($(wildcard /system/build.prop),)
|
||||
SUDO := sudo
|
||||
else
|
||||
SUDO :=
|
||||
endif
|
||||
|
||||
PROGRESS_LIST := \
|
||||
startup \
|
||||
$(DEB_CHECKS) \
|
||||
check_binary \
|
||||
prepare \
|
||||
make_debian_pack
|
||||
|
||||
# make deb package
|
||||
all: $(PROGRESS_LIST)
|
||||
|
||||
startup:
|
||||
$(E) " --------- Making deb package --------- "
|
||||
@ rm -rf $(TEMP_DIR)
|
||||
$(E) " - Checking files and directories (only neededs)..."
|
||||
|
||||
prepare:
|
||||
$(E) " - Copying files..."
|
||||
@ cp -r $(DEBUTILS_DIR)/data $(TEMP_DIR) || exit 1
|
||||
@ rm -f $(DEBTERMUX_USR)/share/man/man8/dummy
|
||||
@ rm -f $(DEBTERMUX_USR)/bin/dummy
|
||||
@ mkdir $(TEMP_DIR)/DEBIAN
|
||||
|
||||
check_binary:
|
||||
@ if [ ! -f "$(BINARY_DIR)/pmt" ]; then \
|
||||
$(E_NS) " - pmt not builded! Please build and retry."; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(E) " - Generating template directory..."
|
||||
@ mkdir $(TEMP_DIR)
|
||||
$(E) " - Generating debian package directory..."
|
||||
@ mkdir $(DEB_DIR)
|
||||
|
||||
make_debian_pack:
|
||||
@ abort() { \
|
||||
[ -d $(TEMP_DIR) ] \
|
||||
&& rm -rf $(TEMP_DIR); \
|
||||
[ -d $(DEB_DIR) ] \
|
||||
&& rm -rf $(DEB_DIR); \
|
||||
exit 1; \
|
||||
}; \
|
||||
if [ ! "$(FOR_THIS)" = "64" ] && [ ! "$(FOR_THIS)" = "32" ]; then \
|
||||
$(E_NS) " - Invalid arch number: $(FOR_THIS) [maybe null]" && abort; \
|
||||
fi; \
|
||||
$(E_NS) " - Selected arm-$(FOR_THIS) package control file."; \
|
||||
cp $(DEBUTILS_DIR)/DEBIAN/control_$(FOR_THIS) $(TEMP_DIR)/DEBIAN/control || abort; \
|
||||
cp $(DEBUTILS_DIR)/mandoc/$(TARGET).8.gz $(DEBTERMUX_USR)/share/man/man8 || abort; \
|
||||
cp $(BINARY_DIR)/$(TARGET) $(DEBTERMUX_USR)/bin || abort; \
|
||||
$(E_NS) " - Starting dpkg-deb..."; \
|
||||
sleep 2; \
|
||||
$(SUDO) chmod -R 755 *; \
|
||||
dpkg-deb -b $(TEMP_DIR) $(DEB_DIR)/$(TARGET)-$(DEB_ARCH_NAME).deb || abort; \
|
||||
rm -rf $(TEMP_DIR); \
|
||||
$(E_NS) " - Done!"
|
||||
|
||||
$(DEBUTILS_DIR)/%:
|
||||
@ [ ! -e "$@" ] && $(E_NS) " - Check failed! Not found: $@" && exit 1
|
||||
|
||||
# end
|
||||
Binary file not shown.
126
build/main.mk
126
build/main.mk
@@ -1,126 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
UPDATE_MAKEFILES = false
|
||||
|
||||
all:
|
||||
$(MAKE_HIDE) $(SILENT) -C $(BUILD)/config || exit 1
|
||||
$(MAKE_HIDE) $(SILENT) -C $(SOURCE_DIRNAME) INC_OLDENV=true || exit 1
|
||||
|
||||
# cleaner functions
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(E) "Cleaning directories..."
|
||||
@ if [ -d $(BINARY_DIR) ]; then \
|
||||
$(E_NS) "==> $(OUT_DIRNAME)/`basename $(BINARY_DIR)`"; \
|
||||
fi
|
||||
@ if [ -d $(PACKAGE_DIR) ]; then \
|
||||
$(E_NS) "==> $(OUT_DIRNAME)/`basename $(PACKAGE_DIR)`"; \
|
||||
fi
|
||||
@ if [ -d $(STATICLIB_DIR) ]; then \
|
||||
$(E_NS) "==> $(OUT_DIRNAME)/`basename $(STATICLIB_DIR)`"; \
|
||||
fi
|
||||
@ if [ -d $(DEB_DIR) ]; then \
|
||||
$(E_NS) "==> $(OUT_DIRNAME)/`basename $(DEB_DIR)`"; \
|
||||
fi
|
||||
@ rm -rf $(IN_OUT_DIR)
|
||||
@ rm -rf $(DEB_DIR)
|
||||
@ sleep 2
|
||||
$(MAKE_HIDE) $(SILENT) -C $(SOURCE_DIRNAME) clean INC_OLDENV=false || exit 1
|
||||
@ sleep 1
|
||||
$(E) "Success."
|
||||
|
||||
# helper function
|
||||
.PHONY: help
|
||||
help:
|
||||
$(E) " ------- Partition Manager help ------- " && $(E_NS)
|
||||
$(E) " Commands:"
|
||||
$(E) " $(MAKE) ==> Build Partition Manager."
|
||||
$(E) " $(MAKE) deb ==> Generate debian package for termux."
|
||||
$(E) " $(MAKE) clean ==> Clear builded binary."
|
||||
$(E) " $(MAKE) install ==> It installs $(TARGET) into termux."
|
||||
$(E) " $(MAKE) uninstall ==> It uninstalls $(TARGET) into termux."
|
||||
$(E) " $(MAKE) gen-makefiles ==> Generate makefiles for build."
|
||||
$(E) " $(MAKE) gen-ndk-makefiles ==> Generate NDK makefiles for build."
|
||||
$(E) " $(MAKE) clean-makefiles ==> Cleanup makefiles."
|
||||
$(E) " $(MAKE) clean-ndk-makefiles ==> Cleanup NDK makefiles."
|
||||
$(E) " $(MAKE) update-makefiles ==> Re-generate makefiles."
|
||||
$(E) " $(MAKE) update-ndk-makefiles ==> Re-generate NDK makefiles."
|
||||
$(E) " $(MAKE) help ==> Display this help message." && $(E_NS)
|
||||
|
||||
# deb maker
|
||||
.PHONY: deb
|
||||
deb:
|
||||
$(MAKE_HIDE) $(SILENT) -C $(DEBUTILS_DIR) -f deb.mk FOR_THIS=$(FOR_THIS) || exit 1
|
||||
$(P) ""
|
||||
|
||||
# install pmt in to termux
|
||||
.PHONY: install
|
||||
install:
|
||||
$(eval PROG := $@)
|
||||
$(MAKE_HIDE) $(SILENT) -C $(OUT_DIRNAME) install PROG=$(PROG) || exit 1
|
||||
|
||||
# uninstall pmt in to termux
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
$(eval PROG := $@)
|
||||
$(MAKE_HIDE) $(SILENT) -C $(OUT_DIRNAME) uninstall PROG=$(PROG) || exit 1
|
||||
|
||||
# clean ndk makefiles
|
||||
.PHONY: gen-ndk-makefiles
|
||||
gen-ndk-makefiles:
|
||||
$(eval NDK_PROG = true)
|
||||
$(call save-gen-vars)
|
||||
$(call gen-ndk-mfiles)
|
||||
@ $(P) ""
|
||||
|
||||
.PHONY: gen-makefiles
|
||||
gen-makefiles:
|
||||
$(call save-gen-vars)
|
||||
$(call gen-mfiles)
|
||||
@ $(P) ""
|
||||
|
||||
.PHONY: update-ndk-makefiles
|
||||
update-ndk-makefiles:
|
||||
$(E) " ------ Updating NDK makefiles ------ "
|
||||
$(eval NDK_PROG = true)
|
||||
$(eval UPDATE_MAKEFILES = true)
|
||||
$(call save-gen-vars)
|
||||
$(call clean-ndk-mfiles)
|
||||
$(call gen-ndk-mfiles)
|
||||
|
||||
.PHONY: update-makefiles
|
||||
update-makefiles:
|
||||
$(E) " ------ Updating makefiles ------ "
|
||||
$(eval UPDATE_MAKEFILES = true)
|
||||
$(call save-gen-vars)
|
||||
$(call clean-ndk-mfiles)
|
||||
$(call gen-mfiles)
|
||||
|
||||
.PHONY: clean-ndk-makefiles
|
||||
clean-ndk-makefiles:
|
||||
$(eval NDK_PROG = true)
|
||||
$(call save-gen-vars)
|
||||
$(call clean-ndk-mfiles)
|
||||
@ $(P) ""
|
||||
|
||||
.PHONY: clean-makefiles
|
||||
clean-makefiles:
|
||||
$(call save-gen-vars)
|
||||
$(call clean-mfiles)
|
||||
@ $(P) ""
|
||||
|
||||
# end
|
||||
159
build/mandoc/mandoc
Executable file
159
build/mandoc/mandoc
Executable file
@@ -0,0 +1,159 @@
|
||||
.\" By YZBruh
|
||||
|
||||
.\" Copyright 2024 Partition Manager
|
||||
.\"
|
||||
.\" Licensed under the Apache License, Version 2.0 (the "License");
|
||||
.\" you may not use this file except in compliance with the License.
|
||||
.\" You may obtain a copy of the License at
|
||||
.\"
|
||||
.\" http://www.apache.org/licenses/LICENSE-2.0
|
||||
.\"
|
||||
.\" Unless required by applicable law or agreed to in writing, software
|
||||
.\" distributed under the License is distributed on an "AS IS" BASIS,
|
||||
.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
.\" See the License for the specific language governing permissions and
|
||||
.\" limitations under the License.
|
||||
.\"
|
||||
.TH "PMT" "8" "December 2024" "PMT 3.0.2" "Partition Manager"
|
||||
.SH NAME
|
||||
.B pmt
|
||||
\- Android Partition Manager Tool
|
||||
.SH SYNOSIS
|
||||
.B pmt
|
||||
[
|
||||
.I {OPTIONS}
|
||||
.B backup
|
||||
.I PARTITION {OUTPUT} {OPTIONS}...
|
||||
]
|
||||
[
|
||||
.I {OPTIONS}
|
||||
.B flash
|
||||
.I PARTITION FILE {OPTIONS}...
|
||||
]
|
||||
[
|
||||
.I {OPTIONS}
|
||||
.B format
|
||||
.I PARTITION FILE_SYSTEM{ext/2/3/4} {OPTIONS}...
|
||||
]
|
||||
[
|
||||
.I {OPTIONS}
|
||||
.B partition-size
|
||||
.I PARTITION {OPTIONS}...
|
||||
]
|
||||
[
|
||||
.I {OPTIONS}
|
||||
.B start-parted
|
||||
.I \[DEVICE\] {OPTIONS}
|
||||
]
|
||||
[
|
||||
.B \-l
|
||||
|
|
||||
.B \-\-logical
|
||||
]
|
||||
[
|
||||
.B \-P
|
||||
|
|
||||
.B \-\-search\-path
|
||||
.I search\-path
|
||||
]
|
||||
[
|
||||
.B \-p
|
||||
|
|
||||
.B \-\-list
|
||||
]
|
||||
[
|
||||
.B \-s
|
||||
|
|
||||
.B \-\-silent
|
||||
]
|
||||
[
|
||||
.B \-V
|
||||
|
|
||||
.B \-\-verbose
|
||||
]
|
||||
[
|
||||
.B \-f
|
||||
|
|
||||
.B \-\-force
|
||||
]
|
||||
[
|
||||
.B \-S
|
||||
|
|
||||
.B \-\-set\-language
|
||||
]
|
||||
[
|
||||
.B \-v
|
||||
|
|
||||
.B \-\-version
|
||||
]
|
||||
[
|
||||
.B \-\-help
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.B pmt
|
||||
is a tool made to professionaly manage with parted, read android parts, make flash and format. Written with C++ language. It was first created as only a hobby but subsequently serialized
|
||||
.PP
|
||||
.SH OPTIONS
|
||||
.sp
|
||||
\fB\-l\fP, \fB\-\-logical\fP
|
||||
.RS 4
|
||||
It is meant to determine whether the target partition is logical.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-c\fP, \fB\-\-context\fP
|
||||
.RS 4
|
||||
It is meant to specify a custom /dev context. Only classic partitions (default: /dev/block/by-name)
|
||||
.RE
|
||||
.sp
|
||||
\fB\-p\fP, \fB\-\-list\fP
|
||||
.RS 4
|
||||
List partitions.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-s\fP, \fB\-\-silent\fP
|
||||
.RS 4
|
||||
Information and warning messages are silenced in normal work.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-V\fP, \fB\-\-verbose
|
||||
.RS 4
|
||||
Verbose mode. Print detailed informations etc.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-f\fP, \fB\-\-force\fP
|
||||
.RS 4
|
||||
Force mode. Some things are ignored.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-S\fP, \fB\-\-set\-language\fP
|
||||
.RS 4
|
||||
Set current language.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-v\fP, \fB\-\-version\fP
|
||||
.RS 4
|
||||
See version info.
|
||||
.RE
|
||||
.sp
|
||||
\fB\-\-help\fP
|
||||
.RS 4
|
||||
See help message.
|
||||
.SH EXAMPLES
|
||||
.B pmt
|
||||
backup boot_a -c /dev/block/platform/bootdevice/by-name
|
||||
.sp
|
||||
.B pmt
|
||||
flash boot_a /sdcard/twrp/boot.img -c /dev/block/platform/bootdevice/by-name
|
||||
.sp
|
||||
.B pmt
|
||||
format system_a ext4 --logical
|
||||
.sp
|
||||
.B pmt
|
||||
-c /dev/block/platform/bootdevice/by-name --list
|
||||
.SH AUTHOR
|
||||
This version of
|
||||
.B pmt
|
||||
has been written by YZBruh <github.com/YZBruh>
|
||||
.SH BUGS
|
||||
Report bugs to <t.me/ShawkTeam | Topics | pmt>
|
||||
.PP
|
||||
@@ -1,98 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
########
|
||||
# 2.6.0
|
||||
########
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(LOCAL_PATH)/../build/config/env.mk
|
||||
|
||||
PMT_CFLAGS = \
|
||||
-O3 \
|
||||
-std=c11 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-Wno-nullability-extension \
|
||||
-Wno-gnu-zero-variadic-macro-arguments \
|
||||
-D__NDK_BUILD \
|
||||
$(EXTRA_COMPILER_FLAGS)
|
||||
|
||||
ifneq ($(PMT_ENABLE_DEBUG),)
|
||||
PMT_CFLAGS += -gdwarf-5 -fsanitize=address -fsanitize=undefined
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_root
|
||||
LOCAL_SRC_FILES := root.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_debugging
|
||||
LOCAL_SRC_FILES := debugging.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_partitiontool
|
||||
LOCAL_SRC_FILES := partitiontool.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libpmt_list
|
||||
LOCAL_SRC_FILES := listpart.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := pmt
|
||||
LOCAL_SRC_FILES := \
|
||||
pmt.c \
|
||||
versioning.c \
|
||||
get_stat.c \
|
||||
tools.c \
|
||||
lang_tools.c \
|
||||
languages.c \
|
||||
help.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libpmt_root \
|
||||
libpmt_debugging \
|
||||
libpmt_partitiontool \
|
||||
libpmt_list
|
||||
LOCAL_CFLAGS := $(PMT_CFLAGS)
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# end
|
||||
@@ -1,26 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
THIS_IS = main
|
||||
NDK_PROG ?= false
|
||||
FORCE_GEN ?= false
|
||||
|
||||
# include needed variables
|
||||
include Makefile.inc
|
||||
include $(TOOLS)/gen-makefiles.mk
|
||||
include $(TOOLS)/clean-makefiles.mk
|
||||
|
||||
include $(BUILD)/main.mk
|
||||
@@ -1,151 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#####
|
||||
# sub-make for installing-uninstalling
|
||||
#####
|
||||
|
||||
THIS_IS := out
|
||||
|
||||
# include needed variables
|
||||
include ../Makefile.inc
|
||||
-include $(BUILD)/config/INS_STAT.mk
|
||||
-include $(BUILD)/config/UNINS_STAT.mk
|
||||
|
||||
INSTALL_PROGRESS_LIST := \
|
||||
really_termux \
|
||||
welcome \
|
||||
check_ins_stat \
|
||||
deb_installer \
|
||||
really_builded \
|
||||
install_binary
|
||||
|
||||
UNINSTALL_PROGRESS_LIST := \
|
||||
really_termux \
|
||||
welcome \
|
||||
check_unins_stat \
|
||||
uninstall_$(TARGET)
|
||||
|
||||
# create an empty target
|
||||
all:
|
||||
$(P) ""
|
||||
|
||||
# installer
|
||||
.PHONY: install
|
||||
install: $(INSTALL_PROGRESS_LIST)
|
||||
|
||||
# uninstaller
|
||||
.PHONY: uninstall
|
||||
uninstall: $(UNINSTALL_PROGRESS_LIST)
|
||||
|
||||
install_binary:
|
||||
$(E) " - Installing binary..."
|
||||
if cp $(BINARY_DIR)/$(TARGET) /data/data/com.termux/files/usr/bin/$(TARGET); then \
|
||||
$(E_NS) " - Setting up permissions..."; \
|
||||
else \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if chmod 777 $(TERMUX_BIN)/$(TARGET); then \
|
||||
$(E_NS) " - Saving current status..."; \
|
||||
$(E_NS) "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
|
||||
uninstall_$(TARGET):
|
||||
if [ -f $(TERMUX_USR)/share/man/man8/$(TARGET).8.gz ]; then \
|
||||
$(E_NS) " - It was found to be established by $(TARGET)'s deb pack. It's removed with apt..."; \
|
||||
apt remove -y $(TARGET) || exit 1; \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
$(E_NS) "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
$(E_NS) " - It was found that pmt was manually established (with this makefile or copying). Manually removed..."; \
|
||||
if rm $(TERMUX_BIN)/$(TARGET); then \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
$(E_NS) "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := false" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
deb_installer:
|
||||
if [ -f $(DEB_DIR)/*.deb ]; then \
|
||||
$(E_NS) " - The created deb pack was found. It's setup..."; \
|
||||
cd $(DEB_DIR) || exit 1; \
|
||||
apt install ./*.deb || exit 1; \
|
||||
if [ ! "$?" = "0" ]; then \
|
||||
cd $(CUR_DIR); \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 0; \
|
||||
else \
|
||||
cd $(CUR_DIR); \
|
||||
$(P) " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) installing failed!\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
check_ins_stat:
|
||||
@ if [ ! "$(INSTALL_SUCCESS)" = "true" ] && [ ! "$(INSTALL_SUCCESS)" = "" ]; then \
|
||||
$(P) " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed installation process found\n"; \
|
||||
fi
|
||||
|
||||
check_unins_stat:
|
||||
@ if [ ! "$(UNINSTALL_SUCCESS)" = "true" ] && [ ! "$(UNINSTALL_SUCCESS)" = "" ]; then \
|
||||
$(P) " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed uninstallation process found\n"; \
|
||||
fi
|
||||
|
||||
welcome:
|
||||
$(E) " ----------- $(TARGET) $(PROG)er ----------- "
|
||||
@ if [ "$(PROG)" = "uninstall" ]; then \
|
||||
if [ ! -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
$(E_NS) " - $(TARGET) already $(PROG)ed"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
@ if [ "$(PROG)" = "install" ]; then \
|
||||
if [ -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
$(E_NS) " - $(TARGET) already $(PROG)ed"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
really_termux:
|
||||
@ if [ ! -f $(TERMUX_BIN)/termux-open ]; then \
|
||||
$(P) "$(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) This function is only available on Termux.\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
really_builded:
|
||||
if [ ! -f $(BINARY_DIR)/$(TARGET) ]; then \
|
||||
$(P) " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) Package not builded! Please build package and try again \n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# end
|
||||
@@ -1,189 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#####
|
||||
# sub-make for building package
|
||||
#####
|
||||
|
||||
THIS_IS = src
|
||||
|
||||
include ../Makefile.inc
|
||||
|
||||
ifeq ($(INC_OLDENV),true)
|
||||
include $(BUILD)/config/oldenv.mk
|
||||
endif
|
||||
|
||||
INCLUDE_DIR := $(realpath ../include)
|
||||
PMT_INCDIR := $(INCLUDE_DIR)/pmt
|
||||
|
||||
# the presence of all source files that are on this list will be checked
|
||||
SRCS_REQ := \
|
||||
place-holder/debugging.c \
|
||||
place-holder/help.c \
|
||||
place-holder/get_stat.c \
|
||||
place-holder/lang_tools.c \
|
||||
place-holder/languages.c \
|
||||
place-holder/partitiontool.c \
|
||||
place-holder/pmt.c \
|
||||
place-holder/root.c \
|
||||
place-holder/tools.c \
|
||||
place-holder/versioning.c
|
||||
|
||||
# objects to be used when executable file is created
|
||||
OBJS_EXEC := \
|
||||
$(SOURCE_DIR)/$(TARGET).o \
|
||||
$(SOURCE_DIR)/help.o \
|
||||
$(SOURCE_DIR)/versioning.o \
|
||||
$(SOURCE_DIR)/get_stat.o \
|
||||
$(SOURCE_DIR)/tools.o \
|
||||
$(SOURCE_DIR)/lang_tools.o \
|
||||
$(SOURCE_DIR)/languages.o
|
||||
|
||||
HEADERS_REQ := \
|
||||
$(PMT_INCDIR)/pmt/deprecates.h \
|
||||
$(PMT_INCDIR)/pmt/help_msgs.h \
|
||||
$(PMT_INCDIR)/pmt/pmt.h \
|
||||
$(PMT_INCDIR)/pmt/stringkeys.h \
|
||||
$(PMT_INCDIR)/pmt/versioning.h
|
||||
|
||||
PROGRESS_LIST := \
|
||||
welcome \
|
||||
$(SRCS_REQ) \
|
||||
$(HEADERS_REQ) \
|
||||
pr_obj \
|
||||
$(OBJS) \
|
||||
make_outdirs \
|
||||
$(STATIC_LIBS) \
|
||||
make_executable \
|
||||
end_progress
|
||||
|
||||
define check_hf
|
||||
@ [ ! -f "$1" ] \
|
||||
&& $(E_NS) " ==> Couldn't found required header file: include/pmt/`basename $1`" \
|
||||
&& exit 1
|
||||
endef
|
||||
|
||||
# all target for building
|
||||
all: $(PROGRESS_LIST)
|
||||
|
||||
welcome:
|
||||
@ rm -f $(BUILD)/config/oldenv.mk
|
||||
@ echo " ---- Partition Manager Builder ---- " \
|
||||
&& $(E_NS)
|
||||
$(E) " - Version: $(VERSION)"
|
||||
$(E) " - Version code: $(VERSION_CODE)" \
|
||||
&& $(E_NS)
|
||||
$(E) " -------------------------------- " \
|
||||
&& $(E_NS)
|
||||
@ if [ -f $(SOURCE_DIR)/debugging.o ]; then \
|
||||
$(E_NS) " - Please clean up before you build it." && echo; \
|
||||
$(E_NS) " ----------------------------------- "; \
|
||||
exit 1; \
|
||||
fi
|
||||
$(E) " - Checking required source files..."
|
||||
@ sleep 1
|
||||
|
||||
pr_obj:
|
||||
$(E) " - Building objects..."
|
||||
|
||||
make_outdirs:
|
||||
@ rm -rf $(IN_OUT_DIR)
|
||||
@ mkdir $(BINARY_DIR)
|
||||
@ mkdir $(PACKAGE_DIR)
|
||||
@ mkdir $(STATICLIB_DIR)
|
||||
|
||||
place-holder/%.c:
|
||||
$(E) " CHK $(SOURCE_DIRNAME)/`basename $@`"
|
||||
@ if [ ! -f "$(SOURCE_DIR)/`basename $@`" ]; then \
|
||||
$(E_NS) " ==> Couldn't found required source file: $(SOURCE_DIRNAME)/`basename $@`"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
$(PMT_INCDIR)/%.h:
|
||||
$(E) " CHK include/pmt/`basename $@`"
|
||||
@ if [ ! -f "$(INCLUDE_DIR)/pmt/`basename $@`" ]; then \
|
||||
$(E_NS) " ==> Couldn't found required header file: include/pmt/`basename $@`"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
$(SOURCE_DIR)/%.o: $(SOURCE_DIR)/%.c
|
||||
$(E) " CC $(SOURCE_DIRNAME)/`basename $@`"
|
||||
@ $(CC) $(CFLAGS) -c "$<" || exit 1
|
||||
$(eval GEN_OBJS_MSG = )
|
||||
|
||||
lib$(TARGET)_root.a:
|
||||
$(E) " - Making static libraries..."
|
||||
$(E) " AR $@"
|
||||
@ $(AR) rcs "$@" "$(SOURCE_DIR)/root.o" || exit 1
|
||||
|
||||
lib$(TARGET)_debugging.a:
|
||||
$(E) " AR $@"
|
||||
@ $(AR) rcs "$@" "$(SOURCE_DIR)/debugging.o"
|
||||
|
||||
lib$(TARGET)_listpart.a:
|
||||
$(E) " AR $@"
|
||||
@ $(AR) rcs "$@" "$(SOURCE_DIR)/listpart.o"
|
||||
|
||||
lib$(TARGET)_partitiontool.a:
|
||||
$(E) " AR $@"
|
||||
@ $(AR) rcs "$@" "$(SOURCE_DIR)/partitiontool.o"
|
||||
@ sleep 1
|
||||
|
||||
make_executable:
|
||||
$(E) " - Making executable file..."
|
||||
$(E) " LD $(TARGET)"
|
||||
@ $(CC) $(CFLAGS) -L$(SOURCE_DIR) -l$(TARGET)_root -l$(TARGET)_debugging -l$(TARGET)_listpart -l$(TARGET)_partitiontool -o $(TARGET) $(OBJS_EXEC) || exit 1
|
||||
@ sleep 1
|
||||
|
||||
end_progress:
|
||||
@ abort_build() { \
|
||||
[ -d "$(PACKAGE_DIR)" ] \
|
||||
&& rm -rf "$(PACKAGE_DIR)"; \
|
||||
[ -d "$(BINARY_DIR)" ] \
|
||||
&& rm -rf "$(BINARY_DIR)"; \
|
||||
[ -d "$(STATICLIB_DIR)" ] \
|
||||
&& rm -rf "$(STATICLIB_DIR)"; \
|
||||
exit 1; \
|
||||
}; \
|
||||
mv $(TARGET) $(BINARY_DIR) || abort_build; \
|
||||
mv *.a $(STATICLIB_DIR) || abort_build; \
|
||||
$(E_NS) " - Generating package..."; \
|
||||
cp $(BINARY_DIR)/$(TARGET) $(PACKAGE_DIR) || abort_build; \
|
||||
$(E_NS) " XZ $(OUT_DIRNAME)/package/$(TARGET)-`date +%Y%m%d`.xz"
|
||||
xz $(PACKAGE_DIR)/$(TARGET) || abort_build; \
|
||||
sleep 1; \
|
||||
mv $(PACKAGE_DIR)/$(TARGET).xz $(PACKAGE_DIR)/$(TARGET)-`date +%Y%m%d`.xz || abort_build
|
||||
$(E) " - Success" && $(E_NS)
|
||||
@ sleep 1
|
||||
$(E) " ----------------------------------- "
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(eval STATICLIBS = $(wildcard $(SOURCE_DIR)/*.a))
|
||||
$(eval OBJS = $(wildcard $(SOURCE_DIR)/*.o))
|
||||
$(info Cleaning files...)
|
||||
$(foreach obj, \
|
||||
$(OBJS), \
|
||||
$(call m_stat_nn,$(SOURCE_DIRNAME)/$(shell basename $(obj))) \
|
||||
$(call erase,$(obj)) \
|
||||
)
|
||||
$(foreach lib, \
|
||||
$(STATICLIBS), \
|
||||
$(call m_stat_nn,$(SOURCE_DIRNAME)/$(shell basename $(lib))) \
|
||||
$(call erase,$(lib)) \
|
||||
)
|
||||
|
||||
# end
|
||||
@@ -1,31 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
##################
|
||||
# See "erase" funtion for build/util/utils.mk
|
||||
##################
|
||||
|
||||
include $(TOOLS)/save-gen-vars.mk
|
||||
|
||||
define clean-ndk-mfiles
|
||||
@ [ "$(UPDATE_MAKEFILES)" = "true" ] || printf " ------ Cleaning NDK Makefiles ------ \n"
|
||||
@ cat $(BASH_DIR)/clean-makefiles | $(BIN)/bash
|
||||
endef
|
||||
|
||||
define clean-mfiles
|
||||
@ [ "$(UPDATE_MAKEFILES)" = "true" ] || printf " ------ Cleaning Makefiles ------ \n"
|
||||
@ cat $(BASH_DIR)/clean-makefiles | $(BIN)/bash
|
||||
endef
|
||||
@@ -1,31 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
##################
|
||||
# See "save-gen-vars" funtion for build/tools/save-gen-vars.mk
|
||||
##################
|
||||
|
||||
include $(TOOLS)/save-gen-vars.mk
|
||||
|
||||
define gen-ndk-mfiles
|
||||
@ [ "$(UPDATE_MAKEFILES)" = "true" ] || printf " ------ Generating NDK Makefiles ------ \n"
|
||||
@ cat $(BASH_DIR)/gen-makefiles | $(BIN)/bash
|
||||
endef
|
||||
|
||||
define gen-mfiles
|
||||
@ [ "$(UPDATE_MAKEFILES)" = "true" ] || printf " ------ Generating Makefiles ------ \n"
|
||||
@ cat $(BASH_DIR)/gen-makefiles | $(BIN)/bash
|
||||
endef
|
||||
@@ -1,26 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
define save-gen-vars
|
||||
@ rm -f $(BASH_DIR)/additional-vars
|
||||
$(call touch,$(BASH_DIR)/additional-vars)
|
||||
@ echo "NDK_PROG=$(NDK_PROG)" >> $(BASH_DIR)/additional-vars
|
||||
@ echo "FORCE_GEN=$(FORCE_GEN)" >> $(BASH_DIR)/additional-vars
|
||||
@ echo "THIS_IS=$(THIS_IS)" >> $(BASH_DIR)/additional-vars
|
||||
@ echo "UPDATE_MAKEFILES=$(UPDATE_MAKEFILES)" >> $(BASH_DIR)/additional-vars
|
||||
@ echo "SOURCE_DIRNAME=$(SOURCE_DIRNAME)" >> $(BASH_DIR)/additional-vars
|
||||
@ echo "OUT_DIRNAME=$(OUT_DIRNAME)" >> $(BASH_DIR)/additional-vars
|
||||
endef
|
||||
@@ -1,24 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
ifneq ($(THIS_IS),main)
|
||||
$(error The caller is not the main makefile. Something's wrong)
|
||||
endif
|
||||
|
||||
UPDATE_MAKEFILES = true
|
||||
|
||||
include $(TOOLS)/clean-makefiles.mk
|
||||
include $(TOOLS)/gen-makefiles.mk
|
||||
@@ -1,58 +0,0 @@
|
||||
# By YZBruh
|
||||
|
||||
# Copyright 2024 Partition Manager
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# generate any text based empty file. Usage: $(call touch,<PATH>)
|
||||
define touch
|
||||
$(hide)[ ! "$(FORCE_GEN)" = "true" ] || rm -f "$1"
|
||||
$(hide)touch "$1" || exit 1
|
||||
endef
|
||||
|
||||
# copy files. Usage: $(call copy,<SOURCE>,<COPY_PATH>)
|
||||
define copy
|
||||
cp "$1" "$2" || exit 1
|
||||
endef
|
||||
|
||||
# copy dirs. Usage: $(call copydir,<SOURCE>,<COPY_PATH>)
|
||||
define copydir
|
||||
cp -r "$1" "$2" || exit 1
|
||||
endef
|
||||
|
||||
# file/dir are deleted. usage: $(call erase,<file/directory>)
|
||||
define erase
|
||||
rm -rf "$1"
|
||||
endef
|
||||
|
||||
# make directories. usage: $(call mdir,<PATH>,<PRINTSTATUS=y/NULL>)
|
||||
define mdir
|
||||
[ -z $2 ] || printf " - Generating `basename $1` dir...\n"; \
|
||||
mkdir -p "$1" || exit 1;
|
||||
endef
|
||||
|
||||
# make status. usage: $(call m_stat,"<MESSAGE>",<NEW_LINE_STATE: RANDOM>)
|
||||
define m_stat
|
||||
printf " $1 $2"
|
||||
endef
|
||||
|
||||
# make status (not newline and using make functions). usage: $(call m_stat_nn,"<MESSAGE>")
|
||||
define m_stat_nn
|
||||
$(info ==> $(1))
|
||||
endef
|
||||
|
||||
# Get file content and if speficed write target, write speficed file. Usage: $(call cat,<SOURCE>,<WRITE_PATH>)
|
||||
define cat
|
||||
[ -z "$2" ] && cat "$1" || exit 1
|
||||
[ -n "$2" ] && cat "$1" >> "$2" || exit 1
|
||||
endef
|
||||
@@ -1,5 +1,5 @@
|
||||
export PMT_VERSION="2.6.0"
|
||||
export PMT_VERSION_CODE=260
|
||||
export NDK_LINK="https://dl.google.com/android/repository/android-ndk-r27-linux.zip"
|
||||
export NDK_VERSION="r27"
|
||||
export NDK_IS="android-ndk"
|
||||
export PMT_VERSION="3.0.2"
|
||||
export PMT_VERSION_CODE=302
|
||||
export NDK_VERSION="r27c"
|
||||
export NDK_IS="android-ndk"
|
||||
export NDK_LINK="https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-linux.zip"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
echo -e "\`${CC_VERSION}\`
|
||||
echo -e "\`${CXX_VERSION}\`
|
||||
|
||||
Version/Version Code: \`${PMT_VERSION}\`/\`${PMT_VERSION_CODE}\`
|
||||
Supported architectures: \`arm64-v8a\` (64-bit) and \`armeabi-v7a\` (32-bit)
|
||||
Version and code: \`${PMT_VERSION}\`/\`${PMT_VERSION_CODE}\`
|
||||
Supported architectures: \`arm64-v8a\` (64-bit), \`armeabi-v7a\` (32-bit)
|
||||
|
||||
Notes:
|
||||
Builded with Android NDK ${NDK_VERSION}
|
||||
Packages are compressed with xz.
|
||||
Builded debian packages for termux. [Click](https://github.com/ShawkTeam/pmt/blob/${PMT_VERSION}/SETUP-DEBS.md) for guide.
|
||||
Report bugs and suggestions.
|
||||
[Click](https://github.com/ShawkTeam/pmt/blob/${PMT_VERSION}/CHANGELOG.md) for viewing version ${PMT_VERSION} changelog."
|
||||
- Builded with Android NDK \`${NDK_VERSION}\`
|
||||
- Packages are compressed with \`xz\`.
|
||||
- Report bugs and suggestions.
|
||||
- [Click](https://github.com/ShawkTeam/pmt/blob/${PMT_VERSION}/CHANGELOG.md) for viewing version \`${PMT_VERSION}\` changelog."
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -20,22 +20,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define INC_MAIN_LIBS
|
||||
#define INC_DEBUGERS
|
||||
#if __has_include("config.h")
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <mntent.h>
|
||||
|
||||
#include <pmt/pmt.h>
|
||||
#include <pmt/stringkeys.h>
|
||||
|
||||
/* root checker function */
|
||||
void check_root(void)
|
||||
{
|
||||
/* a quick, easy method for verifying root */
|
||||
if (getuid() != 0)
|
||||
LOGE("%s\n", current->no_root);
|
||||
}
|
||||
ssize_t getrandom(void* buf, size_t buflen, unsigned int flags);
|
||||
int getentropy(void* buf, size_t buflen);
|
||||
char* _Nullable hasmntopt(const struct mntent* mnt, const char* opt);
|
||||
void* _Nullable reallocarray(void* ptr, size_t count, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* end of code */
|
||||
#endif
|
||||
104
include/PartitionManager/Deprecates.h
Executable file
104
include/PartitionManager/Deprecates.h
Executable file
@@ -0,0 +1,104 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* annotated macros */
|
||||
#define DeprecatedOption 1
|
||||
#define ChangedOption 2
|
||||
#define EndDeprcationPoint 0
|
||||
#define NotChanged 0
|
||||
#define NotChangedLong nullptr
|
||||
|
||||
/* version table */
|
||||
#define v150 "1.5.0"
|
||||
#define v160 "1.6.0"
|
||||
#define v170 "1.7.0"
|
||||
#define v180 "1.8.0"
|
||||
#define v190 "1.9.0"
|
||||
#define v200 "2.0.0"
|
||||
#define v210 "2.1.0"
|
||||
#define v220 "2.2.0"
|
||||
#define v230 "2.3.0"
|
||||
#define v240 "2.4.0"
|
||||
#define v250 "2.5.0"
|
||||
#define v260 "2.6.0"
|
||||
#define v270 "2.7.0"
|
||||
#define v280 "2.8.0"
|
||||
#define v290 "2.9.0"
|
||||
#define v291 "2.9.1"
|
||||
#define v296 "2.9.6"
|
||||
#define v302 "3.0.2"
|
||||
#define vUNKNOWN nullptr
|
||||
|
||||
struct DeprecationVarTab {
|
||||
const int DeprecationType;
|
||||
const int Option;
|
||||
const int Option_new;
|
||||
const char* Option_long;
|
||||
const char* Option_long_new;
|
||||
const char* DeprecatedOnVersion;
|
||||
};
|
||||
|
||||
static struct DeprecationVarTab DeprecationTable[] = {
|
||||
{DeprecatedOption, 'b', NotChanged, "backup", NotChangedLong, v210},
|
||||
{DeprecatedOption, 'F', NotChanged, "flash", NotChangedLong, v210},
|
||||
{DeprecatedOption, 'r', NotChanged, "format", NotChangedLong, v210},
|
||||
{DeprecatedOption, 'L', NotChanged, "license", NotChangedLong, v250},
|
||||
{ChangedOption, 'D', 'p', "list", NotChangedLong, v210},
|
||||
{ChangedOption, 'c', 'P', "context", "search-path", v290},
|
||||
{EndDeprcationPoint, NotChanged, NotChanged, NotChangedLong, NotChanged, vUNKNOWN}
|
||||
};
|
||||
|
||||
static void
|
||||
__process_deprecated_opts(int Opt, const string& OptionLong, const char* DeprecationMsg)
|
||||
{
|
||||
string LongErrMsg = (OptionLong.empty()) ? PartitionManager::Display::UsingDispString->not_changed_opt : OptionLong;
|
||||
|
||||
for (int optctrl = 0; DeprecationTable[optctrl].DeprecationType != 0; optctrl++)
|
||||
{
|
||||
|
||||
if (DeprecationTable[optctrl].DeprecationType == 1)
|
||||
{
|
||||
if (Opt == DeprecationTable[optctrl].Option
|
||||
|| strcmp(OptionLong.c_str(), DeprecationTable[optctrl].Option_long) == 0)
|
||||
LOGD("%s [%s]: -%c (%s): %s\n",
|
||||
PartitionManager::Display::UsingDispString->depr_opt_str,
|
||||
DeprecationTable[optctrl].DeprecatedOnVersion,
|
||||
(char)DeprecationTable[optctrl].Option,
|
||||
DeprecationTable[optctrl].Option_long,
|
||||
DeprecationMsg); exit(1);
|
||||
}
|
||||
else if (DeprecationTable[optctrl].DeprecationType == 2)
|
||||
{
|
||||
if (Opt == DeprecationTable[optctrl].Option
|
||||
|| strcmp(OptionLong.c_str(), DeprecationTable[optctrl].Option_long) == 0)
|
||||
LOGD("%s [%s]: -%c (%s): %s\n",
|
||||
PartitionManager::Display::UsingDispString->switched_opt_str,
|
||||
DeprecationTable[optctrl].DeprecatedOnVersion,
|
||||
(char)DeprecationTable[optctrl].Option,
|
||||
LongErrMsg.c_str(),
|
||||
DeprecationMsg); exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#define DEPR_HANDLE __process_deprecated_opts
|
||||
|
||||
/* end of code */
|
||||
23
include/PartitionManager/FileSystemUtils.h
Executable file
23
include/PartitionManager/FileSystemUtils.h
Executable file
@@ -0,0 +1,23 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern "C" int mke2fs_main(int argc, char* argv[]);
|
||||
|
||||
/* end of code */
|
||||
@@ -16,15 +16,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PMT_HELP_MSGS_H
|
||||
#define __PMT_HELP_MSGS_H
|
||||
#pragma once
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void help(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
namespace PartitionManager { void DisplayHelp(void); }
|
||||
|
||||
/* end */
|
||||
40
include/PartitionManager/LanguageConfigs.h
Executable file
40
include/PartitionManager/LanguageConfigs.h
Executable file
@@ -0,0 +1,40 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace PartitionManager {
|
||||
// Config base
|
||||
struct LanguageConfigs {
|
||||
string Name; // name of language. e.g.: "en"
|
||||
string ExName;
|
||||
struct langdb_general* LanguageStructure; // structure of language
|
||||
struct langdb_docs* LanguageDocStructure; // structure of language (for docs)
|
||||
};
|
||||
|
||||
// Used config by pmt
|
||||
struct LanguageConfigs LanguageConfig[] {
|
||||
{"en", "English", &Display::LangEn, &Display::LangDocEn},
|
||||
{"tr", "Türkçe", &Display::LangTr, &Display::LangDocTr}
|
||||
};
|
||||
|
||||
// Default
|
||||
struct langdb_general* Display::UsingDispString = nullptr;
|
||||
}
|
||||
|
||||
/* end of code */
|
||||
@@ -1,9 +1,9 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the "License";
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
@@ -16,23 +16,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PMT_VERSIONING_H
|
||||
#define __PMT_VERSIONING_H
|
||||
#pragma once
|
||||
|
||||
__BEGIN_DECLS
|
||||
#define VIEW_AS_BYTE 1
|
||||
#define VIEW_AS_KIB 2
|
||||
#define VIEW_AS_MIB 3
|
||||
#define VIEW_AS_GIB 4
|
||||
|
||||
#ifdef __NDK_BUILD
|
||||
#include <android/ndk-version.h>
|
||||
#include <pmt/generated/clang-version.h>
|
||||
#endif
|
||||
|
||||
/* versioning */
|
||||
#define PMT_MAJOR 2
|
||||
#define PMT_MINOR 6
|
||||
#define PMT_PATCHLEVEL 0
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
/* end */
|
||||
/* end of code */
|
||||
25
include/PartitionManager/Parted.h
Executable file
25
include/PartitionManager/Parted.h
Executable file
@@ -0,0 +1,25 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern "C" int parted_main(int argc, char* argv[]);
|
||||
extern volatile int set_ret;
|
||||
extern volatile int parted_ret;
|
||||
|
||||
/* end of code */
|
||||
172
include/PartitionManager/PartitionManager.h
Executable file
172
include/PartitionManager/PartitionManager.h
Executable file
@@ -0,0 +1,172 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if INC_MAIN_LIBS
|
||||
#include <iostream>
|
||||
#include <stdbool.h>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdarg>
|
||||
#if IS_MAIN
|
||||
#include <clocale>
|
||||
#endif
|
||||
#if !defined(HELP_CPP) || !defined(VERSION_CPP)
|
||||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#endif
|
||||
#endif
|
||||
#if INC_STRINGKEYS
|
||||
#include <PartitionManager/StringKeys.h>
|
||||
#endif
|
||||
#if INC_DIRENT
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#if INC_STAT
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if INC_DEBUGERS
|
||||
#include <cerrno>
|
||||
#endif
|
||||
#if INC_TOOLS_REQS
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
#if INC_LIBGEN
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
#if INC_PTHREAD
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* logging levels */
|
||||
typedef enum {
|
||||
LOG_LEVEL_FATAL,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARN,
|
||||
LOG_LEVEL_DEBUG
|
||||
} LogLevel;
|
||||
|
||||
/* config structure */
|
||||
struct Configuration {
|
||||
/* general boolean tab */
|
||||
bool UseLogical;
|
||||
bool UseCustomSearchPath;
|
||||
bool UsesSlots;
|
||||
bool UsesLogical;
|
||||
bool SilentEnabled;
|
||||
bool FlashMode;
|
||||
bool BackupMode;
|
||||
bool FormatMode;
|
||||
bool PartedMode;
|
||||
bool PartSizeViewMode;
|
||||
bool PartUtilMode;
|
||||
bool ForceMode;
|
||||
bool VerboseMode;
|
||||
bool InstalledOnTermux;
|
||||
|
||||
/* part-size argument bools */
|
||||
bool OnlyViewSize;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fast error processing without errno entry
|
||||
* but errno can be given in the entrance
|
||||
*/
|
||||
extern "C" char* strqerror(int __qerrno = errno);
|
||||
|
||||
/**
|
||||
* ushort_t = unsigned short type
|
||||
*/
|
||||
typedef unsigned short ushort_t;
|
||||
|
||||
/**
|
||||
* bool type configurations
|
||||
*/
|
||||
extern struct Configuration Config;
|
||||
|
||||
/* create a special namespace */
|
||||
namespace PartitionManager {
|
||||
namespace Strings {
|
||||
extern string OutputName;
|
||||
extern string CustomSearchPath;
|
||||
extern string TargetPartition;
|
||||
extern string TargetFlashFile;
|
||||
extern string TargetFormatFS;
|
||||
extern string PartitionType;
|
||||
extern string Device;
|
||||
extern string ExecutingName;
|
||||
extern string CurrentLanguage;
|
||||
} /* namespace Strings */
|
||||
|
||||
namespace Integers {
|
||||
extern int PartSizeViewType;
|
||||
} /* namespace Integers */
|
||||
|
||||
namespace Display {
|
||||
extern struct langdb_general* UsingDispString;
|
||||
extern struct langdb_docs* UsingDocDispString;
|
||||
extern struct langdb_general LangEn;
|
||||
extern struct langdb_general LangTr;
|
||||
extern struct langdb_docs LangDocEn;
|
||||
extern struct langdb_docs LangDocTr;
|
||||
} /* namespace Display */
|
||||
|
||||
/* functions */
|
||||
int ListPartitions(void);
|
||||
int GetState(const string& filepath, const string& stype = "file");
|
||||
int PartitionManagerMain(const ushort_t& progress_code);
|
||||
int StartParted(void);
|
||||
void SetLanguage(const string& lang, ushort_t null_conf_stat);
|
||||
void DisplaySupportedLanguages(void);
|
||||
void DisplayLog(LogLevel LogPriority, const char* fmt, ...);
|
||||
void DisplayVerboseLog(LogLevel LogPriority, const char* func, const int& line, const char* fmt, ...);
|
||||
void CheckDevPoint(void);
|
||||
void CheckRoot(void);
|
||||
bool CleanSWPoint(void);
|
||||
bool LoadLanguage(void);
|
||||
bool SearchDevice(const string& DevicePath);
|
||||
bool SearchDefaultDevices(void);
|
||||
} /* namespace PartitionManager */
|
||||
|
||||
/* logging macros */
|
||||
#define LOGF(fmt, ...) \
|
||||
((void)PartitionManager::DisplayLog(LOG_LEVEL_FATAL, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
#define LOGE(fmt, ...) \
|
||||
((void)PartitionManager::DisplayLog(LOG_LEVEL_ERROR, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
#define LOGW(fmt, ...) \
|
||||
((void)PartitionManager::DisplayLog(LOG_LEVEL_WARN, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
#define LOGD(fmt, ...) \
|
||||
((void)PartitionManager::DisplayLog(LOG_LEVEL_DEBUG, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
|
||||
/* verbose logging macros */
|
||||
#define VLOGF(fmt, ...) \
|
||||
((void)PartitionManager::DisplayVerboseLog(LOG_LEVEL_FATAL, __func__, __LINE__, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
#define VLOGE(fmt, ...) \
|
||||
((void)PartitionManager::DisplayVerboseLog(LOG_LEVEL_ERROR, __func__, __LINE__, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
#define VLOGW(fmt, ...) \
|
||||
((void)PartitionManager::DisplayVerboseLog(LOG_LEVEL_WARN, __func__, __LINE__, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
#define VLOGD(fmt, ...) \
|
||||
((void)PartitionManager::DisplayVerboseLog(LOG_LEVEL_DEBUG, __func__, __LINE__, (fmt)__VA_OPT__(, ) __VA_ARGS__))
|
||||
|
||||
/* end of code */
|
||||
141
include/PartitionManager/StringKeys.h
Executable file
141
include/PartitionManager/StringKeys.h
Executable file
@@ -0,0 +1,141 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/**
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* The struct is a very good option for setting the languages of texts etc. */
|
||||
struct langdb_general {
|
||||
const char* _Nonnull lang_by_s;
|
||||
const char* _Nonnull language;
|
||||
const char* _Nonnull lang_prefix;
|
||||
const char* _Nonnull not_logical;
|
||||
const char* _Nonnull not_file;
|
||||
const char* _Nonnull not_dir;
|
||||
const char* _Nonnull not_in_dev;
|
||||
const char* _Nonnull not_open;
|
||||
const char* _Nonnull not_block;
|
||||
const char* _Nonnull not_read;
|
||||
const char* _Nonnull not_readdir;
|
||||
const char* _Nonnull not_write;
|
||||
const char* _Nonnull not_gen;
|
||||
const char* _Nonnull no_root;
|
||||
const char* _Nonnull expected_backup_arg;
|
||||
const char* _Nonnull expected_flash_arg;
|
||||
const char* _Nonnull expected_format_arg;
|
||||
const char* _Nonnull expected_partsz_arg;
|
||||
const char* _Nonnull missing_operand;
|
||||
const char* _Nonnull multiple_wiewers;
|
||||
const char* _Nonnull symbol_rule;
|
||||
const char* _Nonnull req_part_name;
|
||||
const char* _Nonnull part_not_found;
|
||||
const char* _Nonnull unsupported_fs;
|
||||
const char* _Nonnull cannot_stat;
|
||||
const char* _Nonnull ffile_more_part;
|
||||
const char* _Nonnull cannot_get_bsz;
|
||||
const char* _Nonnull format_fail;
|
||||
const char* _Nonnull fail_get_psize;
|
||||
const char* _Nonnull depr_backup_opt;
|
||||
const char* _Nonnull depr_flash_opt;
|
||||
const char* _Nonnull depr_format_opt;
|
||||
const char* _Nonnull depr_Vlicense_opt;
|
||||
const char* _Nonnull depr_ch_list_opt;
|
||||
const char* _Nonnull depr_ch_sp_opt;
|
||||
const char* _Nonnull not_spec_opt;
|
||||
const char* _Nonnull some_spec;
|
||||
const char* _Nonnull logical_warn;
|
||||
const char* _Nonnull ab_warn;
|
||||
const char* _Nonnull out_not_spec;
|
||||
const char* _Nonnull no_found_on_process;
|
||||
const char* _Nonnull please_rerun;
|
||||
const char* _Nonnull part_disk_sz;
|
||||
const char* _Nonnull flash_file_sz;
|
||||
const char* _Nonnull part_disk_sz_fail;
|
||||
const char* _Nonnull flash_file_sz_fail;
|
||||
const char* _Nonnull found_defdevice;
|
||||
const char* _Nonnull cannot_find_any_defdevice;
|
||||
const char* _Nonnull cannot_find_device;
|
||||
const char* _Nonnull not_spec_device_on_args;
|
||||
const char* _Nonnull starting_parted;
|
||||
const char* _Nonnull exited_with;
|
||||
const char* _Nonnull unknown_opr;
|
||||
const char* _Nonnull req_an_arg;
|
||||
const char* _Nonnull list_of_general;
|
||||
const char* _Nonnull list_of_logc;
|
||||
const char* _Nonnull success_backup;
|
||||
const char* _Nonnull success_flash;
|
||||
const char* _Nonnull success_format;
|
||||
const char* _Nonnull formatting;
|
||||
const char* _Nonnull warn;
|
||||
const char* _Nonnull fatal;
|
||||
const char* _Nonnull is_requires_arg;
|
||||
const char* _Nonnull list_of_supported;
|
||||
const char* _Nonnull only_partsz_args;
|
||||
const char* _Nonnull unknw_arg;
|
||||
const char* _Nonnull switching_lang;
|
||||
const char* _Nonnull welcome;
|
||||
const char* _Nullable welcome_;
|
||||
const char* _Nonnull for_more;
|
||||
const char* _Nonnull s_and_v;
|
||||
const char* _Nonnull try_h;
|
||||
const char* _Nonnull usage_head;
|
||||
const char* _Nonnull depr_opt_str;
|
||||
const char* _Nonnull switched_opt_str;
|
||||
const char* _Nonnull not_changed_opt;
|
||||
const char* _Nonnull compiler_str;
|
||||
const char* _Nonnull version_str;
|
||||
const char* _Nonnull bin_str;
|
||||
const char* _Nonnull part_name;
|
||||
const char* _Nonnull part_type;
|
||||
const char* _Nonnull fs_str;
|
||||
const char* _Nonnull unknw_str;
|
||||
const char* _Nonnull by_str;
|
||||
const char* _Nonnull yes;
|
||||
const char* _Nonnull no;
|
||||
};
|
||||
|
||||
/* docs etc. */
|
||||
struct langdb_docs {
|
||||
const char* _Nonnull docs_strs_l1;
|
||||
const char* _Nonnull docs_strs_l2;
|
||||
const char* _Nonnull docs_strs_l3;
|
||||
const char* _Nonnull docs_strs_l4;
|
||||
const char* _Nonnull docs_strs_l5;
|
||||
const char* _Nonnull docs_strs_l6;
|
||||
const char* _Nonnull docs_strs_l7;
|
||||
const char* _Nonnull docs_strs_l8;
|
||||
const char* _Nonnull docs_strs_l9;
|
||||
const char* _Nonnull docs_strs_l10;
|
||||
const char* _Nonnull docs_strs_l11;
|
||||
const char* _Nonnull docs_strs_l12;
|
||||
const char* _Nonnull docs_strs_l13;
|
||||
const char* _Nonnull docs_strs_l14;
|
||||
const char* _Nonnull docs_strs_l15;
|
||||
const char* _Nonnull docs_strs_l16;
|
||||
const char* _Nonnull docs_strs_l17;
|
||||
const char* _Nonnull docs_strs_l18;
|
||||
const char* _Nonnull docs_strs_l19;
|
||||
const char* _Nonnull docs_strs_l20;
|
||||
const char* _Nonnull docs_strs_l21;
|
||||
const char* _Nonnull docs_strs_l22;
|
||||
const char* _Nonnull docs_strs_l23;
|
||||
const char* _Nonnull docs_strs_l24;
|
||||
const char* _Nonnull or_str;
|
||||
const char* _Nonnull usage_docstr;
|
||||
};
|
||||
|
||||
/* end of code */
|
||||
32
include/PartitionManager/VersionFnVars.h
Executable file
32
include/PartitionManager/VersionFnVars.h
Executable file
@@ -0,0 +1,32 @@
|
||||
/* By YZBruh */
|
||||
|
||||
/*
|
||||
* Copyright 2024 Partition Manager
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <android/ndk-version.h>
|
||||
#include <PartitionManager/generated/clang-version.h>
|
||||
#include <e2fsprogs/version.h>
|
||||
|
||||
/* versioning */
|
||||
#define PMT_MAJOR 3
|
||||
#define PMT_MINOR 0
|
||||
#define PMT_PATCHLEVEL 2
|
||||
|
||||
namespace PartitionManager { void DisplayVersion(void); }
|
||||
|
||||
/* end */
|
||||
501
include/blkid/blkid.h
Executable file
501
include/blkid/blkid.h
Executable file
@@ -0,0 +1,501 @@
|
||||
/*
|
||||
* blkid.h - Interface for libblkid, a library to identify block devices
|
||||
*
|
||||
* Copyright (C) 2001 Andreas Dilger
|
||||
* Copyright (C) 2003 Theodore Ts'o
|
||||
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
* This library 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 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _BLKID_BLKID_H
|
||||
#define _BLKID_BLKID_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLKID_VERSION "2.40.2"
|
||||
#define BLKID_DATE "04-Jul-2024"
|
||||
|
||||
/**
|
||||
* blkid_dev:
|
||||
*
|
||||
* The device object keeps information about one device
|
||||
*/
|
||||
typedef struct blkid_struct_dev *blkid_dev;
|
||||
|
||||
/**
|
||||
* blkid_cache:
|
||||
*
|
||||
* information about all system devices
|
||||
*/
|
||||
typedef struct blkid_struct_cache *blkid_cache;
|
||||
|
||||
/**
|
||||
* blkid_probe:
|
||||
*
|
||||
* low-level probing setting
|
||||
*/
|
||||
typedef struct blkid_struct_probe *blkid_probe;
|
||||
|
||||
/**
|
||||
* blkid_topology:
|
||||
*
|
||||
* device topology information
|
||||
*/
|
||||
typedef struct blkid_struct_topology *blkid_topology;
|
||||
|
||||
/**
|
||||
* blkid_partlist
|
||||
*
|
||||
* list of all detected partitions and partitions tables
|
||||
*/
|
||||
typedef struct blkid_struct_partlist *blkid_partlist;
|
||||
|
||||
/**
|
||||
* blkid_partition:
|
||||
*
|
||||
* information about a partition
|
||||
*/
|
||||
typedef struct blkid_struct_partition *blkid_partition;
|
||||
|
||||
/**
|
||||
* blkid_parttable:
|
||||
*
|
||||
* information about a partition table
|
||||
*/
|
||||
typedef struct blkid_struct_parttable *blkid_parttable;
|
||||
|
||||
/**
|
||||
* blkid_loff_t:
|
||||
*
|
||||
* 64-bit signed number for offsets and sizes
|
||||
*/
|
||||
typedef int64_t blkid_loff_t;
|
||||
|
||||
/**
|
||||
* blkid_tag_iterate:
|
||||
*
|
||||
* tags iterator for high-level (blkid_cache) API
|
||||
*/
|
||||
typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
|
||||
|
||||
/**
|
||||
* blkid_dev_iterate:
|
||||
*
|
||||
* devices iterator for high-level (blkid_cache) API
|
||||
*/
|
||||
typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
|
||||
|
||||
/*
|
||||
* Flags for blkid_get_dev
|
||||
*
|
||||
* BLKID_DEV_CREATE Create an empty device structure if not found
|
||||
* in the cache.
|
||||
* BLKID_DEV_VERIFY Make sure the device structure corresponds
|
||||
* with reality.
|
||||
* BLKID_DEV_FIND Just look up a device entry, and return NULL
|
||||
* if it is not found.
|
||||
* BLKID_DEV_NORMAL Get a valid device structure, either from the
|
||||
* cache or by probing the device.
|
||||
*/
|
||||
#define BLKID_DEV_FIND 0x0000
|
||||
#define BLKID_DEV_CREATE 0x0001
|
||||
#define BLKID_DEV_VERIFY 0x0002
|
||||
#define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY)
|
||||
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||
# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __ul_attribute__
|
||||
# if __GNUC_PREREQ (3, 4)
|
||||
# define __ul_attribute__(_a_) __attribute__(_a_)
|
||||
# else
|
||||
# define __ul_attribute__(_a_)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* init.c */
|
||||
extern void blkid_init_debug(int mask);
|
||||
|
||||
/* cache.c */
|
||||
extern void blkid_put_cache(blkid_cache cache);
|
||||
extern int blkid_get_cache(blkid_cache *cache, const char *filename);
|
||||
extern void blkid_gc_cache(blkid_cache cache);
|
||||
|
||||
/* dev.c */
|
||||
extern const char *blkid_dev_devname(blkid_dev dev)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
|
||||
extern int blkid_dev_set_search(blkid_dev_iterate iter,
|
||||
const char *search_type, const char *search_value);
|
||||
extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
|
||||
extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
|
||||
|
||||
/* devno.c */
|
||||
extern char *blkid_devno_to_devname(dev_t devno)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern int blkid_devno_to_wholedisk(dev_t dev, char *diskname,
|
||||
size_t len, dev_t *diskdevno)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
/* devname.c */
|
||||
extern int blkid_probe_all(blkid_cache cache);
|
||||
extern int blkid_probe_all_new(blkid_cache cache);
|
||||
extern int blkid_probe_all_removable(blkid_cache cache);
|
||||
|
||||
extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags);
|
||||
|
||||
/* getsize.c */
|
||||
extern blkid_loff_t blkid_get_dev_size(int fd);
|
||||
|
||||
/* verify.c */
|
||||
extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev);
|
||||
|
||||
/* read.c */
|
||||
|
||||
/* resolve.c */
|
||||
extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
|
||||
const char *devname)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern char *blkid_get_devname(blkid_cache cache, const char *token,
|
||||
const char *value)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
/* tag.c */
|
||||
extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
|
||||
extern int blkid_tag_next(blkid_tag_iterate iterate,
|
||||
const char **type, const char **value);
|
||||
extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
|
||||
extern int blkid_dev_has_tag(blkid_dev dev, const char *type, const char *value);
|
||||
|
||||
extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
|
||||
const char *type,
|
||||
const char *value);
|
||||
|
||||
extern int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val);
|
||||
|
||||
/* version.c */
|
||||
extern int blkid_parse_version_string(const char *ver_string)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_get_library_version(const char **ver_string,
|
||||
const char **date_string);
|
||||
|
||||
/* encode.c */
|
||||
extern int blkid_encode_string(const char *str, char *str_enc, size_t len);
|
||||
extern int blkid_safe_string(const char *str, char *str_safe, size_t len);
|
||||
|
||||
/* evaluate.c */
|
||||
extern int blkid_send_uevent(const char *devname, const char *action);
|
||||
extern char *blkid_evaluate_tag(const char *token, const char *value,
|
||||
blkid_cache *cache)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern char *blkid_evaluate_spec(const char *spec, blkid_cache *cache)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
|
||||
/* probe.c */
|
||||
extern blkid_probe blkid_new_probe(void)
|
||||
__ul_attribute__((warn_unused_result));
|
||||
extern blkid_probe blkid_new_probe_from_filename(const char *filename)
|
||||
__ul_attribute__((warn_unused_result))
|
||||
__ul_attribute__((nonnull));
|
||||
extern void blkid_free_probe(blkid_probe pr);
|
||||
|
||||
extern void blkid_reset_probe(blkid_probe pr);
|
||||
extern int blkid_probe_reset_buffers(blkid_probe pr);
|
||||
extern int blkid_probe_hide_range(blkid_probe pr, uint64_t off, uint64_t len);
|
||||
|
||||
extern int blkid_probe_set_device(blkid_probe pr, int fd,
|
||||
blkid_loff_t off, blkid_loff_t size)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern dev_t blkid_probe_get_devno(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern dev_t blkid_probe_get_wholedisk_devno(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_probe_is_wholedisk(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern blkid_loff_t blkid_probe_get_size(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_probe_get_offset(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_set_sectorsize(blkid_probe pr, unsigned int sz)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_probe_get_sectors(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_probe_get_fd(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_probe_set_hint(blkid_probe pr, const char *name, uint64_t value)
|
||||
__ul_attribute__((nonnull));
|
||||
extern void blkid_probe_reset_hints(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/*
|
||||
* superblocks probing
|
||||
*/
|
||||
extern int blkid_known_fstype(const char *fstype)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_superblocks_get_name(size_t idx, const char **name, int *usage);
|
||||
|
||||
extern int blkid_probe_enable_superblocks(blkid_probe pr, int enable)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */
|
||||
#define BLKID_SUBLKS_LABELRAW (1 << 2) /* read and define LABEL_RAW result value*/
|
||||
#define BLKID_SUBLKS_UUID (1 << 3) /* read UUID from superblock */
|
||||
#define BLKID_SUBLKS_UUIDRAW (1 << 4) /* read and define UUID_RAW result value */
|
||||
#define BLKID_SUBLKS_TYPE (1 << 5) /* define TYPE result value */
|
||||
#define BLKID_SUBLKS_SECTYPE (1 << 6) /* define compatible fs type (second type) */
|
||||
#define BLKID_SUBLKS_USAGE (1 << 7) /* define USAGE result value */
|
||||
#define BLKID_SUBLKS_VERSION (1 << 8) /* read FS type from superblock */
|
||||
#define BLKID_SUBLKS_MAGIC (1 << 9) /* define SBMAGIC and SBMAGIC_OFFSET */
|
||||
#define BLKID_SUBLKS_BADCSUM (1 << 10) /* allow a bad checksum */
|
||||
#define BLKID_SUBLKS_FSINFO (1 << 11) /* read and define fs properties from superblock */
|
||||
|
||||
#define BLKID_SUBLKS_DEFAULT (BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | \
|
||||
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE)
|
||||
|
||||
extern int blkid_probe_set_superblocks_flags(blkid_probe pr, int flags)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_reset_superblocks_filter(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_invert_superblocks_filter(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/**
|
||||
* BLKID_FLTR_NOTIN
|
||||
*/
|
||||
#define BLKID_FLTR_NOTIN 1
|
||||
/**
|
||||
* BLKID_FLTR_ONLYIN
|
||||
*/
|
||||
#define BLKID_FLTR_ONLYIN 2
|
||||
extern int blkid_probe_filter_superblocks_type(blkid_probe pr, int flag, char *names[])
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
#define BLKID_USAGE_FILESYSTEM (1 << 1)
|
||||
#define BLKID_USAGE_RAID (1 << 2)
|
||||
#define BLKID_USAGE_CRYPTO (1 << 3)
|
||||
#define BLKID_USAGE_OTHER (1 << 4)
|
||||
extern int blkid_probe_filter_superblocks_usage(blkid_probe pr, int flag, int usage)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/*
|
||||
* topology probing
|
||||
*/
|
||||
extern int blkid_probe_enable_topology(blkid_probe pr, int enable)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/* binary interface */
|
||||
extern blkid_topology blkid_probe_get_topology(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern unsigned long blkid_topology_get_alignment_offset(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned long blkid_topology_get_minimum_io_size(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned long blkid_topology_get_optimal_io_size(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned long blkid_topology_get_logical_sector_size(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned long blkid_topology_get_physical_sector_size(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned long blkid_topology_get_dax(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
extern uint64_t blkid_topology_get_diskseq(blkid_topology tp)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/*
|
||||
* partitions probing
|
||||
*/
|
||||
extern int blkid_known_pttype(const char *pttype);
|
||||
extern int blkid_partitions_get_name(const size_t idx, const char **name);
|
||||
|
||||
extern int blkid_probe_enable_partitions(blkid_probe pr, int enable)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_probe_reset_partitions_filter(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_invert_partitions_filter(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_filter_partitions_type(blkid_probe pr, int flag, char *names[])
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/* partitions probing flags */
|
||||
#define BLKID_PARTS_FORCE_GPT (1 << 1)
|
||||
#define BLKID_PARTS_ENTRY_DETAILS (1 << 2)
|
||||
#define BLKID_PARTS_MAGIC (1 << 3)
|
||||
extern int blkid_probe_set_partitions_flags(blkid_probe pr, int flags)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/* binary interface */
|
||||
extern blkid_partlist blkid_probe_get_partitions(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_partlist_numof_partitions(blkid_partlist ls)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_parttable blkid_partlist_get_table(blkid_partlist ls)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_partition blkid_partlist_get_partition(blkid_partlist ls, int n)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_partition blkid_partlist_get_partition_by_partno(blkid_partlist ls, int n)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_parttable blkid_partition_get_table(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern const char *blkid_partition_get_name(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern const char *blkid_partition_get_uuid(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_partition_get_partno(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_partition_get_start(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_partition_get_size(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_partition_get_type(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern const char *blkid_partition_get_type_string(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern unsigned long long blkid_partition_get_flags(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern int blkid_partition_is_logical(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_partition_is_extended(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_partition_is_primary(blkid_partition par)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
extern const char *blkid_parttable_get_type(blkid_parttable tab)
|
||||
__ul_attribute__((nonnull));
|
||||
extern const char *blkid_parttable_get_id(blkid_parttable tab)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_loff_t blkid_parttable_get_offset(blkid_parttable tab)
|
||||
__ul_attribute__((nonnull));
|
||||
extern blkid_partition blkid_parttable_get_parent(blkid_parttable tab)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/*
|
||||
* NAME=value low-level interface
|
||||
*/
|
||||
extern int blkid_do_probe(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_do_safeprobe(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_do_fullprobe(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/**
|
||||
* BLKID_PROBE_OK:
|
||||
*
|
||||
* probing return value; superblock (RAID, partiton table, ...) succesfully detected
|
||||
*/
|
||||
#define BLKID_PROBE_OK 0
|
||||
/**
|
||||
* BLKID_PROBE_NONE:
|
||||
*
|
||||
* probing return value; found nothing
|
||||
*/
|
||||
#define BLKID_PROBE_NONE 1
|
||||
/**
|
||||
* BLKID_PROBE_ERROR:
|
||||
*
|
||||
* probing return value; probing ends with en error (see errno for more details)
|
||||
*/
|
||||
#define BLKID_PROBE_ERROR -1
|
||||
/**
|
||||
* BLKID_PROBE_AMBIGUOUS:
|
||||
*
|
||||
* probing return value; more than one probing result, in this case, it's not
|
||||
* safe to use the device automaticaly and user intervention is recommended
|
||||
*/
|
||||
#define BLKID_PROBE_AMBIGUOUS -2
|
||||
|
||||
extern int blkid_probe_numof_values(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_get_value(blkid_probe pr, int num, const char **name,
|
||||
const char **data, size_t *len)
|
||||
__ul_attribute__((nonnull(1)));
|
||||
extern int blkid_probe_lookup_value(blkid_probe pr, const char *name,
|
||||
const char **data, size_t *len)
|
||||
__ul_attribute__((nonnull(1, 2)));
|
||||
extern int blkid_probe_has_value(blkid_probe pr, const char *name)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_do_wipe(blkid_probe pr, int dryrun)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_wipe_all(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
extern int blkid_probe_step_back(blkid_probe pr)
|
||||
__ul_attribute__((nonnull));
|
||||
|
||||
/*
|
||||
* Deprecated functions/macros
|
||||
*/
|
||||
#ifndef BLKID_DISABLE_DEPRECATED
|
||||
|
||||
#define BLKID_PROBREQ_LABEL BLKID_SUBLKS_LABEL
|
||||
#define BLKID_PROBREQ_LABELRAW BLKID_SUBLKS_LABELRAW
|
||||
#define BLKID_PROBREQ_UUID BLKID_SUBLKS_UUID
|
||||
#define BLKID_PROBREQ_UUIDRAW BLKID_SUBLKS_UUIDRAW
|
||||
#define BLKID_PROBREQ_TYPE BLKID_SUBLKS_TYPE
|
||||
#define BLKID_PROBREQ_SECTYPE BLKID_SUBLKS_SECTYPE
|
||||
#define BLKID_PROBREQ_USAGE BLKID_SUBLKS_USAGE
|
||||
#define BLKID_PROBREQ_VERSION BLKID_SUBLKS_VERSION
|
||||
|
||||
extern int blkid_probe_set_request(blkid_probe pr, int flags)
|
||||
__ul_attribute__((deprecated));
|
||||
|
||||
extern int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage)
|
||||
__ul_attribute__((deprecated));
|
||||
|
||||
extern int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[])
|
||||
__ul_attribute__((deprecated));
|
||||
|
||||
extern int blkid_probe_invert_filter(blkid_probe pr)
|
||||
__ul_attribute__((deprecated));
|
||||
|
||||
extern int blkid_probe_reset_filter(blkid_probe pr)
|
||||
__ul_attribute__((deprecated));
|
||||
|
||||
#endif /* BLKID_DISABLE_DEPRECATED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BLKID_BLKID_H */
|
||||
204
include/e2fsprogs/blkid/blkidP.h
Executable file
204
include/e2fsprogs/blkid/blkidP.h
Executable file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* blkidP.h - Internal interfaces for libblkid
|
||||
*
|
||||
* Copyright (C) 2001 Andreas Dilger
|
||||
* Copyright (C) 2003 Theodore Ts'o
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _BLKID_BLKIDP_H
|
||||
#define _BLKID_BLKIDP_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include <blkid/blkid_local.h>
|
||||
|
||||
#include <blkid/list.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define __BLKID_ATTR(x) __attribute__(x)
|
||||
#else
|
||||
#define __BLKID_ATTR(x)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This describes the attributes of a specific device.
|
||||
* We can traverse all of the tags by bid_tags (linking to the tag bit_names).
|
||||
* The bid_label and bid_uuid fields are shortcuts to the LABEL and UUID tag
|
||||
* values, if they exist.
|
||||
*/
|
||||
struct blkid_struct_dev
|
||||
{
|
||||
struct list_head bid_devs; /* All devices in the cache */
|
||||
struct list_head bid_tags; /* All tags for this device */
|
||||
blkid_cache bid_cache; /* Dev belongs to this cache */
|
||||
char *bid_name; /* Device inode pathname */
|
||||
char *bid_type; /* Preferred device TYPE */
|
||||
int bid_pri; /* Device priority */
|
||||
dev_t bid_devno; /* Device major/minor number */
|
||||
time_t bid_time; /* Last update time of device */
|
||||
unsigned int bid_flags; /* Device status bitflags */
|
||||
char *bid_label; /* Shortcut to device LABEL */
|
||||
char *bid_uuid; /* Shortcut to binary UUID */
|
||||
};
|
||||
|
||||
#define BLKID_BID_FL_VERIFIED 0x0001 /* Device data validated from disk */
|
||||
#define BLKID_BID_FL_INVALID 0x0004 /* Device is invalid */
|
||||
|
||||
/*
|
||||
* Each tag defines a NAME=value pair for a particular device. The tags
|
||||
* are linked via bit_names for a single device, so that traversing the
|
||||
* names list will get you a list of all tags associated with a device.
|
||||
* They are also linked via bit_values for all devices, so one can easily
|
||||
* search all tags with a given NAME for a specific value.
|
||||
*/
|
||||
struct blkid_struct_tag
|
||||
{
|
||||
struct list_head bit_tags; /* All tags for this device */
|
||||
struct list_head bit_names; /* All tags with given NAME */
|
||||
char *bit_name; /* NAME of tag (shared) */
|
||||
char *bit_val; /* value of tag */
|
||||
blkid_dev bit_dev; /* pointer to device */
|
||||
};
|
||||
typedef struct blkid_struct_tag *blkid_tag;
|
||||
|
||||
/*
|
||||
* Minimum number of seconds between device probes, even when reading
|
||||
* from the cache. This is to avoid re-probing all devices which were
|
||||
* just probed by another program that does not share the cache.
|
||||
*/
|
||||
#define BLKID_PROBE_MIN 2
|
||||
|
||||
/*
|
||||
* Time in seconds an entry remains verified in the in-memory cache
|
||||
* before being reverified (in case of long-running processes that
|
||||
* keep a cache in memory and continue to use it for a long time).
|
||||
*/
|
||||
#define BLKID_PROBE_INTERVAL 200
|
||||
|
||||
/* This describes an entire blkid cache file and probed devices.
|
||||
* We can traverse all of the found devices via bic_list.
|
||||
* We can traverse all of the tag types by bic_tags, which hold empty tags
|
||||
* for each tag type. Those tags can be used as list_heads for iterating
|
||||
* through all devices with a specific tag type (e.g. LABEL).
|
||||
*/
|
||||
struct blkid_struct_cache
|
||||
{
|
||||
struct list_head bic_devs; /* List head of all devices */
|
||||
struct list_head bic_tags; /* List head of all tag types */
|
||||
time_t bic_time; /* Last probe time */
|
||||
time_t bic_ftime; /* Mod time of the cachefile */
|
||||
unsigned int bic_flags; /* Status flags of the cache */
|
||||
char *bic_filename; /* filename of cache */
|
||||
};
|
||||
|
||||
#define BLKID_BIC_FL_PROBED 0x0002 /* We probed /proc/partition devices */
|
||||
#define BLKID_BIC_FL_CHANGED 0x0004 /* Cache has changed from disk */
|
||||
|
||||
extern char *blkid_strdup(const char *s);
|
||||
extern char *blkid_strndup(const char *s, const int length);
|
||||
|
||||
#define BLKID_CACHE_FILE "/etc/blkid.tab"
|
||||
|
||||
#define BLKID_ERR_IO 5
|
||||
#define BLKID_ERR_PROC 9
|
||||
#define BLKID_ERR_MEM 12
|
||||
#define BLKID_ERR_CACHE 14
|
||||
#define BLKID_ERR_DEV 19
|
||||
#define BLKID_ERR_PARAM 22
|
||||
#define BLKID_ERR_BIG 27
|
||||
|
||||
/*
|
||||
* Priority settings for different types of devices
|
||||
*/
|
||||
#define BLKID_PRI_DM 40
|
||||
#define BLKID_PRI_EVMS 30
|
||||
#define BLKID_PRI_LVM 20
|
||||
#define BLKID_PRI_MD 10
|
||||
|
||||
#if defined(TEST_PROGRAM) && !defined(CONFIG_BLKID_DEBUG)
|
||||
#define CONFIG_BLKID_DEBUG
|
||||
#endif
|
||||
|
||||
#define DEBUG_CACHE 0x0001
|
||||
#define DEBUG_DUMP 0x0002
|
||||
#define DEBUG_DEV 0x0004
|
||||
#define DEBUG_DEVNAME 0x0008
|
||||
#define DEBUG_DEVNO 0x0010
|
||||
#define DEBUG_PROBE 0x0020
|
||||
#define DEBUG_READ 0x0040
|
||||
#define DEBUG_RESOLVE 0x0080
|
||||
#define DEBUG_SAVE 0x0100
|
||||
#define DEBUG_TAG 0x0200
|
||||
#define DEBUG_INIT 0x8000
|
||||
#define DEBUG_ALL 0xFFFF
|
||||
|
||||
#ifdef CONFIG_BLKID_DEBUG
|
||||
#include <stdio.h>
|
||||
extern int blkid_debug_mask;
|
||||
#define DBG(m,x) if ((m) & blkid_debug_mask) x;
|
||||
#else
|
||||
#define DBG(m,x)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLKID_DEBUG
|
||||
extern void blkid_debug_dump_dev(blkid_dev dev);
|
||||
extern void blkid_debug_dump_tag(blkid_tag tag);
|
||||
#endif
|
||||
|
||||
static inline int blkidP_is_disk_device(mode_t mode)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
return S_ISBLK(mode) || S_ISCHR(mode);
|
||||
#else
|
||||
return S_ISBLK(mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* devno.c */
|
||||
struct dir_list {
|
||||
char *name;
|
||||
struct dir_list *next;
|
||||
};
|
||||
extern void blkid__scan_dir(const char *, dev_t, struct dir_list **, char **);
|
||||
|
||||
/* lseek.c */
|
||||
extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence);
|
||||
|
||||
/* read.c */
|
||||
extern void blkid_read_cache(blkid_cache cache);
|
||||
|
||||
/* save.c */
|
||||
extern int blkid_flush_cache(blkid_cache cache);
|
||||
|
||||
/*
|
||||
* Functions to create and find a specific tag type: tag.c
|
||||
*/
|
||||
extern void blkid_free_tag(blkid_tag tag);
|
||||
extern blkid_tag blkid_find_tag_dev(blkid_dev dev, const char *type);
|
||||
extern int blkid_set_tag(blkid_dev dev, const char *name,
|
||||
const char *value, const int vlength);
|
||||
|
||||
/*
|
||||
* Functions to create and find a specific tag type: dev.c
|
||||
*/
|
||||
extern blkid_dev blkid_new_dev(void);
|
||||
extern void blkid_free_dev(blkid_dev dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BLKID_BLKIDP_H */
|
||||
110
include/e2fsprogs/blkid/blkid_local.h
Executable file
110
include/e2fsprogs/blkid/blkid_local.h
Executable file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* blkid.h - Interface for libblkid, a library to identify block devices
|
||||
*
|
||||
* Copyright (C) 2001 Andreas Dilger
|
||||
* Copyright (C) 2003 Theodore Ts'o
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _BLKID_BLKID_H
|
||||
#define _BLKID_BLKID_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <blkid/blkid_types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLKID_VERSION "1.0.0"
|
||||
#define BLKID_DATE "12-Feb-2003"
|
||||
|
||||
typedef struct blkid_struct_dev *blkid_dev;
|
||||
typedef struct blkid_struct_cache *blkid_cache;
|
||||
typedef __s64 blkid_loff_t;
|
||||
|
||||
typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
|
||||
typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
|
||||
|
||||
/*
|
||||
* Flags for blkid_get_dev
|
||||
*
|
||||
* BLKID_DEV_CREATE Create an empty device structure if not found
|
||||
* in the cache.
|
||||
* BLKID_DEV_VERIFY Make sure the device structure corresponds
|
||||
* with reality.
|
||||
* BLKID_DEV_FIND Just look up a device entry, and return NULL
|
||||
* if it is not found.
|
||||
* BLKID_DEV_NORMAL Get a valid device structure, either from the
|
||||
* cache or by probing the device.
|
||||
*/
|
||||
#define BLKID_DEV_FIND 0x0000
|
||||
#define BLKID_DEV_CREATE 0x0001
|
||||
#define BLKID_DEV_VERIFY 0x0002
|
||||
#define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY)
|
||||
|
||||
/* cache.c */
|
||||
extern void blkid_put_cache(blkid_cache cache);
|
||||
extern int blkid_get_cache(blkid_cache *cache, const char *filename);
|
||||
extern void blkid_gc_cache(blkid_cache cache);
|
||||
|
||||
/* dev.c */
|
||||
extern const char *blkid_dev_devname(blkid_dev dev);
|
||||
|
||||
extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
|
||||
extern int blkid_dev_set_search(blkid_dev_iterate iter,
|
||||
char *search_type, char *search_value);
|
||||
extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
|
||||
extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
|
||||
|
||||
/* devno.c */
|
||||
extern char *blkid_devno_to_devname(dev_t devno);
|
||||
|
||||
/* devname.c */
|
||||
extern int blkid_probe_all(blkid_cache cache);
|
||||
extern int blkid_probe_all_new(blkid_cache cache);
|
||||
extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname,
|
||||
int flags);
|
||||
|
||||
/* getsize.c */
|
||||
extern blkid_loff_t blkid_get_dev_size(int fd);
|
||||
|
||||
/* probe.c */
|
||||
int blkid_known_fstype(const char *fstype);
|
||||
extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev);
|
||||
|
||||
/* read.c */
|
||||
|
||||
/* resolve.c */
|
||||
extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
|
||||
const char *devname);
|
||||
extern char *blkid_get_devname(blkid_cache cache, const char *token,
|
||||
const char *value);
|
||||
|
||||
/* tag.c */
|
||||
extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
|
||||
extern int blkid_tag_next(blkid_tag_iterate iterate,
|
||||
const char **type, const char **value);
|
||||
extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
|
||||
extern int blkid_dev_has_tag(blkid_dev dev, const char *type,
|
||||
const char *value);
|
||||
extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
|
||||
const char *type,
|
||||
const char *value);
|
||||
extern int blkid_parse_tag_string(const char *token, char **ret_type,
|
||||
char **ret_val);
|
||||
|
||||
/* version.c */
|
||||
extern int blkid_parse_version_string(const char *ver_string);
|
||||
extern int blkid_get_library_version(const char **ver_string,
|
||||
const char **date_string);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BLKID_BLKID_H */
|
||||
45
include/e2fsprogs/blkid/blkid_types.h
Executable file
45
include/e2fsprogs/blkid/blkid_types.h
Executable file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* If linux/types.h is already been included, assume it has defined
|
||||
* everything we need. (cross fingers) Other header files may have
|
||||
* also defined the types that we need.
|
||||
*/
|
||||
#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
|
||||
!defined(_EXT2_TYPES_H) && !defined(_UUID_TYPES_H))
|
||||
#define _BLKID_TYPES_H
|
||||
|
||||
typedef unsigned char __u8;
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned short __u16;
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned int __u32;
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned long long __u64;
|
||||
typedef __signed__ long long __s64;
|
||||
#endif
|
||||
|
||||
#include <stdint.h> //uintptr_t
|
||||
|
||||
/* endian checking stuff */
|
||||
#ifndef EXT2_ENDIAN_H_
|
||||
#define EXT2_ENDIAN_H_
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#ifndef __bitwise
|
||||
#define __bitwise __attribute__((bitwise))
|
||||
#endif
|
||||
#define __force __attribute__((force))
|
||||
#else
|
||||
#ifndef __bitwise
|
||||
#define __bitwise
|
||||
#endif
|
||||
#define __force
|
||||
#endif
|
||||
|
||||
typedef __u16 __bitwise __le16;
|
||||
typedef __u32 __bitwise __le32;
|
||||
typedef __u64 __bitwise __le64;
|
||||
typedef __u16 __bitwise __be16;
|
||||
typedef __u32 __bitwise __be32;
|
||||
typedef __u64 __bitwise __be64;
|
||||
|
||||
#endif /* EXT2_ENDIAN_H_ */
|
||||
184
include/e2fsprogs/blkid/list.h
Executable file
184
include/e2fsprogs/blkid/list.h
Executable file
@@ -0,0 +1,184 @@
|
||||
#if !defined(_BLKID_LIST_H) && !defined(LIST_HEAD_INIT)
|
||||
#define _BLKID_LIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _INLINE_ static __inline__
|
||||
#else /* For Watcom C */
|
||||
#define _INLINE_ static inline
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple doubly linked list implementation.
|
||||
*
|
||||
* Some of the internal functions ("__xxx") are useful when
|
||||
* manipulating whole lists rather than single entries, as
|
||||
* sometimes we already know the next/prev entries and we can
|
||||
* generate better code by using them directly rather than
|
||||
* using the generic single-entry routines.
|
||||
*/
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next, *prev;
|
||||
};
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
|
||||
#define INIT_LIST_HEAD(ptr) do { \
|
||||
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Insert a new entry between two known consecutive entries.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
*/
|
||||
_INLINE_ void __list_add(struct list_head * add,
|
||||
struct list_head * prev,
|
||||
struct list_head * next)
|
||||
{
|
||||
next->prev = add;
|
||||
add->next = next;
|
||||
add->prev = prev;
|
||||
prev->next = add;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_add - add a new entry
|
||||
* @add: new entry to be added
|
||||
* @head: list head to add it after
|
||||
*
|
||||
* Insert a new entry after the specified head.
|
||||
* This is good for implementing stacks.
|
||||
*/
|
||||
_INLINE_ void list_add(struct list_head *add, struct list_head *head)
|
||||
{
|
||||
__list_add(add, head, head->next);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_add_tail - add a new entry
|
||||
* @add: new entry to be added
|
||||
* @head: list head to add it before
|
||||
*
|
||||
* Insert a new entry before the specified head.
|
||||
* This is useful for implementing queues.
|
||||
*/
|
||||
_INLINE_ void list_add_tail(struct list_head *add, struct list_head *head)
|
||||
{
|
||||
__list_add(add, head->prev, head);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete a list entry by making the prev/next entries
|
||||
* point to each other.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
*/
|
||||
_INLINE_ void __list_del(struct list_head * prev,
|
||||
struct list_head * next)
|
||||
{
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_del - deletes entry from list.
|
||||
* @entry: the element to delete from the list.
|
||||
*
|
||||
* list_empty() on @entry does not return true after this, @entry is
|
||||
* in an undefined state.
|
||||
*/
|
||||
_INLINE_ void list_del(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_del_init - deletes entry from list and reinitialize it.
|
||||
* @entry: the element to delete from the list.
|
||||
*/
|
||||
_INLINE_ void list_del_init(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
INIT_LIST_HEAD(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_empty - tests whether a list is empty
|
||||
* @head: the list to test.
|
||||
*/
|
||||
_INLINE_ int list_empty(struct list_head *head)
|
||||
{
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice - join two lists
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*/
|
||||
_INLINE_ void list_splice(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
struct list_head *first = list->next;
|
||||
|
||||
if (first != list) {
|
||||
struct list_head *last = list->prev;
|
||||
struct list_head *at = head->next;
|
||||
|
||||
first->prev = head;
|
||||
head->next = first;
|
||||
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list_entry - get the struct for this entry
|
||||
* @ptr: the &struct list_head pointer.
|
||||
* @type: the type of the struct this is embedded in.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*/
|
||||
#define list_entry(ptr, type, member) \
|
||||
((type *)((char *)(ptr)-(unsigned long)(intptr_t)(&((type *)0)->member)))
|
||||
|
||||
/**
|
||||
* list_for_each - iterate over elements in a list
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; pos != (head); pos = pos->next)
|
||||
|
||||
/**
|
||||
* list_for_each_safe - iterate over elements in a list, but don't dereference
|
||||
* pos after the body is done (in case it is freed)
|
||||
* @pos: the &struct list_head to use as a loop counter.
|
||||
* @pnext: the &struct list_head to use as a pointer to the next item.
|
||||
* @head: the head for your list (not included in iteration).
|
||||
*/
|
||||
#define list_for_each_safe(pos, pnext, head) \
|
||||
for (pos = (head)->next, pnext = pos->next; pos != (head); \
|
||||
pos = pnext, pnext = pos->next)
|
||||
|
||||
#undef _INLINE_
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BLKID_LIST_H */
|
||||
852
include/e2fsprogs/blkid/probe.h
Executable file
852
include/e2fsprogs/blkid/probe.h
Executable file
@@ -0,0 +1,852 @@
|
||||
/*
|
||||
* probe.h - constants and on-disk structures for extracting device data
|
||||
*
|
||||
* Copyright (C) 1999 by Andries Brouwer
|
||||
* Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
|
||||
* Copyright (C) 2001 by Andreas Dilger
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _BLKID_PROBE_H
|
||||
#define _BLKID_PROBE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <blkid/blkid_types.h>
|
||||
|
||||
struct blkid_magic;
|
||||
|
||||
#define SB_BUFFER_SIZE 0x11000
|
||||
|
||||
struct blkid_probe {
|
||||
int fd;
|
||||
blkid_cache cache;
|
||||
blkid_dev dev;
|
||||
unsigned char *sbbuf;
|
||||
size_t sb_valid;
|
||||
unsigned char *buf;
|
||||
size_t buf_max;
|
||||
};
|
||||
|
||||
typedef int (*blkid_probe_t)(struct blkid_probe *probe,
|
||||
struct blkid_magic *id, unsigned char *buf);
|
||||
|
||||
struct blkid_magic {
|
||||
const char *bim_type; /* type name for this magic */
|
||||
long bim_kboff; /* kilobyte offset of superblock */
|
||||
unsigned bim_sboff; /* byte offset within superblock */
|
||||
unsigned bim_len; /* length of magic */
|
||||
const char *bim_magic; /* magic string */
|
||||
blkid_probe_t bim_probe; /* probe function */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structures for each of the content types we want to extract information
|
||||
* from. We do not necessarily need the magic field here, because we have
|
||||
* already identified the content type before we get this far. It may still
|
||||
* be useful if there are probe functions which handle multiple content types.
|
||||
*/
|
||||
struct ext2_super_block {
|
||||
__u32 s_inodes_count;
|
||||
__u32 s_blocks_count;
|
||||
__u32 s_r_blocks_count;
|
||||
__u32 s_free_blocks_count;
|
||||
__u32 s_free_inodes_count;
|
||||
__u32 s_first_data_block;
|
||||
__u32 s_log_block_size;
|
||||
__u32 s_dummy3[7];
|
||||
unsigned char s_magic[2];
|
||||
__u16 s_state;
|
||||
__u32 s_dummy5[8];
|
||||
__u32 s_feature_compat;
|
||||
__u32 s_feature_incompat;
|
||||
__u32 s_feature_ro_compat;
|
||||
unsigned char s_uuid[16];
|
||||
char s_volume_name[16];
|
||||
char s_last_mounted[64];
|
||||
__u32 s_algorithm_usage_bitmap;
|
||||
__u8 s_prealloc_blocks;
|
||||
__u8 s_prealloc_dir_blocks;
|
||||
__u16 s_reserved_gdt_blocks;
|
||||
__u8 s_journal_uuid[16];
|
||||
__u32 s_journal_inum;
|
||||
__u32 s_journal_dev;
|
||||
__u32 s_last_orphan;
|
||||
__u32 s_hash_seed[4];
|
||||
__u8 s_def_hash_version;
|
||||
__u8 s_jnl_backup_type;
|
||||
__u16 s_reserved_word_pad;
|
||||
__u32 s_default_mount_opts;
|
||||
__u32 s_first_meta_bg;
|
||||
__u32 s_mkfs_time;
|
||||
__u32 s_jnl_blocks[17];
|
||||
__u32 s_blocks_count_hi;
|
||||
__u32 s_r_blocks_count_hi;
|
||||
__u32 s_free_blocks_hi;
|
||||
__u16 s_min_extra_isize;
|
||||
__u16 s_want_extra_isize;
|
||||
__u32 s_flags;
|
||||
__u16 s_raid_stride;
|
||||
__u16 s_mmp_interval;
|
||||
__u64 s_mmp_block;
|
||||
__u32 s_raid_stripe_width;
|
||||
__u32 s_reserved[163];
|
||||
};
|
||||
|
||||
/* for s_flags */
|
||||
#define EXT2_FLAGS_TEST_FILESYS 0x0004
|
||||
|
||||
/* for s_feature_compat */
|
||||
#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
|
||||
|
||||
/* for s_feature_ro_compat */
|
||||
#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
||||
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
||||
#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
|
||||
#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
|
||||
#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
|
||||
#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
|
||||
#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
|
||||
#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
|
||||
#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400
|
||||
|
||||
/* for s_feature_incompat */
|
||||
#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
|
||||
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
|
||||
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
|
||||
#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
|
||||
#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
|
||||
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
|
||||
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
|
||||
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
|
||||
|
||||
#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||
EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
|
||||
EXT2_FEATURE_INCOMPAT_META_BG)
|
||||
#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP
|
||||
#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP
|
||||
|
||||
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
||||
EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
||||
#define EXT3_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
|
||||
EXT3_FEATURE_INCOMPAT_RECOVER| \
|
||||
EXT2_FEATURE_INCOMPAT_META_BG)
|
||||
#define EXT3_FEATURE_INCOMPAT_UNSUPPORTED ~EXT3_FEATURE_INCOMPAT_SUPP
|
||||
#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT3_FEATURE_RO_COMPAT_SUPP
|
||||
|
||||
|
||||
struct xfs_super_block {
|
||||
unsigned char xs_magic[4];
|
||||
__u32 xs_blocksize;
|
||||
__u64 xs_dblocks;
|
||||
__u64 xs_rblocks;
|
||||
__u32 xs_dummy1[2];
|
||||
unsigned char xs_uuid[16];
|
||||
__u32 xs_dummy2[15];
|
||||
char xs_fname[12];
|
||||
__u32 xs_dummy3[2];
|
||||
__u64 xs_icount;
|
||||
__u64 xs_ifree;
|
||||
__u64 xs_fdblocks;
|
||||
};
|
||||
|
||||
struct reiserfs_super_block {
|
||||
__u32 rs_blocks_count;
|
||||
__u32 rs_free_blocks;
|
||||
__u32 rs_root_block;
|
||||
__u32 rs_journal_block;
|
||||
__u32 rs_journal_dev;
|
||||
__u32 rs_orig_journal_size;
|
||||
__u32 rs_dummy2[5];
|
||||
__u16 rs_blocksize;
|
||||
__u16 rs_dummy3[3];
|
||||
unsigned char rs_magic[12];
|
||||
__u32 rs_dummy4[5];
|
||||
unsigned char rs_uuid[16];
|
||||
char rs_label[16];
|
||||
};
|
||||
|
||||
struct reiser4_super_block {
|
||||
unsigned char rs4_magic[16];
|
||||
__u16 rs4_dummy[2];
|
||||
unsigned char rs4_uuid[16];
|
||||
unsigned char rs4_label[16];
|
||||
__u64 rs4_dummy2;
|
||||
};
|
||||
|
||||
struct jfs_super_block {
|
||||
unsigned char js_magic[4];
|
||||
__u32 js_version;
|
||||
__u64 js_size;
|
||||
__u32 js_bsize; /* 4: aggregate block size in bytes */
|
||||
__u16 js_l2bsize; /* 2: log2 of s_bsize */
|
||||
__u16 js_l2bfactor; /* 2: log2(s_bsize/hardware block size) */
|
||||
__u32 js_pbsize; /* 4: hardware/LVM block size in bytes */
|
||||
__u16 js_l2pbsize; /* 2: log2 of s_pbsize */
|
||||
__u16 js_pad; /* 2: padding necessary for alignment */
|
||||
__u32 js_dummy2[26];
|
||||
unsigned char js_uuid[16];
|
||||
unsigned char js_label[16];
|
||||
unsigned char js_loguuid[16];
|
||||
};
|
||||
|
||||
struct romfs_super_block {
|
||||
unsigned char ros_magic[8];
|
||||
__u32 ros_dummy1[2];
|
||||
unsigned char ros_volume[16];
|
||||
};
|
||||
|
||||
struct cramfs_super_block {
|
||||
__u8 magic[4];
|
||||
__u32 size;
|
||||
__u32 flags;
|
||||
__u32 future;
|
||||
__u8 signature[16];
|
||||
struct cramfs_info {
|
||||
__u32 crc;
|
||||
__u32 edition;
|
||||
__u32 blocks;
|
||||
__u32 files;
|
||||
} info;
|
||||
__u8 name[16];
|
||||
};
|
||||
|
||||
struct swap_id_block {
|
||||
/* unsigned char sws_boot[1024]; */
|
||||
__u32 sws_version;
|
||||
__u32 sws_lastpage;
|
||||
__u32 sws_nrbad;
|
||||
unsigned char sws_uuid[16];
|
||||
char sws_volume[16];
|
||||
unsigned char sws_pad[117];
|
||||
__u32 sws_badpg;
|
||||
};
|
||||
|
||||
/* Yucky misaligned values */
|
||||
struct vfat_super_block {
|
||||
/* 00*/ unsigned char vs_ignored[3];
|
||||
/* 03*/ unsigned char vs_sysid[8];
|
||||
/* 0b*/ unsigned char vs_sector_size[2];
|
||||
/* 0d*/ __u8 vs_cluster_size;
|
||||
/* 0e*/ __u16 vs_reserved;
|
||||
/* 10*/ __u8 vs_fats;
|
||||
/* 11*/ unsigned char vs_dir_entries[2];
|
||||
/* 13*/ unsigned char vs_sectors[2];
|
||||
/* 15*/ unsigned char vs_media;
|
||||
/* 16*/ __u16 vs_fat_length;
|
||||
/* 18*/ __u16 vs_secs_track;
|
||||
/* 1a*/ __u16 vs_heads;
|
||||
/* 1c*/ __u32 vs_hidden;
|
||||
/* 20*/ __u32 vs_total_sect;
|
||||
/* 24*/ __u32 vs_fat32_length;
|
||||
/* 28*/ __u16 vs_flags;
|
||||
/* 2a*/ __u8 vs_version[2];
|
||||
/* 2c*/ __u32 vs_root_cluster;
|
||||
/* 30*/ __u16 vs_insfo_sector;
|
||||
/* 32*/ __u16 vs_backup_boot;
|
||||
/* 34*/ __u16 vs_reserved2[6];
|
||||
/* 40*/ unsigned char vs_unknown[3];
|
||||
/* 43*/ unsigned char vs_serno[4];
|
||||
/* 47*/ unsigned char vs_label[11];
|
||||
/* 52*/ unsigned char vs_magic[8];
|
||||
/* 5a*/ unsigned char vs_dummy2[164];
|
||||
/*1fe*/ unsigned char vs_pmagic[2];
|
||||
};
|
||||
|
||||
/* Yucky misaligned values */
|
||||
struct msdos_super_block {
|
||||
/* 00*/ unsigned char ms_ignored[3];
|
||||
/* 03*/ unsigned char ms_sysid[8];
|
||||
/* 0b*/ unsigned char ms_sector_size[2];
|
||||
/* 0d*/ __u8 ms_cluster_size;
|
||||
/* 0e*/ __u16 ms_reserved;
|
||||
/* 10*/ __u8 ms_fats;
|
||||
/* 11*/ unsigned char ms_dir_entries[2];
|
||||
/* 13*/ unsigned char ms_sectors[2];
|
||||
/* 15*/ unsigned char ms_media;
|
||||
/* 16*/ __u16 ms_fat_length;
|
||||
/* 18*/ __u16 ms_secs_track;
|
||||
/* 1a*/ __u16 ms_heads;
|
||||
/* 1c*/ __u32 ms_hidden;
|
||||
/* 20*/ __u32 ms_total_sect;
|
||||
/* 24*/ unsigned char ms_unknown[3];
|
||||
/* 27*/ unsigned char ms_serno[4];
|
||||
/* 2b*/ unsigned char ms_label[11];
|
||||
/* 36*/ unsigned char ms_magic[8];
|
||||
/* 3d*/ unsigned char ms_dummy2[192];
|
||||
/*1fe*/ unsigned char ms_pmagic[2];
|
||||
};
|
||||
|
||||
struct vfat_dir_entry {
|
||||
__u8 name[11];
|
||||
__u8 attr;
|
||||
__u16 time_creat;
|
||||
__u16 date_creat;
|
||||
__u16 time_acc;
|
||||
__u16 date_acc;
|
||||
__u16 cluster_high;
|
||||
__u16 time_write;
|
||||
__u16 date_write;
|
||||
__u16 cluster_low;
|
||||
__u32 size;
|
||||
};
|
||||
|
||||
/* maximum number of clusters */
|
||||
#define FAT12_MAX 0xFF4
|
||||
#define FAT16_MAX 0xFFF4
|
||||
#define FAT32_MAX 0x0FFFFFF6
|
||||
|
||||
struct minix_super_block {
|
||||
__u16 ms_ninodes;
|
||||
__u16 ms_nzones;
|
||||
__u16 ms_imap_blocks;
|
||||
__u16 ms_zmap_blocks;
|
||||
__u16 ms_firstdatazone;
|
||||
__u16 ms_log_zone_size;
|
||||
__u32 ms_max_size;
|
||||
unsigned char ms_magic[2];
|
||||
__u16 ms_state;
|
||||
__u32 ms_zones;
|
||||
};
|
||||
|
||||
struct mdp_superblock_s {
|
||||
__u32 md_magic;
|
||||
__u32 major_version;
|
||||
__u32 minor_version;
|
||||
__u32 patch_version;
|
||||
__u32 gvalid_words;
|
||||
__u32 set_uuid0;
|
||||
__u32 ctime;
|
||||
__u32 level;
|
||||
__u32 size;
|
||||
__u32 nr_disks;
|
||||
__u32 raid_disks;
|
||||
__u32 md_minor;
|
||||
__u32 not_persistent;
|
||||
__u32 set_uuid1;
|
||||
__u32 set_uuid2;
|
||||
__u32 set_uuid3;
|
||||
};
|
||||
|
||||
struct hfs_super_block {
|
||||
char h_magic[2];
|
||||
char h_dummy[18];
|
||||
__u32 h_blksize;
|
||||
};
|
||||
|
||||
struct ocfs_volume_header {
|
||||
unsigned char minor_version[4];
|
||||
unsigned char major_version[4];
|
||||
unsigned char signature[128];
|
||||
char mount[128];
|
||||
unsigned char mount_len[2];
|
||||
};
|
||||
|
||||
struct ocfs_volume_label {
|
||||
unsigned char disk_lock[48];
|
||||
char label[64];
|
||||
unsigned char label_len[2];
|
||||
unsigned char vol_id[16];
|
||||
unsigned char vol_id_len[2];
|
||||
};
|
||||
|
||||
#define ocfsmajor(o) ((__u32)o.major_version[0] \
|
||||
+ (((__u32) o.major_version[1]) << 8) \
|
||||
+ (((__u32) o.major_version[2]) << 16) \
|
||||
+ (((__u32) o.major_version[3]) << 24))
|
||||
#define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8))
|
||||
#define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8))
|
||||
|
||||
#define OCFS_MAGIC "OracleCFS"
|
||||
|
||||
struct ocfs2_super_block {
|
||||
unsigned char signature[8];
|
||||
unsigned char s_dummy1[184];
|
||||
unsigned char s_dummy2[80];
|
||||
char s_label[64];
|
||||
unsigned char s_uuid[16];
|
||||
};
|
||||
|
||||
#define OCFS2_MIN_BLOCKSIZE 512
|
||||
#define OCFS2_MAX_BLOCKSIZE 4096
|
||||
|
||||
#define OCFS2_SUPER_BLOCK_BLKNO 2
|
||||
|
||||
#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
|
||||
|
||||
struct oracle_asm_disk_label {
|
||||
char dummy[32];
|
||||
char dl_tag[8];
|
||||
char dl_id[24];
|
||||
};
|
||||
|
||||
#define ORACLE_ASM_DISK_LABEL_MARKED "ORCLDISK"
|
||||
#define ORACLE_ASM_DISK_LABEL_OFFSET 32
|
||||
|
||||
struct iso_volume_descriptor {
|
||||
unsigned char vd_type;
|
||||
unsigned char vd_id[5];
|
||||
unsigned char vd_version;
|
||||
unsigned char flags;
|
||||
unsigned char system_id[32];
|
||||
unsigned char volume_id[32];
|
||||
unsigned char unused[8];
|
||||
unsigned char space_size[8];
|
||||
unsigned char escape_sequences[8];
|
||||
};
|
||||
|
||||
/* Common gfs/gfs2 constants: */
|
||||
#define GFS_MAGIC 0x01161970
|
||||
#define GFS_DEFAULT_BSIZE 4096
|
||||
#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE)
|
||||
#define GFS_METATYPE_SB 1
|
||||
#define GFS_FORMAT_SB 100
|
||||
#define GFS_LOCKNAME_LEN 64
|
||||
|
||||
/* gfs1 constants: */
|
||||
#define GFS_FORMAT_FS 1309
|
||||
#define GFS_FORMAT_MULTI 1401
|
||||
/* gfs2 constants: */
|
||||
#define GFS2_FORMAT_FS 1801
|
||||
#define GFS2_FORMAT_MULTI 1900
|
||||
|
||||
struct gfs2_meta_header {
|
||||
__u32 mh_magic;
|
||||
__u32 mh_type;
|
||||
__u64 __pad0; /* Was generation number in gfs1 */
|
||||
__u32 mh_format;
|
||||
__u32 __pad1; /* Was incarnation number in gfs1 */
|
||||
};
|
||||
|
||||
struct gfs2_inum {
|
||||
__u64 no_formal_ino;
|
||||
__u64 no_addr;
|
||||
};
|
||||
|
||||
struct gfs2_sb {
|
||||
struct gfs2_meta_header sb_header;
|
||||
|
||||
__u32 sb_fs_format;
|
||||
__u32 sb_multihost_format;
|
||||
__u32 __pad0; /* Was superblock flags in gfs1 */
|
||||
|
||||
__u32 sb_bsize;
|
||||
__u32 sb_bsize_shift;
|
||||
__u32 __pad1; /* Was journal segment size in gfs1 */
|
||||
|
||||
struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
|
||||
struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
|
||||
struct gfs2_inum sb_root_dir;
|
||||
|
||||
char sb_lockproto[GFS_LOCKNAME_LEN];
|
||||
char sb_locktable[GFS_LOCKNAME_LEN];
|
||||
/* In gfs1, quota and license dinodes followed */
|
||||
};
|
||||
|
||||
struct ntfs_super_block {
|
||||
__u8 jump[3];
|
||||
__u8 oem_id[8];
|
||||
__u8 bios_parameter_block[25];
|
||||
__u16 unused[2];
|
||||
__u64 number_of_sectors;
|
||||
__u64 mft_cluster_location;
|
||||
__u64 mft_mirror_cluster_location;
|
||||
__s8 cluster_per_mft_record;
|
||||
__u8 reserved1[3];
|
||||
__s8 cluster_per_index_record;
|
||||
__u8 reserved2[3];
|
||||
__u64 volume_serial;
|
||||
__u16 checksum;
|
||||
};
|
||||
|
||||
struct master_file_table_record {
|
||||
__u32 magic;
|
||||
__u16 usa_ofs;
|
||||
__u16 usa_count;
|
||||
__u64 lsn;
|
||||
__u16 sequence_number;
|
||||
__u16 link_count;
|
||||
__u16 attrs_offset;
|
||||
__u16 flags;
|
||||
__u32 bytes_in_use;
|
||||
__u32 bytes_allocated;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct file_attribute {
|
||||
__u32 type;
|
||||
__u32 len;
|
||||
__u8 non_resident;
|
||||
__u8 name_len;
|
||||
__u16 name_offset;
|
||||
__u16 flags;
|
||||
__u16 instance;
|
||||
__u32 value_len;
|
||||
__u16 value_offset;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define MFT_RECORD_VOLUME 3
|
||||
#define MFT_RECORD_ATTR_VOLUME_NAME 0x60
|
||||
#define MFT_RECORD_ATTR_VOLUME_INFO 0x70
|
||||
#define MFT_RECORD_ATTR_OBJECT_ID 0x40
|
||||
#define MFT_RECORD_ATTR_END 0xffffffffu
|
||||
|
||||
/* HFS / HFS+ */
|
||||
struct hfs_finder_info {
|
||||
__u32 boot_folder;
|
||||
__u32 start_app;
|
||||
__u32 open_folder;
|
||||
__u32 os9_folder;
|
||||
__u32 reserved;
|
||||
__u32 osx_folder;
|
||||
__u8 id[8];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hfs_mdb {
|
||||
__u8 signature[2];
|
||||
__u32 cr_date;
|
||||
__u32 ls_Mod;
|
||||
__u16 atrb;
|
||||
__u16 nm_fls;
|
||||
__u16 vbm_st;
|
||||
__u16 alloc_ptr;
|
||||
__u16 nm_al_blks;
|
||||
__u32 al_blk_size;
|
||||
__u32 clp_size;
|
||||
__u16 al_bl_st;
|
||||
__u32 nxt_cnid;
|
||||
__u16 free_bks;
|
||||
__u8 label_len;
|
||||
__u8 label[27];
|
||||
__u32 vol_bkup;
|
||||
__u16 vol_seq_num;
|
||||
__u32 wr_cnt;
|
||||
__u32 xt_clump_size;
|
||||
__u32 ct_clump_size;
|
||||
__u16 num_root_dirs;
|
||||
__u32 file_count;
|
||||
__u32 dir_count;
|
||||
struct hfs_finder_info finder_info;
|
||||
__u8 embed_sig[2];
|
||||
__u16 embed_startblock;
|
||||
__u16 embed_blockcount;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
#define HFS_NODE_LEAF 0xff
|
||||
#define HFSPLUS_POR_CNID 1
|
||||
|
||||
struct hfsplus_bnode_descriptor {
|
||||
__u32 next;
|
||||
__u32 prev;
|
||||
__u8 type;
|
||||
__u8 height;
|
||||
__u16 num_recs;
|
||||
__u16 reserved;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hfsplus_bheader_record {
|
||||
__u16 depth;
|
||||
__u32 root;
|
||||
__u32 leaf_count;
|
||||
__u32 leaf_head;
|
||||
__u32 leaf_tail;
|
||||
__u16 node_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hfsplus_catalog_key {
|
||||
__u16 key_len;
|
||||
__u32 parent_id;
|
||||
__u16 unicode_len;
|
||||
__u8 unicode[255 * 2];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hfsplus_extent {
|
||||
__u32 start_block;
|
||||
__u32 block_count;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define HFSPLUS_EXTENT_COUNT 8
|
||||
struct hfsplus_fork {
|
||||
__u64 total_size;
|
||||
__u32 clump_size;
|
||||
__u32 total_blocks;
|
||||
struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct hfsplus_vol_header {
|
||||
__u8 signature[2];
|
||||
__u16 version;
|
||||
__u32 attributes;
|
||||
__u32 last_mount_vers;
|
||||
__u32 reserved;
|
||||
__u32 create_date;
|
||||
__u32 modify_date;
|
||||
__u32 backup_date;
|
||||
__u32 checked_date;
|
||||
__u32 file_count;
|
||||
__u32 folder_count;
|
||||
__u32 blocksize;
|
||||
__u32 total_blocks;
|
||||
__u32 free_blocks;
|
||||
__u32 next_alloc;
|
||||
__u32 rsrc_clump_sz;
|
||||
__u32 data_clump_sz;
|
||||
__u32 next_cnid;
|
||||
__u32 write_count;
|
||||
__u64 encodings_bmp;
|
||||
struct hfs_finder_info finder_info;
|
||||
struct hfsplus_fork alloc_file;
|
||||
struct hfsplus_fork ext_file;
|
||||
struct hfsplus_fork cat_file;
|
||||
struct hfsplus_fork attr_file;
|
||||
struct hfsplus_fork start_file;
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/* this is lvm's label_header & pv_header combined. */
|
||||
|
||||
#define LVM2_ID_LEN 32
|
||||
|
||||
struct lvm2_pv_label_header {
|
||||
/* label_header */
|
||||
__u8 id[8]; /* LABELONE */
|
||||
__u64 sector_xl; /* Sector number of this label */
|
||||
__u32 crc_xl; /* From next field to end of sector */
|
||||
__u32 offset_xl; /* Offset from start of struct to contents */
|
||||
__u8 type[8]; /* LVM2 001 */
|
||||
/* pv_header */
|
||||
__u8 pv_uuid[LVM2_ID_LEN];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/*
|
||||
* this is a very generous portion of the super block, giving us
|
||||
* room to translate 14 chunks with 3 stripes each.
|
||||
*/
|
||||
#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
|
||||
#define BTRFS_LABEL_SIZE 256
|
||||
#define BTRFS_UUID_SIZE 16
|
||||
#define BTRFS_FSID_SIZE 16
|
||||
#define BTRFS_CSUM_SIZE 32
|
||||
|
||||
struct btrfs_dev_item {
|
||||
/* the internal btrfs device id */
|
||||
__u64 devid;
|
||||
|
||||
/* size of the device */
|
||||
__u64 total_bytes;
|
||||
|
||||
/* bytes used */
|
||||
__u64 bytes_used;
|
||||
|
||||
/* optimal io alignment for this device */
|
||||
__u32 io_align;
|
||||
|
||||
/* optimal io width for this device */
|
||||
__u32 io_width;
|
||||
|
||||
/* minimal io size for this device */
|
||||
__u32 sector_size;
|
||||
|
||||
/* type and info about this device */
|
||||
__u64 type;
|
||||
|
||||
/* expected generation for this device */
|
||||
__u64 generation;
|
||||
|
||||
/*
|
||||
* starting byte of this partition on the device,
|
||||
* to allow for stripe alignment in the future
|
||||
*/
|
||||
__u64 start_offset;
|
||||
|
||||
/* grouping information for allocation decisions */
|
||||
__u32 dev_group;
|
||||
|
||||
/* seek speed 0-100 where 100 is fastest */
|
||||
__u8 seek_speed;
|
||||
|
||||
/* bandwidth 0-100 where 100 is fastest */
|
||||
__u8 bandwidth;
|
||||
|
||||
/* btrfs generated uuid for this device */
|
||||
__u8 uuid[BTRFS_UUID_SIZE];
|
||||
|
||||
/* uuid of FS who owns this device */
|
||||
__u8 fsid[BTRFS_UUID_SIZE];
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
/*
|
||||
* the super block basically lists the main trees of the FS
|
||||
* it currently lacks any block count etc etc
|
||||
*/
|
||||
struct btrfs_super_block {
|
||||
__u8 csum[BTRFS_CSUM_SIZE];
|
||||
/* the first 3 fields must match struct btrfs_header */
|
||||
__u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
|
||||
__u64 bytenr; /* this block number */
|
||||
__u64 flags;
|
||||
|
||||
/* allowed to be different from the btrfs_header from here own down */
|
||||
__u64 magic;
|
||||
__u64 generation;
|
||||
__u64 root;
|
||||
__u64 chunk_root;
|
||||
__u64 log_root;
|
||||
|
||||
/* this will help find the new super based on the log root */
|
||||
__u64 log_root_transid;
|
||||
__u64 total_bytes;
|
||||
__u64 bytes_used;
|
||||
__u64 root_dir_objectid;
|
||||
__u64 num_devices;
|
||||
__u32 sectorsize;
|
||||
__u32 nodesize;
|
||||
__u32 leafsize;
|
||||
__u32 stripesize;
|
||||
__u32 sys_chunk_array_size;
|
||||
__u64 chunk_root_generation;
|
||||
__u64 compat_flags;
|
||||
__u64 compat_ro_flags;
|
||||
__u64 incompat_flags;
|
||||
__u16 csum_type;
|
||||
__u8 root_level;
|
||||
__u8 chunk_root_level;
|
||||
__u8 log_root_level;
|
||||
struct btrfs_dev_item dev_item;
|
||||
|
||||
char label[BTRFS_LABEL_SIZE];
|
||||
|
||||
/* future expansion */
|
||||
__u64 reserved[32];
|
||||
__u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
|
||||
|
||||
struct f2fs_super_block {
|
||||
__u32 magic; /* Magic Number */
|
||||
__u16 major_ver; /* Major Version */
|
||||
__u16 minor_ver; /* Minor Version */
|
||||
__u32 log_sectorsize; /* log2 sector size in bytes */
|
||||
__u32 log_sectors_per_block; /* log2 # of sectors per block */
|
||||
__u32 log_blocksize; /* log2 block size in bytes */
|
||||
__u32 log_blocks_per_seg; /* log2 # of blocks per segment */
|
||||
__u32 segs_per_sec; /* # of segments per section */
|
||||
__u32 secs_per_zone; /* # of sections per zone */
|
||||
__u32 checksum_offset; /* checksum offset inside super block */
|
||||
__u64 block_count; /* total # of user blocks */
|
||||
__u32 section_count; /* total # of sections */
|
||||
__u32 segment_count; /* total # of segments */
|
||||
__u32 segment_count_ckpt; /* # of segments for checkpoint */
|
||||
__u32 segment_count_sit; /* # of segments for SIT */
|
||||
__u32 segment_count_nat; /* # of segments for NAT */
|
||||
__u32 segment_count_ssa; /* # of segments for SSA */
|
||||
__u32 segment_count_main; /* # of segments for main area */
|
||||
__u32 segment0_blkaddr; /* start block address of segment 0 */
|
||||
__u32 cp_blkaddr; /* start block address of checkpoint */
|
||||
__u32 sit_blkaddr; /* start block address of SIT */
|
||||
__u32 nat_blkaddr; /* start block address of NAT */
|
||||
__u32 ssa_blkaddr; /* start block address of SSA */
|
||||
__u32 main_blkaddr; /* start block address of main area */
|
||||
__u32 root_ino; /* root inode number */
|
||||
__u32 node_ino; /* node inode number */
|
||||
__u32 meta_ino; /* meta inode number */
|
||||
__u8 uuid[16]; /* 128-bit uuid for volume */
|
||||
__u16 volume_name[512]; /* volume name */
|
||||
__u32 extension_count; /* # of extensions below */
|
||||
__u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct exfat_super_block {
|
||||
uint8_t jump[3];
|
||||
uint8_t oem_name[8];
|
||||
uint8_t __unused1[53];
|
||||
uint64_t block_start;
|
||||
uint64_t block_count;
|
||||
uint32_t fat_block_start;
|
||||
uint32_t fat_block_count;
|
||||
uint32_t cluster_block_start;
|
||||
uint32_t cluster_count;
|
||||
uint32_t rootdir_cluster;
|
||||
uint8_t volume_serial[4];
|
||||
struct {
|
||||
uint8_t vermin;
|
||||
uint8_t vermaj;
|
||||
} version;
|
||||
uint16_t volume_state;
|
||||
uint8_t block_bits;
|
||||
uint8_t bpc_bits;
|
||||
uint8_t fat_count;
|
||||
uint8_t drive_no;
|
||||
uint8_t allocated_percent;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct exfat_entry_label {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint8_t name[30];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define BLOCK_SIZE(sb) (1 << (sb)->block_bits)
|
||||
#define CLUSTER_SIZE(sb) (BLOCK_SIZE(sb) << (sb)->bpc_bits)
|
||||
|
||||
#define EXFAT_FIRST_DATA_CLUSTER 2
|
||||
#define EXFAT_LAST_DATA_CLUSTER 0xffffff6
|
||||
#define EXFAT_ENTRY_SIZE 32
|
||||
|
||||
#define EXFAT_ENTRY_EOD 0x00
|
||||
#define EXFAT_ENTRY_LABEL 0x83
|
||||
|
||||
/*
|
||||
* Byte swap functions
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define _INLINE_ static __inline__
|
||||
#else /* For Watcom C */
|
||||
#define _INLINE_ static inline
|
||||
#endif
|
||||
|
||||
_INLINE_ __u16 blkid_swab16(__u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
|
||||
_INLINE_ __u32 blkid_swab32(__u32 val)
|
||||
{
|
||||
return ((val>>24) | ((val>>8)&0xFF00) |
|
||||
((val<<8)&0xFF0000) | (val<<24));
|
||||
}
|
||||
|
||||
_INLINE_ __u64 blkid_swab64(__u64 val)
|
||||
{
|
||||
return (blkid_swab32(val >> 32) |
|
||||
(((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
|
||||
}
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define blkid_le16(x) blkid_swab16(x)
|
||||
#define blkid_le32(x) blkid_swab32(x)
|
||||
#define blkid_le64(x) blkid_swab64(x)
|
||||
#define blkid_be16(x) (x)
|
||||
#define blkid_be32(x) (x)
|
||||
#define blkid_be64(x) (x)
|
||||
#else
|
||||
#define blkid_le16(x) (x)
|
||||
#define blkid_le32(x) (x)
|
||||
#define blkid_le64(x) (x)
|
||||
#define blkid_be16(x) blkid_swab16(x)
|
||||
#define blkid_be32(x) blkid_swab32(x)
|
||||
#define blkid_be64(x) blkid_swab64(x)
|
||||
#endif
|
||||
|
||||
#undef _INLINE_
|
||||
|
||||
#endif /* _BLKID_PROBE_H */
|
||||
678
include/e2fsprogs/config.h
Executable file
678
include/e2fsprogs/config.h
Executable file
@@ -0,0 +1,678 @@
|
||||
/* lib/config.h. Generated from config.h.in by configure. */
|
||||
/* lib/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* Define to 1 if debugging the blkid library */
|
||||
/* #undef CONFIG_BLKID_DEBUG */
|
||||
|
||||
/* Define to 1 to compile findfs */
|
||||
/* #undef CONFIG_BUILD_FINDFS */
|
||||
|
||||
/* Define to 1 for features for use by ext4 developers */
|
||||
/* #undef CONFIG_DEVELOPER_FEATURES */
|
||||
|
||||
/* Define to 1 if using dlopen to access libarchive */
|
||||
#define CONFIG_DLOPEN_LIBARCHIVE 1
|
||||
|
||||
/* Define to 1 if debugging ext3/4 journal code */
|
||||
/* #undef CONFIG_JBD_DEBUG */
|
||||
|
||||
/* Define to 1 to enable mmp support */
|
||||
#define CONFIG_MMP 1
|
||||
|
||||
/* Define to 1 to enable tdb support */
|
||||
#define CONFIG_TDB 1
|
||||
|
||||
/* Define to 1 if the testio I/O manager should be enabled */
|
||||
#define CONFIG_TESTIO_DEBUG 1
|
||||
|
||||
/* Define to 1 to disable use of backtrace */
|
||||
/* #undef DISABLE_BACKTRACE */
|
||||
|
||||
/* Define to 1 to enable bitmap stats. */
|
||||
#define ENABLE_BMAP_STATS 1
|
||||
|
||||
/* Define to 1 to enable bitmap stats. */
|
||||
/* #undef ENABLE_BMAP_STATS_OPS */
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
/* #undef ENABLE_NLS */
|
||||
|
||||
/* Define to the version of FUSE to use */
|
||||
#define FUSE_USE_VERSION 29
|
||||
|
||||
/* Define to 1 if you have the `add_key' function. */
|
||||
/* #undef HAVE_ADD_KEY */
|
||||
|
||||
/* Define to 1 if you have the <archive.h> header file. */
|
||||
#define HAVE_ARCHIVE_H 1
|
||||
|
||||
/* Define to 1 if you have the <attr/xattr.h> header file. */
|
||||
/* #undef HAVE_ATTR_XATTR_H */
|
||||
|
||||
/* Define to 1 if you have the `backtrace' function. */
|
||||
#define HAVE_BACKTRACE 1
|
||||
|
||||
/* Define to 1 if blkid has blkid_probe_enable_partitions */
|
||||
// #define HAVE_BLKID_PROBE_ENABLE_PARTITIONS 1
|
||||
|
||||
/* Define to 1 if blkid has blkid_probe_get_topology */
|
||||
/* #undef HAVE_BLKID_PROBE_GET_TOPOLOGY */
|
||||
|
||||
/* Define to 1 if blkid has blkid_topology_get_dax */
|
||||
/* #undef HAVE_BLKID_TOPOLOGY_GET_DAX */
|
||||
|
||||
/* Define to 1 if you have the BSD-style 'qsort_r' function. */
|
||||
/* #undef HAVE_BSD_QSORT_R */
|
||||
|
||||
/* Define to 1 if you have the Mac OS X function
|
||||
CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
|
||||
/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */
|
||||
|
||||
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
|
||||
the CoreFoundation framework. */
|
||||
/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
|
||||
|
||||
/* Define to 1 if you have the `chflags' function. */
|
||||
/* #undef HAVE_CHFLAGS */
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
/* #undef HAVE_DCGETTEXT */
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the <execinfo.h> header file. */
|
||||
#define HAVE_EXECINFO_H 1
|
||||
|
||||
/* Define to 1 if Ext2 ioctls present */
|
||||
#define HAVE_EXT2_IOCTLS 1
|
||||
|
||||
/* Define to 1 if you have the `fadvise64' function. */
|
||||
/* #undef HAVE_FADVISE64 */
|
||||
|
||||
/* Define to 1 if you have the `fallocate' function. */
|
||||
#define HAVE_FALLOCATE 1
|
||||
|
||||
/* Define to 1 if you have the `fallocate64' function. */
|
||||
#define HAVE_FALLOCATE64 1
|
||||
|
||||
/* Define to 1 if you have the `fchown' function. */
|
||||
#define HAVE_FCHOWN 1
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#define HAVE_FCNTL 1
|
||||
|
||||
/* Define to 1 if you have the `fdatasync' function. */
|
||||
#define HAVE_FDATASYNC 1
|
||||
|
||||
/* Define to 1 if fsmap_sizeof() is declared in linux/fsmap.h */
|
||||
/* #undef HAVE_FSMAP_SIZEOF */
|
||||
|
||||
/* Define to 1 if you have the `fstat64' function. */
|
||||
#define HAVE_FSTAT64 1
|
||||
|
||||
/* Define to 1 if you have the `fsync' function. */
|
||||
#define HAVE_FSYNC 1
|
||||
|
||||
/* Define to 1 if you have the `ftruncate64' function. */
|
||||
#define HAVE_FTRUNCATE64 1
|
||||
|
||||
/* Define to 1 if you have the <fuse.h> header file. */
|
||||
#define HAVE_FUSE_H 1
|
||||
|
||||
/* Define to 1 if you have the `futimes' function. */
|
||||
#define HAVE_FUTIMES 1
|
||||
|
||||
/* Define to 1 if you have the `getcwd' function. */
|
||||
#define HAVE_GETCWD 1
|
||||
|
||||
/* Define to 1 if you have the `getdtablesize' function. */
|
||||
/* #undef HAVE_GETDTABLESIZE */
|
||||
|
||||
/* Define to 1 if you have the `getentropy' function. */
|
||||
#define HAVE_GETENTROPY 1
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define to 1 if you have the `getmntinfo' function. */
|
||||
/* #undef HAVE_GETMNTINFO */
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#define HAVE_GETOPT_H 1
|
||||
|
||||
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||
#define HAVE_GETPWUID_R 1
|
||||
|
||||
/* Define to 1 if you have the `getrandom' function. */
|
||||
#define HAVE_GETRANDOM 1
|
||||
|
||||
/* Define to 1 if you have the `getrlimit' function. */
|
||||
#define HAVE_GETRLIMIT 1
|
||||
|
||||
/* Define to 1 if you have the `getrusage' function. */
|
||||
#define HAVE_GETRUSAGE 1
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
|
||||
/* Define to 1 if you have the GNU-style 'qsort_r' function. */
|
||||
/* #undef HAVE_GNU_QSORT_R */
|
||||
|
||||
/* Define if you have the iconv() function and it works. */
|
||||
#define HAVE_ICONV 1
|
||||
|
||||
/* Define to 1 if the system has the type `intptr_t'. */
|
||||
#define HAVE_INTPTR_T 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `jrand48' function. */
|
||||
#define HAVE_JRAND48 1
|
||||
|
||||
/* Define to 1 if you have the `keyctl' function. */
|
||||
/* #undef HAVE_KEYCTL */
|
||||
|
||||
/* Define to 1 if you have the <linux/falloc.h> header file. */
|
||||
#define HAVE_LINUX_FALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the <linux/fd.h> header file. */
|
||||
#define HAVE_LINUX_FD_H 1
|
||||
|
||||
/* Define to 1 if you have the <linux/fsmap.h> header file. */
|
||||
#define HAVE_LINUX_FSMAP_H 1
|
||||
|
||||
/* Define to 1 if you have the <linux/loop.h> header file. */
|
||||
#define HAVE_LINUX_LOOP_H 1
|
||||
|
||||
/* Define to 1 if you have the <linux/major.h> header file. */
|
||||
#define HAVE_LINUX_MAJOR_H 1
|
||||
|
||||
/* Define to 1 if you have the <linux/types.h> header file. */
|
||||
#define HAVE_LINUX_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `llistxattr' function. */
|
||||
#define HAVE_LLISTXATTR 1
|
||||
|
||||
/* Define to 1 if you have the `llseek' function. */
|
||||
/* #undef HAVE_LLSEEK */
|
||||
|
||||
/* Define to 1 if llseek declared in unistd.h */
|
||||
/* #undef HAVE_LLSEEK_PROTOTYPE */
|
||||
|
||||
/* Define to 1 if you have the `lseek64' function. */
|
||||
#define HAVE_LSEEK64 1
|
||||
|
||||
/* Define to 1 if lseek64 declared in unistd.h */
|
||||
#define HAVE_LSEEK64_PROTOTYPE 1
|
||||
|
||||
/* Define to 1 if you have the <magic.h> header file. */
|
||||
#define HAVE_MAGIC_H 1
|
||||
|
||||
/* Define to 1 if you have the `mallinfo' function. */
|
||||
#define HAVE_MALLINFO 1
|
||||
|
||||
/* Define to 1 if you have the `mallinfo2' function. */
|
||||
/* #undef HAVE_MALLINFO2 */
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the `mbstowcs' function. */
|
||||
#define HAVE_MBSTOWCS 1
|
||||
|
||||
/* Define to 1 if you have the `memalign' function. */
|
||||
#define HAVE_MEMALIGN 1
|
||||
|
||||
/* Define to 1 if you have the `mempcpy' function. */
|
||||
#define HAVE_MEMPCPY 1
|
||||
|
||||
/* Define to 1 if you have the <minix/config.h> header file. */
|
||||
/* #undef HAVE_MINIX_CONFIG_H */
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the <mntent.h> header file. */
|
||||
#define HAVE_MNTENT_H 1
|
||||
|
||||
/* Define to 1 if mount supports nodev. */
|
||||
#define HAVE_MOUNT_NODEV 1
|
||||
|
||||
/* Define to 1 if mount supports nosuid. */
|
||||
#define HAVE_MOUNT_NOSUID 1
|
||||
|
||||
/* Define to 1 if you have the `msync' function. */
|
||||
#define HAVE_MSYNC 1
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#define HAVE_NANOSLEEP 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <net/if_dl.h> header file. */
|
||||
/* #undef HAVE_NET_IF_DL_H */
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
#define HAVE_NET_IF_H 1
|
||||
|
||||
/* Define to 1 if you have the `open64' function. */
|
||||
#define HAVE_OPEN64 1
|
||||
|
||||
/* Define to 1 if optreset for getopt is present */
|
||||
/* #undef HAVE_OPTRESET */
|
||||
|
||||
/* Define to 1 if you have the `pathconf' function. */
|
||||
#define HAVE_PATHCONF 1
|
||||
|
||||
/* Define to 1 if you have the <paths.h> header file. */
|
||||
#define HAVE_PATHS_H 1
|
||||
|
||||
/* Define to 1 if you have the `posix_fadvise' function. */
|
||||
#define HAVE_POSIX_FADVISE 1
|
||||
|
||||
/* Define to 1 if you have the `posix_fadvise64' function. */
|
||||
#define HAVE_POSIX_FADVISE64 1
|
||||
|
||||
/* Define to 1 if you have the `posix_memalign' function. */
|
||||
#define HAVE_POSIX_MEMALIGN 1
|
||||
|
||||
/* Define to 1 if you have the `prctl' function. */
|
||||
#define HAVE_PRCTL 1
|
||||
|
||||
/* Define to 1 if you have the `pread' function. */
|
||||
#define HAVE_PREAD 1
|
||||
|
||||
/* Define to 1 if you have the `pread64' function. */
|
||||
#define HAVE_PREAD64 1
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#define HAVE_PTHREAD 1
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#define HAVE_PTHREAD_H 1
|
||||
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#define HAVE_PTHREAD_PRIO_INHERIT 1
|
||||
|
||||
/* Define to 1 if you have the `pwrite' function. */
|
||||
#define HAVE_PWRITE 1
|
||||
|
||||
/* Define to 1 if you have the `pwrite64' function. */
|
||||
#define HAVE_PWRITE64 1
|
||||
|
||||
/* Define to 1 if you have the `qsort_r' function. */
|
||||
/* #undef HAVE_QSORT_R */
|
||||
|
||||
/* Define to 1 if dirent has d_reclen */
|
||||
#define HAVE_RECLEN_DIRENT 1
|
||||
|
||||
/* Define to 1 if if struct sockaddr contains sa_len */
|
||||
/* #undef HAVE_SA_LEN */
|
||||
|
||||
/* Define to 1 if you have the `secure_getenv' function. */
|
||||
/* #undef HAVE_SECURE_GETENV */
|
||||
|
||||
/* Define to 1 if you have the <semaphore.h> header file. */
|
||||
#define HAVE_SEMAPHORE_H 1
|
||||
|
||||
/* Define to 1 if sem_init() exists */
|
||||
/* #undef HAVE_SEM_INIT */
|
||||
|
||||
/* Define to 1 if you have the <setjmp.h> header file. */
|
||||
#define HAVE_SETJMP_H 1
|
||||
|
||||
/* Define to 1 if you have the `setmntent' function. */
|
||||
#define HAVE_SETMNTENT 1
|
||||
|
||||
/* Define to 1 if you have the `setresgid' function. */
|
||||
#define HAVE_SETRESGID 1
|
||||
|
||||
/* Define to 1 if you have the `setresuid' function. */
|
||||
#define HAVE_SETRESUID 1
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `srandom' function. */
|
||||
#define HAVE_SRANDOM 1
|
||||
|
||||
/* Define to 1 if struct stat has st_flags */
|
||||
/* #undef HAVE_STAT_FLAGS */
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `stpcpy' function. */
|
||||
#define HAVE_STPCPY 1
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strnlen' function. */
|
||||
#define HAVE_STRNLEN 1
|
||||
|
||||
/* Define to 1 if you have the `strptime' function. */
|
||||
#define HAVE_STRPTIME 1
|
||||
|
||||
/* Define to 1 if you have the `strtoull' function. */
|
||||
#define HAVE_STRTOULL 1
|
||||
|
||||
/* Define to 1 if `st_atim' is a member of `struct stat'. */
|
||||
#define HAVE_STRUCT_STAT_ST_ATIM 1
|
||||
|
||||
/* Define to 1 if you have the `sync_file_range' function. */
|
||||
#define HAVE_SYNC_FILE_RANGE 1
|
||||
|
||||
/* Define to 1 if you have the `sysconf' function. */
|
||||
#define HAVE_SYSCONF 1
|
||||
|
||||
/* Define to 1 if you have the <sys/acl.h> header file. */
|
||||
/* #undef HAVE_SYS_ACL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/disklabel.h> header file. */
|
||||
/* #undef HAVE_SYS_DISKLABEL_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/disk.h> header file. */
|
||||
/* #undef HAVE_SYS_DISK_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/key.h> header file. */
|
||||
/* #undef HAVE_SYS_KEY_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mkdev.h> header file. */
|
||||
/* #undef HAVE_SYS_MKDEV_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#define HAVE_SYS_MMAN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/mount.h> header file. */
|
||||
#define HAVE_SYS_MOUNT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||
#define HAVE_SYS_PRCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/random.h> header file. */
|
||||
#define HAVE_SYS_RANDOM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/sockio.h> header file. */
|
||||
/* #undef HAVE_SYS_SOCKIO_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/syscall.h> header file. */
|
||||
#define HAVE_SYS_SYSCALL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
|
||||
#define HAVE_SYS_SYSMACROS_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#define HAVE_SYS_UN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/xattr.h> header file. */
|
||||
#define HAVE_SYS_XATTR_H 1
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define to 1 if you have the <termio.h> header file. */
|
||||
#define HAVE_TERMIO_H 1
|
||||
|
||||
/* Define to 1 if ssize_t declared */
|
||||
#define HAVE_TYPE_SSIZE_T 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#define HAVE_USLEEP 1
|
||||
|
||||
/* Define to 1 if you have the `utime' function. */
|
||||
#define HAVE_UTIME 1
|
||||
|
||||
/* Define to 1 if you have the `utimes' function. */
|
||||
#define HAVE_UTIMES 1
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#define HAVE_UTIME_H 1
|
||||
|
||||
/* Define to 1 if you have the `valloc' function. */
|
||||
/* #undef HAVE_VALLOC */
|
||||
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Define to 1 if you have the `__secure_getenv' function. */
|
||||
/* #undef HAVE___SECURE_GETENV */
|
||||
|
||||
/* package name for gettext */
|
||||
#define PACKAGE "e2fsprogs"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME ""
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING ""
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME ""
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION ""
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
/* #undef PTHREAD_CREATE_JOINABLE */
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 8
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The size of `off_t', as computed by sizeof. */
|
||||
#define SIZEOF_OFF_T 8
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `time_t', as computed by sizeof. */
|
||||
#define SIZEOF_TIME_T 8
|
||||
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* If the compiler supports a TLS storage class define it to that here */
|
||||
#define TLS __thread
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# define _ALL_SOURCE 1
|
||||
#endif
|
||||
/* Enable general extensions on macOS. */
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
# define _DARWIN_C_SOURCE 1
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# define __EXTENSIONS__ 1
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
/* Enable X/Open compliant socket functions that do not require linking
|
||||
with -lxnet on HP-UX 11.11. */
|
||||
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
|
||||
# define _HPUX_ALT_XOPEN_SOCKET_API 1
|
||||
#endif
|
||||
/* Identify the host operating system as Minix.
|
||||
This macro does not affect the system headers' behavior.
|
||||
A future release of Autoconf may stop defining this macro. */
|
||||
#ifndef _MINIX
|
||||
/* # undef _MINIX */
|
||||
#endif
|
||||
/* Enable general extensions on NetBSD.
|
||||
Enable NetBSD compatibility extensions on Minix. */
|
||||
#ifndef _NETBSD_SOURCE
|
||||
# define _NETBSD_SOURCE 1
|
||||
#endif
|
||||
/* Enable OpenBSD compatibility extensions on NetBSD.
|
||||
Oddly enough, this does nothing on OpenBSD. */
|
||||
#ifndef _OPENBSD_SOURCE
|
||||
# define _OPENBSD_SOURCE 1
|
||||
#endif
|
||||
/* Define to 1 if needed for POSIX-compatible behavior. */
|
||||
#ifndef _POSIX_SOURCE
|
||||
/* # undef _POSIX_SOURCE */
|
||||
#endif
|
||||
/* Define to 2 if needed for POSIX-compatible behavior. */
|
||||
#ifndef _POSIX_1_SOURCE
|
||||
/* # undef _POSIX_1_SOURCE */
|
||||
#endif
|
||||
/* Enable POSIX-compatible threading on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# define _POSIX_PTHREAD_SEMANTICS 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
|
||||
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
|
||||
# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
|
||||
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
|
||||
# define __STDC_WANT_IEC_60559_BFP_EXT__ 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
|
||||
# define __STDC_WANT_IEC_60559_DFP_EXT__ 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
|
||||
# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
|
||||
#ifndef __STDC_WANT_LIB_EXT2__
|
||||
# define __STDC_WANT_LIB_EXT2__ 1
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC 24747:2009. */
|
||||
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
|
||||
# define __STDC_WANT_MATH_SPEC_FUNCS__ 1
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# define _TANDEM_SOURCE 1
|
||||
#endif
|
||||
/* Enable X/Open extensions. Define to 500 only if necessary
|
||||
to make mbstate_t available. */
|
||||
#ifndef _XOPEN_SOURCE
|
||||
/* # undef _XOPEN_SOURCE */
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 to build uuidd */
|
||||
#define USE_UUIDD 1
|
||||
|
||||
/* version for gettext */
|
||||
#define VERSION "0.14.1"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define to 1 if Apple Darwin libintl workaround is needed */
|
||||
/* #undef _INTL_REDIRECT_MACROS */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
#include <dirpaths.h>
|
||||
10
include/e2fsprogs/dirpaths.h
Executable file
10
include/e2fsprogs/dirpaths.h
Executable file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* This file contains the path names for various directories as
|
||||
* controlled by the configure script.
|
||||
*/
|
||||
|
||||
/* Where to put the messages file for internationalization support */
|
||||
#define LOCALEDIR "/usr/share/locale"
|
||||
|
||||
/* Where to find the mke2fs.conf and e2fsck.conf files */
|
||||
#define ROOT_SYSCONFDIR "/etc"
|
||||
92
include/e2fsprogs/e2p/e2p.h
Executable file
92
include/e2fsprogs/e2p/e2p.h
Executable file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* e2p.h --- header file for the e2p library
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#include <sys/types.h> /* Needed by dirent.h on netbsd */
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <ext2fs/ext2_fs.h>
|
||||
|
||||
#define E2P_FEATURE_COMPAT 0
|
||||
#define E2P_FEATURE_INCOMPAT 1
|
||||
#define E2P_FEATURE_RO_INCOMPAT 2
|
||||
#define E2P_FEATURE_TYPE_MASK 0x03
|
||||
|
||||
#define E2P_FEATURE_NEGATE_FLAG 0x80
|
||||
|
||||
#define E2P_FS_FEATURE 0
|
||||
#define E2P_JOURNAL_FEATURE 1
|
||||
|
||||
/* `options' for print_flags() */
|
||||
|
||||
#define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */
|
||||
|
||||
|
||||
int fgetflags (const char * name, unsigned long * flags);
|
||||
int fgetversion (const char * name, unsigned long * version);
|
||||
int fsetflags (const char * name, unsigned long flags);
|
||||
int fsetversion (const char * name, unsigned long version);
|
||||
int fgetproject(const char *name, unsigned long *project);
|
||||
int fsetproject(const char *name, unsigned long project);
|
||||
int getflags (int fd, unsigned long * flags);
|
||||
int getversion (int fd, unsigned long * version);
|
||||
int iterate_on_dir (const char * dir_name,
|
||||
int (*func) (const char *, struct dirent *, void *),
|
||||
void * private_arg);
|
||||
void list_super(struct ext2_super_block * s);
|
||||
void list_super2(struct ext2_super_block * s, FILE *f);
|
||||
void print_fs_errors (FILE * f, unsigned short errors);
|
||||
void print_flags (FILE * f, unsigned long flags, unsigned options);
|
||||
void print_fs_state (FILE * f, unsigned short state);
|
||||
int setflags (int fd, unsigned long flags);
|
||||
int setversion (int fd, unsigned long version);
|
||||
|
||||
#define E2P_LIST_JOURNAL_FLAG_FC 0x1
|
||||
void e2p_list_journal_super(FILE *f, char *journal_sb_buf,
|
||||
int exp_block_size, int flags);
|
||||
|
||||
void e2p_feature_to_string(int compat, unsigned int mask, char *buf,
|
||||
size_t buf_len);
|
||||
const char *e2p_feature2string(int compat, unsigned int mask);
|
||||
const char *e2p_jrnl_feature2string(int compat, unsigned int mask);
|
||||
int e2p_string2feature(char *string, int *compat, unsigned int *mask);
|
||||
int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask);
|
||||
int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array);
|
||||
int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array,
|
||||
__u32 *clear_ok_array, int *type_err,
|
||||
unsigned int *mask_err);
|
||||
|
||||
int e2p_is_null_uuid(void *uu);
|
||||
void e2p_uuid_to_str(void *uu, char *out);
|
||||
const char *e2p_uuid2str(void *uu);
|
||||
|
||||
const char *e2p_hash2string(int num);
|
||||
int e2p_string2hash(char *string);
|
||||
|
||||
const char *e2p_mntopt2string(unsigned int mask);
|
||||
int e2p_string2mntopt(char *string, unsigned int *mask);
|
||||
int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok);
|
||||
|
||||
unsigned long parse_num_blocks(const char *arg, int log_block_size);
|
||||
unsigned long long parse_num_blocks2(const char *arg, int log_block_size);
|
||||
|
||||
char *e2p_os2string(int os_type);
|
||||
int e2p_string2os(char *str);
|
||||
|
||||
unsigned int e2p_percent(int percent, unsigned int base);
|
||||
|
||||
const char *e2p_encmode2string(int num);
|
||||
int e2p_string2encmode(char *string);
|
||||
|
||||
int e2p_str2encoding(const char *string);
|
||||
const char *e2p_encoding2str(int encoding);
|
||||
int e2p_get_encoding_flags(int encoding);
|
||||
int e2p_str2encoding_flags(int encoding, char *param, __u16 *flags);
|
||||
|
||||
const char *e2p_errcode2str(unsigned int err);
|
||||
27
include/e2fsprogs/e2p/project.h
Executable file
27
include/e2fsprogs/e2p/project.h
Executable file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* project.h
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#include <ext2fs/ext2_fs.h>
|
||||
|
||||
#if defined(__linux__) && !defined(FS_IOC_FSGETXATTR)
|
||||
#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr)
|
||||
#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)
|
||||
|
||||
/*
|
||||
* Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR.
|
||||
*/
|
||||
struct fsxattr {
|
||||
__u32 fsx_xflags; /* xflags field value (get/set) */
|
||||
__u32 fsx_extsize; /* extsize field value (get/set)*/
|
||||
__u32 fsx_nextents; /* nextents field value (get) */
|
||||
__u32 fsx_projid; /* project identifier (get/set) */
|
||||
unsigned char fsx_pad[12];
|
||||
};
|
||||
#endif
|
||||
|
||||
68
include/e2fsprogs/et/com_err.h
Executable file
68
include/e2fsprogs/et/com_err.h
Executable file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Header file for common error description library.
|
||||
*
|
||||
* Copyright 1988, Student Information Processing Board of the
|
||||
* Massachusetts Institute of Technology.
|
||||
*
|
||||
* For copyright and distribution info, see the documentation supplied
|
||||
* with this package.
|
||||
*/
|
||||
|
||||
#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define COM_ERR_ATTR(x) __attribute__(x)
|
||||
#else
|
||||
#define COM_ERR_ATTR(x)
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef long errcode_t;
|
||||
|
||||
struct error_table {
|
||||
char const * const * msgs;
|
||||
long base;
|
||||
int n_msgs;
|
||||
};
|
||||
struct et_list;
|
||||
|
||||
extern void com_err (const char *, long, const char *, ...)
|
||||
COM_ERR_ATTR((format(printf, 3, 4)));
|
||||
|
||||
extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
|
||||
va_list args)
|
||||
COM_ERR_ATTR((format(printf, 3, 0)));
|
||||
|
||||
extern char const *error_message (long);
|
||||
extern void (*com_err_hook) (const char *, long, const char *, va_list);
|
||||
extern void (*set_com_err_hook (void (*) (const char *, long,
|
||||
const char *, va_list)))
|
||||
(const char *, long, const char *, va_list);
|
||||
extern void (*reset_com_err_hook (void)) (const char *, long,
|
||||
const char *, va_list);
|
||||
extern int init_error_table(const char * const *msgs, long base, int count);
|
||||
extern char *(*set_com_err_gettext (char *(*) (const char *)))
|
||||
(const char *);
|
||||
|
||||
extern errcode_t add_error_table(const struct error_table * et);
|
||||
extern errcode_t remove_error_table(const struct error_table * et);
|
||||
extern void add_to_error_table(struct et_list *new_table);
|
||||
|
||||
/* Provided for Heimdall compatibility */
|
||||
extern const char *com_right(struct et_list *list, long code);
|
||||
extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len);
|
||||
extern void initialize_error_table_r(struct et_list **list,
|
||||
const char **messages,
|
||||
int num_errors,
|
||||
long base);
|
||||
extern void free_error_table(struct et_list *et);
|
||||
|
||||
/* Provided for compatibility with other com_err libraries */
|
||||
extern int et_list_lock(void);
|
||||
extern int et_list_unlock(void);
|
||||
|
||||
#define __COM_ERR_H
|
||||
#define __COM_ERR_H__
|
||||
#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/
|
||||
29
include/e2fsprogs/et/error_table.h
Executable file
29
include/e2fsprogs/et/error_table.h
Executable file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 1988 by the Student Information Processing Board of the
|
||||
* Massachusetts Institute of Technology.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose is hereby granted, provided that
|
||||
* the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
|
||||
* advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. M.I.T. and the
|
||||
* M.I.T. S.I.P.B. make no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without
|
||||
* express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef _ET_H
|
||||
|
||||
struct et_list {
|
||||
struct et_list *next;
|
||||
const struct error_table *table;
|
||||
};
|
||||
extern struct et_list *_et_list, *_et_dynamic_list;
|
||||
|
||||
#define ERRCODE_RANGE 8 /* # of bits to shift table number */
|
||||
#define BITS_PER_CHAR 6 /* # bits to shift per character in name */
|
||||
|
||||
extern const char *error_table_name(errcode_t num);
|
||||
|
||||
#define _ET_H
|
||||
#endif
|
||||
19
include/e2fsprogs/et/internal.h
Executable file
19
include/e2fsprogs/et/internal.h
Executable file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* internal include file for com_err package
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose is hereby granted, provided that
|
||||
* the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
|
||||
* advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. M.I.T. and the
|
||||
* M.I.T. S.I.P.B. make no representations about the suitability of
|
||||
* this software for any purpose. It is provided "as is" without
|
||||
* express or implied warranty.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef NEED_SYS_ERRLIST
|
||||
extern char const * const sys_errlist[];
|
||||
extern const int sys_nerr;
|
||||
#endif
|
||||
606
include/e2fsprogs/ext2fs/bitops.h
Executable file
606
include/e2fsprogs/ext2fs/bitops.h
Executable file
@@ -0,0 +1,606 @@
|
||||
/*
|
||||
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
|
||||
* also included here.
|
||||
*
|
||||
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define ext2fs_cpu_to_le64(x) ((__force __le64)ext2fs_swab64((__u64)(x)))
|
||||
#define ext2fs_le64_to_cpu(x) ext2fs_swab64((__force __u64)(__le64)(x))
|
||||
#define ext2fs_cpu_to_le32(x) ((__force __le32)ext2fs_swab32((__u32)(x)))
|
||||
#define ext2fs_le32_to_cpu(x) ext2fs_swab32((__force __u32)(__le32)(x))
|
||||
#define ext2fs_cpu_to_le16(x) ((__force __le16)ext2fs_swab16((__u16)(x)))
|
||||
#define ext2fs_le16_to_cpu(x) ext2fs_swab16((__force __u16)(__le16)(x))
|
||||
|
||||
#define ext2fs_cpu_to_be64(x) ((__force __be64)(__u64)(x))
|
||||
#define ext2fs_be64_to_cpu(x) ((__force __u64)(__be64)(x))
|
||||
#define ext2fs_cpu_to_be32(x) ((__force __be32)(__u32)(x))
|
||||
#define ext2fs_be32_to_cpu(x) ((__force __u32)(__be32)(x))
|
||||
#define ext2fs_cpu_to_be16(x) ((__force __be16)(__u16)(x))
|
||||
#define ext2fs_be16_to_cpu(x) ((__force __u16)(__be16)(x))
|
||||
#else
|
||||
#define ext2fs_cpu_to_le64(x) ((__force __le64)(__u64)(x))
|
||||
#define ext2fs_le64_to_cpu(x) ((__force __u64)(__le64)(x))
|
||||
#define ext2fs_cpu_to_le32(x) ((__force __le32)(__u32)(x))
|
||||
#define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x))
|
||||
#define ext2fs_cpu_to_le16(x) ((__force __le16)(__u16)(x))
|
||||
#define ext2fs_le16_to_cpu(x) ((__force __u16)(__le16)(x))
|
||||
|
||||
#define ext2fs_cpu_to_be64(x) ((__force __be64)ext2fs_swab64((__u64)(x)))
|
||||
#define ext2fs_be64_to_cpu(x) ext2fs_swab64((__force __u64)(__be64)(x))
|
||||
#define ext2fs_cpu_to_be32(x) ((__force __be32)ext2fs_swab32((__u32)(x)))
|
||||
#define ext2fs_be32_to_cpu(x) ext2fs_swab32((__force __u32)(__be32)(x))
|
||||
#define ext2fs_cpu_to_be16(x) ((__force __be16)ext2fs_swab16((__u16)(x)))
|
||||
#define ext2fs_be16_to_cpu(x) ext2fs_swab16((__force __u16)(__be16)(x))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* EXT2FS bitmap manipulation routines.
|
||||
*/
|
||||
|
||||
/* Support for sending warning messages from the inline subroutines */
|
||||
extern const char *ext2fs_block_string;
|
||||
extern const char *ext2fs_inode_string;
|
||||
extern const char *ext2fs_mark_string;
|
||||
extern const char *ext2fs_unmark_string;
|
||||
extern const char *ext2fs_test_string;
|
||||
extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
|
||||
const char *description);
|
||||
extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
|
||||
int code, unsigned long arg);
|
||||
|
||||
#ifdef NO_INLINE_FUNCS
|
||||
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
|
||||
extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
|
||||
extern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
|
||||
extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
|
||||
extern __u16 ext2fs_swab16(__u16 val);
|
||||
extern __u32 ext2fs_swab32(__u32 val);
|
||||
extern __u64 ext2fs_swab64(__u64 val);
|
||||
|
||||
extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
|
||||
extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
|
||||
|
||||
extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
|
||||
extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
|
||||
|
||||
extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block);
|
||||
|
||||
extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
|
||||
extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
|
||||
|
||||
extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
#endif
|
||||
|
||||
/* These functions routines moved to gen_bitmap.c */
|
||||
extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode, int num);
|
||||
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
||||
__u32 bitno);
|
||||
extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
||||
blk_t bitno);
|
||||
extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
||||
blk_t bitno);
|
||||
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num);
|
||||
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
|
||||
extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
|
||||
extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
|
||||
|
||||
/* 64-bit versions */
|
||||
|
||||
#ifdef NO_INLINE_FUNCS
|
||||
extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
|
||||
extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
|
||||
extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block);
|
||||
|
||||
extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode);
|
||||
extern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t start,
|
||||
blk64_t end,
|
||||
blk64_t *out);
|
||||
extern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t start,
|
||||
ext2_ino_t end,
|
||||
ext2_ino_t *out);
|
||||
extern errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t start,
|
||||
blk64_t end,
|
||||
blk64_t *out);
|
||||
extern errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t start,
|
||||
ext2_ino_t end,
|
||||
ext2_ino_t *out);
|
||||
extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap);
|
||||
extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap);
|
||||
extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap);
|
||||
|
||||
extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num);
|
||||
extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num);
|
||||
extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num);
|
||||
#endif
|
||||
|
||||
/* These routines moved to gen_bitmap64.c */
|
||||
extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
|
||||
extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
|
||||
ext2fs_generic_bitmap bm1,
|
||||
ext2fs_generic_bitmap bm2);
|
||||
extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
|
||||
extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
blk64_t bitno);
|
||||
extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
blk64_t bitno);
|
||||
extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
blk64_t bitno);
|
||||
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap);
|
||||
extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap);
|
||||
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block, unsigned int num);
|
||||
extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
__u64 start, __u64 end,
|
||||
__u64 *out);
|
||||
extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
__u64 start, __u64 end,
|
||||
__u64 *out);
|
||||
|
||||
/*
|
||||
* The inline routines themselves...
|
||||
*
|
||||
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
|
||||
* functions at all; they will be included as normal functions in
|
||||
* inline.c
|
||||
*/
|
||||
|
||||
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
||||
#ifdef INCLUDE_INLINE_FUNCS
|
||||
#if (__STDC_VERSION__ >= 199901L)
|
||||
#define _INLINE_ extern inline
|
||||
#else
|
||||
#define _INLINE_ inline
|
||||
#endif
|
||||
#else /* !INCLUDE_INLINE FUNCS */
|
||||
#if (__STDC_VERSION__ >= 199901L)
|
||||
#define _INLINE_ inline
|
||||
#else /* not C99 */
|
||||
#ifdef __GNUC__
|
||||
#define _INLINE_ extern __inline__
|
||||
#else /* For Watcom C */
|
||||
#define _INLINE_ extern inline
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __STDC_VERSION__ >= 199901L */
|
||||
#endif /* INCLUDE_INLINE_FUNCS */
|
||||
|
||||
/*
|
||||
* Fast bit set/clear functions that doesn't need to return the
|
||||
* previous bit value.
|
||||
*/
|
||||
|
||||
_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR |= (unsigned char) (1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
|
||||
_INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR |= (unsigned char) (1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
|
||||
{
|
||||
unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
|
||||
}
|
||||
|
||||
_INLINE_ __u16 ext2fs_swab16(__u16 val)
|
||||
{
|
||||
return (val >> 8) | (__u16) (val << 8);
|
||||
}
|
||||
|
||||
_INLINE_ __u32 ext2fs_swab32(__u32 val)
|
||||
{
|
||||
return ((val>>24) | ((val>>8)&0xFF00) |
|
||||
((val<<8)&0xFF0000) | (val<<24));
|
||||
}
|
||||
|
||||
_INLINE_ __u64 ext2fs_swab64(__u64 val)
|
||||
{
|
||||
return (ext2fs_swab32((__u32) (val >> 32)) |
|
||||
(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
|
||||
blk_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num)
|
||||
{
|
||||
return ext2fs_test_block_bitmap_range(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num)
|
||||
{
|
||||
ext2fs_mark_block_bitmap_range(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
||||
blk_t block, int num)
|
||||
{
|
||||
ext2fs_unmark_block_bitmap_range(bitmap, block, num);
|
||||
}
|
||||
|
||||
/* 64-bit versions */
|
||||
|
||||
_INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
block);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t inode)
|
||||
{
|
||||
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
inode);
|
||||
}
|
||||
|
||||
_INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t start,
|
||||
blk64_t end,
|
||||
blk64_t *out)
|
||||
{
|
||||
__u64 o;
|
||||
errcode_t rv;
|
||||
|
||||
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
start, end, &o);
|
||||
if (!rv)
|
||||
*out = o;
|
||||
return rv;
|
||||
}
|
||||
|
||||
_INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t start,
|
||||
ext2_ino_t end,
|
||||
ext2_ino_t *out)
|
||||
{
|
||||
__u64 o;
|
||||
errcode_t rv;
|
||||
|
||||
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
start, end, &o);
|
||||
if (!rv)
|
||||
*out = (ext2_ino_t) o;
|
||||
return rv;
|
||||
}
|
||||
|
||||
_INLINE_ errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t start,
|
||||
blk64_t end,
|
||||
blk64_t *out)
|
||||
{
|
||||
__u64 o;
|
||||
errcode_t rv;
|
||||
|
||||
rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
start, end, &o);
|
||||
if (!rv)
|
||||
*out = o;
|
||||
return rv;
|
||||
}
|
||||
|
||||
_INLINE_ errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap,
|
||||
ext2_ino_t start,
|
||||
ext2_ino_t end,
|
||||
ext2_ino_t *out)
|
||||
{
|
||||
__u64 o;
|
||||
errcode_t rv;
|
||||
|
||||
rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap,
|
||||
start, end, &o);
|
||||
if (!rv)
|
||||
*out = (ext2_ino_t) o;
|
||||
return rv;
|
||||
}
|
||||
|
||||
_INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
|
||||
{
|
||||
return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap)
|
||||
{
|
||||
return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
|
||||
}
|
||||
|
||||
_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num)
|
||||
{
|
||||
return ext2fs_test_block_bitmap_range2(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num)
|
||||
{
|
||||
ext2fs_mark_block_bitmap_range2(bitmap, block, num);
|
||||
}
|
||||
|
||||
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
|
||||
blk64_t block,
|
||||
unsigned int num)
|
||||
{
|
||||
ext2fs_unmark_block_bitmap_range2(bitmap, block, num);
|
||||
}
|
||||
|
||||
#undef _INLINE_
|
||||
#endif
|
||||
|
||||
extern int ext2fs_set_bit(unsigned int nr,void * addr);
|
||||
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
|
||||
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
|
||||
extern int ext2fs_set_bit64(__u64 nr,void * addr);
|
||||
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
|
||||
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
|
||||
extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes);
|
||||
106
include/e2fsprogs/ext2fs/bmap64.h
Executable file
106
include/e2fsprogs/ext2fs/bmap64.h
Executable file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* bmap64.h --- 64-bit bitmap structure
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
struct ext2_bmap_statistics {
|
||||
int type;
|
||||
struct timeval created;
|
||||
|
||||
#ifdef ENABLE_BMAP_STATS_OPS
|
||||
unsigned long copy_count;
|
||||
unsigned long resize_count;
|
||||
unsigned long mark_count;
|
||||
unsigned long unmark_count;
|
||||
unsigned long test_count;
|
||||
unsigned long mark_ext_count;
|
||||
unsigned long unmark_ext_count;
|
||||
unsigned long test_ext_count;
|
||||
unsigned long set_range_count;
|
||||
unsigned long get_range_count;
|
||||
unsigned long clear_count;
|
||||
|
||||
blk64_t last_marked;
|
||||
blk64_t last_tested;
|
||||
blk64_t mark_back;
|
||||
blk64_t test_back;
|
||||
|
||||
unsigned long mark_seq;
|
||||
unsigned long test_seq;
|
||||
#endif /* ENABLE_BMAP_STATS_OPS */
|
||||
};
|
||||
|
||||
|
||||
struct ext2fs_struct_generic_bitmap_64 {
|
||||
errcode_t magic;
|
||||
ext2_filsys fs;
|
||||
struct ext2_bitmap_ops *bitmap_ops;
|
||||
int flags;
|
||||
__u64 start, end;
|
||||
__u64 real_end;
|
||||
int cluster_bits;
|
||||
char *description;
|
||||
void *private;
|
||||
errcode_t base_error_code;
|
||||
#ifdef ENABLE_BMAP_STATS
|
||||
struct ext2_bmap_statistics stats;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct ext2fs_struct_generic_bitmap_64 *ext2fs_generic_bitmap_64;
|
||||
|
||||
#define EXT2FS_IS_32_BITMAP(bmap) \
|
||||
(((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP) || \
|
||||
((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP) || \
|
||||
((bmap)->magic == EXT2_ET_MAGIC_INODE_BITMAP))
|
||||
|
||||
#define EXT2FS_IS_64_BITMAP(bmap) \
|
||||
(((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP64) || \
|
||||
((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP64) || \
|
||||
((bmap)->magic == EXT2_ET_MAGIC_INODE_BITMAP64))
|
||||
|
||||
struct ext2_bitmap_ops {
|
||||
int type;
|
||||
/* Generic bmap operators */
|
||||
errcode_t (*new_bmap)(ext2_filsys fs, ext2fs_generic_bitmap_64 bmap);
|
||||
void (*free_bmap)(ext2fs_generic_bitmap_64 bitmap);
|
||||
errcode_t (*copy_bmap)(ext2fs_generic_bitmap_64 src,
|
||||
ext2fs_generic_bitmap_64 dest);
|
||||
errcode_t (*resize_bmap)(ext2fs_generic_bitmap_64 bitmap,
|
||||
__u64 new_end,
|
||||
__u64 new_real_end);
|
||||
/* bit set/test operators */
|
||||
int (*mark_bmap)(ext2fs_generic_bitmap_64 bitmap, __u64 arg);
|
||||
int (*unmark_bmap)(ext2fs_generic_bitmap_64 bitmap, __u64 arg);
|
||||
int (*test_bmap)(ext2fs_generic_bitmap_64 bitmap, __u64 arg);
|
||||
void (*mark_bmap_extent)(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
||||
unsigned int num);
|
||||
void (*unmark_bmap_extent)(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
||||
unsigned int num);
|
||||
int (*test_clear_bmap_extent)(ext2fs_generic_bitmap_64 bitmap,
|
||||
__u64 arg, unsigned int num);
|
||||
errcode_t (*set_bmap_range)(ext2fs_generic_bitmap_64 bitmap,
|
||||
__u64 start, size_t num, void *in);
|
||||
errcode_t (*get_bmap_range)(ext2fs_generic_bitmap_64 bitmap,
|
||||
__u64 start, size_t num, void *out);
|
||||
void (*clear_bmap)(ext2fs_generic_bitmap_64 bitmap);
|
||||
void (*print_stats)(ext2fs_generic_bitmap_64);
|
||||
|
||||
/* Find the first zero bit between start and end, inclusive.
|
||||
* May be NULL, in which case a generic function is used. */
|
||||
errcode_t (*find_first_zero)(ext2fs_generic_bitmap_64 bitmap,
|
||||
__u64 start, __u64 end, __u64 *out);
|
||||
/* Find the first set bit between start and end, inclusive.
|
||||
* May be NULL, in which case a generic function is used. */
|
||||
errcode_t (*find_first_set)(ext2fs_generic_bitmap_64 bitmap,
|
||||
__u64 start, __u64 end, __u64 *out);
|
||||
};
|
||||
|
||||
extern struct ext2_bitmap_ops ext2fs_blkmap64_bitarray;
|
||||
extern struct ext2_bitmap_ops ext2fs_blkmap64_rbtree;
|
||||
86
include/e2fsprogs/ext2fs/brel.h
Executable file
86
include/e2fsprogs/ext2fs/brel.h
Executable file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* brel.h
|
||||
*
|
||||
* Copyright (C) 1996, 1997 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
struct ext2_block_relocate_entry {
|
||||
blk64_t new;
|
||||
__s16 offset;
|
||||
__u16 flags;
|
||||
union {
|
||||
blk64_t block_ref;
|
||||
ext2_ino_t inode_ref;
|
||||
} owner;
|
||||
};
|
||||
|
||||
#define RELOCATE_TYPE_REF 0x0007
|
||||
#define RELOCATE_BLOCK_REF 0x0001
|
||||
#define RELOCATE_INODE_REF 0x0002
|
||||
|
||||
typedef struct ext2_block_relocation_table *ext2_brel;
|
||||
|
||||
struct ext2_block_relocation_table {
|
||||
__u32 magic;
|
||||
char *name;
|
||||
blk64_t current;
|
||||
void *priv_data;
|
||||
|
||||
/*
|
||||
* Add a block relocation entry.
|
||||
*/
|
||||
errcode_t (*put)(ext2_brel brel, blk64_t old,
|
||||
struct ext2_block_relocate_entry *ent);
|
||||
|
||||
/*
|
||||
* Get a block relocation entry.
|
||||
*/
|
||||
errcode_t (*get)(ext2_brel brel, blk64_t old,
|
||||
struct ext2_block_relocate_entry *ent);
|
||||
|
||||
/*
|
||||
* Initialize for iterating over the block relocation entries.
|
||||
*/
|
||||
errcode_t (*start_iter)(ext2_brel brel);
|
||||
|
||||
/*
|
||||
* The iterator function for the inode relocation entries.
|
||||
* Returns an inode number of 0 when out of entries.
|
||||
*/
|
||||
errcode_t (*next)(ext2_brel brel, blk64_t *old,
|
||||
struct ext2_block_relocate_entry *ent);
|
||||
|
||||
/*
|
||||
* Move the inode relocation table from one block number to
|
||||
* another.
|
||||
*/
|
||||
errcode_t (*move)(ext2_brel brel, blk64_t old, blk_t new);
|
||||
|
||||
/*
|
||||
* Remove a block relocation entry.
|
||||
*/
|
||||
errcode_t (*delete)(ext2_brel brel, blk64_t old);
|
||||
|
||||
|
||||
/*
|
||||
* Free the block relocation table.
|
||||
*/
|
||||
errcode_t (*free)(ext2_brel brel);
|
||||
};
|
||||
|
||||
errcode_t ext2fs_brel_memarray_create(char *name, blk64_t max_block,
|
||||
ext2_brel *brel);
|
||||
|
||||
#define ext2fs_brel_put(brel, old, ent) ((brel)->put((brel), old, ent))
|
||||
#define ext2fs_brel_get(brel, old, ent) ((brel)->get((brel), old, ent))
|
||||
#define ext2fs_brel_start_iter(brel) ((brel)->start_iter((brel)))
|
||||
#define ext2fs_brel_next(brel, old, ent) ((brel)->next((brel), old, ent))
|
||||
#define ext2fs_brel_move(brel, old, new) ((brel)->move((brel), old, new))
|
||||
#define ext2fs_brel_delete(brel, old) ((brel)->delete((brel), old))
|
||||
#define ext2fs_brel_free(brel) ((brel)->free((brel)))
|
||||
|
||||
26
include/e2fsprogs/ext2fs/compiler.h
Executable file
26
include/e2fsprogs/ext2fs/compiler.h
Executable file
@@ -0,0 +1,26 @@
|
||||
#ifndef _EXT2FS_COMPILER_H
|
||||
#define _EXT2FS_COMPILER_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
#define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
#define __GNUC_PREREQ(maj, min) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
__typeof__( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
#else
|
||||
#define container_of(ptr, type, member) \
|
||||
((type *)((char *)(ptr) - offsetof(type, member)))
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _EXT2FS_COMPILER_H */
|
||||
74
include/e2fsprogs/ext2fs/crc16.c
Executable file
74
include/e2fsprogs/ext2fs/crc16.c
Executable file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* crc16.c
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 2. See the file COPYING for more details.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <ext2fs/ext2_types.h>
|
||||
|
||||
#include "crc16.h"
|
||||
|
||||
/** CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1) */
|
||||
static __u16 const crc16_table[256] = {
|
||||
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
|
||||
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
|
||||
0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
|
||||
0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
|
||||
0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
|
||||
0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
|
||||
0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
|
||||
0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
|
||||
0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
|
||||
0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
|
||||
0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
|
||||
0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
|
||||
0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
|
||||
0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
|
||||
0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
|
||||
0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
|
||||
0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
|
||||
0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
|
||||
0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
|
||||
0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
|
||||
0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
|
||||
0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
|
||||
0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
|
||||
0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
|
||||
0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
|
||||
0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
|
||||
0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
|
||||
0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
|
||||
0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
|
||||
0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
|
||||
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
|
||||
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute the CRC-16 for the data buffer
|
||||
*
|
||||
* @param crc previous CRC value
|
||||
* @param buffer data pointer
|
||||
* @param len number of bytes in the buffer
|
||||
* @return the updated CRC value
|
||||
*/
|
||||
crc16_t ext2fs_crc16(crc16_t crc, const void *buffer, unsigned int len)
|
||||
{
|
||||
const unsigned char *cp = buffer;
|
||||
|
||||
while (len--)
|
||||
/*
|
||||
* for an unknown reason, PPC treats __u16 as signed
|
||||
* and keeps doing sign extension on the value.
|
||||
* Instead, use only the low 16 bits of an unsigned
|
||||
* int for holding the CRC value to avoid this.
|
||||
*/
|
||||
crc = (((crc >> 8) & 0xffU) ^
|
||||
crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU;
|
||||
return crc;
|
||||
}
|
||||
26
include/e2fsprogs/ext2fs/crc16.h
Executable file
26
include/e2fsprogs/ext2fs/crc16.h
Executable file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* crc16.h - CRC-16 routine
|
||||
*
|
||||
* Implements the standard CRC-16:
|
||||
* Width 16
|
||||
* Poly 0x8005 (x16 + x15 + x2 + 1)
|
||||
* Init 0
|
||||
*
|
||||
* Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
|
||||
*
|
||||
* This source code is licensed under the GNU General Public License,
|
||||
* Version 2. See the file COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef __CRC16_H
|
||||
#define __CRC16_H
|
||||
|
||||
/* for an unknown reason, PPC treats __u16 as signed and keeps doing sign
|
||||
* extension on the value. Instead, use only the low 16 bits of an
|
||||
* unsigned int for holding the CRC value to avoid this.
|
||||
*/
|
||||
typedef unsigned int crc16_t;
|
||||
|
||||
extern crc16_t ext2fs_crc16(crc16_t crc, const void *buffer, unsigned int len);
|
||||
|
||||
#endif /* __CRC16_H */
|
||||
59
include/e2fsprogs/ext2fs/crc32c_defs.h
Executable file
59
include/e2fsprogs/ext2fs/crc32c_defs.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* There are multiple 16-bit CRC polynomials in common use, but this is
|
||||
* *the* standard CRC-32 polynomial, first popularized by Ethernet.
|
||||
* x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
|
||||
*/
|
||||
#define CRCPOLY_LE 0xedb88320
|
||||
#define CRCPOLY_BE 0x04c11db7
|
||||
|
||||
/*
|
||||
* This is the CRC32c polynomial, as outlined by Castagnoli.
|
||||
* x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+
|
||||
* x^8+x^6+x^0
|
||||
*/
|
||||
#define CRC32C_POLY_LE 0x82F63B78
|
||||
#define CRC32C_POLY_BE 0x1EDC6F41
|
||||
|
||||
/* How many bits at a time to use. Valid values are 1, 2, 4, 8, 32 and 64. */
|
||||
/* For less performance-sensitive, use 4 */
|
||||
#ifndef CRC_LE_BITS
|
||||
# define CRC_LE_BITS 64
|
||||
#endif
|
||||
#ifndef CRC_BE_BITS
|
||||
# define CRC_BE_BITS 64
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Little-endian CRC computation. Used with serial bit streams sent
|
||||
* lsbit-first. Be sure to use cpu_to_le32() to append the computed CRC.
|
||||
*/
|
||||
#if CRC_LE_BITS > 64 || CRC_LE_BITS < 1 || CRC_LE_BITS == 16 || \
|
||||
CRC_LE_BITS & CRC_LE_BITS-1
|
||||
# error "CRC_LE_BITS must be one of {1, 2, 4, 8, 32, 64}"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Big-endian CRC computation. Used with serial bit streams sent
|
||||
* msbit-first. Be sure to use cpu_to_be32() to append the computed CRC.
|
||||
*/
|
||||
#if CRC_BE_BITS > 64 || CRC_BE_BITS < 1 || CRC_BE_BITS == 16 || \
|
||||
CRC_BE_BITS & CRC_BE_BITS-1
|
||||
# error "CRC_BE_BITS must be one of {1, 2, 4, 8, 32, 64}"
|
||||
#endif
|
||||
|
||||
|
||||
#define ___constant_swab32(x) \
|
||||
((uint32_t)( \
|
||||
(((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
|
||||
(((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
|
||||
(((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
|
||||
(((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
|
||||
|
||||
|
||||
#if (__GNUC__ >= 3)
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
#define likely(x) (x)
|
||||
#define unlikely(x) (x)
|
||||
#endif
|
||||
1044
include/e2fsprogs/ext2fs/crc32c_table.h
Executable file
1044
include/e2fsprogs/ext2fs/crc32c_table.h
Executable file
File diff suppressed because it is too large
Load Diff
157
include/e2fsprogs/ext2fs/dosio.h
Executable file
157
include/e2fsprogs/ext2fs/dosio.h
Executable file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* v1.0
|
||||
*
|
||||
* Disk I/O include file for the ext2fs/DOS library.
|
||||
*
|
||||
* Copyright (c) 1997 Mark Habersack
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef __diskio_h
|
||||
#define __diskio_h
|
||||
#ifdef __TURBOC__
|
||||
#ifndef __LARGE__
|
||||
# error "ext2fs/DOS library requires LARGE model!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __TURBOC__
|
||||
#include "msdos.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A helper structure used in LBA => CHS conversion
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned short cyl; /* Cylinder (or track) */
|
||||
unsigned short head;
|
||||
unsigned short sector;
|
||||
unsigned short offset; /* Offset of byte within the sector */
|
||||
} CHS;
|
||||
|
||||
/*
|
||||
* All partition data we need is here
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *dev; /* _Linux_ device name (like "/dev/hda1") */
|
||||
unsigned char phys; /* Physical DOS drive number */
|
||||
unsigned long start; /* LBA address of partition start */
|
||||
unsigned long len; /* length of partition in sectors */
|
||||
unsigned char pno; /* Partition number (read from *dev) */
|
||||
|
||||
/* This partition's drive geometry */
|
||||
unsigned short cyls;
|
||||
unsigned short heads;
|
||||
unsigned short sects;
|
||||
} PARTITION;
|
||||
|
||||
/*
|
||||
* PC partition table entry format
|
||||
*/
|
||||
#ifdef __DJGPP__
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
unsigned char active;
|
||||
unsigned char start_head;
|
||||
unsigned char start_sec;
|
||||
unsigned char start_cyl;
|
||||
unsigned char type;
|
||||
unsigned char end_head;
|
||||
unsigned char end_sec;
|
||||
unsigned char end_cyl;
|
||||
unsigned long first_sec_rel;
|
||||
unsigned long size;
|
||||
} PTABLE_ENTRY;
|
||||
#ifdef __DJGPP__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* INT 0x13 operation codes
|
||||
*/
|
||||
#define DISK_READ 0x02
|
||||
#define DISK_WRITE 0x03
|
||||
#define DISK_GET_GEOMETRY 0x08
|
||||
#define DISK_READY 0x10
|
||||
|
||||
/*
|
||||
* Errors to put in _dio_error
|
||||
*/
|
||||
#define ERR_BADDEV 0x00000001L
|
||||
#define ERR_HARDWARE 0x00000002L
|
||||
#define ERR_NOTSUPP 0x00000003L
|
||||
#define ERR_NOTEXT2FS 0x00000004L
|
||||
#define ERR_EMPTYPART 0x00000005L
|
||||
#define ERR_LINUXSWAP 0x00000006L
|
||||
|
||||
/*
|
||||
* Functions in diskio.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Variable contains last module's error
|
||||
*/
|
||||
extern unsigned long _dio_error;
|
||||
|
||||
/*
|
||||
* This one contains last hardware error (if _dio_error == ERR_HARDWARE)
|
||||
*/
|
||||
extern unsigned long _dio_hw_error;
|
||||
|
||||
/*
|
||||
* Macros to check for disk hardware errors
|
||||
*/
|
||||
#define HW_OK() ((unsigned char)_dio_hw_error == 0x00)
|
||||
#define HW_BAD_CMD() ((unsigned char)_dio_hw_error == 0x01)
|
||||
#define HW_NO_ADDR_MARK() ((unsigned char)_dio_hw_error == 0x02)
|
||||
#define HW_WRITE_PROT() ((unsigned char)_dio_hw_error == 0x03)
|
||||
#define HW_NO_SECTOR() ((unsigned char)_dio_hw_error == 0x04)
|
||||
#define HW_RESET_FAIL() ((unsigned char)_dio_hw_error == 0x05)
|
||||
#define HW_DISK_CHANGED() ((unsigned char)_dio_hw_error == 0x06)
|
||||
#define HW_DRIVE_FAIL() ((unsigned char)_dio_hw_error == 0x07)
|
||||
#define HW_DMA_OVERRUN() ((unsigned char)_dio_hw_error == 0x08)
|
||||
#define HW_DMA_BOUNDARY() ((unsigned char)_dio_hw_error == 0x09)
|
||||
#define HW_BAD_SECTOR() ((unsigned char)_dio_hw_error == 0x0A)
|
||||
#define HW_BAD_TRACK() ((unsigned char)_dio_hw_error == 0x0B)
|
||||
#define HW_UNSUPP_TRACK() ((unsigned char)_dio_hw_error == 0x0C)
|
||||
#define HW_BAD_CRC_ECC() ((unsigned char)_dio_hw_error == 0x10)
|
||||
#define HW_CRC_ECC_CORR() ((unsigned char)_dio_hw_error == 0x11)
|
||||
#define HW_CONTR_FAIL() ((unsigned char)_dio_hw_error == 0x20)
|
||||
#define HW_SEEK_FAIL() ((unsigned char)_dio_hw_error == 0x40)
|
||||
#define HW_ATTACH_FAIL() ((unsigned char)_dio_hw_error == 0x80)
|
||||
#define HW_DRIVE_NREADY() ((unsigned char)_dio_hw_error == 0xAA)
|
||||
#define HW_UNDEF_ERROR() ((unsigned char)_dio_hw_error == 0xBB)
|
||||
#define HW_WRITE_FAULT() ((unsigned char)_dio_hw_error == 0xCC)
|
||||
#define HW_STATUS_ERROR() ((unsigned char)_dio_hw_error == 0xE0)
|
||||
#define HW_SENSE_FAIL() ((unsigned char)_dio_hw_error == 0xFF)
|
||||
|
||||
|
||||
/*
|
||||
* Open the specified partition.
|
||||
* String 'dev' must have a format:
|
||||
*
|
||||
* /dev/{sd|hd|fd}[X]
|
||||
*
|
||||
* where,
|
||||
*
|
||||
* only one of the option in curly braces can be used and X is an optional
|
||||
* partition number for the given device. If X is not specified, function
|
||||
* scans the drive's partition table in search for the first Linux ext2fs
|
||||
* partition (signature 0x83). Along the way it dives into every extended
|
||||
* partition encountered.
|
||||
* Scan ends if either (a) there are no more used partition entries, or
|
||||
* (b) there is no Xth partition.
|
||||
*
|
||||
* Routine returns 0 on success and !=0 otherwise.
|
||||
*/
|
||||
int open_partition(char *dev);
|
||||
|
||||
#endif /* __diskio_h */
|
||||
37
include/e2fsprogs/ext2fs/e2image.h
Executable file
37
include/e2fsprogs/ext2fs/e2image.h
Executable file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* e2image.h --- header file describing the ext2 image format
|
||||
*
|
||||
* Copyright (C) 2000 Theodore Ts'o.
|
||||
*
|
||||
* Note: this uses the POSIX IO interfaces, unlike most of the other
|
||||
* functions in this library. So sue me.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
struct ext2_image_hdr {
|
||||
__u32 magic_number; /* This must be EXT2_ET_MAGIC_E2IMAGE */
|
||||
char magic_descriptor[16]; /* "Ext2 Image 1.0", w/ null padding */
|
||||
char fs_hostname[64];/* Hostname of machine of image */
|
||||
char fs_netaddr[32]; /* Network address */
|
||||
__u32 fs_netaddr_type;/* 0 = IPV4, 1 = IPV6, etc. */
|
||||
__u32 fs_device; /* Device number of image */
|
||||
char fs_device_name[64]; /* Device name */
|
||||
char fs_uuid[16]; /* UUID of filesystem */
|
||||
__u32 fs_blocksize; /* Block size of the filesystem */
|
||||
__u32 fs_reserved[8];
|
||||
|
||||
__u32 image_device; /* Device number of image file */
|
||||
__u32 image_inode; /* Inode number of image file */
|
||||
__u32 image_time; /* Time of image creation */
|
||||
__u32 image_reserved[8];
|
||||
|
||||
__u32 offset_super; /* Byte offset of the sb and descriptors */
|
||||
__u32 offset_inode; /* Byte offset of the inode table */
|
||||
__u32 offset_inodemap; /* Byte offset of the inode bitmaps */
|
||||
__u32 offset_blockmap; /* Byte offset of the inode bitmaps */
|
||||
__u32 offset_reserved[8];
|
||||
};
|
||||
201
include/e2fsprogs/ext2fs/ext2_err.h
Executable file
201
include/e2fsprogs/ext2fs/ext2_err.h
Executable file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* ext2_err.h:
|
||||
* This file is automatically generated; please do not edit it.
|
||||
*/
|
||||
|
||||
#include <et/com_err.h>
|
||||
|
||||
#define EXT2_ET_BASE (2133571328L)
|
||||
#define EXT2_ET_MAGIC_EXT2FS_FILSYS (2133571329L)
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L)
|
||||
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L)
|
||||
#define EXT2_ET_MAGIC_INODE_SCAN (2133571332L)
|
||||
#define EXT2_ET_MAGIC_IO_CHANNEL (2133571333L)
|
||||
#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL (2133571334L)
|
||||
#define EXT2_ET_MAGIC_IO_MANAGER (2133571335L)
|
||||
#define EXT2_ET_MAGIC_BLOCK_BITMAP (2133571336L)
|
||||
#define EXT2_ET_MAGIC_INODE_BITMAP (2133571337L)
|
||||
#define EXT2_ET_MAGIC_GENERIC_BITMAP (2133571338L)
|
||||
#define EXT2_ET_MAGIC_TEST_IO_CHANNEL (2133571339L)
|
||||
#define EXT2_ET_MAGIC_DBLIST (2133571340L)
|
||||
#define EXT2_ET_MAGIC_ICOUNT (2133571341L)
|
||||
#define EXT2_ET_MAGIC_PQ_IO_CHANNEL (2133571342L)
|
||||
#define EXT2_ET_MAGIC_EXT2_FILE (2133571343L)
|
||||
#define EXT2_ET_MAGIC_E2IMAGE (2133571344L)
|
||||
#define EXT2_ET_MAGIC_INODE_IO_CHANNEL (2133571345L)
|
||||
#define EXT2_ET_MAGIC_EXTENT_HANDLE (2133571346L)
|
||||
#define EXT2_ET_BAD_MAGIC (2133571347L)
|
||||
#define EXT2_ET_REV_TOO_HIGH (2133571348L)
|
||||
#define EXT2_ET_RO_FILSYS (2133571349L)
|
||||
#define EXT2_ET_GDESC_READ (2133571350L)
|
||||
#define EXT2_ET_GDESC_WRITE (2133571351L)
|
||||
#define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571352L)
|
||||
#define EXT2_ET_GDESC_BAD_INODE_MAP (2133571353L)
|
||||
#define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571354L)
|
||||
#define EXT2_ET_INODE_BITMAP_WRITE (2133571355L)
|
||||
#define EXT2_ET_INODE_BITMAP_READ (2133571356L)
|
||||
#define EXT2_ET_BLOCK_BITMAP_WRITE (2133571357L)
|
||||
#define EXT2_ET_BLOCK_BITMAP_READ (2133571358L)
|
||||
#define EXT2_ET_INODE_TABLE_WRITE (2133571359L)
|
||||
#define EXT2_ET_INODE_TABLE_READ (2133571360L)
|
||||
#define EXT2_ET_NEXT_INODE_READ (2133571361L)
|
||||
#define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571362L)
|
||||
#define EXT2_ET_DIR_CORRUPTED (2133571363L)
|
||||
#define EXT2_ET_SHORT_READ (2133571364L)
|
||||
#define EXT2_ET_SHORT_WRITE (2133571365L)
|
||||
#define EXT2_ET_DIR_NO_SPACE (2133571366L)
|
||||
#define EXT2_ET_NO_INODE_BITMAP (2133571367L)
|
||||
#define EXT2_ET_NO_BLOCK_BITMAP (2133571368L)
|
||||
#define EXT2_ET_BAD_INODE_NUM (2133571369L)
|
||||
#define EXT2_ET_BAD_BLOCK_NUM (2133571370L)
|
||||
#define EXT2_ET_EXPAND_DIR_ERR (2133571371L)
|
||||
#define EXT2_ET_TOOSMALL (2133571372L)
|
||||
#define EXT2_ET_BAD_BLOCK_MARK (2133571373L)
|
||||
#define EXT2_ET_BAD_BLOCK_UNMARK (2133571374L)
|
||||
#define EXT2_ET_BAD_BLOCK_TEST (2133571375L)
|
||||
#define EXT2_ET_BAD_INODE_MARK (2133571376L)
|
||||
#define EXT2_ET_BAD_INODE_UNMARK (2133571377L)
|
||||
#define EXT2_ET_BAD_INODE_TEST (2133571378L)
|
||||
#define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571379L)
|
||||
#define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571380L)
|
||||
#define EXT2_ET_BAD_IND_BLOCK (2133571381L)
|
||||
#define EXT2_ET_BAD_DIND_BLOCK (2133571382L)
|
||||
#define EXT2_ET_BAD_TIND_BLOCK (2133571383L)
|
||||
#define EXT2_ET_NEQ_BLOCK_BITMAP (2133571384L)
|
||||
#define EXT2_ET_NEQ_INODE_BITMAP (2133571385L)
|
||||
#define EXT2_ET_BAD_DEVICE_NAME (2133571386L)
|
||||
#define EXT2_ET_MISSING_INODE_TABLE (2133571387L)
|
||||
#define EXT2_ET_CORRUPT_SUPERBLOCK (2133571388L)
|
||||
#define EXT2_ET_BAD_GENERIC_MARK (2133571389L)
|
||||
#define EXT2_ET_BAD_GENERIC_UNMARK (2133571390L)
|
||||
#define EXT2_ET_BAD_GENERIC_TEST (2133571391L)
|
||||
#define EXT2_ET_SYMLINK_LOOP (2133571392L)
|
||||
#define EXT2_ET_CALLBACK_NOTHANDLED (2133571393L)
|
||||
#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571394L)
|
||||
#define EXT2_ET_UNSUPP_FEATURE (2133571395L)
|
||||
#define EXT2_ET_RO_UNSUPP_FEATURE (2133571396L)
|
||||
#define EXT2_ET_LLSEEK_FAILED (2133571397L)
|
||||
#define EXT2_ET_NO_MEMORY (2133571398L)
|
||||
#define EXT2_ET_INVALID_ARGUMENT (2133571399L)
|
||||
#define EXT2_ET_BLOCK_ALLOC_FAIL (2133571400L)
|
||||
#define EXT2_ET_INODE_ALLOC_FAIL (2133571401L)
|
||||
#define EXT2_ET_NO_DIRECTORY (2133571402L)
|
||||
#define EXT2_ET_TOO_MANY_REFS (2133571403L)
|
||||
#define EXT2_ET_FILE_NOT_FOUND (2133571404L)
|
||||
#define EXT2_ET_FILE_RO (2133571405L)
|
||||
#define EXT2_ET_DB_NOT_FOUND (2133571406L)
|
||||
#define EXT2_ET_DIR_EXISTS (2133571407L)
|
||||
#define EXT2_ET_UNIMPLEMENTED (2133571408L)
|
||||
#define EXT2_ET_CANCEL_REQUESTED (2133571409L)
|
||||
#define EXT2_ET_FILE_TOO_BIG (2133571410L)
|
||||
#define EXT2_ET_JOURNAL_NOT_BLOCK (2133571411L)
|
||||
#define EXT2_ET_NO_JOURNAL_SB (2133571412L)
|
||||
#define EXT2_ET_JOURNAL_TOO_SMALL (2133571413L)
|
||||
#define EXT2_ET_JOURNAL_UNSUPP_VERSION (2133571414L)
|
||||
#define EXT2_ET_LOAD_EXT_JOURNAL (2133571415L)
|
||||
#define EXT2_ET_NO_JOURNAL (2133571416L)
|
||||
#define EXT2_ET_DIRHASH_UNSUPP (2133571417L)
|
||||
#define EXT2_ET_BAD_EA_BLOCK_NUM (2133571418L)
|
||||
#define EXT2_ET_TOO_MANY_INODES (2133571419L)
|
||||
#define EXT2_ET_NOT_IMAGE_FILE (2133571420L)
|
||||
#define EXT2_ET_RES_GDT_BLOCKS (2133571421L)
|
||||
#define EXT2_ET_RESIZE_INODE_CORRUPT (2133571422L)
|
||||
#define EXT2_ET_SET_BMAP_NO_IND (2133571423L)
|
||||
#define EXT2_ET_TDB_SUCCESS (2133571424L)
|
||||
#define EXT2_ET_TDB_ERR_CORRUPT (2133571425L)
|
||||
#define EXT2_ET_TDB_ERR_IO (2133571426L)
|
||||
#define EXT2_ET_TDB_ERR_LOCK (2133571427L)
|
||||
#define EXT2_ET_TDB_ERR_OOM (2133571428L)
|
||||
#define EXT2_ET_TDB_ERR_EXISTS (2133571429L)
|
||||
#define EXT2_ET_TDB_ERR_NOLOCK (2133571430L)
|
||||
#define EXT2_ET_TDB_ERR_EINVAL (2133571431L)
|
||||
#define EXT2_ET_TDB_ERR_NOEXIST (2133571432L)
|
||||
#define EXT2_ET_TDB_ERR_RDONLY (2133571433L)
|
||||
#define EXT2_ET_DBLIST_EMPTY (2133571434L)
|
||||
#define EXT2_ET_RO_BLOCK_ITERATE (2133571435L)
|
||||
#define EXT2_ET_MAGIC_EXTENT_PATH (2133571436L)
|
||||
#define EXT2_ET_MAGIC_GENERIC_BITMAP64 (2133571437L)
|
||||
#define EXT2_ET_MAGIC_BLOCK_BITMAP64 (2133571438L)
|
||||
#define EXT2_ET_MAGIC_INODE_BITMAP64 (2133571439L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_13 (2133571440L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_14 (2133571441L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_15 (2133571442L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_16 (2133571443L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_17 (2133571444L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_18 (2133571445L)
|
||||
#define EXT2_ET_MAGIC_RESERVED_19 (2133571446L)
|
||||
#define EXT2_ET_EXTENT_HEADER_BAD (2133571447L)
|
||||
#define EXT2_ET_EXTENT_INDEX_BAD (2133571448L)
|
||||
#define EXT2_ET_EXTENT_LEAF_BAD (2133571449L)
|
||||
#define EXT2_ET_EXTENT_NO_SPACE (2133571450L)
|
||||
#define EXT2_ET_INODE_NOT_EXTENT (2133571451L)
|
||||
#define EXT2_ET_EXTENT_NO_NEXT (2133571452L)
|
||||
#define EXT2_ET_EXTENT_NO_PREV (2133571453L)
|
||||
#define EXT2_ET_EXTENT_NO_UP (2133571454L)
|
||||
#define EXT2_ET_EXTENT_NO_DOWN (2133571455L)
|
||||
#define EXT2_ET_NO_CURRENT_NODE (2133571456L)
|
||||
#define EXT2_ET_OP_NOT_SUPPORTED (2133571457L)
|
||||
#define EXT2_ET_CANT_INSERT_EXTENT (2133571458L)
|
||||
#define EXT2_ET_CANT_SPLIT_EXTENT (2133571459L)
|
||||
#define EXT2_ET_EXTENT_NOT_FOUND (2133571460L)
|
||||
#define EXT2_ET_EXTENT_NOT_SUPPORTED (2133571461L)
|
||||
#define EXT2_ET_EXTENT_INVALID_LENGTH (2133571462L)
|
||||
#define EXT2_ET_IO_CHANNEL_NO_SUPPORT_64 (2133571463L)
|
||||
#define EXT2_ET_NO_MTAB_FILE (2133571464L)
|
||||
#define EXT2_ET_CANT_USE_LEGACY_BITMAPS (2133571465L)
|
||||
#define EXT2_ET_MMP_MAGIC_INVALID (2133571466L)
|
||||
#define EXT2_ET_MMP_FAILED (2133571467L)
|
||||
#define EXT2_ET_MMP_FSCK_ON (2133571468L)
|
||||
#define EXT2_ET_MMP_BAD_BLOCK (2133571469L)
|
||||
#define EXT2_ET_MMP_UNKNOWN_SEQ (2133571470L)
|
||||
#define EXT2_ET_MMP_CHANGE_ABORT (2133571471L)
|
||||
#define EXT2_ET_MMP_OPEN_DIRECT (2133571472L)
|
||||
#define EXT2_ET_BAD_DESC_SIZE (2133571473L)
|
||||
#define EXT2_ET_INODE_CSUM_INVALID (2133571474L)
|
||||
#define EXT2_ET_INODE_BITMAP_CSUM_INVALID (2133571475L)
|
||||
#define EXT2_ET_EXTENT_CSUM_INVALID (2133571476L)
|
||||
#define EXT2_ET_DIR_NO_SPACE_FOR_CSUM (2133571477L)
|
||||
#define EXT2_ET_DIR_CSUM_INVALID (2133571478L)
|
||||
#define EXT2_ET_EXT_ATTR_CSUM_INVALID (2133571479L)
|
||||
#define EXT2_ET_SB_CSUM_INVALID (2133571480L)
|
||||
#define EXT2_ET_UNKNOWN_CSUM (2133571481L)
|
||||
#define EXT2_ET_MMP_CSUM_INVALID (2133571482L)
|
||||
#define EXT2_ET_FILE_EXISTS (2133571483L)
|
||||
#define EXT2_ET_BLOCK_BITMAP_CSUM_INVALID (2133571484L)
|
||||
#define EXT2_ET_INLINE_DATA_CANT_ITERATE (2133571485L)
|
||||
#define EXT2_ET_EA_BAD_NAME_LEN (2133571486L)
|
||||
#define EXT2_ET_EA_BAD_VALUE_SIZE (2133571487L)
|
||||
#define EXT2_ET_BAD_EA_HASH (2133571488L)
|
||||
#define EXT2_ET_BAD_EA_HEADER (2133571489L)
|
||||
#define EXT2_ET_EA_KEY_NOT_FOUND (2133571490L)
|
||||
#define EXT2_ET_EA_NO_SPACE (2133571491L)
|
||||
#define EXT2_ET_MISSING_EA_FEATURE (2133571492L)
|
||||
#define EXT2_ET_NO_INLINE_DATA (2133571493L)
|
||||
#define EXT2_ET_INLINE_DATA_NO_BLOCK (2133571494L)
|
||||
#define EXT2_ET_INLINE_DATA_NO_SPACE (2133571495L)
|
||||
#define EXT2_ET_MAGIC_EA_HANDLE (2133571496L)
|
||||
#define EXT2_ET_INODE_IS_GARBAGE (2133571497L)
|
||||
#define EXT2_ET_EA_BAD_VALUE_OFFSET (2133571498L)
|
||||
#define EXT2_ET_JOURNAL_FLAGS_WRONG (2133571499L)
|
||||
#define EXT2_ET_UNDO_FILE_CORRUPT (2133571500L)
|
||||
#define EXT2_ET_UNDO_FILE_WRONG (2133571501L)
|
||||
#define EXT2_ET_FILESYSTEM_CORRUPTED (2133571502L)
|
||||
#define EXT2_ET_BAD_CRC (2133571503L)
|
||||
#define EXT2_ET_CORRUPT_JOURNAL_SB (2133571504L)
|
||||
#define EXT2_ET_INODE_CORRUPTED (2133571505L)
|
||||
#define EXT2_ET_EA_INODE_CORRUPTED (2133571506L)
|
||||
#define EXT2_ET_NO_GDESC (2133571507L)
|
||||
#define EXT2_FILSYS_CORRUPTED (2133571508L)
|
||||
#define EXT2_ET_EXTENT_CYCLE (2133571509L)
|
||||
#define EXT2_ET_EXTERNAL_JOURNAL_NOSUPP (2133571510L)
|
||||
extern const struct error_table et_ext2_error_table;
|
||||
extern void initialize_ext2_error_table(void);
|
||||
|
||||
/* For compatibility with Heimdal */
|
||||
extern void initialize_ext2_error_table_r(struct et_list **list);
|
||||
|
||||
#define ERROR_TABLE_BASE_ext2 (2133571328L)
|
||||
|
||||
/* for compatibility with older versions... */
|
||||
#define init_ext2_err_tbl initialize_ext2_error_table
|
||||
#define ext2_err_base ERROR_TABLE_BASE_ext2
|
||||
73
include/e2fsprogs/ext2fs/ext2_ext_attr.h
Executable file
73
include/e2fsprogs/ext2fs/ext2_ext_attr.h
Executable file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
File: linux/ext2_ext_attr.h
|
||||
|
||||
On-disk format of extended attributes for the ext2 filesystem.
|
||||
|
||||
(C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
|
||||
*/
|
||||
|
||||
#ifndef _EXT2_EXT_ATTR_H
|
||||
#define _EXT2_EXT_ATTR_H
|
||||
/* Magic value in attribute blocks */
|
||||
#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000
|
||||
#define EXT2_EXT_ATTR_MAGIC 0xEA020000
|
||||
|
||||
/* Maximum number of references to one attribute block */
|
||||
#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024
|
||||
|
||||
struct ext2_ext_attr_header {
|
||||
__u32 h_magic; /* magic number for identification */
|
||||
__u32 h_refcount; /* reference count */
|
||||
__u32 h_blocks; /* number of disk blocks used */
|
||||
__u32 h_hash; /* hash value of all attributes */
|
||||
__u32 h_checksum; /* crc32c(uuid+id+xattrs) */
|
||||
/* id = inum if refcount = 1, else blknum */
|
||||
__u32 h_reserved[3]; /* zero right now */
|
||||
};
|
||||
|
||||
struct ext2_ext_attr_entry {
|
||||
__u8 e_name_len; /* length of name */
|
||||
__u8 e_name_index; /* attribute name index */
|
||||
__u16 e_value_offs; /* offset in disk block of value */
|
||||
__u32 e_value_inum; /* inode in which the value is stored */
|
||||
__u32 e_value_size; /* size of attribute value */
|
||||
__u32 e_hash; /* hash value of name and value */
|
||||
#if 0
|
||||
char e_name[0]; /* attribute name */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define EXT2_EXT_ATTR_PAD_BITS 2
|
||||
#define EXT2_EXT_ATTR_PAD ((unsigned) 1<<EXT2_EXT_ATTR_PAD_BITS)
|
||||
#define EXT2_EXT_ATTR_ROUND (EXT2_EXT_ATTR_PAD-1)
|
||||
#define EXT2_EXT_ATTR_LEN(name_len) \
|
||||
(((name_len) + EXT2_EXT_ATTR_ROUND + \
|
||||
sizeof(struct ext2_ext_attr_entry)) & ~EXT2_EXT_ATTR_ROUND)
|
||||
#define EXT2_EXT_ATTR_NEXT(entry) \
|
||||
( (struct ext2_ext_attr_entry *)( \
|
||||
(char *)(entry) + EXT2_EXT_ATTR_LEN((entry)->e_name_len)) )
|
||||
#define EXT2_EXT_ATTR_SIZE(size) \
|
||||
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
|
||||
#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL)
|
||||
#define EXT2_EXT_ATTR_NAME(entry) \
|
||||
(((char *) (entry)) + sizeof(struct ext2_ext_attr_entry))
|
||||
#define EXT2_XATTR_LEN(name_len) \
|
||||
(((name_len) + EXT2_EXT_ATTR_ROUND + \
|
||||
sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND)
|
||||
#define EXT2_XATTR_SIZE(size) \
|
||||
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
# ifdef CONFIG_EXT2_FS_EXT_ATTR
|
||||
extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int);
|
||||
extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int);
|
||||
extern void ext2_ext_attr_free_inode(struct inode *inode);
|
||||
extern void ext2_ext_attr_put_super(struct super_block *sb);
|
||||
extern int ext2_ext_attr_init(void);
|
||||
extern void ext2_ext_attr_done(void);
|
||||
# else
|
||||
# define ext2_get_ext_attr NULL
|
||||
# define ext2_set_ext_attr NULL
|
||||
# endif
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _EXT2_EXT_ATTR_H */
|
||||
1189
include/e2fsprogs/ext2fs/ext2_fs.h
Executable file
1189
include/e2fsprogs/ext2fs/ext2_fs.h
Executable file
File diff suppressed because it is too large
Load Diff
179
include/e2fsprogs/ext2fs/ext2_io.h
Executable file
179
include/e2fsprogs/ext2fs/ext2_io.h
Executable file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* io.h --- the I/O manager abstraction
|
||||
*
|
||||
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _EXT2FS_EXT2_IO_H
|
||||
#define _EXT2FS_EXT2_IO_H
|
||||
|
||||
#include <ext2fs/ext2_types.h>
|
||||
|
||||
/*
|
||||
* ext2_loff_t is defined here since unix_io.c needs it.
|
||||
*/
|
||||
#if defined(__GNUC__) || defined(HAS_LONG_LONG)
|
||||
typedef long long ext2_loff_t;
|
||||
#else
|
||||
typedef long ext2_loff_t;
|
||||
#endif
|
||||
|
||||
/* llseek.c */
|
||||
ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int);
|
||||
|
||||
typedef struct struct_io_manager *io_manager;
|
||||
typedef struct struct_io_channel *io_channel;
|
||||
typedef struct struct_io_stats *io_stats;
|
||||
|
||||
#define CHANNEL_FLAGS_WRITETHROUGH 0x01
|
||||
#define CHANNEL_FLAGS_DISCARD_ZEROES 0x02
|
||||
#define CHANNEL_FLAGS_BLOCK_DEVICE 0x04
|
||||
#define CHANNEL_FLAGS_THREADS 0x08
|
||||
|
||||
#define io_channel_discard_zeroes_data(i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES)
|
||||
|
||||
struct struct_io_channel {
|
||||
errcode_t magic;
|
||||
io_manager manager;
|
||||
char *name;
|
||||
int block_size;
|
||||
errcode_t (*read_error)(io_channel channel,
|
||||
unsigned long block,
|
||||
int count,
|
||||
void *data,
|
||||
size_t size,
|
||||
int actual_bytes_read,
|
||||
errcode_t error);
|
||||
errcode_t (*write_error)(io_channel channel,
|
||||
unsigned long block,
|
||||
int count,
|
||||
const void *data,
|
||||
size_t size,
|
||||
int actual_bytes_written,
|
||||
errcode_t error);
|
||||
int refcount;
|
||||
int flags;
|
||||
long reserved[14];
|
||||
void *private_data;
|
||||
void *app_data;
|
||||
int align;
|
||||
};
|
||||
|
||||
struct struct_io_stats {
|
||||
int num_fields;
|
||||
int reserved;
|
||||
unsigned long long bytes_read;
|
||||
unsigned long long bytes_written;
|
||||
};
|
||||
|
||||
struct struct_io_manager {
|
||||
errcode_t magic;
|
||||
const char *name;
|
||||
errcode_t (*open)(const char *name, int flags, io_channel *channel);
|
||||
errcode_t (*close)(io_channel channel);
|
||||
errcode_t (*set_blksize)(io_channel channel, int blksize);
|
||||
errcode_t (*read_blk)(io_channel channel, unsigned long block,
|
||||
int count, void *data);
|
||||
errcode_t (*write_blk)(io_channel channel, unsigned long block,
|
||||
int count, const void *data);
|
||||
errcode_t (*flush)(io_channel channel);
|
||||
errcode_t (*write_byte)(io_channel channel, unsigned long offset,
|
||||
int count, const void *data);
|
||||
errcode_t (*set_option)(io_channel channel, const char *option,
|
||||
const char *arg);
|
||||
errcode_t (*get_stats)(io_channel channel, io_stats *io_stats);
|
||||
errcode_t (*read_blk64)(io_channel channel, unsigned long long block,
|
||||
int count, void *data);
|
||||
errcode_t (*write_blk64)(io_channel channel, unsigned long long block,
|
||||
int count, const void *data);
|
||||
errcode_t (*discard)(io_channel channel, unsigned long long block,
|
||||
unsigned long long count);
|
||||
errcode_t (*cache_readahead)(io_channel channel,
|
||||
unsigned long long block,
|
||||
unsigned long long count);
|
||||
errcode_t (*zeroout)(io_channel channel, unsigned long long block,
|
||||
unsigned long long count);
|
||||
long reserved[14];
|
||||
};
|
||||
|
||||
#define IO_FLAG_RW 0x0001
|
||||
#define IO_FLAG_EXCLUSIVE 0x0002
|
||||
#define IO_FLAG_DIRECT_IO 0x0004
|
||||
#define IO_FLAG_FORCE_BOUNCE 0x0008
|
||||
#define IO_FLAG_THREADS 0x0010
|
||||
#define IO_FLAG_NOCACHE 0x0020
|
||||
|
||||
/*
|
||||
* Convenience functions....
|
||||
*/
|
||||
#define io_channel_close(c) ((c)->manager->close((c)))
|
||||
#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s))
|
||||
#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d))
|
||||
#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
|
||||
#define io_channel_flush(c) ((c)->manager->flush((c)))
|
||||
#define io_channel_bumpcount(c) ((c)->refcount++)
|
||||
|
||||
/* io_manager.c */
|
||||
extern errcode_t io_channel_set_options(io_channel channel,
|
||||
const char *options);
|
||||
extern errcode_t io_channel_write_byte(io_channel channel,
|
||||
unsigned long offset,
|
||||
int count, const void *data);
|
||||
extern errcode_t io_channel_read_blk64(io_channel channel,
|
||||
unsigned long long block,
|
||||
int count, void *data);
|
||||
extern errcode_t io_channel_write_blk64(io_channel channel,
|
||||
unsigned long long block,
|
||||
int count, const void *data);
|
||||
extern errcode_t io_channel_discard(io_channel channel,
|
||||
unsigned long long block,
|
||||
unsigned long long count);
|
||||
extern errcode_t io_channel_zeroout(io_channel channel,
|
||||
unsigned long long block,
|
||||
unsigned long long count);
|
||||
extern errcode_t io_channel_alloc_buf(io_channel channel,
|
||||
int count, void *ptr);
|
||||
extern errcode_t io_channel_cache_readahead(io_channel io,
|
||||
unsigned long long block,
|
||||
unsigned long long count);
|
||||
|
||||
#ifdef _WIN32
|
||||
/* windows_io.c */
|
||||
extern io_manager windows_io_manager;
|
||||
#define default_io_manager windows_io_manager
|
||||
#else
|
||||
/* unix_io.c */
|
||||
extern io_manager unix_io_manager;
|
||||
extern io_manager unixfd_io_manager;
|
||||
#define default_io_manager unix_io_manager
|
||||
#endif
|
||||
|
||||
/* sparse_io.c */
|
||||
extern io_manager sparse_io_manager;
|
||||
extern io_manager sparsefd_io_manager;
|
||||
|
||||
/* undo_io.c */
|
||||
extern io_manager undo_io_manager;
|
||||
extern errcode_t set_undo_io_backing_manager(io_manager manager);
|
||||
extern errcode_t set_undo_io_backup_file(char *file_name);
|
||||
|
||||
/* test_io.c */
|
||||
extern io_manager test_io_manager, test_io_backing_manager;
|
||||
extern void (*test_io_cb_read_blk)
|
||||
(unsigned long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_write_blk)
|
||||
(unsigned long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_read_blk64)
|
||||
(unsigned long long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_write_blk64)
|
||||
(unsigned long long block, int count, errcode_t err);
|
||||
extern void (*test_io_cb_set_blksize)
|
||||
(int blksize, errcode_t err);
|
||||
|
||||
#endif /* _EXT2FS_EXT2_IO_H */
|
||||
|
||||
45
include/e2fsprogs/ext2fs/ext2_types.h
Executable file
45
include/e2fsprogs/ext2fs/ext2_types.h
Executable file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* If linux/types.h is already been included, assume it has defined
|
||||
* everything we need. (cross fingers) Other header files may have
|
||||
* also defined the types that we need.
|
||||
*/
|
||||
#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
|
||||
!defined(_EXT2_TYPES_H) && !defined(_UUID_TYPES_H))
|
||||
#define _EXT2_TYPES_H
|
||||
|
||||
typedef unsigned char __u8;
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned short __u16;
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned int __u32;
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned long long __u64;
|
||||
typedef __signed__ long long __s64;
|
||||
#endif
|
||||
|
||||
#include <stdint.h> //uintptr_t
|
||||
|
||||
/* endian checking stuff */
|
||||
#ifndef EXT2_ENDIAN_H_
|
||||
#define EXT2_ENDIAN_H_
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#ifndef __bitwise
|
||||
#define __bitwise __attribute__((bitwise))
|
||||
#endif
|
||||
#define __force __attribute__((force))
|
||||
#else
|
||||
#ifndef __bitwise
|
||||
#define __bitwise
|
||||
#endif
|
||||
#define __force
|
||||
#endif
|
||||
|
||||
typedef __u16 __bitwise __le16;
|
||||
typedef __u32 __bitwise __le32;
|
||||
typedef __u64 __bitwise __le64;
|
||||
typedef __u16 __bitwise __be16;
|
||||
typedef __u32 __bitwise __be32;
|
||||
typedef __u64 __bitwise __be64;
|
||||
|
||||
#endif /* EXT2_ENDIAN_H_ */
|
||||
2191
include/e2fsprogs/ext2fs/ext2fs.h
Executable file
2191
include/e2fsprogs/ext2fs/ext2fs.h
Executable file
File diff suppressed because it is too large
Load Diff
210
include/e2fsprogs/ext2fs/ext2fsP.h
Executable file
210
include/e2fsprogs/ext2fs/ext2fsP.h
Executable file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* ext2fsP.h --- private header file for ext2 library
|
||||
*
|
||||
* Copyright (C) 1997 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#if HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "ext2fs.h"
|
||||
|
||||
#define EXT2FS_MAX_NESTED_LINKS 8
|
||||
|
||||
static inline int ext2fsP_is_disk_device(mode_t mode)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
return S_ISBLK(mode) || S_ISCHR(mode);
|
||||
#else
|
||||
return S_ISBLK(mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Badblocks list
|
||||
*/
|
||||
struct ext2_struct_u32_list {
|
||||
int magic;
|
||||
int num;
|
||||
int size;
|
||||
__u32 *list;
|
||||
int badblocks_flags;
|
||||
};
|
||||
|
||||
struct ext2_struct_u32_iterate {
|
||||
int magic;
|
||||
ext2_u32_list bb;
|
||||
int ptr;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Directory block iterator definition
|
||||
*/
|
||||
struct ext2_struct_dblist {
|
||||
int magic;
|
||||
ext2_filsys fs;
|
||||
unsigned long long size;
|
||||
unsigned long long count;
|
||||
int sorted;
|
||||
struct ext2_db_entry2 * list;
|
||||
};
|
||||
|
||||
/*
|
||||
* For directory iterators
|
||||
*/
|
||||
struct dir_context {
|
||||
ext2_ino_t dir;
|
||||
int flags;
|
||||
char *buf;
|
||||
unsigned int buflen;
|
||||
int (*func)(ext2_ino_t dir,
|
||||
int entry,
|
||||
struct ext2_dir_entry *dirent,
|
||||
int offset,
|
||||
int blocksize,
|
||||
char *buf,
|
||||
void *priv_data);
|
||||
void *priv_data;
|
||||
errcode_t errcode;
|
||||
};
|
||||
|
||||
/*
|
||||
* Inode cache structure
|
||||
*/
|
||||
struct ext2_inode_cache {
|
||||
void * buffer;
|
||||
blk64_t buffer_blk;
|
||||
int cache_last;
|
||||
unsigned int cache_size;
|
||||
int refcount;
|
||||
struct ext2_inode_cache_ent *cache;
|
||||
};
|
||||
|
||||
struct ext2_inode_cache_ent {
|
||||
ext2_ino_t ino;
|
||||
struct ext2_inode *inode;
|
||||
};
|
||||
|
||||
/*
|
||||
* NLS definitions
|
||||
*/
|
||||
struct ext2fs_nls_table {
|
||||
int version;
|
||||
const struct ext2fs_nls_ops *ops;
|
||||
};
|
||||
|
||||
struct ext2fs_nls_ops {
|
||||
int (*casefold)(const struct ext2fs_nls_table *charset,
|
||||
const unsigned char *str, size_t len,
|
||||
unsigned char *dest, size_t dlen);
|
||||
int (*validate)(const struct ext2fs_nls_table *table,
|
||||
char *s, size_t len, char **pos);
|
||||
int (*casefold_cmp)(const struct ext2fs_nls_table *table,
|
||||
const unsigned char *str1, size_t len1,
|
||||
const unsigned char *str2, size_t len2);
|
||||
};
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
extern int ext2fs_process_dir_block(ext2_filsys fs,
|
||||
blk64_t *blocknr,
|
||||
e2_blkcnt_t blockcnt,
|
||||
blk64_t ref_block,
|
||||
int ref_offset,
|
||||
void *priv_data);
|
||||
|
||||
extern errcode_t ext2fs_inline_data_ea_remove(ext2_filsys fs, ext2_ino_t ino);
|
||||
extern errcode_t ext2fs_inline_data_expand(ext2_filsys fs, ext2_ino_t ino);
|
||||
extern int ext2fs_inline_data_dir_iterate(ext2_filsys fs,
|
||||
ext2_ino_t ino,
|
||||
void *priv_data);
|
||||
|
||||
/* Generic numeric progress meter */
|
||||
|
||||
struct ext2fs_numeric_progress_struct {
|
||||
__u64 max;
|
||||
int log_max;
|
||||
int skip_progress;
|
||||
};
|
||||
|
||||
/*
|
||||
* progress callback functions
|
||||
*/
|
||||
struct ext2fs_progress_ops {
|
||||
void (*init)(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
const char *label, __u64 max);
|
||||
void (*update)(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
__u64 val);
|
||||
void (*close)(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
const char *message);
|
||||
};
|
||||
|
||||
extern struct ext2fs_progress_ops ext2fs_numeric_progress_ops;
|
||||
|
||||
extern void ext2fs_numeric_progress_init(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
const char *label, __u64 max);
|
||||
extern void ext2fs_numeric_progress_update(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
__u64 val);
|
||||
extern void ext2fs_numeric_progress_close(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
const char *message);
|
||||
|
||||
/*
|
||||
* 64-bit bitmap support
|
||||
*/
|
||||
|
||||
extern errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
|
||||
int type, __u64 start, __u64 end,
|
||||
__u64 real_end,
|
||||
const char * description,
|
||||
ext2fs_generic_bitmap *bmap);
|
||||
|
||||
extern void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap);
|
||||
|
||||
extern errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
|
||||
ext2fs_generic_bitmap *dest);
|
||||
|
||||
extern errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
|
||||
__u64 new_end,
|
||||
__u64 new_real_end);
|
||||
extern errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
|
||||
errcode_t neq,
|
||||
__u64 end, __u64 *oend);
|
||||
extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
__u64 arg);
|
||||
extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
__u64 arg);
|
||||
extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
|
||||
__u64 arg);
|
||||
extern errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bitmap,
|
||||
__u64 start, unsigned int num,
|
||||
void *in);
|
||||
extern errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bitmap,
|
||||
__u64 start, unsigned int num,
|
||||
void *out);
|
||||
extern void ext2fs_warn_bitmap32(ext2fs_generic_bitmap bitmap,const char *func);
|
||||
|
||||
extern int ext2fs_mem_is_zero(const char *mem, size_t len);
|
||||
|
||||
extern int ext2fs_file_block_offset_too_big(ext2_filsys fs,
|
||||
struct ext2_inode *inode,
|
||||
blk64_t offset);
|
||||
|
||||
/* atexit support */
|
||||
typedef void (*ext2_exit_fn)(void *);
|
||||
errcode_t ext2fs_add_exit_fn(ext2_exit_fn fn, void *data);
|
||||
errcode_t ext2fs_remove_exit_fn(ext2_exit_fn fn, void *data);
|
||||
|
||||
#define EXT2FS_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2*!!(cond)]))
|
||||
127
include/e2fsprogs/ext2fs/ext3_extents.h
Executable file
127
include/e2fsprogs/ext2fs/ext3_extents.h
Executable file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2003,2004 Cluster File Systems, Inc, info@clusterfs.com
|
||||
* Written by Alex Tomas <alex@clusterfs.com>
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_EXT3_EXTENTS
|
||||
#define _LINUX_EXT3_EXTENTS
|
||||
|
||||
/*
|
||||
* ext3_inode has i_block array (total 60 bytes)
|
||||
* first 4 bytes are used to store:
|
||||
* - tree depth (0 mean there is no tree yet. all extents in the inode)
|
||||
* - number of alive extents in the inode
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is extent tail on-disk structure.
|
||||
* All other extent structures are 12 bytes long. It turns out that
|
||||
* block_size % 12 >= 4 for at least all powers of 2 greater than 512, which
|
||||
* covers all valid ext4 block sizes. Therefore, this tail structure can be
|
||||
* crammed into the end of the block without having to rebalance the tree.
|
||||
*/
|
||||
struct ext3_extent_tail {
|
||||
__le32 et_checksum; /* crc32c(uuid+inum+extent_block) */
|
||||
};
|
||||
|
||||
/*
|
||||
* this is extent on-disk structure
|
||||
* it's used at the bottom of the tree
|
||||
*/
|
||||
struct ext3_extent {
|
||||
__le32 ee_block; /* first logical block extent covers */
|
||||
__le16 ee_len; /* number of blocks covered by extent */
|
||||
__le16 ee_start_hi; /* high 16 bits of physical block */
|
||||
__le32 ee_start; /* low 32 bigs of physical block */
|
||||
};
|
||||
|
||||
/*
|
||||
* this is index on-disk structure
|
||||
* it's used at all the levels, but the bottom
|
||||
*/
|
||||
struct ext3_extent_idx {
|
||||
__le32 ei_block; /* index covers logical blocks from 'block' */
|
||||
__le32 ei_leaf; /* pointer to the physical block of the next *
|
||||
* level. leaf or next index could bet here */
|
||||
__le16 ei_leaf_hi; /* high 16 bits of physical block */
|
||||
__le16 ei_unused;
|
||||
};
|
||||
|
||||
/*
|
||||
* each block (leaves and indexes), even inode-stored has header
|
||||
*/
|
||||
struct ext3_extent_header {
|
||||
__le16 eh_magic; /* probably will support different formats */
|
||||
__le16 eh_entries; /* number of valid entries */
|
||||
__le16 eh_max; /* capacity of store in entries */
|
||||
__le16 eh_depth; /* has tree real underlying blocks? */
|
||||
__le32 eh_generation; /* generation of the tree */
|
||||
};
|
||||
|
||||
#define EXT3_EXT_MAGIC 0xf30a
|
||||
|
||||
/*
|
||||
* array of ext3_ext_path contains path to some extent
|
||||
* creation/lookup routines use it for traversal/splitting/etc
|
||||
* truncate uses it to simulate recursive walking
|
||||
*/
|
||||
struct ext3_ext_path {
|
||||
__u32 p_block;
|
||||
__u16 p_depth;
|
||||
struct ext3_extent *p_ext;
|
||||
struct ext3_extent_idx *p_idx;
|
||||
struct ext3_extent_header *p_hdr;
|
||||
struct buffer_head *p_bh;
|
||||
};
|
||||
|
||||
/*
|
||||
* EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
|
||||
* initialized extent. This is 2^15 and not (2^16 - 1), since we use the
|
||||
* MSB of ee_len field in the extent datastructure to signify if this
|
||||
* particular extent is an initialized extent or an uninitialized (i.e.
|
||||
* preallocated).
|
||||
* EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
|
||||
* uninitialized extent.
|
||||
* If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
|
||||
* uninitialized one. In other words, if MSB of ee_len is set, it is an
|
||||
* uninitialized extent with only one special scenario when ee_len = 0x8000.
|
||||
* In this case we can not have an uninitialized extent of zero length and
|
||||
* thus we make it as a special case of initialized extent with 0x8000 length.
|
||||
* This way we get better extent-to-group alignment for initialized extents.
|
||||
* Hence, the maximum number of blocks we can have in an *initialized*
|
||||
* extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
|
||||
*/
|
||||
#define EXT_INIT_MAX_LEN (1UL << 15)
|
||||
#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
|
||||
#define EXT_MAX_EXTENT_LBLK (((__u64) 1 << 32) - 1)
|
||||
#define EXT_MAX_EXTENT_PBLK (((__u64) 1 << 48) - 1)
|
||||
|
||||
#define EXT_FIRST_EXTENT(__hdr__) \
|
||||
((struct ext3_extent *) (((char *) (__hdr__)) + \
|
||||
sizeof(struct ext3_extent_header)))
|
||||
#define EXT_FIRST_INDEX(__hdr__) \
|
||||
((struct ext3_extent_idx *) (((char *) (__hdr__)) + \
|
||||
sizeof(struct ext3_extent_header)))
|
||||
#define EXT_HAS_FREE_INDEX(__path__) \
|
||||
(ext2fs_le16_to_cpu((__path__)->p_hdr->eh_entries) < \
|
||||
ext2fs_le16_to_cpu((__path__)->p_hdr->eh_max))
|
||||
#define EXT_LAST_EXTENT(__hdr__) \
|
||||
(EXT_FIRST_EXTENT((__hdr__)) + \
|
||||
ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1)
|
||||
#define EXT_LAST_INDEX(__hdr__) \
|
||||
(EXT_FIRST_INDEX((__hdr__)) + \
|
||||
ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1)
|
||||
#define EXT_MAX_EXTENT(__hdr__) \
|
||||
(EXT_FIRST_EXTENT((__hdr__)) + \
|
||||
ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)
|
||||
#define EXT_MAX_INDEX(__hdr__) \
|
||||
(EXT_FIRST_INDEX((__hdr__)) + \
|
||||
ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)
|
||||
|
||||
#endif /* _LINUX_EXT3_EXTENTS */
|
||||
|
||||
62
include/e2fsprogs/ext2fs/ext4_acl.h
Executable file
62
include/e2fsprogs/ext2fs/ext4_acl.h
Executable file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Ext4's on-disk acl format. From linux/fs/ext4/acl.h
|
||||
*/
|
||||
|
||||
#define EXT4_ACL_VERSION 0x0001
|
||||
|
||||
/* 23.2.5 acl_tag_t values */
|
||||
|
||||
#define ACL_UNDEFINED_TAG (0x00)
|
||||
#define ACL_USER_OBJ (0x01)
|
||||
#define ACL_USER (0x02)
|
||||
#define ACL_GROUP_OBJ (0x04)
|
||||
#define ACL_GROUP (0x08)
|
||||
#define ACL_MASK (0x10)
|
||||
#define ACL_OTHER (0x20)
|
||||
|
||||
/* 23.3.6 acl_type_t values */
|
||||
|
||||
#define ACL_TYPE_ACCESS (0x8000)
|
||||
#define ACL_TYPE_DEFAULT (0x4000)
|
||||
|
||||
/* 23.2.7 ACL qualifier constants */
|
||||
|
||||
#define ACL_UNDEFINED_ID ((id_t)-1)
|
||||
|
||||
typedef struct {
|
||||
__le16 e_tag;
|
||||
__le16 e_perm;
|
||||
__le32 e_id;
|
||||
} ext4_acl_entry;
|
||||
|
||||
typedef struct {
|
||||
__le16 e_tag;
|
||||
__le16 e_perm;
|
||||
} ext4_acl_entry_short;
|
||||
|
||||
typedef struct {
|
||||
__le32 a_version;
|
||||
} ext4_acl_header;
|
||||
|
||||
|
||||
/* Supported ACL a_version fields */
|
||||
#define POSIX_ACL_XATTR_VERSION 0x0002
|
||||
|
||||
typedef struct {
|
||||
__le16 e_tag;
|
||||
__le16 e_perm;
|
||||
__le32 e_id;
|
||||
} posix_acl_xattr_entry;
|
||||
|
||||
typedef struct {
|
||||
__le32 a_version;
|
||||
#if __GNUC_PREREQ (4, 8)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
posix_acl_xattr_entry a_entries[0];
|
||||
#if __GNUC_PREREQ (4, 8)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
} posix_acl_xattr_header;
|
||||
|
||||
190
include/e2fsprogs/ext2fs/fast_commit.h
Executable file
190
include/e2fsprogs/ext2fs/fast_commit.h
Executable file
@@ -0,0 +1,190 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __FAST_COMMIT_H__
|
||||
#define __FAST_COMMIT_H__
|
||||
|
||||
#include "jfs_compat.h"
|
||||
|
||||
/*
|
||||
* Note this file is present in e2fsprogs/lib/ext2fs/fast_commit.h and
|
||||
* linux/fs/ext4/fast_commit.h. These file should always be byte identical.
|
||||
*/
|
||||
|
||||
/* Fast commit tags */
|
||||
#define EXT4_FC_TAG_ADD_RANGE 0x0001
|
||||
#define EXT4_FC_TAG_DEL_RANGE 0x0002
|
||||
#define EXT4_FC_TAG_CREAT 0x0003
|
||||
#define EXT4_FC_TAG_LINK 0x0004
|
||||
#define EXT4_FC_TAG_UNLINK 0x0005
|
||||
#define EXT4_FC_TAG_INODE 0x0006
|
||||
#define EXT4_FC_TAG_PAD 0x0007
|
||||
#define EXT4_FC_TAG_TAIL 0x0008
|
||||
#define EXT4_FC_TAG_HEAD 0x0009
|
||||
|
||||
#define EXT4_FC_SUPPORTED_FEATURES 0x0
|
||||
|
||||
/* On disk fast commit tlv value structures */
|
||||
|
||||
/* Fast commit on disk tag length structure */
|
||||
struct ext4_fc_tl {
|
||||
__le16 fc_tag;
|
||||
__le16 fc_len;
|
||||
};
|
||||
|
||||
/* Value structure for tag EXT4_FC_TAG_HEAD. */
|
||||
struct ext4_fc_head {
|
||||
__le32 fc_features;
|
||||
__le32 fc_tid;
|
||||
};
|
||||
|
||||
/* Value structure for EXT4_FC_TAG_ADD_RANGE. */
|
||||
struct ext4_fc_add_range {
|
||||
__le32 fc_ino;
|
||||
__u8 fc_ex[12];
|
||||
};
|
||||
|
||||
/* Value structure for tag EXT4_FC_TAG_DEL_RANGE. */
|
||||
struct ext4_fc_del_range {
|
||||
__le32 fc_ino;
|
||||
__le32 fc_lblk;
|
||||
__le32 fc_len;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the value structure for tags EXT4_FC_TAG_CREAT, EXT4_FC_TAG_LINK
|
||||
* and EXT4_FC_TAG_UNLINK.
|
||||
*/
|
||||
struct ext4_fc_dentry_info {
|
||||
__le32 fc_parent_ino;
|
||||
__le32 fc_ino;
|
||||
__u8 fc_dname[0];
|
||||
};
|
||||
|
||||
/* Value structure for EXT4_FC_TAG_INODE and EXT4_FC_TAG_INODE_PARTIAL. */
|
||||
struct ext4_fc_inode {
|
||||
__le32 fc_ino;
|
||||
__u8 fc_raw_inode[0];
|
||||
};
|
||||
|
||||
/* Value structure for tag EXT4_FC_TAG_TAIL. */
|
||||
struct ext4_fc_tail {
|
||||
__le32 fc_tid;
|
||||
__le32 fc_crc;
|
||||
};
|
||||
|
||||
/*
|
||||
* Fast commit reason codes
|
||||
*/
|
||||
enum {
|
||||
/*
|
||||
* Commit status codes:
|
||||
*/
|
||||
EXT4_FC_REASON_OK = 0,
|
||||
EXT4_FC_REASON_INELIGIBLE,
|
||||
EXT4_FC_REASON_ALREADY_COMMITTED,
|
||||
EXT4_FC_REASON_FC_START_FAILED,
|
||||
EXT4_FC_REASON_FC_FAILED,
|
||||
|
||||
/*
|
||||
* Fast commit ineligiblity reasons:
|
||||
*/
|
||||
EXT4_FC_REASON_XATTR = 0,
|
||||
EXT4_FC_REASON_CROSS_RENAME,
|
||||
EXT4_FC_REASON_JOURNAL_FLAG_CHANGE,
|
||||
EXT4_FC_REASON_NOMEM,
|
||||
EXT4_FC_REASON_SWAP_BOOT,
|
||||
EXT4_FC_REASON_RESIZE,
|
||||
EXT4_FC_REASON_RENAME_DIR,
|
||||
EXT4_FC_REASON_FALLOC_RANGE,
|
||||
EXT4_FC_REASON_INODE_JOURNAL_DATA,
|
||||
EXT4_FC_COMMIT_FAILED,
|
||||
EXT4_FC_REASON_MAX
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* In memory list of dentry updates that are performed on the file
|
||||
* system used by fast commit code.
|
||||
*/
|
||||
struct ext4_fc_dentry_update {
|
||||
int fcd_op; /* Type of update create / unlink / link */
|
||||
int fcd_parent; /* Parent inode number */
|
||||
int fcd_ino; /* Inode number */
|
||||
struct qstr fcd_name; /* Dirent name */
|
||||
unsigned char fcd_iname[DNAME_INLINE_LEN]; /* Dirent name string */
|
||||
struct list_head fcd_list;
|
||||
};
|
||||
|
||||
struct ext4_fc_stats {
|
||||
unsigned int fc_ineligible_reason_count[EXT4_FC_REASON_MAX];
|
||||
unsigned long fc_num_commits;
|
||||
unsigned long fc_ineligible_commits;
|
||||
unsigned long fc_numblks;
|
||||
};
|
||||
|
||||
#define EXT4_FC_REPLAY_REALLOC_INCREMENT 4
|
||||
|
||||
/*
|
||||
* Physical block regions added to different inodes due to fast commit
|
||||
* recovery. These are set during the SCAN phase. During the replay phase,
|
||||
* our allocator excludes these from its allocation. This ensures that
|
||||
* we don't accidentally allocating a block that is going to be used by
|
||||
* another inode.
|
||||
*/
|
||||
struct ext4_fc_alloc_region {
|
||||
ext4_lblk_t lblk;
|
||||
ext4_fsblk_t pblk;
|
||||
int ino, len;
|
||||
};
|
||||
|
||||
/*
|
||||
* Fast commit replay state.
|
||||
*/
|
||||
struct ext4_fc_replay_state {
|
||||
int fc_replay_num_tags;
|
||||
int fc_replay_expected_off;
|
||||
int fc_current_pass;
|
||||
int fc_cur_tag;
|
||||
int fc_crc;
|
||||
struct ext4_fc_alloc_region *fc_regions;
|
||||
int fc_regions_size, fc_regions_used, fc_regions_valid;
|
||||
int *fc_modified_inodes;
|
||||
int fc_modified_inodes_used, fc_modified_inodes_size;
|
||||
};
|
||||
|
||||
#define region_last(__region) (((__region)->lblk) + ((__region)->len) - 1)
|
||||
#endif
|
||||
|
||||
static inline const char *tag2str(__u16 tag)
|
||||
{
|
||||
switch (tag) {
|
||||
case EXT4_FC_TAG_LINK:
|
||||
return "ADD_ENTRY";
|
||||
case EXT4_FC_TAG_UNLINK:
|
||||
return "DEL_ENTRY";
|
||||
case EXT4_FC_TAG_ADD_RANGE:
|
||||
return "ADD_RANGE";
|
||||
case EXT4_FC_TAG_CREAT:
|
||||
return "CREAT_DENTRY";
|
||||
case EXT4_FC_TAG_DEL_RANGE:
|
||||
return "DEL_RANGE";
|
||||
case EXT4_FC_TAG_INODE:
|
||||
return "INODE";
|
||||
case EXT4_FC_TAG_PAD:
|
||||
return "PAD";
|
||||
case EXT4_FC_TAG_TAIL:
|
||||
return "TAIL";
|
||||
case EXT4_FC_TAG_HEAD:
|
||||
return "HEAD";
|
||||
default:
|
||||
return "ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
/* Get length of a particular tlv */
|
||||
static inline int ext4_fc_tag_len(struct ext4_fc_tl *tl)
|
||||
{
|
||||
return le16_to_cpu(tl->fc_len);
|
||||
}
|
||||
|
||||
#endif /* __FAST_COMMIT_H__ */
|
||||
93
include/e2fsprogs/ext2fs/fiemap.h
Executable file
93
include/e2fsprogs/ext2fs/fiemap.h
Executable file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* FS_IOC_FIEMAP ioctl infrastructure.
|
||||
*
|
||||
* Some portions copyright (C) 2007 Cluster File Systems, Inc
|
||||
*
|
||||
* Authors: Mark Fasheh <mfasheh@suse.com>
|
||||
* Kalpak Shah <kalpak.shah@sun.com>
|
||||
* Andreas Dilger <adilger@sun.com>
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_FIEMAP_H
|
||||
#define _LINUX_FIEMAP_H
|
||||
|
||||
struct fiemap_extent {
|
||||
__u64 fe_logical; /* logical offset in bytes for the start of
|
||||
* the extent from the beginning of the file */
|
||||
__u64 fe_physical; /* physical offset in bytes for the start
|
||||
* of the extent from the beginning of the disk */
|
||||
__u64 fe_length; /* length in bytes for this extent */
|
||||
__u64 fe_reserved64[2];
|
||||
__u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
|
||||
__u32 fe_reserved[3];
|
||||
};
|
||||
|
||||
struct fiemap {
|
||||
__u64 fm_start; /* logical offset (inclusive) at
|
||||
* which to start mapping (in) */
|
||||
__u64 fm_length; /* logical length of mapping which
|
||||
* userspace wants (in) */
|
||||
__u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */
|
||||
__u32 fm_mapped_extents;/* number of extents that were mapped (out) */
|
||||
__u32 fm_extent_count; /* size of fm_extents array (in) */
|
||||
__u32 fm_reserved;
|
||||
#if __GNUC_PREREQ (4, 8)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
|
||||
#if __GNUC_PREREQ (4, 8)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(__linux__) && !defined(FS_IOC_FIEMAP)
|
||||
#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(FS_IOC_GETSTATE)
|
||||
#define EXT4_IOC_GETSTATE _IOW('f', 41, __u32)
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(EXT4_IOC_GET_ES_CACHE)
|
||||
#define EXT4_IOC_GET_ES_CACHE _IOWR('f', 42, struct fiemap)
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(EXT4_STATE_FLAG_EXT_PRECACHED)
|
||||
#define EXT4_STATE_FLAG_EXT_PRECACHED 0x00000001
|
||||
#endif
|
||||
|
||||
#define FIEMAP_MAX_OFFSET (~0ULL)
|
||||
|
||||
#define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */
|
||||
#define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */
|
||||
#define FIEMAP_FLAG_CACHE 0x00000004 /* request caching of the extents */
|
||||
|
||||
#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
|
||||
|
||||
#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
|
||||
#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
|
||||
#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
|
||||
* Sets EXTENT_UNKNOWN. */
|
||||
#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
|
||||
* while fs is unmounted */
|
||||
#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
|
||||
* Sets EXTENT_NO_BYPASS. */
|
||||
#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
|
||||
* block aligned. */
|
||||
#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
|
||||
* Sets EXTENT_NOT_ALIGNED.*/
|
||||
#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
|
||||
* Sets EXTENT_NOT_ALIGNED.*/
|
||||
#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
|
||||
* no data (i.e. zero). */
|
||||
#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
|
||||
* support extents. Result
|
||||
* merged for efficiency. */
|
||||
#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other
|
||||
* files. */
|
||||
|
||||
#define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 /* Entry in extent status
|
||||
cache for a hole*/
|
||||
|
||||
#endif /* _LINUX_FIEMAP_H */
|
||||
42
include/e2fsprogs/ext2fs/hashmap.h
Executable file
42
include/e2fsprogs/ext2fs/hashmap.h
Executable file
@@ -0,0 +1,42 @@
|
||||
#ifndef HASHMAP_H
|
||||
# define HASHMAP_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <stdint.h>
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
#define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#else
|
||||
#define __GNUC_PREREQ(maj, min) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct ext2fs_hashmap;
|
||||
|
||||
struct ext2fs_hashmap_entry {
|
||||
void *data;
|
||||
const void *key;
|
||||
size_t key_len;
|
||||
struct ext2fs_hashmap_entry *next;
|
||||
struct ext2fs_hashmap_entry *list_next;
|
||||
struct ext2fs_hashmap_entry *list_prev;
|
||||
};
|
||||
|
||||
struct ext2fs_hashmap *ext2fs_hashmap_create(
|
||||
uint32_t(*hash_fct)(const void*, size_t),
|
||||
void(*free_fct)(void*), size_t size);
|
||||
int ext2fs_hashmap_add(struct ext2fs_hashmap *h,
|
||||
void *data, const void *key,size_t key_len);
|
||||
void *ext2fs_hashmap_lookup(struct ext2fs_hashmap *h, const void *key,
|
||||
size_t key_len);
|
||||
void *ext2fs_hashmap_iter_in_order(struct ext2fs_hashmap *h,
|
||||
struct ext2fs_hashmap_entry **it);
|
||||
void ext2fs_hashmap_del(struct ext2fs_hashmap *h,
|
||||
struct ext2fs_hashmap_entry *e);
|
||||
void ext2fs_hashmap_free(struct ext2fs_hashmap *h);
|
||||
|
||||
uint32_t ext2fs_djb2_hash(const void *str, size_t size);
|
||||
|
||||
#endif /* !HASHMAP_H */
|
||||
114
include/e2fsprogs/ext2fs/irel.h
Executable file
114
include/e2fsprogs/ext2fs/irel.h
Executable file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* irel.h
|
||||
*
|
||||
* Copyright (C) 1996, 1997 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
struct ext2_inode_reference {
|
||||
blk64_t block;
|
||||
__u16 offset;
|
||||
};
|
||||
|
||||
struct ext2_inode_relocate_entry {
|
||||
ext2_ino_t new;
|
||||
ext2_ino_t orig;
|
||||
__u16 flags;
|
||||
__u16 max_refs;
|
||||
};
|
||||
|
||||
typedef struct ext2_inode_relocation_table *ext2_irel;
|
||||
|
||||
struct ext2_inode_relocation_table {
|
||||
__u32 magic;
|
||||
char *name;
|
||||
ext2_ino_t current;
|
||||
void *priv_data;
|
||||
|
||||
/*
|
||||
* Add an inode relocation entry.
|
||||
*/
|
||||
errcode_t (*put)(ext2_irel irel, ext2_ino_t old,
|
||||
struct ext2_inode_relocate_entry *ent);
|
||||
/*
|
||||
* Get an inode relocation entry.
|
||||
*/
|
||||
errcode_t (*get)(ext2_irel irel, ext2_ino_t old,
|
||||
struct ext2_inode_relocate_entry *ent);
|
||||
|
||||
/*
|
||||
* Get an inode relocation entry by its original inode number
|
||||
*/
|
||||
errcode_t (*get_by_orig)(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
|
||||
struct ext2_inode_relocate_entry *ent);
|
||||
|
||||
/*
|
||||
* Initialize for iterating over the inode relocation entries.
|
||||
*/
|
||||
errcode_t (*start_iter)(ext2_irel irel);
|
||||
|
||||
/*
|
||||
* The iterator function for the inode relocation entries.
|
||||
* Returns an inode number of 0 when out of entries.
|
||||
*/
|
||||
errcode_t (*next)(ext2_irel irel, ext2_ino_t *old,
|
||||
struct ext2_inode_relocate_entry *ent);
|
||||
|
||||
/*
|
||||
* Add an inode reference (i.e., note the fact that a
|
||||
* particular block/offset contains a reference to an inode)
|
||||
*/
|
||||
errcode_t (*add_ref)(ext2_irel irel, ext2_ino_t ino,
|
||||
struct ext2_inode_reference *ref);
|
||||
|
||||
/*
|
||||
* Initialize for iterating over the inode references for a
|
||||
* particular inode.
|
||||
*/
|
||||
errcode_t (*start_iter_ref)(ext2_irel irel, ext2_ino_t ino);
|
||||
|
||||
/*
|
||||
* The iterator function for the inode references for an
|
||||
* inode. The references for only one inode can be iterator
|
||||
* over at a time, as the iterator state is stored in ext2_irel.
|
||||
*/
|
||||
errcode_t (*next_ref)(ext2_irel irel,
|
||||
struct ext2_inode_reference *ref);
|
||||
|
||||
/*
|
||||
* Move the inode relocation table from one inode number to
|
||||
* another. Note that the inode references also must move.
|
||||
*/
|
||||
errcode_t (*move)(ext2_irel irel, ext2_ino_t old, ext2_ino_t new);
|
||||
|
||||
/*
|
||||
* Remove an inode relocation entry, along with all of the
|
||||
* inode references.
|
||||
*/
|
||||
errcode_t (*delete)(ext2_irel irel, ext2_ino_t old);
|
||||
|
||||
/*
|
||||
* Free the inode relocation table.
|
||||
*/
|
||||
errcode_t (*free)(ext2_irel irel);
|
||||
};
|
||||
|
||||
errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode,
|
||||
ext2_irel *irel);
|
||||
|
||||
#define ext2fs_irel_put(irel, old, ent) ((irel)->put((irel), old, ent))
|
||||
#define ext2fs_irel_get(irel, old, ent) ((irel)->get((irel), old, ent))
|
||||
#define ext2fs_irel_get_by_orig(irel, orig, old, ent) \
|
||||
((irel)->get_by_orig((irel), orig, old, ent))
|
||||
#define ext2fs_irel_start_iter(irel) ((irel)->start_iter((irel)))
|
||||
#define ext2fs_irel_next(irel, old, ent) ((irel)->next((irel), old, ent))
|
||||
#define ext2fs_irel_add_ref(irel, ino, ref) ((irel)->add_ref((irel), ino, ref))
|
||||
#define ext2fs_irel_start_iter_ref(irel, ino) ((irel)->start_iter_ref((irel), ino))
|
||||
#define ext2fs_irel_next_ref(irel, ref) ((irel)->next_ref((irel), ref))
|
||||
#define ext2fs_irel_move(irel, old, new) ((irel)->move((irel), old, new))
|
||||
#define ext2fs_irel_delete(irel, old) ((irel)->delete((irel), old))
|
||||
#define ext2fs_irel_free(irel) ((irel)->free((irel)))
|
||||
113
include/e2fsprogs/ext2fs/jfs_compat.h
Executable file
113
include/e2fsprogs/ext2fs/jfs_compat.h
Executable file
@@ -0,0 +1,113 @@
|
||||
|
||||
#ifndef _JFS_COMPAT_H
|
||||
#define _JFS_COMPAT_H
|
||||
|
||||
#include "kernel-list.h"
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <arpa/inet.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define printk printf
|
||||
#define KERN_ERR ""
|
||||
#define KERN_DEBUG ""
|
||||
|
||||
#define REQ_OP_READ 0
|
||||
#define REQ_OP_WRITE 1
|
||||
|
||||
#define cpu_to_le16(x) ext2fs_cpu_to_le16(x)
|
||||
#define cpu_to_be16(x) ext2fs_cpu_to_be16(x)
|
||||
#define cpu_to_le32(x) ext2fs_cpu_to_le32(x)
|
||||
#define cpu_to_be32(x) ext2fs_cpu_to_be32(x)
|
||||
#define cpu_to_le64(x) ext2fs_cpu_to_le64(x)
|
||||
#define cpu_to_be64(x) ext2fs_cpu_to_be64(x)
|
||||
|
||||
#define le16_to_cpu(x) ext2fs_le16_to_cpu(x)
|
||||
#define be16_to_cpu(x) ext2fs_be16_to_cpu(x)
|
||||
#define le32_to_cpu(x) ext2fs_le32_to_cpu(x)
|
||||
#define be32_to_cpu(x) ext2fs_be32_to_cpu(x)
|
||||
#define le64_to_cpu(x) ext2fs_le64_to_cpu(x)
|
||||
#define be64_to_cpu(x) ext2fs_be64_to_cpu(x)
|
||||
|
||||
typedef unsigned int tid_t;
|
||||
typedef struct journal_s journal_t;
|
||||
typedef struct kdev_s *kdev_t;
|
||||
|
||||
struct buffer_head;
|
||||
struct inode;
|
||||
|
||||
typedef unsigned int gfp_t;
|
||||
#define GFP_KERNEL 0
|
||||
#define GFP_NOFS 0
|
||||
#define __GFP_NOFAIL 0
|
||||
#define JBD2_TAG_SIZE32 JBD_TAG_SIZE32
|
||||
#define JBD2_BARRIER 0
|
||||
typedef __u64 u64;
|
||||
#define put_bh(x) brelse(x)
|
||||
|
||||
#define crc32_be(x, y, z) ext2fs_crc32_be((x), (y), (z))
|
||||
#define spin_lock_init(x)
|
||||
#define spin_lock(x)
|
||||
#define spin_unlock(x)
|
||||
#define SLAB_HWCACHE_ALIGN 0
|
||||
#define SLAB_TEMPORARY 0
|
||||
#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
|
||||
sizeof(struct __struct), __alignof__(struct __struct),\
|
||||
(__flags), NULL)
|
||||
|
||||
#define blkdev_issue_flush(kdev) sync_blockdev(kdev)
|
||||
#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
|
||||
#define pr_emerg(fmt)
|
||||
#define pr_err(...)
|
||||
|
||||
enum passtype {PASS_SCAN, PASS_REVOKE, PASS_REPLAY};
|
||||
|
||||
#define JBD2_FC_REPLAY_STOP 0
|
||||
#define JBD2_FC_REPLAY_CONTINUE 1
|
||||
|
||||
struct journal_s
|
||||
{
|
||||
unsigned long j_flags;
|
||||
int j_errno;
|
||||
struct buffer_head * j_sb_buffer;
|
||||
struct journal_superblock_s *j_superblock;
|
||||
int j_format_version;
|
||||
unsigned long j_head;
|
||||
unsigned long j_tail;
|
||||
unsigned long j_fc_first;
|
||||
unsigned long j_fc_off;
|
||||
unsigned long j_fc_last;
|
||||
unsigned long j_free;
|
||||
unsigned long j_first, j_last;
|
||||
kdev_t j_dev;
|
||||
kdev_t j_fs_dev;
|
||||
int j_blocksize;
|
||||
unsigned int j_blk_offset;
|
||||
unsigned int j_total_len;
|
||||
struct inode * j_inode;
|
||||
tid_t j_tail_sequence;
|
||||
tid_t j_transaction_sequence;
|
||||
__u8 j_uuid[16];
|
||||
struct jbd2_revoke_table_s *j_revoke;
|
||||
struct jbd2_revoke_table_s *j_revoke_table[2];
|
||||
tid_t j_failed_commit;
|
||||
__u32 j_csum_seed;
|
||||
int (*j_fc_replay_callback)(struct journal_s *journal,
|
||||
struct buffer_head *bh,
|
||||
enum passtype pass, int off,
|
||||
tid_t expected_tid);
|
||||
|
||||
};
|
||||
|
||||
#define is_journal_abort(x) 0
|
||||
|
||||
#define BUFFER_TRACE(bh, info) do {} while (0)
|
||||
|
||||
/* Need this so we can compile with configure --enable-gcc-wall */
|
||||
#ifdef NO_INLINE_FUNCS
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
#endif /* _JFS_COMPAT_H */
|
||||
456
include/e2fsprogs/ext2fs/kernel-jbd.h
Executable file
456
include/e2fsprogs/ext2fs/kernel-jbd.h
Executable file
@@ -0,0 +1,456 @@
|
||||
/*
|
||||
* linux/include/linux/jbd.h
|
||||
*
|
||||
* Written by Stephen C. Tweedie <sct@redhat.com>
|
||||
*
|
||||
* Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
|
||||
*
|
||||
* This file is part of the Linux kernel and is made available under
|
||||
* the terms of the GNU General Public License, version 2, or at your
|
||||
* option, any later version, incorporated herein by reference.
|
||||
*
|
||||
* Definitions for transaction data structures for the buffer cache
|
||||
* filesystem journaling support.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_JBD_H
|
||||
#define _LINUX_JBD_H
|
||||
|
||||
#include "jfs_compat.h"
|
||||
#define JFS_DEBUG
|
||||
#define jfs_debug jbd_debug
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __FUNCTION__ ""
|
||||
#endif
|
||||
|
||||
#define journal_oom_retry 0
|
||||
|
||||
#ifdef CONFIG_JBD_DEBUG
|
||||
/*
|
||||
* Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
|
||||
* consistency checks. By default we don't do this unless
|
||||
* CONFIG_JBD_DEBUG is on.
|
||||
*/
|
||||
#define JBD_EXPENSIVE_CHECKING
|
||||
extern int journal_enable_debug;
|
||||
#else
|
||||
#define journal_enable_debug (-1)
|
||||
#endif /* !CONFIG_JBD_DEBUG */
|
||||
|
||||
#ifdef __STDC__
|
||||
#define jbd_debug(n, f, a...) \
|
||||
do { \
|
||||
if ((n) <= journal_enable_debug) { \
|
||||
printk (KERN_DEBUG "(%s, %d): %s: ", \
|
||||
__FILE__, __LINE__, __FUNCTION__); \
|
||||
printk (f, ## a); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define jbd_debug(x) /* AIX doesn't do STDC */
|
||||
#endif /* !__STDC__ */
|
||||
|
||||
extern void * __jbd_kmalloc (char *where, size_t size, int flags, int retry);
|
||||
#define jbd_kmalloc(size, flags) \
|
||||
__jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
|
||||
#define jbd_rep_kmalloc(size, flags) \
|
||||
__jbd_kmalloc(__FUNCTION__, (size), (flags), 1)
|
||||
|
||||
#define JBD2_MIN_JOURNAL_BLOCKS 1024
|
||||
#define JBD2_DEFAULT_FAST_COMMIT_BLOCKS 256
|
||||
|
||||
/*
|
||||
* Internal structures used by the logging mechanism:
|
||||
*/
|
||||
|
||||
#define JBD2_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
|
||||
|
||||
/*
|
||||
* On-disk structures
|
||||
*/
|
||||
|
||||
/*
|
||||
* Descriptor block types:
|
||||
*/
|
||||
|
||||
#define JBD2_DESCRIPTOR_BLOCK 1
|
||||
#define JBD2_COMMIT_BLOCK 2
|
||||
#define JBD2_SUPERBLOCK_V1 3
|
||||
#define JBD2_SUPERBLOCK_V2 4
|
||||
#define JBD2_REVOKE_BLOCK 5
|
||||
#define JBD2_FC_BLOCK 6
|
||||
|
||||
/*
|
||||
* Standard header for all descriptor blocks:
|
||||
*/
|
||||
typedef struct journal_header_s
|
||||
{
|
||||
__be32 h_magic;
|
||||
__be32 h_blocktype;
|
||||
__be32 h_sequence;
|
||||
} journal_header_t;
|
||||
|
||||
/*
|
||||
* Checksum types.
|
||||
*/
|
||||
#define JBD2_CRC32_CHKSUM 1
|
||||
#define JBD2_MD5_CHKSUM 2
|
||||
#define JBD2_SHA1_CHKSUM 3
|
||||
#define JBD2_CRC32C_CHKSUM 4
|
||||
|
||||
#define JBD2_CRC32_CHKSUM_SIZE 4
|
||||
|
||||
#define JBD2_CHECKSUM_BYTES (32 / sizeof(__u32))
|
||||
/*
|
||||
* Commit block header for storing transactional checksums:
|
||||
*
|
||||
* NOTE: If FEATURE_COMPAT_CHECKSUM (checksum v1) is set, the h_chksum*
|
||||
* fields are used to store a checksum of the descriptor and data blocks.
|
||||
*
|
||||
* If FEATURE_INCOMPAT_CSUM_V2 (checksum v2) is set, then the h_chksum
|
||||
* field is used to store crc32c(uuid+commit_block). Each journal metadata
|
||||
* block gets its own checksum, and data block checksums are stored in
|
||||
* journal_block_tag (in the descriptor). The other h_chksum* fields are
|
||||
* not used.
|
||||
*
|
||||
* If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses
|
||||
* journal_block_tag3_t to store a full 32-bit checksum. Everything else
|
||||
* is the same as v2.
|
||||
*
|
||||
* Checksum v1, v2, and v3 are mutually exclusive features.
|
||||
*/
|
||||
struct commit_header {
|
||||
__be32 h_magic;
|
||||
__be32 h_blocktype;
|
||||
__be32 h_sequence;
|
||||
unsigned char h_chksum_type;
|
||||
unsigned char h_chksum_size;
|
||||
unsigned char h_padding[2];
|
||||
__be32 h_chksum[JBD2_CHECKSUM_BYTES];
|
||||
__be64 h_commit_sec;
|
||||
__be32 h_commit_nsec;
|
||||
};
|
||||
|
||||
/*
|
||||
* The block tag: used to describe a single buffer in the journal
|
||||
*/
|
||||
typedef struct journal_block_tag3_s
|
||||
{
|
||||
__be32 t_blocknr; /* The on-disk block number */
|
||||
__be32 t_flags; /* See below */
|
||||
__be32 t_blocknr_high; /* most-significant high 32bits. */
|
||||
__be32 t_checksum; /* crc32c(uuid+seq+block) */
|
||||
} journal_block_tag3_t;
|
||||
|
||||
typedef struct journal_block_tag_s
|
||||
{
|
||||
__be32 t_blocknr; /* The on-disk block number */
|
||||
__be16 t_checksum; /* truncated crc32c(uuid+seq+block) */
|
||||
__be16 t_flags; /* See below */
|
||||
__be32 t_blocknr_high; /* most-significant high 32bits. */
|
||||
} journal_block_tag_t;
|
||||
|
||||
/* Tail of descriptor or revoke block, for checksumming */
|
||||
struct jbd2_journal_block_tail {
|
||||
__be32 t_checksum;
|
||||
};
|
||||
|
||||
/*
|
||||
* The revoke descriptor: used on disk to describe a series of blocks to
|
||||
* be revoked from the log
|
||||
*/
|
||||
typedef struct journal_revoke_header_s
|
||||
{
|
||||
journal_header_t r_header;
|
||||
__be32 r_count; /* Count of bytes used in the block */
|
||||
} jbd2_journal_revoke_header_t;
|
||||
|
||||
/* Definitions for the journal tag flags word: */
|
||||
#define JBD2_FLAG_ESCAPE 1 /* on-disk block is escaped */
|
||||
#define JBD2_FLAG_SAME_UUID 2 /* block has same uuid as previous */
|
||||
#define JBD2_FLAG_DELETED 4 /* block deleted by this transaction */
|
||||
#define JBD2_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
|
||||
|
||||
|
||||
#define UUID_SIZE 16
|
||||
#define JBD2_USERS_MAX 48
|
||||
#define JBD2_USERS_SIZE (UUID_SIZE * JBD2_USERS_MAX)
|
||||
/*
|
||||
* The journal superblock. All fields are in big-endian byte order.
|
||||
*/
|
||||
typedef struct journal_superblock_s
|
||||
{
|
||||
/* 0x0000 */
|
||||
journal_header_t s_header;
|
||||
|
||||
/* 0x000C */
|
||||
/* Static information describing the journal */
|
||||
__be32 s_blocksize; /* journal device blocksize */
|
||||
__be32 s_maxlen; /* total blocks in journal file */
|
||||
__be32 s_first; /* first block of log information */
|
||||
|
||||
/* 0x0018 */
|
||||
/* Dynamic information describing the current state of the log */
|
||||
__be32 s_sequence; /* first commit ID expected in log */
|
||||
__be32 s_start; /* blocknr of start of log */
|
||||
|
||||
/* 0x0020 */
|
||||
/* Error value, as set by journal_abort(). */
|
||||
__s32 s_errno;
|
||||
|
||||
/* 0x0024 */
|
||||
/* Remaining fields are only valid in a version-2 superblock */
|
||||
__be32 s_feature_compat; /* compatible feature set */
|
||||
__be32 s_feature_incompat; /* incompatible feature set */
|
||||
__be32 s_feature_ro_compat; /* readonly-compatible feature set */
|
||||
/* 0x0030 */
|
||||
__u8 s_uuid[16]; /* 128-bit uuid for journal */
|
||||
|
||||
/* 0x0040 */
|
||||
__be32 s_nr_users; /* Nr of filesystems sharing log */
|
||||
|
||||
__be32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
|
||||
|
||||
/* 0x0048 */
|
||||
__be32 s_max_transaction; /* Limit of journal blocks per trans.*/
|
||||
__be32 s_max_trans_data; /* Limit of data blocks per trans. */
|
||||
|
||||
/* 0x0050 */
|
||||
__u8 s_checksum_type; /* checksum type */
|
||||
__u8 s_padding2[3];
|
||||
/* 0x0054 */
|
||||
__be32 s_num_fc_blks; /* Number of fast commit blocks */
|
||||
/* 0x0058 */
|
||||
__be32 s_padding[41];
|
||||
__be32 s_checksum; /* crc32c(superblock) */
|
||||
|
||||
/* 0x0100 */
|
||||
__u8 s_users[JBD2_USERS_SIZE]; /* ids of all fs'es sharing the log */
|
||||
|
||||
/* 0x0400 */
|
||||
} journal_superblock_t;
|
||||
|
||||
#define JBD2_HAS_COMPAT_FEATURE(j,mask) \
|
||||
((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_compat & ext2fs_cpu_to_be32((mask))))
|
||||
#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask) \
|
||||
((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_ro_compat & ext2fs_cpu_to_be32((mask))))
|
||||
#define JBD2_HAS_INCOMPAT_FEATURE(j,mask) \
|
||||
((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_incompat & ext2fs_cpu_to_be32((mask))))
|
||||
|
||||
#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
|
||||
|
||||
#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
|
||||
#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
|
||||
#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
|
||||
#define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008
|
||||
#define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010
|
||||
#define JBD2_FEATURE_INCOMPAT_FAST_COMMIT 0x00000020
|
||||
|
||||
/* Features known to this kernel version: */
|
||||
#define JBD2_KNOWN_COMPAT_FEATURES 0
|
||||
#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
|
||||
#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE|\
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT| \
|
||||
JBD2_FEATURE_INCOMPAT_64BIT|\
|
||||
JBD2_FEATURE_INCOMPAT_CSUM_V2| \
|
||||
JBD2_FEATURE_INCOMPAT_CSUM_V3 | \
|
||||
JBD2_FEATURE_INCOMPAT_FAST_COMMIT)
|
||||
|
||||
#ifdef NO_INLINE_FUNCS
|
||||
extern size_t journal_tag_bytes(journal_t *journal);
|
||||
extern int jbd2_journal_has_csum_v2or3(journal_t *journal);
|
||||
extern int jbd2_journal_get_num_fc_blks(journal_superblock_t *jsb);
|
||||
extern int tid_gt(tid_t x, tid_t y) EXT2FS_ATTR((unused));
|
||||
extern int tid_geq(tid_t x, tid_t y) EXT2FS_ATTR((unused));
|
||||
#endif
|
||||
|
||||
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
||||
#ifdef E2FSCK_INCLUDE_INLINE_FUNCS
|
||||
#if (__STDC_VERSION__ >= 199901L)
|
||||
#define _INLINE_ extern inline
|
||||
#else
|
||||
#define _INLINE_ inline
|
||||
#endif
|
||||
#else /* !E2FSCK_INCLUDE_INLINE FUNCS */
|
||||
#if (__STDC_VERSION__ >= 199901L)
|
||||
#define _INLINE_ inline
|
||||
#else /* not C99 */
|
||||
#ifdef __GNUC__
|
||||
#define _INLINE_ extern __inline__
|
||||
#else /* For Watcom C */
|
||||
#define _INLINE_ extern inline
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __STDC_VERSION__ >= 199901L */
|
||||
#endif /* INCLUDE_INLINE_FUNCS */
|
||||
|
||||
/* journal feature predicate functions */
|
||||
#define JBD2_FEATURE_COMPAT_FUNCS(name, flagname) \
|
||||
_INLINE_ int jbd2_has_feature_##name(journal_t *j); \
|
||||
_INLINE_ int jbd2_has_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
return ((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_compat & \
|
||||
ext2fs_cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname)) != 0); \
|
||||
} \
|
||||
_INLINE_ void jbd2_set_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jbd2_set_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_compat |= \
|
||||
ext2fs_cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname); \
|
||||
} \
|
||||
_INLINE_ void jbd2_clear_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jbd2_clear_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_compat &= \
|
||||
~ext2fs_cpu_to_be32(JBD2_FEATURE_COMPAT_##flagname); \
|
||||
}
|
||||
|
||||
#define JBD2_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
|
||||
_INLINE_ int jbd2_has_feature_##name(journal_t *j); \
|
||||
_INLINE_ int jbd2_has_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
return ((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_ro_compat & \
|
||||
ext2fs_cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname)) != 0); \
|
||||
} \
|
||||
_INLINE_ void jbd2_set_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jbd2_set_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_ro_compat |= \
|
||||
ext2fs_cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname); \
|
||||
} \
|
||||
_INLINE_ void jbd2_clear_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jbd2_clear_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_ro_compat &= \
|
||||
~ext2fs_cpu_to_be32(JBD2_FEATURE_RO_COMPAT_##flagname); \
|
||||
}
|
||||
|
||||
#define JBD2_FEATURE_INCOMPAT_FUNCS(name, flagname) \
|
||||
_INLINE_ int jbd2_has_feature_##name(journal_t *j); \
|
||||
_INLINE_ int jbd2_has_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
return ((j)->j_format_version >= 2 && \
|
||||
((j)->j_superblock->s_feature_incompat & \
|
||||
ext2fs_cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname)) != 0); \
|
||||
} \
|
||||
_INLINE_ void jbd2_set_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jbd2_set_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_incompat |= \
|
||||
ext2fs_cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname); \
|
||||
} \
|
||||
_INLINE_ void jbd2_clear_feature_##name(journal_t *j); \
|
||||
_INLINE_ void jbd2_clear_feature_##name(journal_t *j) \
|
||||
{ \
|
||||
(j)->j_superblock->s_feature_incompat &= \
|
||||
~ext2fs_cpu_to_be32(JBD2_FEATURE_INCOMPAT_##flagname); \
|
||||
}
|
||||
|
||||
#else
|
||||
#define JBD2_FEATURE_COMPAT_FUNCS(name, flagname) \
|
||||
extern int jbd2_has_feature_##name(journal_t *j); \
|
||||
extern void jbd2_set_feature_##name(journal_t *j); \
|
||||
extern void jbd2_clear_feature_##name(journal_t *j);
|
||||
|
||||
#define JBD2_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
|
||||
extern int jbd2_has_feature_##name(journal_t *j); \
|
||||
extern void jbd2_set_feature_##name(journal_t *j); \
|
||||
extern void jbd2_clear_feature_##name(journal_t *j);
|
||||
|
||||
#define JBD2_FEATURE_INCOMPAT_FUNCS(name, flagname) \
|
||||
extern int jbd2_has_feature_##name(journal_t *j); \
|
||||
extern void jbd2_set_feature_##name(journal_t *j); \
|
||||
extern void jbd2_clear_feature_##name(journal_t *j);
|
||||
|
||||
#endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
|
||||
|
||||
JBD2_FEATURE_COMPAT_FUNCS(checksum, CHECKSUM)
|
||||
|
||||
JBD2_FEATURE_INCOMPAT_FUNCS(revoke, REVOKE)
|
||||
JBD2_FEATURE_INCOMPAT_FUNCS(64bit, 64BIT)
|
||||
JBD2_FEATURE_INCOMPAT_FUNCS(async_commit, ASYNC_COMMIT)
|
||||
JBD2_FEATURE_INCOMPAT_FUNCS(csum2, CSUM_V2)
|
||||
JBD2_FEATURE_INCOMPAT_FUNCS(csum3, CSUM_V3)
|
||||
JBD2_FEATURE_INCOMPAT_FUNCS(fast_commit, FAST_COMMIT)
|
||||
|
||||
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
|
||||
/*
|
||||
* helper functions to deal with 32 or 64bit block numbers.
|
||||
*/
|
||||
_INLINE_ size_t journal_tag_bytes(journal_t *journal)
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
if (jbd2_has_feature_csum3(journal))
|
||||
return sizeof(journal_block_tag3_t);
|
||||
|
||||
sz = sizeof(journal_block_tag_t);
|
||||
|
||||
if (jbd2_has_feature_csum2(journal))
|
||||
sz += sizeof(__u16);
|
||||
|
||||
if (jbd2_has_feature_64bit(journal))
|
||||
return sz;
|
||||
|
||||
return sz - sizeof(__u32);
|
||||
}
|
||||
|
||||
_INLINE_ int jbd2_journal_has_csum_v2or3(journal_t *journal)
|
||||
{
|
||||
if (jbd2_has_feature_csum2(journal) || jbd2_has_feature_csum3(journal))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_INLINE_ int jbd2_journal_get_num_fc_blks(journal_superblock_t *jsb)
|
||||
{
|
||||
int num_fc_blocks = be32_to_cpu(jsb->s_num_fc_blks);
|
||||
|
||||
return num_fc_blocks ? num_fc_blocks : JBD2_DEFAULT_FAST_COMMIT_BLOCKS;
|
||||
}
|
||||
|
||||
/* Comparison functions for transaction IDs: perform comparisons using
|
||||
* modulo arithmetic so that they work over sequence number wraps. */
|
||||
|
||||
_INLINE_ int tid_gt(tid_t x, tid_t y)
|
||||
{
|
||||
int difference = (x - y);
|
||||
return (difference > 0);
|
||||
}
|
||||
|
||||
_INLINE_ int tid_geq(tid_t x, tid_t y)
|
||||
{
|
||||
int difference = (x - y);
|
||||
return (difference >= 0);
|
||||
}
|
||||
#endif /* (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) */
|
||||
|
||||
#undef _INLINE_
|
||||
|
||||
extern int journal_blocks_per_page(struct inode *inode);
|
||||
|
||||
/*
|
||||
* Definitions which augment the buffer_head layer
|
||||
*/
|
||||
|
||||
/* journaling buffer types */
|
||||
#define BJ_None 0 /* Not journaled */
|
||||
#define BJ_SyncData 1 /* Normal data: flush before commit */
|
||||
#define BJ_AsyncData 2 /* writepage data: wait on it before commit */
|
||||
#define BJ_Metadata 3 /* Normal journaled metadata */
|
||||
#define BJ_Forget 4 /* Buffer superseded by this transaction */
|
||||
#define BJ_IO 5 /* Buffer is for temporary IO use */
|
||||
#define BJ_Shadow 6 /* Buffer contents being shadowed to the log */
|
||||
#define BJ_LogCtl 7 /* Buffer contains log descriptors */
|
||||
#define BJ_Reserved 8 /* Buffer is reserved for access by journal */
|
||||
#define BJ_Types 9
|
||||
|
||||
extern int jbd_blocks_per_page(struct inode *inode);
|
||||
|
||||
#endif /* _LINUX_JBD_H */
|
||||
111
include/e2fsprogs/ext2fs/kernel-list.h
Executable file
111
include/e2fsprogs/ext2fs/kernel-list.h
Executable file
@@ -0,0 +1,111 @@
|
||||
#ifndef _LINUX_LIST_H
|
||||
#define _LINUX_LIST_H
|
||||
|
||||
#include "compiler.h"
|
||||
|
||||
/*
|
||||
* Simple doubly linked list implementation.
|
||||
*
|
||||
* Some of the internal functions ("__xxx") are useful when
|
||||
* manipulating whole lists rather than single entries, as
|
||||
* sometimes we already know the next/prev entries and we can
|
||||
* generate better code by using them directly rather than
|
||||
* using the generic single-entry routines.
|
||||
*/
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next, *prev;
|
||||
};
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
|
||||
#define INIT_LIST_HEAD(ptr) do { \
|
||||
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
||||
} while (0)
|
||||
|
||||
#if (!defined(__GNUC__) && !defined(__WATCOMC__))
|
||||
#define __inline__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Insert a new entry between two known consecutive entries.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
*/
|
||||
static __inline__ void __list_add(struct list_head * new,
|
||||
struct list_head * prev,
|
||||
struct list_head * next)
|
||||
{
|
||||
next->prev = new;
|
||||
new->next = next;
|
||||
new->prev = prev;
|
||||
prev->next = new;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert a new entry after the specified head..
|
||||
*/
|
||||
static __inline__ void list_add(struct list_head *new, struct list_head *head)
|
||||
{
|
||||
__list_add(new, head, head->next);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert a new entry at the tail
|
||||
*/
|
||||
static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
|
||||
{
|
||||
__list_add(new, head->prev, head);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete a list entry by making the prev/next entries
|
||||
* point to each other.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
*/
|
||||
static __inline__ void __list_del(struct list_head * prev,
|
||||
struct list_head * next)
|
||||
{
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
static __inline__ void list_del(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
}
|
||||
|
||||
static __inline__ int list_empty(struct list_head *head)
|
||||
{
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
/*
|
||||
* Splice in "list" into "head"
|
||||
*/
|
||||
static __inline__ void list_splice(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
struct list_head *first = list->next;
|
||||
|
||||
if (first != list) {
|
||||
struct list_head *last = list->prev;
|
||||
struct list_head *at = head->next;
|
||||
|
||||
first->prev = head;
|
||||
head->next = first;
|
||||
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
}
|
||||
}
|
||||
|
||||
#define list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; pos != (head); pos = pos->next)
|
||||
|
||||
#endif
|
||||
114
include/e2fsprogs/ext2fs/qcow2.h
Executable file
114
include/e2fsprogs/ext2fs/qcow2.h
Executable file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* qcow2.h --- structures and function prototypes for qcow2.c to generate
|
||||
* qcow2 formatted disk images. This format is used originally by QEMU
|
||||
* for virtual machines, and stores the filesystem data on disk in a
|
||||
* packed format to avoid creating sparse image files that need lots of
|
||||
* seeking to read and write.
|
||||
*
|
||||
* The qcow2 format supports zlib compression, but that is not yet
|
||||
* implemented.
|
||||
*
|
||||
* It is possible to directly mount a qcow2 image using qemu-nbd:
|
||||
*
|
||||
* [root]# modprobe nbd max_part=63
|
||||
* [root]# qemu-nbd -c /dev/nbd0 image.img
|
||||
* [root]# mount /dev/nbd0p1 /mnt/qemu
|
||||
*
|
||||
* Format details at http://people.gnome.org/~markmc/qcow-image-format.html
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
/* Number of l2 tables in memory before writeback */
|
||||
#define L2_CACHE_PREALLOC 512
|
||||
|
||||
|
||||
#define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb)
|
||||
#define QCOW_VERSION 2
|
||||
#define QCOW_OFLAG_COPIED (1ULL << 63)
|
||||
#define QCOW_OFLAG_COMPRESSED (1ULL << 62)
|
||||
|
||||
#define QCOW_COMPRESSED 1
|
||||
#define QCOW_ENCRYPTED 2
|
||||
#define QCOW_CORRUPTED 3
|
||||
|
||||
struct ext2_qcow2_hdr {
|
||||
__u32 magic;
|
||||
__u32 version;
|
||||
|
||||
__u64 backing_file_offset;
|
||||
__u32 backing_file_size;
|
||||
|
||||
__u32 cluster_bits;
|
||||
__u64 size;
|
||||
__u32 crypt_method;
|
||||
|
||||
__u32 l1_size;
|
||||
__u64 l1_table_offset;
|
||||
|
||||
__u64 refcount_table_offset;
|
||||
__u32 refcount_table_clusters;
|
||||
|
||||
__u32 nb_snapshots;
|
||||
__u64 snapshots_offset;
|
||||
};
|
||||
|
||||
typedef struct ext2_qcow2_l2_table L2_CACHE_HEAD;
|
||||
|
||||
struct ext2_qcow2_l2_table {
|
||||
__u32 l1_index;
|
||||
__u64 offset;
|
||||
__u64 *data;
|
||||
L2_CACHE_HEAD *next;
|
||||
};
|
||||
|
||||
struct ext2_qcow2_l2_cache {
|
||||
L2_CACHE_HEAD *used_head;
|
||||
L2_CACHE_HEAD *used_tail;
|
||||
L2_CACHE_HEAD *free_head;
|
||||
__u32 free;
|
||||
__u32 count;
|
||||
__u64 next_offset;
|
||||
};
|
||||
|
||||
struct ext2_qcow2_refcount {
|
||||
__u64 *refcount_table;
|
||||
__u64 refcount_table_offset;
|
||||
__u64 refcount_block_offset;
|
||||
|
||||
__u32 refcount_table_clusters;
|
||||
__u32 refcount_table_index;
|
||||
__u32 refcount_block_index;
|
||||
|
||||
__u16 *refcount_block;
|
||||
};
|
||||
|
||||
struct ext2_qcow2_image {
|
||||
int fd;
|
||||
struct ext2_qcow2_hdr *hdr;
|
||||
struct ext2_qcow2_l2_cache *l2_cache;
|
||||
struct ext2_qcow2_refcount refcount;
|
||||
__u32 cluster_size;
|
||||
__u32 cluster_bits;
|
||||
__u32 l1_size;
|
||||
__u32 l2_size;
|
||||
|
||||
__u64 *l1_table;
|
||||
__u64 l2_offset;
|
||||
__u64 l1_offset;
|
||||
__u64 image_size;
|
||||
};
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/* qcow2.c */
|
||||
|
||||
/* Functions for converting qcow2 image into raw image */
|
||||
struct ext2_qcow2_hdr *qcow2_read_header(int);
|
||||
int qcow2_write_raw_image(int, int, struct ext2_qcow2_hdr *);
|
||||
|
||||
183
include/e2fsprogs/ext2fs/rbtree.h
Executable file
183
include/e2fsprogs/ext2fs/rbtree.h
Executable file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
Red Black Trees
|
||||
(C) 1999 Andrea Arcangeli <andrea@suse.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 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 General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
linux/include/linux/rbtree.h
|
||||
|
||||
To use rbtrees you'll have to implement your own insert and search cores.
|
||||
This will avoid us to use callbacks and to drop dramatically performances.
|
||||
I know it's not the cleaner way, but in C (not in C++) to get
|
||||
performances and genericity...
|
||||
|
||||
Some example of insert and search follows here. The search is a plain
|
||||
normal search over an ordered tree. The insert instead must be implemented
|
||||
in two steps: First, the code must insert the element in order as a red leaf
|
||||
in the tree, and then the support library function rb_insert_color() must
|
||||
be called. Such function will do the not trivial work to rebalance the
|
||||
rbtree, if necessary.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
static inline struct page * rb_search_page_cache(struct inode * inode,
|
||||
unsigned long offset)
|
||||
{
|
||||
struct rb_node * n = inode->i_rb_page_cache.rb_node;
|
||||
struct page * page;
|
||||
|
||||
while (n)
|
||||
{
|
||||
page = rb_entry(n, struct page, rb_page_cache);
|
||||
|
||||
if (offset < page->offset)
|
||||
n = n->rb_left;
|
||||
else if (offset > page->offset)
|
||||
n = n->rb_right;
|
||||
else
|
||||
return page;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct page * __rb_insert_page_cache(struct inode * inode,
|
||||
unsigned long offset,
|
||||
struct rb_node * node)
|
||||
{
|
||||
struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
|
||||
struct rb_node * parent = NULL;
|
||||
struct page * page;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
parent = *p;
|
||||
page = rb_entry(parent, struct page, rb_page_cache);
|
||||
|
||||
if (offset < page->offset)
|
||||
p = &(*p)->rb_left;
|
||||
else if (offset > page->offset)
|
||||
p = &(*p)->rb_right;
|
||||
else
|
||||
return page;
|
||||
}
|
||||
|
||||
rb_link_node(node, parent, p);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct page * rb_insert_page_cache(struct inode * inode,
|
||||
unsigned long offset,
|
||||
struct rb_node * node)
|
||||
{
|
||||
struct page * ret;
|
||||
if ((ret = __rb_insert_page_cache(inode, offset, node)))
|
||||
goto out;
|
||||
rb_insert_color(node, &inode->i_rb_page_cache);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_RBTREE_H
|
||||
#define _LINUX_RBTREE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "compiler.h"
|
||||
|
||||
#if __GNUC_PREREQ (4, 6)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
struct rb_node
|
||||
{
|
||||
uintptr_t rb_parent_color;
|
||||
#define RB_RED 0
|
||||
#define RB_BLACK 1
|
||||
struct rb_node *rb_right;
|
||||
struct rb_node *rb_left;
|
||||
} __attribute__((aligned(sizeof(long))));
|
||||
/* The alignment might seem pointless, but allegedly CRIS needs it */
|
||||
|
||||
struct rb_root
|
||||
{
|
||||
struct rb_node *rb_node;
|
||||
};
|
||||
|
||||
|
||||
#define ext2fs_rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3))
|
||||
#define ext2fs_rb_color(r) ((r)->rb_parent_color & 1)
|
||||
#define ext2fs_rb_is_red(r) (!ext2fs_rb_color(r))
|
||||
#define ext2fs_rb_is_black(r) ext2fs_rb_color(r)
|
||||
#define ext2fs_rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
|
||||
#define ext2fs_rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
|
||||
|
||||
static inline void ext2fs_rb_set_parent(struct rb_node *rb, struct rb_node *p)
|
||||
{
|
||||
rb->rb_parent_color = (rb->rb_parent_color & 3) | (uintptr_t)p;
|
||||
}
|
||||
static inline void ext2fs_rb_set_color(struct rb_node *rb, int color)
|
||||
{
|
||||
rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
|
||||
}
|
||||
|
||||
#define RB_ROOT (struct rb_root) { NULL, }
|
||||
#define ext2fs_rb_entry(ptr, type, member) container_of(ptr, type, member)
|
||||
|
||||
static inline int ext2fs_rb_empty_root(struct rb_root *root)
|
||||
{
|
||||
return root->rb_node == NULL;
|
||||
}
|
||||
|
||||
static inline int ext2fs_rb_empty_node(struct rb_node *node)
|
||||
{
|
||||
return ext2fs_rb_parent(node) == node;
|
||||
}
|
||||
|
||||
static inline void ext2fs_rb_clear_node(struct rb_node *node)
|
||||
{
|
||||
ext2fs_rb_set_parent(node, node);
|
||||
}
|
||||
|
||||
extern void ext2fs_rb_insert_color(struct rb_node *, struct rb_root *);
|
||||
extern void ext2fs_rb_erase(struct rb_node *, struct rb_root *);
|
||||
|
||||
/* Find logical next and previous nodes in a tree */
|
||||
extern struct rb_node *ext2fs_rb_next(struct rb_node *);
|
||||
extern struct rb_node *ext2fs_rb_prev(struct rb_node *);
|
||||
extern struct rb_node *ext2fs_rb_first(const struct rb_root *);
|
||||
extern struct rb_node *ext2fs_rb_last(const struct rb_root *);
|
||||
|
||||
/* Fast replacement of a single node without remove/rebalance/add/rebalance */
|
||||
extern void ext2fs_rb_replace_node(struct rb_node *victim, struct rb_node *new,
|
||||
struct rb_root *root);
|
||||
|
||||
static inline void ext2fs_rb_link_node(struct rb_node * node,
|
||||
struct rb_node * parent,
|
||||
struct rb_node ** rb_link)
|
||||
{
|
||||
node->rb_parent_color = (uintptr_t)parent;
|
||||
node->rb_left = node->rb_right = NULL;
|
||||
|
||||
*rb_link = node;
|
||||
}
|
||||
|
||||
#if __GNUC_PREREQ (4, 6)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_RBTREE_H */
|
||||
215
include/e2fsprogs/ext2fs/tdb.h
Executable file
215
include/e2fsprogs/ext2fs/tdb.h
Executable file
@@ -0,0 +1,215 @@
|
||||
#ifndef __TDB_H__
|
||||
#define __TDB_H__
|
||||
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
trivial database library
|
||||
|
||||
Copyright (C) Andrew Tridgell 1999-2004
|
||||
|
||||
** NOTE! The following LGPL license applies to the tdb
|
||||
** library. This does NOT imply that all of Samba is released
|
||||
** under the LGPL
|
||||
|
||||
This library 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 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* flags to tdb_store() */
|
||||
#define TDB_REPLACE 1
|
||||
#define TDB_INSERT 2
|
||||
#define TDB_MODIFY 3
|
||||
|
||||
/* flags for tdb_open() */
|
||||
#define TDB_DEFAULT 0 /* just a readability place holder */
|
||||
#define TDB_CLEAR_IF_FIRST 1
|
||||
#define TDB_INTERNAL 2 /* don't store on disk */
|
||||
#define TDB_NOLOCK 4 /* don't do any locking */
|
||||
#define TDB_NOMMAP 8 /* don't use mmap */
|
||||
#define TDB_CONVERT 16 /* convert endian (internal use) */
|
||||
#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */
|
||||
#define TDB_NOSYNC 64 /* don't use synchronous transactions */
|
||||
#define TDB_SEQNUM 128 /* maintain a sequence number */
|
||||
|
||||
#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret)
|
||||
|
||||
/* error codes */
|
||||
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
|
||||
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT,
|
||||
TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY};
|
||||
|
||||
/* debugging uses one of the following levels */
|
||||
enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
|
||||
TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
|
||||
|
||||
typedef struct TDB_DATA {
|
||||
unsigned char *dptr;
|
||||
size_t dsize;
|
||||
} TDB_DATA;
|
||||
|
||||
#ifndef PRINTF_ATTRIBUTE
|
||||
#if (__GNUC__ >= 3)
|
||||
/** Use gcc attribute to check printf fns. a1 is the 1-based index of
|
||||
* the parameter containing the format, and a2 the index of the first
|
||||
* argument. Note that some gcc 2.x versions don't handle this
|
||||
* properly **/
|
||||
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
|
||||
#else
|
||||
#define PRINTF_ATTRIBUTE(a1, a2)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ext2fs tdb renames */
|
||||
#define tdb_open ext2fs_tdb_open
|
||||
#define tdb_open_ex ext2fs_tdb_open_ex
|
||||
#define tdb_set_max_dead ext2fs_tdb_set_max_dead
|
||||
#define tdb_reopen ext2fs_tdb_reopen
|
||||
#define tdb_reopen_all ext2fs_tdb_reopen_all
|
||||
#define tdb_set_logging_function ext2fs_tdb_set_logging_function
|
||||
#define tdb_error ext2fs_tdb_error
|
||||
#define tdb_errorstr ext2fs_tdb_errorstr
|
||||
#define tdb_fetch ext2fs_tdb_fetch
|
||||
#define tdb_parse_record ext2fs_tdb_parse_record
|
||||
#define tdb_delete ext2fs_tdb_delete
|
||||
#define tdb_store ext2fs_tdb_store
|
||||
#define tdb_append ext2fs_tdb_append
|
||||
#define tdb_close ext2fs_tdb_close
|
||||
#define tdb_firstkey ext2fs_tdb_firstkey
|
||||
#define tdb_nextkey ext2fs_tdb_nextkey
|
||||
#define tdb_traverse ext2fs_tdb_traverse
|
||||
#define tdb_traverse_read ext2fs_tdb_traverse_read
|
||||
#define tdb_exists ext2fs_tdb_exists
|
||||
#define tdb_lockall ext2fs_tdb_lockall
|
||||
#define tdb_unlockall ext2fs_tdb_unlockall
|
||||
#define tdb_lockall_read ext2fs_tdb_lockall_read
|
||||
#define tdb_unlockall_read ext2fs_tdb_unlockall_read
|
||||
#define tdb_name ext2fs_tdb_name
|
||||
#define tdb_fd ext2fs_tdb_fd
|
||||
#define tdb_log_fn ext2fs_tdb_log_fn
|
||||
#define tdb_get_logging_private ext2fs_tdb_get_logging_private
|
||||
#define tdb_transaction_start ext2fs_tdb_transaction_start
|
||||
#define tdb_transaction_commit ext2fs_tdb_transaction_commit
|
||||
#define tdb_transaction_cancel ext2fs_tdb_transaction_cancel
|
||||
#define tdb_transaction_recover ext2fs_tdb_transaction_recover
|
||||
#define tdb_get_seqnum ext2fs_tdb_get_seqnum
|
||||
#define tdb_hash_size ext2fs_tdb_hash_size
|
||||
#define tdb_map_size ext2fs_tdb_map_size
|
||||
#define tdb_get_flags ext2fs_tdb_get_flags
|
||||
#define tdb_chainlock ext2fs_tdb_chainlock
|
||||
#define tdb_chainunlock ext2fs_tdb_chainunlock
|
||||
#define tdb_chainlock_read ext2fs_tdb_chainlock_read
|
||||
#define tdb_chainunlock_read ext2fs_tdb_chainunlock_read
|
||||
#define tdb_dump_all ext2fs_tdb_dump_all
|
||||
#define tdb_printfreelist ext2fs_tdb_printfreelist
|
||||
#define tdb_validate_freelist ext2fs_tdb_validate_freelist
|
||||
#define tdb_chainlock_mark ext2fs_tdb_chainlock_mark
|
||||
#define tdb_chainlock_nonblock ext2fs_tdb_chainlock_nonblock
|
||||
#define tdb_chainlock_unmark ext2fs_tdb_chainlock_unmark
|
||||
#define tdb_enable_seqnum ext2fs_tdb_enable_seqnum
|
||||
#define tdb_increment_seqnum_nonblock ext2fs_tdb_increment_seqnum_nonblock
|
||||
#define tdb_lock_nonblock ext2fs_tdb_lock_nonblock
|
||||
#define tdb_lockall_mark ext2fs_tdb_lockall_mark
|
||||
#define tdb_lockall_nonblock ext2fs_tdb_lockall_nonblock
|
||||
#define tdb_lockall_read_nonblock ext2fs_tdb_lockall_read_nonblock
|
||||
#define tdb_lockall_unmark ext2fs_tdb_lockall_unmark
|
||||
#define tdb_flush ext2fs_tdb_flush
|
||||
|
||||
/* this is the context structure that is returned from a db open */
|
||||
typedef struct tdb_context TDB_CONTEXT;
|
||||
|
||||
typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
|
||||
typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
|
||||
typedef unsigned int (*tdb_hash_func)(TDB_DATA *key);
|
||||
|
||||
struct tdb_logging_context {
|
||||
tdb_log_func log_fn;
|
||||
void *log_private;
|
||||
};
|
||||
|
||||
struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
|
||||
int open_flags, mode_t mode);
|
||||
struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
|
||||
int open_flags, mode_t mode,
|
||||
const struct tdb_logging_context *log_ctx,
|
||||
tdb_hash_func hash_fn);
|
||||
void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
|
||||
|
||||
int tdb_reopen(struct tdb_context *tdb);
|
||||
int tdb_reopen_all(int parent_longlived);
|
||||
void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
|
||||
enum TDB_ERROR tdb_error(struct tdb_context *tdb);
|
||||
const char *tdb_errorstr(struct tdb_context *tdb);
|
||||
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
|
||||
int (*parser)(TDB_DATA key, TDB_DATA data,
|
||||
void *private_data),
|
||||
void *private_data);
|
||||
int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
|
||||
int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
|
||||
int tdb_close(struct tdb_context *tdb);
|
||||
TDB_DATA tdb_firstkey(struct tdb_context *tdb);
|
||||
TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *);
|
||||
int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *);
|
||||
int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_lockall(struct tdb_context *tdb);
|
||||
int tdb_lockall_nonblock(struct tdb_context *tdb);
|
||||
int tdb_unlockall(struct tdb_context *tdb);
|
||||
int tdb_lockall_read(struct tdb_context *tdb);
|
||||
int tdb_lockall_read_nonblock(struct tdb_context *tdb);
|
||||
int tdb_unlockall_read(struct tdb_context *tdb);
|
||||
int tdb_lockall_mark(struct tdb_context *tdb);
|
||||
int tdb_lockall_unmark(struct tdb_context *tdb);
|
||||
const char *tdb_name(struct tdb_context *tdb);
|
||||
int tdb_fd(struct tdb_context *tdb);
|
||||
tdb_log_func tdb_log_fn(struct tdb_context *tdb);
|
||||
void *tdb_get_logging_private(struct tdb_context *tdb);
|
||||
int tdb_transaction_start(struct tdb_context *tdb);
|
||||
int tdb_transaction_commit(struct tdb_context *tdb);
|
||||
int tdb_transaction_cancel(struct tdb_context *tdb);
|
||||
int tdb_transaction_recover(struct tdb_context *tdb);
|
||||
int tdb_get_seqnum(struct tdb_context *tdb);
|
||||
int tdb_hash_size(struct tdb_context *tdb);
|
||||
size_t tdb_map_size(struct tdb_context *tdb);
|
||||
int tdb_get_flags(struct tdb_context *tdb);
|
||||
void tdb_enable_seqnum(struct tdb_context *tdb);
|
||||
void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
|
||||
int tdb_flush(struct tdb_context *tdb);
|
||||
|
||||
/* Low level locking functions: use with care */
|
||||
int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
|
||||
int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key);
|
||||
|
||||
/* Debug functions. Not used in production. */
|
||||
void tdb_dump_all(struct tdb_context *tdb);
|
||||
int tdb_printfreelist(struct tdb_context *tdb);
|
||||
int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* tdb.h */
|
||||
4109
include/e2fsprogs/ext2fs/utf8data.h
Executable file
4109
include/e2fsprogs/ext2fs/utf8data.h
Executable file
File diff suppressed because it is too large
Load Diff
120
include/e2fsprogs/ext2fs/utf8n.h
Executable file
120
include/e2fsprogs/ext2fs/utf8n.h
Executable file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2014 SGI.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it would 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* This code is copied from the linux kernel. We have a userspace
|
||||
* version here to such that hashes will match that implementation.
|
||||
*/
|
||||
|
||||
#ifndef UTF8NORM_H
|
||||
#define UTF8NORM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Encoding a unicode version number as a single unsigned int. */
|
||||
#define UNICODE_MAJ_SHIFT (16)
|
||||
#define UNICODE_MIN_SHIFT (8)
|
||||
|
||||
#define UNICODE_AGE(MAJ, MIN, REV) \
|
||||
(((unsigned int)(MAJ) << UNICODE_MAJ_SHIFT) | \
|
||||
((unsigned int)(MIN) << UNICODE_MIN_SHIFT) | \
|
||||
((unsigned int)(REV)))
|
||||
|
||||
/* Highest unicode version supported by the data tables. */
|
||||
extern int utf8version_is_supported(uint8_t maj, uint8_t min, uint8_t rev);
|
||||
extern int utf8version_latest(void);
|
||||
|
||||
/*
|
||||
* Look for the correct const struct utf8data for a unicode version.
|
||||
* Returns NULL if the version requested is too new.
|
||||
*
|
||||
* Two normalization forms are supported: nfdi and nfdicf.
|
||||
*
|
||||
* nfdi:
|
||||
* - Apply unicode normalization form NFD.
|
||||
* - Remove any Default_Ignorable_Code_Point.
|
||||
*
|
||||
* nfdicf:
|
||||
* - Apply unicode normalization form NFD.
|
||||
* - Remove any Default_Ignorable_Code_Point.
|
||||
* - Apply a full casefold (C + F).
|
||||
*/
|
||||
extern const struct utf8data *utf8nfdi(unsigned int maxage);
|
||||
extern const struct utf8data *utf8nfdicf(unsigned int maxage);
|
||||
|
||||
/*
|
||||
* Determine the maximum age of any unicode character in the string.
|
||||
* Returns 0 if only unassigned code points are present.
|
||||
* Returns -1 if the input is not valid UTF-8.
|
||||
*/
|
||||
extern int utf8agemax(const struct utf8data *data, const char *s);
|
||||
extern int utf8nagemax(const struct utf8data *data, const char *s, size_t len);
|
||||
|
||||
/*
|
||||
* Determine the minimum age of any unicode character in the string.
|
||||
* Returns 0 if any unassigned code points are present.
|
||||
* Returns -1 if the input is not valid UTF-8.
|
||||
*/
|
||||
extern int utf8agemin(const struct utf8data *data, const char *s);
|
||||
extern int utf8nagemin(const struct utf8data *data, const char *s, size_t len);
|
||||
|
||||
/*
|
||||
* Determine the length of the normalized from of the string,
|
||||
* excluding any terminating NULL byte.
|
||||
* Returns 0 if only ignorable code points are present.
|
||||
* Returns -1 if the input is not valid UTF-8.
|
||||
*/
|
||||
extern ssize_t utf8len(const struct utf8data *data, const char *s);
|
||||
extern ssize_t utf8nlen(const struct utf8data *data, const char *s, size_t len);
|
||||
|
||||
/* Needed in struct utf8cursor below. */
|
||||
#define UTF8HANGULLEAF (12)
|
||||
|
||||
/*
|
||||
* Cursor structure used by the normalizer.
|
||||
*/
|
||||
struct utf8cursor {
|
||||
const struct utf8data *data;
|
||||
const char *s;
|
||||
const char *p;
|
||||
const char *ss;
|
||||
const char *sp;
|
||||
unsigned int len;
|
||||
unsigned int slen;
|
||||
short int ccc;
|
||||
short int nccc;
|
||||
unsigned char hangul[UTF8HANGULLEAF];
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialize a utf8cursor to normalize a string.
|
||||
* Returns 0 on success.
|
||||
* Returns -1 on failure.
|
||||
*/
|
||||
extern int utf8cursor(struct utf8cursor *u8c, const struct utf8data *data,
|
||||
const char *s);
|
||||
extern int utf8ncursor(struct utf8cursor *u8c, const struct utf8data *data,
|
||||
const char *s, size_t len);
|
||||
|
||||
/*
|
||||
* Get the next byte in the normalization.
|
||||
* Returns a value > 0 && < 256 on success.
|
||||
* Returns 0 when the end of the normalization is reached.
|
||||
* Returns -1 if the string being normalized is not valid UTF-8.
|
||||
*/
|
||||
extern int utf8byte(struct utf8cursor *u8c);
|
||||
|
||||
#endif /* UTF8NORM_H */
|
||||
166
include/e2fsprogs/magic.h
Executable file
166
include/e2fsprogs/magic.h
Executable file
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (c) Christos Zoulas 2003.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _MAGIC_H
|
||||
#define _MAGIC_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAGIC_NONE 0x0000000 /* No flags */
|
||||
#define MAGIC_DEBUG 0x0000001 /* Turn on debugging */
|
||||
#define MAGIC_SYMLINK 0x0000002 /* Follow symlinks */
|
||||
#define MAGIC_COMPRESS 0x0000004 /* Check inside compressed files */
|
||||
#define MAGIC_DEVICES 0x0000008 /* Look at the contents of devices */
|
||||
#define MAGIC_MIME_TYPE 0x0000010 /* Return the MIME type */
|
||||
#define MAGIC_CONTINUE 0x0000020 /* Return all matches */
|
||||
#define MAGIC_CHECK 0x0000040 /* Print warnings to stderr */
|
||||
#define MAGIC_PRESERVE_ATIME 0x0000080 /* Restore access time on exit */
|
||||
#define MAGIC_RAW 0x0000100 /* Don't convert unprintable chars */
|
||||
#define MAGIC_ERROR 0x0000200 /* Handle ENOENT etc as real errors */
|
||||
#define MAGIC_MIME_ENCODING 0x0000400 /* Return the MIME encoding */
|
||||
#define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
|
||||
#define MAGIC_APPLE 0x0000800 /* Return the Apple creator/type */
|
||||
#define MAGIC_EXTENSION 0x1000000 /* Return a /-separated list of
|
||||
* extensions */
|
||||
#define MAGIC_COMPRESS_TRANSP 0x2000000 /* Check inside compressed files
|
||||
* but not report compression */
|
||||
#define MAGIC_NO_COMPRESS_FORK 0x4000000 /* Don't allow decompression that
|
||||
* needs to fork */
|
||||
#define MAGIC_NODESC (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
|
||||
|
||||
#define MAGIC_NO_CHECK_COMPRESS 0x0001000 /* Don't check for compressed files */
|
||||
#define MAGIC_NO_CHECK_TAR 0x0002000 /* Don't check for tar files */
|
||||
#define MAGIC_NO_CHECK_SOFT 0x0004000 /* Don't check magic entries */
|
||||
#define MAGIC_NO_CHECK_APPTYPE 0x0008000 /* Don't check application type */
|
||||
#define MAGIC_NO_CHECK_ELF 0x0010000 /* Don't check for elf details */
|
||||
#define MAGIC_NO_CHECK_TEXT 0x0020000 /* Don't check for text files */
|
||||
#define MAGIC_NO_CHECK_CDF 0x0040000 /* Don't check for cdf files */
|
||||
#define MAGIC_NO_CHECK_CSV 0x0080000 /* Don't check for CSV files */
|
||||
#define MAGIC_NO_CHECK_TOKENS 0x0100000 /* Don't check tokens */
|
||||
#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
|
||||
#define MAGIC_NO_CHECK_JSON 0x0400000 /* Don't check for JSON files */
|
||||
#define MAGIC_NO_CHECK_SIMH 0x0800000 /* Don't check for SIMH tape files */
|
||||
|
||||
/* No built-in tests; only consult the magic file */
|
||||
#define MAGIC_NO_CHECK_BUILTIN ( \
|
||||
MAGIC_NO_CHECK_COMPRESS | \
|
||||
MAGIC_NO_CHECK_TAR | \
|
||||
/* MAGIC_NO_CHECK_SOFT | */ \
|
||||
MAGIC_NO_CHECK_APPTYPE | \
|
||||
MAGIC_NO_CHECK_ELF | \
|
||||
MAGIC_NO_CHECK_TEXT | \
|
||||
MAGIC_NO_CHECK_CSV | \
|
||||
MAGIC_NO_CHECK_CDF | \
|
||||
MAGIC_NO_CHECK_TOKENS | \
|
||||
MAGIC_NO_CHECK_ENCODING | \
|
||||
MAGIC_NO_CHECK_JSON | \
|
||||
MAGIC_NO_CHECK_SIMH | \
|
||||
0 \
|
||||
)
|
||||
|
||||
#define MAGIC_SNPRINTB "\177\020\
|
||||
b\0debug\0\
|
||||
b\1symlink\0\
|
||||
b\2compress\0\
|
||||
b\3devices\0\
|
||||
b\4mime_type\0\
|
||||
b\5continue\0\
|
||||
b\6check\0\
|
||||
b\7preserve_atime\0\
|
||||
b\10raw\0\
|
||||
b\11error\0\
|
||||
b\12mime_encoding\0\
|
||||
b\13apple\0\
|
||||
b\14no_check_compress\0\
|
||||
b\15no_check_tar\0\
|
||||
b\16no_check_soft\0\
|
||||
b\17no_check_sapptype\0\
|
||||
b\20no_check_elf\0\
|
||||
b\21no_check_text\0\
|
||||
b\22no_check_cdf\0\
|
||||
b\23no_check_csv\0\
|
||||
b\24no_check_tokens\0\
|
||||
b\25no_check_encoding\0\
|
||||
b\26no_check_json\0\
|
||||
b\27no_check_simh\0\
|
||||
b\30extension\0\
|
||||
b\31transp_compression\0\
|
||||
"
|
||||
|
||||
/* Defined for backwards compatibility (renamed) */
|
||||
#define MAGIC_NO_CHECK_ASCII MAGIC_NO_CHECK_TEXT
|
||||
|
||||
/* Defined for backwards compatibility; do nothing */
|
||||
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
|
||||
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
|
||||
|
||||
#define MAGIC_VERSION 545 /* This implementation */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct magic_set *magic_t;
|
||||
magic_t magic_open(int);
|
||||
void magic_close(magic_t);
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
const char *magic_file(magic_t, const char *);
|
||||
const char *magic_descriptor(magic_t, int);
|
||||
const char *magic_buffer(magic_t, const void *, size_t);
|
||||
|
||||
const char *magic_error(magic_t);
|
||||
int magic_getflags(magic_t);
|
||||
int magic_setflags(magic_t, int);
|
||||
|
||||
int magic_version(void);
|
||||
int magic_load(magic_t, const char *);
|
||||
int magic_load_buffers(magic_t, void **, size_t *, size_t);
|
||||
|
||||
int magic_compile(magic_t, const char *);
|
||||
int magic_check(magic_t, const char *);
|
||||
int magic_list(magic_t, const char *);
|
||||
int magic_errno(magic_t);
|
||||
|
||||
#define MAGIC_PARAM_INDIR_MAX 0
|
||||
#define MAGIC_PARAM_NAME_MAX 1
|
||||
#define MAGIC_PARAM_ELF_PHNUM_MAX 2
|
||||
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
|
||||
#define MAGIC_PARAM_ELF_NOTES_MAX 4
|
||||
#define MAGIC_PARAM_REGEX_MAX 5
|
||||
#define MAGIC_PARAM_BYTES_MAX 6
|
||||
#define MAGIC_PARAM_ENCODING_MAX 7
|
||||
#define MAGIC_PARAM_ELF_SHSIZE_MAX 8
|
||||
|
||||
int magic_setparam(magic_t, int, const void *);
|
||||
int magic_getparam(magic_t, int, void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _MAGIC_H */
|
||||
57
include/e2fsprogs/misc/create_inode.h
Executable file
57
include/e2fsprogs/misc/create_inode.h
Executable file
@@ -0,0 +1,57 @@
|
||||
#ifndef _CREATE_INODE_H
|
||||
#define _CREATE_INODE_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "et/com_err.h"
|
||||
#include "e2p/e2p.h"
|
||||
#include "ext2fs/ext2fs.h"
|
||||
|
||||
struct hdlink_s
|
||||
{
|
||||
dev_t src_dev;
|
||||
ino_t src_ino;
|
||||
ext2_ino_t dst_ino;
|
||||
};
|
||||
|
||||
struct hdlinks_s
|
||||
{
|
||||
int count;
|
||||
int size;
|
||||
struct hdlink_s *hdl;
|
||||
};
|
||||
|
||||
#define HDLINK_CNT (4)
|
||||
|
||||
struct fs_ops_callbacks {
|
||||
errcode_t (* create_new_inode)(ext2_filsys fs, const char *target_path,
|
||||
const char *name, ext2_ino_t parent_ino, ext2_ino_t root,
|
||||
mode_t mode);
|
||||
errcode_t (* end_create_new_inode)(ext2_filsys fs,
|
||||
const char *target_path, const char *name,
|
||||
ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode);
|
||||
};
|
||||
|
||||
extern int no_copy_xattrs; /* this should eventually be a flag
|
||||
passed to populate_fs3() */
|
||||
|
||||
/* For populating the filesystem */
|
||||
extern errcode_t populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
|
||||
const char *source_dir, ext2_ino_t root);
|
||||
extern errcode_t populate_fs2(ext2_filsys fs, ext2_ino_t parent_ino,
|
||||
const char *source_dir, ext2_ino_t root,
|
||||
struct fs_ops_callbacks *fs_callbacks);
|
||||
extern errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd,
|
||||
const char *name, unsigned int st_mode,
|
||||
unsigned int st_rdev);
|
||||
extern errcode_t do_symlink_internal(ext2_filsys fs, ext2_ino_t cwd,
|
||||
const char *name, char *target,
|
||||
ext2_ino_t root);
|
||||
extern errcode_t do_mkdir_internal(ext2_filsys fs, ext2_ino_t cwd,
|
||||
const char *name, ext2_ino_t root);
|
||||
extern errcode_t do_write_internal(ext2_filsys fs, ext2_ino_t cwd,
|
||||
const char *src, const char *dest,
|
||||
ext2_ino_t root);
|
||||
|
||||
#endif /* _CREATE_INODE_H */
|
||||
30
include/e2fsprogs/misc/mke2fs.h
Executable file
30
include/e2fsprogs/misc/mke2fs.h
Executable file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* mke2fs.h
|
||||
*
|
||||
* Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
* 2003, 2004, 2005 by Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
/* mke2fs.c */
|
||||
extern const char * program_name;
|
||||
extern int quiet;
|
||||
extern int verbose;
|
||||
extern int zero_hugefile;
|
||||
extern char **fs_types;
|
||||
|
||||
extern char *get_string_from_profile(char **types, const char *opt,
|
||||
const char *def_val);
|
||||
extern int get_int_from_profile(char **types, const char *opt, int def_val);
|
||||
extern int get_bool_from_profile(char **types, const char *opt, int def_val);
|
||||
extern int int_log10(unsigned long long arg);
|
||||
|
||||
/* mk_hugefiles.c */
|
||||
extern errcode_t mk_hugefiles(ext2_filsys fs, const char *device_name);
|
||||
|
||||
|
||||
|
||||
29
include/e2fsprogs/misc/util.h
Executable file
29
include/e2fsprogs/misc/util.h
Executable file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* util.h --- header file defining prototypes for helper functions
|
||||
* used by tune2fs and mke2fs
|
||||
*
|
||||
* Copyright 2000 by Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
extern int journal_size;
|
||||
extern int journal_fc_size;
|
||||
extern int journal_flags;
|
||||
extern char *journal_device;
|
||||
extern char *journal_location_string;
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
extern int strcasecmp (char *s1, char *s2);
|
||||
#endif
|
||||
extern char *get_progname(char *argv_zero);
|
||||
extern void proceed_question(int delay);
|
||||
extern void parse_journal_opts(const char *opts);
|
||||
extern void check_mount(const char *device, int force, const char *type);
|
||||
extern void figure_journal_size(struct ext2fs_journal_params *jparams,
|
||||
int requested_j_size, int requested_fc_size, ext2_filsys fs);
|
||||
extern void print_check_message(int, unsigned int);
|
||||
extern void dump_mmp_msg(struct mmp_struct *mmp, const char *msg);
|
||||
43
include/e2fsprogs/support/argv_parse.h
Executable file
43
include/e2fsprogs/support/argv_parse.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* argv_parse.h --- header file for the argv parser.
|
||||
*
|
||||
* This file defines the interface for the functions argv_parse() and
|
||||
* argv_free().
|
||||
*
|
||||
***********************************************************************
|
||||
* int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv)
|
||||
*
|
||||
* This function takes as its first argument a string which it will
|
||||
* parse into an argv argument vector, with each white-space separated
|
||||
* word placed into its own slot in the argv. This function handles
|
||||
* double quotes and backslashes so that the parsed words can contain
|
||||
* special characters. The count of the number words found in the
|
||||
* parsed string, as well as the argument vector, are returned into
|
||||
* ret_argc and ret_argv, respectively.
|
||||
***********************************************************************
|
||||
* extern void argv_free(char **argv);
|
||||
*
|
||||
* This function frees the argument vector created by argv_parse().
|
||||
***********************************************************************
|
||||
*
|
||||
* Copyright 1999 by Theodore Ts'o.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that
|
||||
* the above copyright notice and this permission notice appear in all
|
||||
* copies. THE SOFTWARE IS PROVIDED "AS IS" AND THEODORE TS'O (THE
|
||||
* AUTHOR) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. (Isn't
|
||||
* it sick that the U.S. culture of lawsuit-happy lawyers requires
|
||||
* this kind of disclaimer?)
|
||||
*
|
||||
* Version 1.1, modified 2/27/1999
|
||||
*/
|
||||
|
||||
extern int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv);
|
||||
extern void argv_free(char **argv);
|
||||
36
include/e2fsprogs/support/common.h
Executable file
36
include/e2fsprogs/support/common.h
Executable file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
*
|
||||
* Various things common for all utilities
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __QUOTA_COMMON_H__
|
||||
#define __QUOTA_COMMON_H__
|
||||
|
||||
#if EXT2_FLAT_INCLUDES
|
||||
#include "e2_types.h"
|
||||
#else
|
||||
#include <ext2fs/ext2_types.h>
|
||||
#endif /* EXT2_FLAT_INCLUDES */
|
||||
|
||||
/* #define DEBUG_QUOTA 1 */
|
||||
|
||||
#ifndef __attribute__
|
||||
# if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
# define __attribute__(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define log_err(format, arg ...) \
|
||||
fprintf(stderr, "[ERROR] %s:%d:%s: " format "\n", \
|
||||
__FILE__, __LINE__, __func__, ## arg)
|
||||
|
||||
#ifdef DEBUG_QUOTA
|
||||
# define log_debug(format, arg ...) \
|
||||
fprintf(stderr, "[DEBUG] %s:%d:%s: " format "\n", \
|
||||
__FILE__, __LINE__, __func__, ## arg)
|
||||
#else
|
||||
# define log_debug(...)
|
||||
#endif
|
||||
|
||||
#endif /* __QUOTA_COMMON_H__ */
|
||||
6
include/e2fsprogs/support/cstring.h
Executable file
6
include/e2fsprogs/support/cstring.h
Executable file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* cstring.h -- header file for C string parse/print utilities
|
||||
*/
|
||||
|
||||
extern int parse_c_string(char *str);
|
||||
extern void print_c_string(FILE *f, const char *cp, int len);
|
||||
19
include/e2fsprogs/support/devname.h
Executable file
19
include/e2fsprogs/support/devname.h
Executable file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* devname.c --- Figure out if a pathname is ext* or something else.
|
||||
*
|
||||
* Copyright (C) 2022 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Public
|
||||
* License.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#ifndef DEVNAME_H_
|
||||
#define DEVNAME_H_
|
||||
|
||||
#include "blkid/blkid.h"
|
||||
|
||||
char *get_devname(blkid_cache cache, const char *token, const char *value);
|
||||
|
||||
#endif /* DEVNAME_H_ */
|
||||
147
include/e2fsprogs/support/dict.h
Executable file
147
include/e2fsprogs/support/dict.h
Executable file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Dictionary Abstract Data Type
|
||||
* Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net>
|
||||
*
|
||||
* Free Software License:
|
||||
*
|
||||
* All rights are reserved by the author, with the following exceptions:
|
||||
* Permission is granted to freely reproduce and distribute this software,
|
||||
* possibly in exchange for a fee, provided that this copyright notice appears
|
||||
* intact. Permission is also granted to adapt this software to produce
|
||||
* derivative works, as long as the modified versions carry this copyright
|
||||
* notice and additional notices stating that the work has been modified.
|
||||
* This source code may be translated into executable form and incorporated
|
||||
* into proprietary software; there is no requirement for such software to
|
||||
* contain a copyright notice related to this source.
|
||||
*
|
||||
* $Id: dict.h,v 1.22.2.6 2000/11/13 01:36:44 kaz Exp $
|
||||
* $Name: kazlib_1_20 $
|
||||
* The work has been modified.
|
||||
*/
|
||||
|
||||
#ifndef DICT_H
|
||||
#define DICT_H
|
||||
|
||||
#include <limits.h>
|
||||
#ifdef KAZLIB_SIDEEFFECT_DEBUG
|
||||
#include "sfx.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Blurb for inclusion into C++ translation units
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned long dictcount_t;
|
||||
#define DICTCOUNT_T_MAX ULONG_MAX
|
||||
|
||||
/*
|
||||
* The dictionary is implemented as a red-black tree
|
||||
*/
|
||||
|
||||
typedef enum { dnode_red, dnode_black } dnode_color_t;
|
||||
|
||||
typedef struct dnode_t {
|
||||
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
|
||||
struct dnode_t *dict_left;
|
||||
struct dnode_t *dict_right;
|
||||
struct dnode_t *dict_parent;
|
||||
dnode_color_t dict_color;
|
||||
const void *dict_key;
|
||||
void *dict_data;
|
||||
#else
|
||||
int dict_dummy;
|
||||
#endif
|
||||
} dnode_t;
|
||||
|
||||
typedef int (*dict_comp_t)(const void *, const void *, const void *);
|
||||
typedef dnode_t *(*dnode_alloc_t)(void *);
|
||||
typedef void (*dnode_free_t)(dnode_t *, void *);
|
||||
|
||||
typedef struct dict_t {
|
||||
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
|
||||
dnode_t dict_nilnode;
|
||||
dictcount_t dict_nodecount;
|
||||
dictcount_t dict_maxcount;
|
||||
dict_comp_t dict_compare;
|
||||
dnode_alloc_t dict_allocnode;
|
||||
dnode_free_t dict_freenode;
|
||||
void *dict_context;
|
||||
const void *cmp_ctx;
|
||||
int dict_dupes;
|
||||
#else
|
||||
int dict_dummmy;
|
||||
#endif
|
||||
} dict_t;
|
||||
|
||||
typedef void (*dnode_process_t)(dict_t *, dnode_t *, void *);
|
||||
|
||||
typedef struct dict_load_t {
|
||||
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
|
||||
dict_t *dict_dictptr;
|
||||
dnode_t dict_nilnode;
|
||||
#else
|
||||
int dict_dummmy;
|
||||
#endif
|
||||
} dict_load_t;
|
||||
|
||||
extern dict_t *dict_create(dictcount_t, dict_comp_t);
|
||||
extern void dict_set_allocator(dict_t *, dnode_alloc_t, dnode_free_t, void *);
|
||||
extern void dict_set_cmp_context(dict_t *, const void *);
|
||||
extern void dict_destroy(dict_t *);
|
||||
extern void dict_free_nodes(dict_t *);
|
||||
extern void dict_free(dict_t *);
|
||||
extern dict_t *dict_init(dict_t *, dictcount_t, dict_comp_t);
|
||||
extern void dict_init_like(dict_t *, const dict_t *);
|
||||
extern int dict_verify(dict_t *);
|
||||
extern int dict_similar(const dict_t *, const dict_t *);
|
||||
extern dnode_t *dict_lookup(dict_t *, const void *);
|
||||
extern dnode_t *dict_lower_bound(dict_t *, const void *);
|
||||
extern dnode_t *dict_upper_bound(dict_t *, const void *);
|
||||
extern void dict_insert(dict_t *, dnode_t *, const void *);
|
||||
extern dnode_t *dict_delete(dict_t *, dnode_t *);
|
||||
extern int dict_alloc_insert(dict_t *, const void *, void *);
|
||||
extern void dict_delete_free(dict_t *, dnode_t *);
|
||||
extern dnode_t *dict_first(dict_t *);
|
||||
extern dnode_t *dict_last(dict_t *);
|
||||
extern dnode_t *dict_next(dict_t *, dnode_t *);
|
||||
extern dnode_t *dict_prev(dict_t *, dnode_t *);
|
||||
extern dictcount_t dict_count(dict_t *);
|
||||
extern int dict_isempty(dict_t *);
|
||||
extern int dict_isfull(dict_t *);
|
||||
extern int dict_contains(dict_t *, dnode_t *);
|
||||
extern void dict_allow_dupes(dict_t *);
|
||||
extern int dnode_is_in_a_dict(dnode_t *);
|
||||
extern dnode_t *dnode_create(void *);
|
||||
extern dnode_t *dnode_init(dnode_t *, void *);
|
||||
extern void dnode_destroy(dnode_t *);
|
||||
extern void *dnode_get(dnode_t *);
|
||||
extern const void *dnode_getkey(dnode_t *);
|
||||
extern void dnode_put(dnode_t *, void *);
|
||||
extern void dict_process(dict_t *, void *, dnode_process_t);
|
||||
extern void dict_load_begin(dict_load_t *, dict_t *);
|
||||
extern void dict_load_next(dict_load_t *, dnode_t *, const void *);
|
||||
extern void dict_load_end(dict_load_t *);
|
||||
extern void dict_merge(dict_t *, dict_t *);
|
||||
|
||||
#if defined(DICT_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
|
||||
#ifdef KAZLIB_SIDEEFFECT_DEBUG
|
||||
#define dict_isfull(D) (SFX_CHECK(D)->dict_nodecount == (D)->dict_maxcount)
|
||||
#else
|
||||
#define dict_isfull(D) ((D)->dict_nodecount == (D)->dict_maxcount)
|
||||
#endif
|
||||
#define dict_count(D) ((D)->dict_nodecount)
|
||||
#define dict_isempty(D) ((D)->dict_nodecount == 0)
|
||||
#define dnode_get(N) ((N)->dict_data)
|
||||
#define dnode_getkey(N) ((N)->dict_key)
|
||||
#define dnode_put(N, X) ((N)->dict_data = (X))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user