Re: [PATCH v3 7/8] debugfs: allow access to signed values

2007-12-19 Thread Johannes Berg

> +static u64 debugfs_s8_get(void *data)


>  struct simple_attr {
> - u64 (*get)(void *);
> + unsigned long long (*get)(void *);

That seems wrong. Wouldn't you have to declare all the _get functions
with unsigned long long too now to avoid trouble on systems where u64 !=
unsigned long long?

johannes


signature.asc
Description: This is a digitally signed message part


Re: [PATCH v3 7/8] debugfs: allow access to signed values

2007-12-19 Thread John W. Linville
On Wed, Dec 19, 2007 at 10:20:16AM +0100, Stefano Brivio wrote:
> On Tue, 18 Dec 2007 22:45:10 -0800
> Greg KH <[EMAIL PROTECTED]> wrote:
> 
> > On Wed, Dec 19, 2007 at 01:27:39AM +0100, Stefano Brivio wrote:

> > > here comes an implementation of debugfs_create_s{8,16,32,64} which avoids 
> > > code
> > > duplication, suggested by Johannes Berg. We would need this to be merged 
> > > to
> > > 2.6.25, as we need those functions to be available for rc80211-pid, the 
> > > new
> > > mac80211 rate control algorithm.
> > 
> > Looks good to me, do you want me to add this to my tree and send it to
> > Linus when 2.6.25 opens up, or do you want this to go through the
> > wireless tree as you have patches relying on it?
> 
> I have one patch (rate control rework, 8/8) relying on it. Let's ask John. 
> John,
> what's the best for you?

Since Greg approves, I'll take it through wireless-2.6 to avoid any
staging problems for patch 8/8.

Thanks,

John
-- 
John W. Linville
[EMAIL PROTECTED]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 7/8] debugfs: allow access to signed values

2007-12-19 Thread Stefano Brivio
On Tue, 18 Dec 2007 22:45:10 -0800
Greg KH <[EMAIL PROTECTED]> wrote:

> On Wed, Dec 19, 2007 at 01:27:39AM +0100, Stefano Brivio wrote:
> > Add debugfs_create_s{8,16,32,64}. For these to work properly, we need to 
> > remove
> > a cast in libfs.
> > 
> > Cc: Johannes Berg <[EMAIL PROTECTED]>
> > To: Greg Kroah-Hartman <[EMAIL PROTECTED]>
> > Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>
> > ---
> > Greg,
> > 
> > here comes an implementation of debugfs_create_s{8,16,32,64} which avoids 
> > code
> > duplication, suggested by Johannes Berg. We would need this to be merged to
> > 2.6.25, as we need those functions to be available for rc80211-pid, the new
> > mac80211 rate control algorithm.
> 
> Looks good to me, do you want me to add this to my tree and send it to
> Linus when 2.6.25 opens up, or do you want this to go through the
> wireless tree as you have patches relying on it?

I have one patch (rate control rework, 8/8) relying on it. Let's ask John. John,
what's the best for you?

> Whatever works the best for you is fine for me.  If the wireless tree,
> feel free to add:
>   Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
> to the patch.

Thanks. I'm going to resend the patch to John with your Signed-off-by -- in 
case.


--
Ciao
Stefano
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 7/8] debugfs: allow access to signed values

2007-12-18 Thread Greg KH
On Wed, Dec 19, 2007 at 01:27:39AM +0100, Stefano Brivio wrote:
> Add debugfs_create_s{8,16,32,64}. For these to work properly, we need to 
> remove
> a cast in libfs.
> 
> Cc: Johannes Berg <[EMAIL PROTECTED]>
> To: Greg Kroah-Hartman <[EMAIL PROTECTED]>
> Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>
> ---
> Greg,
> 
> here comes an implementation of debugfs_create_s{8,16,32,64} which avoids code
> duplication, suggested by Johannes Berg. We would need this to be merged to
> 2.6.25, as we need those functions to be available for rc80211-pid, the new
> mac80211 rate control algorithm.

Looks good to me, do you want me to add this to my tree and send it to
Linus when 2.6.25 opens up, or do you want this to go through the
wireless tree as you have patches relying on it?

Whatever works the best for you is fine for me.  If the wireless tree,
feel free to add:
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
to the patch.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 7/8] debugfs: allow access to signed values

2007-12-18 Thread Stefano Brivio
Add debugfs_create_s{8,16,32,64}. For these to work properly, we need to remove
a cast in libfs.

Cc: Johannes Berg <[EMAIL PROTECTED]>
To: Greg Kroah-Hartman <[EMAIL PROTECTED]>
Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>
---
Greg,

