All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Move runnable tools from Documentation to tools
@ 2016-09-22  0:51 Shuah Khan
  2016-09-22  0:51 ` [PATCH v2 1/3] tools: move accounting tool from Documentation Shuah Khan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Shuah Khan @ 2016-09-22  0:51 UTC (permalink / raw)
  To: corbet, davem, nicolas.dichtel, elfring, geert, akpm, gregkh,
	kvalo, mchehab, linux
  Cc: Shuah Khan, linux-doc, linux-kernel, linux-pcmcia

Move runnable tools from Documentation to tools. I moved just the
tools code, and left documentation files as is.

Based on the v1 series feedback, This v2 series moves accounting,
laptops/dslm, and pcmcia to tools.

If v2 patches look good, and if I get an okay, I will try to get
these into 4.9-rc1

Changes since v1:
-- Move to tools instead of samples based on feedback
-- Update location information and MAINTIANERS file
   as needed.

Shuah Khan (3):
  tools: move accounting example code from Documentation
  tools: move laptops dslm tool from Documentation
  tools: move pcmcia crc32hash tool from Documentation

 Documentation/Makefile                        |   3 +-
 Documentation/accounting/.gitignore           |   1 -
 Documentation/accounting/Makefile             |   7 -
 Documentation/accounting/delay-accounting.txt |   6 +-
 Documentation/accounting/getdelays.c          | 550 --------------------------
 Documentation/laptops/.gitignore              |   1 -
 Documentation/laptops/00-INDEX                |   4 -
 Documentation/laptops/Makefile                |   5 -
 Documentation/laptops/dslm.c                  | 166 --------
 Documentation/laptops/laptop-mode.txt         |   2 +-
 Documentation/pcmcia/.gitignore               |   1 -
 Documentation/pcmcia/Makefile                 |   7 -
 Documentation/pcmcia/crc32hash.c              |  32 --
 Documentation/pcmcia/devicetable.txt          |   4 +-
 MAINTAINERS                                   |   1 +
 tools/accounting/.gitignore                   |   1 +
 tools/accounting/Makefile                     |   9 +
 tools/accounting/getdelays.c                  | 550 ++++++++++++++++++++++++++
 tools/laptop/dslm/.gitignore                  |   1 +
 tools/laptop/dslm/Makefile                    |   9 +
 tools/laptop/dslm/dslm.c                      | 166 ++++++++
 tools/pcmcia/.gitignore                       |   1 +
 tools/pcmcia/Makefile                         |   9 +
 tools/pcmcia/crc32hash.c                      |  32 ++
 24 files changed, 786 insertions(+), 782 deletions(-)
 delete mode 100644 Documentation/accounting/.gitignore
 delete mode 100644 Documentation/accounting/Makefile
 delete mode 100644 Documentation/accounting/getdelays.c
 delete mode 100644 Documentation/laptops/.gitignore
 delete mode 100644 Documentation/laptops/Makefile
 delete mode 100644 Documentation/laptops/dslm.c
 delete mode 100644 Documentation/pcmcia/.gitignore
 delete mode 100644 Documentation/pcmcia/Makefile
 delete mode 100644 Documentation/pcmcia/crc32hash.c
 create mode 100644 tools/accounting/.gitignore
 create mode 100644 tools/accounting/Makefile
 create mode 100644 tools/accounting/getdelays.c
 create mode 100644 tools/laptop/dslm/.gitignore
 create mode 100644 tools/laptop/dslm/Makefile
 create mode 100644 tools/laptop/dslm/dslm.c
 create mode 100644 tools/pcmcia/.gitignore
 create mode 100644 tools/pcmcia/Makefile
 create mode 100644 tools/pcmcia/crc32hash.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] tools: move accounting tool from Documentation
  2016-09-22  0:51 [PATCH v2 0/3] Move runnable tools from Documentation to tools Shuah Khan
@ 2016-09-22  0:51 ` Shuah Khan
  2016-09-22  0:51 ` [PATCH v2 2/3] tools: move laptops dslm " Shuah Khan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2016-09-22  0:51 UTC (permalink / raw)
  To: corbet, davem, nicolas.dichtel, elfring, geert, akpm, gregkh,
	kvalo, mchehab, linux
  Cc: Shuah Khan, linux-doc, linux-kernel, linux-pcmcia

Move accounting tool to tools and remove it from Documentation
Makefile. Update location information for this tool. Create a
new Makefile to build accounting. It can be built from top level
directory or from accounting directory:

Run make -C tools/accounting or cd tools/accounting; make

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 Documentation/Makefile                        |   2 +-
 Documentation/accounting/.gitignore           |   1 -
 Documentation/accounting/Makefile             |   7 -
 Documentation/accounting/delay-accounting.txt |   6 +-
 Documentation/accounting/getdelays.c          | 550 --------------------------
 tools/accounting/.gitignore                   |   1 +
 tools/accounting/Makefile                     |   9 +
 tools/accounting/getdelays.c                  | 550 ++++++++++++++++++++++++++
 8 files changed, 564 insertions(+), 562 deletions(-)
 delete mode 100644 Documentation/accounting/.gitignore
 delete mode 100644 Documentation/accounting/Makefile
 delete mode 100644 Documentation/accounting/getdelays.c
 create mode 100644 tools/accounting/.gitignore
 create mode 100644 tools/accounting/Makefile
 create mode 100644 tools/accounting/getdelays.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0b8cd50..e4dd5e4 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1,2 @@
-subdir-y := accounting blackfin \
+subdir-y := blackfin \
 	laptops pcmcia
diff --git a/Documentation/accounting/.gitignore b/Documentation/accounting/.gitignore
deleted file mode 100644
index 8648520..0000000
--- a/Documentation/accounting/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-getdelays
diff --git a/Documentation/accounting/Makefile b/Documentation/accounting/Makefile
deleted file mode 100644
index 7e232cb..0000000
--- a/Documentation/accounting/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# List of programs to build
-hostprogs-y := getdelays
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
-
-HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include
diff --git a/Documentation/accounting/delay-accounting.txt b/Documentation/accounting/delay-accounting.txt
index 8a12f07..042ea59 100644
--- a/Documentation/accounting/delay-accounting.txt
+++ b/Documentation/accounting/delay-accounting.txt
@@ -54,9 +54,9 @@ are sent to userspace without requiring a command. If it is the last exiting
 task of a thread group, the per-tgid statistics are also sent. More details
 are given in the taskstats interface description.
 
-The getdelays.c userspace utility in this directory allows simple commands to
-be run and the corresponding delay statistics to be displayed. It also serves
-as an example of using the taskstats interface.
+The getdelays.c userspace utility in tools/accounting directory allows simple
+commands to be run and the corresponding delay statistics to be displayed. It
+also serves as an example of using the taskstats interface.
 
 Usage
 -----
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
deleted file mode 100644
index b5ca536..0000000
--- a/Documentation/accounting/getdelays.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* getdelays.c
- *
- * Utility to get per-pid and per-tgid delay accounting statistics
- * Also illustrates usage of the taskstats interface
- *
- * Copyright (C) Shailabh Nagar, IBM Corp. 2005
- * Copyright (C) Balbir Singh, IBM Corp. 2006
- * Copyright (c) Jay Lan, SGI. 2006
- *
- * Compile with
- *	gcc -I/usr/src/linux/include getdelays.c -o getdelays
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <poll.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <signal.h>
-
-#include <linux/genetlink.h>
-#include <linux/taskstats.h>
-#include <linux/cgroupstats.h>
-
-/*
- * Generic macros for dealing with netlink sockets. Might be duplicated
- * elsewhere. It is recommended that commercial grade applications use
- * libnl or libnetlink and use the interfaces provided by the library
- */
-#define GENLMSG_DATA(glh)	((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
-#define GENLMSG_PAYLOAD(glh)	(NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
-#define NLA_DATA(na)		((void *)((char*)(na) + NLA_HDRLEN))
-#define NLA_PAYLOAD(len)	(len - NLA_HDRLEN)
-
-#define err(code, fmt, arg...)			\
-	do {					\
-		fprintf(stderr, fmt, ##arg);	\
-		exit(code);			\
-	} while (0)
-
-int done;
-int rcvbufsz;
-char name[100];
-int dbg;
-int print_delays;
-int print_io_accounting;
-int print_task_context_switch_counts;
-
-#define PRINTF(fmt, arg...) {			\
-	    if (dbg) {				\
-		printf(fmt, ##arg);		\
-	    }					\
-	}
-
-/* Maximum size of response requested or message sent */
-#define MAX_MSG_SIZE	1024
-/* Maximum number of cpus expected to be specified in a cpumask */
-#define MAX_CPUS	32
-
-struct msgtemplate {
-	struct nlmsghdr n;
-	struct genlmsghdr g;
-	char buf[MAX_MSG_SIZE];
-};
-
-char cpumask[100+6*MAX_CPUS];
-
-static void usage(void)
-{
-	fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] "
-			"[-m cpumask] [-t tgid] [-p pid]\n");
-	fprintf(stderr, "  -d: print delayacct stats\n");
-	fprintf(stderr, "  -i: print IO accounting (works only with -p)\n");
-	fprintf(stderr, "  -l: listen forever\n");
-	fprintf(stderr, "  -v: debug on\n");
-	fprintf(stderr, "  -C: container path\n");
-}
-
-/*
- * Create a raw netlink socket and bind
- */
-static int create_nl_socket(int protocol)
-{
-	int fd;
-	struct sockaddr_nl local;
-
-	fd = socket(AF_NETLINK, SOCK_RAW, protocol);
-	if (fd < 0)
-		return -1;
-
-	if (rcvbufsz)
-		if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
-				&rcvbufsz, sizeof(rcvbufsz)) < 0) {
-			fprintf(stderr, "Unable to set socket rcv buf size to %d\n",
-				rcvbufsz);
-			goto error;
-		}
-
-	memset(&local, 0, sizeof(local));
-	local.nl_family = AF_NETLINK;
-
-	if (bind(fd, (struct sockaddr *) &local, sizeof(local)) < 0)
-		goto error;
-
-	return fd;
-error:
-	close(fd);
-	return -1;
-}
-
-
-static int send_cmd(int sd, __u16 nlmsg_type, __u32 nlmsg_pid,
-	     __u8 genl_cmd, __u16 nla_type,
-	     void *nla_data, int nla_len)
-{
-	struct nlattr *na;
-	struct sockaddr_nl nladdr;
-	int r, buflen;
-	char *buf;
-
-	struct msgtemplate msg;
-
-	msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	msg.n.nlmsg_type = nlmsg_type;
-	msg.n.nlmsg_flags = NLM_F_REQUEST;
-	msg.n.nlmsg_seq = 0;
-	msg.n.nlmsg_pid = nlmsg_pid;
-	msg.g.cmd = genl_cmd;
-	msg.g.version = 0x1;
-	na = (struct nlattr *) GENLMSG_DATA(&msg);
-	na->nla_type = nla_type;
-	na->nla_len = nla_len + 1 + NLA_HDRLEN;
-	memcpy(NLA_DATA(na), nla_data, nla_len);
-	msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
-
-	buf = (char *) &msg;
-	buflen = msg.n.nlmsg_len ;
-	memset(&nladdr, 0, sizeof(nladdr));
-	nladdr.nl_family = AF_NETLINK;
-	while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr,
-			   sizeof(nladdr))) < buflen) {
-		if (r > 0) {
-			buf += r;
-			buflen -= r;
-		} else if (errno != EAGAIN)
-			return -1;
-	}
-	return 0;
-}
-
-
-/*
- * Probe the controller in genetlink to find the family id
- * for the TASKSTATS family
- */
-static int get_family_id(int sd)
-{
-	struct {
-		struct nlmsghdr n;
-		struct genlmsghdr g;
-		char buf[256];
-	} ans;
-
-	int id = 0, rc;
-	struct nlattr *na;
-	int rep_len;
-
-	strcpy(name, TASKSTATS_GENL_NAME);
-	rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
-			CTRL_ATTR_FAMILY_NAME, (void *)name,
-			strlen(TASKSTATS_GENL_NAME)+1);
-	if (rc < 0)
-		return 0;	/* sendto() failure? */
-
-	rep_len = recv(sd, &ans, sizeof(ans), 0);
-	if (ans.n.nlmsg_type == NLMSG_ERROR ||
-	    (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len))
-		return 0;
-
-	na = (struct nlattr *) GENLMSG_DATA(&ans);
-	na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
-	if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
-		id = *(__u16 *) NLA_DATA(na);
-	}
-	return id;
-}
-
-#define average_ms(t, c) (t / 1000000ULL / (c ? c : 1))
-
-static void print_delayacct(struct taskstats *t)
-{
-	printf("\n\nCPU   %15s%15s%15s%15s%15s\n"
-	       "      %15llu%15llu%15llu%15llu%15.3fms\n"
-	       "IO    %15s%15s%15s\n"
-	       "      %15llu%15llu%15llums\n"
-	       "SWAP  %15s%15s%15s\n"
-	       "      %15llu%15llu%15llums\n"
-	       "RECLAIM  %12s%15s%15s\n"
-	       "      %15llu%15llu%15llums\n",
-	       "count", "real total", "virtual total",
-	       "delay total", "delay average",
-	       (unsigned long long)t->cpu_count,
-	       (unsigned long long)t->cpu_run_real_total,
-	       (unsigned long long)t->cpu_run_virtual_total,
-	       (unsigned long long)t->cpu_delay_total,
-	       average_ms((double)t->cpu_delay_total, t->cpu_count),
-	       "count", "delay total", "delay average",
-	       (unsigned long long)t->blkio_count,
-	       (unsigned long long)t->blkio_delay_total,
-	       average_ms(t->blkio_delay_total, t->blkio_count),
-	       "count", "delay total", "delay average",
-	       (unsigned long long)t->swapin_count,
-	       (unsigned long long)t->swapin_delay_total,
-	       average_ms(t->swapin_delay_total, t->swapin_count),
-	       "count", "delay total", "delay average",
-	       (unsigned long long)t->freepages_count,
-	       (unsigned long long)t->freepages_delay_total,
-	       average_ms(t->freepages_delay_total, t->freepages_count));
-}
-
-static void task_context_switch_counts(struct taskstats *t)
-{
-	printf("\n\nTask   %15s%15s\n"
-	       "       %15llu%15llu\n",
-	       "voluntary", "nonvoluntary",
-	       (unsigned long long)t->nvcsw, (unsigned long long)t->nivcsw);
-}
-
-static void print_cgroupstats(struct cgroupstats *c)
-{
-	printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, "
-		"uninterruptible %llu\n", (unsigned long long)c->nr_sleeping,
-		(unsigned long long)c->nr_io_wait,
-		(unsigned long long)c->nr_running,
-		(unsigned long long)c->nr_stopped,
-		(unsigned long long)c->nr_uninterruptible);
-}
-
-
-static void print_ioacct(struct taskstats *t)
-{
-	printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
-		t->ac_comm,
-		(unsigned long long)t->read_bytes,
-		(unsigned long long)t->write_bytes,
-		(unsigned long long)t->cancelled_write_bytes);
-}
-
-int main(int argc, char *argv[])
-{
-	int c, rc, rep_len, aggr_len, len2;
-	int cmd_type = TASKSTATS_CMD_ATTR_UNSPEC;
-	__u16 id;
-	__u32 mypid;
-
-	struct nlattr *na;
-	int nl_sd = -1;
-	int len = 0;
-	pid_t tid = 0;
-	pid_t rtid = 0;
-
-	int fd = 0;
-	int count = 0;
-	int write_file = 0;
-	int maskset = 0;
-	char *logfile = NULL;
-	int loop = 0;
-	int containerset = 0;
-	char *containerpath = NULL;
-	int cfd = 0;
-	int forking = 0;
-	sigset_t sigset;
-
-	struct msgtemplate msg;
-
-	while (!forking) {
-		c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:c:");
-		if (c < 0)
-			break;
-
-		switch (c) {
-		case 'd':
-			printf("print delayacct stats ON\n");
-			print_delays = 1;
-			break;
-		case 'i':
-			printf("printing IO accounting\n");
-			print_io_accounting = 1;
-			break;
-		case 'q':
-			printf("printing task/process context switch rates\n");
-			print_task_context_switch_counts = 1;
-			break;
-		case 'C':
-			containerset = 1;
-			containerpath = optarg;
-			break;
-		case 'w':
-			logfile = strdup(optarg);
-			printf("write to file %s\n", logfile);
-			write_file = 1;
-			break;
-		case 'r':
-			rcvbufsz = atoi(optarg);
-			printf("receive buf size %d\n", rcvbufsz);
-			if (rcvbufsz < 0)
-				err(1, "Invalid rcv buf size\n");
-			break;
-		case 'm':
-			strncpy(cpumask, optarg, sizeof(cpumask));
-			cpumask[sizeof(cpumask) - 1] = '\0';
-			maskset = 1;
-			printf("cpumask %s maskset %d\n", cpumask, maskset);
-			break;
-		case 't':
-			tid = atoi(optarg);
-			if (!tid)
-				err(1, "Invalid tgid\n");
-			cmd_type = TASKSTATS_CMD_ATTR_TGID;
-			break;
-		case 'p':
-			tid = atoi(optarg);
-			if (!tid)
-				err(1, "Invalid pid\n");
-			cmd_type = TASKSTATS_CMD_ATTR_PID;
-			break;
-		case 'c':
-
-			/* Block SIGCHLD for sigwait() later */
-			if (sigemptyset(&sigset) == -1)
-				err(1, "Failed to empty sigset");
-			if (sigaddset(&sigset, SIGCHLD))
-				err(1, "Failed to set sigchld in sigset");
-			sigprocmask(SIG_BLOCK, &sigset, NULL);
-
-			/* fork/exec a child */
-			tid = fork();
-			if (tid < 0)
-				err(1, "Fork failed\n");
-			if (tid == 0)
-				if (execvp(argv[optind - 1],
-				    &argv[optind - 1]) < 0)
-					exit(-1);
-
-			/* Set the command type and avoid further processing */
-			cmd_type = TASKSTATS_CMD_ATTR_PID;
-			forking = 1;
-			break;
-		case 'v':
-			printf("debug on\n");
-			dbg = 1;
-			break;
-		case 'l':
-			printf("listen forever\n");
-			loop = 1;
-			break;
-		default:
-			usage();
-			exit(-1);
-		}
-	}
-
-	if (write_file) {
-		fd = open(logfile, O_WRONLY | O_CREAT | O_TRUNC,
-			  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-		if (fd == -1) {
-			perror("Cannot open output file\n");
-			exit(1);
-		}
-	}
-
-	nl_sd = create_nl_socket(NETLINK_GENERIC);
-	if (nl_sd < 0)
-		err(1, "error creating Netlink socket\n");
-
-
-	mypid = getpid();
-	id = get_family_id(nl_sd);
-	if (!id) {
-		fprintf(stderr, "Error getting family id, errno %d\n", errno);
-		goto err;
-	}
-	PRINTF("family id %d\n", id);
-
-	if (maskset) {
-		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
-			      TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
-			      &cpumask, strlen(cpumask) + 1);
-		PRINTF("Sent register cpumask, retval %d\n", rc);
-		if (rc < 0) {
-			fprintf(stderr, "error sending register cpumask\n");
-			goto err;
-		}
-	}
-
-	if (tid && containerset) {
-		fprintf(stderr, "Select either -t or -C, not both\n");
-		goto err;
-	}
-
-	/*
-	 * If we forked a child, wait for it to exit. Cannot use waitpid()
-	 * as all the delicious data would be reaped as part of the wait
-	 */
-	if (tid && forking) {
-		int sig_received;
-		sigwait(&sigset, &sig_received);
-	}
-
-	if (tid) {
-		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
-			      cmd_type, &tid, sizeof(__u32));
-		PRINTF("Sent pid/tgid, retval %d\n", rc);
-		if (rc < 0) {
-			fprintf(stderr, "error sending tid/tgid cmd\n");
-			goto done;
-		}
-	}
-
-	if (containerset) {
-		cfd = open(containerpath, O_RDONLY);
-		if (cfd < 0) {
-			perror("error opening container file");
-			goto err;
-		}
-		rc = send_cmd(nl_sd, id, mypid, CGROUPSTATS_CMD_GET,
-			      CGROUPSTATS_CMD_ATTR_FD, &cfd, sizeof(__u32));
-		if (rc < 0) {
-			perror("error sending cgroupstats command");
-			goto err;
-		}
-	}
-	if (!maskset && !tid && !containerset) {
-		usage();
-		goto err;
-	}
-
-	do {
-		rep_len = recv(nl_sd, &msg, sizeof(msg), 0);
-		PRINTF("received %d bytes\n", rep_len);
-
-		if (rep_len < 0) {
-			fprintf(stderr, "nonfatal reply error: errno %d\n",
-				errno);
-			continue;
-		}
-		if (msg.n.nlmsg_type == NLMSG_ERROR ||
-		    !NLMSG_OK((&msg.n), rep_len)) {
-			struct nlmsgerr *err = NLMSG_DATA(&msg);
-			fprintf(stderr, "fatal reply error,  errno %d\n",
-				err->error);
-			goto done;
-		}
-
-		PRINTF("nlmsghdr size=%zu, nlmsg_len=%d, rep_len=%d\n",
-		       sizeof(struct nlmsghdr), msg.n.nlmsg_len, rep_len);
-
-
-		rep_len = GENLMSG_PAYLOAD(&msg.n);
-
-		na = (struct nlattr *) GENLMSG_DATA(&msg);
-		len = 0;
-		while (len < rep_len) {
-			len += NLA_ALIGN(na->nla_len);
-			switch (na->nla_type) {
-			case TASKSTATS_TYPE_AGGR_TGID:
-				/* Fall through */
-			case TASKSTATS_TYPE_AGGR_PID:
-				aggr_len = NLA_PAYLOAD(na->nla_len);
-				len2 = 0;
-				/* For nested attributes, na follows */
-				na = (struct nlattr *) NLA_DATA(na);
-				done = 0;
-				while (len2 < aggr_len) {
-					switch (na->nla_type) {
-					case TASKSTATS_TYPE_PID:
-						rtid = *(int *) NLA_DATA(na);
-						if (print_delays)
-							printf("PID\t%d\n", rtid);
-						break;
-					case TASKSTATS_TYPE_TGID:
-						rtid = *(int *) NLA_DATA(na);
-						if (print_delays)
-							printf("TGID\t%d\n", rtid);
-						break;
-					case TASKSTATS_TYPE_STATS:
-						count++;
-						if (print_delays)
-							print_delayacct((struct taskstats *) NLA_DATA(na));
-						if (print_io_accounting)
-							print_ioacct((struct taskstats *) NLA_DATA(na));
-						if (print_task_context_switch_counts)
-							task_context_switch_counts((struct taskstats *) NLA_DATA(na));
-						if (fd) {
-							if (write(fd, NLA_DATA(na), na->nla_len) < 0) {
-								err(1,"write error\n");
-							}
-						}
-						if (!loop)
-							goto done;
-						break;
-					case TASKSTATS_TYPE_NULL:
-						break;
-					default:
-						fprintf(stderr, "Unknown nested"
-							" nla_type %d\n",
-							na->nla_type);
-						break;
-					}
-					len2 += NLA_ALIGN(na->nla_len);
-					na = (struct nlattr *)((char *)na +
-							       NLA_ALIGN(na->nla_len));
-				}
-				break;
-
-			case CGROUPSTATS_TYPE_CGROUP_STATS:
-				print_cgroupstats(NLA_DATA(na));
-				break;
-			default:
-				fprintf(stderr, "Unknown nla_type %d\n",
-					na->nla_type);
-			case TASKSTATS_TYPE_NULL:
-				break;
-			}
-			na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
-		}
-	} while (loop);
-done:
-	if (maskset) {
-		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
-			      TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
-			      &cpumask, strlen(cpumask) + 1);
-		printf("Sent deregister mask, retval %d\n", rc);
-		if (rc < 0)
-			err(rc, "error sending deregister cpumask\n");
-	}
-err:
-	close(nl_sd);
-	if (fd)
-		close(fd);
-	if (cfd)
-		close(cfd);
-	return 0;
-}
diff --git a/tools/accounting/.gitignore b/tools/accounting/.gitignore
new file mode 100644
index 0000000..8648520
--- /dev/null
+++ b/tools/accounting/.gitignore
@@ -0,0 +1 @@
+getdelays
diff --git a/tools/accounting/Makefile b/tools/accounting/Makefile
new file mode 100644
index 0000000..647c94a
--- /dev/null
+++ b/tools/accounting/Makefile
@@ -0,0 +1,9 @@
+CC := $(CROSS_COMPILE)gcc
+CFLAGS := -I../../usr/include
+
+PROGS := getdelays
+
+all: $(PROGS)
+
+clean:
+	rm -fr $(PROGS)
diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c
new file mode 100644
index 0000000..b5ca536
--- /dev/null
+++ b/tools/accounting/getdelays.c
@@ -0,0 +1,550 @@
+/* getdelays.c
+ *
+ * Utility to get per-pid and per-tgid delay accounting statistics
+ * Also illustrates usage of the taskstats interface
+ *
+ * Copyright (C) Shailabh Nagar, IBM Corp. 2005
+ * Copyright (C) Balbir Singh, IBM Corp. 2006
+ * Copyright (c) Jay Lan, SGI. 2006
+ *
+ * Compile with
+ *	gcc -I/usr/src/linux/include getdelays.c -o getdelays
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <poll.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <signal.h>
+
+#include <linux/genetlink.h>
+#include <linux/taskstats.h>
+#include <linux/cgroupstats.h>
+
+/*
+ * Generic macros for dealing with netlink sockets. Might be duplicated
+ * elsewhere. It is recommended that commercial grade applications use
+ * libnl or libnetlink and use the interfaces provided by the library
+ */
+#define GENLMSG_DATA(glh)	((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
+#define GENLMSG_PAYLOAD(glh)	(NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
+#define NLA_DATA(na)		((void *)((char*)(na) + NLA_HDRLEN))
+#define NLA_PAYLOAD(len)	(len - NLA_HDRLEN)
+
+#define err(code, fmt, arg...)			\
+	do {					\
+		fprintf(stderr, fmt, ##arg);	\
+		exit(code);			\
+	} while (0)
+
+int done;
+int rcvbufsz;
+char name[100];
+int dbg;
+int print_delays;
+int print_io_accounting;
+int print_task_context_switch_counts;
+
+#define PRINTF(fmt, arg...) {			\
+	    if (dbg) {				\
+		printf(fmt, ##arg);		\
+	    }					\
+	}
+
+/* Maximum size of response requested or message sent */
+#define MAX_MSG_SIZE	1024
+/* Maximum number of cpus expected to be specified in a cpumask */
+#define MAX_CPUS	32
+
+struct msgtemplate {
+	struct nlmsghdr n;
+	struct genlmsghdr g;
+	char buf[MAX_MSG_SIZE];
+};
+
+char cpumask[100+6*MAX_CPUS];
+
+static void usage(void)
+{
+	fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] "
+			"[-m cpumask] [-t tgid] [-p pid]\n");
+	fprintf(stderr, "  -d: print delayacct stats\n");
+	fprintf(stderr, "  -i: print IO accounting (works only with -p)\n");
+	fprintf(stderr, "  -l: listen forever\n");
+	fprintf(stderr, "  -v: debug on\n");
+	fprintf(stderr, "  -C: container path\n");
+}
+
+/*
+ * Create a raw netlink socket and bind
+ */
+static int create_nl_socket(int protocol)
+{
+	int fd;
+	struct sockaddr_nl local;
+
+	fd = socket(AF_NETLINK, SOCK_RAW, protocol);
+	if (fd < 0)
+		return -1;
+
+	if (rcvbufsz)
+		if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
+				&rcvbufsz, sizeof(rcvbufsz)) < 0) {
+			fprintf(stderr, "Unable to set socket rcv buf size to %d\n",
+				rcvbufsz);
+			goto error;
+		}
+
+	memset(&local, 0, sizeof(local));
+	local.nl_family = AF_NETLINK;
+
+	if (bind(fd, (struct sockaddr *) &local, sizeof(local)) < 0)
+		goto error;
+
+	return fd;
+error:
+	close(fd);
+	return -1;
+}
+
+
+static int send_cmd(int sd, __u16 nlmsg_type, __u32 nlmsg_pid,
+	     __u8 genl_cmd, __u16 nla_type,
+	     void *nla_data, int nla_len)
+{
+	struct nlattr *na;
+	struct sockaddr_nl nladdr;
+	int r, buflen;
+	char *buf;
+
+	struct msgtemplate msg;
+
+	msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
+	msg.n.nlmsg_type = nlmsg_type;
+	msg.n.nlmsg_flags = NLM_F_REQUEST;
+	msg.n.nlmsg_seq = 0;
+	msg.n.nlmsg_pid = nlmsg_pid;
+	msg.g.cmd = genl_cmd;
+	msg.g.version = 0x1;
+	na = (struct nlattr *) GENLMSG_DATA(&msg);
+	na->nla_type = nla_type;
+	na->nla_len = nla_len + 1 + NLA_HDRLEN;
+	memcpy(NLA_DATA(na), nla_data, nla_len);
+	msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
+
+	buf = (char *) &msg;
+	buflen = msg.n.nlmsg_len ;
+	memset(&nladdr, 0, sizeof(nladdr));
+	nladdr.nl_family = AF_NETLINK;
+	while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr,
+			   sizeof(nladdr))) < buflen) {
+		if (r > 0) {
+			buf += r;
+			buflen -= r;
+		} else if (errno != EAGAIN)
+			return -1;
+	}
+	return 0;
+}
+
+
+/*
+ * Probe the controller in genetlink to find the family id
+ * for the TASKSTATS family
+ */
+static int get_family_id(int sd)
+{
+	struct {
+		struct nlmsghdr n;
+		struct genlmsghdr g;
+		char buf[256];
+	} ans;
+
+	int id = 0, rc;
+	struct nlattr *na;
+	int rep_len;
+
+	strcpy(name, TASKSTATS_GENL_NAME);
+	rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
+			CTRL_ATTR_FAMILY_NAME, (void *)name,
+			strlen(TASKSTATS_GENL_NAME)+1);
+	if (rc < 0)
+		return 0;	/* sendto() failure? */
+
+	rep_len = recv(sd, &ans, sizeof(ans), 0);
+	if (ans.n.nlmsg_type == NLMSG_ERROR ||
+	    (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len))
+		return 0;
+
+	na = (struct nlattr *) GENLMSG_DATA(&ans);
+	na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
+	if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
+		id = *(__u16 *) NLA_DATA(na);
+	}
+	return id;
+}
+
+#define average_ms(t, c) (t / 1000000ULL / (c ? c : 1))
+
+static void print_delayacct(struct taskstats *t)
+{
+	printf("\n\nCPU   %15s%15s%15s%15s%15s\n"
+	       "      %15llu%15llu%15llu%15llu%15.3fms\n"
+	       "IO    %15s%15s%15s\n"
+	       "      %15llu%15llu%15llums\n"
+	       "SWAP  %15s%15s%15s\n"
+	       "      %15llu%15llu%15llums\n"
+	       "RECLAIM  %12s%15s%15s\n"
+	       "      %15llu%15llu%15llums\n",
+	       "count", "real total", "virtual total",
+	       "delay total", "delay average",
+	       (unsigned long long)t->cpu_count,
+	       (unsigned long long)t->cpu_run_real_total,
+	       (unsigned long long)t->cpu_run_virtual_total,
+	       (unsigned long long)t->cpu_delay_total,
+	       average_ms((double)t->cpu_delay_total, t->cpu_count),
+	       "count", "delay total", "delay average",
+	       (unsigned long long)t->blkio_count,
+	       (unsigned long long)t->blkio_delay_total,
+	       average_ms(t->blkio_delay_total, t->blkio_count),
+	       "count", "delay total", "delay average",
+	       (unsigned long long)t->swapin_count,
+	       (unsigned long long)t->swapin_delay_total,
+	       average_ms(t->swapin_delay_total, t->swapin_count),
+	       "count", "delay total", "delay average",
+	       (unsigned long long)t->freepages_count,
+	       (unsigned long long)t->freepages_delay_total,
+	       average_ms(t->freepages_delay_total, t->freepages_count));
+}
+
+static void task_context_switch_counts(struct taskstats *t)
+{
+	printf("\n\nTask   %15s%15s\n"
+	       "       %15llu%15llu\n",
+	       "voluntary", "nonvoluntary",
+	       (unsigned long long)t->nvcsw, (unsigned long long)t->nivcsw);
+}
+
+static void print_cgroupstats(struct cgroupstats *c)
+{
+	printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, "
+		"uninterruptible %llu\n", (unsigned long long)c->nr_sleeping,
+		(unsigned long long)c->nr_io_wait,
+		(unsigned long long)c->nr_running,
+		(unsigned long long)c->nr_stopped,
+		(unsigned long long)c->nr_uninterruptible);
+}
+
+
+static void print_ioacct(struct taskstats *t)
+{
+	printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
+		t->ac_comm,
+		(unsigned long long)t->read_bytes,
+		(unsigned long long)t->write_bytes,
+		(unsigned long long)t->cancelled_write_bytes);
+}
+
+int main(int argc, char *argv[])
+{
+	int c, rc, rep_len, aggr_len, len2;
+	int cmd_type = TASKSTATS_CMD_ATTR_UNSPEC;
+	__u16 id;
+	__u32 mypid;
+
+	struct nlattr *na;
+	int nl_sd = -1;
+	int len = 0;
+	pid_t tid = 0;
+	pid_t rtid = 0;
+
+	int fd = 0;
+	int count = 0;
+	int write_file = 0;
+	int maskset = 0;
+	char *logfile = NULL;
+	int loop = 0;
+	int containerset = 0;
+	char *containerpath = NULL;
+	int cfd = 0;
+	int forking = 0;
+	sigset_t sigset;
+
+	struct msgtemplate msg;
+
+	while (!forking) {
+		c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:c:");
+		if (c < 0)
+			break;
+
+		switch (c) {
+		case 'd':
+			printf("print delayacct stats ON\n");
+			print_delays = 1;
+			break;
+		case 'i':
+			printf("printing IO accounting\n");
+			print_io_accounting = 1;
+			break;
+		case 'q':
+			printf("printing task/process context switch rates\n");
+			print_task_context_switch_counts = 1;
+			break;
+		case 'C':
+			containerset = 1;
+			containerpath = optarg;
+			break;
+		case 'w':
+			logfile = strdup(optarg);
+			printf("write to file %s\n", logfile);
+			write_file = 1;
+			break;
+		case 'r':
+			rcvbufsz = atoi(optarg);
+			printf("receive buf size %d\n", rcvbufsz);
+			if (rcvbufsz < 0)
+				err(1, "Invalid rcv buf size\n");
+			break;
+		case 'm':
+			strncpy(cpumask, optarg, sizeof(cpumask));
+			cpumask[sizeof(cpumask) - 1] = '\0';
+			maskset = 1;
+			printf("cpumask %s maskset %d\n", cpumask, maskset);
+			break;
+		case 't':
+			tid = atoi(optarg);
+			if (!tid)
+				err(1, "Invalid tgid\n");
+			cmd_type = TASKSTATS_CMD_ATTR_TGID;
+			break;
+		case 'p':
+			tid = atoi(optarg);
+			if (!tid)
+				err(1, "Invalid pid\n");
+			cmd_type = TASKSTATS_CMD_ATTR_PID;
+			break;
+		case 'c':
+
+			/* Block SIGCHLD for sigwait() later */
+			if (sigemptyset(&sigset) == -1)
+				err(1, "Failed to empty sigset");
+			if (sigaddset(&sigset, SIGCHLD))
+				err(1, "Failed to set sigchld in sigset");
+			sigprocmask(SIG_BLOCK, &sigset, NULL);
+
+			/* fork/exec a child */
+			tid = fork();
+			if (tid < 0)
+				err(1, "Fork failed\n");
+			if (tid == 0)
+				if (execvp(argv[optind - 1],
+				    &argv[optind - 1]) < 0)
+					exit(-1);
+
+			/* Set the command type and avoid further processing */
+			cmd_type = TASKSTATS_CMD_ATTR_PID;
+			forking = 1;
+			break;
+		case 'v':
+			printf("debug on\n");
+			dbg = 1;
+			break;
+		case 'l':
+			printf("listen forever\n");
+			loop = 1;
+			break;
+		default:
+			usage();
+			exit(-1);
+		}
+	}
+
+	if (write_file) {
+		fd = open(logfile, O_WRONLY | O_CREAT | O_TRUNC,
+			  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+		if (fd == -1) {
+			perror("Cannot open output file\n");
+			exit(1);
+		}
+	}
+
+	nl_sd = create_nl_socket(NETLINK_GENERIC);
+	if (nl_sd < 0)
+		err(1, "error creating Netlink socket\n");
+
+
+	mypid = getpid();
+	id = get_family_id(nl_sd);
+	if (!id) {
+		fprintf(stderr, "Error getting family id, errno %d\n", errno);
+		goto err;
+	}
+	PRINTF("family id %d\n", id);
+
+	if (maskset) {
+		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
+			      TASKSTATS_CMD_ATTR_REGISTER_CPUMASK,
+			      &cpumask, strlen(cpumask) + 1);
+		PRINTF("Sent register cpumask, retval %d\n", rc);
+		if (rc < 0) {
+			fprintf(stderr, "error sending register cpumask\n");
+			goto err;
+		}
+	}
+
+	if (tid && containerset) {
+		fprintf(stderr, "Select either -t or -C, not both\n");
+		goto err;
+	}
+
+	/*
+	 * If we forked a child, wait for it to exit. Cannot use waitpid()
+	 * as all the delicious data would be reaped as part of the wait
+	 */
+	if (tid && forking) {
+		int sig_received;
+		sigwait(&sigset, &sig_received);
+	}
+
+	if (tid) {
+		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
+			      cmd_type, &tid, sizeof(__u32));
+		PRINTF("Sent pid/tgid, retval %d\n", rc);
+		if (rc < 0) {
+			fprintf(stderr, "error sending tid/tgid cmd\n");
+			goto done;
+		}
+	}
+
+	if (containerset) {
+		cfd = open(containerpath, O_RDONLY);
+		if (cfd < 0) {
+			perror("error opening container file");
+			goto err;
+		}
+		rc = send_cmd(nl_sd, id, mypid, CGROUPSTATS_CMD_GET,
+			      CGROUPSTATS_CMD_ATTR_FD, &cfd, sizeof(__u32));
+		if (rc < 0) {
+			perror("error sending cgroupstats command");
+			goto err;
+		}
+	}
+	if (!maskset && !tid && !containerset) {
+		usage();
+		goto err;
+	}
+
+	do {
+		rep_len = recv(nl_sd, &msg, sizeof(msg), 0);
+		PRINTF("received %d bytes\n", rep_len);
+
+		if (rep_len < 0) {
+			fprintf(stderr, "nonfatal reply error: errno %d\n",
+				errno);
+			continue;
+		}
+		if (msg.n.nlmsg_type == NLMSG_ERROR ||
+		    !NLMSG_OK((&msg.n), rep_len)) {
+			struct nlmsgerr *err = NLMSG_DATA(&msg);
+			fprintf(stderr, "fatal reply error,  errno %d\n",
+				err->error);
+			goto done;
+		}
+
+		PRINTF("nlmsghdr size=%zu, nlmsg_len=%d, rep_len=%d\n",
+		       sizeof(struct nlmsghdr), msg.n.nlmsg_len, rep_len);
+
+
+		rep_len = GENLMSG_PAYLOAD(&msg.n);
+
+		na = (struct nlattr *) GENLMSG_DATA(&msg);
+		len = 0;
+		while (len < rep_len) {
+			len += NLA_ALIGN(na->nla_len);
+			switch (na->nla_type) {
+			case TASKSTATS_TYPE_AGGR_TGID:
+				/* Fall through */
+			case TASKSTATS_TYPE_AGGR_PID:
+				aggr_len = NLA_PAYLOAD(na->nla_len);
+				len2 = 0;
+				/* For nested attributes, na follows */
+				na = (struct nlattr *) NLA_DATA(na);
+				done = 0;
+				while (len2 < aggr_len) {
+					switch (na->nla_type) {
+					case TASKSTATS_TYPE_PID:
+						rtid = *(int *) NLA_DATA(na);
+						if (print_delays)
+							printf("PID\t%d\n", rtid);
+						break;
+					case TASKSTATS_TYPE_TGID:
+						rtid = *(int *) NLA_DATA(na);
+						if (print_delays)
+							printf("TGID\t%d\n", rtid);
+						break;
+					case TASKSTATS_TYPE_STATS:
+						count++;
+						if (print_delays)
+							print_delayacct((struct taskstats *) NLA_DATA(na));
+						if (print_io_accounting)
+							print_ioacct((struct taskstats *) NLA_DATA(na));
+						if (print_task_context_switch_counts)
+							task_context_switch_counts((struct taskstats *) NLA_DATA(na));
+						if (fd) {
+							if (write(fd, NLA_DATA(na), na->nla_len) < 0) {
+								err(1,"write error\n");
+							}
+						}
+						if (!loop)
+							goto done;
+						break;
+					case TASKSTATS_TYPE_NULL:
+						break;
+					default:
+						fprintf(stderr, "Unknown nested"
+							" nla_type %d\n",
+							na->nla_type);
+						break;
+					}
+					len2 += NLA_ALIGN(na->nla_len);
+					na = (struct nlattr *)((char *)na +
+							       NLA_ALIGN(na->nla_len));
+				}
+				break;
+
+			case CGROUPSTATS_TYPE_CGROUP_STATS:
+				print_cgroupstats(NLA_DATA(na));
+				break;
+			default:
+				fprintf(stderr, "Unknown nla_type %d\n",
+					na->nla_type);
+			case TASKSTATS_TYPE_NULL:
+				break;
+			}
+			na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
+		}
+	} while (loop);
+done:
+	if (maskset) {
+		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
+			      TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK,
+			      &cpumask, strlen(cpumask) + 1);
+		printf("Sent deregister mask, retval %d\n", rc);
+		if (rc < 0)
+			err(rc, "error sending deregister cpumask\n");
+	}
+err:
+	close(nl_sd);
+	if (fd)
+		close(fd);
+	if (cfd)
+		close(cfd);
+	return 0;
+}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] tools: move laptops dslm tool from Documentation
  2016-09-22  0:51 [PATCH v2 0/3] Move runnable tools from Documentation to tools Shuah Khan
  2016-09-22  0:51 ` [PATCH v2 1/3] tools: move accounting tool from Documentation Shuah Khan
