Changeset 7a819535 in mainline


Ignore:
Timestamp:
2011-06-12T05:29:50Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b12edd1
Parents:
52ee8b7a
Message:

Add crc32 calculation to filegen utility.

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/filegen/Makefile

    r52ee8b7a r7a819535  
    3232
    3333SOURCES = \
    34         filegen.c
     34        filegen.c \
     35        crc32.c
    3536
    3637include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/filegen/filegen.c

    r52ee8b7a r7a819535  
    1818#include <errno.h>
    1919#include <sys/time.h>
     20#include "crc32.h"
    2021
    2122#define NAME    "filegen"
    2223#define VERSION "0.0.1"
     24
     25#define BUFFERSIZE 256
     26
    2327
    2428static void print_help(void);
     
    4650        }
    4751       
    48         size = size / sizeof(int);
    49 
    5052        struct timeval tv;     
    5153        gettimeofday(&tv, NULL);
    5254        srandom(tv.tv_sec + tv.tv_usec / 100000);       
    5355
    54         uint32_t i;
    55         int dword=0;
    56         for (i = 0; i<size; i++) {
    57                 dword = rand();
    58                 write(fd, &dword, sizeof(int));
     56        uint64_t i=0, pbuf=0;
     57        uint32_t crc=~0;
     58        char buf[BUFFERSIZE];
     59       
     60        while (i<size) {
     61                pbuf=0;
     62                while (i<size && pbuf<BUFFERSIZE) {
     63                        buf[pbuf] = rand() % 255;
     64                        i++;
     65                        pbuf++;
     66                }
     67                if (pbuf) {
     68                        crc32(buf, pbuf, &crc);
     69                        write(fd, buf, pbuf);
     70                }
    5971        }
    60 
     72       
    6173        close(fd);
     74        crc = ~crc;
     75        printf("%s: %x\n", argv[1], crc);
    6276
    6377        return 0;
  • uspace/srv/fs/fat/fat_directory.c

    r52ee8b7a r7a819535  
    8888                        rc = fat_block_get(&di->b, di->bs, di->nodep, i, BLOCK_FLAGS_NONE);
    8989                        if (rc != EOK) {
    90                                 di->b = NULL:
     90                                di->b = NULL;
    9191                                return rc;
    9292                        }
Note: See TracChangeset for help on using the changeset viewer.