@@ -4821,6 +4821,86 @@ sysret_t sys_fstatfs64(int fd, size_t sz, struct statfs *buf)
4821
4821
return ret ;
4822
4822
}
4823
4823
4824
+ sysret_t sys_mount (char * source , char * target ,
4825
+ char * filesystemtype ,
4826
+ unsigned long mountflags , void * data )
4827
+ {
4828
+ char * copy_source ;
4829
+ char * copy_target ;
4830
+ char * copy_filesystemtype ;
4831
+ size_t len_source , copy_len_source ;
4832
+ size_t len_target , copy_len_target ;
4833
+ size_t len_filesystemtype , copy_len_filesystemtype ;
4834
+ int err_source , err_target , err_filesystemtype ;
4835
+ char * tmp = NULL ;
4836
+ int ret = 0 ;
4837
+
4838
+ len_source = lwp_user_strlen (source , & err_source );
4839
+ len_target = lwp_user_strlen (target , & err_target );
4840
+ len_filesystemtype = lwp_user_strlen (filesystemtype , & err_filesystemtype );
4841
+ if (err_source || err_target || err_filesystemtype )
4842
+ {
4843
+ return - EFAULT ;
4844
+ }
4845
+
4846
+ copy_source = (char * )rt_malloc (len_source + 1 + len_target + 1 + len_filesystemtype + 1 );
4847
+ if (!copy_source )
4848
+ {
4849
+ return - ENOMEM ;
4850
+ }
4851
+ copy_target = copy_source + len_source + 1 ;
4852
+ copy_filesystemtype = copy_target + len_target + 1 ;
4853
+
4854
+ copy_len_source = lwp_get_from_user (copy_source , source , len_source );
4855
+ copy_source [copy_len_source ] = '\0' ;
4856
+ copy_len_target = lwp_get_from_user (copy_target , target , len_target );
4857
+ copy_target [copy_len_target ] = '\0' ;
4858
+ copy_len_filesystemtype = lwp_get_from_user (copy_filesystemtype , filesystemtype , len_filesystemtype );
4859
+ copy_filesystemtype [copy_len_filesystemtype ] = '\0' ;
4860
+
4861
+ if (strcmp (copy_filesystemtype , "nfs" ) == 0 )
4862
+ {
4863
+ tmp = copy_source ;
4864
+ copy_source = NULL ;
4865
+ }
4866
+ if (strcmp (copy_filesystemtype , "tmp" ) == 0 )
4867
+ {
4868
+ copy_source = NULL ;
4869
+ }
4870
+ ret = dfs_mount (copy_source , copy_target , copy_filesystemtype , 0 , tmp );
4871
+ rt_free (copy_source );
4872
+
4873
+ return ret ;
4874
+ }
4875
+
4876
+ sysret_t sys_umount2 (char * __special_file , int __flags )
4877
+ {
4878
+ char * copy_special_file ;
4879
+ size_t len_special_file , copy_len_special_file ;
4880
+ int err_special_file ;
4881
+ int ret = 0 ;
4882
+
4883
+ len_special_file = lwp_user_strlen (__special_file , & err_special_file );
4884
+ if (err_special_file )
4885
+ {
4886
+ return - EFAULT ;
4887
+ }
4888
+
4889
+ copy_special_file = (char * )rt_malloc (len_special_file + 1 );
4890
+ if (!copy_special_file )
4891
+ {
4892
+ return - ENOMEM ;
4893
+ }
4894
+
4895
+ copy_len_special_file = lwp_get_from_user (copy_special_file , __special_file , len_special_file );
4896
+ copy_special_file [copy_len_special_file ] = '\0' ;
4897
+
4898
+ ret = dfs_unmount (copy_special_file );
4899
+ rt_free (copy_special_file );
4900
+
4901
+ return ret ;
4902
+ }
4903
+
4824
4904
const static struct rt_syscall_def func_table [] =
4825
4905
{
4826
4906
SYSCALL_SIGN (sys_exit ), /* 01 */
@@ -5037,6 +5117,8 @@ const static struct rt_syscall_def func_table[] =
5037
5117
SYSCALL_SIGN (sys_fstatfs ),
5038
5118
SYSCALL_SIGN (sys_fstatfs64 ),
5039
5119
SYSCALL_SIGN (sys_openat ), /* 175 */
5120
+ SYSCALL_SIGN (sys_mount ),
5121
+ SYSCALL_SIGN (sys_umount2 ),
5040
5122
};
5041
5123
5042
5124
const void * lwp_get_sys_api (rt_uint32_t number )
0 commit comments