comparison src/cs/drivers/drv_app/ffs/board/fsck.c @ 191:4725fe5932c4

FFS journal_init() bugfix from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 22 May 2020 18:04:44 +0000
parents b6a5e36de839
children
comparison
equal deleted inserted replaced
190:49c7ed5eeadd 191:4725fe5932c4
1245 // case. Otherwise, if journal file is clean (no journals pending) and all 1245 // case. Otherwise, if journal file is clean (no journals pending) and all
1246 // is fine, return EFFS_OK. 1246 // is fine, return EFFS_OK.
1247 effs_t journal_init(iref_t i) 1247 effs_t journal_init(iref_t i)
1248 { 1248 {
1249 int j; 1249 int j;
1250 struct inode_s *ip = inode_addr(i); 1250 struct inode_s *ip;
1251 struct journal_s *addr; 1251 struct journal_s *addr;
1252 1252
1253 if (i == 0) { 1253 if (i == 0) {
1254 // Journal file does not exist, so create it 1254 // Journal file does not exist, so create it
1255 if ((i = journal_create(0)) <= 0) { 1255 if ((i = journal_create(0)) <= 0) {
1258 } 1258 }
1259 } 1259 }
1260 1260
1261 fs.journal_depth = 0; 1261 fs.journal_depth = 0;
1262 fs.journal_pos = JOURNAL_POS_INITIAL; 1262 fs.journal_pos = JOURNAL_POS_INITIAL;
1263 ip = inode_addr(i);
1263 1264
1264 addr = (struct journal_s *) 1265 addr = (struct journal_s *)
1265 offset2addr(location2offset(ip->location) + fs.journal_pos); 1266 offset2addr(location2offset(ip->location) + fs.journal_pos);
1266 1267
1267 tw(tr(TR_BEGIN, TrJournal, "journal_init(%d) {\n", i)); 1268 tw(tr(TR_BEGIN, TrJournal, "journal_init(%d) {\n", i));