Lines Matching refs:name

510         name: &str,  in find_entry()
515 LongDirEntry::validate_long_name(name)?; in find_entry()
518 if e.eq_name(name) { in find_entry()
541 pub fn open_file(&self, name: &str, fs: Arc<FATFileSystem>) -> Result<FATFile, SystemError> { in open_file()
542 let f: FATFile = self.find_entry(name, Some(false), None, fs)?.to_file()?; in open_file()
547 pub fn open_dir(&self, name: &str, fs: Arc<FATFileSystem>) -> Result<FATDir, SystemError> { in open_dir()
548 let d: FATDir = self.find_entry(name, Some(true), None, fs)?.to_dir()?; in open_dir()
556 pub fn create_file(&self, name: &str, fs: &Arc<FATFileSystem>) -> Result<FATFile, SystemError> { in create_file()
558 self.check_existence(name, Some(false), fs.clone()); in create_file()
572 LongDirEntry::validate_long_name(name)?; in create_file()
576 name.trim(), in create_file()
595 pub fn create_dir(&self, name: &str, fs: &Arc<FATFileSystem>) -> Result<FATDir, SystemError> { in create_dir()
597 self.check_existence(name, Some(true), fs.clone()); in create_dir()
612 LongDirEntry::validate_long_name(name)?; in create_dir()
624 dot_entry.name = ShortNameGenerator::new(".").generate().unwrap(); in create_dir()
638 dot_dot_entry.name = ShortNameGenerator::new("..").generate().unwrap(); in create_dir()
649 name.trim(), in create_dir()
678 name: &str, in check_existence()
682 let mut sng = ShortNameGenerator::new(name); in check_existence()
686 self.find_entry(name, expect_dir, Some(&mut sng), fs.clone()); in check_existence()
703 if let Ok(name) = sng.generate() { in check_existence()
704 return Ok(FATDirEntryOrShortName::ShortName(name)); in check_existence()
729 short_dentry.name = short_name.clone();
794 name: &str, in remove()
797 let e: FATDirEntry = self.find_entry(name, None, None, fs.clone())?; in remove()
833 short_entry.name[0] = 0xe5; in remove_dir_entries()
846 name: &str, in get_dir_entry()
848 if name == "." || name == "/" { in get_dir_entry()
852 LongDirEntry::validate_long_name(name)?; in get_dir_entry()
853 return self.find_entry(name, None, None, fs); in get_dir_entry()
886 self.remove(fs.clone(), old_dentry.name().as_str(), false)?; in rename()
932 name: [u8; 11], field
1049 pub fn validate_long_name(mut name: &str) -> Result<(), SystemError> { in validate_long_name()
1051 name = name.trim(); in validate_long_name()
1054 if name.len() == 0 { in validate_long_name()
1059 if name.len() > 255 { in validate_long_name()
1064 for c in name.chars() { in validate_long_name()
1165 let base_len = self.name[..8] in name_to_string()
1171 let ext_len = self.name[8..] in name_to_string()
1178 let mut name = [ShortDirEntry::PADDING; 12]; in name_to_string() localVariable
1180 name[..base_len].copy_from_slice(&self.name[..base_len]); in name_to_string()
1184 name[base_len] = '.' as u8; in name_to_string()
1185 name[base_len + 1..base_len + 1 + ext_len].copy_from_slice(&self.name[8..8 + ext_len]); in name_to_string()
1192 if name[0] == 0x05 { in name_to_string()
1193 name[0] = 0xe5; in name_to_string()
1196 let iter = name[..total_len].iter().map(|c| decode_u8_ascii(*c)); in name_to_string()
1246 name: String, in to_dir_entry_with_long_name()
1257 file.file_name = name; in to_dir_entry_with_long_name()
1270 dir.dir_name = name; in to_dir_entry_with_long_name()
1283 for c in &self.name { in checksum()
1315 cursor.write_exact(&self.name)?; in flush()
1696 return f.short_dir_entry.name;
1701 return s.name;
1711 return s.short_dir_entry.name;
1719 pub fn name(&self) -> String { in name() method
1764 pub fn eq_name(&self, name: &str) -> bool { in eq_name()
1768 let binding = self.name(); in eq_name()
1770 let name = name.chars().flat_map(|c| c.to_uppercase()); in eq_name() localVariable
1772 let long_name_matches: bool = long_name.eq(name.clone()); in eq_name()
1773 let short_name_matches: bool = short_name.eq(name); in eq_name()
1810 name: [u8; 11], field
1836 pub fn new(mut name: &str) -> Self { in new()
1837 name = name.trim(); in new()
1840 if name == "." { in new()
1844 if name == ".." { in new()
1852 let (name_fits, basename_len, is_lossy) = match name.rfind('.') { in new()
1857 Self::copy_part(&mut short_name[..Self::SHORT_NAME_LEN], &name[..index]); in new()
1862 &name[index + 1..], in new()
1870 Self::copy_part(&mut short_name[..Self::SHORT_NAME_LEN], &name); in new()
1880 if name == "." { in new()
1883 if name == ".." { in new()
1892 name: short_name, in new()
1895 checksum: Self::fletcher_16_checksum(name), in new()
1940 fn fletcher_16_checksum(name: &str) -> u16 { in fletcher_16_checksum()
1943 for c in name.chars() { in fletcher_16_checksum()
1952 pub fn add_name(&mut self, name: &[u8; 11]) { in add_name()
1954 if name == &self.name {
1962 let num_suffix: Option<u32> = if name[prefix_len] as char == '~' {
1963 (name[prefix_len + 1] as char).to_digit(10)
1969 let ext_matches: bool = name[8..] == self.name[8..];
1971 if name[..prefix_len] == self.name[..prefix_len] // 基础名前缀相同
1982 let num_suffix: Option<u32> = if name[prefix_len + 4] as char == '~' {
1983 (name[prefix_len + 1] as char).to_digit(10)
1988 if name[..prefix_len] == self.name[..prefix_len] && num_suffix.is_some() && ext_matches {
1993 > = core::str::from_utf8(&name[prefix_len..prefix_len + 4])
2006 return Ok(self.name);
2011 return Ok(self.name);
2049 buf[..prefix_len].copy_from_slice(&self.name[..prefix_len]);
2054 buf[..prefix_len].copy_from_slice(&self.name[..prefix_len]);
2060 buf[8..].copy_from_slice(&self.name[8..]);
2110 name: Vec<u16>, field
2118 name: Vec::new(), in new()
2132 self.name.clear(); in process()
2140 self.name in process()
2148 self.name.clear(); in process()
2158 .copy_name_to_slice(&mut self.name[pos..pos + LongDirEntry::LONG_NAME_STR_LEN])?; in process()
2165 return self.name.len(); in len()
2170 let mut s = String::from_utf16_lossy(self.name.as_slice()); in to_string()
2190 name: Vec<u16>, field
2204 pub fn new(name: &str, checksum: u8) -> Self { in new()
2205 let mut name: Vec<u16> = name.chars().map(|c| c as u16).collect(); in new() localVariable
2207 let padding_bytes: usize = (13 - (name.len() % 13)) % 13; in new()
2211 name.push(0); in new()
2213 name.push(0xffff); in new()
2218 let start_index = (name.len() / 13) as u8; in new()
2220 name: name, in new()
2249 &self.name.as_slice()[start_idx..start_idx + 13], in next()
2259 &self.name.as_slice()[start_idx..start_idx + 13], in next()
2413 cursor.read_exact(&mut short_dentry.name)?; in get_raw_dir_entry()