/* exec.c */
int pm_exec(endpoint_t proc_e, vir_bytes path, size_t path_len, vir_bytes frame,
size_t frame_len, vir_bytes *pc, vir_bytes *newsp, int flags);
-#define check_bsf_lock() do { \
- assert(mutex_trylock(&bsf_lock) == 0); \
- unlock_bsf(); \
- } while(0)
/* filedes.c */
void *do_filp_gc(void *arg);
int do_getdents(void);
void lock_bsf(void);
void unlock_bsf(void);
+void check_bsf_lock(void);
int do_read_write(int rw_flag);
int read_write(int rw_flag, struct filp *f, char *buffer, size_t nbytes,
endpoint_t for_e);
panic("failed to unlock block special file lock");
}
+/*===========================================================================*
+ * check_bsf *
+ *===========================================================================*/
+void check_bsf_lock(void)
+{
+ int r = mutex_trylock(&bsf_lock);
+
+ if (r == -EBUSY)
+ panic("bsf_lock locked");
+ else if (r != 0)
+ panic("bsf_lock weird state");
+
+ /* r == 0 */
+ unlock_bsf();
+}
+
/*===========================================================================*
* do_read_write *
*===========================================================================*/