Changeset 2667

Show
Ignore:
Timestamp:
04/22/08 14:42:45 (8 months ago)
Author:
pebenito
Message:

fcglob: have the fs walk skip over branches that aren't xattr fs'es.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/fcglob/support/fcglob/fcglob.py

    r2666 r2667  
    2929 
    3030import selinux 
     31 
     32xattrfs=["ext2","ext3","jfs","xfs"] 
     33 
     34def get_mounts(): 
     35        """Find mounted filesystems""" 
     36        mounts=open("/etc/mtab", "r") 
     37 
     38        fs_lines=[] 
     39 
     40        for line in mounts.readlines(): 
     41                parsed = line.split() 
     42 
     43                if parsed[2] not in xattrfs: 
     44                        fs_lines.append(parsed[1]) 
     45 
     46        mounts.close() 
     47        return fs_lines 
    3148 
    3249class FCException(Exception): 
     
    11591176 
    11601177                mismatches = 0 
     1178                mounts = get_mounts() 
    11611179 
    11621180                gc.set_threshold(20000) 
     
    11641182                selinux.matchpathcon_init(args[1]) 
    11651183 
    1166                 for root, dirs, files in os.walk(args[2]): 
     1184                for root, dirs, files in os.walk(args[2], topdown=True): 
     1185                        if root in mounts: 
     1186                                debug("Skipping %s and its children since it is not an xattr fs" % root) 
     1187                                del dirs[:] 
     1188                                continue 
     1189 
    11671190                        for name in files+dirs: 
    11681191                                fi = os.path.join(root,name)