@ 2016-09-22  0:51 ` Shuah Khan
  2016-09-22  0:51 ` [PATCH v2 3/3] tools: move pcmcia crc32hash " Shuah Khan
  2016-09-22 14:57 ` [PATCH v2 0/3] Move runnable tools from Documentation to tools Jonathan Corbet
  3 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2016-09-22  0:51 UTC (permalink / raw)
  To: corbet, davem, nicolas.dichtel, elfring, geert, akpm, gregkh,
	kvalo, mchehab, linux
  Cc: Shuah Khan, linux-doc, linux-kernel, linux-pcmcia

Move laptops dslm tool to tools/laptop/dslm and remove it from
Documentation Makefile. Update location information for this
tool. Create a new Makefile to build dslm. It can be built
from top level directory or from laptops directory:

Run make -C tools/laptop/dslm or cd tools/laptop/dslm; make

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 Documentation/Makefile                |   2 +-
 Documentation/laptops/.gitignore      |   1 -
 Documentation/laptops/00-INDEX        |   4 -
 Documentation/laptops/Makefile        |   5 -
 Documentation/laptops/dslm.c          | 166 ----------------------------------
 Documentation/laptops/laptop-mode.txt |   2 +-
 tools/laptop/dslm/.gitignore          |   1 +
 tools/laptop/dslm/Makefile            |   9 ++
 tools/laptop/dslm/dslm.c              | 166 ++++++++++++++++++++++++++++++++++
 9 files changed, 178 insertions(+), 178 deletions(-)
 delete mode 100644 Documentation/laptops/.gitignore
 delete mode 100644 Documentation/laptops/Makefile
 delete mode 100644 Documentation/laptops/dslm.c
 create mode 100644 tools/laptop/dslm/.gitignore
 create mode 100644 tools/laptop/dslm/Makefile
 create mode 100644 tools/laptop/dslm/dslm.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index e4dd5e4..0ddb50c 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1,2 @@
 subdir-y := blackfin \
-	laptops pcmcia
+	pcmcia
diff --git a/Documentation/laptops/.gitignore b/Documentation/laptops/.gitignore
deleted file mode 100644
index 9fc984e..0000000
--- a/Documentation/laptops/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dslm
diff --git a/Documentation/laptops/00-INDEX b/Documentation/laptops/00-INDEX
index 7c0ac2a..86169dc 100644
--- a/Documentation/laptops/00-INDEX
+++ b/Documentation/laptops/00-INDEX
@@ -1,13 +1,9 @@
 00-INDEX
 	- This file
-Makefile
-	- Makefile for building dslm example program.
 asus-laptop.txt
 	- information on the Asus Laptop Extras driver.
 disk-shock-protection.txt
 	- information on hard disk shock protection.
-dslm.c
-	- Simple Disk Sleep Monitor program
 laptop-mode.txt
 	- how to conserve battery power using laptop-mode.
 sony-laptop.txt
diff --git a/Documentation/laptops/Makefile b/Documentation/laptops/Makefile
deleted file mode 100644
index 0abe44f..0000000
--- a/Documentation/laptops/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-y := dslm
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
diff --git a/Documentation/laptops/dslm.c b/Documentation/laptops/dslm.c
deleted file mode 100644
index d5dd2d4..0000000
--- a/Documentation/laptops/dslm.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * dslm.c
- * Simple Disk Sleep Monitor
- *  by Bartek Kania
- * Licensed under the GPL
- */
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <linux/hdreg.h>
-
-#ifdef DEBUG
-#define D(x) x
-#else
-#define D(x)
-#endif
-
-int endit = 0;
-
-/* Check if the disk is in powersave-mode
- * Most of the code is stolen from hdparm.
- * 1 = active, 0 = standby/sleep, -1 = unknown */
-static int check_powermode(int fd)
-{
-    unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
-    int state;
-
-    if (ioctl(fd, HDIO_DRIVE_CMD, &args)
-	&& (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
-	&& ioctl(fd, HDIO_DRIVE_CMD, &args)) {
-	if (errno != EIO || args[0] != 0 || args[1] != 0) {
-	    state = -1; /* "unknown"; */
-	} else
-	    state = 0; /* "sleeping"; */
-    } else {
-	state = (args[2] == 255) ? 1 : 0;
-    }
-    D(printf(" drive state is:  %d\n", state));
-
-    return state;
-}
-
-static char *state_name(int i)
-{
-    if (i == -1) return "unknown";
-    if (i == 0) return "sleeping";
-    if (i == 1) return "active";
-
-    return "internal error";
-}
-
-static char *myctime(time_t time)
-{
-    char *ts = ctime(&time);
-    ts[strlen(ts) - 1] = 0;
-
-    return ts;
-}
-
-static void measure(int fd)
-{
-    time_t start_time;
-    int last_state;
-    time_t last_time;
-    int curr_state;
-    time_t curr_time = 0;
-    time_t time_diff;
-    time_t active_time = 0;
-    time_t sleep_time = 0;
-    time_t unknown_time = 0;
-    time_t total_time = 0;
-    int changes = 0;
-    float tmp;
-
-    printf("Starting measurements\n");
-
-    last_state = check_powermode(fd);
-    start_time = last_time = time(0);
-    printf("  System is in state %s\n\n", state_name(last_state));
-
-    while(!endit) {
-	sleep(1);
-	curr_state = check_powermode(fd);
-
-	if (curr_state != last_state || endit) {
-	    changes++;
-	    curr_time = time(0);
-	    time_diff = curr_time - last_time;
-
-	    if (last_state == 1) active_time += time_diff;
-	    else if (last_state == 0) sleep_time += time_diff;
-	    else unknown_time += time_diff;
-
-	    last_state = curr_state;
-	    last_time = curr_time;
-
-	    printf("%s: State-change to %s\n", myctime(curr_time),
-		   state_name(curr_state));
-	}
-    }
-    changes--; /* Compensate for SIGINT */
-
-    total_time = time(0) - start_time;
-    printf("\nTotal running time:  %lus\n", curr_time - start_time);
-    printf(" State changed %d times\n", changes);
-
-    tmp = (float)sleep_time / (float)total_time * 100;
-    printf(" Time in sleep state:   %lus (%.2f%%)\n", sleep_time, tmp);
-    tmp = (float)active_time / (float)total_time * 100;
-    printf(" Time in active state:  %lus (%.2f%%)\n", active_time, tmp);
-    tmp = (float)unknown_time / (float)total_time * 100;
-    printf(" Time in unknown state: %lus (%.2f%%)\n", unknown_time, tmp);
-}
-
-static void ender(int s)
-{
-    endit = 1;
-}
-
-static void usage(void)
-{
-    puts("usage: dslm [-w <time>] <disk>");
-    exit(0);
-}
-
-int main(int argc, char **argv)
-{
-    int fd;
-    char *disk = 0;
-    int settle_time = 60;
-
-    /* Parse the simple command-line */
-    if (argc == 2)
-	disk = argv[1];
-    else if (argc == 4) {
-	settle_time = atoi(argv[2]);
-	disk = argv[3];
-    } else
-	usage();
-
-    if (!(fd = open(disk, O_RDONLY|O_NONBLOCK))) {
-	printf("Can't open %s, because: %s\n", disk, strerror(errno));
-	exit(-1);
-    }
-
-    if (settle_time) {
-	printf("Waiting %d seconds for the system to settle down to "
-	       "'normal'\n", settle_time);
-	sleep(settle_time);
-    } else
-	puts("Not waiting for system to settle down");
-
-    signal(SIGINT, ender);
-
-    measure(fd);
-
-    close(fd);
-
-    return 0;
-}
diff --git a/Documentation/laptops/laptop-mode.txt b/Documentation/laptops/laptop-mode.txt
index 4ebbfc3..19276f5 100644
--- a/Documentation/laptops/laptop-mode.txt
+++ b/Documentation/laptops/laptop-mode.txt
@@ -779,4 +779,4 @@ Monitoring tool
 ---------------
 
 Bartek Kania submitted this, it can be used to measure how much time your disk
-spends spun up/down.  See Documentation/laptops/dslm.c
+spends spun up/down.  See tools/laptop/dslm/dslm.c
diff --git a/tools/laptop/dslm/.gitignore b/tools/laptop/dslm/.gitignore
new file mode 100644
index 0000000..9fc984e
--- /dev/null
+++ b/tools/laptop/dslm/.gitignore
@@ -0,0 +1 @@
+dslm
diff --git a/tools/laptop/dslm/Makefile b/tools/laptop/dslm/Makefile
new file mode 100644
index 0000000..ff613b3
--- /dev/null
+++ b/tools/laptop/dslm/Makefile
@@ -0,0 +1,9 @@
+CC := $(CROSS_COMPILE)gcc
+CFLAGS := -I../../usr/include
+
+PROGS := dslm
+
+all: $(PROGS)
+
+clean:
+	rm -fr $(PROGS)
diff --git a/tools/laptop/dslm/dslm.c b/tools/laptop/dslm/dslm.c
new file mode 100644
index 0000000..d5dd2d4
--- /dev/null
+++ b/tools/laptop/dslm/dslm.c
@@ -0,0 +1,166 @@
+/*
+ * dslm.c
+ * Simple Disk Sleep Monitor
+ *  by Bartek Kania
+ * Licensed under the GPL
+ */
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <linux/hdreg.h>
+
+#ifdef DEBUG
+#define D(x) x
+#else
+#define D(x)
+#endif
+
+int endit = 0;
+
+/* Check if the disk is in powersave-mode
+ * Most of the code is stolen from hdparm.
+ * 1 = active, 0 = standby/sleep, -1 = unknown */
+static int check_powermode(int fd)
+{
+    unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
+    int state;
+
+    if (ioctl(fd, HDIO_DRIVE_CMD, &args)
+	&& (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
+	&& ioctl(fd, HDIO_DRIVE_CMD, &args)) {
+	if (errno != EIO || args[0] != 0 || args[1] != 0) {
+	    state = -1; /* "unknown"; */
+	} else
+	    state = 0; /* "sleeping"; */
+    } else {
+	state = (args[2] == 255) ? 1 : 0;
+    }
+    D(printf(" drive state is:  %d\n", state));
+
+    return state;
+}
+
+static char *state_name(int i)
+{
+    if (i == -1) return "unknown";
+    if (i == 0) return "sleeping";
+    if (i == 1) return "active";
+
+    return "internal error";
+}
+
+static char *myctime(time_t time)
+{
+    char *ts = ctime(&time);
+    ts[strlen(ts) - 1] = 0;
+
+    return ts;
+}
+
+static void measure(int fd)
+{
+    time_t start_time;
+    int last_state;
+    time_t last_time;
+    int curr_state;
+    time_t curr_time = 0;
+    time_t time_diff;
+    time_t active_time = 0;
+    time_t sleep_time = 0;
+    time_t unknown_time = 0;
+    time_t total_time = 0;
+    int changes = 0;
+    float tmp;
+
+    printf("Starting measurements\n");
+
+    last_state = check_powermode(fd);
+    start_time = last_time = time(0);
+    printf("  System is in state %s\n\n", state_name(last_state));
+
+    while(!endit) {
+	sleep(1);
+	curr_state = check_powermode(fd);
+
+	if (curr_state != last_state || endit) {
+	    changes++;
+	    curr_time = time(0);
+	    time_diff = curr_time - last_time;
+
+	    if (last_state == 1) active_time += time_diff;
+	    else if (last_state == 0) sleep_time += time_diff;
+	    else unknown_time += time_diff;
+
+	    last_state = curr_state;
+	    last_time = curr_time;
+
+	    printf("%s: State-change to %s\n", myctime(curr_time),
+		   state_name(curr_state));
+	}
+    }
+    changes--; /* Compensate for SIGINT */
+
+    total_time = time(0) - start_time;
+    printf("\nTotal running time:  %lus\n", curr_time - start_time);
+    printf(" State changed %d times\n", changes);
+
+    tmp = (float)sleep_time / (float)total_time * 100;
+    printf(" Time in sleep state:   %lus (%.2f%%)\n", sleep_time, tmp);
+    tmp = (float)active_time / (float)total_time * 100;
+    printf(" Time in active state:  %lus (%.2f%%)\n", active_time, tmp);
+    tmp = (float)unknown_time / (float)total_time * 100;
+    printf(" Time in unknown state: %lus (%.2f%%)\n", unknown_time, tmp);
+}
+
+static void ender(int s)
+{
+    endit = 1;
+}
+
+static void usage(void)
+{
+    puts("usage: dslm [-w <time>] <disk>");
+    exit(0);
+}
+
+int main(int argc, char **argv)
+{
+    int fd;
+    char *disk = 0;
+    int settle_time = 60;
+
+    /* Parse the simple command-line */
+    if (argc == 2)
+	disk = argv[1];
+    else if (argc == 4) {
+	settle_time = atoi(argv[2]);
+	disk = argv[3];
+    } else
+	usage();
+
+    if (!(fd = open(disk, O_RDONLY|O_NONBLOCK))) {
+	printf("Can't open %s, because: %s\n", disk, strerror(errno));
+	exit(-1);
+    }
+
+    if (settle_time) {
+	printf("Waiting %d seconds for the system to settle down to "
+	       "'normal'\n", settle_time);
+	sleep(settle_time);
+    } else
+	puts("Not waiting for system to settle down");
+
+    signal(SIGINT, ender);
+
+    measure(fd);
+
+    close(fd);
+
+    return 0;
+}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] tools: move pcmcia crc32hash tool from Documentation
  2016-09-22  0:51 [PATCH v2 0/3] Move runnable tools from Documentation to tools Shuah Khan
  2016-09-22  0:51 ` [PATCH v2 1/3] tools: move accounting tool from Documentation Shuah Khan
  2016-09-22  0:51 ` [PATCH v2 2/3] tools: move laptops dslm " Shuah Khan
@ 2016-09-22  0:51 ` Shuah Khan
  2016-09-22  5:14   ` Greg KH
  2016-09-22  7:31   ` Dominik Brodowski
  2016-09-22 14:57 ` [PATCH v2 0/3] Move runnable tools from Documentation to tools Jonathan Corbet
  3 siblings, 2 replies; 8+ messages in thread
From: Shuah Khan @ 2016-09-22  0:51 UTC (permalink / raw)
  To: corbet, davem, nicolas.dichtel, elfring, geert, akpm, gregkh,
	kvalo, mchehab, linux
  Cc: Shuah Khan, linux-doc, linux-kernel, linux-pcmcia

Move pcmcia crc32hash tool from Documentation to tools/pcmcia and
remove it from Documentation Makefile. Update location information
for this tool. Create a new Makefile to build pcmcia. It can be built
from top level directory or from pcmcia directory:

Run make -C tools/pcmcia or cd tools/pcmcia; make

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 Documentation/Makefile               |  3 +--
 Documentation/pcmcia/.gitignore      |  1 -
 Documentation/pcmcia/Makefile        |  7 -------
 Documentation/pcmcia/crc32hash.c     | 32 --------------------------------
 Documentation/pcmcia/devicetable.txt |  4 ++--
 MAINTAINERS                          |  1 +
 tools/pcmcia/.gitignore              |  1 +
 tools/pcmcia/Makefile                |  9 +++++++++
 tools/pcmcia/crc32hash.c             | 32 ++++++++++++++++++++++++++++++++
 9 files changed, 46 insertions(+), 44 deletions(-)
 delete mode 100644 Documentation/pcmcia/.gitignore
 delete mode 100644 Documentation/pcmcia/Makefile
 delete mode 100644 Documentation/pcmcia/crc32hash.c
 create mode 100644 tools/pcmcia/.gitignore
 create mode 100644 tools/pcmcia/Makefile
 create mode 100644 tools/pcmcia/crc32hash.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0ddb50c..8435965 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1 @@
-subdir-y := blackfin \
-	pcmcia
+subdir-y := blackfin
diff --git a/Documentation/pcmcia/.gitignore b/Documentation/pcmcia/.gitignore
deleted file mode 100644
index 53d0813..0000000
--- a/Documentation/pcmcia/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-crc32hash
diff --git a/Documentation/pcmcia/Makefile b/Documentation/pcmcia/Makefile
deleted file mode 100644
index 47a8fa1..0000000
--- a/Documentation/pcmcia/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# List of programs to build
-hostprogs-y := crc32hash
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
-
-HOSTCFLAGS_crc32hash.o += -I$(objtree)/usr/include
diff --git a/Documentation/pcmcia/crc32hash.c b/Documentation/pcmcia/crc32hash.c
deleted file mode 100644
index 44f8bee..0000000
--- a/Documentation/pcmcia/crc32hash.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */
-/* Usage example:
-$ ./crc32hash "Dual Speed"
-*/
-
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-static unsigned int crc32(unsigned char const *p, unsigned int len)
-{
-	int i;
-	unsigned int crc = 0;
-	while (len--) {
-		crc ^= *p++;
-		for (i = 0; i < 8; i++)
-			crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
-	}
-	return crc;
-}
-
-int main(int argc, char **argv) {
-	unsigned int result;
-	if (argc != 2) {
-		printf("no string passed as argument\n");
-		return -1;
-	}
-	result = crc32((unsigned char const *)argv[1], strlen(argv[1]));
-	printf("0x%x\n", result);
-	return 0;
-}
diff --git a/Documentation/pcmcia/devicetable.txt b/Documentation/pcmcia/devicetable.txt
index 199afd1..5f3e00a 100644
--- a/Documentation/pcmcia/devicetable.txt
+++ b/Documentation/pcmcia/devicetable.txt
@@ -27,7 +27,7 @@ pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000
 The hex value after "pa" is the hash of product ID string 1, after "pb" for
 string 2 and so on.
 
-Alternatively, you can use crc32hash (see Documentation/pcmcia/crc32hash.c)
+Alternatively, you can use crc32hash (see tools/pcmcia/crc32hash.c)
 to determine the crc32 hash.  Simply pass the string you want to evaluate
 as argument to this program, e.g.:
-$ ./crc32hash "Dual Speed"
+$ tools/pcmcia/crc32hash "Dual Speed"
diff --git a/MAINTAINERS b/MAINTAINERS
index afd3577..54b70ce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9125,6 +9125,7 @@ W:	http://lists.infradead.org/mailman/listinfo/linux-pcmcia
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia.git
 S:	Maintained
 F:	Documentation/pcmcia/
+F:	tools/pcmcia/
 F:	drivers/pcmcia/
 F:	include/pcmcia/
 
diff --git a/tools/pcmcia/.gitignore b/tools/pcmcia/.gitignore
new file mode 100644
index 0000000..53d0813
--- /dev/null
+++ b/tools/pcmcia/.gitignore
@@ -0,0 +1 @@
+crc32hash
diff --git a/tools/pcmcia/Makefile b/tools/pcmcia/Makefile
new file mode 100644
index 0000000..81a7498
--- /dev/null
+++ b/tools/pcmcia/Makefile
@@ -0,0 +1,9 @@
+CC := $(CROSS_COMPILE)gcc
+CFLAGS := -I../../usr/include
+
+PROGS := crc32hash
+
+all: $(PROGS)
+
+clean:
+	rm -fr $(PROGS)
diff --git a/tools/pcmcia/crc32hash.c b/tools/pcmcia/crc32hash.c
new file mode 100644
index 0000000..44f8bee
--- /dev/null
+++ b/tools/pcmcia/crc32hash.c
@@ -0,0 +1,32 @@
+/* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */
+/* Usage example:
+$ ./crc32hash "Dual Speed"
+*/
+
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+static unsigned int crc32(unsigned char const *p, unsigned int len)
+{
+	int i;
+	unsigned int crc = 0;
+	while (len--) {
+		crc ^= *p++;
+		for (i = 0; i < 8; i++)
+			crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
+	}
+	return crc;
+}
+
+int main(int argc, char **argv) {
+	unsigned int result;
+	if (argc != 2) {
+		printf("no string passed as argument\n");
+		return -1;
+	}
+	result = crc32((unsigned char const *)argv[1], strlen(argv[1]));
+	printf("0x%x\n", result);
+	return 0;
+}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] tools: move pcmcia crc32hash tool from Documentation
  2016-09-22  0:51 ` [PATCH v2 3/3] tools: move pcmcia crc32hash " Shuah Khan
