OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /eco32/trunk
    from Rev 259 to Rev 260
    Reverse comparison

Rev 259 → Rev 260

/disk/tools/fs-EOS32/mkfs/mkfs.c
26,9 → 26,9
#define DOUBLE_INDIR (NDADDR + 1) /* index of double indirect block */
#define DIRSIZ 60 /* max length of a path name component */
 
#define NIPB (BSIZE / sizeof(Dinode))
#define NDIRENT (BSIZE / sizeof(Dirent))
#define NINDIR (BSIZE / sizeof(EOS32_daddr_t))
#define NIPB (BSIZE / (int) sizeof(Dinode))
#define NDIRENT (BSIZE / (int) sizeof(Dirent))
#define NINDIR (BSIZE / (int) sizeof(EOS32_daddr_t))
 
#define SUPER_MAGIC 0x44FCB67D
 
71,10 → 71,10
 
/* EOS32 types */
 
typedef unsigned long EOS32_ino_t;
typedef unsigned long EOS32_daddr_t;
typedef unsigned long EOS32_off_t;
typedef long EOS32_time_t;
typedef unsigned int EOS32_ino_t;
typedef unsigned int EOS32_daddr_t;
typedef unsigned int EOS32_off_t;
typedef int EOS32_time_t;
 
 
/* super block */
448,7 → 448,7
/**************************************************************/
 
 
unsigned long fsStart; /* file system start sector */
unsigned int fsStart; /* file system start sector */
 
 
void rdfs(EOS32_daddr_t bno, unsigned char *bf, int blkType) {
457,7 → 457,7
fseek(fs, fsStart * SSIZE + bno * BSIZE, SEEK_SET);
n = fread(bf, 1, BSIZE, fs);
if (n != BSIZE) {
printf("read error: %ld\n", bno);
printf("read error: %d\n", bno);
exit(1);
}
switch (blkType) {
515,7 → 515,7
fseek(fs, fsStart * SSIZE + bno * BSIZE, SEEK_SET);
n = fwrite(bf, 1, BSIZE, fs);
if(n != BSIZE) {
printf("write error: %ld\n", bno);
printf("write error: %d\n", bno);
exit(1);
}
switch (blkType) {
627,9 → 627,9
}
 
 
long getNum(void) {
int getNum(void) {
int i, c;
long n;
int n;
 
getStr();
n = 0;
982,10 → 982,10
printf("NIPB = %d\n", NIPB);
printf("NDIRENT = %d\n", NDIRENT);
printf("NINDIR = %d\n", NINDIR);
printf("sizeof(Filsys) = %d\n", sizeof(Filsys));
printf("sizeof(Dinode) = %d\n", sizeof(Dinode));
printf("sizeof(Dirent) = %d\n", sizeof(Dirent));
printf("sizeof(Fblk) = %d\n", sizeof(Fblk));
printf("sizeof(Filsys) = %d\n", (int) sizeof(Filsys));
printf("sizeof(Dinode) = %d\n", (int) sizeof(Dinode));
printf("sizeof(Dirent) = %d\n", (int) sizeof(Dirent));
printf("sizeof(Fblk) = %d\n", (int) sizeof(Fblk));
}
 
 
993,12 → 993,12
char *fsnam;
char *proto;
char protoBuf[20];
unsigned long fsSize;
unsigned int fsSize;
int part;
char *endptr;
unsigned char partTable[SSIZE];
unsigned char *ptptr;
unsigned long partType;
unsigned int partType;
EOS32_daddr_t maxBlocks;
EOS32_daddr_t numBlocks;
EOS32_ino_t numInodes;
1048,19 → 1048,19
fsStart = read4FromEco(ptptr + 4);
fsSize = read4FromEco(ptptr + 8);
}
printf("File system space is %lu (0x%lX) sectors of %d bytes each.\n",
printf("File system space is %u (0x%X) sectors of %d bytes each.\n",
fsSize, fsSize, SSIZE);
if (fsSize % SPB != 0) {
printf("File system space is not a multiple of block size.\n");
}
maxBlocks = fsSize / SPB;
printf("This equals %lu (0x%lX) blocks of %d bytes each.\n",
printf("This equals %u (0x%X) blocks of %d bytes each.\n",
maxBlocks, maxBlocks, BSIZE);
if (argc == 4) {
proto = argv[3];
} else {
proto = protoBuf;
sprintf(protoBuf, "%lu", maxBlocks);
sprintf(protoBuf, "%u", maxBlocks);
}
/* initialize super block and possibly write boot block */
filsys.s_magic = SUPER_MAGIC;
1120,8 → 1120,8
error("bad block ratio (total/inode = %lu/%lu)",
filsys.s_fsize, filsys.s_isize);
}
printf("File system size = %ld blocks\n", filsys.s_fsize);
printf("Number of inodes = %ld inodes\n", numInodes);
printf("File system size = %d blocks\n", filsys.s_fsize);
printf("Number of inodes = %d inodes\n", numInodes);
filsys.s_freeblks = 0;
filsys.s_freeinos = 0;
filsys.s_ninode = 0;
/disk/tools/fs-EOS32/mkfs/Makefile
4,7 → 4,7
 
BUILD = ../../../../build
 
CC = gcc -m32
CC = gcc
CFLAGS = -g -Wall
LDFLAGS = -g
LDLIBS = -lm
/disk/tools/fs-EOS32/shfs/shfs.c
42,10 → 42,10
#define IOEXEC 000001 /* other's execute permission */
 
 
typedef unsigned long EOS32_ino_t;
typedef unsigned long EOS32_daddr_t;
typedef unsigned long EOS32_off_t;
typedef long EOS32_time_t;
typedef unsigned int EOS32_ino_t;
typedef unsigned int EOS32_daddr_t;
typedef unsigned int EOS32_off_t;
typedef int EOS32_time_t;
 
 
void error(char *fmt, ...) {
60,7 → 60,7
}
 
 
unsigned long fsStart; /* file system start sector */
unsigned int fsStart; /* file system start sector */
 
 
void readBlock(FILE *disk,
73,11 → 73,11
}
 
 
unsigned long get4Bytes(unsigned char *addr) {
return (unsigned long) addr[0] << 24 |
(unsigned long) addr[1] << 16 |
(unsigned long) addr[2] << 8 |
(unsigned long) addr[3] << 0;
unsigned int get4Bytes(unsigned char *addr) {
return (unsigned int) addr[0] << 24 |
(unsigned int) addr[1] << 16 |
(unsigned int) addr[2] << 8 |
(unsigned int) addr[3] << 0;
}
 
 
168,19 → 168,19
if (checkBatch(1)) return;
fsize = get4Bytes(p);
p += 4;
printf("file system size = %lu (0x%lX) blocks\n", fsize, fsize);
printf("file system size = %u (0x%X) blocks\n", fsize, fsize);
if (checkBatch(1)) return;
isize = get4Bytes(p);
p += 4;
printf("inode list size = %lu (0x%lX) blocks\n", isize, isize);
printf("inode list size = %u (0x%X) blocks\n", isize, isize);
if (checkBatch(1)) return;
freeblks = get4Bytes(p);
p += 4;
printf("free blocks = %lu (0x%lX)\n", freeblks, freeblks);
printf("free blocks = %u (0x%X)\n", freeblks, freeblks);
if (checkBatch(1)) return;
freeinos = get4Bytes(p);
p += 4;
printf("free inodes = %lu (0x%lX)\n", freeinos, freeinos);
printf("free inodes = %u (0x%X)\n", freeinos, freeinos);
if (checkBatch(1)) return;
ninode = get4Bytes(p);
p += 4;
190,7 → 190,7
ino = get4Bytes(p);
p += 4;
if (i < ninode) {
printf(" free inode[%3d] = %lu (0x%lX)\n", i, ino, ino);
printf(" free inode[%3d] = %u (0x%X)\n", i, ino, ino);
if (checkBatch(1)) return;
}
}
202,7 → 202,7
free = get4Bytes(p);
p += 4;
if (i < nfree) {
printf(" %s block[%3d] = %lu (0x%lX)\n",
printf(" %s block[%3d] = %u (0x%X)\n",
i == 0 ? "link" : "free", i, free, free);
if (checkBatch(1)) return;
}
211,7 → 211,7
p += 4;
dat = ctime((time_t *) &tim);
dat[strlen(dat) - 1] = '\0';
printf("last super block update = %ld (%s)\n", tim, dat);
printf("last super block update = %d (%s)\n", tim, dat);
if (checkBatch(1)) return;
flag = *p++;
printf("free list locked flag = %d\n", (int) flag);
306,7 → 306,7
dat = ctime((time_t *) &tim);
dat[strlen(dat) - 1] = '\0';
if (mode != 0) {
printf(" time inode created = %ld (%s)\n", tim, dat);
printf(" time inode created = %d (%s)\n", tim, dat);
if (checkBatch(1)) return;
}
tim = get4Bytes(p);
314,7 → 314,7
dat = ctime((time_t *) &tim);
dat[strlen(dat) - 1] = '\0';
if (mode != 0) {
printf(" time last modified = %ld (%s)\n", tim, dat);
printf(" time last modified = %d (%s)\n", tim, dat);
if (checkBatch(1)) return;
}
tim = get4Bytes(p);
322,13 → 322,13
dat = ctime((time_t *) &tim);
dat[strlen(dat) - 1] = '\0';
if (mode != 0) {
printf(" time last accessed = %ld (%s)\n", tim, dat);
printf(" time last accessed = %d (%s)\n", tim, dat);
if (checkBatch(1)) return;
}
size = get4Bytes(p);
p += 4;
if (mode != 0) {
printf(" size = %lu (0x%lX)\n", size, size);
printf(" size = %u (0x%X)\n", size, size);
if (checkBatch(1)) return;
}
for (j = 0; j < 6; j++) {
335,7 → 335,7
addr = get4Bytes(p);
p += 4;
if (mode != 0) {
printf(" direct block[%1d] = %lu (0x%lX)\n", j, addr, addr);
printf(" direct block[%1d] = %u (0x%X)\n", j, addr, addr);
if (checkBatch(1)) return;
}
}
342,13 → 342,13
addr = get4Bytes(p);
p += 4;
if (mode != 0) {
printf(" single indirect = %lu (0x%lX)\n", addr, addr);
printf(" single indirect = %u (0x%X)\n", addr, addr);
if (checkBatch(1)) return;
}
addr = get4Bytes(p);
p += 4;
if (mode != 0) {
printf(" double indirect = %lu (0x%lX)\n", addr, addr);
printf(" double indirect = %u (0x%X)\n", addr, addr);
if (checkBatch(1)) return;
}
}
365,7 → 365,7
printf("%02d: ", i);
ino = get4Bytes(p);
p += 4;
printf("inode = %lu (0x%lX)\n", ino, ino);
printf("inode = %u (0x%X)\n", ino, ino);
if (checkBatch(1)) return;
printf(" name = ");
if (*p == '\0') {
404,7 → 404,7
addr = get4Bytes(p);
p += 4;
if (i < nfree) {
printf(" %s block[%3d] = %lu (0x%lX)\n",
printf(" %s block[%3d] = %u (0x%X)\n",
i == 0 ? "link" : "free", i, addr, addr);
if (checkBatch(1)) return;
}
420,7 → 420,7
for (i = 0; i < BLOCK_SIZE / sizeof(EOS32_daddr_t); i++) {
addr = get4Bytes(p);
p += 4;
printf("block[%4d] = %lu (0x%lX)\n", i, addr, addr);
printf("block[%4d] = %u (0x%X)\n", i, addr, addr);
if (checkBatch(1)) return;
}
}
444,10 → 444,10
}
 
 
int parseNumber(char **pc, unsigned long *pi) {
int parseNumber(char **pc, unsigned int *pi) {
char *p;
unsigned int base, dval;
unsigned long n;
unsigned int n;
 
p = *pc;
while (*p == ' ' || *p == '\t') {
502,12 → 502,12
 
int main(int argc, char *argv[]) {
FILE *disk;
unsigned long fsSize;
unsigned int fsSize;
int part;
char *endptr;
unsigned char partTable[SECTOR_SIZE];
unsigned char *ptptr;
unsigned long partType;
unsigned int partType;
EOS32_daddr_t numBlocks;
EOS32_daddr_t currBlock;
unsigned char blockBuffer[BLOCK_SIZE];
514,7 → 514,7
char line[LINE_SIZE];
int quit;
char *p;
unsigned long n;
unsigned int n;
 
if (argc != 3) {
printf("Usage: %s <disk> <partition>\n", argv[0]);
551,13 → 551,13
fsStart = get4Bytes(ptptr + 4);
fsSize = get4Bytes(ptptr + 8);
}
printf("File system has size %lu (0x%lX) sectors of %d bytes each.\n",
printf("File system has size %u (0x%X) sectors of %d bytes each.\n",
fsSize, fsSize, SECTOR_SIZE);
if (fsSize % SPB != 0) {
printf("File system size is not a multiple of block size.\n");
}
numBlocks = fsSize / SPB;
printf("This equals %lu (0x%lX) blocks of %d bytes each.\n",
printf("This equals %u (0x%X) blocks of %d bytes each.\n",
numBlocks, numBlocks, BLOCK_SIZE);
if (numBlocks < 2) {
error("file system has less than 2 blocks");
567,7 → 567,7
help();
quit = 0;
while (!quit) {
printf("shfs [block %lu (0x%lX)] > ", currBlock, currBlock);
printf("shfs [block %u (0x%X)] > ", currBlock, currBlock);
fflush(stdout);
if (fgets(line, LINE_SIZE, stdin) == NULL) {
printf("\n");
645,7 → 645,7
printf("Error: cannot parse inode number!\n");
break;
}
printf("inode %lu (0x%lX) is in block %lu (0x%lX), inode %lu\n",
printf("inode %u (0x%X) is in block %u (0x%X), inode %u\n",
n, n, n / INOPB + 2, n / INOPB + 2, n % INOPB);
break;
default:
/disk/tools/fs-EOS32/shfs/Makefile
4,7 → 4,7
 
BUILD = ../../../../build
 
CC = gcc -m32
CC = gcc
CFLAGS = -g -Wall
LDFLAGS = -g
LDLIBS = -lm
/disk/tools/fs-EOS32/mkboot/stage2/boot.c
41,10 → 41,10
#define NULL 0
 
 
typedef unsigned long EOS32_ino_t;
typedef unsigned long EOS32_daddr_t;
typedef unsigned long EOS32_off_t;
typedef long EOS32_time_t;
typedef unsigned int EOS32_ino_t;
typedef unsigned int EOS32_daddr_t;
typedef unsigned int EOS32_off_t;
typedef int EOS32_time_t;
 
 
#define IFMT 070000 /* type of file */
243,9 → 243,9
/* file operations*/
 
 
EOS32_daddr_t sibn = -1;
EOS32_daddr_t sibn = (EOS32_daddr_t) -1;
EOS32_daddr_t singleIndirectBlock[NINDIR];
EOS32_daddr_t dibn = -1;
EOS32_daddr_t dibn = (EOS32_daddr_t) -1;
EOS32_daddr_t doubleIndirectBlock[NINDIR];
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.