Diff for /libaitsess/src/sess.c between versions 1.5.4.1 and 1.5.4.2

version 1.5.4.1, 2013/01/17 13:10:49 version 1.5.4.2, 2013/01/17 13:26:37
Line 47  SUCH DAMAGE. Line 47  SUCH DAMAGE.
   
   
 /*  /*
 * sess_FreeValues() Free all values from value array allocated from sess_GetValues() * sess_FreeValues() - Free all values from value array allocated from sess_GetValues()
  *   *
  * @ppsVals = Array strings   * @ppsVals = Array strings
  * return: none   * return: none
Line 68  sess_FreeValues(char *** __restrict ppsVals) Line 68  sess_FreeValues(char *** __restrict ppsVals)
 }  }
   
 /*  /*
 * sess_GetValues() Get all values from session shared memory * sess_GetValues() - Get all values from session shared memory
  *   *
  * @s = Session item   * @s = Session item
  * @ppsVals = Return array strings   * @ppsVals = Return array strings
 * return: -1 error: in parameter, !=-1 count of returned strings in ppsVals (must be free after use!) * return: -1 error: in parameter, !=-1 count of returned strings in ppsVals 
  *                (must be sess_FreeValues after use!)
  */   */
 int  int
 sess_GetValues(ait_sess_t * __restrict s, char ***ppsVals)  sess_GetValues(ait_sess_t * __restrict s, char ***ppsVals)
Line 90  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV Line 91  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV
         } else          } else
                 *valz = NULL;                  *valz = NULL;
   
        // allocated memory & mirrored shared memory into this        /* allocated memory & mirrored shared memory into this */
         Shared = e_malloc(s->eom);          Shared = e_malloc(s->eom);
         if (!Shared) {          if (!Shared) {
                 LOGERR;                  LOGERR;
Line 123  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV Line 124  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV
 }  }
   
 /*  /*
 * sess_GetValue() Get value from session shared memory from attribute * sess_GetValue() - Get value from session shared memory from attribute
  *   *
  * @s = Session item   * @s = Session item
  * @csAttr = Attribute for search   * @csAttr = Attribute for search
  * @psVal = Return string buffer   * @psVal = Return string buffer
  * @pnLen = Length of return string buffer,    * @pnLen = Length of return string buffer, 
         // *{pnLen} input is max_size of buffer & output is really taken bytes          // *{pnLen} input is max_size of buffer & output is really taken bytes
 * return: 0 not found, -1 error: in parameter, >0 get position, if define item merged with IS_DEF * return: 0 not found, -1 error: in parameter, >0 get position, 
  *        if define item merged with IS_DEF
  */   */
 int  int
 sess_GetValue(ait_sess_t * __restrict s, const char *csAttr, char *psVal, int *pnLen)  sess_GetValue(ait_sess_t * __restrict s, const char *csAttr, char *psVal, int *pnLen)
