X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Futil.h;h=f3bf80c6eaeddc760344b743bb30785d2258b985;hb=822b56da1165488311e7a5460ed995cf0465b672;hp=29e212dc52cc9d1e6194f637d46f48635fd5c629;hpb=17e42975c2d42574072925f3743cc64bfd5a8fc1;p=openvswitch diff --git a/lib/util.h b/lib/util.h index 29e212dc..f3bf80c6 100644 --- a/lib/util.h +++ b/lib/util.h @@ -101,6 +101,14 @@ extern const char *program_name; ((OVS_TYPEOF(OBJECT)) (void *) \ ((char *) (POINTER) - ((char *) &(OBJECT)->MEMBER - (char *) (OBJECT)))) +/* Given POINTER, the address of the given MEMBER within an object of the type + * that that OBJECT points to, assigns the address of the outer object to + * OBJECT, which must be an lvalue. + * + * Evaluates to 1. */ +#define ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER) \ + ((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), 1) + #ifdef __cplusplus extern "C" { #endif @@ -129,6 +137,7 @@ void ovs_strlcpy(char *dst, const char *src, size_t size); void ovs_fatal(int err_no, const char *format, ...) PRINTF_FORMAT(2, 3) NO_RETURN; void ovs_error(int err_no, const char *format, ...) PRINTF_FORMAT(2, 3); +const char *ovs_retval_to_string(int); void ovs_hex_dump(FILE *, const void *, size_t, uintptr_t offset, bool ascii); bool str_to_int(const char *, int base, int *);