@ 2016-09-22  5:14   ` Greg KH
  2016-09-22  7:31   ` Dominik Brodowski
  1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2016-09-22  5:14 UTC (permalink / raw)
  To: Shuah Khan
  Cc: corbet, davem, nicolas.dichtel, elfring, geert, akpm, kvalo,
	mchehab, linux, linux-doc, linux-kernel, linux-pcmcia

On Wed, Sep 21, 2016 at 06:51:13PM -0600, Shuah Khan wrote:
> Move pcmcia crc32hash tool from Documentation to tools/pcmcia and
> remove it from Documentation Makefile. Update location information
> for this tool. Create a new Makefile to build pcmcia. It can be built
> from top level directory or from pcmcia directory:
> 
> Run make -C tools/pcmcia or cd tools/pcmcia; make
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  Documentation/Makefile               |  3 +--
>  Documentation/pcmcia/.gitignore      |  1 -
>  Documentation/pcmcia/Makefile        |  7 -------
>  Documentation/pcmcia/crc32hash.c     | 32 --------------------------------
>  Documentation/pcmcia/devicetable.txt |  4 ++--
>  MAINTAINERS                          |  1 +
>  tools/pcmcia/.gitignore              |  1 +
>  tools/pcmcia/Makefile                |  9 +++++++++
>  tools/pcmcia/crc32hash.c             | 32 ++++++++++++++++++++++++++++++++
>  9 files changed, 46 insertions(+), 44 deletions(-)
>  delete mode 100644 Documentation/pcmcia/.gitignore
>  delete mode 100644 Documentation/pcmcia/Makefile
>  delete mode 100644 Documentation/pcmcia/crc32hash.c
>  create mode 100644 tools/pcmcia/.gitignore
>  create mode 100644 tools/pcmcia/Makefile
>  create mode 100644 tools/pcmcia/crc32hash.c


Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] tools: move pcmcia crc32hash tool from Documentation
  2016-09-22  0:51 ` [PATCH v2 3/3] tools: move pcmcia crc32hash " Shuah Khan
  2016-09-22  5:14   ` Greg KH
