/* Sync one block full of indirect pointers and read it because we'll need it. */ static int sync_iblock (struct inode * inode, u32 * iblockp, int convert, struct buffer_head * *bh, int wait) { int rc; u32 tmp, block; *bh = NULL; block = tmp = *iblockp; if (convert) block = from_coh_ulong(block); if (!block) return 0; rc = sync_block (inode, iblockp, convert, wait); if (rc) return rc; *bh = sv_bread(inode->i_sb, inode->i_dev, block); if (tmp != *iblockp) { brelse(*bh); *bh = NULL; return 1; } if (!*bh) return -1; return 0; }
/* synchronize and return pointers */ int sync_blockp(int blocksize_samples, csample_t **buffers_in, int *nsamples_ret, csample_t **buffersret, float *fracdiffs, float *phasediffs) { const int skipfirst = conf.sync_end, skipfirst_sync = conf.sync_start; float timediffs[NRECEIVERS_MAX] = {0}; int ri, ret; csample_t *buffers[NRECEIVERS_MAX]; for(ri = 0; ri < nreceivers; ri++) { buffers[ri] = buffers_in[ri] + skipfirst_sync; } blocksize_samples -= skipfirst_sync; ret = sync_block(blocksize_samples, buffers, timediffs, phasediffs); if(ret < 0) return ret; *nsamples_ret = blocksize_samples - corrlen*4 - skipfirst; for(ri = 0; ri < nreceivers; ri++) { float td, td_int, td_frac; td = timediffs[ri]; td_int = floor(td); td_frac = td - td_int; buffersret[ri] = buffers[ri] + corrlen*2 - (int)td_int + skipfirst; fracdiffs[ri] = td_frac; } return 0; }
static int sync_direct (struct inode * inode, int wait) { int i; int rc, err = 0; for (i = 0; i < EXT2_NDIR_BLOCKS; i++) { rc = sync_block (inode, inode->u.ext2_i.i_data + i, wait); if (rc > 0) break; if (rc) err = rc; } return err; }
static int sync_direct(struct inode *inode, int wait) { int i; int rc, err = 0; for (i = 0; i < 10; i++) { rc = sync_block (inode, inode->u.sysv_i.i_data + i, 0, wait); if (rc > 0) break; if (rc) err = rc; } return err; }
static int sync_direct(struct inode *inode, int wait) { int i; int rc, err = 0; for (i = 0; i < 7; i++) { rc = sync_block(inode, (unsigned short *) inode->u.qnx4_i.i_first_xtnt.xtnt_blk + i, wait); if (rc > 0) break; if (rc) err = rc; } return err; }
static int sync_indirect (struct inode * inode, u32 * iblock, int wait) { int i; struct buffer_head * ind_bh; int rc, err = 0; rc = sync_iblock (inode, iblock, &ind_bh, wait); if (rc || !ind_bh) return rc; for (i = 0; i < addr_per_block; i++) { rc = sync_block (inode, ((u32 *) ind_bh->b_data) + i, wait); if (rc > 0) break; if (rc) err = rc; } brelse (ind_bh); return err; }
static int sync_iblock (struct inode * inode, u32 * iblock, struct buffer_head ** bh, int wait) { int rc, tmp; *bh = NULL; tmp = *iblock; if (!tmp) return 0; rc = sync_block (inode, iblock, wait); if (rc) return rc; *bh = bread (inode->i_dev, tmp, blocksize); if (tmp != *iblock) { brelse (*bh); *bh = NULL; return 1; } if (!*bh) return -1; return 0; }
static int sync_indirect(struct inode *inode, u32 *iblockp, int convert, int wait) { int i; struct buffer_head * ind_bh; int rc, err = 0; struct super_block * sb; rc = sync_iblock (inode, iblockp, convert, &ind_bh, wait); if (rc || !ind_bh) return rc; sb = inode->i_sb; for (i = 0; i < sb->sv_ind_per_block; i++) { rc = sync_block (inode, ((u32 *) ind_bh->b_data) + i, sb->sv_convert, wait); if (rc > 0) break; if (rc) err = rc; } brelse(ind_bh); return err; }