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

2007-12-29 Thread Stefano Brivio
On Fri, 28 Dec 2007 19:58:32 +0100
Christoph Hellwig <[EMAIL PROTECTED]> wrote:

> On Thu, Dec 20, 2007 at 01:47:13PM +0100, Arnd Bergmann wrote:
> > Also, Christoph has recently posted a suggestion for how to improve
> > the interface to allow the 'get' operation to return an error:
> > http://patchwork.ozlabs.org/cbe-oss-dev/patch?id=14962
> > 
> > I'd suggest consolidating the two changes in order to avoid merge
> > conflicts.
> 
> Stefano, I couldn't find your complete patch series.  Where are the
> other 7 patches for that series?   Anyway, I'll post my series with
> the simple attribute chanegs ASAP and I'll Cc you.  If you send me the
> latest version of your patches I'll port it ontop of my patches.

Sorry for the late reply. As Johannes said, the other patches have nothing
to do with this anyway. I had to put this patch within my patchset because I
originally wanted to send a patch which would export signed values to
debugfs, but then I solved the issue in a different fashion, and I'm not
that interested in it at the moment.

BTW, the patch I sent was just meant to allow exporting signed values
through debugfs, but in order to do that I had to change some users as well.
And being spufs an user, I don't feel that much like sending a patch
without testing on ppc64 in advance.


-- 
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 v4 7/8] debugfs: allow access to signed values

2007-12-28 Thread Johannes Berg

On Fri, 2007-12-28 at 19:58 +0100, Christoph Hellwig wrote:
> On Thu, Dec 20, 2007 at 01:47:13PM +0100, Arnd Bergmann wrote:
> > Also, Christoph has recently posted a suggestion for how to improve
> > the interface to allow the 'get' operation to return an error:
> > http://patchwork.ozlabs.org/cbe-oss-dev/patch?id=14962
> > 
> > I'd suggest consolidating the two changes in order to avoid merge
> > conflicts.
> 
> Stefano, I couldn't find your complete patch series.  Where are the
> other 7 patches for that series?   Anyway, I'll post my series with
> the simple attribute chanegs ASAP and I'll Cc you.  If you send me the
> latest version of your patches I'll port it ontop of my patches.

There was only one, the seven other patches are plain wireless patches.

johannes


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


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

2007-12-28 Thread Christoph Hellwig
On Thu, Dec 20, 2007 at 01:47:13PM +0100, Arnd Bergmann wrote:
> Also, Christoph has recently posted a suggestion for how to improve
> the interface to allow the 'get' operation to return an error:
> http://patchwork.ozlabs.org/cbe-oss-dev/patch?id=14962
> 
> I'd suggest consolidating the two changes in order to avoid merge
> conflicts.

Stefano, I couldn't find your complete patch series.  Where are the
other 7 patches for that series?   Anyway, I'll post my series with
the simple attribute chanegs ASAP and I'll Cc you.  If you send me the
latest version of your patches I'll port it ontop of my patches.
--
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 v4 7/8] debugfs: allow access to signed values

2007-12-20 Thread Arnd Bergmann
On Thursday 20 December 2007, Stefano Brivio wrote:
> debugfs: allow access to signed values
> 
> Add debugfs_create_s{8,16,32,64}. For these to work properly, we need to 
> remove
> a cast in libfs, change the simple_attr_open prototype and thus fix the users 
> as
> well.
> 
> Cc: Johannes Berg <[EMAIL PROTECTED]>
> Cc: Mattias Nissler <[EMAIL PROTECTED]>
> To: Greg Kroah-Hartman <[EMAIL PROTECTED]>
> To: Arnd Bergmann <[EMAIL PROTECTED]>
> To: Akinobu Mita <[EMAIL PROTECTED]>
> Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>

Have you checked that spufs still builds? I would guess that you need
to do the same interface changes there.

