Skip to content
Snippets Groups Projects
Commit 9a4b3995 authored by Antônio Augusto Fröhlich's avatar Antônio Augusto Fröhlich
Browse files

Import from 1994 LISHA CVS repository

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #19 canceled
PYXIS = /home/venus/guto/Pyxis
BIN = $(PYXIS)/bin
DEV = $(PYXIS)/dev
ETC = $(PYXIS)/etc
INCLUDE = $(PYXIS)/include
LIB = $(PYXIS)/lib
SRC = $(PYXIS)/src
CC = CC
CFLAGS = -g -I$(INCLUDE) -DMSG_MONITOR
AR = ar
AFLAGS = rcv
sos : err sun msg tty win buf fil dir posix.o
err : err.o
err.o : $(SRC)/err.c
$(CC) $(CFLAGS) -c $(SRC)/err.c
$(AR) $(AFLAGS) $(LIB)/stub.a err.o
ranlib $(LIB)/stub.a
sun : sun.o
sun.o : $(SRC)/sun.c
$(CC) $(CFLAGS) -c $(SRC)/sun.c
$(AR) $(AFLAGS) $(LIB)/stub.a sun.o
ranlib $(LIB)/stub.a
msg : mbox.o msg.o
$(CC) $(CFLAGS) msg.o -o msg $(LIB)/stub.a
mbox.o : $(SRC)/mbox.c
$(CC) $(CFLAGS) -c $(SRC)/mbox.c
$(AR) $(AFLAGS) $(LIB)/stub.a mbox.o
ranlib $(LIB)/stub.a
msg.o : $(SRC)/msg.c
$(CC) $(CFLAGS) -c $(SRC)/msg.c
tty : tty.o
$(CC) $(CFLAGS) tty.o -o tty $(LIB)/stub.a
$(CC) $(CFLAGS) -c $(SRC)/tty_stub.c
$(AR) $(AFLAGS) $(LIB)/stub.a tty_stub.o
ranlib $(LIB)/stub.a
tty.o : $(SRC)/tty.c
$(CC) $(CFLAGS) -c $(SRC)/tty.c
win : win.o
$(CC) $(CFLAGS) win.o -o win $(LIB)/stub.a
$(CC) $(CFLAGS) -c $(SRC)/win_stub.c
$(AR) $(AFLAGS) $(LIB)/stub.a win_stub.o
ranlib $(LIB)/stub.a
win.o : $(SRC)/win.c
$(CC) $(CFLAGS) -c $(SRC)/win.c
buf : buf.o
$(CC) $(CFLAGS) buf.o -o buf $(LIB)/stub.a
$(CC) $(CFLAGS) -c $(SRC)/buf_stub.c
$(AR) $(AFLAGS) $(LIB)/stub.a buf_stub.o
ranlib $(LIB)/stub.a
buf.o : $(SRC)/buf.c
$(CC) $(CFLAGS) -c $(SRC)/buf.c
fil : fil.o
$(CC) $(CFLAGS) fil.o -o fil $(LIB)/stub.a
$(CC) $(CFLAGS) -c $(SRC)/fil_stub.c
$(AR) $(AFLAGS) $(LIB)/stub.a fil_stub.o
ranlib $(LIB)/stub.a
fil.o : $(SRC)/fil.c
$(CC) $(CFLAGS) -c $(SRC)/fil.c
dir : dir.o
$(CC) $(CFLAGS) dir.o -o dir $(LIB)/stub.a
$(CC) $(CFLAGS) -c $(SRC)/dir_stub.c
$(AR) $(AFLAGS) $(LIB)/stub.a dir_stub.o
ranlib $(LIB)/stub.a
dir.o : $(SRC)/dir.c
$(CC) $(CFLAGS) -c $(SRC)/dir.c
posix.o : $(SRC)/posix.c
$(CC) $(CFLAGS) -c $(SRC)/posix.c $(LIB)/stub.a
$(AR) $(AFLAGS) $(LIB)/stub.a posix.o
ranlib $(LIB)/stub.a
etc : mkfs
mkfs : mkfs1 mkfs2
mkfs1 : $(ETC)/mkfs1.c
$(CC) $(CFLAGS) $(ETC)/mkfs1.c -o mkfs1 $(LIB)/stub.a
mkfs2 : $(ETC)/mkfs2.c
$(CC) $(CFLAGS) $(ETC)/mkfs2.c -o mkfs2 $(LIB)/stub.a
clients : posix_client tty_client win_client buf_client fil_client
tty_client : $(SRC)/tty_client.c
$(CC) $(CFLAGS) $(SRC)/tty_client.c -o tty_client $(LIB)/stub.a
win_client : $(SRC)/win_client.c
$(CC) $(CFLAGS) $(SRC)/win_client.c -o win_client $(LIB)/stub.a
buf_client : $(SRC)/buf_client.c
$(CC) $(CFLAGS) $(SRC)/buf_client.c -o buf_client $(LIB)/stub.a
fil_client : $(SRC)/fil_client.c
$(CC) $(CFLAGS) $(SRC)/fil_client.c -o fil_client $(LIB)/stub.a
dir_client : $(SRC)/dir_client.c
$(CC) $(CFLAGS) $(SRC)/dir_client.c -o dir_client $(LIB)/stub.a
posix_client : $(SRC)/posix_client.c
$(CC) $(CFLAGS) $(SRC)/posix_client.c -o posix_client $(LIB)/stub.a
shell : $(SRC)/shell.c
$(CC) $(CFLAGS) $(SRC)/shell.c -o shell $(LIB)/stub.a
all : sos clients etc shell
clean :
rm err*
rm sun*
rm msg*
rm mbox*
rm tty*
rm win*
rm buf*
rm fil*
rm dir*
rm posix*
rm shell*
veryclean : clean
rm $(LIB)/stub.a
bin/buf 0 → 100755
File added
File added
bin/dir 0 → 100755
File added
bin/fil 0 → 100755
File added
File added
#! /bin/sh
/home/venus/guto/Pyxis/bin/mkfs1 $1 $2 $3
/home/venus/guto/Pyxis/bin/fil $1&
sleep 1
/home/venus/guto/Pyxis/bin/mkfs2 $1
bin/mkfs1 0 → 100755
File added
bin/mkfs2 0 → 100755
File added
bin/msg 0 → 100755
File added
File added
bin/shell 0 → 100755
File added
bin/tty 0 → 100755
File added
File added
bin/win 0 → 100755
File added
File added
#! /bin/sh
/home/venus/guto/Pyxis/bin/mkfs1 $1 $2 $3
/home/venus/guto/Pyxis/bin/fil $1&
sleep 1
/home/venus/guto/Pyxis/bin/mkfs2 $1
//==============================================================================
// MKFS.C: Make File System utility for S.O.S.
//
// Author: Antonio Augusto Frohlich Date: 28/07/94
//------------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sos.h>
#include <sun.h>
#include <mbox.h>
#include <fil.h>
#include <dir.h>
#include <stub.h>
Mail_Box *stub_mbox;
int main(int argc, char *argv[])
{
int i,
size,
inodes;
Dwrd dev;
File_System fs;
Mail_Box mbox;
stub_mbox = &mbox;
// Check usage
if(argc != 4)
{
printf("Usage: mkfs <device> <size> <i-nodes>\n");
return(ERR);
}
printf("S.O.S. mkfs 1.0\n");
dev = atoi(argv[1]);
size = atoi(argv[2]);
if(size < 3)
{
printf("Error: can't make a device of size %d Kbytes!\n", size);
return(ERR);
}
inodes = atoi(argv[3]);
if((inodes < 1) || (inodes / 8 - 2) > size)
{
printf("Error: can't make a device with %d i-nodes!\n", inodes);
return(ERR);
}
if((inodes % 8) != 0)
{
inodes = (inodes / 8) * 8 + 8;
printf("Warning: making %d i-nodes.\n", inodes);
}
if(win_read(VENUS, dev, SUPER_BLOCK, (Block)&fs) < sizeof(Block))
{
printf("Warning: can't read device's Super-Block!\n");
return(ERR);
}
if(fs.c_date)
{
char c;
printf("Warning: device is already made. All data will be lost!\n");
printf("Would you like to continue?\n");
scanf("%c", &c);
if((c != 'y') && (c != 'Y'))
return(ERR);
}
// OK to make the file system
strcpy(fs.name, "S.O.S. v1.0");
fs.r_o = FALSE;
fs.dirty = FALSE;
fs.size = size;
fs.free = 0; // size - 2 - inodes / 8;
fs.first = 2 + inodes / 8;
fs.c_date = get_date();
fs.m_date = fs.c_date;
fs.a_date = fs.c_date;
fs.il_size = inodes;
fs.il_free = inodes;
fs.il_next = 0;
fs.iv_free = 0;
fs.iv_index = 0;
fs.fb_head = -1; // 2 + (inodes / 8) + 255;
fs.fb_flag = 1;
fs.fb_index = FREE_BLOCK_VEC_LEN;
// Generate the free block list
for(i = fs.size; i >= fs.first; --i)
{
Dwrd tmp;
fs.fb_vect[--fs.fb_index] = i;
if(fs.fb_index == 0)
{
if(fs.fb_flag)
{
tmp = fs.fb_vect[FREE_BLOCK_VEC_LEN - 1];
fs.fb_vect[FREE_BLOCK_VEC_LEN - 1] = fs.fb_head;
fs.fb_head = tmp;
}
if(buf_write(VENUS, dev, fs.fb_head, fs.fb_flag * sizeof(fs.fb_vect), sizeof(fs.fb_vect), (Byte *)fs.fb_vect) < sizeof(fs.fb_vect))
{
printf("Trouble generating the free block list\n.");
return(ERR);
}
fs.fb_flag = !fs.fb_flag;
fs.fb_index = FREE_BLOCK_VEC_LEN;
}
fs.free++;
}
if(buf_sync(VENUS) < 0)
{
printf("Error: trouble generating the free block list!\n");
return(ERR);
}
if(win_write(VENUS, dev, SUPER_BLOCK, (Block)&fs) < sizeof(Block))
{
printf("Error: can't save Super-Block!\n");
return(ERR);
}
// Generate the Index-Node List
memset(&fs, 0, sizeof(Block));
for(i = 0; i < inodes / 8; i++)
if(win_write(VENUS, dev, INDEX_NODE_LIST + i, (Block)&fs) < sizeof(Block))
{
printf("Error: trouble generating the i-list!\n");
return(ERR);
}
// Start the File Server
printf("Please, start up the File Server and hit a key.\n");
printf("\n");
int aux;
scanf("%s", &aux);
// if(system("/home/venus/guto/Pyxis/bin/fil &") < 0)
// {
// printf("Error: trouble starting the File Server!\n");
// return(ERR);
// }
//Generate the Root Directory
Dwrd inode = fil_create(VENUS, dev, 0, 0755);
if(inode < 0)
{
printf("Error: can't create root directory!\n");
return(ERR);
}
if(inode != 0)
{
printf("Error: File System seams to have problems. Root directory must be associated to i-node 0 and not %d!\n", inode);
return(ERR);
}
int fd = fil_open(VENUS, dev, inode, 7);
if(fd < 0)
{
printf("Error: can't open root directory!\n");
return(ERR);
}
O_Id oid(VENUS, dev, inode);
Directory_Entry de;
strcpy(de.name, ".");
de.oid = oid;
if(fil_write(fd, (char *)&de, sizeof(Directory_Entry)) < 0)
{
printf("Error: can't write to root directory!\n");
return(ERR);
}
strcpy(de.name, "..");
if(fil_write(fd, (char *)&de, sizeof(Directory_Entry)) < 0)
{
printf("Error: can't write to root directory!\n");
return(ERR);
}
fil_close(fd);
return(OK);
}
//==============================================================================
// MKFS.C: Make File System utility for S.O.S.
//
// Author: Antonio Augusto Frohlich Date: 28/07/94
//------------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sos.h>
#include <sun.h>
#include <mbox.h>
#include <fil.h>
#include <dir.h>
#include <stub.h>
Mail_Box *stub_mbox;
int main(int argc, char *argv[])
{
int i,
size,
inodes;
Dwrd dev;
File_System fs;
Mail_Box mbox;
stub_mbox = &mbox;
// Check usage
if(argc != 4)
{
printf("Usage: mkfs1 <device> <size> <i-nodes>\n");
return(ERR);
}
printf("PYXIS mkfs1 1.0\n");
dev = atoi(argv[1]);
size = atoi(argv[2]);
if(size < 3)
{
printf("Error: can't make a device of size %d Kbytes!\n", size);
return(ERR);
}
inodes = atoi(argv[3]);
if((inodes < 1) || (inodes / 8 - 2) > size)
{
printf("Error: can't make a device with %d i-nodes!\n", inodes);
return(ERR);
}
if((inodes % 8) != 0)
{
inodes = (inodes / 8) * 8 + 8;
printf("Warning: making %d i-nodes.\n", inodes);
}
if(win_read(VENUS, dev, SUPER_BLOCK, (Block)&fs) < sizeof(Block))
{
printf("Warning: can't read device's Super-Block!\n");
return(ERR);
}
if(fs.c_date)
{
char c;
printf("Warning: device is already made. All data will be lost!\n");
printf("Would you like to continue?\n");
scanf("%c", &c);
if((c != 'y') && (c != 'Y'))
return(ERR);
}
// OK to make the file system
strcpy(fs.name, "S.O.S. v1.0");
fs.r_o = FALSE;
fs.dirty = FALSE;
fs.size = size;
fs.free = 0; // size - 2 - inodes / 8;
fs.first = 2 + inodes / 8;
fs.c_date = get_date();
fs.m_date = fs.c_date;
fs.a_date = fs.c_date;
fs.il_size = inodes;
fs.il_free = inodes;
fs.il_next = 0;
fs.iv_free = 0;
fs.iv_index = 0;
fs.fb_head = -1; // 2 + (inodes / 8) + 255;
fs.fb_flag = 1;
fs.fb_index = FREE_BLOCK_VEC_LEN;
// Generate the free block list
for(i = fs.size; i >= fs.first; --i)
{
Dwrd tmp;
fs.fb_vect[--fs.fb_index] = i;
if(fs.fb_index == 0)
{
if(fs.fb_flag)
{
tmp = fs.fb_vect[FREE_BLOCK_VEC_LEN - 1];
fs.fb_vect[FREE_BLOCK_VEC_LEN - 1] = fs.fb_head;
fs.fb_head = tmp;
}
if(buf_write(VENUS, dev, fs.fb_head, fs.fb_flag * sizeof(fs.fb_vect), sizeof(fs.fb_vect), (Byte *)fs.fb_vect) < sizeof(fs.fb_vect))
{
printf("Trouble generating the free block list\n.");
return(ERR);
}
fs.fb_flag = !fs.fb_flag;
fs.fb_index = FREE_BLOCK_VEC_LEN;
}
fs.free++;
}
if(buf_sync(VENUS) < 0)
{
printf("Error: trouble generating the free block list!\n");
return(ERR);
}
if(win_write(VENUS, dev, SUPER_BLOCK, (Block)&fs) < sizeof(Block))
{
printf("Error: can't save Super-Block!\n");
return(ERR);
}
// Generate the Index-Node List
memset(&fs, 0, sizeof(Block));
for(i = 0; i < inodes / 8; i++)
if(win_write(VENUS, dev, INDEX_NODE_LIST + i, (Block)&fs) < sizeof(Block))
{
printf("Error: trouble generating the i-list!\n");
return(ERR);
}
return(OK);
}
//==============================================================================
// MKFS.C: Make File System utility for S.O.S.
//
// Author: Antonio Augusto Frohlich Date: 28/07/94
//------------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sos.h>
#include <sun.h>
#include <mbox.h>
#include <fil.h>
#include <dir.h>
#include <stub.h>
Mail_Box *stub_mbox;
int main(int argc, char *argv[])
{
Dwrd dev;
File_Descriptor fd;
Mail_Box mbox;
stub_mbox = &mbox;
// Check usage
if(argc != 2)
{
printf("Usage: mkfs2 <device>\n");
return(ERR);
}
printf("PYXIS mkfs2 1.0\n");
dev = atoi(argv[1]);
//Generate the Root Directory
Dwrd inode = fil_create(VENUS, dev, 0, 0755);
if(inode < 0)
{
printf("Error: can't create root directory!\n");
return(ERR);
}
if(inode != 0)
{
printf("Error: File System seams to have problems. Root directory must be associated to i-node 0 and not %d!\n", inode);
return(ERR);
}
if(fil_open(O_Id(VENUS, dev, inode), 7, &fd) < 0)
{
printf("Error: can't open root directory!\n");
return(ERR);
}
O_Id oid(VENUS, dev, inode);
Directory_Entry de;
strcpy(de.name, ".");
de.oid = oid;
if(fil_write(&fd, (char *)&de, sizeof(Directory_Entry)) != sizeof(Directory_Entry))
{
printf("Error: can't write to root directory!\n");
return(ERR);
}
strcpy(de.name, "..");
if(fil_write(&fd, (char *)&de, sizeof(Directory_Entry)) != sizeof(Directory_Entry))
{
printf("Error: can't write to root directory!\n");
return(ERR);
}
fil_close(&fd);
return(OK);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment