<commit_before>/* Minimal block driver for Mini-OS. 
 * Copyright (c) 2007-2008 <NAME>.
 * Based on netfront.c.
 */

#include <os.h>
#include <xenbus.h>
#include <events.h>
#include <errno.h>
#include <xen/io/blkif.h>
#include <gnttab.h>
#include <xmalloc.h>
#include <time.h>
#include <blkfront.h>
#include <lib.h>
#include <fcntl.h>

#ifndef HAVE_LIBC
#define strtoul simple_strtoul
#endif

/* Note: we generally don't need to disable IRQs since we hardly do anything in
 * the interrupt handler.  */

/* Note: we really suppose non-preemptive threads.  */

DECLARE_WAIT_QUEUE_HEAD(blkfront_queue);




#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE)
#define GRANT_INVALID_REF 0


struct blk_buffer {
    void* page;
    grant_ref_t gref;
};

struct blkfront_dev {
    domid_t dom;

    struct blkif_front_ring ring;
    grant_ref_t ring_ref;
    evtchn_port_t evtchn, local_port;
    blkif_vdev_t handle;

    char *nodename;
    char *backend;
    unsigned sector_size;
    unsigned sectors;
    int mode;
    int barrier;
    int flush;

#ifdef HAVE_LIBC
    int fd;
#endif
};

static inline int xenblk_rxidx(RING_IDX idx)
{
    return idx & (BLK_RING_SIZE - 1);
}<commit_msg>minios: drop unused xenblk_rxidx function Signed-off-by: <NAME> <<EMAIL>><commit_after>/* Minimal block driver for Mini-OS. 
 * Copyright (c) 2007-2008 <NAME>.
 * Based on netfront.c.
 */

#include <os.h>
#include <xenbus.h>
#include <events.h>
#include <errno.h>
#include <xen/io/blkif.h>
#include <gnttab.h>
#include <xmalloc.h>
#include <time.h>
#include <blkfront.h>
#include <lib.h>
#include <fcntl.h>

#ifndef HAVE_LIBC
#define strtoul simple_strtoul
#endif

/* Note: we generally don't need to disable IRQs since we hardly do anything in
 * the interrupt handler.  */

/* Note: we really suppose non-preemptive threads.  */

DECLARE_WAIT_QUEUE_HEAD(blkfront_queue);




#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE)
#define GRANT_INVALID_REF 0


struct blk_buffer {
    void* page;
    grant_ref_t gref;
};

struct blkfront_dev {
    domid_t dom;

    struct blkif_front_ring ring;
    grant_ref_t ring_ref;
    evtchn_port_t evtchn, local_port;
    blkif_vdev_t handle;

    char *nodename;
    char *backend;
    unsigned sector_size;
    unsigned sectors;
    int mode;
    int barrier;
    int flush;

#ifdef HAVE_LIBC
    int fd;
#endif
};
{'fraction_non_alphanumeric': 0.10975609756097561, 'fraction_numerical': 0.008830950378469302, 'mean_word_length': 3.7867203219315897, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '40650', 'n_tokens_mistral': 942, 'n_tokens_neox': 901, 'n_words': 242}