lkml.org 
[lkml]   [2005]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 05/16] Allow multiple programs to listen on the same port
    The NFS and NFSACL programs run on the same RPC transport.  This patch adds
    support for this by converting svc_program into a chained list of programs
    (server-side).

    Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
    Signed-off-by: Olaf Kirch <okir@suse.de>

    Index: linux-2.6.11-rc5/include/linux/sunrpc/svc.h
    ===================================================================
    --- linux-2.6.11-rc5.orig/include/linux/sunrpc/svc.h
    +++ linux-2.6.11-rc5/include/linux/sunrpc/svc.h
    @@ -240,9 +240,10 @@ struct svc_deferred_req {
    };

    /*
    - * RPC program
    + * List of RPC programs on the same transport endpoint
    */
    struct svc_program {
    + struct svc_program * pg_next; /* other programs (same xprt) */
    u32 pg_prog; /* program number */
    unsigned int pg_lovers; /* lowest version */
    unsigned int pg_hivers; /* lowest version */
    Index: linux-2.6.11-rc5/net/sunrpc/svc.c
    ===================================================================
    --- linux-2.6.11-rc5.orig/net/sunrpc/svc.c
    +++ linux-2.6.11-rc5/net/sunrpc/svc.c
    @@ -35,20 +35,24 @@ svc_create(struct svc_program *prog, uns
    if (!(serv = (struct svc_serv *) kmalloc(sizeof(*serv), GFP_KERNEL)))
    return NULL;
    memset(serv, 0, sizeof(*serv));
    + serv->sv_name = prog->pg_name;
    serv->sv_program = prog;
    serv->sv_nrthreads = 1;
    serv->sv_stats = prog->pg_stats;
    serv->sv_bufsz = bufsize? bufsize : 4096;
    - prog->pg_lovers = prog->pg_nvers-1;
    xdrsize = 0;
    - for (vers=0; vers<prog->pg_nvers ; vers++)
    - if (prog->pg_vers[vers]) {
    - prog->pg_hivers = vers;
    - if (prog->pg_lovers > vers)
    - prog->pg_lovers = vers;
    - if (prog->pg_vers[vers]->vs_xdrsize > xdrsize)
    - xdrsize = prog->pg_vers[vers]->vs_xdrsize;
    - }
    + while (prog) {
    + prog->pg_lovers = prog->pg_nvers-1;
    + for (vers=0; vers<prog->pg_nvers ; vers++)
    + if (prog->pg_vers[vers]) {
    + prog->pg_hivers = vers;
    + if (prog->pg_lovers > vers)
    + prog->pg_lovers = vers;
    + if (prog->pg_vers[vers]->vs_xdrsize > xdrsize)
    + xdrsize = prog->pg_vers[vers]->vs_xdrsize;
    + }
    + prog = prog->pg_next;
    + }
    serv->sv_xdrsize = xdrsize;
    INIT_LIST_HEAD(&serv->sv_threads);
    INIT_LIST_HEAD(&serv->sv_sockets);
    @@ -56,8 +60,6 @@ svc_create(struct svc_program *prog, uns
    INIT_LIST_HEAD(&serv->sv_permsocks);
    spin_lock_init(&serv->sv_lock);

    - serv->sv_name = prog->pg_name;
    -
    /* Remove any stale portmap registrations */
    svc_register(serv, 0, 0);

    @@ -332,7 +334,10 @@ svc_process(struct svc_serv *serv, struc
    goto sendit;
    }

    - if (prog != progp->pg_prog)
    + for (progp = serv->sv_program; progp; progp = progp->pg_next)
    + if (prog == progp->pg_prog)
    + break;
    + if (progp == NULL)
    goto err_bad_prog;

    if (vers >= progp->pg_nvers ||
    @@ -444,11 +449,7 @@ err_bad_auth:
    goto sendit;

    err_bad_prog:
    -#ifdef RPC_PARANOIA
    - if (prog != 100227 || progp->pg_prog != 100003)
    - printk("svc: unknown program %d (me %d)\n", prog, progp->pg_prog);
    - /* else it is just a Solaris client seeing if ACLs are supported */
    -#endif
    + dprintk("svc: unknown program %d\n", prog);
    serv->sv_stats->rpcbadfmt++;
    svc_putu32(resv, rpc_prog_unavail);
    goto sendit;
    --
    Andreas Gruenbacher <agruen@suse.de>
    SUSE Labs, SUSE LINUX PRODUCTS GMBH

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

    \
     
     \ /
      Last update: 2005-03-22 14:10    [from the cache]
    ©2003-2014 Jasper Spaans. hosted at Digital Ocean