Ticket #8449: fs_func_c.patch
File fs_func_c.patch, 1.5 KB (added by , 12 years ago) |
---|
-
.c
old new 48 48 char label[256]; 49 49 } identify_cookie; 50 50 51 status_t 52 checkReadOnly(const char *dev) 53 { 54 status_t check = B_NO_ERROR; // NO ERROR during READ_ONLY check 55 int fd = open(dev, O_RDONLY | O_NOCACHE); 56 if (fd < 0) 57 check = errno; 58 59 if (fd >= 0) { 60 // opening succeeded 61 device_geometry geometry; 62 63 if (!ioctl(fd, B_GET_GEOMETRY, &geometry)) { 64 if (geometry.read_only) { 65 check = B_OK; // READ_ONLY device 66 } 67 } 68 69 // close the descriptor 70 close(fd); 71 } 72 return check; // go the default way 73 } 51 74 52 75 static status_t 53 76 get_node_type(ntfs_inode* ni, int* _type) … … 204 227 void *handle; 205 228 unsigned long mountFlags = 0; 206 229 status_t result = B_NO_ERROR; 230 status_t rdOnlyCheck = B_NO_ERROR; 207 231 208 232 TRACE("fs_mount - ENTER\n"); 209 233 … … 234 258 "true"), "true") == 0; 235 259 unload_driver_settings(handle); 236 260 237 if (ns->ro || (flags & B_MOUNT_READ_ONLY) != 0) { 261 // checking whether the device is READ_ONLY or not 262 rdOnlyCheck = checkReadOnly(device); 263 264 // set the status given by checkReadOnly, can be B_NO_ERROR or ERRNO set during function call 265 if(rdOnlyCheck != B_OK) 266 result = rdOnlyCheck; 267 268 if (ns->ro || (flags & B_MOUNT_READ_ONLY) != 0 || rdOnlyCheck == B_OK) { 238 269 mountFlags |= MS_RDONLY; 239 270 ns->flags |= B_FS_IS_READONLY; 240 271 } 241 272 242 273 // TODO: this does not take read-only volumes into account! 243 274 ns->ntvol = utils_mount_volume(device, mountFlags, true); 244 275 if (ns->ntvol != NULL)