Subversion Repositories HelenOS

Rev

Rev 3548 | Rev 3572 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3548 Rev 3550
Line 111... Line 111...
111
    block_t *b;
111
    block_t *b;
112
    fat_bs_t *bs;
112
    fat_bs_t *bs;
113
    fat_dentry_t *d;
113
    fat_dentry_t *d;
114
    fat_node_t *nodep = NULL;
114
    fat_node_t *nodep = NULL;
115
    unsigned bps;
115
    unsigned bps;
-
 
116
    unsigned spc;
116
    unsigned dps;
117
    unsigned dps;
117
 
118
 
118
    if (idxp->nodep) {
119
    if (idxp->nodep) {
119
        /*
120
        /*
120
         * We are lucky.
121
         * We are lucky.
Line 162... Line 163...
162
    }
163
    }
163
    fat_node_initialize(nodep);
164
    fat_node_initialize(nodep);
164
 
165
 
165
    bs = block_bb_get(idxp->dev_handle);
166
    bs = block_bb_get(idxp->dev_handle);
166
    bps = uint16_t_le2host(bs->bps);
167
    bps = uint16_t_le2host(bs->bps);
-
 
168
    spc = bs->spc;
167
    dps = bps / sizeof(fat_dentry_t);
169
    dps = bps / sizeof(fat_dentry_t);
168
 
170
 
169
    /* Read the block that contains the dentry of interest. */
171
    /* Read the block that contains the dentry of interest. */
170
    b = _fat_block_get(bs, idxp->dev_handle, idxp->pfc,
172
    b = _fat_block_get(bs, idxp->dev_handle, idxp->pfc,
171
        (idxp->pdi * sizeof(fat_dentry_t)) / bps);
173
        (idxp->pdi * sizeof(fat_dentry_t)) / bps);
Line 182... Line 184...
182
        /*
184
        /*
183
         * Unfortunately, the 'size' field of the FAT dentry is not
185
         * Unfortunately, the 'size' field of the FAT dentry is not
184
         * defined for the directory entry type. We must determine the
186
         * defined for the directory entry type. We must determine the
185
         * size of the directory by walking the FAT.
187
         * size of the directory by walking the FAT.
186
         */
188
         */
187
        nodep->size = bps * _fat_blcks_get(bs, idxp->dev_handle,
189
        nodep->size = bps * spc * fat_clusters_get(bs, idxp->dev_handle,
188
            uint16_t_le2host(d->firstc), NULL);
190
            uint16_t_le2host(d->firstc));
189
    } else {
191
    } else {
190
        nodep->type = FAT_FILE;
192
        nodep->type = FAT_FILE;
191
        nodep->size = uint32_t_le2host(d->size);
193
        nodep->size = uint32_t_le2host(d->size);
192
    }
194
    }
193
    nodep->firstc = uint16_t_le2host(d->firstc);
195
    nodep->firstc = uint16_t_le2host(d->firstc);