]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - include/linux/kernel.h
Update bcachefs sources to 15f6e66e86 bcachefs: pass around bset_tree less
[bcachefs-tools-debian] / include / linux / kernel.h
index dc778f1c88408656ff77ae6405448ebc8555a5f1..a281edcf40baa6589e5e56c9e0adf4c0be89dc80 100644 (file)
 #define swap(a, b) \
        do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
 
+/* This counts to 12. Any more, it will return 13th argument. */
+#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n
+#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+
 #define _RET_IP_               (unsigned long)__builtin_return_address(0)
 #define _THIS_IP_  ({ __label__ __here; __here: (unsigned long)&&__here; })
 
 #define cpu_relax()            do {} while (0)
 #define cpu_relax_lowlatency() do {} while (0)
 
-__printf(1, 2)
-static inline void panic(const char *fmt, ...)
-{
-       va_list args;
-
-       va_start(args, fmt);
-       vprintf(fmt, args);
-       va_end(args);
-
-       BUG();
-}
+#define panic(fmt, ...)                                        \
+do {                                                   \
+       printf(fmt, ##__VA_ARGS__);                     \
+       BUG();                                          \
+} while (0)
 
 unsigned long simple_strtoul(const char *,char **,unsigned int);
 long simple_strtol(const char *,char **,unsigned int);
@@ -228,4 +226,23 @@ static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *
         BUILD_BUG_ON_ZERO((perms) & 2) +                                       \
         (perms))
 
+/* The hash is always the low bits of hash_len */
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ #define HASH_LEN_DECLARE u32 hash; u32 len
+#else
+ #define HASH_LEN_DECLARE u32 len; u32 hash
+#endif
+
+struct qstr {
+       union {
+               struct {
+                       HASH_LEN_DECLARE;
+               };
+               u64 hash_len;
+       };
+       const unsigned char *name;
+};
+
+#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
+
 #endif