Also, Christoph has recently posted a suggestion for how to improve
the interface to allow the 'get' operation to return an error:
http://patchwork.ozlabs.org/cbe-oss-dev/patch?id=14962

I'd suggest consolidating the two changes in order to avoid merge
conflicts.

Arnd <><
--
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 v4 7/8] debugfs: allow access to signed values

2007-12-20 Thread Stefano Brivio
debugfs: allow access to signed values

Add debugfs_create_s{8,16,32,64}. For these to work properly, we need to remove
a cast in libfs, change the simple_attr_open prototype and thus fix the users as
well.

Cc: Johannes Berg <[EMAIL PROTECTED]>
Cc: Mattias Nissler <[EMAIL PROTECTED]>
To: Greg Kroah-Hartman <[EMAIL PROTECTED]>
To: Arnd Bergmann <[EMAIL PROTECTED]>
To: Akinobu Mita <[EMAIL PROTECTED]>
Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>
---

This version addresses last Johannes' concerns.

---
 arch/powerpc/platforms/cell/spufs/file.c |   48 
 fs/debugfs/file.c|  186 +--
 fs/libfs.c   |   23 ++-
 include/linux/debugfs.h  |   38 ++
 include/linux/fs.h   |   25 ++--
 lib/fault-inject.c   |   11 +
 6 files changed, 268 insertions(+), 63 deletions(-)

Index: wireless-2.6/fs/debugfs/file.c
===
--- wireless-2.6.orig/fs/debugfs/file.c
+++ wireless-2.6/fs/debugfs/file.c
@@ -56,11 +56,11 @@ const struct inode_operations debugfs_li
.follow_link= debugfs_follow_link,
 };
 
-static void debugfs_u8_set(void *data, u64 val)
+static void debugfs_u8_set(void *data, unsigned long long val)
 {
*(u8 *)data = val;
 }
-static u64 debugfs_u8_get(void *data)
+static unsigned long long debugfs_u8_get(void *data)
 {
return *(u8 *)data;
 }
@@ -97,11 +97,11 @@ struct dentry *debugfs_create_u8(const c
 }
 EXPORT_SYMBOL_GPL(debugfs_create_u8);
 
-static void debugfs_u16_set(void *data, u64 val)
+static void debugfs_u16_set(void *data, unsigned long long val)
 {
*(u16 *)data = val;
 }
-static u64 debugfs_u16_get(void *data)
+static unsigned long long debugfs_u16_get(void *data)
 {
return *(u16 *)data;
 }
@@ -138,11 +138,11 @@ struct dentry *debugfs_create_u16(const 
 }
 EXPORT_SYMBOL_GPL(debugfs_create_u16);
 
-static void debugfs_u32_set(void *data, u64 val)
+static void debugfs_u32_set(void *data, unsigned long long val)
 {
*(u32 *)data = val;
 }
-static u64 debugfs_u32_get(void *data)
+static unsigned long long debugfs_u32_get(void *data)
 {
return *(u32 *)data;
 }
@@ -179,12 +179,12 @@ struct dentry *debugfs_create_u32(const 
 }
 EXPORT_SYMBOL_GPL(debugfs_create_u32);
 
-static void debugfs_u64_set(void *data, u64 val)
+static void debugfs_u64_set(void *data, unsigned long long val)
 {
*(u64 *)data = val;
 }
 
-static u64 debugfs_u64_get(void *data)
+static unsigned long long debugfs_u64_get(void *data)
 {
return *(u64 *)data;
 }
@@ -221,6 +221,172 @@ struct dentry *debugfs_create_u64(const 
 }
 EXPORT_SYMBOL_GPL(debugfs_create_u64);
 
+
+static void debugfs_s8_set(void *data, unsigned long long val)
+{
+   *(s8 *)data = val;
+}
+static unsigned long long 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, unsigned long long val)
+{
+   *(s16 *)data = val;
+}
+static unsigned long long 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

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

2007-12-19 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]>
Signed-off-by: Stefano Brivio <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 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 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 t