Changeset fc840d9 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2008-10-27T16:53:38Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7a5cdded
Parents:
04619ba
Message:

Move libfs_blockread(), block_get() and block_put() to libblock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    r04619ba rfc840d9  
    4141#include "../../vfs/vfs.h"
    4242#include <libfs.h>
     43#include <libblock.h>
    4344#include <ipc/ipc.h>
    4445#include <ipc/services.h>
     
    6061/** List of cached free FAT nodes. */
    6162static LIST_INITIALIZE(ffn_head);
    62 
    63 static int dev_phone = -1;              /* FIXME */
    64 static void *dev_buffer = NULL;         /* FIXME */
    65 
    66 block_t *block_get(dev_handle_t dev_handle, off_t offset, size_t bs)
    67 {
    68         /* FIXME */
    69         block_t *b;
    70         off_t bufpos = 0;
    71         size_t buflen = 0;
    72         off_t pos = offset * bs;
    73 
    74         assert(dev_phone != -1);
    75         assert(dev_buffer);
    76 
    77         b = malloc(sizeof(block_t));
    78         if (!b)
    79                 return NULL;
    80        
    81         b->data = malloc(bs);
    82         if (!b->data) {
    83                 free(b);
    84                 return NULL;
    85         }
    86         b->size = bs;
    87 
    88         if (!libfs_blockread(dev_phone, dev_buffer, &bufpos, &buflen, &pos,
    89             b->data, bs, bs)) {
    90                 free(b->data);
    91                 free(b);
    92                 return NULL;
    93         }
    94 
    95         return b;
    96 }
    97 
    98 void block_put(block_t *block)
    99 {
    100         /* FIXME */
    101         free(block->data);
    102         free(block);
    103 }
    10463
    10564static void fat_node_initialize(fat_node_t *node)
Note: See TracChangeset for help on using the changeset viewer.