EXTRA_DIST = autogen.sh COPYING INSTALL README AUTHORS THANKS NEWS glusterfs.spec
SUBDIRS = argp-standalone libglusterfs rpc xlators glusterfsd $(FUSERMOUNT_SUBDIR) doc extras cli
CLEANFILES =
gitclean: distclean
find . -name Makefile.in -exec rm -f {} \;
find . -name Makefile -exec rm -f {} \;
find . -name mount.glusterfs -exec rm -f {} \;
rm -fr autom4te.cache
rm -f missing aclocal.m4 config.h.in config.guess config.sub ltmain.sh install-sh configure depcomp
rm -fr argp-standalone/autom4te.cache
rm -f argp-standalone/aclocal.m4 argp-standalone/config.h.in argp-standalone/configure argp-standalone/depcomp argp-standalone/install-sh argp-standalone/missing
ived a copy of the GNU Affero General Public License
along with this program. If not, see
.
*/
#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif
#include
#include
#include "server.h"
#include "server-helpers.h"
#include "glusterfs3-xdr.h"
#include "call-stub.h"
#include "statedump.h"
#include "defaults.h"
#include "authenticate.h"
#include "rpcsvc.h"
struct iobuf *
gfs_serialize_reply (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc,
struct iovec *outmsg)
{
struct iobuf *iob = NULL;
ssize_t retlen = -1;
/* First, get the io buffer into which the reply in arg will
* be serialized.
*/
iob = iobuf_get (req->svc->ctx->iobuf_pool);
if (!iob) {
gf_log ("", GF_LOG_ERROR, "Failed to get iobuf");
goto ret;
}
iobuf_to_iovec (iob, outmsg);
/* Use the given serializer to translate the give C structure in arg
* to XDR format which will be written into the buffer in outmsg.
*/
/* retlen is used to received the error since size_t is unsigned and we
* need -1 for error notification during encoding.
*/
retlen = sfunc (*outmsg, arg);
if (retlen == -1) {
/* Failed to Encode 'GlusterFS' msg in RPC is not exactly
failure of RPC return values.. client should get
notified about this, so there are no missing frames */
gf_log ("", GF_LOG_ERROR, "Failed to encode message");
req->rpc_err = GARBAGE_ARGS;
retlen = 0;
}
outmsg->iov_len = retlen;
ret:
if (retlen == -1) {
iobuf_unref (iob);
iob = NULL;
}
return iob;
}
/* Generic reply function for NFSv3 specific replies. */
int
server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
struct iovec *payload, int payloadcount,
struct iobref *iobref, gfs_serialize_t sfunc)
{
struct iobuf *iob = NULL;
int ret = -1;
struct iovec rsp = {0,};
server_state_t *state = NULL;
char new_iobref = 0;
if (!req) {
goto ret;
}
if (frame) {
state = CALL_STATE (frame);
frame->local = NULL;
}
if (!iobref) {
iobref = iobref_new ();
if (!iobref) {
gf_log ("", GF_LOG_ERROR, "out of memory");
goto ret;
}
new_iobref = 1;
}
iob = gfs_serialize_reply (req, arg, sfunc, &rsp);
if (!iob) {
gf_log ("", GF_LOG_ERROR, "Failed to serialize reply");
goto ret;
}