Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130585
b: refs/heads/master
c: 618b2c8
h: refs/heads/master
i:
  130583: 128100d
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Jan 29, 2009
1 parent 0a610c4 commit 4a3558f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf3647c44bc76c43c4b2ebb4c37a559e899ac70e
refs/heads/master: 618b2c8db24522ae273d8299c6a936ea13793c4d
33 changes: 32 additions & 1 deletion trunk/drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ static ssize_t store_target_kb(struct sys_device *dev,
if (!capable(CAP_SYS_ADMIN))
return -EPERM;

target_bytes = memparse(buf, &endchar);
target_bytes = simple_strtoull(buf, &endchar, 0) * 1024;

balloon_set_new_target(target_bytes >> PAGE_SHIFT);

Expand All @@ -508,8 +508,39 @@ static ssize_t store_target_kb(struct sys_device *dev,
static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR,
show_target_kb, store_target_kb);


static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr,
char *buf)
{
return sprintf(buf, "%llu\n",
(u64)balloon_stats.target_pages << PAGE_SHIFT);
}

static ssize_t store_target(struct sys_device *dev,
struct sysdev_attribute *attr,
const char *buf,
size_t count)
{
char *endchar;
unsigned long long target_bytes;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;

target_bytes = memparse(buf, &endchar);

balloon_set_new_target(target_bytes >> PAGE_SHIFT);

return count;
}

static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR,
show_target, store_target);


static struct sysdev_attribute *balloon_attrs[] = {
&attr_target_kb,
&attr_target,
};

static struct attribute *balloon_info_attrs[] = {
Expand Down

0 comments on commit 4a3558f

Please sign in to comment.