rem: err = errno;
add: struct stat stat; err = fstat(device, &stat) < 0 ? B_ERROR : B_OK; if (!err) { deviceSize = stat.st_size / 2048; }
context: udf_mount(nspace_id nsid, const char *deviceName, ulong flags, void *parms,		size_t parmsLength, void **volumeCookie, vnode_id *rootID){	INITIALIZE_DEBUGGING_OUTPUT_FILE("/boot/home/Desktop/udf_debug.txt");	DEBUG_INIT_ETC(CF_ENTRY | CF_VOLUME_OPS, NULL, ("deviceName: `%s'", deviceName));	status_t err = B_OK;	off_t deviceSize = 0;	// in blocks	Udf::Volume *volume = NULL;	device_geometry geometry;	// Open the device (read only should be fine), get its geometry,	// and calculate its length. 	int device = open(deviceName, O_RDONLY);	err = device < B_OK ? device : B_OK;	if (!err) {		if (ioctl(device, B_GET_GEOMETRY, &geometry) == 0) {			deviceSize = (off_t)geometry.sectors_per_track				* geometry.cylinder_count * geometry.head_count;		} else {			err = errno;		}	}		// Create and mount the volume	if (!err) {		volume = new Udf::Volume(nsid);		err = volume ? B_OK : B_NO_MEMORY;	}	if (!err) {		err = volume->Mount(deviceName, 0, deviceSize, flags, 2048);	}			if (!err) {		if (rootID)			*rootID = volume->RootIcb()->Id();		if (volumeCookie)			*volumeCookie = volume;	}	RETURN(err);	}