Author: quozl
Date: Fri Apr 20 09:07:04 2012
New Revision: 2947
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2947
Log:
ext2fs - fix inode reference count for directories on filesystems without DIR_NLINK, and maintain directory count in group descriptor, #11787
Modified:
ofw/fs/ext2fs/bitmap.fth
ofw/fs/ext2fs/dir.fth
ofw/fs/ext2fs/sb.fth
Modified: ofw/fs/ext2fs/bitmap.fth
==============================================================================
--- ofw/fs/ext2fs/bitmap.fth Thu Apr 19 21:05:54 2012 (r2946)
+++ ofw/fs/ext2fs/bitmap.fth Fri Apr 20 09:07:04 2012 (r2947)
@@ -75,11 +75,32 @@
then ( n r: adr )
r> h# 0e + le-w! ( )
;
-: free-inodes+! ( n inode# -- )
+: free-inodes+! ( n group# -- )
tuck free-inodes@ + ( group# n' )
over free-inodes! ( group# )
gd-update ( )
;
+: used-dirs@ ( group# -- n )
+ group-desc dup h# 10 + le-w@ ( adr lo )
+ desc64? if ( adr lo )
+ swap h# 30 + le-w@ wljoin ( n )
+ else ( adr lo )
+ nip ( n )
+ then ( n )
+;
+: used-dirs! ( n group# -- )
+ group-desc >r ( n r: adr )
+ desc64? if ( n r: adr )
+ lwsplit ( lo hi r: adr )
+ r@ h# 30 + le-w! ( lo r: adr )
+ then ( n r: adr )
+ r> h# 10 + le-w! ( )
+;
+: used-dirs+! ( n group# -- )
+ tuck used-dirs@ + ( group# n' )
+ over used-dirs! ( group# )
+ gd-update ( )
+;
[ifdef] 386-assembler
code find-low-zero ( n -- bit# )
Modified: ofw/fs/ext2fs/dir.fth
==============================================================================
--- ofw/fs/ext2fs/dir.fth Thu Apr 19 21:05:54 2012 (r2946)
+++ ofw/fs/ext2fs/dir.fth Fri Apr 20 09:07:04 2012 (r2947)
@@ -78,7 +78,7 @@
: +link-count ( increment -- )
\ link-count = 1 means that the directory has more links than can
\ be represented in a 16-bit number; don't increment in that case.
- dir? if ( increment )
+ dir? sb-nlink? and if ( increment )
link-count 1 = if ( increment )
drop exit ( -- )
then ( increment )
@@ -89,7 +89,7 @@
\ If the incremented value exceeds the limit, store 1
\ We should also set the RO_COMPAT_DIR_NLINK bit in the superblock,
\ but we assume that OFW won't be used to create enormous directories
- dir? if ( link-count )
+ dir? sb-nlink? and if ( link-count )
dup d# 65000 >= if ( link-count )
drop 1 ( link-count' )
then ( link-count' )
@@ -106,6 +106,9 @@
dup ctime! ( time ) \ set creation time
mtime! ( ) \ set modification time
0 link-count! ( ) \ link count will be incremented by new-dirent
+ dir? if
+ 1 inode# 1- ipg / used-dirs+!
+ then
inode# ( inode# )
;
@@ -214,6 +217,10 @@
\ Delete the currently selected inode. Does not affect the directory entry, if any.
: idelete ( -- )
+ dir? if
+ -1 inode# 1- ipg / used-dirs+!
+ then
+
\ Short symlinks hold no blocks, but have a string in the direct block list,
\ so we must not interpret that string as a block list.
d.#blks-held d0<> if
@@ -276,7 +283,7 @@
new-inode ( name$ inode# )
\ new-inode changed the value of inode#; we must restore it so
- \ new-dirent can find info about the containing diretory
+ \ new-dirent can find info about the containing directory
wd-inum set-inode ( name$ inode# )
new-dirent ( error? )
Modified: ofw/fs/ext2fs/sb.fth
==============================================================================
--- ofw/fs/ext2fs/sb.fth Thu Apr 19 21:05:54 2012 (r2946)
+++ ofw/fs/ext2fs/sb.fth Fri Apr 20 09:07:04 2012 (r2947)
@@ -57,6 +57,7 @@
: sb-64bit? ( -- flag ) incompat-flags h# 80 and 0<> ;
: sb-extents? ( -- flag ) incompat-flags h# 40 and 0<> ;
: sb-gd-csum? ( -- flag ) ro-flags h# 10 and 0<> ;
+: sb-nlink? ( -- flag ) ro-flags h# 20 and 0<> ;
\ Don't write to a disk that uses extensions we don't understand
: unknown-extensions? ( -- unsafe? )
Author: wmb
Date: Thu Apr 19 21:05:54 2012
New Revision: 2946
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2946
Log:
OLPC trac 11786 - fixed bug with file deletion introduced by svn 2817.
Modified:
ofw/fs/ext2fs/dir.fth
Modified: ofw/fs/ext2fs/dir.fth
==============================================================================
--- ofw/fs/ext2fs/dir.fth Thu Apr 19 03:43:07 2012 (r2945)
+++ ofw/fs/ext2fs/dir.fth Thu Apr 19 21:05:54 2012 (r2946)
@@ -77,15 +77,25 @@
: +link-count ( increment -- )
\ link-count = 1 means that the directory has more links than can
- \ be represented in a 16-bit number
- link-count 1 = if drop exit then \ Don't increment if already 1
+ \ be represented in a 16-bit number; don't increment in that case.
+ dir? if ( increment )
+ link-count 1 = if ( increment )
+ drop exit ( -- )
+ then ( increment )
+ then ( increment )
+
+ link-count + ( link-count' )
\ If the incremented value exceeds the limit, store 1
\ We should also set the RO_COMPAT_DIR_NLINK bit in the superblock,
- \ but we assume that OFW won't really be used to create enormous directories
- link-count + dup d# 65000 >= if drop 1 then ( link-count )
+ \ but we assume that OFW won't be used to create enormous directories
+ dir? if ( link-count )
+ dup d# 65000 >= if ( link-count )
+ drop 1 ( link-count' )
+ then ( link-count' )
+ then ( link-count )
- link-count!
+ link-count! ( )
;
: new-inode ( mode -- inode# )
Author: quozl
Date: Fri Apr 13 07:01:36 2012
New Revision: 2943
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2943
Log:
disklabel - file spec parsing, avoid treating a-h as partition letter if UFS partition support is disabled.
Modified:
ofw/disklabel/methods.fth
Modified: ofw/disklabel/methods.fth
==============================================================================
--- ofw/disklabel/methods.fth Fri Apr 13 01:28:34 2012 (r2942)
+++ ofw/disklabel/methods.fth Fri Apr 13 07:01:36 2012 (r2943)
@@ -200,12 +200,14 @@
dup 0= if exit then ( adr len )
then
+[ifdef] ufs-support
\ If the first character is "a".."h", it's a UFS partition letter
over c@ lcc ascii a ascii h between if ( adr len )
over c@ to ufs-partition ( adr len )
1 /string ( adr' len' )
dup 0= if exit then ( adr len )
then ( adr len )
+[then]
;
: parse-partition ( -- )
null$ to filename null$ to partition-name$ -1 to #part 0 to ufs-partition