@ 2016-09-22  7:31   ` Dominik Brodowski
  1 sibling, 0 replies; 8+ messages in thread
From: Dominik Brodowski @ 2016-09-22  7:31 UTC (permalink / raw)
  To: Shuah Khan
  Cc: corbet, davem, nicolas.dichtel, elfring, geert, akpm, gregkh,
	kvalo, mchehab, linux, linux-kernel, linux-pcmcia, linux-doc

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

On Wed, Sep 21, 2016 at 06:51:13PM -0600, Shuah Khan wrote:
> Move pcmcia crc32hash tool from Documentation to tools/pcmcia and
> remove it from Documentation Makefile. Update location information
> for this tool. Create a new Makefile to build pcmcia. It can be built
> from top level directory or from pcmcia directory:
> 
> Run make -C tools/pcmcia or cd tools/pcmcia; make
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>

Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] Move runnable tools from Documentation to tools
  2016-09-22  0:51 [PATCH v2 0/3] Move runnable tools from Documentation to tools Shuah Khan
                   ` (2 preceding siblings ...)
  2016-09-22  0:51 ` [PATCH v2 3/3] tools: move pcmcia crc32hash " Shuah Khan
@ 2016-09-22 14:57 ` Jonathan Corbet
  2016-09-23 13:59   ` Shuah Khan
  3 siblings, 1 reply; 8+ messages in thread
From: Jonathan Corbet @ 2016-09-22 14:57 UTC (permalink / raw)
  To: Shuah Khan
  Cc: davem, nicolas.dichtel, elfring, geert, akpm, gregkh, kvalo,
	mchehab, linux, linux-doc, linux-kernel, linux-pcmcia

On Wed, 21 Sep 2016 18:51:10 -0600
Shuah Khan <shuahkh@osg.samsung.com> wrote:

> Move runnable tools from Documentation to tools. I moved just the
> tools code, and left documentation files as is.
> 
> Based on the v1 series feedback, This v2 series moves accounting,
> laptops/dslm, and pcmcia to tools.
> 
> If v2 patches look good, and if I get an okay, I will try to get
> these into 4.9-rc1

Acked-by: Jonathan Corbet <corbet@lwn.net>

Though I still wonder if we really need to keep some of those tools...

jon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] Move runnable tools from Documentation to tools
  2016-09-22 14:57 ` [PATCH v2 0/3] Move runnable tools from Documentation to tools Jonathan Corbet
