Skip to contentSkip to conversation

Move runnable tools from Documentation to tools

PATCH In review Shuah Khan 4 participants 8 messages Sep 22, 2016 – Sep 23, 2016

Subsystems (3)
lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

v2 cover Move runnable tools from Documentation to tools

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
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/3 tools: move accounting tool from Documentation

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

---
 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
Documentation/Makefile +1 -1
index 0b8cd50..e4dd5e4 100644
@@ -1,2 +1,2 @@
-subdir-y := accounting blackfin \
+subdir-y := blackfin \
 	laptops pcmcia
Documentation/accounting/.gitignore deleted +0 -1
deleted file mode 100644
index 8648520..0000000
@@ -1 +0,0 @@
-getdelays
Documentation/accounting/Makefile deleted +0 -7
deleted file mode 100644
index 7e232cb..0000000
@@ -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
Documentation/accounting/delay-accounting.txt +3 -3
index 8a12f07..042ea59 100644
@@ -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
 -----
Documentation/accounting/getdelays.c deleted +0 -550

550 lines not on this page · raw message

tools/accounting/.gitignore new file +1 -0
new file mode 100644
index 0000000..8648520
@@ -0,0 +1 @@
+getdelays
tools/accounting/Makefile new file +9 -0
new file mode 100644
index 0000000..647c94a
@@ -0,0 +1,9 @@
+CC := $(CROSS_COMPILE)gcc
+CFLAGS := -I../../usr/include
+
+PROGS := getdelays
+
+all: $(PROGS)
+
+clean:
+	rm -fr $(PROGS)
tools/accounting/getdelays.c new file +550 -0

550 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/3 tools: move laptops dslm tool from Documentation

In reply to Shuah Khan

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

---
 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
Documentation/Makefile +1 -1
index e4dd5e4..0ddb50c 100644
@@ -1,2 +1,2 @@
 subdir-y := blackfin \
-	laptops pcmcia
+	pcmcia
Documentation/laptops/.gitignore deleted +0 -1
deleted file mode 100644
index 9fc984e..0000000
@@ -1 +0,0 @@
-dslm
Documentation/laptops/00-INDEX +0 -4
index 7c0ac2a..86169dc 100644
@@ -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
Documentation/laptops/Makefile deleted +0 -5
deleted file mode 100644
index 0abe44f..0000000
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-y := dslm
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
Documentation/laptops/dslm.c deleted +0 -166

166 lines not on this page · raw message

Documentation/laptops/laptop-mode.txt +1 -1
index 4ebbfc3..19276f5 100644
@@ -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
tools/laptop/dslm/.gitignore new file +1 -0
new file mode 100644
index 0000000..9fc984e
@@ -0,0 +1 @@
+dslm
tools/laptop/dslm/Makefile new file +9 -0
new file mode 100644
index 0000000..ff613b3
@@ -0,0 +1,9 @@
+CC := $(CROSS_COMPILE)gcc
+CFLAGS := -I../../usr/include
+
+PROGS := dslm
+
+all: $(PROGS)
+
+clean:
+	rm -fr $(PROGS)
tools/laptop/dslm/dslm.c new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/3 tools: move pcmcia crc32hash tool from Documentation

In reply to Shuah Khan

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

---
 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
Documentation/Makefile +1 -2
index 0ddb50c..8435965 100644
@@ -1,2 +1 @@
-subdir-y := blackfin \
-	pcmcia
+subdir-y := blackfin
Documentation/pcmcia/.gitignore deleted +0 -1
deleted file mode 100644
index 53d0813..0000000
@@ -1 +0,0 @@
-crc32hash
Documentation/pcmcia/Makefile deleted +0 -7
deleted file mode 100644
index 47a8fa1..0000000
@@ -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
Documentation/pcmcia/crc32hash.c deleted +0 -32
deleted file mode 100644
index 44f8bee..0000000
@@ -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;
-}
Documentation/pcmcia/devicetable.txt +2 -2
index 199afd1..5f3e00a 100644
@@ -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"
MAINTAINERS +1 -0
index afd3577..54b70ce 100644
@@ -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/
 
tools/pcmcia/.gitignore new file +1 -0
new file mode 100644
index 0000000..53d0813
@@ -0,0 +1 @@
+crc32hash
tools/pcmcia/Makefile new file +9 -0
new file mode 100644
index 0000000..81a7498
@@ -0,0 +1,9 @@
+CC := $(CROSS_COMPILE)gcc
+CFLAGS := -I../../usr/include
+
+PROGS := crc32hash
+
+all: $(PROGS)
+
+clean:
+	rm -fr $(PROGS)
tools/pcmcia/crc32hash.c new file +32 -0
new file mode 100644
index 0000000..44f8bee
@@ -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;
+}
Signature · 1 line
2.7.4
Acked-by on v2 3/3
#4 lore raw

Re: [PATCH v2 3/3] tools: move pcmcia crc32hash tool from Documentation

Quoted 17 lines · Shuah Khan

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

---
 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 +++++++++
Quoted 8 lines
 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
maintainer Acked-by on v2 3/3
#5 lore raw

Re: [PATCH v2 3/3] tools: move pcmcia crc32hash tool from Documentation

In reply to Shuah Khan
Quoted 8 lines · Shuah Khan

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

maintainer Acked-by on the v2 series
#6 lore raw
In reply to Shuah Khan
Quoted 8 lines · On Wed, 21 Sep 2016 18:51:10 -0600 Shuah Khan <[email protected]> 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

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

jon

author
#7 lore raw
Quoted 9 lines · Jonathan Corbet
Quoted 6 lines · On Wed, 21 Sep 2016 18:51:10 -0600 Shuah Khan <[email protected]> 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.

Quoted 9 lines
Quoted 2 lines

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

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