mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:02:44 +00:00 
			
		
		
		
	Kernel/DevFS: Use KString for DevFSLinkInode::m_name
This commit is contained in:
		
							parent
							
								
									61c1937d02
								
							
						
					
					
						commit
						dd37d0a327
					
				
					 2 changed files with 12 additions and 6 deletions
				
			
		|  | @ -141,16 +141,19 @@ KResult DevFSInode::truncate(u64) | |||
| 
 | ||||
| StringView DevFSLinkInode::name() const | ||||
| { | ||||
|     return m_name; | ||||
|     return m_name->view(); | ||||
| } | ||||
| 
 | ||||
| DevFSLinkInode::~DevFSLinkInode() | ||||
| { | ||||
| } | ||||
| DevFSLinkInode::DevFSLinkInode(DevFS& fs, String name) | ||||
| 
 | ||||
| DevFSLinkInode::DevFSLinkInode(DevFS& fs, NonnullOwnPtr<KString> name) | ||||
|     : DevFSInode(fs) | ||||
|     , m_name(name) | ||||
|     , m_name(move(name)) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| KResultOr<size_t> DevFSLinkInode::read_bytes(off_t offset, size_t, UserOrKernelBuffer& buffer, FileDescription*) const | ||||
| { | ||||
|     Locker locker(m_inode_lock); | ||||
|  | @ -291,7 +294,10 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(StringView | |||
|             if (link.name() == name) | ||||
|                 return EEXIST; | ||||
|         } | ||||
|         auto new_link_inode = adopt_ref_if_nonnull(new (nothrow) DevFSLinkInode(m_parent_fs, name)); | ||||
|         auto name_kstring = KString::try_create(name); | ||||
|         if (!name_kstring) | ||||
|             return ENOMEM; | ||||
|         auto new_link_inode = adopt_ref_if_nonnull(new (nothrow) DevFSLinkInode(m_parent_fs, name_kstring.release_nonnull())); | ||||
|         if (!new_link_inode) | ||||
|             return ENOMEM; | ||||
|         if (!m_links.try_ensure_capacity(m_links.size() + 1)) | ||||
|  |  | |||
|  | @ -97,13 +97,13 @@ public: | |||
|     virtual ~DevFSLinkInode() override; | ||||
| 
 | ||||
| protected: | ||||
|     DevFSLinkInode(DevFS&, String); | ||||
|     DevFSLinkInode(DevFS&, NonnullOwnPtr<KString>); | ||||
|     // ^Inode
 | ||||
|     virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer& buffer, FileDescription*) const override; | ||||
|     virtual InodeMetadata metadata() const override; | ||||
|     virtual KResultOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, FileDescription*) override; | ||||
| 
 | ||||
|     const String m_name; | ||||
|     NonnullOwnPtr<KString> m_name; | ||||
|     String m_link; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling