/*
 * 9p backend
 *
 * Copyright IBM, Corp. 2010
 *
 * Authors:
 *  Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
 *  Venkateswararao Jujjuri(JV) <jvrao@linux.vnet.ibm.com>
 *
 * This work is licensed under the terms of the GNU GPL, version 2.  See
 * the COPYING file in the top-level directory.
 *
 */

#ifndef _QEMU_9P_COTH_H
#define _QEMU_9P_COTH_H

#include "qemu/thread.h"
#include "qemu/coroutine.h"
#include "virtio-9p.h"

/*
 * we want to use bottom half because we want to make sure the below
 * sequence of events.
 *
 *   1. Yield the coroutine in the QEMU thread.
 *   2. Submit the coroutine to a worker thread.
 *   3. Enter the coroutine in the worker thread.
 * we cannot swap step 1 and 2, because that would imply worker thread
 * can enter coroutine while step1 is still running
 */
#define v9fs_co_run_in_worker(code_block)                               \
    do {                                                                \
        QEMUBH *co_bh;                                                  \
        co_bh = qemu_bh_new(co_run_in_worker_bh,                        \
                            qemu_coroutine_self());                     \
        qemu_bh_schedule(co_bh);                                        \
        /*                                                              \
         * yield in qemu thread and re-enter back                       \
         * in worker thread                                             \
         */                                                             \
        qemu_coroutine_yield();                                         \
        qemu_bh_delete(co_bh);                                          \
        code_block;                                                     \
        /* re-enter back to qemu thread */                              \
        qemu_coroutine_yield();                                         \
    } while (0)

extern void co_run_in_worker_bh(void *);
extern int v9fs_init_worker_threads(void);
extern int v9fs_co_readlink(V9fsPDU *, V9fsPath *, V9fsString *);
extern int v9fs_co_readdir_r(V9fsPDU *, V9fsFidState *,
                           struct dirent *, struct dirent **result);
extern off_t v9fs_co_telldir(V9fsPDU *, V9fsFidState *);
extern void v9fs_co_seekdir(V9fsPDU *, V9fsFidState *, off_t);
extern void v9fs_co_rewinddir(V9fsPDU *, V9fsFidState *);
extern int v9fs_co_statfs(V9fsPDU *, V9fsPath *, struct statfs *);
extern int v9fs_co_lstat(V9fsPDU *, V9fsPath *, struct stat *);
extern int v9fs_co_chmod(V9fsPDU *, V9fsPath *, mode_t);
extern int v9fs_co_utimensat(V9fsPDU *, V9fsPath *, struct timespec [2]);
extern int v9fs_co_chown(V9fsPDU *, V9fsPath *, uid_t, gid_t);
extern int v9fs_co_truncate(V9fsPDU *, V9fsPath *, off_t);
extern int v9fs_co_llistxattr(V9fsPDU *, V9fsPath *, void *, size_t);
extern int v9fs_co_lgetxattr(V9fsPDU *, V9fsPath *,
                             V9fsString *, void *, size_t);
extern int v9fs_co_mknod(V9fsPDU *, V9fsFidState *, V9fsString *, uid_t,
                         gid_t, dev_t, mode_t, struct stat *);
extern int v9fs_co_mkdir(V9fsPDU *, V9fsFidState *, V9fsString *,
                         mode_t, uid_t, gid_t, struct stat *);
extern int v9fs_co_remove(V9fsPDU *, V9fsPath *);
extern int v9fs_co_rename(V9fsPDU *, V9fsPath *, V9fsPath *);
extern int v9fs_co_unlinkat(V9fsPDU *, V9fsPath *, V9fsString *, int flags);
extern int v9fs_co_renameat(V9fsPDU *, V9fsPath *, V9fsString *,
                            V9fsPath *, V9fsString *);
extern int v9fs_co_fstat(V9fsPDU *, V9fsFidState *, struct stat *);
extern int v9fs_co_opendir(V9fsPDU *, V9fsFidState *);
extern int v9fs_co_open(V9fsPDU *, V9fsFidState *, int);
extern int v9fs_co_open2(V9fsPDU *, V9fsFidState *, V9fsString *,
                         gid_t, int, int, struct stat *);
extern int v9fs_co_lsetxattr(V9fsPDU *, V9fsPath *, V9fsString *,
                             void *, size_t, int);
extern int v9fs_co_lremovexattr(V9fsPDU *, V9fsPath *, V9fsString *);
extern int v9fs_co_closedir(V9fsPDU *, V9fsFidOpenState *);
extern int v9fs_co_close(V9fsPDU *, V9fsFidOpenState *);
extern int v9fs_co_fsync(V9fsPDU *, V9fsFidState *, int);
extern int v9fs_co_symlink(V9fsPDU *, V9fsFidState *, V9fsString *,
                           const char *, gid_t, struct stat *);
extern int v9fs_co_link(V9fsPDU *, V9fsFidState *,
                        V9fsFidState *, V9fsString *);
extern int v9fs_co_pwritev(V9fsPDU *, V9fsFidState *,
                           struct iovec *, int, int64_t);
extern int v9fs_co_preadv(V9fsPDU *, V9fsFidState *,
                          struct iovec *, int, int64_t);
extern int v9fs_co_name_to_path(V9fsPDU *, V9fsPath *,
                                const char *, V9fsPath *);
extern int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t,
                          V9fsStatDotl *v9stat);

#endif
