Home
last modified time | relevance | path

Searched refs:i32 (Results 1 – 25 of 40) sorted by relevance

12

/DragonOS-0.1.5/kernel/src/driver/timers/rtc/
Drtc.rs7 pub second: i32,
8 pub minute: i32,
9 pub hour: i32,
10 pub day: i32,
11 pub month: i32,
12 pub year: i32,
33 pub fn get(&mut self) -> Result<i32, i32> { in get() argument
51 self.year = read_cmos(CMOSTimeSelector::Year as u8) as i32; in get()
52 self.month = read_cmos(CMOSTimeSelector::Month as u8) as i32; in get()
53 self.day = read_cmos(CMOSTimeSelector::Day as u8) as i32; in get()
[all …]
/DragonOS-0.1.5/kernel/src/filesystem/vfs/
Dmod.rs94 fn open(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in open() argument
96 return Err(-(ENOTSUP as i32)); in open()
103 fn close(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in close() argument
105 return Err(-(ENOTSUP as i32)); in close()
123 ) -> Result<usize, i32>; in read_at() argument
140 ) -> Result<usize, i32>; in write_at() argument
145 fn poll(&self) -> Result<PollStatus, i32>; in poll() argument
151 fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
153 return Err(-(ENOTSUP as i32)); in metadata()
160 fn set_metadata(&self, _metadata: &Metadata) -> Result<(), i32> { in set_metadata() argument
[all …]
Dsyscall.rs32 return (-(EINVAL as i32)) as u64; in sys_open()
37 let r: Result<i32, i32> = do_open(path, open_flags); in sys_open()
51 let fd = regs.r8 as i32; in sys_close()
52 let r: Result<(), i32> = current_pcb().drop_fd(fd); in sys_close()
68 let fd = regs.r8 as i32; in sys_read()
75 return (-(EPERM as i32)) as u64; in sys_read()
81 let r: Result<usize, i32> = do_read(fd, buf); in sys_read()
97 let fd = regs.r8 as i32; in sys_write()
104 return (-(EPERM as i32)) as u64; in sys_write()
110 let r: Result<usize, i32> = do_write(fd, buf); in sys_write()
[all …]
Dcore.rs48 pub extern "C" fn vfs_init() -> i32 { in vfs_init()
102 ) -> Result<(), i32> { in do_migrate() argument
120 fn migrate_virtual_filesystem(new_fs: Arc<dyn FileSystem>) -> Result<(), i32> { in migrate_virtual_filesystem() argument
153 pub extern "C" fn mount_root_fs() -> i32 { in mount_root_fs()
163 let fatfs: Result<Arc<FATFileSystem>, i32> = FATFileSystem::new(partiton); in mount_root_fs()
187 pub fn do_open(path: &str, mode: FileMode) -> Result<i32, i32> { in do_open() argument
190 return Err(-(ENAMETOOLONG as i32)); in do_open()
193 let inode: Result<Arc<dyn IndexNode>, i32> = ROOT_INODE().lookup(path); in do_open()
200 && errno == -(ENOENT as i32) in do_open()
220 return Err(-(ENOTDIR as i32)); in do_open()
[all …]
Dmount.rs107 fn is_mountpoint_root(&self) -> Result<bool, i32> { in is_mountpoint_root() argument
129 fn open(&self, data: &mut FilePrivateData) -> Result<(), i32> { in open() argument
133 fn close(&self, data: &mut FilePrivateData) -> Result<(), i32> { in close() argument
143 ) -> Result<Arc<dyn IndexNode>, i32> { in create_with_data() argument
149 fn truncate(&self, len: usize) -> Result<(), i32> { in truncate() argument
159 ) -> Result<usize, i32> { in read_at() argument
169 ) -> Result<usize, i32> { in write_at() argument
176 fn poll(&self) -> Result<super::PollStatus, i32> { in poll() argument
191 fn metadata(&self) -> Result<super::Metadata, i32> { in metadata() argument
196 fn set_metadata(&self, metadata: &super::Metadata) -> Result<(), i32> { in set_metadata() argument
[all …]
Dfile.rs99 pub fn new(inode: Arc<dyn IndexNode>, mode: FileMode) -> Result<Self, i32> { in new() argument
121 pub fn read(&mut self, len: usize, buf: &mut [u8]) -> Result<usize, i32> { in read() argument
126 return Err(-(ENOBUFS as i32)); in read()
143 pub fn write(&mut self, len: usize, buf: &[u8]) -> Result<usize, i32> { in write() argument
147 return Err(-(ENOBUFS as i32)); in write()
157 pub fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
162 pub fn get_entry_name(&self, ino: usize) -> Result<String, i32> { in get_entry_name() argument
169 pub fn lseek(&mut self, origin: SeekFrom) -> Result<usize, i32> { in lseek() argument
171 return Err(-(ESPIPE as i32)); in lseek()
186 return Err(-(EINVAL as i32)); in lseek()
[all …]
/DragonOS-0.1.5/kernel/src/libs/
Dlockref.rs15 pub count: i32,
22 count: i32,
53 fn cmpxchg_loop(&mut self, mode: CmpxchgMode) -> Result<i32, i32> { in cmpxchg_loop() argument
117 return Err(-(ETIMEDOUT as i32)); in cmpxchg_loop()
123 fn cmpxchg_loop(&mut self, mode: CmpxchgMode) -> Result<i32, i32> { in cmpxchg_loop() argument
126 return Err(-(ENOTSUP as i32)); in cmpxchg_loop()
147 pub fn inc_not_zero(&mut self) -> Result<i32, i32> { in inc_not_zero() argument
176 pub fn inc_not_dead(&mut self) -> Result<i32, i32> { in inc_not_dead() argument
206 pub fn dec(&mut self) -> Result<i32, i32> { in dec() argument
213 let retval: Result<i32, i32>; in dec()
[all …]
Dvec_cursor.rs48 pub fn read_u8(&mut self) -> Result<u8, i32> { in read_u8() argument
50 return Err(-(E2BIG as i32)); in read_u8()
57 pub fn read_u16(&mut self) -> Result<u16, i32> { in read_u16() argument
59 return Err(-(E2BIG as i32)); in read_u16()
71 pub fn read_u32(&mut self) -> Result<u32, i32> { in read_u32() argument
73 return Err(-(E2BIG as i32)); in read_u32()
85 pub fn read_u64(&mut self) -> Result<u64, i32> { in read_u64() argument
87 return Err(-(E2BIG as i32)); in read_u64()
104 pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), i32> { in read_exact() argument
106 return Err(-(E2BIG as i32)); in read_exact()
[all …]
Dsemaphore.rs21 fn new(counter: i32) -> Result<Self, i32> { in new() argument
28 return Err(-(EOVERFLOW as i32)); in new()
/DragonOS-0.1.5/kernel/src/filesystem/ramfs/
Dmod.rs125 ) -> Result<usize, i32> { in read_at() argument
127 return Err(-(EINVAL as i32)); in read_at()
134 return Err(-(EISDIR as i32)); in read_at()
142 return Err(-(ENOBUFS as i32)); in read_at()
157 ) -> Result<usize, i32> { in write_at() argument
159 return Err(-(EINVAL as i32)); in write_at()
167 return Err(-(EISDIR as i32)); in write_at()
182 fn poll(&self) -> Result<PollStatus, i32> { in poll() argument
188 return Err(-(EISDIR as i32)); in poll()
204 fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
[all …]
/DragonOS-0.1.5/docs/kernel/locking/
Dlockref.md19 pub count: i32,
26 count: i32,
62 - `pub fn inc_not_zero(&mut self) -> Result<i32, i32>`
63 - `pub fn inc_not_dead(&mut self) -> Result<i32, i32>`
102 - `pub fn dec(&mut self) -> Result<i32, i32>`
103 - `pub fn dec_return(&mut self) -> Result<i32, i32>`
104 - `pub fn dec_not_zero(&mut self) -> Result<i32, i32>`
105 - `pub fn dec_or_lock_not_zero(&mut self) -> Result<i32, i32>`
/DragonOS-0.1.5/kernel/src/driver/disk/ahci/
Dahci_inode.rs80 fn open(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in open() argument
81 Err(-(ENOTSUP as i32)) in open()
84 fn close(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in close() argument
85 Err(-(ENOTSUP as i32)) in close()
88 fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
96 fn list(&self) -> Result<Vec<String>, i32> { in list() argument
97 Err(-(ENOTSUP as i32)) in list()
100 fn set_metadata(&self, metadata: &Metadata) -> Result<(), i32> { in set_metadata() argument
112 fn poll(&self) -> Result<PollStatus, i32> { in poll() argument
125 ) -> Result<usize, i32> { in read_at() argument
[all …]
/DragonOS-0.1.5/kernel/src/process/
Dprocess.rs43 _wake_flags: i32, in process_try_to_wake_up() argument
114 pub fn init_files(&mut self) -> Result<(), i32> { in init_files() argument
118 return Err(-(EPERM as i32)); in init_files()
136 ) -> Result<(), i32> { in copy_files() argument
161 pub fn exit_files(&mut self) -> Result<(), i32> { in exit_files() argument
177 pub fn alloc_fd(&mut self, file: File) -> Result<i32, i32> { in alloc_fd() argument
189 return Err(-(EFAULT as i32)); in alloc_fd()
203 return Err(-(ENFILE as i32)); in alloc_fd()
211 pub fn get_file_mut_by_fd(&self, fd: i32) -> Option<&mut File> { in get_file_mut_by_fd()
225 pub fn get_file_ref_by_fd(&self, fd: i32) -> Option<&File> { in get_file_ref_by_fd()
[all …]
/DragonOS-0.1.5/kernel/src/filesystem/devfs/
Dmod.rs97 pub fn register_device<T: DeviceINode>(&self, name: &str, device: Arc<T>) -> Result<(), i32> { in register_device() argument
130 return Err(-(ENOTSUP as i32)); in register_device()
138 pub fn unregister_device<T: DeviceINode>(&self, name: &str, device: Arc<T>) -> Result<(), i32> { in unregister_device() argument
144 return Err(-(ENOENT as i32)); in unregister_device()
157 return Err(-(ENOENT as i32)); in unregister_device()
169 return Err(-(ENOTSUP as i32)); in unregister_device()
233 pub fn add_dir(&self, name: &str) -> Result<(), i32> { in add_dir() argument
237 return Err(-(EEXIST as i32)); in add_dir()
250 pub fn add_dev(&self, name: &str, dev: Arc<dyn IndexNode>) -> Result<(), i32> { in add_dev() argument
254 return Err(-(EEXIST as i32)); in add_dev()
[all …]
Dnull_dev.rs75 fn open(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in open() argument
76 Err(-(ENOTSUP as i32)) in open()
79 fn close(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in close() argument
80 Err(-(ENOTSUP as i32)) in close()
83 fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
91 fn list(&self) -> Result<Vec<String>, i32> { in list() argument
92 Err(-(ENOTSUP as i32)) in list()
95 fn set_metadata(&self, metadata: &Metadata) -> Result<(), i32> { in set_metadata() argument
107 fn poll(&self) -> Result<PollStatus, i32> { in poll() argument
120 ) -> Result<usize, i32> { in read_at() argument
[all …]
Dzero_dev.rs75 fn open(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in open() argument
76 Err(-(ENOTSUP as i32)) in open()
79 fn close(&self, _data: &mut FilePrivateData) -> Result<(), i32> { in close() argument
80 Err(-(ENOTSUP as i32)) in close()
83 fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
91 fn list(&self) -> Result<Vec<String>, i32> { in list() argument
92 Err(-(ENOTSUP as i32)) in list()
95 fn set_metadata(&self, metadata: &Metadata) -> Result<(), i32> { in set_metadata() argument
107 fn poll(&self) -> Result<PollStatus, i32> { in poll() argument
120 ) -> Result<usize, i32> { in read_at() argument
[all …]
/DragonOS-0.1.5/kernel/src/filesystem/procfs/
Dmod.rs117 fn open_status(&self, pdata: &mut ProcfsFilePrivateData) -> Result<i64, i32> { in open_status() argument
126 return Err(-(ESRCH as i32)); in open_status()
201 ) -> Result<usize, i32> { in read_status() argument
207 return Err(-(ENOBUFS as i32)); in read_status()
281 pub fn register_pid(&self, pid: i64) -> Result<(), i32> { in register_pid() argument
303 pub fn unregister_pid(&self, pid: i64) -> Result<(), i32> { in unregister_pid() argument
322 fn open(&self, data: &mut FilePrivateData) -> Result<(), i32> { in open() argument
345 fn close(&self, data: &mut FilePrivateData) -> Result<(), i32> { in close() argument
369 ) -> Result<usize, i32> { in read_at() argument
371 return Err(-(EINVAL as i32)); in read_at()
[all …]
/DragonOS-0.1.5/docs/community/code_contribution/
Drust-coding-style.md21 fn foo() -> i32 {
26 fn foo() -> i32 {
32 &emsp;&emsp;DragonOS采用返回Posix错误码作为**模块间错误处理**的方式。为了确保在模块之间,错误处理代码的一致性,我们推荐在发生错误的时候,返回`Err(i32)`,并且p…
45 fn foo() -> Result<(), i32> {
49 return Err(-(EINVAL as i32));
/DragonOS-0.1.5/kernel/src/driver/keyboard/
Dps2_keyboard.rs84 ) -> Result<usize, i32> { in read_at() argument
104 ) -> Result<usize, i32> { in write_at() argument
105 return Err(-(ENOTSUP as i32)); in write_at()
108 fn open(&self, _data: &mut crate::filesystem::vfs::FilePrivateData) -> Result<(), i32> { in open() argument
115 fn close(&self, _data: &mut crate::filesystem::vfs::FilePrivateData) -> Result<(), i32> { in close() argument
122 fn poll(&self) -> Result<PollStatus, i32> { in poll() argument
128 fn metadata(&self) -> Result<Metadata, i32> { in metadata() argument
132 fn set_metadata(&self, metadata: &Metadata) -> Result<(), i32> { in set_metadata() argument
152 fn list(&self) -> Result<alloc::vec::Vec<alloc::string::String>, i32> { in list() argument
153 return Err(-(ENOTSUP as i32)); in list()
/DragonOS-0.1.5/kernel/src/driver/virtio/
Dvirtio_impl.rs18 (pages * PAGE_SIZE / (PAGE_2M_SIZE as usize) + 1) as i32 in dma_alloc()
20 (pages * PAGE_SIZE / (PAGE_2M_SIZE as usize)) as i32 in dma_alloc()
33 fn dma_dealloc(paddr: PhysAddr, pages: usize) -> i32 { in dma_dealloc() argument
36 (pages * PAGE_SIZE / (PAGE_2M_SIZE as usize) + 1) as i32 in dma_dealloc()
38 (pages * PAGE_SIZE / (PAGE_2M_SIZE as usize)) as i32 in dma_dealloc()
/DragonOS-0.1.5/kernel/src/filesystem/fat/
Dbpb.rs183 pub fn new(partition: Arc<Partition>) -> Result<BiosParameterBlock, i32> { in new() argument
273 pub fn validate(&self, bpb32: &BiosParameterBlockFAT32) -> Result<(), i32> { in validate() argument
277 return Err(-(EINVAL as i32)); in validate()
280 return Err(-(EINVAL as i32)); in validate()
283 return Err(-(EINVAL as i32)); in validate()
290 return Err(-(EINVAL as i32)); in validate()
295 return Err(-(EINVAL as i32)); in validate()
300 return Err(-(EINVAL as i32)); in validate()
305 return Err(-(EINVAL as i32)); in validate()
310 return Err(-(EINVAL as i32)); in validate()
[all …]
Dfs.rs125 fn find(&mut self, name: &str) -> Result<Arc<LockedFATInode>, i32> { in find() argument
155 return Err(-(ENOTDIR as i32)); in find()
246 pub fn new(partition: Arc<Partition>) -> Result<Arc<FATFileSystem>, i32> { in new() argument
276 return Err(-(EINVAL as i32)); in new()
345 pub fn get_fat_entry(&self, cluster: Cluster) -> Result<FATEntry, i32> { in get_fat_entry() argument
440 pub fn get_fat_entry_raw(&self, cluster: Cluster) -> Result<u64, i32> { in get_fat_entry_raw() argument
541 pub fn allocate_cluster(&self, prev_cluster: Option<Cluster>) -> Result<Cluster, i32> { in allocate_cluster() argument
589 pub fn deallocate_cluster_chain(&self, start_cluster: Cluster) -> Result<(), i32> { in deallocate_cluster_chain() argument
600 pub fn deallocate_cluster(&self, cluster: Cluster) -> Result<(), i32> { in deallocate_cluster() argument
613 return Err(-(EFAULT as i32)); in deallocate_cluster()
[all …]
/DragonOS-0.1.5/kernel/src/ipc/
Dsignal_types.rs30 pub const MAX_SIG_NUM: i32 = 64;
32 pub const _NSIG_U64_CNT: i32 = MAX_SIG_NUM / 64;
166 pub si_signo: i32,
167 pub si_code: i32,
168 pub si_errno: i32,
193 pub fn new(sig: SignalNumber, _si_errno: i32, _si_code: si_code_val) -> Self { in new() argument
197 si_signo: sig as i32, in new()
198 si_code: _si_code as i32, in new()
259 #[repr(i32)]
280 pub fn from_i32(x: i32) -> si_code_val { in from_i32()
[all …]
Dsignal.rs66 let sig: SignalNumber = SignalNumber::from(regs.r9 as i32); in sys_kill()
78 si_signo: sig as i32, in sys_kill()
79 si_code: si_code_val::SI_USER as i32, in sys_kill()
110 ) -> Result<i32, i32> { in signal_kill_something_info() argument
114 return Err(-(ENOTSUP as i32)); in signal_kill_something_info()
125 ) -> Result<i32, i32> { in signal_kill_proc_info() argument
126 let mut retval = Err(-(ESRCH as i32)); in signal_kill_proc_info()
150 return if (sig as i32) <= MAX_SIG_NUM { in verify_signal()
165 ) -> Result<i32, i32> { in signal_send_sig_info() argument
169 return Err(-(EINVAL as i32)); in signal_send_sig_info()
[all …]
/DragonOS-0.1.5/kernel/src/io/
Ddevice.rs35 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, i32>; in read_at() argument
42 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, i32>; in write_at() argument
45 fn sync(&self) -> Result<(), i32>; in sync() argument
60 fn read_at(&self, lba_id_start: BlockId, count: usize, buf: &mut [u8]) -> Result<usize, i32>; in read_at() argument
69 fn write_at(&self, lba_id_start: BlockId, count: usize, buf: &[u8]) -> Result<usize, i32>; in write_at() argument
72 fn sync(&self) -> Result<(), i32>; in sync() argument
99 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, i32> { in read_at() argument
101 return Err(-(E2BIG as i32)); in read_at()
121 return Err(-(E2BIG as i32)); in read_at()
135 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, i32> { in write_at() argument
[all …]

12