Example #1
0
static void busy_fs_close(reiser4_fs_t *fs) {
	aal_device_t *device;
	
	if (!fs) return;
	
	device = fs->device;
	reiser4_fs_close(fs);
	aal_device_close(device);
}
Example #2
0
static reiser4_fs_t *busy_fs_open(char *name) {
	aal_device_t *device;
	reiser4_fs_t *fs;

	if (!(device = aal_device_open(&file_ops, name, 512, O_RDWR))) {
		aal_error("Can't open device %s.", name);
		return NULL;
	}
    
	if (!(fs = reiser4_fs_open(device, 1))) {
		aal_error("Can't open filesystem on %s.", name);
		goto error_close_device;
	}

	if (!(fs->journal = reiser4_journal_open(fs, device))) {
		aal_error("Failed to open the journal on %s.", name);
		goto error_close_fs;
	}
	
	fs->tree->mpc_func = misc_mpressure_detect;
	
	if (reiser4_journal_replay(fs->journal)) {
		aal_error("Failed to replay the journal on %s.", name);
		goto error_close_journal;
	}
	
	reiser4_journal_close(fs->journal);
	fs->journal = NULL;

	reiser4_fs_sync(fs);
	return fs;

 error_close_journal:
	reiser4_journal_close(fs->journal);
 error_close_fs:
	reiser4_fs_close(fs);
 error_close_device:
	aal_device_close(device);
	return NULL;
}
/// close device
static void fs_close(){
    reiser4_fs_close(fs);
    aal_device_close(fs_device);
}