Line 149  sess_GetValue(ait_sess_t * __restrict s, const char *c Line 151  sess_GetValue(ait_sess_t * __restrict s, const char *c
                         return -1;                          return -1;
         }          }
   
        // allocated memory & mirrored shared memory into this        /* allocated memory & mirrored shared memory into this */
         Shared = e_malloc(s->eom);          Shared = e_malloc(s->eom);
         if (!Shared) {          if (!Shared) {
                 LOGERR;                  LOGERR;
Line 180  sess_GetValue(ait_sess_t * __restrict s, const char *c Line 182  sess_GetValue(ait_sess_t * __restrict s, const char *c
 }  }
   
 /*  /*
 * sess_DelValue() Delete item from session shared memory * sess_DelValue() - Delete item from session shared memory
  *   *
  * @s = Session item   * @s = Session item
  * @csAttr = Attribute for erasing   * @csAttr = Attribute for erasing
Line 241  sess_DelValue(ait_sess_t * __restrict s, const char *c Line 243  sess_DelValue(ait_sess_t * __restrict s, const char *c
 }  }
   
 /*  /*
 * sess_SetValue() Set item into session shared memory or update if find it * sess_SetValue() - Set item into session shared memory or update if exists
  *   *
  * @s = Session item   * @s = Session item
  * @csAttr = Attribute   * @csAttr = Attribute
Line 326  sess_SetValue(ait_sess_t * __restrict s, const char *c Line 328  sess_SetValue(ait_sess_t * __restrict s, const char *c
   
   
 /*  /*
 * sess_prepareSession() Attach to shared memory and de-marshaling data * sess_prepareSession() - Attach to shared memory and de-marshaling data
  *   *
  * @s = Session   * @s = Session
  * @useDirect = Use direct shared memory if !=0 or snapshot of data to array   * @useDirect = Use direct shared memory if !=0 or snapshot of data to array
Line 341  sess_prepareSession(ait_sess_t * __restrict s, char us Line 343  sess_prepareSession(ait_sess_t * __restrict s, char us
   
         assert(s);          assert(s);
         if (!s) {          if (!s) {
                sess_SetErr(EINVAL, "Error:: invalid argument\n");                sess_SetErr(EINVAL, "Invalid argument\n");
                 return NULL;                  return NULL;
         }          }
         if (s->addr) {          if (s->addr) {
                sess_SetErr(EINVAL, "Error:: already attached memory\n");                sess_SetErr(EINVAL, "Already attached memory\n");
                 return NULL;                  return NULL;
         }          }
   
Line 357  sess_prepareSession(ait_sess_t * __restrict s, char us Line 359  sess_prepareSession(ait_sess_t * __restrict s, char us
         if (hdr->hdr_magic != SESS_AIT_MAGIC) {          if (hdr->hdr_magic != SESS_AIT_MAGIC) {
                 DETACH_MEMORY(s);                  DETACH_MEMORY(s);
   
                sess_SetErr(EINVAL, "Error:: shared memory not contains values with proper format\n");                sess_SetErr(EINVAL, "Shared memory not contains values with proper format\n");
                 return NULL;                  return NULL;
         }          }
   
Line 373  sess_prepareSession(ait_sess_t * __restrict s, char us Line 375  sess_prepareSession(ait_sess_t * __restrict s, char us
 }  }
   
 /*  /*
 * sess_doneSession() Free resources allocated with sess_prepareSession() * sess_doneSession() - Free resources allocated with sess_prepareSession()
  *   *
  * @s = Session   * @s = Session
  * @arr = Array with variables for free   * @arr = Array with variables for free
Line 384  sess_doneSession(ait_sess_t * __restrict s, array_t ** Line 386  sess_doneSession(ait_sess_t * __restrict s, array_t **
 {  {
         assert(s);          assert(s);
         if (!s) {          if (!s) {
                sess_SetErr(EINVAL, "Error:: invalid argument\n");                sess_SetErr(EINVAL, "Invalid argument\n");
                 return;                  return;
         }          }
   
Line 396  sess_doneSession(ait_sess_t * __restrict s, array_t ** Line 398  sess_doneSession(ait_sess_t * __restrict s, array_t **
 }  }
   
 /*  /*
 * sess_commitSession() Commit data to shared memory * sess_commitSession() - Commit data to shared memory
  *   *
  * @s = Session   * @s = Session
  * @arr = Array with variables for save   * @arr = Array with variables for save
Line 410  sess_commitSession(ait_sess_t * __restrict s, array_t  Line 412  sess_commitSession(ait_sess_t * __restrict s, array_t 
   
         assert(s && arr);          assert(s && arr);
         if (!s || !arr) {          if (!s || !arr) {
                sess_SetErr(EINVAL, "Error:: invalid argument\n");                sess_SetErr(EINVAL, "Invalid argument\n");
                 return -1;                  return -1;
         }          }
   

Removed from v.1.5.4.1  
changed lines
  Added in v.1.5.4.2


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