X-Git-Url: http://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fopr%2Fopr.h;h=1130b335a82d3773acdcebcc6265e4324497858e;hp=a6aaaf2feff5b759cd13921ec9bdb4ed28b8ded7;hb=48fbb45967381f10df092a1ec18b5fb820387e05;hpb=04661c4139b3f0bc7d44a43160c9a0ac1405ca5e diff --git a/src/opr/opr.h b/src/opr/opr.h index a6aaaf2..1130b33 100644 --- a/src/opr/opr.h +++ b/src/opr/opr.h @@ -17,7 +17,6 @@ extern void opr_NTAbort(void); #endif extern void opr_AssertionFailed(const char *, int) AFS_NORETURN; -extern void opr_AssertFailU(const char *, const char *, int) AFS_NORETURN; /* opr_Assert is designed to work in a similar way to the operating * system's assert function. This means that in future, it may compile @@ -54,6 +53,13 @@ extern void opr_AssertFailU(const char *, const char *, int) AFS_NORETURN; # define opr_Verify(ex) __opr_Verify(ex) #endif +/* opr_StaticAssert is a static build-time assertion, to assert certain + * static values (such as sizeof results). If the assertion fails, the + * build will fail. */ + +#define opr_StaticAssert(ex) \ + ((void)(sizeof(char[1 - 2 * !(ex)]))) + /* casestrcpy.c */ #define lcstring opr_lcstring #define ucstring opr_ucstring @@ -64,8 +70,38 @@ extern void opr_AssertFailU(const char *, const char *, int) AFS_NORETURN; extern char *opr_lcstring(char *d, const char *s, int n) AFS_NONNULL((1,2)); extern char *opr_ucstring(char *d, const char *s, int n) AFS_NONNULL((1,2)); -extern void opr_stolower(char *s) AFS_NONNULL(()); -extern void opr_stoupper(char *s) AFS_NONNULL(()); +extern void opr_stolower(char *s) AFS_NONNULL((1)); +extern void opr_stoupper(char *s) AFS_NONNULL((1)); extern char *opr_strcompose(char *buf, size_t len, ...) AFS_NONNULL((1)); +/* threadname.c */ + +#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV) +extern void opr_threadname_set(const char *threadname); +#else +static_inline void +opr_threadname_set(const char *threadname) +{ + /* noop */ +} +#endif + +/* cache.c */ + +struct opr_cache_opts { + afs_uint32 max_entries; + afs_uint32 n_buckets; +}; +struct opr_cache; + +extern int opr_cache_init(struct opr_cache_opts *opts, + struct opr_cache **a_cache) AFS_NONNULL(); +extern void opr_cache_free(struct opr_cache **a_cache) AFS_NONNULL(); + +extern int opr_cache_get(struct opr_cache *cache, void *key_buf, + size_t key_len, void *val_buf, size_t *a_val_len) + AFS_NONNULL((4,5)); +extern void opr_cache_put(struct opr_cache *cache, void *key_buf, + size_t key_len, void *val_buf, size_t val_len); + #endif