usr/src/lib/libidmap/common/idmap_api.c
changeset 13687 72ce76fa37fb
parent 12926 e95332bf1454
equal deleted inserted replaced
13686:4bc0783f6064 13687:72ce76fa37fb
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 /*
    21 /*
    22  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    22  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
       
    23  * Copyright Milan Jurik 2012. All rights reserved.
    23  */
    24  */
    24 
    25 
    25 
    26 
    26 /*
    27 /*
    27  * libidmap API
    28  * libidmap API
    63 	itera->type = ityp;\
    64 	itera->type = ityp;\
    64 	itera->retcode = IDMAP_NEXT;\
    65 	itera->retcode = IDMAP_NEXT;\
    65 	itera->limit = 1024;\
    66 	itera->limit = 1024;\
    66 	itera->arg = argu;
    67 	itera->arg = argu;
    67 
    68 
    68 
       
    69 #define	__ITER_ERR_RETURN(itera, argu, xdr_argu, iretcod)\
       
    70 	if (argu) {\
       
    71 		xdr_free(xdr_argu, (caddr_t)argu);\
       
    72 		free(argu);\
       
    73 	}\
       
    74 	if (itera)\
       
    75 		free(itera);\
       
    76 	return (iretcod);
       
    77 
       
    78 
       
    79 #define	__ITER_CHECK(itera, ityp)\
    69 #define	__ITER_CHECK(itera, ityp)\
    80 	if (itera == NULL) {\
    70 	if (itera == NULL) {\
    81 		errno = EINVAL;\
    71 		errno = EINVAL;\
    82 		return (IDMAP_ERR_ARG);\
    72 		return (IDMAP_ERR_ARG);\
    83 	}\
    73 	}\
   604 
   594 
   605 	*iter = tmpiter;
   595 	*iter = tmpiter;
   606 	return (IDMAP_SUCCESS);
   596 	return (IDMAP_SUCCESS);
   607 
   597 
   608 errout:
   598 errout:
   609 	__ITER_ERR_RETURN(tmpiter, arg,
   599 	if (arg) {
   610 	    xdr_idmap_list_namerules_1_argument, retcode);
   600 		xdr_free(xdr_idmap_list_namerules_1_argument, (char *)arg);
       
   601 		free(arg);
       
   602 	}
       
   603 	if (tmpiter)
       
   604 		free(tmpiter);
       
   605 
       
   606 	return (retcode);
   611 }
   607 }
   612 
   608 
   613 
   609 
   614 /*
   610 /*
   615  * Iterate through the name-based mapping rules
   611  * Iterate through the name-based mapping rules