1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-27 16:39:08 +00:00

Remove "zfs:" prefix from lock and condvar names and also skip non-letter

characters (mostly "&"). Because top(1) shows only first six characters of
wait channel, without this change we saw only one meaningful character.

Requested by:	kris & others
MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2007-11-05 18:40:55 +00:00
parent 605385f843
commit 171eb887e9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173371
6 changed files with 48 additions and 6 deletions

View File

@ -45,8 +45,15 @@ typedef enum {
} kcv_type_t;
#define zfs_cv_init(cv, name, type, arg) do { \
const char *_name; \
ASSERT((type) == CV_DEFAULT); \
cv_init((cv), "zfs:" #cv); \
for (_name = #cv; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
} \
if (*_name == '\0') \
_name = #cv; \
cv_init((cv), _name); \
} while (0)
#define cv_init(cv, name, type, arg) zfs_cv_init((cv), (name), (type), (arg))

View File

@ -53,11 +53,18 @@ typedef struct sx kmutex_t;
#endif
#define mutex_init(lock, desc, type, arg) do { \
const char *_name; \
ASSERT((type) == MUTEX_DEFAULT); \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
sx_init_flags((lock), "zfs:" #lock, MUTEX_FLAGS); \
for (_name = #lock; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
} \
if (*_name == '\0') \
_name = #lock; \
sx_init_flags((lock), _name, MUTEX_FLAGS); \
} while (0)
#define mutex_destroy(lock) sx_destroy(lock)
#define mutex_enter(lock) sx_xlock(lock)

View File

@ -60,10 +60,17 @@ typedef struct sx krwlock_t;
#define RW_ISWRITER(x) (rw_iswriter(x))
#define rw_init(lock, desc, type, arg) do { \
const char *_name; \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
sx_init_flags((lock), "zfs:" #lock, RW_FLAGS); \
for (_name = #lock; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
} \
if (*_name == '\0') \
_name = #lock; \
sx_init_flags((lock), _name, RW_FLAGS); \
} while (0)
#define rw_destroy(lock) sx_destroy(lock)
#define rw_enter(lock, how) do { \

View File

@ -45,8 +45,15 @@ typedef enum {
} kcv_type_t;
#define zfs_cv_init(cv, name, type, arg) do { \
const char *_name; \
ASSERT((type) == CV_DEFAULT); \
cv_init((cv), "zfs:" #cv); \
for (_name = #cv; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
} \
if (*_name == '\0') \
_name = #cv; \
cv_init((cv), _name); \
} while (0)
#define cv_init(cv, name, type, arg) zfs_cv_init((cv), (name), (type), (arg))

View File

@ -53,11 +53,18 @@ typedef struct sx kmutex_t;
#endif
#define mutex_init(lock, desc, type, arg) do { \
const char *_name; \
ASSERT((type) == MUTEX_DEFAULT); \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
sx_init_flags((lock), "zfs:" #lock, MUTEX_FLAGS); \
for (_name = #lock; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
} \
if (*_name == '\0') \
_name = #lock; \
sx_init_flags((lock), _name, MUTEX_FLAGS); \
} while (0)
#define mutex_destroy(lock) sx_destroy(lock)
#define mutex_enter(lock) sx_xlock(lock)

View File

@ -60,10 +60,17 @@ typedef struct sx krwlock_t;
#define RW_ISWRITER(x) (rw_iswriter(x))
#define rw_init(lock, desc, type, arg) do { \
const char *_name; \
KASSERT(((lock)->lock_object.lo_flags & LO_ALLMASK) != \
LO_EXPECTED, ("lock %s already initialized", #lock)); \
bzero((lock), sizeof(struct sx)); \
sx_init_flags((lock), "zfs:" #lock, RW_FLAGS); \
for (_name = #lock; *_name != '\0'; _name++) { \
if (*_name >= 'a' && *_name <= 'z') \
break; \
} \
if (*_name == '\0') \
_name = #lock; \
sx_init_flags((lock), _name, RW_FLAGS); \
} while (0)
#define rw_destroy(lock) sx_destroy(lock)
#define rw_enter(lock, how) do { \