* [PATCH 1/2] AFS: Make the match_*() functions take const options
@ 2007-05-01 17:47 David Howells
2007-05-01 17:47 ` [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes David Howells
2007-05-03 10:10 ` [PATCH 1/2] AFS: Make the match_*() functions take const options David Miller
0 siblings, 2 replies; 6+ messages in thread
From: David Howells @ 2007-05-01 17:47 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel, linux-fsdevel, netdev, geert, dhowells
Make the match_*() functions take a const pointer to the options table and
make strings pointers in the options table const too.
Signed-off-by: David Howells <dhowells@redhat.com>
---
include/linux/parser.h | 8 ++++----
lib/parser.c | 10 +++++-----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/parser.h b/include/linux/parser.h
index fa33328..86676f6 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -11,10 +11,10 @@
/* associates an integer enumerator with a pattern string. */
struct match_token {
int token;
- char *pattern;
+ const char *pattern;
};
-typedef struct match_token match_table_t[];
+typedef const struct match_token match_table_t[];
/* Maximum number of arguments that match_token will find in a pattern */
enum {MAX_OPT_ARGS = 3};
@@ -29,5 +29,5 @@ int match_token(char *, match_table_t table, substring_t args[]);
int match_int(substring_t *, int *result);
int match_octal(substring_t *, int *result);
int match_hex(substring_t *, int *result);
-void match_strcpy(char *, substring_t *);
-char *match_strdup(substring_t *);
+void match_strcpy(char *, const substring_t *);
+char *match_strdup(const substring_t *);
diff --git a/lib/parser.c b/lib/parser.c
index 7ad2a48..703c8c1 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -22,7 +22,7 @@
* match extremely simple token=arg style patterns. If the pattern is found,
* the location(s) of the arguments will be returned in the @args array.
*/
-static int match_one(char *s, char *p, substring_t args[])
+static int match_one(char *s, const char *p, substring_t args[])
{
char *meta;
int argc = 0;
@@ -43,7 +43,7 @@ static int match_one(char *s, char *p, substring_t args[])
p = meta + 1;
if (isdigit(*p))
- len = simple_strtoul(p, &p, 10);
+ len = simple_strtoul(p, (char **) &p, 10);
else if (*p == '%') {
if (*s++ != '%')
return 0;
@@ -102,7 +102,7 @@ static int match_one(char *s, char *p, substring_t args[])
*/
int match_token(char *s, match_table_t table, substring_t args[])
{
- struct match_token *p;
+ const struct match_token *p;
for (p = table; !match_one(s, p->pattern, args) ; p++)
;
@@ -190,7 +190,7 @@ int match_hex(substring_t *s, int *result)
* &substring_t @s to the c-style string @to. Caller guarantees that @to is
* large enough to hold the characters of @s.
*/
-void match_strcpy(char *to, substring_t *s)
+void match_strcpy(char *to, const substring_t *s)
{
memcpy(to, s->from, s->to - s->from);
to[s->to - s->from] = '\0';
@@ -204,7 +204,7 @@ void match_strcpy(char *to, substring_t *s)
* the &substring_t @s. The caller is responsible for freeing the returned
* string with kfree().
*/
-char *match_strdup(substring_t *s)
+char *match_strdup(const substring_t *s)
{
char *p = kmalloc(s->to - s->from + 1, GFP_KERNEL);
if (p)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes
2007-05-01 17:47 [PATCH 1/2] AFS: Make the match_*() functions take const options David Howells
@ 2007-05-01 17:47 ` David Howells
2007-05-01 18:08 ` Geert Uytterhoeven
2007-05-03 10:11 ` David Miller
2007-05-03 10:10 ` [PATCH 1/2] AFS: Make the match_*() functions take const options David Miller
1 sibling, 2 replies; 6+ messages in thread
From: David Howells @ 2007-05-01 17:47 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel, linux-fsdevel, netdev, geert, dhowells
Make miscellaneous fixes to AFS and AF_RXRPC:
(*) Make AF_RXRPC select KEYS rather than RXKAD or AFS_FS in Kconfig.
(*) Don't use FS_BINARY_MOUNTDATA.
(*) Remove a done 'TODO' item in a comemnt on afs_get_sb().
(*) Don't pass a void * as the page pointer argument of kmap_atomic() as this
breaks on m68k. Patch from Geert Uytterhoeven <geert@linux-m68k.org>.
(*) Use match_*() functions rather than doing my own parsing.
Signed-off-by: David Howells <dhowells@redhat.com>
---
fs/Kconfig | 1 -
fs/afs/fsclient.c | 3 +-
fs/afs/super.c | 100 +++++++++++++++++++++++------------------------------
net/rxrpc/Kconfig | 3 +-
4 files changed, 47 insertions(+), 60 deletions(-)
diff --git a/fs/Kconfig b/fs/Kconfig
index a42f767..e33c089 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -2020,7 +2020,6 @@ config AFS_FS
tristate "Andrew File System support (AFS) (EXPERIMENTAL)"
depends on INET && EXPERIMENTAL
select AF_RXRPC
- select KEYS
help
If you say Y here, you will get an experimental Andrew File System
driver. It currently only supports unsecured read-only AFS access.
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index 2393d2a..e54e6c2 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -266,7 +266,8 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call,
call->unmarshall++;
if (call->count < PAGE_SIZE) {
- buffer = kmap_atomic(call->reply3, KM_USER0);
+ page = call->reply3;
+ buffer = kmap_atomic(page, KM_USER0);
memset(buffer + PAGE_SIZE - call->count, 0,
call->count);
kunmap_atomic(buffer, KM_USER0);
diff --git a/fs/afs/super.c b/fs/afs/super.c
index cebd03c..41173f8 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -20,6 +20,7 @@
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
+#include <linux/parser.h>
#include "internal.h"
#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
@@ -42,7 +43,7 @@ struct file_system_type afs_fs_type = {
.name = "afs",
.get_sb = afs_get_sb,
.kill_sb = kill_anon_super,
- .fs_flags = FS_BINARY_MOUNTDATA,
+ .fs_flags = 0,
};
static const struct super_operations afs_super_ops = {
@@ -58,6 +59,20 @@ static const struct super_operations afs_super_ops = {
static struct kmem_cache *afs_inode_cachep;
static atomic_t afs_count_active_inodes;
+enum {
+ afs_no_opt,
+ afs_opt_cell,
+ afs_opt_rwpath,
+ afs_opt_vol,
+};
+
+static const match_table_t afs_options_list = {
+ { afs_opt_cell, "cell=%s" },
+ { afs_opt_rwpath, "rwpath" },
+ { afs_opt_vol, "vol=%s" },
+ { afs_no_opt, NULL },
+};
+
/*
* initialise the filesystem
*/
@@ -115,31 +130,6 @@ void __exit afs_fs_exit(void)
}
/*
- * check that an argument has a value
- */
-static int want_arg(char **_value, const char *option)
-{
- if (!_value || !*_value || !**_value) {
- printk(KERN_NOTICE "kAFS: %s: argument missing\n", option);
- return 0;
- }
- return 1;
-}
-
-/*
- * check that there's no subsequent value
- */
-static int want_no_value(char *const *_value, const char *option)
-{
- if (*_value && **_value) {
- printk(KERN_NOTICE "kAFS: %s: Invalid argument: %s\n",
- option, *_value);
- return 0;
- }
- return 1;
-}
-
-/*
* parse the mount options
* - this function has been shamelessly adapted from the ext3 fs which
* shamelessly adapted it from the msdos fs
@@ -148,48 +138,46 @@ static int afs_parse_options(struct afs_mount_params *params,
char *options, const char **devname)
{
struct afs_cell *cell;
- char *key, *value;
- int ret;
+ substring_t args[MAX_OPT_ARGS];
+ char *p;
+ int token;
_enter("%s", options);
options[PAGE_SIZE - 1] = 0;
- ret = 0;
- while ((key = strsep(&options, ","))) {
- value = strchr(key, '=');
- if (value)
- *value++ = 0;
-
- _debug("kAFS: KEY: %s, VAL:%s", key, value ?: "-");
+ while ((p = strsep(&options, ","))) {
+ if (!*p)
+ continue;
- if (strcmp(key, "rwpath") == 0) {
- if (!want_no_value(&value, "rwpath"))
- return -EINVAL;
- params->rwpath = 1;
- } else if (strcmp(key, "vol") == 0) {
- if (!want_arg(&value, "vol"))
- return -EINVAL;
- *devname = value;
- } else if (strcmp(key, "cell") == 0) {
- if (!want_arg(&value, "cell"))
- return -EINVAL;
- cell = afs_cell_lookup(value, strlen(value));
+ token = match_token(p, afs_options_list, args);
+ switch (token) {
+ case afs_opt_cell:
+ cell = afs_cell_lookup(args[0].from,
+ args[0].to - args[0].from);
if (IS_ERR(cell))
return PTR_ERR(cell);
afs_put_cell(params->cell);
params->cell = cell;
- } else {
- printk("kAFS: Unknown mount option: '%s'\n", key);
- ret = -EINVAL;
- goto error;
+ break;
+
+ case afs_opt_rwpath:
+ params->rwpath = 1;
+ break;
+
+ case afs_opt_vol:
+ *devname = args[0].from;
+ break;
+
+ default:
+ printk(KERN_ERR "kAFS:"
+ " Unknown or invalid mount option: '%s'\n", p);
+ return -EINVAL;
}
}
- ret = 0;
-error:
- _leave(" = %d", ret);
- return ret;
+ _leave(" = 0");
+ return 0;
}
/*
@@ -361,7 +349,6 @@ error:
/*
* get an AFS superblock
- * - TODO: don't use get_sb_nodev(), but rather call sget() directly
*/
static int afs_get_sb(struct file_system_type *fs_type,
int flags,
@@ -386,7 +373,6 @@ static int afs_get_sb(struct file_system_type *fs_type,
goto error;
}
-
ret = afs_parse_device_name(¶ms, dev_name);
if (ret < 0)
goto error;
diff --git a/net/rxrpc/Kconfig b/net/rxrpc/Kconfig
index 8750f6d..91b3d52 100644
--- a/net/rxrpc/Kconfig
+++ b/net/rxrpc/Kconfig
@@ -5,6 +5,7 @@
config AF_RXRPC
tristate "RxRPC session sockets"
depends on EXPERIMENTAL
+ select KEYS
help
Say Y or M here to include support for RxRPC session sockets (just
the transport part, not the presentation part: (un)marshalling is
@@ -29,7 +30,7 @@ config AF_RXRPC_DEBUG
config RXKAD
tristate "RxRPC Kerberos security"
- depends on AF_RXRPC && KEYS
+ depends on AF_RXRPC
select CRYPTO
select CRYPTO_MANAGER
select CRYPTO_BLKCIPHER
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes
2007-05-01 17:47 ` [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes David Howells
@ 2007-05-01 18:08 ` Geert Uytterhoeven
2007-05-01 18:11 ` David Howells
2007-05-03 10:11 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2007-05-01 18:08 UTC (permalink / raw)
To: David Howells
Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development,
linux-fsdevel, netdev
Hi David,
I've just noticed another issue: if CONFIG_AFS_FS=y, the kernel build fails
with
| `afs_callback_update_kill' referenced in section `.init.text' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o
| `afs_vlocation_purge' referenced in section `.init.text' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o
and indeed, afs_init() calls both afs_callback_update_kill() and
afs_vlocation_purge() in the failure path.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes
2007-05-01 18:08 ` Geert Uytterhoeven
@ 2007-05-01 18:11 ` David Howells
0 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2007-05-01 18:11 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development,
linux-fsdevel, netdev
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> I've just noticed another issue: if CONFIG_AFS_FS=y, the kernel build fails
> with
Can you send me the config you're using please?
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] AFS: Make the match_*() functions take const options
2007-05-01 17:47 [PATCH 1/2] AFS: Make the match_*() functions take const options David Howells
2007-05-01 17:47 ` [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes David Howells
@ 2007-05-03 10:10 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2007-05-03 10:10 UTC (permalink / raw)
To: dhowells; +Cc: torvalds, akpm, linux-kernel, linux-fsdevel, netdev, geert
From: David Howells <dhowells@redhat.com>
Date: Tue, 01 May 2007 18:47:47 +0100
> Make the match_*() functions take a const pointer to the options table and
> make strings pointers in the options table const too.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
I'll take this, applied, thanks David.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes
2007-05-01 17:47 ` [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes David Howells
2007-05-01 18:08 ` Geert Uytterhoeven
@ 2007-05-03 10:11 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2007-05-03 10:11 UTC (permalink / raw)
To: dhowells; +Cc: torvalds, akpm, linux-kernel, linux-fsdevel, netdev, geert
From: David Howells <dhowells@redhat.com>
Date: Tue, 01 May 2007 18:47:52 +0100
> Make miscellaneous fixes to AFS and AF_RXRPC:
>
> (*) Make AF_RXRPC select KEYS rather than RXKAD or AFS_FS in Kconfig.
>
> (*) Don't use FS_BINARY_MOUNTDATA.
>
> (*) Remove a done 'TODO' item in a comemnt on afs_get_sb().
>
> (*) Don't pass a void * as the page pointer argument of kmap_atomic() as this
> breaks on m68k. Patch from Geert Uytterhoeven <geert@linux-m68k.org>.
>
> (*) Use match_*() functions rather than doing my own parsing.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-05-03 10:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-01 17:47 [PATCH 1/2] AFS: Make the match_*() functions take const options David Howells
2007-05-01 17:47 ` [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes David Howells
2007-05-01 18:08 ` Geert Uytterhoeven
2007-05-01 18:11 ` David Howells
2007-05-03 10:11 ` David Miller
2007-05-03 10:10 ` [PATCH 1/2] AFS: Make the match_*() functions take const options David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.