#define DDOFF(f) bitize(offsetof(xfs_dqblk_t, dd_ ## f)) #define DDSZC(f) szcount(xfs_dqblk_t, dd_ ## f) const field_t dqblk_flds[] = { { "diskdq", FLDT_DISK_DQUOT, OI(DDOFF(diskdq)), C1, 0, TYP_NONE }, { "fill", FLDT_CHARS, OI(DDOFF(fill)), CI(DDSZC(fill)), FLD_SKIPALL, TYP_NONE }, { "crc", FLDT_CRC, OI(DDOFF(crc)), C1, 0, TYP_NONE }, { "lsn", FLDT_UINT64X, OI(DDOFF(lsn)), C1, 0, TYP_NONE }, { "uuid", FLDT_UUID, OI(DDOFF(uuid)), C1, 0, TYP_NONE }, { NULL } }; #define DOFF(f) bitize(offsetof(xfs_disk_dquot_t, d_ ## f)) const field_t disk_dquot_flds[] = { { "magic", FLDT_UINT16X, OI(DOFF(magic)), C1, 0, TYP_NONE }, { "version", FLDT_UINT8X, OI(DOFF(version)), C1, 0, TYP_NONE }, { "flags", FLDT_UINT8X, OI(DOFF(flags)), C1, 0, TYP_NONE }, { "id", FLDT_DQID, OI(DOFF(id)), C1, 0, TYP_NONE }, { "blk_hardlimit", FLDT_QCNT, OI(DOFF(blk_hardlimit)), C1, 0, TYP_NONE }, { "blk_softlimit", FLDT_QCNT, OI(DOFF(blk_softlimit)), C1, 0, TYP_NONE }, { "ino_hardlimit", FLDT_QCNT, OI(DOFF(ino_hardlimit)), C1, 0, TYP_NONE }, { "ino_softlimit", FLDT_QCNT, OI(DOFF(ino_softlimit)), C1, 0, TYP_NONE }, { "bcount", FLDT_QCNT, OI(DOFF(bcount)), C1, 0, TYP_NONE }, { "icount", FLDT_QCNT, OI(DOFF(icount)), C1, 0, TYP_NONE }, { "itimer", FLDT_INT32D, OI(DOFF(itimer)), C1, 0, TYP_NONE }, { "btimer", FLDT_INT32D, OI(DOFF(btimer)), C1, 0, TYP_NONE },
static void handle_hit( Blob **blobs, int nblobs, struct object *res, int docid, double *field_c[65], double *prox_c[8], double mc, double mp, int cutoff ) { int i, j, k, end = 0; Hit *hits = calloc( nblobs, sizeof(Hit) ); unsigned char *nhits = malloc( nblobs ); unsigned char *pos = malloc( nblobs ); int matrix[65][8]; memset(matrix, 0, sizeof(matrix) ); for( i = 0; i<nblobs; i++ ) nhits[i] = wf_blob_nhits( blobs[i] ); for( i = 0; i<nblobs; i++ ) { memset( pos, 0, nblobs ); for( j = 0; j<nhits[i]; j++ ) { hits[i] = wf_blob_hit( blobs[i], j ); matrix[MOFF(hits[i])][3]++; /* forward the other positions */ for( k = 0; k<nblobs; k++ ) if( k != i && pos[ k ] < nhits[ k ] ) { while( (hits[k].raw < hits[i].raw) && (pos[ k ] < nhits[ k ])) hits[k] = wf_blob_hit( blobs[k], pos[k]++ ); if( (pos[ k ] < nhits[ k ]) && hits[k].type == hits[i].type ) matrix[MOFF(hits[i])][DOFF(OFFSET(hits[k])-OFFSET(hits[i]))]+=4; } } } free( pos ); free( nhits ); free( hits ); /* Now we have our nice matrix. Time to do some multiplication */ { double accum = 0.0, fc, pc; int accum_i; for( i = 0; i<65; i++ ) if( (fc = (*field_c)[i]) != 0.0 ) for( j = 0; j<8; j++ ) if( (pc = (*prox_c)[j]) != 0.0 ) accum += (MINIMUM(matrix[i][j],cutoff)*fc*pc) / (mc*mp); /* Limit */ if( accum > 32000.0 ) accum = 32000.0; accum_i = (int)(accum *100 ) + 1; if( accum > 0.0 ) wf_resultset_add( res, docid, accum_i ); } }