Ty Coon, President of Vice
That's all there is to it!
+
+----------------------------------------------------------------------
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation files
+(the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
Name: e2fsprogs
Version: 1.46.0
Release: 0
-License: GPLv2
+License: GPL-2.0
Group: System Environment/Base
Source: ftp://download.sourceforge.net/pub/sourceforge/e2fsprogs/e2fsprogs-%{version}.tar.gz
Url: http://e2fsprogs.sourceforge.net/
%package -n uuidd
Summary: helper daemon to guarantee uniqueness of time-based UUIDs
Group: System Environment/Daemons
-License: GPLv2
+License: BSD-3-Clause
Requires: e2fsprogs = %{version}
Requires(pre): shadow-utils
.I number-of-inodes
]
[
+.B \-d
+.I root-directory
+]
+[
.B \-n
]
[
ratio). This allows the user to specify the number
of desired inodes directly.
.TP
+.BI \-d " root-directory"
+Add the files from the root-directory to the filesystem.
+.TP
.BI \-o " creator-os"
Overrides the default value of the "creator operating system" field of the
filesystem. The creator field is set by default to the name of the OS the
--- /dev/null
+libext2fs
+ targetarch ia64 block!
+libcom_err
+ targetarch ia64 block!
+e2fsprogs
+e2fsprogs-devel
+libext2fs-devel
+ requires "libext2fs-<targettype> = <version>"
+libcom_err-devel
+ requires "libcom_err-<targettype> = <version>"
--- /dev/null
+[options]
+# This will prevent e2fsck from stopping boot just because the clock is wrong
+broken_system_clock = 1
+
--- /dev/null
+* Sat May 11 2013 Anas Nashif <anas.nashif@intel.com> submit/tizen/20130509.173946@4ee9d9d
+- Set license using %license
+
+* Fri Dec 21 2012 Anas Nashif <anas.nashif@intel.com> upstream/1.42.4@5438d17
+- Update to 1.42.6
+
+* Fri Dec 14 2012 Anas Nashif <anas.nashif@intel.com> upstream/1.42.4@8afbc93
+- Initail import
+
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+Name: e2fsprogs
+BuildRequires: autoconf
+BuildRequires: libblkid-devel
+BuildRequires: libuuid-devel
+BuildRequires: pkg-config
+Version: 1.46.0
+Release: 0
+Summary: Utilities for the Second Extended File System
+License: GPL-2.0
+Group: System/Filesystems
+Url: http://e2fsprogs.sourceforge.net
+Requires: libcom_err >= %{version}
+Requires: libext2fs >= %{version}
+Source: http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v%{version}/e2fsprogs-%{version}.tar.xz
+Source1: baselibs.conf
+Source2: e2fsck.conf
+Source1001: e2fsprogs.manifest
+
+%description
+Utilities needed to create and maintain ext2 and ext3 file systems
+under Linux. Included in this package are: chattr, lsattr, mke2fs,
+mklost+found, tune2fs, e2fsck, resize2fs, and badblocks.
+
+%package devel
+Summary: Dummy development package
+License: LGPL-2.0
+Group: Base/Development
+Requires: libblkid-devel
+Requires: libext2fs-devel = %version
+Requires: libuuid-devel
+
+%description devel
+Dummy development package for backwards compatibility.
+
+%package -n libext2fs
+Summary: Ext2fs library
+License: LGPL-2.0
+Group: Base/File Systems
+
+%description -n libext2fs
+The basic Ext2fs shared library.
+
+%package -n libext2fs-devel
+Summary: Development files for libext2fs
+License: LGPL-2.0
+Group: Base/Development
+Requires: libcom_err-devel
+Requires: libext2fs = %version
+
+%description -n libext2fs-devel
+Development files for libext2fs.
+
+%package -n libcom_err
+Summary: E2fsprogs error reporting library
+License: MIT
+Group: Base/File Systems
+
+%description -n libcom_err
+com_err is an error message display library.
+
+%package -n libcom_err-devel
+Summary: Development files for libcom_err
+License: MIT
+Group: Base/Development
+Requires: glibc-devel
+Requires: libcom_err = %version
+
+%description -n libcom_err-devel
+Development files for the com_err error message display library.
+
+%prep
+%setup -q
+cp %{SOURCE1001} .
+
+%build
+%{?asan:%restore_fcommon}
+export CFLAGS="${CFLAGS} -fPIE -flto "
+export LDFLAGS="${LDFLAGS} -pie -flto "
+%configure \
+ --disable-evms \
+ --with-root-prefix='' \
+ --enable-elf-shlibs \
+ --disable-libblkid \
+ --disable-libuuid \
+ --disable-uuidd \
+ --disable-nls \
+ --disable-fsck \
+ --enable-hardening \
+
+make %{?_smp_mflags} V=1
+
+%install
+make install install-libs DESTDIR=$RPM_BUILD_ROOT ELF_INSTALL_DIR=/%{_libdir}
+find "%buildroot/%_libdir" -type f -name "*.a" \
+ -print -delete
+# Let boot continue even if system clock is wrong
+install -p -m 644 %{SOURCE2} %{buildroot}/etc/e2fsck.conf
+
+
+rm $RPM_BUILD_ROOT%{_libdir}/e2initrd_helper
+rm -f $RPM_BUILD_ROOT/%{_sbindir}/mkfs.ext4dev
+rm -f $RPM_BUILD_ROOT/%{_sbindir}/fsck.ext4dev
+rm -f $RPM_BUILD_ROOT/usr/share/man/man8/mkfs.ext4dev.8*
+rm -f $RPM_BUILD_ROOT/usr/share/man/man8/fsck.ext4dev.8*
+
+mkdir -p %{buildroot}/%{_defaultdocdir}/%{name}
+install -p -m 644 README %{buildroot}/%{_defaultdocdir}/%{name}/README
+install -p -m 644 RELEASE-NOTES %{buildroot}/%{_defaultdocdir}/%{name}/RELEASE-NOTES
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%post -n libext2fs -p /sbin/ldconfig
+
+%postun -n libext2fs -p /sbin/ldconfig
+
+%post -n libcom_err -p /sbin/ldconfig
+
+%postun -n libcom_err -p /sbin/ldconfig
+
+%docs_package
+%doc %{_defaultdocdir}/%{name}/RELEASE-NOTES
+%doc %{_defaultdocdir}/%{name}/README
+
+%files devel
+%manifest %{name}.manifest
+%doc README
+
+%files
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%license NOTICE
+%config /etc/e2fsck.conf
+%config /etc/mke2fs.conf
+%config /etc/e2scrub.conf
+%{_sbindir}/badblocks
+%{_sbindir}/debugfs
+%{_sbindir}/dumpe2fs
+%{_sbindir}/e2undo
+%{_sbindir}/e2fsck
+%{_sbindir}/e2label
+%{_sbindir}/e2scrub
+%{_sbindir}/e2scrub_all
+%{_sbindir}/fsck.ext2
+%{_sbindir}/fsck.ext3
+%{_sbindir}/fsck.ext4
+%{_sbindir}/mke2fs
+%{_sbindir}/mkfs.ext2
+%{_sbindir}/mkfs.ext3
+%{_sbindir}/mkfs.ext4
+%{_sbindir}/resize2fs
+%{_sbindir}/tune2fs
+%{_sbindir}/e2image
+%{_sbindir}/logsave
+%{_bindir}/chattr
+%{_bindir}/lsattr
+%{_sbindir}/mklost+found
+%{_sbindir}/filefrag
+%{_sbindir}/e2freefrag
+%{_sbindir}/e2mmpstatus
+%{_sbindir}/e4crypt
+%{_sbindir}/e4defrag
+
+%files -n libext2fs
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%license NOTICE
+%{_libdir}/libext2fs.so.*
+%{_libdir}/libe2p.so.*
+
+%files -n libext2fs-devel
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%{_libdir}/libext2fs.so
+%{_libdir}/libe2p.so
+/usr/include/ext2fs
+/usr/include/e2p
+%_libdir/pkgconfig/e2p.pc
+%_libdir/pkgconfig/ext2fs.pc
+
+%files -n libcom_err
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%license debian/copyright
+%{_libdir}/libcom_err.so.*
+%{_libdir}/libss.so.*
+
+%files -n libcom_err-devel
+%manifest %{name}.manifest
+%defattr(-, root, root)
+%_bindir/compile_et
+%_bindir/mk_cmds
+%{_libdir}/libcom_err.so
+%{_libdir}/libss.so
+%_libdir/pkgconfig/com_err.pc
+%_libdir/pkgconfig/ss.pc
+%_includedir/com_err.h
+%_includedir/et
+%_includedir/ss
+%_datadir/et
+%_datadir/ss
+
+%changelog
blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
{
ext2_ino_t inode_count;
- dgrp_t groups, flex_groups;
+ dgrp_t groups;
blk64_t blks_needed, data_blocks;
blk64_t grp, data_needed, last_start;
blk64_t overhead = 0;
int old_desc_blocks;
+ int extra_groups = 0;
int flexbg_size = 1 << fs->super->s_log_groups_per_flex;
/*
* inode tables of slack space so the resize operation can be
* guaranteed to finish.
*/
- flex_groups = groups;
- if (ext2fs_has_feature_flex_bg(fs->super)) {
- dgrp_t remainder = groups & (flexbg_size - 1);
-
- flex_groups += flexbg_size - remainder;
- if (flex_groups > fs->group_desc_count)
- flex_groups = fs->group_desc_count;
+ if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) {
+ extra_groups = flexbg_size - (groups & (flexbg_size - 1));
+ data_needed += fs->inode_blocks_per_group * extra_groups;
+ extra_groups = groups % flexbg_size;
}
/*
*/
data_blocks = EXT2_GROUPS_TO_BLOCKS(fs->super, groups);
last_start = 0;
- for (grp = 0; grp < flex_groups; grp++) {
+ for (grp = 0; grp < groups; grp++) {
overhead = calc_group_overhead(fs, grp, old_desc_blocks);
/*
* the groups leading up to the last group so we can determine
* how big the last group needs to be
*/
- if (grp < (groups - 1))
+ if (grp != (groups - 1))
last_start += EXT2_BLOCKS_PER_GROUP(fs->super) -
overhead;
- if (data_blocks > overhead)
- data_blocks -= overhead;
- else
- data_blocks = 0;
+ data_blocks -= overhead;
}
#ifdef RESIZE2FS_DEBUG
if (flags & RESIZE_DEBUG_MIN_CALC)
* if we need more group descriptors in order to accommodate our data
* then we need to add them here
*/
- blks_needed = data_needed;
- while (blks_needed > data_blocks) {
- blk64_t remainder = blks_needed - data_blocks;
+ while (data_needed > data_blocks) {
+ blk64_t remainder = data_needed - data_blocks;
dgrp_t extra_grps;
/* figure out how many more groups we need for the data */
overhead = calc_group_overhead(fs, groups-1, old_desc_blocks);
last_start += EXT2_BLOCKS_PER_GROUP(fs->super) - overhead;
- grp = flex_groups;
- groups += extra_grps;
- if (!ext2fs_has_feature_flex_bg(fs->super))
- flex_groups = groups;
- else if (groups > flex_groups) {
- dgrp_t r = groups & (flexbg_size - 1);
-
- flex_groups = groups + flexbg_size - r;
- if (flex_groups > fs->group_desc_count)
- flex_groups = fs->group_desc_count;
- }
-
- for (; grp < flex_groups; grp++) {
+ for (grp = groups; grp < groups+extra_grps; grp++) {
overhead = calc_group_overhead(fs, grp,
old_desc_blocks);
* again, we need to see how much data we cram into
* all of the groups leading up to the last group
*/
- if (grp < groups - 1)
+ if (grp != (groups + extra_grps - 1))
last_start += EXT2_BLOCKS_PER_GROUP(fs->super)
- overhead;
data_blocks -= overhead;
}
+ groups += extra_grps;
+ extra_groups += extra_grps;
+ if (fs->super->s_feature_incompat
+ & EXT4_FEATURE_INCOMPAT_FLEX_BG
+ && extra_groups > flexbg_size) {
+ /*
+ * For ext4 we need to allow for up to a flex_bg worth
+ * of inode tables of slack space so the resize
+ * operation can be guaranteed to finish.
+ */
+ extra_groups = flexbg_size -
+ (groups & (flexbg_size - 1));
+ data_needed += (fs->inode_blocks_per_group *
+ extra_groups);
+ extra_groups = groups % flexbg_size;
+ }
#ifdef RESIZE2FS_DEBUG
if (flags & RESIZE_DEBUG_MIN_CALC)
printf("Added %d extra group(s), "
- "blks_needed %llu, data_blocks %llu, "
- "last_start %llu\n", extra_grps, blks_needed,
- data_blocks, last_start);
+ "data_needed %llu, data_blocks %llu, "
+ "last_start %llu\n",
+ extra_grps, data_needed, data_blocks,
+ last_start);
#endif
}
/* now for the fun voodoo */
- grp = groups - 1;
- if (ext2fs_has_feature_flex_bg(fs->super) &&
- (grp & ~(flexbg_size - 1)) == 0)
- grp = grp & ~(flexbg_size - 1);
- overhead = 0;
- for (; grp < flex_groups; grp++)
- overhead += calc_group_overhead(fs, grp, old_desc_blocks);
-
+ overhead = calc_group_overhead(fs, groups-1, old_desc_blocks);
#ifdef RESIZE2FS_DEBUG
if (flags & RESIZE_DEBUG_MIN_CALC)
printf("Last group's overhead is %llu\n", overhead);
* if this is the case then the last group is going to have data in it
* so we need to adjust the size of the last group accordingly
*/
- if (last_start < blks_needed) {
- blk64_t remainder = blks_needed - last_start;
+ if (last_start < data_needed) {
+ blk64_t remainder = data_needed - last_start;
#ifdef RESIZE2FS_DEBUG
if (flags & RESIZE_DEBUG_MIN_CALC)
printf("Final size of last group is %lld\n", overhead);
#endif
- /* Add extra slack for bigalloc file systems */
- if (EXT2FS_CLUSTER_RATIO(fs) > 1)
- overhead += EXT2FS_CLUSTER_RATIO(fs) * 2;
-
/*
- * since our last group doesn't have to be BLOCKS_PER_GROUP
- * large, we only do groups-1, and then add the number of
- * blocks needed to handle the group descriptor metadata+data
- * that we need
+ * since our last group doesn't have to be BLOCKS_PER_GROUP large, we
+ * only do groups-1, and then add the number of blocks needed to
+ * handle the group descriptor metadata+data that we need
*/
blks_needed = EXT2_GROUPS_TO_BLOCKS(fs->super, groups - 1);
blks_needed += overhead;
* We need to reserve a few extra blocks if extents are
* enabled, in case we need to grow the extent tree. The more
* we shrink the file system, the more space we need.
- *
- * The absolute worst case is every single data block is in
- * the part of the file system that needs to be evacuated,
- * with each data block needs to be in its own extent, and
- * with each inode needing at least one extent block.
*/
if (ext2fs_has_feature_extents(fs->super)) {
blk64_t safe_margin = (ext2fs_blocks_count(fs->super) -
blks_needed)/500;
- unsigned int exts_per_blk = (fs->blocksize /
- sizeof(struct ext3_extent)) - 1;
- blk64_t worst_case = ((data_needed + exts_per_blk - 1) /
- exts_per_blk);
-
- if (worst_case < inode_count)
- worst_case = inode_count;
-
- if (safe_margin > worst_case)
- safe_margin = worst_case;
#ifdef RESIZE2FS_DEBUG
if (flags & RESIZE_DEBUG_MIN_CALC)
}
resize_test () {
-DBG_FLAGS=63
echo $test_description starting > $LOG
rm -f $TMPFILE
echo $FSCK -fy $TMPFILE >> $LOG 2>&1
$FSCK -fy $TMPFILE >> $LOG 2>&1
-echo $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS $TMPFILE $SIZE_2 >> $LOG 2>&1
-if ! $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS $TMPFILE $SIZE_2 >> $LOG 2>&1
+echo $RESIZE2FS $RESIZE2FS_OPTS -d 31 $TMPFILE $SIZE_2 >> $LOG 2>&1
+if ! $RESIZE2FS $RESIZE2FS_OPTS -d 31 $TMPFILE $SIZE_2 >> $LOG 2>&1
then
return 1
fi
return 1
fi
-# Uncomment to grab extra debugging image
-#
-#mv $TMPFILE /tmp/foo.img
-#return 0
-
-echo $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS -M $TMPFILE $SIZE_2 >> $LOG 2>&1
-if ! $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS -M $TMPFILE $SIZE_2 >> $LOG 2>&1
+echo $RESIZE2FS $RESIZE2FS_OPTS -d 31 -M $TMPFILE $SIZE_2 >> $LOG 2>&1
+if ! $RESIZE2FS $RESIZE2FS_OPTS -d 31 -M $TMPFILE $SIZE_2 >> $LOG 2>&1
then
return 1
fi
return 1
fi
-echo $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS -M $TMPFILE $SIZE_2 >> $LOG 2>&1
-if ! $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS -M $TMPFILE $SIZE_2 >> $LOG 2>&1
+echo $RESIZE2FS $RESIZE2FS_OPTS -d 31 -M $TMPFILE $SIZE_2 >> $LOG 2>&1
+if ! $RESIZE2FS $RESIZE2FS_OPTS -d 31 -M $TMPFILE $SIZE_2 >> $LOG 2>&1
then
return 1
fi
return 1
fi
-echo $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS -M $TMPFILE $SIZE_2 >> $LOG 2>&1
-if ! $RESIZE2FS $RESIZE2FS_OPTS -d $DBG_FLAGS -M $TMPFILE $SIZE_2 >> $LOG 2>&1
+echo $RESIZE2FS $RESIZE2FS_OPTS -d 31 -M $TMPFILE $SIZE_2 >> $LOG 2>&1
+if ! $RESIZE2FS $RESIZE2FS_OPTS -d 31 -M $TMPFILE $SIZE_2 >> $LOG 2>&1
then
return 1
fi