Пример #1
0
static dev_t fs_get_disk(struct libmnt_fs *fs, int check)
{
	struct fsck_fs_data *data;
	const char *device;
	struct stat st;

	data = mnt_fs_get_userdata(fs);
	if (data && data->disk)
		return data->disk;

	if (!check)
		return 0;

	if (mnt_fs_is_netfs(fs) || mnt_fs_is_pseudofs(fs))
		return 0;

	device = fs_get_device(fs);
	if (!device)
		return 0;

	data = fs_create_data(fs);

	if (!stat(device, &st) &&
	    !blkid_devno_to_wholedisk(st.st_rdev, NULL, 0, &data->disk)) {

		if (data->disk)
			data->stacked = count_slaves(data->disk) > 0 ? 1 : 0;
		return data->disk;
	}
	return 0;
}
Пример #2
0
static struct fsck_fs_data *fs_create_data(struct libmnt_fs *fs)
{
	struct fsck_fs_data *data = mnt_fs_get_userdata(fs);

	if (!data) {
		data = xcalloc(1, sizeof(*data));
		mnt_fs_set_userdata(fs, data);
	}
	return data;
}
Пример #3
0
/*
 * fs from fstab might contains real device name as well as symlink,
 * LABEL or UUID, this function returns canonicalized result.
 */
static const char *fs_get_device(struct libmnt_fs *fs)
{
	struct fsck_fs_data *data = mnt_fs_get_userdata(fs);

	if (!data || !data->eval_device) {
		const char *spec = mnt_fs_get_source(fs);

		if (!data)
			data = fs_create_data(fs);

		data->eval_device = 1;
		data->device = mnt_resolve_spec(spec, mnt_table_get_cache(fstab));
		if (!data->device)
			data->device = xstrdup(spec);
	}

	return data->device;
}
Пример #4
0
static int fs_is_done(struct libmnt_fs *fs)
{
	struct fsck_fs_data *data = mnt_fs_get_userdata(fs);
	return data ? data->done : 0;
}
Пример #5
0
static int fs_is_stacked(struct libmnt_fs *fs)
{
	struct fsck_fs_data *data = mnt_fs_get_userdata(fs);
	return data ? data->stacked : 0;
}