Rev 2404 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2404 | Rev 2435 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
30 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
31 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
32 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
32 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
33 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ |
34 | */ |
35 | 35 | ||
- | 36 | /** @addtogroup FileSystemImpl |
|
- | 37 | * @{ |
|
36 | 38 | */ |
|
37 | /* This file contains the procedures for opening, closing, and seeking on files. */ |
- | |
38 | 39 | ||
39 | /* Methods: |
40 | /** |
40 | * do_open: perform the OPEN system call |
- | |
41 | * do_close: perform the CLOSE system call |
41 | * @file open.c |
42 | * do_lseek: perform the SEEK system call |
42 | * @brief This file contains the procedures for opening, closing, and seeking on files. |
43 | */ |
43 | */ |
44 | 44 | ||
45 | - | ||
46 | #include "fs.h" |
45 | #include "fs.h" |
47 | #include "block.h" |
46 | #include "block.h" |
48 | #include "file.h" |
47 | #include "file.h" |
49 | #include "fproc.h" |
48 | #include "fproc.h" |
50 | #include "inode.h" |
49 | #include "inode.h" |
51 | #include "param.h" |
50 | #include "param.h" |
52 | 51 | ||
53 | 52 | /** |
|
- | 53 | * Perform the OPEN system call |
|
- | 54 | */ |
|
54 | int do_open() |
55 | int do_open() |
55 | { |
56 | { |
56 | 57 | ||
57 | /* Perform the open(file_name) system call */ |
58 | /* Perform the open(file_name) system call */ |
58 | 59 | ||
Line 80... | Line 81... | ||
80 | fil_ptr->filp_flags = R_BIT; |
81 | fil_ptr->filp_flags = R_BIT; |
81 | 82 | ||
82 | return fd; |
83 | return fd; |
83 | } |
84 | } |
84 | 85 | ||
- | 86 | /** |
|
- | 87 | * Perform the CLOSE system call |
|
- | 88 | */ |
|
85 | int do_close() |
89 | int do_close() |
86 | { |
90 | { |
87 | 91 | ||
88 | /* Perform the close(fd) system call. */ |
92 | /* Perform the close(fd) system call. */ |
89 | 93 | ||
Line 104... | Line 108... | ||
104 | fp->fp_filp[fd] = NIL_FILP; |
108 | fp->fp_filp[fd] = NIL_FILP; |
105 | 109 | ||
106 | return OK; |
110 | return OK; |
107 | } |
111 | } |
108 | 112 | ||
- | 113 | /** |
|
- | 114 | * Perform the SEEK system call |
|
- | 115 | */ |
|
109 | int do_lseek() |
116 | int do_lseek() |
110 | { |
117 | { |
111 | 118 | ||
112 | /* Perform the seek(ls_fd, offset, whence) system call. */ |
119 | /* Perform the seek(ls_fd, offset, whence) system call. */ |
113 | 120 | ||
Line 152... | Line 159... | ||
152 | rfilp->filp_pos = pos; |
159 | rfilp->filp_pos = pos; |
153 | 160 | ||
154 | return pos; |
161 | return pos; |
155 | } |
162 | } |
156 | 163 | ||
- | 164 | /** |
|
- | 165 | * } |
|
- | 166 | */ |
|
- | 167 |