Changeset 57176 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Aug 4, 2015 3:20:30 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r53757 r57176 112 112 113 113 /** 114 * Translate RTFMODE into DT_xxx (in conjunction to rtDirType()) 115 * @param fMode file mode 116 * returns d_type 117 */ 118 static int sf_get_d_type(RTFMODE fMode) 119 { 120 int d_type; 121 switch (fMode & RTFS_TYPE_MASK) 122 { 123 case RTFS_TYPE_FIFO: d_type = DT_FIFO; break; 124 case RTFS_TYPE_DEV_CHAR: d_type = DT_CHR; break; 125 case RTFS_TYPE_DIRECTORY: d_type = DT_DIR; break; 126 case RTFS_TYPE_DEV_BLOCK: d_type = DT_BLK; break; 127 case RTFS_TYPE_FILE: d_type = DT_REG; break; 128 case RTFS_TYPE_SYMLINK: d_type = DT_LNK; break; 129 case RTFS_TYPE_SOCKET: d_type = DT_SOCK; break; 130 case RTFS_TYPE_WHITEOUT: d_type = DT_WHT; break; 131 default: d_type = DT_UNKNOWN; break; 132 } 133 return d_type; 134 } 135 136 /** 114 137 * Extract element ([dir]->f_pos) from the directory [dir] into [d_name]. 115 138 * 116 139 * @returns 0 for success, 1 for end reached, Linux error code otherwise. 117 140 */ 118 static int sf_getdent(struct file *dir, char d_name[NAME_MAX] )141 static int sf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type) 119 142 { 120 143 loff_t cur; … … 202 225 } 203 226 227 *d_type = sf_get_d_type(info->Info.Attr.fMode); 228 204 229 return sf_nlscpy(sf_g, d_name, NAME_MAX, 205 230 info->name.String.utf8, info->name.u16Length); … … 245 270 loff_t sanity; 246 271 char d_name[NAME_MAX]; 247 248 err = sf_getdent(dir, d_name); 272 int d_type = DT_UNKNOWN; 273 274 err = sf_getdent(dir, d_name, &d_type); 249 275 switch (err) 250 276 { … … 281 307 282 308 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) 283 if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, DT_UNKNOWN))309 if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, d_type)) 284 310 { 285 311 LogFunc(("dir_emit failed\n")); … … 287 313 } 288 314 #else 289 err = filldir(opaque, d_name, strlen(d_name), dir->f_pos, fake_ino, DT_UNKNOWN);315 err = filldir(opaque, d_name, strlen(d_name), dir->f_pos, fake_ino, d_type); 290 316 if (err) 291 317 {
Note:
See TracChangeset
for help on using the changeset viewer.