PATH: //proc/thread-self/root/proc/self/root/proc/thread-self/root/usr/include/linux
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
π a.out.h
β
X
π acct.h
β
X
π acrn.h
β
X
π adb.h
β
X
π adfs_fs.h
β
X
π affs_hardblocks.h
β
X
π agpgart.h
β
X
π aio_abi.h
β
X
π am437x-vpfe.h
β
X
π android/
X
π apm_bios.h
β
X
π arcfb.h
β
X
π arm_sdei.h
β
X
π aspeed-lpc-ctrl.h
β
X
π aspeed-p2a-ctrl.h
β
X
π atalk.h
β
X
π atm.h
β
X
π atm_eni.h
β
X
π atm_he.h
β
X
π atm_idt77105.h
β
X
π atm_nicstar.h
β
X
π atm_tcp.h
β
X
π atm_zatm.h
β
X
π atmapi.h
β
X
π atmarp.h
β
X
π atmbr2684.h
β
X
π atmclip.h
β
X
π atmdev.h
β
X
π atmioc.h
β
X
π atmlec.h
β
X
π atmmpc.h
β
X
π atmppp.h
β
X
π atmsap.h
β
X
π atmsvc.h
β
X
π audit.h
β
X
π auto_dev-ioctl.h
β
X
π auto_fs.h
β
X
π auto_fs4.h
β
X
π auxvec.h
β
X
π ax25.h
β
X
π batadv_packet.h
β
X
π batman_adv.h
β
X
π baycom.h
β
X
π bcm933xx_hcs.h
β
X
π bfs_fs.h
β
X
π binfmts.h
β
X
π bits.h
β
X
π blkpg.h
β
X
π blktrace_api.h
β
X
π blkzoned.h
β
X
π bpf.h
β
X
π bpf_common.h
β
X
π bpf_perf_event.h
β
X
π bpfilter.h
β
X
π bpqether.h
β
X
π bsg.h
β
X
π bt-bmc.h
β
X
π btf.h
β
X
π btrfs.h
β
X
π btrfs_tree.h
β
X
π byteorder/
X
π cachefiles.h
β
X
π caif/
X
π can/
X
π can.h
β
X
π capability.h
β
X
π capi.h
β
X
π cciss_defs.h
β
X
π cciss_ioctl.h
β
X
π ccs.h
β
X
π cdrom.h
β
X
π cec-funcs.h
β
X
π cec.h
β
X
π cfm_bridge.h
β
X
π cgroupstats.h
β
X
π chio.h
β
X
π cifs/
X
π close_range.h
β
X
π cm4000_cs.h
β
X
π cn_proc.h
β
X
π coda.h
β
X
π coff.h
β
X
π connector.h
β
X
π const.h
β
X
π coresight-stm.h
β
X
π cramfs_fs.h
β
X
π cryptouser.h
β
X
π cuda.h
β
X
π cxl_mem.h
β
X
π cycx_cfm.h
β
X
π dcbnl.h
β
X
π dccp.h
β
X
π devlink.h
β
X
π dlm.h
β
X
π dlm_device.h
β
X
π dlm_netlink.h
β
X
π dlm_plock.h
β
X
π dlmconstants.h
β
X
π dm-ioctl.h
β
X
π dm-log-userspace.h
β
X
π dma-buf.h
β
X
π dma-heap.h
β
X
π dn.h
β
X
π dns_resolver.h
β
X
π dpll.h
β
X
π dqblk_xfs.h
β
X
π dvb/
X
π edd.h
β
X
π efs_fs_sb.h
β
X
π elf-em.h
β
X
π elf-fdpic.h
β
X
π elf.h
β
X
π errno.h
β
X
π errqueue.h
β
X
π erspan.h
β
X
π ethtool.h
β
X
π ethtool_netlink.h
β
X
π ethtool_netlink_generated.h
β
X
π eventfd.h
β
X
π eventpoll.h
β
X
π f2fs.h
β
X
π fadvise.h
β
X
π falloc.h
β
X
π fanotify.h
β
X
π fb.h
β
X
π fcntl.h
β
X
π fd.h
β
X
π fdreg.h
β
X
π fib_rules.h
β
X
π fiemap.h
β
X
π filter.h
β
X
π firewire-cdev.h
β
X
π firewire-constants.h
β
X
π fou.h
β
X
π fpga-dfl.h
β
X
π fs.h
β
X
π fscrypt.h
β
X
π fsi.h
β
X
π fsl_hypervisor.h
β
X
π fsl_mc.h
β
X
π fsmap.h
β
X
π fsverity.h
β
X
π fuse.h
β
X
π futex.h
β
X
π gameport.h
β
X
π gen_stats.h
β
X
π genetlink.h
β
X
π genwqe/
X
π gfs2_ondisk.h
β
X
π gpio.h
β
X
π gsmmux.h
β
X
π gtp.h
β
X
π handshake.h
β
X
π hash_info.h
β
X
π hdlc/
X
π hdlc.h
β
X
π hdlcdrv.h
β
X
π hdreg.h
β
X
π hid.h
β
X
π hiddev.h
β
X
π hidraw.h
β
X
π hpet.h
β
X
π hsi/
X
π hsr_netlink.h
β
X
π hw_breakpoint.h
β
X
π hyperv.h
β
X
π i2c-dev.h
β
X
π i2c.h
β
X
π i2o-dev.h
β
X
π i8k.h
β
X
π icmp.h
β
X
π icmpv6.h
β
X
π idxd.h
β
X
π if.h
β
X
π if_addr.h
β
X
π if_addrlabel.h
β
X
π if_alg.h
β
X
π if_arcnet.h
β
X
π if_arp.h
β
X
π if_bonding.h
β
X
π if_bridge.h
β
X
π if_cablemodem.h
β
X
π if_eql.h
β
X
π if_ether.h
β
X
π if_fc.h
β
X
π if_fddi.h
β
X
π if_hippi.h
β
X
π if_infiniband.h
β
X
π if_link.h
β
X
π if_ltalk.h
β
X
π if_macsec.h
β
X
π if_packet.h
β
X
π if_phonet.h
β
X
π if_plip.h
β
X
π if_ppp.h
β
X
π if_pppol2tp.h
β
X
π if_pppox.h
β
X
π if_slip.h
β
X
π if_team.h
β
X
π if_tun.h
β
X
π if_tunnel.h
β
X
π if_vlan.h
β
X
π if_x25.h
β
X
π if_xdp.h
β
X
π ife.h
β
X
π igmp.h
β
X
π iio/
X
π ila.h
β
X
π in.h
β
X
π in6.h
β
X
π in_route.h
β
X
π inet_diag.h
β
X
π inotify.h
β
X
π input-event-codes.h
β
X
π input.h
β
X
π io_uring.h
β
X
π ioctl.h
β
X
π iommufd.h
β
X
π ioprio.h
β
X
π ip.h
β
X
π ip6_tunnel.h
β
X
π ip_vs.h
β
X
π ipc.h
β
X
π ipmi.h
β
X
π ipmi_bmc.h
β
X
π ipmi_msgdefs.h
β
X
π ipmi_ssif_bmc.h
β
X
π ipsec.h
β
X
π ipv6.h
β
X
π ipv6_route.h
β
X
π ipx.h
β
X
π irqnr.h
β
X
π isdn/
X
π iso_fs.h
β
X
π isst_if.h
β
X
π ivtv.h
β
X
π ivtvfb.h
β
X
π jffs2.h
β
X
π joystick.h
β
X
π kcm.h
β
X
π kcmp.h
β
X
π kcov.h
β
X
π kd.h
β
X
π kdev_t.h
β
X
π kernel-page-flags.h
β
X
π kernel.h
β
X
π kernelcapi.h
β
X
π kexec.h
β
X
π keyboard.h
β
X
π keyctl.h
β
X
π kfd_ioctl.h
β
X
π kfd_sysfs.h
β
X
π kvm.h
β
X
π kvm_para.h
β
X
π l2tp.h
β
X
π landlock.h
β
X
π libc-compat.h
β
X
π limits.h
β
X
π lirc.h
β
X
π llc.h
β
X
π loadpin.h
β
X
π loop.h
β
X
π lp.h
β
X
π lsm.h
β
X
π lwtunnel.h
β
X
π magic.h
β
X
π major.h
β
X
π map_to_7segment.h
β
X
π matroxfb.h
β
X
π max2175.h
β
X
π mdio.h
β
X
π media-bus-format.h
β
X
π media.h
β
X
π mei.h
β
X
π mei_uuid.h
β
X
π membarrier.h
β
X
π memfd.h
β
X
π mempolicy.h
β
X
π meye.h
β
X
π mii.h
β
X
π minix_fs.h
β
X
π misc/
X
π mman.h
β
X
π mmc/
X
π mmtimer.h
β
X
π module.h
β
X
π mount.h
β
X
π mpls.h
β
X
π mpls_iptunnel.h
β
X
π mptcp.h
β
X
π mptcp_pm.h
β
X
π mqueue.h
β
X
π mroute.h
β
X
π mroute6.h
β
X
π mrp_bridge.h
β
X
π msdos_fs.h
β
X
π msg.h
β
X
π mshv.h
β
X
π mtio.h
β
X
π nbd-netlink.h
β
X
π nbd.h
β
X
π ncsi.h
β
X
π ndctl.h
β
X
π neighbour.h
β
X
π net.h
β
X
π net_dropmon.h
β
X
π net_namespace.h
β
X
π net_shaper.h
β
X
π net_tstamp.h
β
X
π netconf.h
β
X
π netdev.h
β
X
π netdevice.h
β
X
π netfilter/
X
π netfilter.h
β
X
π netfilter_arp/
X
π netfilter_arp.h
β
X
π netfilter_bridge/
X
π netfilter_bridge.h
β
X
π netfilter_decnet.h
β
X
π netfilter_ipv4/
X
π netfilter_ipv4.h
β
X
π netfilter_ipv6/
X
π netfilter_ipv6.h
β
X
π netlink.h
β
X
π netlink_diag.h
β
X
π netrom.h
β
X
π nexthop.h
β
X
π nfc.h
β
X
π nfs.h
β
X
π nfs2.h
β
X
π nfs3.h
β
X
π nfs4.h
β
X
π nfs4_mount.h
β
X
π nfs_fs.h
β
X
π nfs_idmap.h
β
X
π nfs_mount.h
β
X
π nfsacl.h
β
X
π nfsd/
X
π nfsd_netlink.h
β
X
π nilfs2_api.h
β
X
π nilfs2_ondisk.h
β
X
π nitro_enclaves.h
β
X
π nl80211.h
β
X
π nsfs.h
β
X
π nubus.h
β
X
π nvme_ioctl.h
β
X
π nvram.h
β
X
π omap3isp.h
β
X
π omapfb.h
β
X
π oom.h
β
X
π openat2.h
β
X
π openvswitch.h
β
X
π packet_diag.h
β
X
π param.h
β
X
π parport.h
β
X
π patchkey.h
β
X
π pci.h
β
X
π pci_regs.h
β
X
π pcitest.h
β
X
π perf_event.h
β
X
π personality.h
β
X
π pfkeyv2.h
β
X
π pfrut.h
β
X
π pg.h
β
X
π phantom.h
β
X
π phonet.h
β
X
π pidfd.h
β
X
π pkt_cls.h
β
X
π pkt_sched.h
β
X
π pktcdvd.h
β
X
π pmu.h
β
X
π poll.h
β
X
π posix_acl.h
β
X
π posix_acl_xattr.h
β
X
π posix_types.h
β
X
π ppdev.h
β
X
π ppp-comp.h
β
X
π ppp-ioctl.h
β
X
π ppp_defs.h
β
X
π pps.h
β
X
π pr.h
β
X
π prctl.h
β
X
π psample.h
β
X
π psci.h
β
X
π psp-dbc.h
β
X
π psp-sev.h
β
X
π ptp_clock.h
β
X
π ptrace.h
β
X
π qemu_fw_cfg.h
β
X
π qnx4_fs.h
β
X
π qnxtypes.h
β
X
π qrtr.h
β
X
π quota.h
β
X
π radeonfb.h
β
X
π raid/
X
π random.h
β
X
π rds.h
β
X
π reboot.h
β
X
π reiserfs_fs.h
β
X
π reiserfs_xattr.h
β
X
π remoteproc_cdev.h
β
X
π resource.h
β
X
π rfkill.h
β
X
π rio_cm_cdev.h
β
X
π rio_mport_cdev.h
β
X
π rkisp1-config.h
β
X
π romfs_fs.h
β
X
π rose.h
β
X
π route.h
β
X
π rpl.h
β
X
π rpl_iptunnel.h
β
X
π rpmsg.h
β
X
π rpmsg_types.h
β
X
π rseq.h
β
X
π rtc.h
β
X
π rtnetlink.h
β
X
π rxrpc.h
β
X
π scc.h
β
X
π sched/
X
π sched.h
β
X
π scif_ioctl.h
β
X
π screen_info.h
β
X
π sctp.h
β
X
π seccomp.h
β
X
π securebits.h
β
X
π sed-opal.h
β
X
π seg6.h
β
X
π seg6_genl.h
β
X
π seg6_hmac.h
β
X
π seg6_iptunnel.h
β
X
π seg6_local.h
β
X
π selinux_netlink.h
β
X
π sem.h
β
X
π serial.h
β
X
π serial_core.h
β
X
π serial_reg.h
β
X
π serio.h
β
X
π sev-guest.h
β
X
π shm.h
β
X
π signal.h
β
X
π signalfd.h
β
X
π smc.h
β
X
π smc_diag.h
β
X
π smiapp.h
β
X
π snmp.h
β
X
π sock_diag.h
β
X
π socket.h
β
X
π sockios.h
β
X
π sonet.h
β
X
π sonypi.h
β
X
π sound.h
β
X
π soundcard.h
β
X
π spi/
X
π stat.h
β
X
π stddef.h
β
X
π stm.h
β
X
π string.h
β
X
π sunrpc/
X
π surface_aggregator/
X
π suspend_ioctls.h
β
X
π swab.h
β
X
π switchtec_ioctl.h
β
X
π sync_file.h
β
X
π synclink.h
β
X
π sysctl.h
β
X
π sysinfo.h
β
X
π target_core_user.h
β
X
π taskstats.h
β
X
π tc_act/
X
π tc_ematch/
X
π tcp.h
β
X
π tcp_metrics.h
β
X
π tdx-guest.h
β
X
π tee.h
β
X
π termios.h
β
X
π thermal.h
β
X
π time.h
β
X
π time_types.h
β
X
π timerfd.h
β
X
π times.h
β
X
π timex.h
β
X
π tiocl.h
β
X
π tipc.h
β
X
π tipc_config.h
β
X
π tipc_netlink.h
β
X
π tipc_sockets_diag.h
β
X
π tls.h
β
X
π toshiba.h
β
X
π tps6594_pfsm.h
β
X
π tty.h
β
X
π tty_flags.h
β
X
π types.h
β
X
π udf_fs_i.h
β
X
π udmabuf.h
β
X
π udp.h
β
X
π uhid.h
β
X
π uinput.h
β
X
π uio.h
β
X
π uleds.h
β
X
π ultrasound.h
β
X
π um_timetravel.h
β
X
π un.h
β
X
π unistd.h
β
X
π unix_diag.h
β
X
π usb/
X
π usbdevice_fs.h
β
X
π usbip.h
β
X
π userfaultfd.h
β
X
π userio.h
β
X
π utime.h
β
X
π utsname.h
β
X
π uuid.h
β
X
π uvcvideo.h
β
X
π v4l2-common.h
β
X
π v4l2-controls.h
β
X
π v4l2-dv-timings.h
β
X
π v4l2-mediabus.h
β
X
π v4l2-subdev.h
β
X
π vbox_err.h
β
X
π vbox_vmmdev_types.h
β
X
π vboxguest.h
β
X
π vdpa.h
β
X
π vduse.h
β
X
π version.h
β
X
π veth.h
β
X
π vfio.h
β
X
π vfio_ccw.h
β
X
π vfio_zdev.h
β
X
π vhost.h
β
X
π vhost_types.h
β
X
π videodev2.h
β
X
π virtio_9p.h
β
X
π virtio_balloon.h
β
X
π virtio_blk.h
β
X
π virtio_bt.h
β
X
π virtio_config.h
β
X
π virtio_console.h
β
X
π virtio_crypto.h
β
X
π virtio_fs.h
β
X
π virtio_gpio.h
β
X
π virtio_gpu.h
β
X
π virtio_i2c.h
β
X
π virtio_ids.h
β
X
π virtio_input.h
β
X
π virtio_iommu.h
β
X
π virtio_mem.h
β
X
π virtio_mmio.h
β
X
π virtio_net.h
β
X
π virtio_pci.h
β
X
π virtio_pcidev.h
β
X
π virtio_pmem.h
β
X
π virtio_ring.h
β
X
π virtio_rng.h
β
X
π virtio_scmi.h
β
X
π virtio_scsi.h
β
X
π virtio_snd.h
β
X
π virtio_types.h
β
X
π virtio_vsock.h
β
X
π vm_sockets.h
β
X
π vm_sockets_diag.h
β
X
π vmcore.h
β
X
π vsockmon.h
β
X
π vt.h
β
X
π vtpm_proxy.h
β
X
π wait.h
β
X
π watch_queue.h
β
X
π watchdog.h
β
X
π wireguard.h
β
X
π wireless.h
β
X
π wmi.h
β
X
π wwan.h
β
X
π x25.h
β
X
π xattr.h
β
X
π xdp_diag.h
β
X
π xfrm.h
β
X
π xilinx-v4l2-controls.h
β
X
π zorro.h
β
X
π zorro_ids.h
β
X
SAVING...
BERHASIL DIUBAH!
EDITING: virtio_ring.h
#ifndef _LINUX_VIRTIO_RING_H #define _LINUX_VIRTIO_RING_H /* An interface for efficient virtio implementation, currently for use by KVM, * but hopefully others soon. Do NOT change this since it will * break existing servers and clients. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ #include <stdint.h> #include <linux/types.h> #include <linux/virtio_types.h> /* This marks a buffer as continuing via the next field. */ #define VRING_DESC_F_NEXT 1 /* This marks a buffer as write-only (otherwise read-only). */ #define VRING_DESC_F_WRITE 2 /* This means the buffer contains a list of buffer descriptors. */ #define VRING_DESC_F_INDIRECT 4 /* * Mark a descriptor as available or used in packed ring. * Notice: they are defined as shifts instead of shifted values. */ #define VRING_PACKED_DESC_F_AVAIL 7 #define VRING_PACKED_DESC_F_USED 15 /* The Host uses this in used->flags to advise the Guest: don't kick me when * you add a buffer. It's unreliable, so it's simply an optimization. Guest * will still kick if it's out of buffers. */ #define VRING_USED_F_NO_NOTIFY 1 /* The Guest uses this in avail->flags to advise the Host: don't interrupt me * when you consume a buffer. It's unreliable, so it's simply an * optimization. */ #define VRING_AVAIL_F_NO_INTERRUPT 1 /* Enable events in packed ring. */ #define VRING_PACKED_EVENT_FLAG_ENABLE 0x0 /* Disable events in packed ring. */ #define VRING_PACKED_EVENT_FLAG_DISABLE 0x1 /* * Enable events for a specific descriptor in packed ring. * (as specified by Descriptor Ring Change Event Offset/Wrap Counter). * Only valid if VIRTIO_RING_F_EVENT_IDX has been negotiated. */ #define VRING_PACKED_EVENT_FLAG_DESC 0x2 /* * Wrap counter bit shift in event suppression structure * of packed ring. */ #define VRING_PACKED_EVENT_F_WRAP_CTR 15 /* We support indirect buffer descriptors */ #define VIRTIO_RING_F_INDIRECT_DESC 28 /* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick * at the end of the used ring. Guest should ignore the used->flags field. */ #define VIRTIO_RING_F_EVENT_IDX 29 /* Alignment requirements for vring elements. * When using pre-virtio 1.0 layout, these fall out naturally. */ #define VRING_AVAIL_ALIGN_SIZE 2 #define VRING_USED_ALIGN_SIZE 4 #define VRING_DESC_ALIGN_SIZE 16 /** * struct vring_desc - Virtio ring descriptors, * 16 bytes long. These can chain together via @next. * * @addr: buffer address (guest-physical) * @len: buffer length * @flags: descriptor flags * @next: index of the next descriptor in the chain, * if the VRING_DESC_F_NEXT flag is set. We chain unused * descriptors via this, too. */ struct vring_desc { __virtio64 addr; __virtio32 len; __virtio16 flags; __virtio16 next; }; struct vring_avail { __virtio16 flags; __virtio16 idx; __virtio16 ring[]; }; /* u32 is used here for ids for padding reasons. */ struct vring_used_elem { /* Index of start of used descriptor chain. */ __virtio32 id; /* Total length of the descriptor chain which was used (written to) */ __virtio32 len; }; typedef struct vring_used_elem __attribute__((aligned(VRING_USED_ALIGN_SIZE))) vring_used_elem_t; struct vring_used { __virtio16 flags; __virtio16 idx; vring_used_elem_t ring[]; }; /* * The ring element addresses are passed between components with different * alignments assumptions. Thus, we might need to decrease the compiler-selected * alignment, and so must use a typedef to make sure the aligned attribute * actually takes hold: * * https://gcc.gnu.org/onlinedocs//gcc/Common-Type-Attributes.html#Common-Type-Attributes * * When used on a struct, or struct member, the aligned attribute can only * increase the alignment; in order to decrease it, the packed attribute must * be specified as well. When used as part of a typedef, the aligned attribute * can both increase and decrease alignment, and specifying the packed * attribute generates a warning. */ typedef struct vring_desc __attribute__((aligned(VRING_DESC_ALIGN_SIZE))) vring_desc_t; typedef struct vring_avail __attribute__((aligned(VRING_AVAIL_ALIGN_SIZE))) vring_avail_t; typedef struct vring_used __attribute__((aligned(VRING_USED_ALIGN_SIZE))) vring_used_t; struct vring { unsigned int num; vring_desc_t *desc; vring_avail_t *avail; vring_used_t *used; }; #ifndef VIRTIO_RING_NO_LEGACY /* The standard layout for the ring is a continuous chunk of memory which looks * like this. We assume num is a power of 2. * * struct vring * { * // The actual descriptors (16 bytes each) * struct vring_desc desc[num]; * * // A ring of available descriptor heads with free-running index. * __virtio16 avail_flags; * __virtio16 avail_idx; * __virtio16 available[num]; * __virtio16 used_event_idx; * * // Padding to the next align boundary. * char pad[]; * * // A ring of used descriptor heads with free-running index. * __virtio16 used_flags; * __virtio16 used_idx; * struct vring_used_elem used[num]; * __virtio16 avail_event_idx; * }; */ /* We publish the used event index at the end of the available ring, and vice * versa. They are at the end for backwards compatibility. */ #define vring_used_event(vr) ((vr)->avail->ring[(vr)->num]) #define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num]) static __inline__ void vring_init(struct vring *vr, unsigned int num, void *p, unsigned long align) { vr->num = num; vr->desc = p; vr->avail = (struct vring_avail *)((char *)p + num * sizeof(struct vring_desc)); vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) + align-1) & ~(align - 1)); } static __inline__ unsigned vring_size(unsigned int num, unsigned long align) { return ((sizeof(struct vring_desc) * num + sizeof(__virtio16) * (3 + num) + align - 1) & ~(align - 1)) + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num; } #endif /* VIRTIO_RING_NO_LEGACY */ /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ /* Assuming a given event_idx value from the other side, if * we have just incremented index from old to new_idx, * should we trigger an event? */ static __inline__ int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old) { /* Note: Xen has similar logic for notification hold-off * in include/xen/interface/io/ring.h with req_event and req_prod * corresponding to event_idx + 1 and new_idx respectively. * Note also that req_event and req_prod in Xen start at 1, * event indexes in virtio start at 0. */ return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old); } struct vring_packed_desc_event { /* Descriptor Ring Change Event Offset/Wrap Counter. */ __le16 off_wrap; /* Descriptor Ring Change Event Flags. */ __le16 flags; }; struct vring_packed_desc { /* Buffer Address. */ __le64 addr; /* Buffer Length. */ __le32 len; /* Buffer ID. */ __le16 id; /* The flags depending on descriptor type. */ __le16 flags; }; #endif /* _LINUX_VIRTIO_RING_H */
SIMPAN PERUBAHAN