osPfsReSizeFile.3p
2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.TH osPfsReSizeFile 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osPfsReSizeFile \- Set a file to a specified length
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
s32 osPfsReSizeFile(OSPfs \(**pfs, u16 company_code, u32 game_code,
u8 \(**game_name, u8 \(**ext_name, int length)
.Op
\f1
.fi
.SH DESCRIPTION
.sp
The
.I osPfsReSizeFile
call set the size of the file whose name is given by
.I company_code, game_code, game_name, and ext_name,
to
.I length
bytes.
.sp
If the file was previously longer than
.I length,
bytes past
.I length
will no longer be accessible. If it was shorter, bytes from the EOF before the
call to the EOF after the call will be read in as zeros. The
.I length
must be multiple of
.I BLOCKSIZE
bytes.
The
.I OSPfs
handle
must be the handle returned from
.I osPfsInit.
See
.IR osPfsInit (3P)
for details on how to create this handle.
.sp
Note that the file is not allowed to grow on the write. The application
should declare the size needed on allocation time or use
.I osPfsReSizeFile
to grow/truncate the file.
.sp
A value of 0 is returned if the calls succeed, otherwise
one of the following error code is returned.
.PP
.nf
.ta 5 26
PFS_ERR_CONTRFAIL The controller sends data at higher data
transfer rate than the hardware handling
capability or the hardware CRC error
occurs.
.sp
PFS_ERR_INVALID Invalid parameter or the specified file
does not exist. Application should change
parameter and then retry.
.sp
PFS_ERR_NEW_PACK CONTROLLER PAK has been changed to a
different one. Application needs to call
osPfsInit(3p) to initialize the new
CONTROLLER PAK.
.sp
PFS_ERR_INCONSISTENT File system is corrupted. Application needs
to call osPfsChecker(3P) to repair the file
system.
.sp
PFS_DATA_FULL No free space on CONTROLLER PAK. No old
files can grow and no new files can be
created. Application should ask users to
change to a new CONTROLLER PAK or loop
through directory to let users delete files.
.fi
.SH "SEE ALSO"
osContInit (3P),
osPfsAllocateFile (3P),
osPfsChecker (3P),
osPfsFileState (3P),
osPfsFreeBlocks (3P),
osPfsInit (3P),
osPfsIsPlug (3P),
osPfsReadWriteFile (3P),
osPfsSetLabel (3P)