~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to net/rxrpc/ar-key.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <keys/user-type.h>
26
26
#include "ar-internal.h"
27
27
 
 
28
static int rxrpc_vet_description_s(const char *);
28
29
static int rxrpc_instantiate(struct key *, const void *, size_t);
29
30
static int rxrpc_instantiate_s(struct key *, const void *, size_t);
30
31
static void rxrpc_destroy(struct key *);
52
53
 */
53
54
struct key_type key_type_rxrpc_s = {
54
55
        .name           = "rxrpc_s",
 
56
        .vet_description = rxrpc_vet_description_s,
55
57
        .instantiate    = rxrpc_instantiate_s,
56
58
        .match          = user_match,
57
59
        .destroy        = rxrpc_destroy_s,
59
61
};
60
62
 
61
63
/*
 
64
 * Vet the description for an RxRPC server key
 
65
 */
 
66
static int rxrpc_vet_description_s(const char *desc)
 
67
{
 
68
        unsigned long num;
 
69
        char *p;
 
70
 
 
71
        num = simple_strtoul(desc, &p, 10);
 
72
        if (*p != ':' || num > 65535)
 
73
                return -EINVAL;
 
74
        num = simple_strtoul(p + 1, &p, 10);
 
75
        if (*p || num < 1 || num > 255)
 
76
                return -EINVAL;
 
77
        return 0;
 
78
}
 
79
 
 
80
/*
62
81
 * parse an RxKAD type XDR format token
63
82
 * - the caller guarantees we have at least 4 words
64
83
 */