mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	Kernel: Avoid ninja-import of global variable
This would have caused an issue later when we enable -Wmissing-declarations, as the compiler didn't see that Kernel::all_inodes() was being used elsewhere, too. Also, this means that if the type changes later, there's not going to be weird run-time issues, but rather a nice type error during compile time.
This commit is contained in:
		
							parent
							
								
									ef9a3b8e46
								
							
						
					
					
						commit
						5e48eda218
					
				
					 3 changed files with 6 additions and 6 deletions
				
			
		|  | @ -39,7 +39,7 @@ namespace Kernel { | |||
| 
 | ||||
| static SpinLock s_all_inodes_lock; | ||||
| 
 | ||||
| static InlineLinkedList<Inode>& all_inodes() | ||||
| InlineLinkedList<Inode>& Inode::all_with_lock() | ||||
| { | ||||
|     ASSERT(s_all_inodes_lock.is_locked()); | ||||
| 
 | ||||
|  | @ -54,7 +54,7 @@ void Inode::sync() | |||
|     NonnullRefPtrVector<Inode, 32> inodes; | ||||
|     { | ||||
|         ScopedSpinLock all_inodes_lock(s_all_inodes_lock); | ||||
|         for (auto& inode : all_inodes()) { | ||||
|         for (auto& inode : all_with_lock()) { | ||||
|             if (inode.is_metadata_dirty()) | ||||
|                 inodes.append(inode); | ||||
|         } | ||||
|  | @ -110,13 +110,13 @@ Inode::Inode(FS& fs, unsigned index) | |||
|     , m_index(index) | ||||
| { | ||||
|     ScopedSpinLock all_inodes_lock(s_all_inodes_lock); | ||||
|     all_inodes().append(this); | ||||
|     all_with_lock().append(this); | ||||
| } | ||||
| 
 | ||||
| Inode::~Inode() | ||||
| { | ||||
|     ScopedSpinLock all_inodes_lock(s_all_inodes_lock); | ||||
|     all_inodes().remove(this); | ||||
|     all_with_lock().remove(this); | ||||
| } | ||||
| 
 | ||||
| void Inode::will_be_destroyed() | ||||
|  |  | |||
|  | @ -105,6 +105,7 @@ public: | |||
|     SharedInodeVMObject* shared_vmobject() { return m_shared_vmobject.ptr(); } | ||||
|     const SharedInodeVMObject* shared_vmobject() const { return m_shared_vmobject.ptr(); } | ||||
| 
 | ||||
|     static InlineLinkedList<Inode>& all_with_lock(); | ||||
|     static void sync(); | ||||
| 
 | ||||
|     bool has_watchers() const { return !m_watchers.is_empty(); } | ||||
|  |  | |||
|  | @ -900,10 +900,9 @@ static Optional<KBuffer> procfs$all(InodeIdentifier) | |||
| 
 | ||||
| static Optional<KBuffer> procfs$inodes(InodeIdentifier) | ||||
| { | ||||
|     extern InlineLinkedList<Inode>& all_inodes(); | ||||
|     KBufferBuilder builder; | ||||
|     InterruptDisabler disabler; | ||||
|     for (auto& inode : all_inodes()) { | ||||
|     for (auto& inode : Inode::all_with_lock()) { | ||||
|         builder.appendf("Inode{K%x} %02u:%08u (%u)\n", &inode, inode.fsid(), inode.index(), inode.ref_count()); | ||||
|     } | ||||
|     return builder.build(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ben Wiederhake
						Ben Wiederhake