static struct buffer_head *qnx4_getblk(struct inode *inode, int nr, int create) { struct buffer_head *result = NULL; if ( nr >= 0 ) nr = qnx4_block_map( inode, nr ); if (nr) { result = sb_getblk(inode->i_sb, nr); return result; } if (!create) { return NULL; } #if 0 tmp = qnx4_new_block(inode->i_sb); if (!tmp) { return NULL; } result = sb_getblk(inode->i_sb, tmp); if (tst) { qnx4_free_block(inode->i_sb, tmp); brelse(result); goto repeat; } tst = tmp; #endif inode->i_ctime = CURRENT_TIME_SEC; mark_inode_dirty(inode); return result; }
static int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_head *bh, int create ) { unsigned long phys; QNX4DEBUG((KERN_INFO "qnx4: qnx4_get_block inode=[%ld] iblock=[%ld]\n",inode->i_ino,iblock)); phys = qnx4_block_map( inode, iblock ); if ( phys ) { // logical block is before EOF map_bh(bh, inode->i_sb, phys); } return 0; }
static struct buffer_head *qnx4_getblk(struct inode *inode, int nr, int create) { struct buffer_head *result = NULL; if ( nr >= 0 ) nr = qnx4_block_map( inode, nr ); if (nr) { result = sb_getblk(inode->i_sb, nr); return result; } return NULL; }
static struct buffer_head *qnx4_find_entry(int len, struct inode *dir, const char *name, struct qnx4_inode_entry **res_dir, int *ino) { unsigned long block, offset, blkofs; struct buffer_head *bh; *res_dir = NULL; if (!dir->i_sb) { printk(KERN_WARNING "qnx4: no superblock on dir.\n"); return NULL; } bh = NULL; block = offset = blkofs = 0; while (blkofs * QNX4_BLOCK_SIZE + offset < dir->i_size) { if (!bh) { block = qnx4_block_map(dir, blkofs); if (block) bh = sb_bread(dir->i_sb, block); if (!bh) { blkofs++; continue; } } *res_dir = (struct qnx4_inode_entry *) (bh->b_data + offset); if (qnx4_match(len, name, bh, &offset)) { *ino = block * QNX4_INODES_PER_BLOCK + (offset / QNX4_DIR_ENTRY_SIZE) - 1; return bh; } if (offset < bh->b_size) { continue; } brelse(bh); bh = NULL; offset = 0; blkofs++; } brelse(bh); *res_dir = NULL; return NULL; }