The patch titled mm/thp: use conventional format for boolean attributes has been removed from the -mm tree. Its filename was mm-thp-use-conventional-format-for-boolean-attributes.patch This patch was dropped because it was merged into mainline or a subsystem tree The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: mm/thp: use conventional format for boolean attributes From: Ben Hutchings <ben@xxxxxxxxxxxxxxx> The conventional format for boolean attributes in sysfs is numeric ("0" or "1" followed by new-line). Any boolean attribute can then be read and written using a generic function. Using the strings "yes [no]", "[yes] no" (read), "yes" and "no" (write) will frustrate this. [akpm@xxxxxxxxxxxxxxxxxxxx: use kstrtoul()] [akpm@xxxxxxxxxxxxxxxxxxxx: test_bit() doesn't return 1/0, per Neil] Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: Johannes Weiner <jweiner@xxxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Tested-by: David Rientjes <rientjes@xxxxxxxxxx> Cc: NeilBrown <neilb@xxxxxxx> Cc: <stable@xxxxxxxxxx> [2.6.38.x] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/huge_memory.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff -puN mm/huge_memory.c~mm-thp-use-conventional-format-for-boolean-attributes mm/huge_memory.c --- a/mm/huge_memory.c~mm-thp-use-conventional-format-for-boolean-attributes +++ a/mm/huge_memory.c @@ -244,24 +244,28 @@ static ssize_t single_flag_show(struct k struct kobj_attribute *attr, char *buf, enum transparent_hugepage_flag flag) { - if (test_bit(flag, &transparent_hugepage_flags)) - return sprintf(buf, "[yes] no\n"); - else - return sprintf(buf, "yes [no]\n"); + return sprintf(buf, "%d\n", + !!test_bit(flag, &transparent_hugepage_flags)); } + static ssize_t single_flag_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count, enum transparent_hugepage_flag flag) { - if (!memcmp("yes", buf, - min(sizeof("yes")-1, count))) { + unsigned long value; + int ret; + + ret = kstrtoul(buf, 10, &value); + if (ret < 0) + return ret; + if (value > 1) + return -EINVAL; + + if (value) set_bit(flag, &transparent_hugepage_flags); - } else if (!memcmp("no", buf, - min(sizeof("no")-1, count))) { + else clear_bit(flag, &transparent_hugepage_flags); - } else - return -EINVAL; return count; } _ Patches currently in -mm which might be from ben@xxxxxxxxxxxxxxx are origin.patch linux-next.patch arch-alpha-include-asm-ioh-s-extern-inline-static-inline.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html