Example #1
0
/**
 * Set default striping pattern (a number, not a human-readable string).
 *
 * \param[in] file	proc file
 * \param[in] buffer	string containing the default striping pattern for new
 *			files. This is an integer LOV_PATTERN_* value
 * \param[in] count	@buffer length
 * \param[in] off	unused for single entry
 *
 * \retval @count	on success
 * \retval negative	error code if failed
 */
static ssize_t
lod_stripetype_seq_write(struct file *file, const char __user *buffer,
			 size_t count, loff_t *off)
{
	struct seq_file *m = file->private_data;
	struct obd_device *dev = m->private;
	struct lod_device *lod;
	int rc;
	__u32 pattern;
	__s64 val;

	LASSERT(dev != NULL);
	lod  = lu2lod_dev(dev->obd_lu_dev);
	rc = lprocfs_str_to_s64(buffer, count, &val);
	if (rc)
		return rc;
	if (val < 0)
		return -ERANGE;

	pattern = val;
	lod_fix_desc_pattern(&pattern);
	lod->lod_desc.ld_pattern = pattern;

	return count;
}
Example #2
0
/**
 * Set default striping pattern (a number, not a human-readable string).
 *
 * \param[in] file	proc file
 * \param[in] buffer	string containing the default striping pattern for new
 *			files. This is an integer LOV_PATTERN_* value
 * \param[in] count	@buffer length
 * \param[in] off	unused for single entry
 *
 * \retval @count	on success
 * \retval negative	error code if failed
 */
static ssize_t
lod_stripetype_seq_write(struct file *file, const char __user *buffer,
			 size_t count, loff_t *off)
{
	struct seq_file   *m = file->private_data;
	struct obd_device *dev = m->private;
	struct lod_device *lod;
	int val, rc;

	LASSERT(dev != NULL);
	lod  = lu2lod_dev(dev->obd_lu_dev);
	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	lod_fix_desc_pattern(&val);
	lod->lod_desc.ld_pattern = val;
	return count;
}