/commonlibrary/rust/ylong_runtime/ylong_runtime/src/fs/ |
H A D | async_file.rs | 3 // you may not use this file except in compliance with the License. 35 file: Arc<SyncFile>, 103 f.debug_tuple("YlongFile").field(&self.file).finish() in fmt() 109 pub fn new(file: SyncFile) -> File { in fmt() 111 file: Arc::new(file), in fmt() 121 /// Attempts to open a file in read-only mode asynchronously. in fmt() 141 let file = async_op(|| SyncFile::open(path)).await?; in fmt() 142 Ok(File::new(file)) in fmt() 145 /// Opens a file i in fmt() 219 let mut file = self.inner.lock().await; fmt() variables 247 let mut file = self.inner.lock().await; fmt() variables 279 let mut file = self.inner.lock().await; fmt() variables 735 let mut file = File::create(file_path).await.unwrap(); ut_fs_file_seek() variables 744 let mut file = File::open(file_path).await.unwrap(); ut_fs_file_seek() variables 822 let mut file = File::create(file_path).await.unwrap(); ut_fs_file_sync_all() variables 849 let mut file = File::create(file_path).await.unwrap(); ut_fs_set_buf_size_limit() variables 891 let mut file = OpenOptions::new() ut_file_into_std() variables 928 let mut file = File::create(file_path).await.unwrap(); ut_file_try_into_std() variables 935 let mut file = std.unwrap_err(); ut_file_try_into_std() variables [all...] |
H A D | open_options.rs | 3 // you may not use this file except in compliance with the License. 22 /// Options and flags which can be used to configure how a file is opened. 28 /// let file = OpenOptions::new() 41 /// a file. 53 /// let file = options.read(true).open("foo.txt").await; 62 /// Sets the option for file read access. 64 /// This option, when true, will indicate that the file should be 75 /// let file = OpenOptions::new().read(true).open("foo.txt").await; 83 /// Sets the option for file write access. 85 /// This option, when true, will indicate that the file shoul [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/tests/ |
H A D | async_fs.rs | 3 // you may not use this file except in compliance with the License. 22 /// SDV test cases for asynchronous file writing 25 /// 1. Generate an asynchronous file IO with create. 32 let mut file = File::create(file_path).await.unwrap(); in sdv_async_fs_write() variables 34 let res = file.write(&buf).await.unwrap(); in sdv_async_fs_write() 36 file.sync_all().await.unwrap(); in sdv_async_fs_write() 41 let mut file = File::open(file_path).await.unwrap(); in sdv_async_fs_write() variables 43 let res = file.read(&mut buf).await.unwrap(); in sdv_async_fs_write() 51 /// SDV test cases for asynchronous file reading 54 /// 1. Generate an asynchronous file I 61 let mut file = File::create(file_path).await.unwrap(); sdv_async_fs_read() variables 67 let mut file = File::open(file_path).await.unwrap(); sdv_async_fs_read() variables 76 let mut file = File::open(file_path).await.unwrap(); sdv_async_fs_read() variables 101 let mut file = OpenOptions::new() sdv_async_fs_rw() variables 121 let mut file = File::open(file_path).await; sdv_async_fs_rw() variables 125 let mut file = file.unwrap(); sdv_async_fs_rw() variables 164 let mut file = File::create(file_path).await.unwrap(); sdv_async_fs_read_to_end() variables 171 let mut file = File::open(file_path).await.unwrap(); sdv_async_fs_read_to_end() variables 190 let mut file = File::create(file_path).await.unwrap(); sdv_async_fs_seek() variables 199 let mut file = File::open(file_path).await.unwrap(); sdv_async_fs_seek() variables 277 let mut file = File::create(file_path).await.unwrap(); sdv_async_fs_sync_all() variables 345 let mut file = OpenOptions::new() sdv_async_fs_open_options() variables [all...] |
H A D | async_buf_write.rs | 3 // you may not use this file except in compliance with the License. 104 /// 1. Create a file and write data. 105 /// 2. Open the file, seek to three different positions in the file and read 117 let mut file = File::create("buf_writer_seek_file").await.unwrap(); in sdv_buf_writer_seek() variables 119 let res = file.write(buf).await.unwrap(); in sdv_buf_writer_seek() 120 file.sync_all().await.unwrap(); in sdv_buf_writer_seek() 126 let file = File::open("buf_writer_seek_file").await.unwrap(); in sdv_buf_writer_seek() 127 let mut buf_writer = AsyncBufWriter::new(file); in sdv_buf_writer_seek()
|
H A D | async_buf_read.rs | 3 // you may not use this file except in compliance with the License. 195 /// 1. Create a file and write data. 196 /// 2. Open the file and call `read_until` with a delimiter '-'. 197 /// 3. Seek to three different positions in the file and read data. 208 let mut file = File::create("buf_reader_seek_file").await.unwrap(); in sdv_buf_reader_seek() variables 210 let res = file.write(buf).await.unwrap(); in sdv_buf_reader_seek() 211 file.sync_all().await.unwrap(); in sdv_buf_reader_seek() 217 let file = File::open("buf_reader_seek_file").await.unwrap(); in sdv_buf_reader_seek() 218 let mut buf_reader = AsyncBufReader::new(file); in sdv_buf_reader_seek()
|
/commonlibrary/c_utils/base/src/ |
H A D | file_ex.cpp | 4 * you may not use this file except in compliance with the License. 112 ifstream file(filePath.c_str()); in LoadStringFromFile() 113 if (!file.is_open()) { in LoadStringFromFile() 114 UTILS_LOGD("open file failed! filePath:%{public}s", filePath.c_str()); in LoadStringFromFile() 118 file.seekg(0, ios::end); in LoadStringFromFile() 119 const long long fileLength = file.tellg(); in LoadStringFromFile() 121 UTILS_LOGD("invalid file length(%{public}lld)!", fileLength); in LoadStringFromFile() 126 file.seekg(0, ios::beg); in LoadStringFromFile() 127 copy(istreambuf_iterator<char>(file), istreambuf_iterator<char>(), back_inserter(content)); in LoadStringFromFile() 153 UTILS_LOGD("LoadStringFromFd get file nam in LoadStringFromFdToFile() 210 ofstream file; SaveStringToFile() local 296 ifstream file; LoadBufferFromFile() local 340 ofstream file; SaveBufferToFile() local [all...] |
H A D | directory_ex.cpp | 4 * you may not use this file except in compliance with the License. 298 UTILS_LOGE("Access to file: %{public}s is failed", name); in ForceRemoveDirectory() 349 for (auto& file : files) { in GetFolderSize() 350 if (stat(file.c_str(), &statbuf) == 0) { in GetFolderSize()
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/ |
H A D | ylong_tokio_async_file.rs | 3 // you may not use this file except in compliance with the License. 38 let mut file = File::open(READ_FILE).await.unwrap(); in async_read() variables 42 file.read_exact(&mut READ_BUFFER).await.unwrap(); in async_read() 62 let mut file = File::open(READ_FILE).await.unwrap(); in async_read_by_chars() variables 67 file.read_exact(&mut buffer).await.unwrap(); in async_read_by_chars() 89 let mut file = File::create(WRITE_FILE).await.unwrap(); in async_write() variables 92 let _ = file.write(&WRITE_BUFFER).await.unwrap(); in async_write()
|
H A D | sync_benchmarks.rs | 3 // you may not use this file except in compliance with the License. 58 let mut file = File::open(READ_FILE).unwrap(); in std_read_file() variables 62 file.read_exact(&mut READ_BUFFER).unwrap(); in std_read_file() 72 let mut file = File::open(READ_FILE).unwrap(); in std_read_file_by_chars() variables 77 file.read_exact(&mut buffer).unwrap(); in std_read_file_by_chars() 90 let mut file = File::create(WRITE_FILE).unwrap(); in std_write_file() variables 93 let _ = file.write(&WRITE_BUFFER).unwrap(); in std_write_file()
|
H A D | ylong_tokio_file.rs | 3 // you may not use this file except in compliance with the License. 14 //! Benchmarks for large file io operations. Covers more scenarios than 29 let mut file = File::create(dir.clone()).await.unwrap(); variables 30 let _ = file.write_all($content).await.unwrap(); 40 let mut file = File::open(dir.clone()).await.unwrap(); variables 42 file.read_to_end(&mut buffer).await.unwrap();
|
/commonlibrary/c_utils/base/test/unittest/rust/ |
H A D | rust_utils_file_test.rs | 4 * you may not use this file except in compliance with the License. 32 if let Ok(mut file) = File::create(path) { in create_test_file() 33 if let Err(err) = file.write_all(content.as_bytes()) { in create_test_file() 34 println!("Error writing to file: {}", err); in create_test_file() 39 println!("Failed to create file: {}", path); in create_test_file() 55 let file = File::open(&filename).expect("Failed to open file"); in test_load_string_from_file_001() 56 let fd: RawFd = file.as_raw_fd(); in test_load_string_from_file_001() 131 let file = File::open(&filename).expect("Failed to open file"); in test_load_string_from_fd_002() 289 let mut file = File::create_new(&filename).expect("Failed to create file"); test_save_string_to_fd_002() variables 307 let mut file = File::create_new(&filename).expect("Failed to create file"); test_save_string_to_fd_003() variables 326 let mut file = File::open(&filename).expect("Failed to open file"); test_save_string_to_fd_004() variables [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/src/util/c_openssl/ssl/ |
H A D | ctx.rs | 3 // you may not use this file except in compliance with the License. 166 /// Loads trusted root certificates from a file.\ 169 /// The file should contain a sequence of PEM-formatted CA certificates. 170 pub(crate) fn set_ca_file<P>(&mut self, file: P) -> Result<(), ErrorStack> 174 let file = Self::get_c_file(file)?; 177 SSL_CTX_load_verify_locations(ptr, file.as_ptr() as *const _, ptr::null()) 193 /// Loads a leaf certificate from a file. 198 /// single file. 201 file [all...] |
/commonlibrary/rust/ylong_http/ylong_http_client/examples/ |
H A D | async_certs_adapter.rs | 3 // you may not use this file except in compliance with the License. 32 // cmp cert file in verify() 33 let mut file = std::fs::File::open("./tests/file/cert.pem").unwrap(); in verify() variables 35 file.read_to_string(&mut contents).unwrap(); in verify()
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/process/sys/unix/ |
H A D | pipe.rs | 3 // you may not use this file except in compliance with the License. 105 let mut file = std::fs::File::options() in ut_process_pipe_test() variables 111 let seek = file.stream_position().unwrap(); in ut_process_pipe_test() 112 let mut pipe = Pipe::from(file); in ut_process_pipe_test()
|
H A D | child.rs | 3 // you may not use this file except in compliance with the License. 100 let mut file = io.inner.io_take()?.fd; in to_blocking_file() variables 101 set_nonblock(&mut file, false)?; in to_blocking_file() 102 Ok(file) in to_blocking_file()
|
/commonlibrary/c_utils/base/test/fuzztest/directory_fuzzer/ |
H A D | directory_fuzzer.cpp | 4 * you may not use this file except in compliance with the License. 39 ofstream file = ofstream(testFile, fstream::out); in DirectoryTestFunc() local 40 file.close(); in DirectoryTestFunc()
|
/commonlibrary/rust/ylong_runtime/ylong_io/src/sys/unix/ |
H A D | waker.rs | 3 // you may not use this file except in compliance with the License. 53 let file = unsafe { File::from_raw_fd(fd) }; 60 .map(|()| WakerInner { fd: file })
|
/commonlibrary/rust/ylong_http/ylong_http_client/src/util/c_openssl/ |
H A D | error.rs | 3 // you may not use this file except in compliance with the License. 41 file: *const c_char, 43 file: CString, 55 file: self.file, in clone() 57 file: self.file.clone(), in clone() 72 let mut file = ptr::null(); in get() variables 80 match ERR_get_error_line_data(&mut file, &mut line, &mut data, &mut flags) { in get() 97 file, in get() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/process/pty_process/ |
H A D | sys.rs | 3 // you may not use this file except in compliance with the License. 90 let file = OpenOptions::new().read(true).write(true).open(path)?; 91 Ok(PtsInner(file.into()))
|
/commonlibrary/c_utils/base/test/unittest/common/ |
H A D | utils_directory_test.cpp | 4 * you may not use this file except in compliance with the License. 228 ofstream file("./test_file"); in HWTEST_F() 229 file.close(); in HWTEST_F() 277 // test symlink to file outside the target directory in HWTEST_F() 383 * @tc.desc: Remove soft link file. 409 // symlink to a file in HWTEST_F() 417 // Target file is not removed. in HWTEST_F() 427 * @tc.desc: Remove dangling soft link file. 435 // symlink to a file in HWTEST_F()
|
H A D | utils_mapped_file_test.cpp | 4 * you may not use this file except in compliance with the License. 79 std::cout << "open file failed!" << path.c_str() << std::endl; in CreateTestFile() 94 std::ofstream file; in SaveStringToFile() local 96 file.open(filePath.c_str(), std::ios::out | std::ios::trunc); in SaveStringToFile() 98 file.open(filePath.c_str(), std::ios::out | std::ios::app); in SaveStringToFile() 101 if (!file.is_open()) { in SaveStringToFile() 105 file.seekp(offset, std::ios::beg); in SaveStringToFile() 107 file.write(content.c_str(), content.length()); in SaveStringToFile() 108 if (file.fail()) { in SaveStringToFile() 153 // read from mapped file in TestFileReadAndWrite() [all...] |
/commonlibrary/c_utils/base/test/benchmarktest/mapped_benchmark_test/ |
H A D | mapped_benchmark_test.cpp | 4 * you may not use this file except in compliance with the License. 107 std::ofstream file; in SaveStringToFile() local 109 file.open(filePath.c_str(), std::ios::out | std::ios::trunc); in SaveStringToFile() 111 file.open(filePath.c_str(), std::ios::out | std::ios::app); in SaveStringToFile() 114 if (!file.is_open()) { in SaveStringToFile() 118 file.seekp(offset, std::ios::beg); in SaveStringToFile() 120 file.write(content.c_str(), content.length()); in SaveStringToFile() 121 if (file.fail()) { in SaveStringToFile() 156 * @tc.desc: Test file mapping with default params. 162 // 1. Create a new file in BENCHMARK_F() [all...] |
/commonlibrary/c_utils/base/test/benchmarktest/directory_benchmark_test/ |
H A D | directory_benchmark_test.cpp | 4 * you may not use this file except in compliance with the License. 184 ofstream file(resultfile[0], fstream::out); in BENCHMARK_F() 276 * @tc.desc: Remove soft link file. 304 // symlink to a file in BENCHMARK_F() 312 // Target file is not removed. in BENCHMARK_F() 324 * @tc.desc: Remove dangling soft link file. 334 // symlink to a file in BENCHMARK_F() 525 * @tc.desc: test transform the file name
|
/commonlibrary/rust/ylong_json/src/ |
H A D | value.rs | 3 // you may not use this file except in compliance with the License. 672 /// Reads the contents from the file and Trys to deserialize to a JsonValue instance. in fmt() 682 let mut file = File::open(path.as_ref())?; in fmt() variables 683 Self::from_reader(&mut file) in fmt() 694 /// let mut file = File::open("./json.txt").unwrap(); in fmt() 695 /// let value = JsonValue::from_reader(&mut file).unwrap(); in fmt()
|