@ 2016-09-23 13:59   ` Shuah Khan
  0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2016-09-23 13:59 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: davem, nicolas.dichtel, elfring, geert, akpm, gregkh, kvalo,
	mchehab, linux, linux-doc, linux-kernel, linux-pcmcia,
	Shuah Khan

On 09/22/2016 08:57 AM, Jonathan Corbet wrote:
> On Wed, 21 Sep 2016 18:51:10 -0600
> Shuah Khan <shuahkh@osg.samsung.com> wrote:
> 
>> Move runnable tools from Documentation to tools. I moved just the
>> tools code, and left documentation files as is.
>>
>> Based on the v1 series feedback, This v2 series moves accounting,
>> laptops/dslm, and pcmcia to tools.
>>
>> If v2 patches look good, and if I get an okay, I will try to get
>> these into 4.9-rc1
> 
> Acked-by: Jonathan Corbet <corbet@lwn.net>
> 
> Though I still wonder if we really need to keep some of those tools...
> 
> jon
> 

I am a bit skeptical about laptop/dslm and pcmcia whether or not
we still need them. I am afraid as soon we delete somebody will
miss it.

How about we go ahead and move it under tools and make a call in
a couple of releases? I have to make a note of that and delete
them.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-23 13:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22  0:51 [PATCH v2 0/3] Move runnable tools from Documentation to tools Shuah Khan
2016-09-22  0:51 ` [PATCH v2 1/3] tools: move accounting tool from Documentation Shuah Khan
2016-09-22  0:51 ` [PATCH v2 2/3] tools: move laptops dslm " Shuah Khan
2016-09-22  0:51 ` [PATCH v2 3/3] tools: move pcmcia crc32hash " Shuah Khan
2016-09-22  5:14   ` Greg KH
2016-09-22  7:31   ` Dominik Brodowski
2016-09-22 14:57 ` [PATCH v2 0/3] Move runnable tools from Documentation to tools Jonathan Corbet
2016-09-23 13:59   ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.