<s>
A	O
file	B-Application
system	I-Application
API	I-Application
is	O
an	O
application	B-Application
programming	I-Application
interface	I-Application
through	O
which	O
a	O
utility	O
or	O
user	O
program	O
requests	O
services	O
of	O
a	O
file	B-Application
system	I-Application
.	O
</s>
<s>
An	O
operating	O
system	O
may	O
provide	O
abstractions	O
for	O
accessing	O
different	O
file	B-Application
systems	I-Application
transparently	O
.	O
</s>
<s>
Some	O
file	B-Application
system	I-Application
APIs	I-Application
may	O
also	O
include	O
interfaces	O
for	O
maintenance	O
operations	O
,	O
such	O
as	O
creating	O
or	O
initializing	O
a	O
file	B-Application
system	I-Application
,	O
verifying	O
the	O
file	B-Application
system	I-Application
for	O
integrity	O
,	O
and	O
defragmentation	B-Application
.	O
</s>
<s>
Each	O
operating	O
system	O
includes	O
the	O
APIs	B-Application
needed	O
for	O
the	O
file	B-Application
systems	I-Application
it	O
supports	O
.	O
</s>
<s>
Microsoft	B-Application
Windows	I-Application
has	O
file	B-Application
system	I-Application
APIs	I-Application
for	O
NTFS	B-Application
and	O
several	O
FAT	B-Application
file	I-Application
systems	I-Application
.	O
</s>
<s>
Linux	B-Application
systems	O
can	O
include	O
APIs	B-Application
for	O
ext2	B-Application
,	O
ext3	B-Application
,	O
ReiserFS	B-Application
,	O
and	O
Btrfs	B-Operating_System
to	O
name	O
a	O
few	O
.	O
</s>
<s>
Some	O
early	O
operating	O
systems	O
were	O
capable	O
of	O
handling	O
only	O
tape	O
and	O
disk	B-Application
file	I-Application
systems	I-Application
.	O
</s>
<s>
As	O
file	B-Application
systems	I-Application
provided	O
more	O
services	O
,	O
more	O
interfaces	O
were	O
defined	O
:	O
</s>
<s>
As	O
additional	O
file	B-Application
system	I-Application
types	I-Application
,	O
hierarchy	O
structure	O
and	O
supported	O
media	O
increased	O
,	O
additional	O
features	O
needed	O
some	O
specialized	O
functions	O
:	O
</s>
<s>
Multi-user	O
systems	O
required	O
APIs	B-Application
for	O
:	O
</s>
<s>
Writing	O
user	O
data	O
to	O
a	O
file	B-Application
system	I-Application
is	O
provided	O
for	O
use	O
directly	O
by	O
the	O
user	O
program	O
or	O
the	O
run-time	O
library	B-Library
.	O
</s>
<s>
The	O
run-time	O
library	B-Library
for	O
some	O
programming	O
languages	O
may	O
provide	O
type	O
conversion	O
,	O
formatting	O
and	O
blocking	O
.	O
</s>
<s>
Some	O
file	B-Application
systems	I-Application
provide	O
identification	O
of	O
records	O
by	O
key	O
and	O
may	O
include	O
re-writing	O
an	O
existing	O
record	O
.	O
</s>
<s>
Reading	O
user	O
data	O
,	O
sometimes	O
called	O
,	O
may	O
include	O
a	O
direction	O
(	O
forward	O
or	O
reverse	O
)	O
or	O
in	O
the	O
case	O
of	O
a	O
keyed	O
file	B-Application
system	I-Application
,	O
a	O
specific	O
key	O
.	O
</s>
<s>
The	O
open	B-Language
API	B-Application
may	O
be	O
explicitly	O
requested	O
or	O
implicitly	O
invoked	O
upon	O
the	O
issuance	O
of	O
the	O
first	O
operation	O
by	O
a	O
process	O
on	O
an	O
object	O
.	O
</s>
<s>
Usual	O
requirements	O
for	O
requesting	O
access	O
to	O
a	O
file	B-Application
system	I-Application
object	O
include	O
:	O
</s>
<s>
These	O
are	O
requested	O
via	O
a	O
programming	O
language	O
library	B-Library
which	O
may	O
provide	O
coordination	O
among	O
modules	O
in	O
the	O
process	O
in	O
addition	O
to	O
forwarding	O
the	O
request	O
to	O
the	O
file	B-Application
system	I-Application
.	O
</s>
<s>
It	O
must	O
be	O
expected	O
that	O
something	O
may	O
go	O
wrong	O
during	O
the	O
processing	O
of	O
the	O
open	B-Language
.	O
</s>
<s>
The	O
file	B-Application
system	I-Application
may	O
be	O
unable	O
to	O
create	O
or	O
update	O
structures	O
required	O
to	O
coordinate	O
activities	O
among	O
users	O
.	O
</s>
<s>
Depending	O
on	O
the	O
programming	O
language	O
,	O
additional	O
specifications	O
in	O
the	O
open	B-Language
may	O
establish	O
the	O
modules	O
to	O
handle	O
these	O
conditions	O
.	O
</s>
<s>
Some	O
libraries	O
specify	O
a	O
library	B-Library
module	O
to	O
the	O
file	B-Application
system	I-Application
permitting	O
analysis	O
should	O
the	O
opening	O
program	O
be	O
unable	O
to	O
perform	O
any	O
meaningful	O
action	O
as	O
a	O
result	O
of	O
a	O
failure	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
the	O
failure	O
is	O
on	O
the	O
attempt	O
to	O
open	B-Language
the	O
necessary	O
input	O
file	O
,	O
the	O
only	O
action	O
may	O
be	O
to	O
report	O
the	O
failure	O
and	O
abort	O
the	O
program	O
.	O
</s>
<s>
Close	B-Language
may	O
cause	O
dismounting	O
or	O
ejecting	O
removable	O
media	O
and	O
updating	O
library	B-Library
and	O
file	B-Application
system	I-Application
structures	O
to	O
indicate	O
that	O
the	O
object	O
is	O
no	O
longer	O
in	O
use	O
.	O
</s>
<s>
The	O
minimal	O
specification	O
to	O
the	O
close	B-Language
references	O
the	O
object	O
.	O
</s>
<s>
Additionally	O
,	O
some	O
file	B-Application
systems	I-Application
provide	O
specifying	O
a	O
disposition	O
of	O
the	O
object	O
which	O
may	O
indicate	O
the	O
object	O
is	O
to	O
be	O
discarded	O
and	O
no	O
longer	O
be	O
part	O
of	O
the	O
file	B-Application
system	I-Application
.	O
</s>
<s>
Similar	O
to	O
the	O
open	B-Language
,	O
it	O
must	O
be	O
expected	O
that	O
something	O
may	O
go	O
wrong	O
.	O
</s>
<s>
Considerations	O
for	O
handling	O
a	O
failure	O
are	O
similar	O
to	O
those	O
of	O
the	O
open	B-Language
.	O
</s>
<s>
Some	O
of	O
the	O
metadata	O
is	O
maintained	O
by	O
the	O
file	B-Application
system	I-Application
,	O
for	O
example	O
last-modification	O
date	O
(	O
and	O
various	O
other	O
dates	O
depending	O
on	O
the	O
file	B-Application
system	I-Application
)	O
,	O
</s>
<s>
location	O
of	O
the	O
beginning	O
of	O
the	O
file	O
,	O
the	O
size	O
of	O
the	O
file	O
and	O
if	O
the	O
file	B-Application
system	I-Application
backup	O
utility	O
has	O
saved	O
the	O
current	O
version	O
of	O
the	O
files	O
.	O
</s>
<s>
Additional	O
meta	O
data	O
supported	O
by	O
some	O
file	B-Application
systems	I-Application
may	O
include	O
the	O
owner	O
of	O
the	O
file	O
,	O
the	O
group	O
to	O
which	O
the	O
file	O
belongs	O
as	O
well	O
as	O
permissions	O
and/or	O
access	O
control	O
(	O
i.e.	O
</s>
<s>
These	O
items	O
are	O
usually	O
modifiable	O
by	O
file	B-Application
system	I-Application
utilities	O
which	O
may	O
be	O
executed	O
by	O
the	O
owner	O
.	O
</s>
<s>
Renaming	O
a	O
file	O
,	O
moving	O
a	O
file	O
(	O
or	O
a	O
subdirectory	O
)	O
from	O
one	O
directory	O
to	O
another	O
and	O
deleting	O
a	O
file	O
are	O
examples	O
of	O
the	O
operations	O
provide	O
by	O
the	O
file	B-Application
system	I-Application
for	O
the	O
management	O
of	O
directories	O
.	O
</s>
<s>
As	O
a	O
filesystem	B-Application
is	O
used	O
directories	O
,	O
files	O
and	O
records	O
may	O
be	O
added	O
,	O
deleted	O
or	O
modified	O
.	O
</s>
<s>
Incomplete	O
structures	O
or	O
other	O
inconsistencies	O
may	O
be	O
caused	O
by	O
device	O
or	O
media	O
errors	O
,	O
inadequate	O
time	O
between	O
detection	O
of	O
impending	O
loss	O
of	O
power	O
and	O
actual	O
power	O
loss	O
,	O
improper	O
system	O
shutdown	O
or	O
media	O
removal	O
,	O
and	O
on	O
very	O
rare	O
occasions	O
file	B-Application
system	I-Application
coding	O
errors	O
.	O
</s>
<s>
Specialized	O
routines	O
in	O
the	O
file	B-Application
system	I-Application
are	O
included	O
to	O
optimize	O
or	O
repair	O
these	O
structures	O
.	O
</s>
<s>
They	O
are	O
not	O
usually	O
invoked	O
by	O
the	O
user	O
directly	O
but	O
triggered	O
within	O
the	O
file	B-Application
system	I-Application
itself	O
.	O
</s>
<s>
Sometimes	O
these	O
routines	O
are	O
invoked	O
or	O
scheduled	O
by	O
the	O
system	O
manager	O
or	O
as	O
in	O
the	O
case	O
of	O
defragmentation	B-Application
.	O
</s>
<s>
The	O
API	B-Application
is	O
"	O
kernel-level	O
"	O
when	O
the	O
kernel	O
not	O
only	O
provides	O
the	O
interfaces	O
for	O
the	O
filesystems	B-Application
developers	O
but	O
is	O
also	O
the	O
space	O
in	O
which	O
the	O
filesystem	B-Application
code	O
resides	O
.	O
</s>
<s>
It	O
differs	O
with	O
the	O
old	O
schema	O
in	O
that	O
the	O
kernel	O
itself	O
uses	O
its	O
own	O
facilities	O
to	O
talk	O
with	O
the	O
filesystem	B-Application
driver	O
and	O
vice	O
versa	O
,	O
as	O
contrary	O
to	O
the	O
kernel	O
being	O
the	O
one	O
that	O
handles	O
the	O
filesystem	B-Application
layout	O
and	O
the	O
filesystem	B-Application
the	O
one	O
that	O
directly	O
access	O
the	O
hardware	O
.	O
</s>
<s>
With	O
modular	O
kernels	O
it	O
allows	O
adding	O
filesystems	B-Application
as	O
any	O
kernel	O
module	O
,	O
even	O
third	O
party	O
ones	O
.	O
</s>
<s>
With	O
non-modular	O
kernels	O
however	O
it	O
requires	O
the	O
kernel	O
to	O
be	O
recompiled	O
with	O
the	O
new	O
filesystem	B-Application
code	O
(	O
and	O
in	O
closed-source	O
kernels	O
,	O
this	O
makes	O
third	O
party	O
filesystem	B-Application
impossible	O
)	O
.	O
</s>
<s>
Unixes	B-Application
and	O
Unix-like	B-Operating_System
systems	I-Operating_System
such	O
as	O
Linux	B-Application
have	O
used	O
this	O
modular	O
scheme	O
.	O
</s>
<s>
There	O
is	O
a	O
variation	O
of	O
this	O
scheme	O
used	O
in	O
MS-DOS	B-Application
(	O
DOS	O
4.0	O
onward	O
)	O
and	O
compatibles	O
to	O
support	O
CD-ROM	O
and	O
network	O
file	B-Application
systems	I-Application
.	O
</s>
<s>
Instead	O
of	O
adding	O
code	O
to	O
the	O
kernel	O
,	O
as	O
in	O
the	O
old	O
scheme	O
,	O
or	O
using	O
kernel	O
facilities	O
as	O
in	O
the	O
kernel-based	O
scheme	O
,	O
it	O
traps	O
all	O
calls	O
to	O
a	O
file	O
and	O
identifies	O
if	O
it	O
should	O
be	O
redirected	O
to	O
the	O
kernel	O
's	O
equivalent	O
function	O
or	O
if	O
it	O
has	O
to	O
be	O
handled	O
by	O
the	O
specific	O
filesystem	B-Application
driver	O
,	O
and	O
the	O
filesystem	B-Application
driver	O
"	O
directly	O
"	O
access	O
the	O
disk	O
contents	O
using	O
low-level	O
BIOS	B-Operating_System
functions	O
.	O
</s>
<s>
The	O
API	B-Application
is	O
"	O
driver-based	O
"	O
when	O
the	O
kernel	O
provides	O
facilities	O
but	O
the	O
file	B-Application
system	I-Application
code	O
resides	O
totally	O
external	O
to	O
the	O
kernel	O
(	O
not	O
even	O
as	O
a	O
module	O
of	O
a	O
modular	O
kernel	O
)	O
.	O
</s>
<s>
It	O
is	O
a	O
cleaner	O
scheme	O
as	O
the	O
filesystem	B-Application
code	O
is	O
totally	O
independent	O
,	O
it	O
allows	O
filesystems	B-Application
to	O
be	O
created	O
for	O
closed-source	O
kernels	O
and	O
online	O
filesystem	B-Application
additions	O
or	O
removals	O
from	O
the	O
system	O
.	O
</s>
<s>
Examples	O
of	O
this	O
scheme	O
are	O
the	O
Windows	B-Device
NT	I-Device
and	O
OS/2	B-Application
respective	O
IFSs	B-Application
.	O
</s>
<s>
In	O
this	O
API	B-Application
all	O
filesystems	B-Application
are	O
in	O
the	O
kernel	O
,	O
like	O
in	O
kernel-based	O
APIs	B-Application
,	O
but	O
they	O
are	O
automatically	O
trapped	O
by	O
another	O
API	B-Application
,	O
that	O
is	O
driver-based	O
,	O
by	O
the	O
OS	O
.	O
</s>
<s>
This	O
scheme	O
was	O
used	O
in	O
Windows	B-Application
3.1	I-Application
for	O
providing	O
a	O
FAT	B-Application
filesystem	I-Application
driver	O
in	O
32-bit	O
protected	O
mode	O
,	O
and	O
cached	O
,	O
(	O
VFAT	O
)	O
that	O
bypassed	O
the	O
DOS	O
FAT	B-Application
driver	O
in	O
the	O
kernel	O
(	O
MSDOS.SYS	O
)	O
completely	O
,	O
and	O
later	O
in	O
the	O
Windows	O
9x	O
series	O
(	O
95	B-Application
,	O
98	B-Device
and	O
Me	B-Device
)	O
for	O
VFAT	O
,	O
the	O
ISO9660	O
filesystem	B-Application
driver	O
(	O
along	O
with	O
Joliet	O
)	O
,	O
network	O
shares	O
,	O
and	O
third	O
party	O
filesystem	B-Application
drivers	O
,	O
as	O
well	O
as	O
adding	O
to	O
the	O
original	O
DOS	O
APIs	B-Application
the	O
LFN	O
API	B-Application
(	O
that	O
IFS	O
drivers	O
can	O
not	O
only	O
intercept	O
the	O
already	O
existent	O
DOS	O
file	O
APIs	B-Application
but	O
also	O
add	O
new	O
ones	O
from	O
within	O
the	O
32-bit	O
protected	O
mode	O
executable	O
)	O
.	O
</s>
<s>
However	O
that	O
API	B-Application
was	O
not	O
completely	O
documented	O
,	O
and	O
third	O
parties	O
found	O
themselves	O
in	O
a	O
"	O
make-it-by-yourself	O
"	O
scenario	O
even	O
worse	O
than	O
with	O
kernel-based	O
APIs	B-Application
.	O
</s>
<s>
The	O
API	B-Application
is	O
in	O
the	O
user	B-Operating_System
space	I-Operating_System
when	O
the	O
filesystem	B-Application
does	O
not	O
directly	O
use	O
kernel	O
facilities	O
but	O
accesses	O
disks	O
using	O
high-level	O
operating	O
system	O
functions	O
and	O
provides	O
functions	O
in	O
a	O
library	B-Library
that	O
a	O
series	O
of	O
utilities	O
use	O
to	O
access	O
the	O
filesystem	B-Application
.	O
</s>
<s>
The	O
advantage	O
is	O
that	O
a	O
filesystem	B-Application
can	O
be	O
made	O
portable	O
between	O
operating	O
systems	O
as	O
the	O
high-level	O
operating	O
system	O
functions	O
it	O
uses	O
can	O
be	O
as	O
common	O
as	O
ANSI	O
C	O
,	O
but	O
the	O
disadvantage	O
is	O
that	O
the	O
API	B-Application
is	O
unique	O
to	O
each	O
application	O
that	O
implements	O
one	O
.	O
</s>
<s>
As	O
all	O
filesystems	B-Application
(	O
at	O
least	O
the	O
disk	O
ones	O
)	O
need	O
equivalent	O
functions	O
provided	O
by	O
the	O
kernel	O
,	O
it	O
is	O
possible	O
to	O
easily	O
port	O
a	O
filesystem	B-Application
code	O
from	O
one	O
API	B-Application
to	O
another	O
,	O
even	O
if	O
they	O
are	O
of	O
different	O
types	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
ext2	B-Application
driver	O
for	O
OS/2	B-Application
is	O
simply	O
a	O
wrapper	O
from	O
the	O
Linux	B-Application
's	O
VFS	O
to	O
the	O
OS/2	B-Application
'	O
s	O
IFS	O
and	O
the	O
Linux	B-Application
's	O
ext2	B-Application
kernel-based	O
,	O
and	O
the	O
HFS	O
driver	O
for	O
OS/2	B-Application
is	O
a	O
port	O
of	O
the	O
hfsutils	O
to	O
the	O
OS/2	B-Application
'	O
s	O
IFS	O
.	O
</s>
<s>
There	O
also	O
exists	O
a	O
project	O
that	O
uses	O
a	O
Windows	B-Device
NT	I-Device
IFS	O
driver	O
for	O
making	O
NTFS	B-Application
work	O
under	O
Linux	B-Application
.	O
</s>
