Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/mfs/mfs_rw.c

    r7a46bfe r36cb22f  
    3131 */
    3232
     33#include <align.h>
    3334#include "mfs.h"
    3435
     
    5354 *bytes, this function returns the on-disk block
    5455 *relative to that position.
    55  *Returns zero if the block does not exist.
     56 *
     57 * @param b     Pointer to a 32bit number where the block number will be stored
     58 * @param mnode Pointer to a generic MINIX inode in memory.
     59 * @param pos   Position in file.
     60 *
     61 * @return      EOK on success or a negative error code.
    5662 */
    5763int
     
    6571        int rblock = pos / block_size;
    6672
    67         if (mnode->ino_i->i_size < pos) {
     73        if (ROUND_UP(mnode->ino_i->i_size, sbi->block_size) < pos) {
    6874                /*Trying to read beyond the end of file*/
    6975                r = EOK;
     
    227233}
    228234
    229 /*Free unused indirect zones*/
     235/**Free unused indirect zones from a MINIX inode according to it's new size.
     236 *
     237 * @param mnode         Pointer to a generic MINIX inode in memory.
     238 * @param new_size      The new size of the inode.
     239 *
     240 * @return              EOK on success or a negative error code.
     241 */
    230242int
    231243mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size)
     
    239251        mfs_version_t fs_version = sbi->fs_version;
    240252       
     253        assert(new_size <= ino_i->i_size);
     254
    241255        if (fs_version == MFS_VERSION_V1) {
    242256                nr_direct = V1_NR_DIRECT_ZONES;
Note: See TracChangeset for help on using the changeset viewer.