From: Andreas Gruenbacher <agruen@suse.de>
To: Andrew Morton <akpm@digeo.com>,
Linus Torvalds <torvalds@transmeta.com>,
Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Linus Torvalds <torvalds@transmeta.com>,
Dave Kleikamp <shaggy@austin.ibm.com>,
Steve Best <sbest@us.ibm.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH] Make inode_ops->setxattr value parameter const (2.4.x + 2.5.x)
Date: Wed, 20 Nov 2002 16:05:45 +0100 [thread overview]
Message-ID: <200211201605.45786.agruen@suse.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 766 bytes --]
Hello,
the setxattr inode operation is defined like this in 2.4 and 2.5:
int (*setxattr) (struct dentry *dentry, const char *name,
void *value, size_t size, int flags);
the original type of the value parameter was `const void *'; the const
obviously has been lost at some point. The definition should be:
int (*setxattr) (struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
Please apply the attached patches.
Thanks,
Andreas.
------------------------------------------------------------------
Andreas Gruenbacher SuSE Linux AG
mailto:agruen@suse.de Deutschherrnstr. 15-19
http://www.suse.de/ D-90429 Nuernberg, Germany
[-- Attachment #2: linux-2.5.48-setxattr-const-value.diff --]
[-- Type: text/x-diff, Size: 4738 bytes --]
Make inode_ops->setxattr value parameter const
Add `const' to the value parameter definition of the setxattr inode
operation and fix the resulting warnings in fs/jfs/xattr.c: File
systems are not supposed to modify the value.
Also fixes the non-const usage in jfs, ext2, and ext3.
--- linux-2.5.48.orig/fs/ext2/xattr.c 2002-11-18 05:29:48.000000000 +0100
+++ linux-2.5.48/fs/ext2/xattr.c 2002-11-18 20:15:55.000000000 +0100
@@ -230,7 +230,7 @@
*/
int
ext2_setxattr(struct dentry *dentry, const char *name,
- void *value, size_t size, int flags)
+ const void *value, size_t size, int flags)
{
struct ext2_xattr_handler *handler;
struct inode *inode = dentry->d_inode;
--- linux-2.5.48.orig/fs/ext2/xattr.h 2002-11-18 05:29:22.000000000 +0100
+++ linux-2.5.48/fs/ext2/xattr.h 2002-11-18 20:17:07.000000000 +0100
@@ -67,7 +67,7 @@
extern int ext2_xattr_register(int, struct ext2_xattr_handler *);
extern void ext2_xattr_unregister(int, struct ext2_xattr_handler *);
-extern int ext2_setxattr(struct dentry *, const char *, void *, size_t, int);
+extern int ext2_setxattr(struct dentry *, const char *, const void *, size_t, int);
extern ssize_t ext2_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t ext2_listxattr(struct dentry *, char *, size_t);
extern int ext2_removexattr(struct dentry *, const char *);
--- linux-2.5.48.orig/fs/ext3/xattr.c 2002-11-18 05:29:47.000000000 +0100
+++ linux-2.5.48/fs/ext3/xattr.c 2002-11-18 20:18:39.000000000 +0100
@@ -223,7 +223,7 @@
*/
int
ext3_setxattr(struct dentry *dentry, const char *name,
- void *value, size_t size, int flags)
+ const void *value, size_t size, int flags)
{
struct ext3_xattr_handler *handler;
struct inode *inode = dentry->d_inode;
--- linux-2.5.48.orig/fs/ext3/xattr.h 2002-11-18 05:29:56.000000000 +0100
+++ linux-2.5.48/fs/ext3/xattr.h 2002-11-18 20:18:12.000000000 +0100
@@ -66,7 +66,7 @@
extern int ext3_xattr_register(int, struct ext3_xattr_handler *);
extern void ext3_xattr_unregister(int, struct ext3_xattr_handler *);
-extern int ext3_setxattr(struct dentry *, const char *, void *, size_t, int);
+extern int ext3_setxattr(struct dentry *, const char *, const void *, size_t, int);
extern ssize_t ext3_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t ext3_listxattr(struct dentry *, char *, size_t);
extern int ext3_removexattr(struct dentry *, const char *);
--- linux-2.5.48.orig/fs/jfs/jfs_xattr.h 2002-11-18 05:29:53.000000000 +0100
+++ linux-2.5.48/fs/jfs/jfs_xattr.h 2002-11-18 23:40:06.000000000 +0100
@@ -52,9 +52,9 @@
#define END_EALIST(ealist) \
((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
-extern int __jfs_setxattr(struct inode *, const char *, void *, size_t,
- int);
-extern int jfs_setxattr(struct dentry *, const char *, void *, size_t,
+extern int __jfs_setxattr(struct inode *, const char *, const void *, size_t,
+ int);
+extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t,
int);
extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t);
--- linux-2.5.48.orig/fs/jfs/xattr.c 2002-11-18 05:29:31.000000000 +0100
+++ linux-2.5.48/fs/jfs/xattr.c 2002-11-18 20:20:16.000000000 +0100
@@ -706,7 +706,7 @@
}
static int can_set_xattr(struct inode *inode, const char *name,
- void *value, size_t value_len)
+ const void *value, size_t value_len)
{
if (IS_RDONLY(inode))
return -EROFS;
@@ -735,7 +735,7 @@
#endif
}
-int __jfs_setxattr(struct inode *inode, const char *name, void *value,
+int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
size_t value_len, int flags)
{
struct jfs_ea_list *ealist;
@@ -874,7 +874,7 @@
return rc;
}
-int jfs_setxattr(struct dentry *dentry, const char *name, void *value,
+int jfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t value_len, int flags)
{
if (value == NULL) { /* empty EA, do not remove */
--- linux-2.5.48.orig/include/linux/fs.h 2002-11-18 05:29:29.000000000 +0100
+++ linux-2.5.48/include/linux/fs.h 2002-11-18 20:13:06.000000000 +0100
@@ -782,7 +782,7 @@
int (*permission) (struct inode *, int);
int (*setattr) (struct dentry *, struct iattr *);
int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
- int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
+ int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
ssize_t (*listxattr) (struct dentry *, char *, size_t);
int (*removexattr) (struct dentry *, const char *);
[-- Attachment #3: linux-2.4.20-rc2-setxattr-const-value.diff --]
[-- Type: text/x-diff, Size: 2752 bytes --]
Make inode_ops->setxattr value parameter const
Add `const' to the value parameter definition of the setxattr inode
operation and fix the resulting warnings in fs/jfs/xattr.c: File
systems are not supposed to modify the value.
Also fixes the non-const usage in jfs.
--- linux-2.4.20-rc2.patch/include/linux/fs.h~xattr-const 2002-11-18 23:51:35.000000000 +0100
+++ linux-2.4.20-rc2.patch-agruen/include/linux/fs.h 2002-11-18 23:51:35.000000000 +0100
@@ -866,7 +866,7 @@
int (*revalidate) (struct dentry *);
int (*setattr) (struct dentry *, struct iattr *);
int (*getattr) (struct dentry *, struct iattr *);
- int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
+ int (*setxattr) (struct dentry *, const char *, const void *, size_t, int);
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
ssize_t (*listxattr) (struct dentry *, char *, size_t);
int (*removexattr) (struct dentry *, const char *);
--- linux-2.4.20-rc2.patch/fs/jfs/xattr.c~xattr-const 2002-11-18 23:51:35.000000000 +0100
+++ linux-2.4.20-rc2.patch-agruen/fs/jfs/xattr.c 2002-11-18 23:51:35.000000000 +0100
@@ -641,7 +641,7 @@
}
static int can_set_xattr(struct inode *inode, const char *name,
- void *value, size_t value_len)
+ const void *value, size_t value_len)
{
if (IS_RDONLY(inode))
return -EROFS;
@@ -660,7 +660,7 @@
return permission(inode, MAY_WRITE);
}
-int __jfs_setxattr(struct inode *inode, const char *name, void *value,
+int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
size_t value_len, int flags)
{
struct jfs_ea_list *ealist;
@@ -799,7 +799,7 @@
return rc;
}
-int jfs_setxattr(struct dentry *dentry, const char *name, void *value,
+int jfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t value_len, int flags)
{
if (value == NULL) { /* empty EA, do not remove */
--- linux-2.4.20-rc2.patch/fs/jfs/jfs_xattr.h~xattr-const 2002-11-18 23:52:56.000000000 +0100
+++ linux-2.4.20-rc2.patch-agruen/fs/jfs/jfs_xattr.h 2002-11-18 23:40:27.000000000 +0100
@@ -52,8 +52,10 @@
#define END_EALIST(ealist) \
((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
-extern int __jfs_setxattr(struct inode *, const char *, void *, size_t, int);
-extern int jfs_setxattr(struct dentry *, const char *, void *, size_t, int);
+extern int __jfs_setxattr(struct inode *, const char *, const void *, size_t,
+ int);
+extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t,
+ int);
extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
_
next reply other threads:[~2002-11-20 14:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-20 15:05 Andreas Gruenbacher [this message]
2002-11-20 15:18 ` Dave Kleikamp
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=200211201605.45786.agruen@suse.de \
--to=agruen@suse.de \
--cc=akpm@digeo.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=sbest@us.ibm.com \
--cc=shaggy@austin.ibm.com \
--cc=torvalds@transmeta.com \
/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
all inboxes | Powered by JetHome®