22#include "bootarg.h"
33#include "fs/procfs.h"
44
5- proc_handle_node_t * dispatch_array [256 ];
5+ static proc_handle_node_t * dispatch_array [256 ];
66static size_t dp_index = 0 ;
77extern vfs_node_t procfs_root ;
88
@@ -19,12 +19,15 @@ size_t procfs_node_read(size_t len, size_t offset, size_t size, char *addr, char
1919
2020static uint64_t hash_dp (const char * s ) {
2121 uint64_t h = 0 ;
22- while (* s )
22+ while (* s ) {
2323 h = h * 131 + (unsigned char )* s ++ ;
24+ }
2425 return h ;
2526}
2627
27- static void create_procfs_handle (char * name , read_entry_t read_entry , stat_entry_t stat_entry ) {
28+ static void create_procfs_handle (
29+ const char * name , const read_entry_t read_entry , const stat_entry_t stat_entry
30+ ) {
2831 proc_handle_node_t * handle = malloc (sizeof (proc_handle_node_t ));
2932 handle -> name = strdup (name );
3033 handle -> hash = hash_dp (handle -> name );
@@ -33,9 +36,10 @@ static void create_procfs_handle(char *name, read_entry_t read_entry, stat_entry
3336 dispatch_array [dp_index ++ ] = handle ;
3437}
3538
36- static void create_procfs_node (char * name , read_entry_t read_entry , stat_entry_t stat_entry ) {
39+ static void
40+ create_procfs_node (char * name , const read_entry_t read_entry , const stat_entry_t stat_entry ) {
3741 create_procfs_handle (name , read_entry , stat_entry );
38- vfs_node_t node = vfs_node_alloc (procfs_root , name );
42+ const vfs_node_t node = vfs_node_alloc (procfs_root , name );
3943 node -> type = file_none ;
4044 node -> mode = 0700 ;
4145 proc_handle_t * handle0 = malloc (sizeof (proc_handle_t ));
0 commit comments