summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/xdr-rpc.h
blob: d504391d5f06c912c1c6561435210665a5bcd2a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
  Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
  This file is part of GlusterFS.

  GlusterFS is free software; you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published
  by the Free Software Foundation; either version 3 of the License,
  or (at your option) any later version.

  GlusterFS is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see
  <http://www.gnu.org/licenses/>.
*/

#ifndef _XDR_RPC_H
#define _XDR_RPC_H_

#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif

#ifndef GF_SOLARIS_HOST_OS
#include <rpc/rpc.h>
#endif

#ifdef GF_SOLARIS_HOST_OS
#include <rpc/auth.h>
#include <rpc/auth_sys.h>
#endif

//#include <rpc/pmap_clnt.h>
#include <arpa/inet.h>
#include <rpc/xdr.h>
#include <sys/uio.h>

/* Converts a given network buffer from its XDR format to a structure
 * that contains everything an RPC call needs to work.
 */
extern int
xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call,
                 struct iovec *payload, char *credbytes, char *verfbytes);

extern int
rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid);

extern int
rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err);

extern int
rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow,
                         int proghigh, int verf, int len, char *vdata);
extern int
rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len,
                  struct iovec *dst);

extern int
xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au,
                       char *machname, gid_t *gids);
/* Macros that simplify accesing the members of an RPC call structure. */
#define rpc_call_xid(call)              ((call)->rm_xid)
#define rpc_call_direction(call)        ((call)->rm_direction)
#define rpc_call_rpcvers(call)          ((call)->ru.RM_cmb.cb_rpcvers)
#define rpc_call_program(call)          ((call)->ru.RM_cmb.cb_prog)
#define rpc_call_progver(call)          ((call)->ru.RM_cmb.cb_vers)
#define rpc_call_progproc(call)         ((call)->ru.RM_cmb.cb_proc)
#define rpc_opaque_auth_flavour(oa)     ((oa)->oa_flavor)
#define rpc_opaque_auth_len(oa)         ((oa)->oa_length)

#define rpc_call_cred_flavour(call)     (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_cred)))
#define rpc_call_cred_len(call)         (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_cred)))


#define rpc_call_verf_flavour(call)     (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_verf)))
#define rpc_call_verf_len(call)         (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_verf)))

#endif
call_lease" This is backport of the below mainline patch - https://review.gluster.org/#/c/glusterfs/+/21391 Change-Id: I3320ddf235cc82fad561e13b9457ebd64db6c76b updates: #350 Signed-off-by: Soumya Koduri <skoduri@redhat.com>
This patch fixes below issues in gfapi lease code-path
* 'glfs_setfsleasid' should allow NULL input to be
   able to reset leaseid
* Applications should be allowed to (un)register for
  upcall notifications of type GLFS_EVENT_LEASE_RECALL
* APIs added to read contents of GLFS_EVENT_LEASE_RECALL
  argument which is of type "struct glfs_upcall_lease"

This is backport of the below mainline patch -
 https://review.gluster.org/#/c/glusterfs/+/21391

Change-Id: I3320ddf235cc82fad561e13b9457ebd64db6c76b
updates: #350
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
api: fill out attribute information if not valid 2018-10-17T23:36:13+00:00 Raghavendra Gowdappa rgowdapp@redhat.com 2018-10-12T05:01:04+00:00 5bc2fd4fc6a8aa65d8d2b2c22ffb6c5b70ef9dac translators like readdir-ahead selectively retain entry information of iatt (gfid and type) when rest of the iatt is invalidated (for write invalidating ia_size, (m)(c)times etc). Fuse-bridge uses this information and sends only entry information in readdirplus response. However such option doesn't exist in gfapi. This patch modifies gfapi to populate the stat by forcing an extra lookup. Thanks to Shyamsundar Ranganathan <srangana@redhat.com> and Prashanth Pai <ppai@redhat.com> for tests. Change-Id: Ieb5f8fc76359c327627b7d8420aaf20810e53000 Fixes: bz#1630804 Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com> Signed-off-by: Soumya Koduri <skoduri@redhat.com> (cherry picked from commit 6257276d9de3f15643f159b2ec627a67c84fc23d)
translators like readdir-ahead selectively retain entry information of
iatt (gfid and type) when rest of the iatt is invalidated (for write
invalidating ia_size, (m)(c)times etc). Fuse-bridge uses this
information and sends only entry information in readdirplus
response. However such option doesn't exist in gfapi. This patch
modifies gfapi to populate the stat by forcing an extra lookup.

