The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 7/7] [Suspend2] Suspend2 proc.h
Date: Tue, 27 Jun 2006 02:47:54 +1000	[thread overview]
Message-ID: <20060626164752.10724.22617.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060626164729.10724.37131.stgit@nigel.suspend2.net>

Header file for Suspend2 proc entries - define the data structure used to
define our proc entries, flags and the register/unregister routines.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 kernel/power/proc.h |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/kernel/power/proc.h b/kernel/power/proc.h
new file mode 100644
index 0000000..688f8d2
--- /dev/null
+++ b/kernel/power/proc.h
@@ -0,0 +1,76 @@
+/*
+ * kernel/power/proc.h
+ *
+ * Copyright (C) 2004-2006 Nigel Cunningham <nigel@suspend2.net>
+ *
+ * This file is released under the GPLv2.
+ *
+ * It provides declarations for suspend to use in managing
+ * /proc/suspend2. When we switch to kobjects,
+ * this will become redundant.
+ *
+ */
+
+#include <linux/proc_fs.h>
+
+struct suspend_proc_data {
+	char *filename;
+	int permissions;
+	int type;
+	int needs_storage_manager;
+	union {
+		struct {
+			unsigned long *bit_vector;
+			int bit;
+		} bit;
+		struct {
+			int *variable;
+			int minimum;
+			int maximum;
+		} integer;
+		struct {
+			long *variable;
+			long minimum;
+			long maximum;
+		} a_long;
+		struct {
+			unsigned long *variable;
+			unsigned long minimum;
+			unsigned long maximum;
+		} ul;
+		struct {
+			char *variable;
+			int max_length;
+		} string;
+		struct {
+			read_proc_t *read_proc;
+			write_proc_t *write_proc;
+			void *data;
+		} special;
+	} data;
+	
+	/* Side effects routines. Used, eg, for reparsing the
+	 * resume2 entry when it changes */
+	void (*read_proc) (void);
+	void (*write_proc) (void); 
+	struct list_head proc_data_list;
+};
+
+enum {
+	SUSPEND_PROC_DATA_NONE,
+	SUSPEND_PROC_DATA_CUSTOM,
+	SUSPEND_PROC_DATA_BIT,
+	SUSPEND_PROC_DATA_INTEGER,
+	SUSPEND_PROC_DATA_UL,
+	SUSPEND_PROC_DATA_LONG,
+	SUSPEND_PROC_DATA_STRING
+};
+
+#define PROC_WRITEONLY 0200
+#define PROC_READONLY 0400
+#define PROC_RW 0600
+
+struct proc_dir_entry *suspend_register_procfile(
+		struct suspend_proc_data *suspend_proc_data);
+void suspend_unregister_procfile(struct suspend_proc_data *suspend_proc_data);
+

--
Nigel Cunningham		nigel at suspend2 dot net

  parent reply	other threads:[~2006-06-26 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 16:47 [Suspend2][ 0/7] Proc file support Nigel Cunningham
2006-06-26 16:47 ` [Suspend2][ 1/7] [Suspend2] Proc.c header Nigel Cunningham
2006-06-26 16:47 ` [Suspend2][ 2/7] [Suspend2] Read a proc file entry Nigel Cunningham
2006-06-26 16:47 ` [Suspend2][ 3/7] [Suspend2] Proc write routine Nigel Cunningham
2006-06-26 16:47 ` [Suspend2][ 4/7] [Suspend2] Basic (do_suspend/do_resume) entries Nigel Cunningham
2006-06-26 16:47 ` [Suspend2][ 5/7] [Suspend2] Initialise the proc directories & basic entries Nigel Cunningham
2006-06-26 16:47 ` [Suspend2][ 6/7] [Suspend2] Register and remove proc file functions Nigel Cunningham
2006-06-26 16:47 ` Nigel Cunningham [this message]
2006-06-26 20:07 ` [Suspend2][ 0/7] Proc file support Rafael J. Wysocki
2006-06-26 22:50   ` Nigel Cunningham
2006-06-27 21:00     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060626164752.10724.22617.stgit@nigel.suspend2.net \
    --to=nigel@suspend2.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox