Diff for /libaitrpc/src/blob.c between versions 1.3.2.1 and 1.4.4.1

version 1.3.2.1, 2011/08/29 23:26:56 version 1.4.4.1, 2012/03/13 17:21:52
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 71  again: Line 71  again:
         rnd = random() % UINT_MAX;          rnd = random() % UINT_MAX;
   
         memset(szFName, 0, sizeof szFName);          memset(szFName, 0, sizeof szFName);
        snprintf(szFName, sizeof szFName, BLOB_FILE, srv->srv_blob.dir, rnd);        snprintf(szFName, sizeof szFName, BLOB_FILE, AIT_GET_STR(&srv->srv_blob.dir), rnd);
         f = open(szFName, O_CREAT | O_EXCL | O_RDWR, 0600);          f = open(szFName, O_CREAT | O_EXCL | O_RDWR, 0600);
         if (f == -1) {          if (f == -1) {
                 if (errno == EEXIST)                  if (errno == EEXIST)
Line 127  rpc_srv_blobMap(rpc_srv_t * __restrict srv, rpc_blob_t Line 127  rpc_srv_blobMap(rpc_srv_t * __restrict srv, rpc_blob_t
                 rpc_SetErr(EINVAL, "Error:: invalid arguments ...\n");                  rpc_SetErr(EINVAL, "Error:: invalid arguments ...\n");
                 return -1;                  return -1;
         }          }
           if (blob->blob_data) {
                   rpc_SetErr(EPERM, "Error:: already mmapped object found!\n");
                   return -1;
           }
   
         memset(szFName, 0, sizeof szFName);          memset(szFName, 0, sizeof szFName);
        snprintf(szFName, sizeof szFName, BLOB_FILE, srv->srv_blob.dir, blob->blob_var);        snprintf(szFName, sizeof szFName, BLOB_FILE, AIT_GET_STR(&srv->srv_blob.dir), blob->blob_var);
         f = open(szFName, O_RDWR);          f = open(szFName, O_RDWR);
         if (f == -1) {          if (f == -1) {
                 LOGERR;                  LOGERR;
Line 187  rpc_srv_blobFree(rpc_srv_t * __restrict srv, rpc_blob_ Line 191  rpc_srv_blobFree(rpc_srv_t * __restrict srv, rpc_blob_
                 rpc_srv_blobUnmap(blob);                  rpc_srv_blobUnmap(blob);
   
         memset(szFName, 0, sizeof szFName);          memset(szFName, 0, sizeof szFName);
        snprintf(szFName, sizeof szFName, BLOB_FILE, srv->srv_blob.dir, blob->blob_var);        snprintf(szFName, sizeof szFName, BLOB_FILE, AIT_GET_STR(&srv->srv_blob.dir), blob->blob_var);
         if (unlink(szFName) == -1) {          if (unlink(szFName) == -1) {
                 LOGERR;                  LOGERR;
                 return -1;                  return -1;
Line 297  rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, ait_val_t Line 301  rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, ait_val_t
                 return -1;                  return -1;
         }          }
   
           /* send BLOB to server */
         for (ret = AIT_LEN(var), pos = data; ret > 0; ret -= len, pos += len)          for (ret = AIT_LEN(var), pos = data; ret > 0; ret -= len, pos += len)
                 if ((len = send(cli->cli_sock, pos, ret, 0)) == -1) {                  if ((len = send(cli->cli_sock, pos, ret, 0)) == -1) {
                         LOGERR;                          LOGERR;
Line 337  rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, ait_val_t Line 342  rpc_cli_sendBLOB(rpc_cli_t * __restrict cli, ait_val_t
  * return: -1 error, 0 ok, 1 remote error   * return: -1 error, 0 ok, 1 remote error
  */   */
 int  int
rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, ait_val_t * __restrict var, void ** data)rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, ait_val_t * __restrict var, void ** __restrict data)
 {  {
         int ret, len;          int ret, len;
         uint8_t *pos;          uint8_t *pos;
Line 369  rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, ait_val_t Line 374  rpc_cli_recvBLOB(rpc_cli_t * __restrict cli, ait_val_t
                 return -1;                  return -1;
         }          }
   
           /* receive BLOB from server */
         for (ret = AIT_LEN(var), pos = *data; ret > 0; ret -= len, pos += len) {          for (ret = AIT_LEN(var), pos = *data; ret > 0; ret -= len, pos += len) {
                 FD_ZERO(&fds);                  FD_ZERO(&fds);
                 FD_SET(cli->cli_sock, &fds);                  FD_SET(cli->cli_sock, &fds);

Removed from v.1.3.2.1  
changed lines
  Added in v.1.4.4.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>