@@ -524,6 +524,20 @@ static int do_proc_open(const char *path, struct fuse_file_info *fi)
524
524
return __proc_open (path , fi );
525
525
}
526
526
527
+ static int do_proc_opendir (const char * path , struct fuse_file_info * fi )
528
+ {
529
+ char * error ;
530
+ int (* __proc_opendir )(const char * path , struct fuse_file_info * fi );
531
+
532
+ dlerror ();
533
+ __proc_opendir = (int (* )(const char * path , struct fuse_file_info * fi ))dlsym (dlopen_handle , "proc_opendir" );
534
+ error = dlerror ();
535
+ if (error )
536
+ return log_error (-1 , "%s - Failed to find proc_opendir()" , error );
537
+
538
+ return __proc_opendir (path , fi );
539
+ }
540
+
527
541
static int do_proc_access (const char * path , int mode )
528
542
{
529
543
char * error ;
@@ -608,6 +622,20 @@ static int do_proc_release(const char *path, struct fuse_file_info *fi)
608
622
return __proc_release (path , fi );
609
623
}
610
624
625
+ static int do_proc_releasedir (const char * path , struct fuse_file_info * fi )
626
+ {
627
+ char * error ;
628
+ int (* __proc_releasedir )(const char * path , struct fuse_file_info * fi );
629
+
630
+ dlerror ();
631
+ __proc_releasedir = (int (* )(const char * path , struct fuse_file_info * )) dlsym (dlopen_handle , "proc_releasedir" );
632
+ error = dlerror ();
633
+ if (error )
634
+ return log_error (-1 , "%s - Failed to find proc_releasedir()" , error );
635
+
636
+ return __proc_releasedir (path , fi );
637
+ }
638
+
611
639
static int do_sys_release (const char * path , struct fuse_file_info * fi )
612
640
{
613
641
char * error ;
@@ -724,8 +752,12 @@ static int lxcfs_opendir(const char *path, struct fuse_file_info *fi)
724
752
return ret ;
725
753
}
726
754
727
- if (strcmp (path , "/proc" ) == 0 )
728
- return 0 ;
755
+ if (strncmp (path , "/proc" , 5 ) == 0 ) {
756
+ up_users ();
757
+ ret = do_proc_opendir (path , fi );
758
+ down_users ();
759
+ return ret ;
760
+ }
729
761
730
762
if (strncmp (path , "/sys" , 4 ) == 0 ) {
731
763
up_users ();
@@ -768,7 +800,7 @@ static int lxcfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
768
800
return ret ;
769
801
}
770
802
771
- if (strcmp ( path , "/proc" ) == 0 ) {
803
+ if (LXCFS_TYPE_PROC ( type ) ) {
772
804
up_users ();
773
805
ret = do_proc_readdir (path , buf , filler , offset , fi );
774
806
down_users ();
@@ -837,12 +869,14 @@ static int lxcfs_releasedir(const char *path, struct fuse_file_info *fi)
837
869
return ret ;
838
870
}
839
871
840
- if (path ) {
841
- if ( strcmp ( path , "/" ) == 0 )
842
- return 0 ;
843
- if ( strcmp ( path , "/proc" ) == 0 )
844
- return 0 ;
872
+ if (LXCFS_TYPE_PROC ( type ) ) {
873
+ up_users ();
874
+ ret = do_proc_releasedir ( path , fi ) ;
875
+ down_users ();
876
+ return ret ;
845
877
}
878
+ if (path && strcmp (path , "/" ) == 0 )
879
+ return 0 ;
846
880
847
881
lxcfs_error ("unknown file type: path=%s, type=%d, fi->fh=%" PRIu64 ,
848
882
path , type , fi -> fh );
0 commit comments