Commit 723c2ba8 authored by Al Viro's avatar Al Viro
Browse files

hypfs: swich hypfs_create_u64() to returning int



same story as for hypfs_create_str()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 63f76f51
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@

extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name);

extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name,
				       __u64 value);
extern int hypfs_create_u64(struct dentry *dir, const char *name, __u64 value);

extern int hypfs_create_str(struct dentry *dir, const char *name, char *string);

+10 −10
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
{
	struct dentry *cpu_dir;
	char buffer[TMP_SIZE];
	void *rc;
	int rc;

	snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_get_info_type(),
							    cpu_info));
@@ -214,18 +214,18 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)
	rc = hypfs_create_u64(cpu_dir, "mgmtime",
			      cpu_info__acc_time(diag204_get_info_type(), cpu_info) -
			      cpu_info__lp_time(diag204_get_info_type(), cpu_info));
	if (IS_ERR(rc))
		return PTR_ERR(rc);
	if (rc)
		return rc;
	rc = hypfs_create_u64(cpu_dir, "cputime",
			      cpu_info__lp_time(diag204_get_info_type(), cpu_info));
	if (IS_ERR(rc))
		return PTR_ERR(rc);
	if (rc)
		return rc;
	if (diag204_get_info_type() == DIAG204_INFO_EXT) {
		rc = hypfs_create_u64(cpu_dir, "onlinetime",
				      cpu_info__online_time(diag204_get_info_type(),
							    cpu_info));
		if (IS_ERR(rc))
			return PTR_ERR(rc);
		if (rc)
			return rc;
	}
	diag224_idx2name(cpu_info__ctidx(diag204_get_info_type(), cpu_info), buffer);
	return hypfs_create_str(cpu_dir, "type", buffer);
@@ -263,7 +263,7 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
{
	struct dentry *cpu_dir;
	char buffer[TMP_SIZE];
	void *rc;
	int rc;

	snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_get_info_type(),
							    cpu_info));
@@ -272,8 +272,8 @@ static int hypfs_create_phys_cpu_files(struct dentry *cpus_dir, void *cpu_info)
		return PTR_ERR(cpu_dir);
	rc = hypfs_create_u64(cpu_dir, "mgmtime",
			      phys_cpu__mgm_time(diag204_get_info_type(), cpu_info));
	if (IS_ERR(rc))
		return PTR_ERR(rc);
	if (rc)
		return rc;
	diag224_idx2name(phys_cpu__ctidx(diag204_get_info_type(), cpu_info), buffer);
	return hypfs_create_str(cpu_dir, "type", buffer);
}
+6 −9
Original line number Diff line number Diff line
@@ -19,10 +19,9 @@

#define ATTRIBUTE(dir, name, member) \
do { \
	void *rc; \
	rc = hypfs_create_u64(dir, name, member); \
	if (IS_ERR(rc)) \
		return PTR_ERR(rc); \
	int rc = hypfs_create_u64(dir, name, member); \
	if (rc) \
		return rc; \
} while (0)

static int hypfs_vm_create_guest(struct dentry *systems_dir,
@@ -85,7 +84,7 @@ static int hypfs_vm_create_guest(struct dentry *systems_dir,

int hypfs_vm_create_files(struct dentry *root)
{
	struct dentry *dir, *file;
	struct dentry *dir;
	struct diag2fc_data *data;
	unsigned int count = 0;
	int rc, i;
@@ -110,11 +109,9 @@ int hypfs_vm_create_files(struct dentry *root)
		rc = PTR_ERR(dir);
		goto failed;
	}
	file = hypfs_create_u64(dir, "count", data->lcpus);
	if (IS_ERR(file)) {
		rc = PTR_ERR(file);
	rc = hypfs_create_u64(dir, "count", data->lcpus);
	if (rc)
		goto failed;
	}

	/* guests */
	dir = hypfs_mkdir(root, "systems");
+4 −5
Original line number Diff line number Diff line
@@ -377,8 +377,7 @@ static struct dentry *hypfs_create_update_file(struct dentry *dir)
	return dentry;
}

struct dentry *hypfs_create_u64(struct dentry *dir,
				const char *name, __u64 value)
int hypfs_create_u64(struct dentry *dir, const char *name, __u64 value)
{
	char *buffer;
	char tmp[TMP_SIZE];
@@ -387,15 +386,15 @@ struct dentry *hypfs_create_u64(struct dentry *dir,
	snprintf(tmp, TMP_SIZE, "%llu\n", (unsigned long long int)value);
	buffer = kstrdup(tmp, GFP_KERNEL);
	if (!buffer)
		return ERR_PTR(-ENOMEM);
		return -ENOMEM;
	dentry =
	    hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE);
	if (IS_ERR(dentry)) {
		kfree(buffer);
		return ERR_PTR(-ENOMEM);
		return -ENOMEM;
	}
	hypfs_add_dentry(dentry);
	return dentry;
	return 0;
}

int hypfs_create_str(struct dentry *dir, const char *name, char *string)