Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | drivers/block/drbd/drbd_receiver.c |
static int got_RqSReply(struct drbd_connection *connection,
struct packet_info *pi) {
struct drbd_peer_device *peer_device;
struct drbd_device *device;
struct p_req_state_reply *p = pi->data;
int retcode = be32_to_cpu(p->retcode);
peer_device = conn_peer_device(connection, pi->vnr);
... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_receiver.c |
static int got_NegDReply(struct drbd_connection *connection,
struct packet_info *pi) {
struct drbd_peer_device *peer_device;
struct drbd_device *device;
struct p_block_ack *p = pi->data;
sector_t sector = be64_to_cpu(p->sector);
peer_device = conn_peer_device(connection, pi->vnr);
... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_receiver.c |
static int got_BarrierAck(struct drbd_connection *connection,
struct packet_info *pi) {
struct p_barrier_ack *p = pi->data;
struct drbd_peer_device *peer_device;
int vnr;
tl_release(connection, p->barrier, be32_to_cpu(p->set_size));
rcu_read_lock();
idr_for_each_entry(&connectio... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_receiver.c | static int got_OVResult(struct drbd_connection *connection,
struct packet_info *pi) {
struct drbd_peer_device *peer_device;
struct drbd_device *device;
struct p_block_ack *p = pi->data;
struct drbd_device_work *dw;
sector_t sector;
int size;
peer_device = conn_peer_device(connecti... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_receiver.c |
static int got_skip(struct drbd_connection *connection,
struct packet_info *pi) {
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static struct drbd_request *drbd_req_new(struct drbd_device *device,
struct bio *bio_src) {
struct drbd_request *req;
req = mempool_alloc(&drbd_request_mempool, GFP_NOIO);
if (!req)
return NULL;
memset(req, 0, sizeof(*req));
req->rq_state = (bio_data_dir(bio_src)... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | void start_new_tl_epoch(struct drbd_connection *connection) {
if (connection->current_tle_writes == 0)
return;
connection->current_tle_writes = 0;
atomic_inc(&connection->current_tle_nr);
wake_all_senders(connection);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c |
void complete_master_bio(struct drbd_device *device, struct bio_and_error *m) {
if (unlikely(m->error))
m->bio->bi_status = errno_to_blk_status(m->error);
bio_endio(m->bio);
dec_ap_bio(device);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static void drbd_req_put_completion_ref(struct drbd_request *req,
struct bio_and_error *m, int put) {
struct drbd_device *device = req->device;
D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED));
if (!put)
return;
if (!atomic_sub_and_test(put, &req->completion_re... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c |
static void advance_conn_req_next(struct drbd_peer_device *peer_device,
struct drbd_request *req) {
struct drbd_connection *connection =
peer_device ? peer_device->connection : NULL;
struct drbd_request *iter = req;
if (!connection)
return;
if (connection->req_next !... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static void complete_conflicting_writes(struct drbd_request *req) {
DEFINE_WAIT(wait);
struct drbd_device *device = req->device;
struct drbd_interval *i;
sector_t sector = req->i.sector;
int size = req->i.size;
for (;;) {
drbd_for_each_overlap(i, &device->write_requests, sector, size) {
if (i->c... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static bool do_remote_read(struct drbd_request *req) {
struct drbd_device *device = req->device;
enum drbd_read_balancing rbm;
if (req->private_bio) {
if (!drbd_may_do_local_read(device, req->i.sector, req->i.size)) {
bio_put(req->private_bio);
req->private_bio = NULL;
put_ldev(device);
... | [
0,
1
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static int drbd_process_write_request(struct drbd_request *req) {
struct drbd_device *device = req->device;
int remote, send_oos;
remote = drbd_should_do_remote(device->state);
send_oos = drbd_should_send_out_of_sync(device->state);
if (unlikely(req->i.size == 0)) {
/* The only size==0 bios we expect ar... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static void drbd_unplug(struct blk_plug_cb *cb, bool from_schedule) {
struct drbd_plug_cb *plug = container_of(cb, struct drbd_plug_cb, cb);
struct drbd_resource *resource = plug->cb.data;
struct drbd_request *req = plug->most_recent_req;
kfree(cb);
if (!req)
return;
spin_lock_irq(&resource->req_lock)... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | static void submit_fast_path(struct drbd_device *device,
struct list_head *incoming) {
struct blk_plug plug;
struct drbd_request *req, *tmp;
blk_start_plug(&plug);
list_for_each_entry_safe(req, tmp, incoming, tl_requests) {
const int rw = bio_data_dir(req->master_bio);
if ... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.c | void drbd_submit_bio(struct bio *bio) {
struct drbd_device *device = bio->bi_bdev->bd_disk->private_data;
bio = bio_split_to_limits(bio);
D_ASSERT(device, IS_ALIGNED(bio->bi_iter.bi_size, 512));
inc_ap_bio(device);
__drbd_make_request(device, bio);
} | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_req.h | static inline int _req_mod(struct drbd_request *req, enum drbd_req_event what) {
struct drbd_device *device = req->device;
struct bio_and_error m;
int rv;
rv = __req_mod(req, what, &m);
if (m.bio)
complete_master_bio(device, &m);
return rv;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
void forget_state_change(struct drbd_state_change *state_change) {
unsigned int n;
if (!state_change)
return;
if (state_change->resource->resource)
kref_put(&state_change->resource->resource->kref, drbd_destroy_resource);
for (n = 0; n < state_change->n_devices; n++) {
struct drbd_device *device ... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
bool conn_all_vols_unconf(struct drbd_connection *connection) {
struct drbd_peer_device *peer_device;
bool rv = true;
int vnr;
rcu_read_lock();
idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
struct drbd_device *device = peer_device->device;
if (device->state.disk != D_DISKLESS ||
... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c | static enum drbd_role max_role(enum drbd_role role1, enum drbd_role role2) {
if (role1 == R_PRIMARY || role2 == R_PRIMARY)
return R_PRIMARY;
if (role1 == R_SECONDARY || role2 == R_SECONDARY)
return R_SECONDARY;
return R_UNKNOWN;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
void print_st_err(struct drbd_device *device, union drbd_state os,
union drbd_state ns, enum drbd_state_rv err) {
if (err == SS_IN_TRANSIENT_STATE)
return;
drbd_err(device, "State change failed: %s\n", drbd_set_st_err_str(err));
print_st(device, " state", os);
print_st(device, "wanted", n... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
static long print_state_change(char *pb, union drbd_state os,
union drbd_state ns,
enum chg_state_flags flags) {
char *pbp;
pbp = pb;
*pbp = 0;
if (ns.role != os.role && flags & CS_DC_ROLE)
pbp += sprintf(pbp, "role( %s -> %s ) ", drbd_role_str... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
static void drbd_pr_state_change(struct drbd_device *device,
union drbd_state os, union drbd_state ns,
enum chg_state_flags flags) {
char pb[300];
char *pbp = pb;
pbp += print_state_change(pbp, os, ns, flags ^ CS_DC_MASK);
if (ns.aftr_isp != o... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
static int w_after_state_ch(struct drbd_work *w, int unused) {
struct after_state_chg_work *ascw =
container_of(w, struct after_state_chg_work, w);
struct drbd_device *device = ascw->device;
after_state_ch(device, ascw->os, ascw->ns, ascw->flags, ascw->state_change);
forget_state_change(ascw->state_chan... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
static void abw_start_sync(struct drbd_device *device, int rv) {
if (rv) {
drbd_err(device, "Writing the bitmap failed not starting resync.\n");
_drbd_request_state(device, NS(conn, C_CONNECTED), CS_VERBOSE);
return;
}
switch (device->state.conn) {
case C_STARTING_SYNC_T:
_drbd_request_state(d... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c | int drbd_bitmap_io_from_worker(struct drbd_device *device,
int (*io_fn)(struct drbd_device *), char *why,
enum bm_flag flags) {
int rv;
D_ASSERT(device,
current == first_peer_device(device)->connection->worker.task);
atomic_inc(&device->su... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
int notify_device_state_change(
struct sk_buff *skb, unsigned int seq,
struct drbd_device_state_change *device_state_change,
enum drbd_notification_type type) {
struct drbd_device *device = device_state_change->device;
struct device_info device_info = {
.dev_disk_state = device_state_change->disk... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c | static bool lost_contact_to_peer_data(enum drbd_disk_state os,
enum drbd_disk_state ns) {
if ((os >= D_INCONSISTENT && os != D_UNKNOWN && os != D_OUTDATED) &&
(ns < D_INCONSISTENT || ns == D_UNKNOWN || ns == D_OUTDATED))
return true;
if (os == D_UNKNOWN &&
(ns ... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.c |
static enum drbd_state_rv
conn_is_valid_transition(struct drbd_connection *connection,
union drbd_state mask, union drbd_state val,
enum chg_state_flags flags) {
enum drbd_state_rv rv = SS_SUCCESS;
union drbd_state ns, os;
struct drbd_peer_device *peer_device;
... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_state.h | static inline int drbd_request_state(struct drbd_device *device,
union drbd_state mask,
union drbd_state val) {
return _drbd_request_state(device, mask, val, CS_VERBOSE + CS_ORDERED);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_vli.h | static inline int bitstream_get_bits(struct bitstream *bs, u64 *out, int bits) {
u64 val;
unsigned int n;
if (bits > 64)
return -EINVAL;
if (bs->cur.b + ((bs->cur.bit + bs->pad_bits + bits - 1) >> 3) - bs->buf >=
bs->buf_len)
bits = ((bs->buf_len - (bs->cur.b - bs->buf)) << 3) - bs->cur.bit -
... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | static void drbd_endio_read_sec_final(struct drbd_peer_request *peer_req)
__releases(local) {
unsigned long flags = 0;
struct drbd_peer_device *peer_device = peer_req->peer_device;
struct drbd_device *device = peer_device->device;
spin_lock_irqsave(&device->resource->req_lock, flags);
device->read_cnt +=... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | void drbd_request_endio(struct bio *bio) {
unsigned long flags;
struct drbd_request *req = bio->bi_private;
struct drbd_device *device = req->device;
struct bio_and_error m;
enum drbd_req_event what;
if (unlikely(req->rq_state & RQ_LOCAL_ABORTED)) {
if (drbd_ratelimit())
drbd_emerg(device, "delay... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest) {
SHASH_DESC_ON_STACK(desc, tfm);
struct bio_vec bvec;
struct bvec_iter iter;
desc->tfm = tfm;
crypto_shash_init(desc);
bio_for_each_segment(bvec, bio, iter) {
u8 *src;
src = bvec_kmap_local(&bvec);
crypto_shash_upd... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
int w_resync_timer(struct drbd_work *w, int cancel) {
struct drbd_device *device = container_of(w, struct drbd_device, resync_work);
switch (device->state.conn) {
case C_VERIFY_S:
make_ov_request(device, cancel);
break;
case C_SYNC_TARGET:
make_resync_request(device, cancel);
break;
}
ret... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
static void fifo_set(struct fifo_buffer *fb, int value) {
int i;
for (i = 0; i < fb->size; i++)
fb->values[i] = value;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
static int fifo_push(struct fifo_buffer *fb, int value) {
int ov;
ov = fb->values[fb->head_index];
fb->values[fb->head_index++] = value;
if (fb->head_index >= fb->size)
fb->head_index = 0;
return ov;
} | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
int w_ov_finished(struct drbd_work *w, int cancel) {
struct drbd_device_work *dw = container_of(w, struct drbd_device_work, w);
struct drbd_device *device = dw->device;
kfree(dw);
ov_out_of_sync_print(device);
drbd_resync_finished(device);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | int w_e_end_rsdata_req(struct drbd_work *w, int cancel) {
struct drbd_peer_request *peer_req =
container_of(w, struct drbd_peer_request, w);
struct drbd_peer_device *peer_device = peer_req->peer_device;
struct drbd_device *device = peer_device->device;
int err;
if (unlikely(cancel)) {
drbd_free_pee... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
static int pd_send_unplug_remote(struct drbd_peer_device *pd) {
struct drbd_socket *sock = &pd->connection->data;
if (!drbd_prepare_command(pd, sock))
return -EIO;
return drbd_send_command(pd, sock, P_UNPLUG_REMOTE, 0, NULL, 0);
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
int w_send_write_hint(struct drbd_work *w, int cancel) {
struct drbd_device *device = container_of(w, struct drbd_device, unplug_work);
if (cancel)
return 0;
return pd_send_unplug_remote(first_peer_device(device));
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
static void re_init_if_first_write(struct drbd_connection *connection,
unsigned int epoch) {
if (!connection->send.seen_any_write_yet) {
connection->send.seen_any_write_yet = true;
connection->send.current_epoch_nr = epoch;
connection->send.current_epoch_writes = 0;
... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | int w_send_out_of_sync(struct drbd_work *w, int cancel) {
struct drbd_request *req = container_of(w, struct drbd_request, w);
struct drbd_device *device = req->device;
struct drbd_peer_device *const peer_device = first_peer_device(device);
struct drbd_connection *const connection = peer_device->connection;
in... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
void suspend_other_sg(struct drbd_device *device) {
lock_all_resources();
drbd_pause_after(device);
unlock_all_resources();
} | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | void drbd_rs_controller_reset(struct drbd_device *device) {
struct gendisk *disk = device->ldev->backing_bdev->bd_disk;
struct fifo_buffer *plan;
atomic_set(&device->rs_sect_in, 0);
atomic_set(&device->rs_sect_ev, 0);
device->rs_in_flight = 0;
device->rs_last_events = (int)part_stat_read_accum(disk->part0,... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | static bool use_checksum_based_resync(struct drbd_connection *connection,
struct drbd_device *device) {
bool csums_after_crash_only;
rcu_read_lock();
csums_after_crash_only =
rcu_dereference(connection->net_conf)->csums_after_crash_only;
rcu_read_unlock();
return co... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | static void update_on_disk_bitmap(struct drbd_device *device,
bool resync_done) {
struct sib_info sib = {
.sib_reason = SIB_SYNC_PROGRESS,
};
device->rs_last_bcast = jiffies;
if (!get_ldev(device))
return;
drbd_bm_write_lazy(device, 0);
if (resync_done && is_syn... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c | void __update_timing_details(struct drbd_thread_timing_details *tdp,
unsigned int *cb_nr, void *cb, const char *fn,
const unsigned int line) {
unsigned int i = *cb_nr % DRBD_THREAD_DETAILS_HIST;
struct drbd_thread_timing_details *td = tdp + i;
td->start_j... | [
1,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
static void do_device_work(struct drbd_device *device,
const unsigned long todo) {
if (test_bit(MD_SYNC, &todo))
do_md_sync(device);
if (test_bit(RS_DONE, &todo) || test_bit(RS_PROGRESS, &todo))
update_on_disk_bitmap(device, test_bit(RS_DONE, &todo));
if (test_bit(GO_DISKLESS, ... | [
0,
0
] |
Linux Kernel | drivers/block/drbd/drbd_worker.c |
static unsigned long get_work_bits(unsigned long *flags) {
unsigned long old, new;
do {
old = *flags;
new = old & ~DRBD_DEVICE_WORK_MASK;
} while (cmpxchg(flags, old, new) != old);
return old & DRBD_DEVICE_WORK_MASK;
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static inline void fallback_on_nodma_alloc(char **addr, size_t l) {
#ifdef FLOPPY_CAN_FALLBACK_ON_NODMA
if (*addr)
return;
if (can_use_virtual_dma != 2)
return; /* no fallback allowed */
pr_info("DMA memory shortage. Temporarily falling back on virtual DMA\n");
*addr = (char *)nodma_mem_alloc(l);
#else
... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static inline void set_debugt(void) { debugtimer = jiffies; } | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static inline void debugt(const char *func, const char *msg) {}
#endif | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void is_alive(const char *func, const char *message) {
if (test_bit(0, &fdc_busy) && command_status < 2 &&
!delayed_work_pending(&fd_timeout)) {
DPRINT("%s: timeout handler died. %s\n", func, message);
}
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void twaddle(int fdc, int drive) {
if (drive_params[drive].select_delay)
return;
fdc_outb(fdc_state[fdc].dor & ~(0x10 << UNIT(drive)), fdc, FD_DOR);
fdc_outb(fdc_state[fdc].dor, fdc, FD_DOR);
drive_state[drive].select_date = jiffies;
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void reset_fdc_info(int fdc, int mode) {
int drive;
fdc_state[fdc].spec1 = fdc_state[fdc].spec2 = -1;
fdc_state[fdc].need_configure = 1;
fdc_state[fdc].perp_mode = 1;
fdc_state[fdc].rawcmd = 0;
for (drive = 0; drive < N_DRIVE; drive++)
if (FDC(drive) == fdc && (mode || drive_state[drive].track !... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c | static void floppy_off(unsigned int drive) {
unsigned long volatile delta;
int fdc = FDC(drive);
if (!(fdc_state[fdc].dor & (0x10 << UNIT(drive))))
return;
del_timer(motor_off_timer + drive);
if (drive_params[drive].rps) {
delta = jiffies - drive_state[drive].first_read_date + HZ -
driv... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void floppy_work_workfn(struct work_struct *work) { floppy_work_fn(); } | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void setup_DMA(void) {
unsigned long f;
if (raw_cmd->length == 0) {
print_hex_dump(KERN_INFO, "zero dma transfer size: ", DUMP_PREFIX_NONE, 16,
1, raw_cmd->fullcmd, raw_cmd->cmd_count, false);
cont->done(0);
fdc_state[current_fdc].reset = 1;
return;
}
if (((unsigned l... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static int need_more_output(int fdc) {
int status = wait_til_ready(fdc);
if (status < 0)
return -1;
if (is_ready_state(status))
return MORE_OUTPUT;
return result(fdc);
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static int fdc_dtr(void) {
if ((raw_cmd->rate & 3) == fdc_state[current_fdc].dtr)
return 0;
/* Set dtr */
fdc_outb(raw_cmd->rate & 3, current_fdc, FD_DCR);
/* TODO: some FDC/drive combinations (C&T 82C711 with TEAC 1.2MB)
* need a stabilization period of several milliseconds to be
* enforced after ... | [
1,
1
] |
Linux Kernel | drivers/block/floppy.c |
static void tell_sector(void) {
pr_cont(": track %d, head %d, sector %d, size %d", reply_buffer[R_TRACK],
reply_buffer[R_HEAD], reply_buffer[R_SECTOR],
reply_buffer[R_SIZECODE]);
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void setup_rw_floppy(void) {
int i;
int r;
int flags;
unsigned long ready_date;
void (*function)(void);
flags = raw_cmd->flags;
if (flags & (FD_RAW_READ | FD_RAW_WRITE))
flags |= FD_RAW_INTR;
if ((flags & FD_RAW_SPIN) && !(flags & FD_RAW_NO_MOTOR)) {
ready_date = drive_state[current_dri... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void recal_interrupt(void) {
debugt(__func__, "");
if (inr != 2)
fdc_state[current_fdc].reset = 1;
else if (reply_buffer[ST0] & ST0_ECE) {
switch (drive_state[current_drive].track) {
case NEED_1_RECAL:
debugt(__func__, "need 1 recal");
cont->error();
cont->redo();
retur... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void print_result(char *message, int inr) {
int i;
DPRINT("%s ", message);
if (inr >= 0)
for (i = 0; i < inr; i++)
pr_cont("repl[%d]=%x ", i, reply_buffer[i]);
pr_cont("\n");
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void reset_interrupt(void) {
debugt(__func__, "");
result(current_fdc);
if (fdc_state[current_fdc].reset) {
pr_info("reset set in interrupt, calling %ps\n", cont->error);
cont->error(); /* a reset just after a reset. BAD! */
}
cont->redo();
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static int start_motor(void (*function)(void)) {
int mask;
int data;
mask = 0xfc;
data = UNIT(current_drive);
if (!(raw_cmd->flags & FD_RAW_NO_MOTOR)) {
if (!(fdc_state[current_fdc].dor & (0x10 << UNIT(current_drive)))) {
set_debugt();
drive_state[current_drive].first_read_date = 0;
/*... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c | static void floppy_ready(void) {
if (fdc_state[current_fdc].reset) {
reset_fdc();
return;
}
if (start_motor(floppy_ready))
return;
if (fdc_dtr())
return;
debug_dcl(drive_params[current_drive].flags,
"calling disk change from floppy_ready\n");
if (!(raw_cmd->flags & FD_RAW_NO_MOT... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void set_floppy(int drive) {
int type = ITYPE(drive_state[drive].fd_device);
if (type)
_floppy = floppy_type + type;
else
_floppy = current_type[drive];
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void format_interrupt(void) {
switch (interpret_errors()) {
case 1:
cont->error();
break;
case 2:
break;
case 0:
cont->done(1);
}
cont->redo();
}
#define FM_MODE(x, y) ((y) & ~(((x)->rate & 0x80) >> 1))
#define CT(x) ((x) | 0xc0) | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c | static void virtualdmabug_workaround(void) {
int hard_sectors;
int end_sector;
if (CT(raw_cmd->cmd[COMMAND]) == FD_WRITE) {
raw_cmd->cmd[COMMAND] &= ~0x80;
hard_sectors = raw_cmd->length >> (7 + raw_cmd->cmd[SIZECODE]);
end_sector = raw_cmd->cmd[SECTOR] + hard_sectors - 1;
if (end_sector > raw_c... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c | static void process_fd_request(void) {
cont = &rw_cont;
schedule_bh(redo_fd_request);
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static int poll_drive(bool interruptible, int flag) {
raw_cmd = &default_raw_cmd;
raw_cmd->flags = flag;
raw_cmd->track = 0;
raw_cmd->cmd_count = 0;
cont = &poll_cont;
debug_dcl(drive_params[current_drive].flags,
"setting NEWCHANGE in poll_drive\n");
set_bit(FD_DISK_NEWCHANGE_BIT, &drive_stat... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static const char *drive_name(int type, int drive) {
struct floppy_struct *floppy;
if (type)
floppy = floppy_type + type;
else {
if (drive_params[drive].native_format)
floppy = floppy_type + drive_params[drive].native_format;
else
return "(null)";
}
if (floppy->name)
return flopp... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void raw_cmd_done(int flag) {
if (!flag) {
raw_cmd->flags |= FD_RAW_FAILURE;
raw_cmd->flags |= FD_RAW_HARDFAILURE;
} else {
raw_cmd->reply_count = inr;
if (raw_cmd->reply_count > FD_RAW_REPLY_SIZE)
raw_cmd->reply_count = 0;
memcpy(raw_cmd->reply, reply_buffer, raw_cmd->reply_count);... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void raw_cmd_free(struct floppy_raw_cmd **ptr) {
struct floppy_raw_cmd *next;
struct floppy_raw_cmd *this;
this = *ptr;
*ptr = NULL;
while (this) {
if (this->buffer_length) {
fd_dma_mem_free((unsigned long)this->kernel_data, this->buffer_length);
this->buffer_length = 0;
}
nex... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static int raw_cmd_ioctl(int cmd, void __user *param) {
struct floppy_raw_cmd *my_raw_cmd;
int drive;
int ret2;
int ret;
if (fdc_state[current_fdc].rawcmd <= 1)
fdc_state[current_fdc].rawcmd = 1;
for (drive = 0; drive < N_DRIVE; drive++) {
if (FDC(drive) != current_fdc)
continue;
if (dri... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c | static int floppy_raw_cmd_ioctl(int type, int drive, int cmd,
void __user *param) {
int ret;
pr_warn_once("Note: FDRAWCMD is deprecated and will be removed from the "
"kernel in the near future.\n");
if (type)
return -EINVAL;
if (lock_fdc(drive))
return -... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static int invalidate_drive(struct block_device *bdev) {
set_bit((long)bdev->bd_disk->private_data, &fake_change);
process_fd_request();
if (bdev_check_media_change(bdev))
floppy_revalidate(bdev->bd_disk);
return 0;
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static int get_floppy_geometry(int drive, int type, struct floppy_struct **g) {
if (type)
*g = &floppy_type[type];
else {
if (lock_fdc(drive))
return -EINTR;
if (poll_drive(false, 0) == -EINTR)
return -EINTR;
process_fd_request();
*g = current_type[drive];
}
if (!*g)
return ... | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
unsigned long param) {
int ret;
mutex_lock(&floppy_mutex);
ret = fd_locked_ioctl(bdev, mode, cmd, param);
mutex_unlock(&floppy_mutex);
return ret;
}
#ifdef CONFIG_COMPAT | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static int compat_getdrvstat(int drive, bool poll,
struct compat_floppy_drive_struct __user *arg) {
struct compat_floppy_drive_struct v;
memset(&v, 0, sizeof(struct compat_floppy_drive_struct));
mutex_lock(&floppy_mutex);
if (poll) {
if (lock_fdc(drive))
goto Eintr;
... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c |
static int compat_werrorget(int drive,
struct compat_floppy_write_errors __user *arg) {
struct compat_floppy_write_errors v32;
struct floppy_write_errors v;
memset(&v32, 0, sizeof(struct compat_floppy_write_errors));
mutex_lock(&floppy_mutex);
v = write_errors[drive];
mutex_unl... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c | static void __init config_types(void) {
bool has_drive = false;
int drive;
drive = 0;
if (!drive_params[drive].cmos)
drive_params[drive].cmos = FLOPPY0_TYPE;
drive = 1;
if (!drive_params[drive].cmos)
drive_params[drive].cmos = FLOPPY1_TYPE;
/* FIXME: additional physical CMOS drive detection shou... | [
1,
1
] |
Linux Kernel | drivers/block/floppy.c |
static ssize_t floppy_cmos_show(struct device *dev,
struct device_attribute *attr, char *buf) {
struct platform_device *p = to_platform_device(dev);
int drive;
drive = p->id;
return sprintf(buf, "%X\n", drive_params[drive].cmos);
} | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c |
static bool floppy_available(int drive) {
if (!(allowed_drive_mask & (1 << drive)))
return false;
if (fdc_state[FDC(drive)].version == FDC_NONE)
return false;
return true;
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static int floppy_alloc_disk(unsigned int drive, unsigned int type) {
struct gendisk *disk;
disk = blk_mq_alloc_disk(&tag_sets[drive], NULL);
if (IS_ERR(disk))
return PTR_ERR(disk);
blk_queue_max_hw_sectors(disk->queue, 64);
disk->major = FLOPPY_MAJOR;
disk->first_minor = TOMINOR(drive) | (type << 2);... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void floppy_release_regions(int fdc) {
floppy_release_allocated_regions(fdc, ARRAY_END(io_regions));
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c |
static void floppy_release_irq_and_dma(void) {
int fdc;
#ifndef __sparc__
int drive;
#endif
long tmpsize;
unsigned long tmpaddr;
if (!atomic_dec_and_test(&usage_count))
return;
if (irqdma_allocated) {
fd_disable_dma();
fd_free_dma();
fd_free_irq();
irqdma_allocated = 0;
}
set_dor(... | [
1,
0
] |
Linux Kernel | drivers/block/floppy.c |
static int __init floppy_module_init(void) {
if (floppy)
parse_floppy_cfg_string(floppy);
return floppy_init();
} | [
0,
0
] |
Linux Kernel | drivers/block/floppy.c | static void __exit floppy_module_exit(void) {
int drive, i;
unregister_blkdev(FLOPPY_MAJOR, "fd");
platform_driver_unregister(&floppy_driver);
destroy_workqueue(floppy_wq);
for (drive = 0; drive < N_DRIVE; drive++) {
del_timer_sync(&motor_off_timer[drive]);
if (floppy_available(drive)) {
for... | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static int loop_global_lock_killable(struct loop_device *lo, bool global) {
int err;
if (global) {
err = mutex_lock_killable(&loop_validate_mutex);
if (err)
return err;
}
err = mutex_lock_killable(&lo->lo_mutex);
if (err && global)
mutex_unlock(&loop_validate_mutex);
return err;
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c | static loff_t get_size(loff_t offset, loff_t sizelimit, struct file *file) {
loff_t loopsize;
loopsize = i_size_read(file->f_mapping->host);
if (offset > 0)
loopsize -= offset;
/* offset is beyond i_size, weird but possible */
if (loopsize < 0)
return 0;
if (sizelimit > 0 && sizelimit < loopsize)
... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c | static void loop_set_size(struct loop_device *lo, loff_t size) {
if (!set_capacity_and_notify(lo->lo_disk, size))
kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static void lo_rw_aio_do_completion(struct loop_cmd *cmd) {
struct request *rq = blk_mq_rq_from_pdu(cmd);
if (!atomic_dec_and_test(&cmd->ref))
return;
kfree(cmd->bvec);
cmd->bvec = NULL;
if (likely(!blk_should_fake_timeout(rq->q)))
blk_mq_complete_request(rq);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static void lo_rw_aio_complete(struct kiocb *iocb, long ret) {
struct loop_cmd *cmd = container_of(iocb, struct loop_cmd, iocb);
cmd->ret = ret;
lo_rw_aio_do_completion(cmd);
} | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static inline void loop_update_dio(struct loop_device *lo) {
__loop_update_dio(lo,
(lo->lo_backing_file->f_flags & O_DIRECT) | lo->use_dio);
} | [
1,
0
] |
Linux Kernel | drivers/block/loop.c | static ssize_t loop_attr_show(struct device *dev, char *page,
ssize_t (*callback)(struct loop_device *,
char *)) {
struct gendisk *disk = dev_to_disk(dev);
struct loop_device *lo = disk->private_data;
return callback(lo, page);
}
#d... | [
0,
0
] |
Linux Kernel | drivers/block/loop.c |
static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) {
ssize_t ret;
char *p = NULL;
spin_lock_irq(&lo->lo_lock);
if (lo->lo_backing_file)
p = file_path(lo->lo_backing_file, buf, PAGE_SIZE - 1);
spin_unlock_irq(&lo->lo_lock);
if (IS_ERR_OR_NULL(p))
ret = PTR_ERR(p);
else... | [
1,
0
] |
Linux Kernel | drivers/block/loop.c |
static ssize_t loop_attr_offset_show(struct loop_device *lo, char *buf) {
return sysfs_emit(buf, "%llu\n", (unsigned long long)lo->lo_offset);
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.