Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_extras
Commits
01869e7a
Commit
01869e7a
authored
10 years ago
by
Mohamad Ayyash
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Download
Plain Diff
Merge "Introduce squashfs-utils that includes helper functions"
parents
0a726d10
f4a1ddff
master
brillo-m10-dev
brillo-m10-release
brillo-m7-dev
brillo-m7-mr-dev
brillo-m7-release
brillo-m8-dev
brillo-m8-release
brillo-m9-dev
brillo-m9-release
marshmallow-cts-release
marshmallow-dev
marshmallow-dr-dev
marshmallow-dr-dragon-release
marshmallow-dr-release
marshmallow-dr1.5-dev
marshmallow-dr1.5-release
marshmallow-dr1.6-release
marshmallow-mr1-dev
marshmallow-mr1-release
marshmallow-mr2-release
marshmallow-mr3-release
marshmallow-release
master-soong
nougat-cts-dev
nougat-cts-release
nougat-dev
nougat-dr1-release
nougat-mr0.5-release
nougat-mr1-cts-dev
nougat-mr1-cts-release
nougat-mr1-dev
nougat-mr1-release
nougat-mr1.1-release
nougat-mr1.2-release
nougat-release
rockchip-6.0.1_r55
sdk-release
android-wear-n-preview-2
android-wear-n-preview-1
android-wear-5.1.1_r1
android-wear-5.1.0_r1
android-n-preview-5
android-n-preview-4
android-n-preview-3
android-n-preview-2
android-n-preview-1
android-n-mr1-preview-2
android-n-mr1-preview-1
android-m-preview
android-m-preview-2
android-m-preview-1
android-cts-7.1_r1
android-cts-7.0_r5
android-cts-7.0_r4
android-cts-7.0_r3
android-cts-7.0_r2
android-cts-7.0_r1
android-cts-6.0_r14
android-cts-6.0_r13
android-cts-6.0_r12
android-cts-6.0_r9
android-cts-6.0_r8
android-cts-6.0_r7
android-cts-6.0_r6
android-cts-6.0_r5
android-cts-6.0_r4
android-cts-6.0_r3
android-cts-6.0_r2
android-cts-6.0_r1
android-7.1.1_r13
android-7.1.1_r12
android-7.1.1_r11
android-7.1.1_r10
android-7.1.1_r9
android-7.1.1_r8
android-7.1.1_r7
android-7.1.1_r6
android-7.1.1_r4
android-7.1.1_r3
android-7.1.1_r2
android-7.1.1_r1
android-7.1.0_r7
android-7.1.0_r6
android-7.1.0_r5
android-7.1.0_r4
android-7.1.0_r3
android-7.1.0_r2
android-7.1.0_r1
android-7.0.0_r27
android-7.0.0_r24
android-7.0.0_r21
android-7.0.0_r19
android-7.0.0_r17
android-7.0.0_r15
android-7.0.0_r14
android-7.0.0_r13
android-7.0.0_r12
android-7.0.0_r7
android-7.0.0_r6
android-7.0.0_r5
android-7.0.0_r4
android-7.0.0_r3
android-7.0.0_r1
android-6.0.1_r78
android-6.0.1_r77
android-6.0.1_r74
android-6.0.1_r73
android-6.0.1_r72
android-6.0.1_r70
android-6.0.1_r69
android-6.0.1_r68
android-6.0.1_r67
android-6.0.1_r66
android-6.0.1_r65
android-6.0.1_r63
android-6.0.1_r62
android-6.0.1_r61
android-6.0.1_r60
android-6.0.1_r59
android-6.0.1_r58
android-6.0.1_r57
android-6.0.1_r56
android-6.0.1_r55
android-6.0.1_r54
android-6.0.1_r53
android-6.0.1_r52
android-6.0.1_r51
android-6.0.1_r50
android-6.0.1_r49
android-6.0.1_r48
android-6.0.1_r47
android-6.0.1_r46
android-6.0.1_r45
android-6.0.1_r43
android-6.0.1_r42
android-6.0.1_r41
android-6.0.1_r40
android-6.0.1_r33
android-6.0.1_r32
android-6.0.1_r31
android-6.0.1_r30
android-6.0.1_r28
android-6.0.1_r27
android-6.0.1_r26
android-6.0.1_r25
android-6.0.1_r24
android-6.0.1_r22
android-6.0.1_r21
android-6.0.1_r20
android-6.0.1_r18
android-6.0.1_r17
android-6.0.1_r16
android-6.0.1_r13
android-6.0.1_r12
android-6.0.1_r11
android-6.0.1_r10
android-6.0.1_r9
android-6.0.1_r8
android-6.0.1_r7
android-6.0.1_r5
android-6.0.1_r4
android-6.0.1_r3
android-6.0.1_r1
android-6.0.0_r41
android-6.0.0_r26
android-6.0.0_r25
android-6.0.0_r24
android-6.0.0_r23
android-6.0.0_r13
android-6.0.0_r12
android-6.0.0_r11
android-6.0.0_r7
android-6.0.0_r6
android-6.0.0_r5
android-6.0.0_r4
android-6.0.0_r3
android-6.0.0_r2
android-6.0.0_r1
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
0 deletions
+109
-0
squashfs_utils/Android.mk
squashfs_utils/Android.mk
+7
-0
squashfs_utils/squashfs_utils.c
squashfs_utils/squashfs_utils.c
+63
-0
squashfs_utils/squashfs_utils.h
squashfs_utils/squashfs_utils.h
+39
-0
No files found.
squashfs_utils/Android.mk
View file @
01869e7a
...
...
@@ -2,6 +2,13 @@
LOCAL_PATH
:=
$(
call
my-dir
)
include
$(CLEAR_VARS)
LOCAL_SRC_FILES
:=
squashfs_utils.c
LOCAL_STATIC_LIBRARIES
:=
libcutils
LOCAL_C_INCLUDES
:=
external/squashfs-tools/squashfs-tools
LOCAL_MODULE
:=
libsquashfs_utils
include
$(BUILD_STATIC_LIBRARY)
ifeq
($(HOST_OS),linux)
include
$(CLEAR_VARS)
...
...
This diff is collapsed.
Click to expand it.
squashfs_utils/squashfs_utils.c
0 → 100644
View file @
01869e7a
/*
* Copyright (C) 2015 The Android Open Source Project
*
* 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 "squashfs_utils.h"
#include <cutils/klog.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "squashfs_fs.h"
#define ERROR(x...) KLOG_ERROR("squashfs_utils", x)
int
squashfs_parse_sb
(
char
*
blk_device
,
struct
squashfs_info
*
info
)
{
int
ret
=
0
;
struct
squashfs_super_block
sb
;
int
data_device
;
data_device
=
TEMP_FAILURE_RETRY
(
open
(
blk_device
,
O_RDONLY
|
O_CLOEXEC
));
if
(
data_device
==
-
1
)
{
ERROR
(
"Error opening block device (%s)
\n
"
,
strerror
(
errno
));
return
-
1
;
}
if
(
TEMP_FAILURE_RETRY
(
read
(
data_device
,
&
sb
,
sizeof
(
sb
)))
!=
sizeof
(
sb
))
{
ERROR
(
"Error reading superblock
\n
"
);
ret
=
-
1
;
goto
cleanup
;
}
if
(
sb
.
s_magic
!=
SQUASHFS_MAGIC
)
{
ERROR
(
"Not a valid squashfs filesystem
\n
"
);
ret
=
-
1
;
goto
cleanup
;
}
info
->
block_size
=
sb
.
block_size
;
info
->
inodes
=
sb
.
inodes
;
info
->
bytes_used
=
sb
.
bytes_used
;
// by default mksquashfs pads the filesystem to 4K blocks
info
->
bytes_used_4K_padded
=
sb
.
bytes_used
+
(
4096
-
(
sb
.
bytes_used
&
(
4096
-
1
)));
cleanup:
TEMP_FAILURE_RETRY
(
close
(
data_device
));
return
ret
;
}
This diff is collapsed.
Click to expand it.
squashfs_utils/squashfs_utils.h
0 → 100644
View file @
01869e7a
/*
* Copyright (C) 2015 The Android Open Source Project
*
* 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.
*/
#ifndef _SQUASHFS_UTILS_H_
#define _SQUASHFS_UTILS_H_
#include <stdint.h>
#ifdef __cplusplus
extern
"C"
{
#endif
struct
squashfs_info
{
uint32_t
block_size
;
uint32_t
inodes
;
uint64_t
bytes_used
;
uint64_t
bytes_used_4K_padded
;
};
int
squashfs_parse_sb
(
char
*
blk_device
,
struct
squashfs_info
*
info
);
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment