• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revision39f5dea21df86534dda11e6e5278f3cab522a8db (tree)
Zeit2016-09-04 08:46:00
AutorDiogo Ferreira <diogo@unde...>
CommiterSteve Kondik

Log Message

fs_mgr: When formating ext4 volumes, respect the length parameter

When formatting a volume because it is marked as formattable, the
length parameter is discarded which makes fs_mgr write a filesystem
to the full length of the block device.

This patch adds length semantics to ext4 formatting, if the length
is greater than zero, use that, if it isn't subtract that size
from the block size.

Change-Id: I4d18d5161360f8de0e571352e705678682e61332
Ticket: CYNGNOS-931

Ändern Zusammenfassung

Diff

--- a/fs_mgr/fs_mgr_format.c
+++ b/fs_mgr/fs_mgr_format.c
@@ -31,7 +31,7 @@
3131 extern struct fs_info info; /* magic global from ext4_utils */
3232 extern void reset_ext4fs_info();
3333
34-static int format_ext4(char *fs_blkdev, char *fs_mnt_point)
34+static int format_ext4(char *fs_blkdev, char *fs_mnt_point, long long fs_length)
3535 {
3636 unsigned int nr_sec;
3737 int fd, rc = 0;
@@ -51,6 +51,12 @@ static int format_ext4(char *fs_blkdev, char *fs_mnt_point)
5151 reset_ext4fs_info();
5252 info.len = ((off64_t)nr_sec * 512);
5353
54+ if (fs_length > 0) {
55+ info.len = fs_length;
56+ } else if (fs_length < 0) {
57+ info.len += fs_length;
58+ }
59+
5460 /* Use make_ext4fs_internal to avoid wiping an already-wiped partition. */
5561 rc = make_ext4fs_internal(fd, NULL, NULL, fs_mnt_point, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL);
5662 if (rc) {
@@ -110,7 +116,7 @@ int fs_mgr_do_format(struct fstab_rec *fstab)
110116 if (!strncmp(fstab->fs_type, "f2fs", 4)) {
111117 rc = format_f2fs(fstab->blk_device);
112118 } else if (!strncmp(fstab->fs_type, "ext4", 4)) {
113- rc = format_ext4(fstab->blk_device, fstab->mount_point);
119+ rc = format_ext4(fstab->blk_device, fstab->mount_point, fstab->length);
114120 } else {
115121 ERROR("File system type '%s' is not supported\n", fstab->fs_type);
116122 }