Thanks to Shyamsundar Ranganathan <srangana@redhat.com> and Prashanth
Pai <ppai@redhat.com> for tests.

Change-Id: Ieb5f8fc76359c327627b7d8420aaf20810e53000
Fixes: bz#1630804
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
(cherry picked from commit 6257276d9de3f15643f159b2ec627a67c84fc23d)
gfapi: Cleanup alias file 2018-09-17T19:29:37+00:00 ShyamsundarR srangana@redhat.com 2018-09-14T16:06:28+00:00 f4594a3c88cb0a76e260010d57632dc1c718fd5f 2 extra symbols were in the alias file, that are not exported this is cleaned up with this patch. Change-Id: I1ab54b9fb6b0d455884fbbfd89820c60bb861e6f Updates: bz#1629877 Signed-off-by: ShyamsundarR <srangana@redhat.com>
2 extra symbols were in the alias file, that are not exported
this is cleaned up with this patch.

Change-Id: I1ab54b9fb6b0d455884fbbfd89820c60bb861e6f
Updates: bz#1629877
Signed-off-by: ShyamsundarR <srangana@redhat.com>
gfapi: revert several patchs that introduced pre/post attrs 2018-09-17T14:26:06+00:00 ShyamsundarR srangana@redhat.com 2018-09-14T02:15:20+00:00 cee40c3e3c26ebfb3b98109d154501a5cce61c0d Reverted the following: - 248152767b0599986bbb6bb35fc27197f6be6964 - 09943beb499617212f2985ca8ea9ecd1ed1b470e - d01f7244e9d9f7e3ef84e0ba7b48ef1b1b09d809 The reverts are redone by hand, due to clang format changes that made using git to revert the changes more tedious. Change-Id: I96489638a2b641fb2206a110298543225783f7be Updates: bz#1628620 Signed-off-by: ShyamsundarR <srangana@redhat.com>
Reverted the following:
  - 248152767b0599986bbb6bb35fc27197f6be6964
  - 09943beb499617212f2985ca8ea9ecd1ed1b470e
  - d01f7244e9d9f7e3ef84e0ba7b48ef1b1b09d809

The reverts are redone by hand, due to clang format changes
that made using git to revert the changes more tedious.

Change-Id: I96489638a2b641fb2206a110298543225783f7be
Updates: bz#1628620
Signed-off-by: ShyamsundarR <srangana@redhat.com>
gfapi: revert "gfapi: return pre/post attributes at callback for glfs api" 2018-09-17T14:26:06+00:00 ShyamsundarR srangana@redhat.com 2018-09-13T21:20:02+00:00 5cd9c22a4fd041a27275a465d0117af39cf4e616 This reverts commit 384562b294e9a7847403961e878a4daa0fff33eb. The revert is done manually owing to the clang format changes, and the 4.1 patch that reverts this fix is used as the source for the revert. The 4.1 patch has the commit ID: 98376e0c0a Change-Id: Ib2cbce9940f6a2a2755eb47bf332832147835e4d Updates: bz#1628620 Signed-off-by: ShyamsundarR <srangana@redhat.com>
This reverts commit 384562b294e9a7847403961e878a4daa0fff33eb.

The revert is done manually owing to the clang format changes,
and the 4.1 patch that reverts this fix is used as the source
for the revert.

The 4.1 patch has the commit ID: 98376e0c0a

Change-Id: Ib2cbce9940f6a2a2755eb47bf332832147835e4d
Updates: bz#1628620
Signed-off-by: ShyamsundarR <srangana@redhat.com>
Land part 2 of clang-format changes 2018-09-12T12:22:45+00:00 Gluster Ant bugzilla-bot@gluster.org 2018-09-12T12:22:45+00:00 e16868dede6455cab644805af6fe1ac31