Changeset 2667
- 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
| r2666 |
r2667 |
|
| 29 | 29 | |
|---|
| 30 | 30 | import selinux |
|---|
| | 31 | |
|---|
| | 32 | xattrfs=["ext2","ext3","jfs","xfs"] |
|---|
| | 33 | |
|---|
| | 34 | def 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 |
|---|
| 31 | 48 | |
|---|
| 32 | 49 | class FCException(Exception): |
|---|
| … | … | |
| 1159 | 1176 | |
|---|
| 1160 | 1177 | mismatches = 0 |
|---|
| | 1178 | mounts = get_mounts() |
|---|
| 1161 | 1179 | |
|---|
| 1162 | 1180 | gc.set_threshold(20000) |
|---|
| … | … | |
| 1164 | 1182 | selinux.matchpathcon_init(args[1]) |
|---|
| 1165 | 1183 | |
|---|
| 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 | |
|---|
| 1167 | 1190 | for name in files+dirs: |
|---|
| 1168 | 1191 | fi = os.path.join(root,name) |
|---|
Download in other formats:
* Generating other formats may take time.