here comes an implementation of debugfs_create_s{8,16,32,64} which avoids code
duplication, suggested by Johannes Berg. We would need this to be merged to
2.6.25, as we need those functions to be available for rc80211-pid, the new
mac80211 rate control algorithm.

---
 fs/debugfs/file.c   |  166 
 fs/libfs.c  |4 -
 include/linux/debugfs.h |   30 
 3 files changed, 197 insertions(+), 3 deletions(-)

Index: wireless-2.6/fs/debugfs/file.c
===
--- wireless-2.6.orig/fs/debugfs/file.c
+++ wireless-2.6/fs/debugfs/file.c
@@ -221,6 +221,172 @@ struct dentry *debugfs_create_u64(const
 }
 EXPORT_SYMBOL_GPL(debugfs_create_u64);

+
+static void debugfs_s8_set(void *data, u64 val)
+{
+   *(s8 *)data = val;
+}
+static u64 debugfs_s8_get(void *data)
+{
+   return *(s8 *)data;
+}
+DEFINE_SIMPLE_ATTRIBUTE(fops_s8, debugfs_s8_get, debugfs_s8_set, "%lld\n");
+
+/**
+ * debugfs_create_s8 - create a debugfs file that is used to read and write a 
signed 8-bit value
+ * @name: a pointer to a string containing the name of the file to create.
+ * @mode: the permission that the file should have
+ * @parent: a pointer to the parent dentry for this file.  This should be a
+ *  directory dentry if set.  If this parameter is %NULL, then the
+ *  file will be created in the root of the debugfs filesystem.
+ * @value: a pointer to the variable that the file should read to and write
+ * from.
+ *
+ * This function creates a file in debugfs with the given name that
+ * contains the value of the variable @value.  If the @mode variable is so
+ * set, it can be read from, and written to.
+ *
+ * This function will return a pointer to a dentry if it succeeds.  This
+ * pointer must be passed to the debugfs_remove() function when the file is
+ * to be removed (no automatic cleanup happens if your module is unloaded,
+ * you are responsible here.)  If an error occurs, %NULL will be returned.
+ *
+ * If debugfs is not enabled in the kernel, the value -%ENODEV will be
+ * returned.  It is not wise to check for this value, but rather, check for
+ * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
+ * code.
+ */
+struct dentry *debugfs_create_s8(const char *name, mode_t mode,
+struct dentry *parent, s8 *value)
+{
+   return debugfs_create_file(name, mode, parent, value, &fops_s8);
+}
+EXPORT_SYMBOL_GPL(debugfs_create_s8);
+
+static void debugfs_s16_set(void *data, u64 val)
+{
+   *(s16 *)data = val;
+}
+static u64 debugfs_s16_get(void *data)
+{
+   return *(s16 *)data;
+}
+DEFINE_SIMPLE_ATTRIBUTE(fops_s16, debugfs_s16_get, debugfs_s16_set, "%lld\n");
+
+/**
+ * debugfs_create_s16 - create a debugfs file that is used to read and write a 
signed 16-bit value
+ * @name: a pointer to a string containing the name of the file to create.
+ * @mode: the permission that the file should have
+ * @parent: a pointer to the parent dentry for this file.  This should be a
+ *  directory dentry if set.  If this parameter is %NULL, then the
+ *  file will be created in the root of the debugfs filesystem.
+ * @value: a pointer to the variable that the file should read to and write
+ * from.
+ *
+ * This function creates a file in debugfs with the given name that
+ * contains the value of the variable @value.  If the @mode variable is so
+ * set, it can be read from, and written to.
+ *
+ * This function will return a pointer to a dentry if it succeeds.  This
+ * pointer must be passed to the debugfs_remove() function when the file is
+ * to be removed (no automatic cleanup happens if your module is unloaded,
+ * you are responsible here.)  If an error occurs, %NULL will be returned.
+ *
+ * If debugfs is not enabled in the kernel, the value -%ENODEV will be
+ * returned.  It is not wise to check for this value, but rather, check for
+ * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
+ * code.
+ */
+struct dentry *debugfs_create_s16(const char *name, mode_t mode,
+ struct dentry *parent, s16 *value)
+{
+   return debugfs_create_file(name, mode, parent, value, &fops_s16);
+}
+EXPORT_SYMBOL_GPL(debugfs_create_s16);
+
+static void debugfs_s32_set(void *data, u64 val)
+{
+   *(s32 *)data = val;
+}
+static u64 debugfs_s32_get(void *data)
+{
+   return *(s32 *)data;
+}
+DEFINE_SIMPLE_ATTRIBUTE(fops_s32, debugfs_s32_get, debugfs_s32_set, "%lld\n");
+
+/**
+ * debugfs_create_s32 - create a debugfs file that is used to read and write a 
signed 32-bit value
+ * @name: a pointer to a string containing the name of