00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "fs/client/client_fs.h"
00018
00019 SDW open(char *fname,DW mode)
00020 {
00021 SDD res;
00022 __asm__ __volatile__("pushl %%eax"::"a"(mode));
00023 __asm__ __volatile__("pushl %%eax"::"a"(fname));
00024 __asm__ __volatile__("int $0x30"::"a"(13));
00025 __asm__ __volatile__("popl %ebx");
00026 __asm__ __volatile__("popl %ebx");
00027 __asm__ __volatile__("pushl %eax");
00028 __asm__ __volatile__("popl %0":"=r"(res));
00029 return res;
00030 }
00031
00032 SDW close(DW fd_in)
00033 {
00034 SDD res;
00035 __asm__ __volatile__("pushl %%eax"::"a"(fd_in));
00036 __asm__ __volatile__("int $0x30"::"a"(14));
00037 __asm__ __volatile__("popl %ebx");
00038 __asm__ __volatile__("pushl %eax");
00039 __asm__ __volatile__("popl %0":"=r"(res));
00040 return res;
00041
00042 }
00043
00044 SDW read(DW fd_in,char *buf,DW length)
00045 {
00046 SDD res;
00047 __asm__ __volatile__("pushl %%eax"::"a"(length));
00048 __asm__ __volatile__("pushl %%eax"::"a"(buf));
00049 __asm__ __volatile__("pushl %%eax"::"a"(fd_in));
00050 __asm__ __volatile__("int $0x30"::"a"(15));
00051 __asm__ __volatile__("popl %ebx");
00052 __asm__ __volatile__("popl %ebx");
00053 __asm__ __volatile__("popl %ebx");
00054 __asm__ __volatile__("pushl %eax");
00055 __asm__ __volatile__("popl %0":"=r"(res));
00056 return res;
00057 }
00058
00059 SDW write(DW fd_in,char *buf,DW length)
00060 {
00061 SDD res;
00062 __asm__ __volatile__("pushl %%eax"::"a"(length));
00063 __asm__ __volatile__("pushl %%eax"::"a"(buf));
00064 __asm__ __volatile__("pushl %%eax"::"a"(fd_in));
00065
00066 __asm__ __volatile__("int $0x30"::"a"(16));
00067
00068 __asm__ __volatile__("popl %ebx");
00069 __asm__ __volatile__("popl %ebx");
00070 __asm__ __volatile__("popl %ebx");
00071
00072 __asm__ __volatile__("pushl %eax");
00073 __asm__ __volatile__("popl %0":"=r"(res));
00074 return res;
00075
00076 }
00077
00078 SDW creat(char *fname)
00079 {
00080 SDD res;
00081 __asm__ __volatile__("pushl %%eax"::"a"(fname));
00082 __asm__ __volatile__("int $0x30"::"a"(17));
00083 __asm__ __volatile__("popl %ebx");
00084
00085 __asm__ __volatile__("pushl %eax");
00086 __asm__ __volatile__("popl %0"::"r"(res));
00087 return res;
00088
00089 }
00090
00091 SDW opendir(char *name)
00092 {
00093 SDD res;
00094 __asm__ __volatile__("pushl %%eax"::"a"(name));
00095 __asm__ __volatile__("int $0x30"::"a"(18));
00096 __asm__ __volatile__("popl %ebx");
00097
00098 __asm__ __volatile__("pushl %eax");
00099 __asm__ __volatile__("popl %0":"=r"(res));
00100 return res;
00101 }
00102
00103 SDW createdir(char *name)
00104 {
00105 SDD res;
00106 __asm__ __volatile__("pushl %%eax"::"a"(name));
00107 __asm__ __volatile__("int $0x30"::"a"(19));
00108 __asm__ __volatile__("popl %ebx");
00109
00110 __asm__ __volatile__("pushl %eax");
00111 __asm__ __volatile__("popl %0":"=r"(res));
00112 return res;
00113 }
00114
00115 SDW closedir(DW dd_in)
00116 {
00117 SDD res;
00118 __asm__ __volatile__("pushl %%eax"::"a"(dd_in));
00119 __asm__ __volatile__("int $0x30"::"a"(20));
00120 __asm__ __volatile__("popl %ebx");
00121
00122 __asm__ __volatile__("pushl %eax");
00123 __asm__ __volatile__("popl %0":"=r"(res));
00124 return res;
00125 }
00126
00127 SDW readdir(DW dd_in,DIRENT *dir)
00128 {
00129 SDD res;
00130 __asm__ __volatile__("pushl %%eax"::"a"(dir));
00131 __asm__ __volatile__("pushl %%eax"::"a"(dd_in));
00132 __asm__ __volatile__("int $0x30"::"a"(21));
00133 __asm__ __volatile__("popl %ebx");
00134 __asm__ __volatile__("popl %ebx");
00135
00136 __asm__ __volatile__("pushl %eax");
00137 __asm__ __volatile__("popl %0":"=r"(res));
00138 return res;
00139 }
00140
00141 SDW fs_remove(char *name)
00142 {
00143 SDD res;
00144 __asm__ __volatile__("pushl %%eax"::"a"(name));
00145 __asm__ __volatile__("int $0x30"::"a"(22));
00146 __asm__ __volatile__("popl %ebx");
00147
00148 __asm__ __volatile__("pushl %eax");
00149 __asm__ __volatile__("popl %0":"=r"(res));
00150 return res;
00151 }
00152
00153
00154 SDW rename(char *old_name,char *new_name)
00155 {
00156 SDD res;
00157 __asm__ __volatile__("pushl %%eax"::"a"(new_name));
00158 __asm__ __volatile__("pushl %%eax"::"a"(old_name));
00159 __asm__ __volatile__("int $0x30"::"a"(23));
00160 __asm__ __volatile__("popl %ebx");
00161 __asm__ __volatile__("popl %ebx");
00162
00163 __asm__ __volatile__("pushl %eax");
00164 __asm__ __volatile__("popl %0":"=r"(res));
00165 return res;
00166 }
00167
00168