Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ASA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASE-2021
ASA
Commits
b18dbfdf
Commit
b18dbfdf
authored
4 years ago
by
Thierno souleymane Bah
Browse files
Options
Downloads
Patches
Plain Diff
feat(dvol programm done, we can now list all volumes)
parent
3a2d1bdb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
tpfs/Makefile
+2
-1
2 additions, 1 deletion
tpfs/Makefile
tpfs/drive.c
+9
-0
9 additions, 0 deletions
tpfs/drive.c
tpfs/drive.h
+1
-0
1 addition, 0 deletions
tpfs/drive.h
tpfs/dvol.c
+60
-0
60 additions, 0 deletions
tpfs/dvol.c
tpfs/vol.c
+0
-9
0 additions, 9 deletions
tpfs/vol.c
with
72 additions
and
10 deletions
tpfs/Makefile
+
2
−
1
View file @
b18dbfdf
...
@@ -13,7 +13,7 @@ LIBS = -L$(LIBDIR) -lhardware
...
@@ -13,7 +13,7 @@ LIBS = -L$(LIBDIR) -lhardware
###------------------------------
###------------------------------
### Main targets
### Main targets
###------------------------------------------------------------
###------------------------------------------------------------
BINARIES
=
mkhd display_sector format_sector write_sector mkvol
BINARIES
=
mkhd display_sector format_sector write_sector mkvol
dvol
all
:
$(BINARIES) $(OBJECTS)
all
:
$(BINARIES) $(OBJECTS)
...
@@ -32,6 +32,7 @@ display_sector: display_sector.o drive.o
...
@@ -32,6 +32,7 @@ display_sector: display_sector.o drive.o
format_sector
:
format_sector.o drive.o
format_sector
:
format_sector.o drive.o
write_sector
:
write_sector.o drive.o
write_sector
:
write_sector.o drive.o
mkvol
:
mkvol.o vol.o drive.o
mkvol
:
mkvol.o vol.o drive.o
dvol
:
dvol.o vol.o drive.o
###------------------------------
###------------------------------
### Misc.
### Misc.
...
...
This diff is collapsed.
Click to expand it.
tpfs/drive.c
+
9
−
0
View file @
b18dbfdf
...
@@ -68,6 +68,15 @@ void read_sector(unsigned char *buf, int cylinder, int sector)
...
@@ -68,6 +68,15 @@ void read_sector(unsigned char *buf, int cylinder, int sector)
buf
[
i
]
=
MASTERBUFFER
[
i
];
buf
[
i
]
=
MASTERBUFFER
[
i
];
}
}
void
read_sector_n
(
unsigned
char
*
buf
,
int
cylinder
,
int
sector
,
int
size
)
{
int
i
;
unsigned
char
buffer
[
HDA_SECTORSIZE
];
read_sector
(
buffer
,
cylinder
,
sector
);
for
(
i
=
0
;
i
<
size
;
i
++
)
buf
[
i
]
=
buffer
[
i
];
}
void
write_sector
(
unsigned
int
cylinder
,
unsigned
int
sector
,
unsigned
char
*
buf
)
void
write_sector
(
unsigned
int
cylinder
,
unsigned
int
sector
,
unsigned
char
*
buf
)
{
{
int
i
;
int
i
;
...
...
This diff is collapsed.
Click to expand it.
tpfs/drive.h
+
1
−
0
View file @
b18dbfdf
...
@@ -16,6 +16,7 @@ void dump(unsigned char *buffer,
...
@@ -16,6 +16,7 @@ void dump(unsigned char *buffer,
int
octal_dump
);
int
octal_dump
);
void
seek
(
int
cylinder
,
int
sec
);
void
seek
(
int
cylinder
,
int
sec
);
void
read_sector
(
unsigned
char
*
buf
,
int
cylinder
,
int
sector
);
void
read_sector
(
unsigned
char
*
buf
,
int
cylinder
,
int
sector
);
void
read_sector_n
(
unsigned
char
*
buf
,
int
cylinder
,
int
sector
,
int
size
);
void
write_sector
(
unsigned
int
cylinder
,
unsigned
int
sector
,
unsigned
char
*
buf
);
void
write_sector
(
unsigned
int
cylinder
,
unsigned
int
sector
,
unsigned
char
*
buf
);
void
format_sector
(
unsigned
int
cylinder
,
void
format_sector
(
unsigned
int
cylinder
,
unsigned
int
sector
,
unsigned
int
sector
,
...
...
This diff is collapsed.
Click to expand it.
tpfs/dvol.c
0 → 100644
+
60
−
0
View file @
b18dbfdf
#include
<stdio.h>
#include
<stdlib.h>
#include
"hardware.h"
#include
"vol.h"
void
display_vol
()
{
int
vol
;
char
*
vtype_names
[
3
]
=
{
"BASE"
,
"ANNEXE"
,
"OTHER"
};
vol_t
volume
;
if
(
mbr
.
nb_vols
==
0
)
{
printf
(
"Il n'y aucun volume.
\n
"
);
return
;
}
printf
(
"--------------------------
\n
"
);
for
(
vol
=
0
;
vol
<
mbr
.
nb_vols
;
vol
++
)
{
volume
=
mbr
.
vols
[
vol
];
printf
(
"Volume: %d (%s)
\n
"
,
vol
,
vtype_names
[
volume
.
type
]);
printf
(
"> Sector: %d
\n
"
,
volume
.
sector
);
printf
(
"> Cylinder: %d
\n
"
,
volume
.
cylinder
);
printf
(
"> Nb blocs: %d
\n
"
,
volume
.
nb_blocs
);
printf
(
"--------------------------
\n
"
);
}
}
static
void
empty_it
()
{
return
;
}
int
main
(
int
argc
,
char
const
*
argv
[])
{
unsigned
int
i
;
/* init hardware */
if
(
init_hardware
(
"hwconfig.ini"
)
==
0
)
{
fprintf
(
stderr
,
"Error in hardware initialization
\n
"
);
exit
(
EXIT_FAILURE
);
}
/* Interreupt handlers */
for
(
i
=
0
;
i
<
16
;
i
++
)
IRQVECTOR
[
i
]
=
empty_it
;
/* Allows all IT */
_mask
(
1
);
load_mbr
();
display_vol
();
/* and exit! */
exit
(
EXIT_SUCCESS
);
}
This diff is collapsed.
Click to expand it.
tpfs/vol.c
+
0
−
9
View file @
b18dbfdf
...
@@ -91,12 +91,3 @@ void format_vol(unsigned int vol)
...
@@ -91,12 +91,3 @@ void format_vol(unsigned int vol)
format_sector
(
sector_cylinder
[
1
],
sector_cylinder
[
1
],
FMT_SIZE
,
FMT_DATA
);
format_sector
(
sector_cylinder
[
1
],
sector_cylinder
[
1
],
FMT_SIZE
,
FMT_DATA
);
}
}
}
}
void
read_sector_n
(
unsigned
char
*
buf
,
int
cylinder
,
int
sector
,
int
size
)
{
int
i
;
unsigned
char
buffer
[
HDA_SECTORSIZE
];
read_sector
(
buffer
,
cylinder
,
sector
);
for
(
i
=
0
;
i
<
size
;
i
++
)
buf
[
i
]
=
buffer
[
i
];
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment