Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | arch/um/drivers/net_kern.c |
static void uml_net_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) {
strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
} | [
1,
0
] |
Linux Kernel | arch/um/drivers/net_kern.c |
static void net_device_release(struct device *dev) {
struct uml_net *device = dev_get_drvdata(dev);
struct net_device *netdev = device->dev;
struct uml_net_private *lp = netdev_priv(netdev);
if (lp->remove != NULL)
(*lp->remove)(&lp->user);
list_del(&device->list);
kfree(device);
free_netdev(netdev)... | [
0,
0
] |
Linux Kernel | arch/um/drivers/net_kern.c |
static int net_remove(int n, char **error_out) {
struct uml_net *device;
struct net_device *dev;
struct uml_net_private *lp;
device = find_device(n);
if (device == NULL)
return -ENODEV;
dev = device->dev;
lp = netdev_priv(dev);
if (lp->fd > 0)
return -EBUSY;
unregister_netdev(dev);
platfo... | [
0,
0
] |
Linux Kernel | arch/um/drivers/net_kern.c |
int dev_netmask(void *d, void *m) {
struct net_device *dev = d;
struct in_device *ip = dev->ip_ptr;
struct in_ifaddr *in;
__be32 *mask_out = m;
if (ip == NULL)
return 1;
in = ip->ifa_list;
if (in == NULL)
return 1;
*mask_out = in->ifa_mask;
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/net_kern.c |
int tap_setup_common(char *str, char *type, char **dev_name, char **mac_out,
char **gate_addr) {
char *remain;
remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL);
if (remain != NULL) {
printk(KERN_ERR "tap_setup_common - Extra garbage on "
"specification... | [
0,
0
] |
Linux Kernel | arch/um/drivers/net_user.c |
int net_send(int fd, void *buf, int len) {
int n;
CATCH_EINTR(n = send(fd, buf, len, 0));
if (n < 0) {
if (errno == EAGAIN)
return 0;
return -errno;
} else if (n == 0)
return -ENOTCONN;
return n;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/net_user.c |
static void change_pre_exec(void *arg) {
struct change_pre_exec_data *data = arg;
close(data->close_me);
dup2(data->stdout_fd, 1);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/net_user.c | static int change_tramp(char **argv, char *output, int output_len) {
int pid, fds[2], err;
struct change_pre_exec_data pe_data;
err = os_pipe(fds, 1, 0);
if (err < 0) {
printk(UM_KERN_ERR "change_tramp - pipe failed, err = %d\n", -err);
return err;
}
pe_data.close_me = fds[0];
pe_data.stdout_fd =... | [
1,
0
] |
Linux Kernel | arch/um/drivers/net_user.c |
static void change(char *dev, char *what, unsigned char *addr,
unsigned char *netmask) {
char addr_buf[sizeof("255.255.255.255\0")];
char netmask_buf[sizeof("255.255.255.255\0")];
char version[sizeof("nnnnn\0")];
char *argv[] = {"uml_net", version, what, dev, addr_buf, netmask_buf, NULL};
... | [
1,
0
] |
Linux Kernel | arch/um/drivers/null.c |
static void *null_init(char *str, int device, const struct chan_opts *opts) {
return &null_chan;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/pcap_kern.c |
static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp) {
return -EPERM;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/pcap_kern.c |
static int register_pcap(void) {
register_transport(&pcap_transport);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/pcap_user.c |
static int pcap_user_open(void *data) {
struct pcap_data *pri = data;
__u32 netmask;
int err;
if (pri->pcap == NULL)
return -ENODEV;
if (pri->filter != NULL) {
err = dev_netmask(pri->dev, &netmask);
if (err < 0) {
printk(UM_KERN_ERR "pcap_user_open : dev_netmask failed\n");
return -... | [
0,
0
] |
Linux Kernel | arch/um/drivers/pcap_user.c |
static void pcap_remove(void *data) {
struct pcap_data *pri = data;
if (pri->compiled != NULL)
pcap_freecode(pri->compiled);
if (pri->pcap != NULL)
pcap_close(pri->pcap);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/pcap_user.c |
static void handler(u_char *data, const struct pcap_pkthdr *header,
const u_char *packet) {
int len;
struct pcap_handler_data *hdata = (struct pcap_handler_data *)data;
len = hdata->len < header->caplen ? hdata->len : header->caplen;
memcpy(hdata->buffer, packet, len);
hdata->len = len;... | [
1,
0
] |
Linux Kernel | arch/um/drivers/port_kern.c |
static int port_accept(struct port_list *port) {
struct connection *conn;
int fd, socket[2], pid;
fd = port_connection(port->fd, socket, &pid);
if (fd < 0) {
if (fd != -EAGAIN)
printk(KERN_ERR "port_accept : port_connection "
"returned %d\n",
-fd);
goto out;
... | [
1,
0
] |
Linux Kernel | arch/um/drivers/port_kern.c |
void *port_data(int port_num) {
struct list_head *ele;
struct port_list *port;
struct port_dev *dev = NULL;
int fd;
mutex_lock(&ports_mutex);
list_for_each(ele, &ports) {
port = list_entry(ele, struct port_list, list);
if (port->port == port_num)
goto found;
}
port = kmalloc(sizeof(struc... | [
0,
0
] |
Linux Kernel | arch/um/drivers/port_user.c |
static int port_open(int input, int output, int primary, void *d,
char **dev_out) {
struct port_chan *data = d;
int fd, err;
fd = port_wait(data->kernel_data);
if ((fd >= 0) && data->raw) {
CATCH_EINTR(err = tcgetattr(fd, &data->tt));
if (err)
return err;
err = raw(fd);... | [
0,
0
] |
Linux Kernel | arch/um/drivers/pty.c | static int getmaster(char *line) {
struct stat buf;
char *pty, *bank, *cp;
int master, err;
pty = &line[strlen("/dev/ptyp")];
for (bank = "pqrs"; *bank; bank++) {
line[strlen("/dev/pty")] = *bank;
*pty = '0';
if ((stat(line, &buf) < 0) && (errno == ENOENT))
break;
for (cp = "012345678... | [
0,
0
] |
Linux Kernel | arch/um/drivers/pty.c |
static int pty_open(int input, int output, int primary, void *d,
char **dev_out) {
struct pty_chan *data = d;
int fd, err;
char dev[sizeof("/dev/ptyxx\0")] = "/dev/ptyxx";
fd = getmaster(dev);
if (fd < 0)
return fd;
if (data->raw) {
err = raw(fd);
if (err) {
close(fd... | [
1,
0
] |
Linux Kernel | arch/um/drivers/random.c |
static int rng_dev_read(struct hwrng *rng, void *buf, size_t max, bool block) {
int ret;
for (;;) {
ret = os_read_file(random_fd, buf, max);
if (block && ret == -EAGAIN) {
add_sigio_fd(random_fd);
ret = wait_for_completion_killable(&have_data);
ignore_sigio_fd(random_fd);
deactiv... | [
1,
0
] |
Linux Kernel | arch/um/drivers/random.c | static int __init rng_init(void) {
int err;
err = os_open_file("/dev/random", of_read(OPENFLAGS()), 0);
if (err < 0)
goto out;
random_fd = err;
err = um_request_irq(RANDOM_IRQ, random_fd, IRQ_READ, random_interrupt, 0,
"random", NULL);
if (err < 0)
goto err_out_cleanup_hw;
... | [
0,
0
] |
Linux Kernel | arch/um/drivers/random.c |
static void __exit rng_cleanup(void) {
hwrng_unregister(&hwrng);
os_close_file(random_fd);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/rtc_kern.c | static int uml_rtc_read_time(struct device *dev, struct rtc_time *tm) {
struct timespec64 ts;
read_persistent_clock64(&ts);
rtc_time64_to_tm(timespec64_to_ktime(ts) / NSEC_PER_SEC, tm);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/rtc_kern.c |
static int uml_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) {
uml_rtc_alarm_irq_enable(dev, 0);
uml_rtc_alarm_time = rtc_tm_to_time64(&alrm->time);
uml_rtc_alarm_irq_enable(dev, alrm->enabled);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/rtc_kern.c |
static int uml_rtc_probe(struct platform_device *pdev) {
int err;
err = uml_rtc_setup();
if (err)
return err;
uml_rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(uml_rtc)) {
err = PTR_ERR(uml_rtc);
goto cleanup;
}
uml_rtc->ops = ¨_rtc_ops;
device_init_wakeup(&pdev->dev, 1);
... | [
0,
0
] |
Linux Kernel | arch/um/drivers/rtc_user.c | int uml_rtc_start(bool timetravel) {
int err;
if (timetravel) {
int err = os_pipe(uml_rtc_irq_fds, 1, 1);
if (err)
goto fail;
} else {
uml_rtc_irq_fds[0] = timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC);
if (uml_rtc_irq_fds[0] < 0) {
err = -errno;
goto fail;
}
sigio_broken... | [
0,
0
] |
Linux Kernel | arch/um/drivers/rtc_user.c |
void uml_rtc_disable_alarm(void) { uml_rtc_enable_alarm(0); } | [
0,
0
] |
Linux Kernel | arch/um/drivers/rtc_user.c |
void uml_rtc_stop(bool timetravel) {
if (timetravel)
os_close_file(uml_rtc_irq_fds[1]);
else
ignore_sigio_fd(uml_rtc_irq_fds[0]);
os_close_file(uml_rtc_irq_fds[0]);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/slip_common.c |
int slip_proto_write(int fd, void *buf, int len, struct slip_proto *slip) {
int actual, n;
actual = slip_esc(buf, slip->obuf, len);
n = net_write(fd, slip->obuf, actual);
if (n < 0)
return n;
else
return len;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/slip_kern.c |
static int slip_write(int fd, struct sk_buff *skb, struct uml_net_private *lp) {
return slip_user_write(fd, skb->data, skb->len,
(struct slip_data *)&lp->user);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/slip_user.c |
static void slip_pre_exec(void *arg) {
struct slip_pre_exec_data *data = arg;
if (data->stdin_fd >= 0)
dup2(data->stdin_fd, 0);
dup2(data->stdout_fd, 1);
if (data->close_me >= 0)
close(data->close_me);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/slip_user.c |
static int slip_tramp(char **argv, int fd) {
struct slip_pre_exec_data pe_data;
char *output;
int pid, fds[2], err, output_len;
err = os_pipe(fds, 1, 0);
if (err < 0) {
printk(UM_KERN_ERR "slip_tramp : pipe failed, err = %d\n", -err);
goto out;
}
err = 0;
pe_data.stdin_fd = fd;
pe_data.stdo... | [
0,
0
] |
Linux Kernel | arch/um/drivers/slip_user.c |
static void slip_close(int fd, void *data) {
struct slip_data *pri = data;
char version_buf[sizeof("nnnnn\0")];
char *argv[] = {"uml_net", version_buf, "slip", "down", pri->name, NULL};
int err;
if (pri->gate_addr != NULL)
iter_addresses(pri->dev, close_addr, pri->name);
sprintf(version_buf, "%d", UM... | [
1,
0
] |
Linux Kernel | arch/um/drivers/slirp_kern.c |
static int slirp_write(int fd, struct sk_buff *skb,
struct uml_net_private *lp) {
return slirp_user_write(fd, skb->data, skb->len,
(struct slirp_data *)&lp->user);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/slirp_kern.c | static int slirp_setup(char *str, char **mac_out, void *data) {
struct slirp_init *init = data;
int i = 0;
*init = ((struct slirp_init){.argw = {{"slirp", NULL}}});
str = split_if_spec(str, mac_out, NULL);
if (str == NULL)
return 1;
do {
if (i >= SLIRP_MAX_ARGS - 1) {
printk(KERN_WARNING "... | [
0,
0
] |
Linux Kernel | arch/um/drivers/slirp_user.c |
static void slirp_close(int fd, void *data) {
struct slirp_data *pri = data;
int err;
close(fd);
close(pri->slave);
pri->slave = -1;
if (pri->pid < 1) {
printk(UM_KERN_ERR "slirp_close: no child process to shut "
"down\n");
return;
}
#if 0
if (kill(pri->pid, SIGHUP)<0)... | [
0,
0
] |
Linux Kernel | arch/um/drivers/ssl.c |
static int ssl_get_config(char *dev, char *str, int size, char **error_out) {
return line_get_config(dev, serial_lines, ARRAY_SIZE(serial_lines), str, size,
error_out);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ssl.c |
static int ssl_install(struct tty_driver *driver, struct tty_struct *tty) {
return line_install(driver, tty, &serial_lines[tty->index]);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ssl.c |
static void ssl_exit(void) {
if (!ssl_init_done)
return;
close_lines(serial_lines, ARRAY_SIZE(serial_lines));
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/stdio_console.c |
static void console_exit(void) {
if (!con_init_done)
return;
close_lines(vts, ARRAY_SIZE(vts));
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/stdio_console.c | static int console_chan_setup(char *str) {
if (!strncmp(str, "sole=", 5))
return 0;
line_setup(vt_conf, MAX_TTYS, &def_conf, str, "console");
return 1;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static inline int ubd_test_bit(__u64 bit, unsigned char *data) {
__u64 n;
int bits, off;
bits = sizeof(data[0]) * 8;
n = bit / bits;
off = bit % bits;
return (data[n] & (1 << off)) != 0;
} | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int fake_ide_setup(char *str) {
pr_warn("The fake_ide option has been removed\n");
return 1;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int ubd_setup(char *str) {
char *error;
int err;
err = ubd_setup_common(str, NULL, &error);
if (err)
printk(KERN_ERR "Failed to initialize device with \"%s\" : "
"%s\n",
str, error);
return 1;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int read_cow_bitmap(int fd, void *buf, int offset, int len) {
int err;
err = os_pread_file(fd, buf, len, offset);
if (err < 0)
return err;
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow) {
struct uml_stat buf1, buf2;
int err;
if (from_cmdline == NULL)
return 0;
if (!strcmp(from_cmdline, from_cow))
return 0;
err = os_stat_file(from_cmdline, &buf1);
if (err < 0) {
printk(KERN_ERR "Couldn't stat '%s',... | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int create_cow_file(char *cow_file, char *backing_file,
struct openflags flags, int sectorsize,
int alignment, int *bitmap_offset_out,
unsigned long *bitmap_len_out,
int *data_offset_out) {
int err, fd;... | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int ubd_disk_register(int major, u64 size, int unit,
struct gendisk *disk) {
disk->major = major;
disk->first_minor = unit << UBD_SHIFT;
disk->minors = 1 << UBD_SHIFT;
disk->fops = &ubd_blops;
set_capacity(disk, size / 512);
sprintf(disk->disk_name, "ubd%c", 'a' + unit);... | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int __init ubd_mc_init(void) {
mconsole_register_dev(&ubd_mc);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int __init ubd0_init(void) {
struct ubd *ubd_dev = &ubd_devs[0];
mutex_lock(&ubd_lock);
if (ubd_dev->file == NULL)
ubd_dev->file = "root_fs";
mutex_unlock(&ubd_lock);
return 0;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int __init ubd_init(void) {
char *error;
int i, err;
if (register_blkdev(UBD_MAJOR, "ubd"))
return -1;
irq_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE,
sizeof(struct io_thread_req *), GFP_KERNEL);
irq_remainder = 0;
if (irq_req_buffer == NULL) {
printk(... | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c | static int ubd_open(struct block_device *bdev, fmode_t mode) {
struct gendisk *disk = bdev->bd_disk;
struct ubd *ubd_dev = disk->private_data;
int err = 0;
mutex_lock(&ubd_mutex);
if (ubd_dev->count == 0) {
err = ubd_open_dev(ubd_dev);
if (err) {
printk(KERN_ERR "%s: Can't open \"%s\": errno = ... | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static void cowify_req(struct io_thread_req *req, struct io_desc *segment,
unsigned long offset, unsigned long *bitmap,
__u64 bitmap_offset, __u64 bitmap_len) {
__u64 sector = offset >> SECTOR_SHIFT;
int i;
if (segment->length > (sizeof(segment->sector_mask) * 8) <<... | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static struct io_thread_req *ubd_alloc_req(struct ubd *dev, struct request *req,
int desc_cnt) {
struct io_thread_req *io_req;
int i;
io_req = kmalloc(sizeof(*io_req) + (desc_cnt * sizeof(struct io_desc)),
GFP_ATOMIC);
if (!io_req)
return NULL;... | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
static int ubd_submit_request(struct ubd *dev, struct request *req) {
int segs = 0;
struct io_thread_req *io_req;
int ret;
enum req_op op = req_op(req);
if (op == REQ_OP_FLUSH)
segs = 0;
else if (op == REQ_OP_WRITE_ZEROES || op == REQ_OP_DISCARD)
segs = 1;
else
segs = blk_rq_nr_phys_segments... | [
1,
0
] |
Linux Kernel | arch/um/drivers/ubd_kern.c |
int io_thread(void *arg) {
int n, count, written, res;
os_fix_helper_signals();
while (1) {
n = bulk_req_safe_read(kernel_fd, io_req_buffer, &io_remainder,
&io_remainder_size, UBD_REQ_BUFFER_SIZE);
if (n <= 0) {
if (n == -EAGAIN)
ubd_read_poll(-1);
contin... | [
1,
0
] |
Linux Kernel | arch/um/drivers/umcast_kern.c |
static int mcast_setup(char *str, char **mac_out, void *data) {
struct umcast_init *init = data;
char *port_str = NULL, *ttl_str = NULL, *remain;
char *last;
*init =
((struct umcast_init){.addr = "239.192.168.1", .lport = 1102, .ttl = 1});
remain = split_if_spec(str, mac_out, &init->addr, &port_str, ... | [
1,
0
] |
Linux Kernel | arch/um/drivers/umcast_user.c |
static void umcast_close(int fd, void *data) {
struct umcast_data *pri = data;
if (!pri->unicast) {
struct ip_mreq mreq;
struct sockaddr_in *lsin = pri->listen_addr;
mreq.imr_multiaddr.s_addr = lsin->sin_addr.s_addr;
mreq.imr_interface.s_addr = 0;
if (setsockopt(fd, SOL_IP, IP_DROP_MEMBERSHIP... | [
1,
0
] |
Linux Kernel | arch/um/drivers/umcast_user.c |
int umcast_user_write(int fd, void *buf, int len, struct umcast_data *pri) {
struct sockaddr_in *data_addr = pri->remote_addr;
return net_sendto(fd, buf, len, data_addr, sizeof(*data_addr));
} | [
1,
0
] |
Linux Kernel | arch/um/drivers/vde_kern.c |
static void vde_init(struct net_device *dev, void *data) {
struct vde_init *init = data;
struct uml_net_private *pri;
struct vde_data *vpri;
pri = netdev_priv(dev);
vpri = (struct vde_data *)pri->user;
vpri->vde_switch = init->vde_switch;
vpri->descr = init->descr ? init->descr : "UML vde_transport";
... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vde_user.c |
static int vde_user_init(void *data, void *dev) {
struct vde_data *pri = data;
VDECONN *conn = NULL;
int err = -EINVAL;
pri->dev = dev;
conn = vde_open(pri->vde_switch, pri->descr, pri->args);
if (conn == NULL) {
err = -errno;
printk(UM_KERN_ERR "vde_user_init: vde_open failed, "
... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vde_user.c |
static void vde_remove(void *data) {
struct vde_data *pri = data;
if (pri->conn != NULL) {
printk(UM_KERN_INFO "vde backend - closing connection\n");
vde_close(pri->conn);
pri->conn = NULL;
kfree(pri->args);
pri->args = NULL;
return;
}
printk(UM_KERN_WARNING "vde_remove - we have no V... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static int get_mtu(struct arglist *def) {
char *mtu = uml_vector_fetch_arg(def, "mtu");
long result;
if (mtu != NULL) {
if (kstrtoul(mtu, 10, &result) == 0)
if ((result < (1 << 16) - 1) && (result >= 576))
return result;
}
return ETH_MAX_PACKET;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c | static int vector_advancetail(struct vector_queue *qi, int advance) {
int queue_depth;
qi->tail = (qi->tail + advance) % qi->max_depth;
spin_lock(&qi->head_lock);
qi->queue_depth += advance;
queue_depth = qi->queue_depth;
spin_unlock(&qi->head_lock);
return queue_depth;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static int prep_msg(struct vector_private *vp, struct sk_buff *skb,
struct iovec *iov) {
int iov_index = 0;
int nr_frags, frag;
skb_frag_t *skb_frag;
nr_frags = skb_shinfo(skb)->nr_frags;
if (nr_frags > MAX_IOV_SIZE) {
if (skb_linearize(skb) != 0)
goto drop;
}
if (vp->heade... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c | static void destroy_queue(struct vector_queue *qi) {
int i;
struct iovec *iov;
struct vector_private *vp = netdev_priv(qi->dev);
struct mmsghdr *mmsg_vector;
if (qi == NULL)
return;
if (qi->skbuff_vector != NULL) {
for (i = 0; i < qi->max_depth; i++) {
if (*(qi->skbuff_vector + i) != NULL)
... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static int vector_parse(char *str, int *index_out, char **str_out,
char **error_out) {
int n, len, err;
char *start = str;
len = strlen(str);
while ((*str != ':') && (strlen(str) > 1))
str++;
if (*str != ':') {
*error_out = "Expected ':' after device number";
return -EIN... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static int vector_id(char **str, int *start_out, int *end_out) {
char *end;
int n;
n = simple_strtoul(*str, &end, 0);
if ((*end != '\0') || (end == *str))
return -1;
*start_out = n;
*end_out = n;
*str = end;
return n;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static int vector_remove(int n, char **error_out) {
struct vector_device *vec_d;
struct net_device *dev;
struct vector_private *vp;
vec_d = find_device(n);
if (vec_d == NULL)
return -ENODEV;
dev = vec_d->dev;
vp = netdev_priv(dev);
if (vp->fds != NULL)
return -EBUSY;
unregister_netdev(dev);
... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static int vector_poll(struct napi_struct *napi, int budget) {
struct vector_private *vp = container_of(napi, struct vector_private, napi);
int work_done = 0;
int err;
bool tx_enqueued = false;
if ((vp->options & VECTOR_TX) != 0)
tx_enqueued = (vector_send(vp->tx_queue) > 0);
if ((vp->options & VECTOR... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static void vector_reset_tx(struct work_struct *work) {
struct vector_private *vp =
container_of(work, struct vector_private, reset_tx);
netdev_reset_queue(vp->dev);
netif_start_queue(vp->dev);
netif_wake_queue(vp->dev);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c |
static void vector_net_tx_timeout(struct net_device *dev,
unsigned int txqueue) {
struct vector_private *vp = netdev_priv(dev);
vp->estats.tx_timeout_count++;
netif_trans_update(dev);
schedule_work(&vp->reset_tx);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_kern.c | static inline void inet_register(void) {}
#endif | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_transports.c |
static int l2tpv3_form_header(uint8_t *header, struct sk_buff *skb,
struct vector_private *vp) {
struct uml_l2tpv3_data *td = vp->transport_data;
uint32_t *counter;
if (td->udp)
*(uint32_t *)header = cpu_to_be32(L2TPV3_DATA_PACKET);
(*(uint32_t *)(header + td->session_offset)... | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_transports.c |
static int gre_form_header(uint8_t *header, struct sk_buff *skb,
struct vector_private *vp) {
struct uml_gre_data *td = vp->transport_data;
uint32_t *sequence;
*((uint32_t *)header) = *((uint32_t *)&td->expected_header);
if (td->key)
(*(uint32_t *)(header + td->key_offset)) = td-... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_transports.c | static int gre_verify_header(uint8_t *header, struct sk_buff *skb,
struct vector_private *vp) {
uint32_t key;
struct uml_gre_data *td = vp->transport_data;
if (!td->ipv6)
header += sizeof(struct iphdr);
if (*((uint32_t *)header) != *((uint32_t *)&td->expected_header)) {
i... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_transports.c |
static bool get_ulong_param(struct arglist *def, char *param,
unsigned long *result) {
char *arg = uml_vector_fetch_arg(def, param);
if (arg != NULL) {
if (kstrtoul(arg, 0, result) == 0)
return true;
return true;
}
return false;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_transports.c |
static int build_gre_transport_data(struct vector_private *vp) {
struct uml_gre_data *td;
int temp_int;
int temp_rx;
int temp_tx;
vp->transport_data = kmalloc(sizeof(struct uml_gre_data), GFP_KERNEL);
if (vp->transport_data == NULL)
return -ENOMEM;
td = vp->transport_data;
td->sequence = 0;
td-... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_user.c | struct arglist *uml_parse_vector_ifspec(char *arg) {
struct arglist *result;
int pos, len;
bool parsing_token = true, next_starts = true;
if (arg == NULL)
return NULL;
result = uml_kmalloc(sizeof(struct arglist), UM_GFP_KERNEL);
if (result == NULL)
return NULL;
result->numargs = 0;
len = strlen... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_user.c | static struct vector_fds *user_init_tap_fds(struct arglist *ifspec) {
int fd = -1, i;
char *iface;
struct vector_fds *result = NULL;
bool dynamic = false;
char dynamic_ifname[IFNAMSIZ];
char *argv[] = {NULL, NULL, NULL, NULL};
iface = uml_vector_fetch_arg(ifspec, TOKEN_IFNAME);
if (iface == NULL) {
... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_user.c | bool uml_tap_enable_vnet_headers(int fd) {
unsigned int features;
int len = sizeof(struct virtio_net_hdr);
if (ioctl(fd, TUNGETFEATURES, &features) == -1) {
printk(UM_KERN_INFO TUN_GET_F_FAIL, strerror(errno));
return false;
}
if ((features & IFF_VNET_HDR) == 0) {
printk(UM_KERN_INFO "tapraw: No ... | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_user.c |
int uml_vector_recvmmsg(int fd, void *msgvec, unsigned int vlen,
unsigned int flags) {
int n;
CATCH_EINTR(n = recvmmsg(fd, (struct mmsghdr *)msgvec, vlen, flags, 0));
if ((n < 0) && (errno == EAGAIN))
return 0;
if (n >= 0)
return n;
else
return -errno;
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/vector_user.c | int uml_vector_attach_bpf(int fd, void *bpf) {
struct sock_fprog *prog = bpf;
int err = setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, bpf,
sizeof(struct sock_fprog));
if (err < 0)
printk(KERN_ERR BPF_ATTACH_FAIL, prog->len, prog->filter, fd, -errno);
return err;
} | [
1,
0
] |
Linux Kernel | arch/um/drivers/vector_user.c | void *uml_vector_default_bpf(const void *mac) {
struct sock_filter *bpf;
uint32_t *mac1 = (uint32_t *)(mac + 2);
uint16_t *mac2 = (uint16_t *)mac;
struct sock_fprog *bpf_prog;
bpf_prog = uml_kmalloc(sizeof(struct sock_fprog), UM_GFP_KERNEL);
if (bpf_prog) {
bpf_prog->len = DEFAULT_BPF_LEN;
bpf_prog... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virt-pci.c | static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset,
int size) {
struct um_pci_device_reg *reg = priv;
struct um_pci_device *dev = reg->dev;
struct virtio_pcidev_msg hdr = {
.op = VIRTIO_PCIDEV_OP_CFG_READ,
.size = size,
.addr = off... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virt-pci.c |
static void um_pci_bar_copy_to(void *priv, unsigned int offset,
const void *buffer, int size) {
u8 *resptr = priv;
struct um_pci_device *dev =
container_of(resptr - *resptr, struct um_pci_device, resptr[0]);
struct virtio_pcidev_msg hdr = {
.op = VIRTIO_PCIDEV_OP_MMIO_W... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virt-pci.c |
static int um_pci_init_vqs(struct um_pci_device *dev) {
struct virtqueue *vqs[2];
static const char *const names[2] = {"cmd", "irq"};
vq_callback_t *cbs[2] = {um_pci_cmd_vq_cb, um_pci_irq_vq_cb};
int err, i;
err = virtio_find_vqs(dev->vdev, 2, vqs, cbs, names, NULL);
if (err)
return err;
dev->cmd_v... | [
0,
0
] |
Linux Kernel | arch/um/drivers/virt-pci.c | static void um_pci_virtio_remove(struct virtio_device *vdev) {
struct um_pci_device *dev = vdev->priv;
int i;
virtio_reset_device(vdev);
vdev->config->del_vqs(vdev);
device_set_wakeup_enable(&vdev->dev, false);
mutex_lock(&um_pci_mtx);
for (i = 0; i < MAX_DEVICES; i++) {
if (um_pci_devices[i].dev !... | [
0,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int full_read(int fd, void *buf, int len, bool abortable) {
int rc;
if (!len)
return 0;
do {
rc = os_read_file(fd, buf, len);
if (rc > 0) {
buf += rc;
len -= rc;
}
} while (len && (rc > 0 || rc == -EINTR || (!abortable && rc == -EAGAIN)));
if (rc < 0)
return rc;
if... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int vhost_user_recv_u64(struct virtio_uml_device *vu_dev, u64 *value) {
struct vhost_user_msg msg;
int rc = vhost_user_recv_resp(vu_dev, &msg, sizeof(msg.payload.integer));
if (rc)
return rc;
if (msg.header.size != sizeof(msg.payload.integer))
return -EPROTO;
*value = msg.payload.integer;
r... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int vhost_user_send_no_payload(struct virtio_uml_device *vu_dev,
bool need_response, u32 request) {
struct vhost_user_msg msg = {
.header.request = request,
};
return vhost_user_send(vu_dev, need_response, &msg, NULL, 0);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int vhost_user_get_protocol_features(struct virtio_uml_device *vu_dev,
u64 *protocol_features) {
int rc = vhost_user_send_no_payload(vu_dev, true,
VHOST_USER_GET_PROTOCOL_FEATURES);
if (rc)
return rc;
return vhost_user_... | [
0,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c | static irqreturn_t vu_req_read_message(struct virtio_uml_device *vu_dev,
struct time_travel_event *ev) {
struct virtqueue *vq;
int response = 1;
struct {
struct vhost_user_msg msg;
u8 extra_payload[512];
} msg;
int rc;
irqreturn_t irq_rc = IRQ_NONE;
while (1... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static void vhost_user_get_config(struct virtio_uml_device *vu_dev, u32 offset,
void *buf, u32 len) {
u32 cfg_size = offset + len;
struct vhost_user_msg *msg;
size_t payload_size = sizeof(msg->payload.config) + cfg_size;
size_t msg_size = sizeof(msg->header) + payload_size;
... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c | static int vhost_user_set_mem_table(struct virtio_uml_device *vu_dev) {
struct vhost_user_msg msg = {
.header.request = VHOST_USER_SET_MEM_TABLE,
.header.size = sizeof(msg.payload.mem_regions),
.payload.mem_regions.num = 1,
};
unsigned long reserved = uml_reserved - uml_physmem;
int fds[2];
... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int vhost_user_set_vring_base(struct virtio_uml_device *vu_dev,
u32 index, u32 offset) {
return vhost_user_set_vring_state(vu_dev, VHOST_USER_SET_VRING_BASE, index,
offset);
} | [
0,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int vhost_user_set_vring_addr(struct virtio_uml_device *vu_dev,
u32 index, u64 desc, u64 used, u64 avail,
u64 log) {
struct vhost_user_msg msg = {
.header.request = VHOST_USER_SET_VRING_ADDR,
.header.size = sizeof(msg.payloa... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c |
static int vhost_user_set_vring_fd(struct virtio_uml_device *vu_dev,
u32 request, int index, int fd) {
struct vhost_user_msg msg = {
.header.request = request,
.header.size = sizeof(msg.payload.integer),
.payload.integer = index,
};
if (index & ~VHOST_USER_VR... | [
1,
0
] |
Linux Kernel | arch/um/drivers/virtio_uml.c | static bool vu_notify(struct virtqueue *vq) {
struct virtio_uml_vq_info *info = vq->priv;
const uint64_t n = 1;
int rc;
if (info->suspended)
return true;
time_travel_propagate_time();
if (info->kick_fd < 0) {
struct virtio_uml_device *vu_dev;
vu_dev = to_virtio_uml_device(vq->vdev);
ret... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.