Changeset 12

Show
Ignore:
Timestamp:
10/28/07 17:40:01 (10 months ago)
Author:
dmajnem2
Message:

Fixed compile errors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tarfs/tarfs.c

    r11 r12  
    11#include <stdlib.h> 
    22#include <stdio.h> 
     3 
     4#include <errno.h> 
     5#include <fcntl.h> 
    36 
    47#include <string.h> 
     
    1720#define false       0 
    1821#define eprintf(...) fprintf(stderr, __VA_ARGS__) 
     22 
    1923 
    2024typedef struct posix_header posix_header; 
     
    6973 
    7074static int tarfs_readdir(const char *file_path, void *buffer, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi){ 
    71         char buffer[BLOCK_SIZE]; 
    7275        char *result; 
    7376        char delims[]="/"; 
    7477        inode *i=file_tree, *node; 
    75         int size; 
    7678         
    7779        /* Traverse the file tree */ 
     
    104106} 
    105107 
    106 static int tarfs_getattr(const char*, struct stat*
     108static int tarfs_getattr(const char *file_path, struct stat *stbuf
    107109{ 
    108110   int res = 0; 
     
    112114} 
    113115 
    114 static int tarfs_read(const char *file_path, void *buffer, size_t size, off_t offset, struct fuse_file_info *fi); 
     116static int tarfs_read(const char *file_path, void *buffer, size_t size, off_t offset, struct fuse_file_info *fi){ 
    115117        char *result; 
    116118        char delims[]="/"; 
     
    144146        if (offset < len) { 
    145147                /* Seek to the position of the file in the tar */ 
    146                 fseek(file, node->block_offset, SEEK_SET); 
     148                fseek(tar_file, node->block_offset, SEEK_SET); 
    147149 
    148150                /* Seek to the requested offset */ 
    149                 fseek(file, offset, SEEK_CUR); 
     151                fseek(tar_file, offset, SEEK_CUR); 
    150152 
    151153                /* Do the actual read */ 
    152                 size = fread(buffer, sizeof(char), len, file); 
     154                size = fread(buffer, sizeof(char), len, tar_file); 
    153155        } else 
    154156                size = 0; 
    155157 
    156         fflush(file); 
    157         return size;    
     158        fflush(tar_file); 
     159        return size; 
    158160} 
    159161 
     
    234236        while(i){ 
    235237                if(i->subdir && !i->special ) 
    236                         destroy_file_tree(i->subdir); 
     238                        tarfs_destroy(i->subdir); 
    237239                j=i; 
    238240                i=i->next; 
     
    254256                printf("%s%s (offset=%i, length=%i)\n",tabs,i->file_name,i->block_offset,i->file_length); 
    255257                if( i->subdir && !i->special ) 
    256                         print_tree(i->subdir, tab+3); 
     258                        tarfs_print(i->subdir, tab+3); 
    257259                i=i->next; 
    258260        } 
     
    266268        .readdir = tarfs_readdir, 
    267269        .destroy = tarfs_destroy 
    268 } 
     270}; 
    269271 
    270272int main(int argc, char **argv){ 
     
    276278                case 'f': 
    277279                { 
    278                         tar_file = fopen(optarg); 
     280                        tar_file = fopen(optarg, "r"); 
    279281                        if( !tar_file ){ 
    280282                                eprintf("Invalid filename: %s\n", optarg); 
     
    299301        } 
    300302 
    301         return fuse_main(argc, argv, tarfs_opers); 
    302 } 
     303        return fuse_main(argc, argv, &tarfs_oper); 
     304}