Showing the changes to include/uapi/linux (379 of 578 files). Show all
Unified · Split
| @@ -22,3 +22,396 @@ header-y += usb/ · 21 unmodified lines | ||
| 22 | 22 | header-y += wimax/ |
| 23 | 23 | |
| 24 | 24 | genhdr-y += version.h |
| 25 | + | |
| 26 | +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h \ | |
| 27 | + $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h),) | |
| 28 | +header-y += a.out.h | |
| 29 | +endif | |
| 30 | + | |
| 31 | +header-y += acct.h | |
| 32 | +header-y += adb.h | |
| 33 | +header-y += adfs_fs.h | |
| 34 | +header-y += affs_hardblocks.h | |
| 35 | +header-y += agpgart.h | |
| 36 | +header-y += aio_abi.h | |
| 37 | +header-y += apm_bios.h | |
| 38 | +header-y += arcfb.h | |
| 39 | +header-y += atalk.h | |
| 40 | +header-y += atm.h | |
| 41 | +header-y += atm_eni.h | |
| 42 | +header-y += atm_he.h | |
| 43 | +header-y += atm_idt77105.h | |
| 44 | +header-y += atm_nicstar.h | |
| 45 | +header-y += atm_tcp.h | |
| 46 | +header-y += atm_zatm.h | |
| 47 | +header-y += atmapi.h | |
| 48 | +header-y += atmarp.h | |
| 49 | +header-y += atmbr2684.h | |
| 50 | +header-y += atmclip.h | |
| 51 | +header-y += atmdev.h | |
| 52 | +header-y += atmioc.h | |
| 53 | +header-y += atmlec.h | |
| 54 | +header-y += atmmpc.h | |
| 55 | +header-y += atmppp.h | |
| 56 | +header-y += atmsap.h | |
| 57 | +header-y += atmsvc.h | |
| 58 | +header-y += audit.h | |
| 59 | +header-y += auto_fs.h | |
| 60 | +header-y += auto_fs4.h | |
| 61 | +header-y += auxvec.h | |
| 62 | +header-y += ax25.h | |
| 63 | +header-y += b1lli.h | |
| 64 | +header-y += baycom.h | |
| 65 | +header-y += bfs_fs.h | |
| 66 | +header-y += binfmts.h | |
| 67 | +header-y += blkpg.h | |
| 68 | +header-y += blktrace_api.h | |
| 69 | +header-y += bpqether.h | |
| 70 | +header-y += bsg.h | |
| 71 | +header-y += can.h | |
| 72 | +header-y += capability.h | |
| 73 | +header-y += capi.h | |
| 74 | +header-y += cciss_defs.h | |
| 75 | +header-y += cciss_ioctl.h | |
| 76 | +header-y += cdrom.h | |
| 77 | +header-y += cgroupstats.h | |
| 78 | +header-y += chio.h | |
| 79 | +header-y += cm4000_cs.h | |
| 80 | +header-y += cn_proc.h | |
| 81 | +header-y += coda.h | |
| 82 | +header-y += coda_psdev.h | |
| 83 | +header-y += coff.h | |
| 84 | +header-y += connector.h | |
| 85 | +header-y += const.h | |
| 86 | +header-y += cramfs_fs.h | |
| 87 | +header-y += cuda.h | |
| 88 | +header-y += cyclades.h | |
| 89 | +header-y += cycx_cfm.h | |
| 90 | +header-y += dcbnl.h | |
| 91 | +header-y += dccp.h | |
| 92 | +header-y += dlm.h | |
| 93 | +header-y += dlm_device.h | |
| 94 | +header-y += dlm_netlink.h | |
| 95 | +header-y += dlm_plock.h | |
| 96 | +header-y += dlmconstants.h | |
| 97 | +header-y += dm-ioctl.h | |
| 98 | +header-y += dm-log-userspace.h | |
| 99 | +header-y += dn.h | |
| 100 | +header-y += dqblk_xfs.h | |
| 101 | +header-y += edd.h | |
| 102 | +header-y += efs_fs_sb.h | |
| 103 | +header-y += elf-em.h | |
| 104 | +header-y += elf-fdpic.h | |
| 105 | +header-y += elf.h | |
| 106 | +header-y += elfcore.h | |
| 107 | +header-y += errno.h | |
| 108 | +header-y += errqueue.h | |
| 109 | +header-y += ethtool.h | |
| 110 | +header-y += eventpoll.h | |
| 111 | +header-y += fadvise.h | |
| 112 | +header-y += falloc.h | |
| 113 | +header-y += fanotify.h | |
| 114 | +header-y += fb.h | |
| 115 | +header-y += fcntl.h | |
| 116 | +header-y += fd.h | |
| 117 | +header-y += fdreg.h | |
| 118 | +header-y += fib_rules.h | |
| 119 | +header-y += fiemap.h | |
| 120 | +header-y += filter.h | |
| 121 | +header-y += firewire-cdev.h | |
| 122 | +header-y += firewire-constants.h | |
| 123 | +header-y += flat.h | |
| 124 | +header-y += fs.h | |
| 125 | +header-y += fsl_hypervisor.h | |
| 126 | +header-y += fuse.h | |
| 127 | +header-y += futex.h | |
| 128 | +header-y += gameport.h | |
| 129 | +header-y += gen_stats.h | |
| 130 | +header-y += genetlink.h | |
| 131 | +header-y += gfs2_ondisk.h | |
| 132 | +header-y += gigaset_dev.h | |
| 133 | +header-y += hdlc.h | |
| 134 | +header-y += hdlcdrv.h | |
| 135 | +header-y += hdreg.h | |
| 136 | +header-y += hid.h | |
| 137 | +header-y += hiddev.h | |
| 138 | +header-y += hidraw.h | |
| 139 | +header-y += hpet.h | |
| 140 | +header-y += hysdn_if.h | |
| 141 | +header-y += i2c-dev.h | |
| 142 | +header-y += i2c.h | |
| 143 | +header-y += i2o-dev.h | |
| 144 | +header-y += i8k.h | |
| 145 | +header-y += icmp.h | |
| 146 | +header-y += icmpv6.h | |
| 147 | +header-y += if.h | |
| 148 | +header-y += if_addr.h | |
| 149 | +header-y += if_addrlabel.h | |
| 150 | +header-y += if_alg.h | |
| 151 | +header-y += if_arcnet.h | |
| 152 | +header-y += if_arp.h | |
| 153 | +header-y += if_bonding.h | |
| 154 | +header-y += if_bridge.h | |
| 155 | +header-y += if_cablemodem.h | |
| 156 | +header-y += if_eql.h | |
| 157 | +header-y += if_ether.h | |
| 158 | +header-y += if_fc.h | |
| 159 | +header-y += if_fddi.h | |
| 160 | +header-y += if_frad.h | |
| 161 | +header-y += if_hippi.h | |
| 162 | +header-y += if_infiniband.h | |
| 163 | +header-y += if_link.h | |
| 164 | +header-y += if_ltalk.h | |
| 165 | +header-y += if_packet.h | |
| 166 | +header-y += if_phonet.h | |
| 167 | +header-y += if_plip.h | |
| 168 | +header-y += if_ppp.h | |
| 169 | +header-y += if_pppol2tp.h | |
| 170 | +header-y += if_pppox.h | |
| 171 | +header-y += if_slip.h | |
| 172 | +header-y += if_team.h | |
| 173 | +header-y += if_tun.h | |
| 174 | +header-y += if_tunnel.h | |
| 175 | +header-y += if_vlan.h | |
| 176 | +header-y += if_x25.h | |
| 177 | +header-y += igmp.h | |
| 178 | +header-y += in.h | |
| 179 | +header-y += in6.h | |
| 180 | +header-y += in_route.h | |
| 181 | +header-y += inet_diag.h | |
| 182 | +header-y += inotify.h | |
| 183 | +header-y += input.h | |
| 184 | +header-y += ioctl.h | |
| 185 | +header-y += ip.h | |
| 186 | +header-y += ip6_tunnel.h | |
| 187 | +header-y += ip_vs.h | |
| 188 | +header-y += ipc.h | |
| 189 | +header-y += ipmi.h | |
| 190 | +header-y += ipmi_msgdefs.h | |
| 191 | +header-y += ipsec.h | |
| 192 | +header-y += ipv6.h | |
| 193 | +header-y += ipv6_route.h | |
| 194 | +header-y += ipx.h | |
| 195 | +header-y += irda.h | |
| 196 | +header-y += irqnr.h | |
| 197 | +header-y += isdn.h | |
| 198 | +header-y += isdn_divertif.h | |
| 199 | +header-y += isdn_ppp.h | |
| 200 | +header-y += isdnif.h | |
| 201 | +header-y += iso_fs.h | |
| 202 | +header-y += ivtv.h | |
| 203 | +header-y += ivtvfb.h | |
| 204 | +header-y += ixjuser.h | |
| 205 | +header-y += jffs2.h | |
| 206 | +header-y += joystick.h | |
| 207 | +header-y += kd.h | |
| 208 | +header-y += kdev_t.h | |
| 209 | +header-y += kernel-page-flags.h | |
| 210 | +header-y += kernel.h | |
| 211 | +header-y += kernelcapi.h | |
| 212 | +header-y += kexec.h | |
| 213 | +header-y += keyboard.h | |
| 214 | +header-y += keyctl.h | |
| 215 | + | |
| 216 | +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h \ | |
| 217 | + $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h),) | |
| 218 | +header-y += kvm.h | |
| 219 | +endif | |
| 220 | + | |
| 221 | + | |
| 222 | +ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \ | |
| 223 | + $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h),) | |
| 224 | +header-y += kvm_para.h | |
| 225 | +endif | |
| 226 | + | |
| 227 | +header-y += l2tp.h | |
| 228 | +header-y += limits.h | |
| 229 | +header-y += llc.h | |
| 230 | +header-y += loop.h | |
| 231 | +header-y += lp.h | |
| 232 | +header-y += magic.h | |
| 233 | +header-y += major.h | |
| 234 | +header-y += map_to_7segment.h | |
| 235 | +header-y += matroxfb.h | |
| 236 | +header-y += mdio.h | |
| 237 | +header-y += media.h | |
| 238 | +header-y += mei.h | |
| 239 | +header-y += mempolicy.h | |
| 240 | +header-y += meye.h | |
| 241 | +header-y += mii.h | |
| 242 | +header-y += minix_fs.h | |
| 243 | +header-y += mman.h | |
| 244 | +header-y += mmtimer.h | |
| 245 | +header-y += mqueue.h | |
| 246 | +header-y += mroute.h | |
| 247 | +header-y += mroute6.h | |
| 248 | +header-y += msdos_fs.h | |
| 249 | +header-y += msg.h | |
| 250 | +header-y += mtio.h | |
| 251 | +header-y += n_r3964.h | |
| 252 | +header-y += nbd.h | |
| 253 | +header-y += ncp.h | |
| 254 | +header-y += ncp_fs.h | |
| 255 | +header-y += ncp_mount.h | |
| 256 | +header-y += ncp_no.h | |
| 257 | +header-y += neighbour.h | |
| 258 | +header-y += net.h | |
| 259 | +header-y += net_dropmon.h | |
| 260 | +header-y += net_tstamp.h | |
| 261 | +header-y += netdevice.h | |
| 262 | +header-y += netfilter.h | |
| 263 | +header-y += netfilter_arp.h | |
| 264 | +header-y += netfilter_bridge.h | |
| 265 | +header-y += netfilter_decnet.h | |
| 266 | +header-y += netfilter_ipv4.h | |
| 267 | +header-y += netfilter_ipv6.h | |
| 268 | +header-y += netlink.h | |
| 269 | +header-y += netrom.h | |
| 270 | +header-y += nfc.h | |
| 271 | +header-y += nfs.h | |
| 272 | +header-y += nfs2.h | |
| 273 | +header-y += nfs3.h | |
| 274 | +header-y += nfs4.h | |
| 275 | +header-y += nfs4_mount.h | |
| 276 | +header-y += nfs_fs.h | |
| 277 | +header-y += nfs_idmap.h | |
| 278 | +header-y += nfs_mount.h | |
| 279 | +header-y += nfsacl.h | |
| 280 | +header-y += nl80211.h | |
| 281 | +header-y += nubus.h | |
| 282 | +header-y += nvram.h | |
| 283 | +header-y += omap3isp.h | |
| 284 | +header-y += omapfb.h | |
| 285 | +header-y += oom.h | |
| 286 | +header-y += packet_diag.h | |
| 287 | +header-y += param.h | |
| 288 | +header-y += parport.h | |
| 289 | +header-y += patchkey.h | |
| 290 | +header-y += pci.h | |
| 291 | +header-y += pci_regs.h | |
| 292 | +header-y += perf_event.h | |
| 293 | +header-y += personality.h | |
| 294 | +header-y += pfkeyv2.h | |
| 295 | +header-y += pg.h | |
| 296 | +header-y += phantom.h | |
| 297 | +header-y += phonet.h | |
| 298 | +header-y += pkt_cls.h | |
| 299 | +header-y += pkt_sched.h | |
| 300 | +header-y += pktcdvd.h | |
| 301 | +header-y += pmu.h | |
| 302 | +header-y += poll.h | |
| 303 | +header-y += posix_types.h | |
| 304 | +header-y += ppdev.h | |
| 305 | +header-y += ppp-comp.h | |
| 306 | +header-y += ppp-ioctl.h | |
| 307 | +header-y += ppp_defs.h | |
| 308 | +header-y += pps.h | |
| 309 | +header-y += prctl.h | |
| 310 | +header-y += ptp_clock.h | |
| 311 | +header-y += ptrace.h | |
| 312 | +header-y += qnx4_fs.h | |
| 313 | +header-y += qnxtypes.h | |
| 314 | +header-y += quota.h | |
| 315 | +header-y += radeonfb.h | |
| 316 | +header-y += random.h | |
| 317 | +header-y += raw.h | |
| 318 | +header-y += rds.h | |
| 319 | +header-y += reboot.h | |
| 320 | +header-y += reiserfs_fs.h | |
| 321 | +header-y += reiserfs_xattr.h | |
| 322 | +header-y += resource.h | |
| 323 | +header-y += rfkill.h | |
| 324 | +header-y += romfs_fs.h | |
| 325 | +header-y += rose.h | |
| 326 | +header-y += route.h | |
| 327 | +header-y += rtc.h | |
| 328 | +header-y += rtnetlink.h | |
| 329 | +header-y += scc.h | |
| 330 | +header-y += sched.h | |
| 331 | +header-y += screen_info.h | |
| 332 | +header-y += sdla.h | |
| 333 | +header-y += seccomp.h | |
| 334 | +header-y += securebits.h | |
| 335 | +header-y += selinux_netlink.h | |
| 336 | +header-y += sem.h | |
| 337 | +header-y += serial.h | |
| 338 | +header-y += serial_core.h | |
| 339 | +header-y += serial_reg.h | |
| 340 | +header-y += serio.h | |
| 341 | +header-y += shm.h | |
| 342 | +header-y += signal.h | |
| 343 | +header-y += signalfd.h | |
| 344 | +header-y += snmp.h | |
| 345 | +header-y += sock_diag.h | |
| 346 | +header-y += socket.h | |
| 347 | +header-y += sockios.h | |
| 348 | +header-y += som.h | |
| 349 | +header-y += sonet.h | |
| 350 | +header-y += sonypi.h | |
| 351 | +header-y += sound.h | |
| 352 | +header-y += soundcard.h | |
| 353 | +header-y += stat.h | |
| 354 | +header-y += stddef.h | |
| 355 | +header-y += string.h | |
| 356 | +header-y += suspend_ioctls.h | |
| 357 | +header-y += swab.h | |
| 358 | +header-y += synclink.h | |
| 359 | +header-y += sysctl.h | |
| 360 | +header-y += sysinfo.h | |
| 361 | +header-y += taskstats.h | |
| 362 | +header-y += tcp.h | |
| 363 | +header-y += tcp_metrics.h | |
| 364 | +header-y += telephony.h | |
| 365 | +header-y += termios.h | |
| 366 | +header-y += time.h | |
| 367 | +header-y += times.h | |
| 368 | +header-y += timex.h | |
| 369 | +header-y += tiocl.h | |
| 370 | +header-y += tipc.h | |
| 371 | +header-y += tipc_config.h | |
| 372 | +header-y += toshiba.h | |
| 373 | +header-y += tty.h | |
| 374 | +header-y += tty_flags.h | |
| 375 | +header-y += types.h | |
| 376 | +header-y += udf_fs_i.h | |
| 377 | +header-y += udp.h | |
| 378 | +header-y += uhid.h | |
| 379 | +header-y += uinput.h | |
| 380 | +header-y += uio.h | |
| 381 | +header-y += ultrasound.h | |
| 382 | +header-y += un.h | |
| 383 | +header-y += unistd.h | |
| 384 | +header-y += unix_diag.h | |
| 385 | +header-y += usbdevice_fs.h | |
| 386 | +header-y += utime.h | |
| 387 | +header-y += utsname.h | |
| 388 | +header-y += uuid.h | |
| 389 | +header-y += uvcvideo.h | |
| 390 | +header-y += v4l2-common.h | |
| 391 | +header-y += v4l2-controls.h | |
| 392 | +header-y += v4l2-dv-timings.h | |
| 393 | +header-y += v4l2-mediabus.h | |
| 394 | +header-y += v4l2-subdev.h | |
| 395 | +header-y += veth.h | |
| 396 | +header-y += vfio.h | |
| 397 | +header-y += vhost.h | |
| 398 | +header-y += videodev2.h | |
| 399 | +header-y += virtio_9p.h | |
| 400 | +header-y += virtio_balloon.h | |
| 401 | +header-y += virtio_blk.h | |
| 402 | +header-y += virtio_config.h | |
| 403 | +header-y += virtio_console.h | |
| 404 | +header-y += virtio_ids.h | |
| 405 | +header-y += virtio_net.h | |
| 406 | +header-y += virtio_pci.h | |
| 407 | +header-y += virtio_ring.h | |
| 408 | +header-y += virtio_rng.h | |
| 409 | +header-y += vt.h | |
| 410 | +header-y += wait.h | |
| 411 | +header-y += wanrouter.h | |
| 412 | +header-y += watchdog.h | |
| 413 | +header-y += wimax.h | |
| 414 | +header-y += wireless.h | |
| 415 | +header-y += x25.h | |
| 416 | +header-y += xattr.h | |
| 417 | +header-y += xfrm.h | |
| @@ -0,0 +1,274 @@ | ||
| 1 | +#ifndef _UAPI__A_OUT_GNU_H__ | |
| 2 | +#define _UAPI__A_OUT_GNU_H__ | |
| 3 | + | |
| 4 | +#define __GNU_EXEC_MACROS__ | |
| 5 | + | |
| 6 | +#ifndef __STRUCT_EXEC_OVERRIDE__ | |
| 7 | + | |
| 8 | +#include <asm/a.out.h> | |
| 9 | + | |
| 10 | +#endif /* __STRUCT_EXEC_OVERRIDE__ */ | |
| 11 | + | |
| 12 | +#ifndef __ASSEMBLY__ | |
| 13 | + | |
| 14 | +/* these go in the N_MACHTYPE field */ | |
| 15 | +enum machine_type { | |
| 16 | +#if defined (M_OLDSUN2) | |
| 17 | + M__OLDSUN2 = M_OLDSUN2, | |
| 18 | +#else | |
| 19 | + M_OLDSUN2 = 0, | |
| 20 | +#endif | |
| 21 | +#if defined (M_68010) | |
| 22 | + M__68010 = M_68010, | |
| 23 | +#else | |
| 24 | + M_68010 = 1, | |
| 25 | +#endif | |
| 26 | +#if defined (M_68020) | |
| 27 | + M__68020 = M_68020, | |
| 28 | +#else | |
| 29 | + M_68020 = 2, | |
| 30 | +#endif | |
| 31 | +#if defined (M_SPARC) | |
| 32 | + M__SPARC = M_SPARC, | |
| 33 | +#else | |
| 34 | + M_SPARC = 3, | |
| 35 | +#endif | |
| 36 | + /* skip a bunch so we don't run into any of sun's numbers */ | |
| 37 | + M_386 = 100, | |
| 38 | + M_MIPS1 = 151, /* MIPS R3000/R3000 binary */ | |
| 39 | + M_MIPS2 = 152 /* MIPS R6000/R4000 binary */ | |
| 40 | +}; | |
| 41 | + | |
| 42 | +#if !defined (N_MAGIC) | |
| 43 | +#define N_MAGIC(exec) ((exec).a_info & 0xffff) | |
| 44 | +#endif | |
| 45 | +#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) | |
| 46 | +#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) | |
| 47 | +#define N_SET_INFO(exec, magic, type, flags) \ | |
| 48 | + ((exec).a_info = ((magic) & 0xffff) \ | |
| 49 | + | (((int)(type) & 0xff) << 16) \ | |
| 50 | + | (((flags) & 0xff) << 24)) | |
| 51 | +#define N_SET_MAGIC(exec, magic) \ | |
| 52 | + ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) | |
| 53 | + | |
| 54 | +#define N_SET_MACHTYPE(exec, machtype) \ | |
| 55 | + ((exec).a_info = \ | |
| 56 | + ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) | |
| 57 | + | |
| 58 | +#define N_SET_FLAGS(exec, flags) \ | |
| 59 | + ((exec).a_info = \ | |
| 60 | + ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) | |
| 61 | + | |
| 62 | +/* Code indicating object file or impure executable. */ | |
| 63 | +#define OMAGIC 0407 | |
| 64 | +/* Code indicating pure executable. */ | |
| 65 | +#define NMAGIC 0410 | |
| 66 | +/* Code indicating demand-paged executable. */ | |
| 67 | +#define ZMAGIC 0413 | |
| 68 | +/* This indicates a demand-paged executable with the header in the text. | |
| 69 | + The first page is unmapped to help trap NULL pointer references */ | |
| 70 | +#define QMAGIC 0314 | |
| 71 | + | |
| 72 | +/* Code indicating core file. */ | |
| 73 | +#define CMAGIC 0421 | |
| 74 | + | |
| 75 | +#if !defined (N_BADMAG) | |
| 76 | +#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \ | |
| 77 | + && N_MAGIC(x) != NMAGIC \ | |
| 78 | + && N_MAGIC(x) != ZMAGIC \ | |
| 79 | + && N_MAGIC(x) != QMAGIC) | |
| 80 | +#endif | |
| 81 | + | |
| 82 | +#define _N_HDROFF(x) (1024 - sizeof (struct exec)) | |
| 83 | + | |
| 84 | +#if !defined (N_TXTOFF) | |
| 85 | +#define N_TXTOFF(x) \ | |
| 86 | + (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \ | |
| 87 | + (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) | |
| 88 | +#endif | |
| 89 | + | |
| 90 | +#if !defined (N_DATOFF) | |
| 91 | +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) | |
| 92 | +#endif | |
| 93 | + | |
| 94 | +#if !defined (N_TRELOFF) | |
| 95 | +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) | |
| 96 | +#endif | |
| 97 | + | |
| 98 | +#if !defined (N_DRELOFF) | |
| 99 | +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) | |
| 100 | +#endif | |
| 101 | + | |
| 102 | +#if !defined (N_SYMOFF) | |
| 103 | +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) | |
| 104 | +#endif | |
| 105 | + | |
| 106 | +#if !defined (N_STROFF) | |
| 107 | +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) | |
| 108 | +#endif | |
| 109 | + | |
| 110 | +/* Address of text segment in memory after it is loaded. */ | |
| 111 | +#if !defined (N_TXTADDR) | |
| 112 | +#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0) | |
| 113 | +#endif | |
| 114 | + | |
| 115 | +/* Address of data segment in memory after it is loaded. | |
| 116 | + Note that it is up to you to define SEGMENT_SIZE | |
| 117 | + on machines not listed here. */ | |
| 118 | +#if defined(vax) || defined(hp300) || defined(pyr) | |
| 119 | +#define SEGMENT_SIZE page_size | |
| 120 | +#endif | |
| 121 | +#ifdef sony | |
| 122 | +#define SEGMENT_SIZE 0x2000 | |
| 123 | +#endif /* Sony. */ | |
| 124 | +#ifdef is68k | |
| 125 | +#define SEGMENT_SIZE 0x20000 | |
| 126 | +#endif | |
| 127 | +#if defined(m68k) && defined(PORTAR) | |
| 128 | +#define PAGE_SIZE 0x400 | |
| 129 | +#define SEGMENT_SIZE PAGE_SIZE | |
| 130 | +#endif | |
| 131 | + | |
| 132 | +#ifdef linux | |
| 133 | +#ifndef __KERNEL__ | |
| 134 | +#include <unistd.h> | |
| 135 | +#endif | |
| 136 | +#if defined(__i386__) || defined(__mc68000__) | |
| 137 | +#define SEGMENT_SIZE 1024 | |
| 138 | +#else | |
| 139 | +#ifndef SEGMENT_SIZE | |
| 140 | +#ifndef __KERNEL__ | |
| 141 | +#define SEGMENT_SIZE getpagesize() | |
| 142 | +#endif | |
| 143 | +#endif | |
| 144 | +#endif | |
| 145 | +#endif | |
| 146 | + | |
| 147 | +#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) | |
| 148 | + | |
| 149 | +#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) | |
| 150 | + | |
| 151 | +#ifndef N_DATADDR | |
| 152 | +#define N_DATADDR(x) \ | |
| 153 | + (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \ | |
| 154 | + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) | |
| 155 | +#endif | |
| 156 | + | |
| 157 | +/* Address of bss segment in memory after it is loaded. */ | |
| 158 | +#if !defined (N_BSSADDR) | |
| 159 | +#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) | |
| 160 | +#endif | |
| 161 | + | |
| 162 | +#if !defined (N_NLIST_DECLARED) | |
| 163 | +struct nlist { | |
| 164 | + union { | |
| 165 | + char *n_name; | |
| 166 | + struct nlist *n_next; | |
| 167 | + long n_strx; | |
| 168 | + } n_un; | |
| 169 | + unsigned char n_type; | |
| 170 | + char n_other; | |
| 171 | + short n_desc; | |
| 172 | + unsigned long n_value; | |
| 173 | +}; | |
| 174 | +#endif /* no N_NLIST_DECLARED. */ | |
| 175 | + | |
| 176 | +#if !defined (N_UNDF) | |
| 177 | +#define N_UNDF 0 | |
| 178 | +#endif | |
| 179 | +#if !defined (N_ABS) | |
| 180 | +#define N_ABS 2 | |
| 181 | +#endif | |
| 182 | +#if !defined (N_TEXT) | |
| 183 | +#define N_TEXT 4 | |
| 184 | +#endif | |
| 185 | +#if !defined (N_DATA) | |
| 186 | +#define N_DATA 6 | |
| 187 | +#endif | |
| 188 | +#if !defined (N_BSS) | |
| 189 | +#define N_BSS 8 | |
| 190 | +#endif | |
| 191 | +#if !defined (N_FN) | |
| 192 | +#define N_FN 15 | |
| 193 | +#endif | |
| 194 | + | |
| 195 | +#if !defined (N_EXT) | |
| 196 | +#define N_EXT 1 | |
| 197 | +#endif | |
| 198 | +#if !defined (N_TYPE) | |
| 199 | +#define N_TYPE 036 | |
| 200 | +#endif | |
| 201 | +#if !defined (N_STAB) | |
| 202 | +#define N_STAB 0340 | |
| 203 | +#endif | |
| 204 | + | |
| 205 | +/* The following type indicates the definition of a symbol as being | |
| 206 | + an indirect reference to another symbol. The other symbol | |
| 207 | + appears as an undefined reference, immediately following this symbol. | |
| 208 | + | |
| 209 | + Indirection is asymmetrical. The other symbol's value will be used | |
| 210 | + to satisfy requests for the indirect symbol, but not vice versa. | |
| 211 | + If the other symbol does not have a definition, libraries will | |
| 212 | + be searched to find a definition. */ | |
| 213 | +#define N_INDR 0xa | |
| 214 | + | |
| 215 | +/* The following symbols refer to set elements. | |
| 216 | + All the N_SET[ATDB] symbols with the same name form one set. | |
| 217 | + Space is allocated for the set in the text section, and each set | |
| 218 | + element's value is stored into one word of the space. | |
| 219 | + The first word of the space is the length of the set (number of elements). | |
| 220 | + | |
| 221 | + The address of the set is made into an N_SETV symbol | |
| 222 | + whose name is the same as the name of the set. | |
| 223 | + This symbol acts like a N_DATA global symbol | |
| 224 | + in that it can satisfy undefined external references. */ | |
| 225 | + | |
| 226 | +/* These appear as input to LD, in a .o file. */ | |
| 227 | +#define N_SETA 0x14 /* Absolute set element symbol */ | |
| 228 | +#define N_SETT 0x16 /* Text set element symbol */ | |
| 229 | +#define N_SETD 0x18 /* Data set element symbol */ | |
| 230 | +#define N_SETB 0x1A /* Bss set element symbol */ | |
| 231 | + | |
| 232 | +/* This is output from LD. */ | |
| 233 | +#define N_SETV 0x1C /* Pointer to set vector in data area. */ | |
| 234 | + | |
| 235 | +#if !defined (N_RELOCATION_INFO_DECLARED) | |
| 236 | +/* This structure describes a single relocation to be performed. | |
| 237 | + The text-relocation section of the file is a vector of these structures, | |
| 238 | + all of which apply to the text section. | |
| 239 | + Likewise, the data-relocation section applies to the data section. */ | |
| 240 | + | |
| 241 | +struct relocation_info | |
| 242 | +{ | |
| 243 | + /* Address (within segment) to be relocated. */ | |
| 244 | + int r_address; | |
| 245 | + /* The meaning of r_symbolnum depends on r_extern. */ | |
| 246 | + unsigned int r_symbolnum:24; | |
| 247 | + /* Nonzero means value is a pc-relative offset | |
| 248 | + and it should be relocated for changes in its own address | |
| 249 | + as well as for changes in the symbol or section specified. */ | |
| 250 | + unsigned int r_pcrel:1; | |
| 251 | + /* Length (as exponent of 2) of the field to be relocated. | |
| 252 | + Thus, a value of 2 indicates 1<<2 bytes. */ | |
| 253 | + unsigned int r_length:2; | |
| 254 | + /* 1 => relocate with value of symbol. | |
| 255 | + r_symbolnum is the index of the symbol | |
| 256 | + in file's the symbol table. | |
| 257 | + 0 => relocate with the address of a segment. | |
| 258 | + r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS | |
| 259 | + (the N_EXT bit may be set also, but signifies nothing). */ | |
| 260 | + unsigned int r_extern:1; | |
| 261 | + /* Four bits that aren't used, but when writing an object file | |
| 262 | + it is desirable to clear them. */ | |
| 263 | +#ifdef NS32K | |
| 264 | + unsigned r_bsr:1; | |
| 265 | + unsigned r_disp:1; | |
| 266 | + unsigned r_pad:2; | |
| 267 | +#else | |
| 268 | + unsigned int r_pad:4; | |
| 269 | +#endif | |
| 270 | +}; | |
| 271 | +#endif /* no N_RELOCATION_INFO_DECLARED. */ | |
| 272 | + | |
| 273 | +#endif /*__ASSEMBLY__ */ | |
| 274 | +#endif /* _UAPI__A_OUT_GNU_H__ */ | |
| @@ -0,0 +1,122 @@ | ||
| 1 | +/* | |
| 2 | + * BSD Process Accounting for Linux - Definitions | |
| 3 | + * | |
| 4 | + * Author: Marco van Wieringen (mvw@planets.elm.net) | |
| 5 | + * | |
| 6 | + * This header file contains the definitions needed to implement | |
| 7 | + * BSD-style process accounting. The kernel accounting code and all | |
| 8 | + * user-level programs that try to do something useful with the | |
| 9 | + * process accounting log must include this file. | |
| 10 | + * | |
| 11 | + * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. | |
| 12 | + * | |
| 13 | + */ | |
| 14 | + | |
| 15 | +#ifndef _UAPI_LINUX_ACCT_H | |
| 16 | +#define _UAPI_LINUX_ACCT_H | |
| 17 | + | |
| 18 | +#include <linux/types.h> | |
| 19 | + | |
| 20 | +#include <asm/param.h> | |
| 21 | +#include <asm/byteorder.h> | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * comp_t is a 16-bit "floating" point number with a 3-bit base 8 | |
| 25 | + * exponent and a 13-bit fraction. | |
| 26 | + * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction | |
| 27 | + * (leading 1 not stored). | |
| 28 | + * See linux/kernel/acct.c for the specific encoding systems used. | |
| 29 | + */ | |
| 30 | + | |
| 31 | +typedef __u16 comp_t; | |
| 32 | +typedef __u32 comp2_t; | |
| 33 | + | |
| 34 | +/* | |
| 35 | + * accounting file record | |
| 36 | + * | |
| 37 | + * This structure contains all of the information written out to the | |
| 38 | + * process accounting file whenever a process exits. | |
| 39 | + */ | |
| 40 | + | |
| 41 | +#define ACCT_COMM 16 | |
| 42 | + | |
| 43 | +struct acct | |
| 44 | +{ | |
| 45 | + char ac_flag; /* Flags */ | |
| 46 | + char ac_version; /* Always set to ACCT_VERSION */ | |
| 47 | + /* for binary compatibility back until 2.0 */ | |
| 48 | + __u16 ac_uid16; /* LSB of Real User ID */ | |
| 49 | + __u16 ac_gid16; /* LSB of Real Group ID */ | |
| 50 | + __u16 ac_tty; /* Control Terminal */ | |
| 51 | + __u32 ac_btime; /* Process Creation Time */ | |
| 52 | + comp_t ac_utime; /* User Time */ | |
| 53 | + comp_t ac_stime; /* System Time */ | |
| 54 | + comp_t ac_etime; /* Elapsed Time */ | |
| 55 | + comp_t ac_mem; /* Average Memory Usage */ | |
| 56 | + comp_t ac_io; /* Chars Transferred */ | |
| 57 | + comp_t ac_rw; /* Blocks Read or Written */ | |
| 58 | + comp_t ac_minflt; /* Minor Pagefaults */ | |
| 59 | + comp_t ac_majflt; /* Major Pagefaults */ | |
| 60 | + comp_t ac_swaps; /* Number of Swaps */ | |
| 61 | +/* m68k had no padding here. */ | |
| 62 | +#if !defined(CONFIG_M68K) || !defined(__KERNEL__) | |
| 63 | + __u16 ac_ahz; /* AHZ */ | |
| 64 | +#endif | |
| 65 | + __u32 ac_exitcode; /* Exitcode */ | |
| 66 | + char ac_comm[ACCT_COMM + 1]; /* Command Name */ | |
| 67 | + __u8 ac_etime_hi; /* Elapsed Time MSB */ | |
| 68 | + __u16 ac_etime_lo; /* Elapsed Time LSB */ | |
| 69 | + __u32 ac_uid; /* Real User ID */ | |
| 70 | + __u32 ac_gid; /* Real Group ID */ | |
| 71 | +}; | |
| 72 | + | |
| 73 | +struct acct_v3 | |
| 74 | +{ | |
| 75 | + char ac_flag; /* Flags */ | |
| 76 | + char ac_version; /* Always set to ACCT_VERSION */ | |
| 77 | + __u16 ac_tty; /* Control Terminal */ | |
| 78 | + __u32 ac_exitcode; /* Exitcode */ | |
| 79 | + __u32 ac_uid; /* Real User ID */ | |
| 80 | + __u32 ac_gid; /* Real Group ID */ | |
| 81 | + __u32 ac_pid; /* Process ID */ | |
| 82 | + __u32 ac_ppid; /* Parent Process ID */ | |
| 83 | + __u32 ac_btime; /* Process Creation Time */ | |
| 84 | +#ifdef __KERNEL__ | |
| 85 | + __u32 ac_etime; /* Elapsed Time */ | |
| 86 | +#else | |
| 87 | + float ac_etime; /* Elapsed Time */ | |
| 88 | +#endif | |
| 89 | + comp_t ac_utime; /* User Time */ | |
| 90 | + comp_t ac_stime; /* System Time */ | |
| 91 | + comp_t ac_mem; /* Average Memory Usage */ | |
| 92 | + comp_t ac_io; /* Chars Transferred */ | |
| 93 | + comp_t ac_rw; /* Blocks Read or Written */ | |
| 94 | + comp_t ac_minflt; /* Minor Pagefaults */ | |
| 95 | + comp_t ac_majflt; /* Major Pagefaults */ | |
| 96 | + comp_t ac_swaps; /* Number of Swaps */ | |
| 97 | + char ac_comm[ACCT_COMM]; /* Command Name */ | |
| 98 | +}; | |
| 99 | + | |
| 100 | +/* | |
| 101 | + * accounting flags | |
| 102 | + */ | |
| 103 | + /* bit set when the process ... */ | |
| 104 | +#define AFORK 0x01 /* ... executed fork, but did not exec */ | |
| 105 | +#define ASU 0x02 /* ... used super-user privileges */ | |
| 106 | +#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ | |
| 107 | +#define ACORE 0x08 /* ... dumped core */ | |
| 108 | +#define AXSIG 0x10 /* ... was killed by a signal */ | |
| 109 | + | |
| 110 | +#ifdef __BIG_ENDIAN | |
| 111 | +#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ | |
| 112 | +#else | |
| 113 | +#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ | |
| 114 | +#endif | |
| 115 | + | |
| 116 | +#ifndef __KERNEL__ | |
| 117 | +#define ACCT_VERSION 2 | |
| 118 | +#define AHZ (HZ) | |
| 119 | +#endif /* __KERNEL */ | |
| 120 | + | |
| 121 | + | |
| 122 | +#endif /* _UAPI_LINUX_ACCT_H */ | |
| @@ -0,0 +1,44 @@ | ||
| 1 | +/* | |
| 2 | + * Definitions for ADB (Apple Desktop Bus) support. | |
| 3 | + */ | |
| 4 | +#ifndef _UAPI__ADB_H | |
| 5 | +#define _UAPI__ADB_H | |
| 6 | + | |
| 7 | +/* ADB commands */ | |
| 8 | +#define ADB_BUSRESET 0 | |
| 9 | +#define ADB_FLUSH(id) (0x01 | ((id) << 4)) | |
| 10 | +#define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4)) | |
| 11 | +#define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4)) | |
| 12 | + | |
| 13 | +/* ADB default device IDs (upper 4 bits of ADB command byte) */ | |
| 14 | +#define ADB_DONGLE 1 /* "software execution control" devices */ | |
| 15 | +#define ADB_KEYBOARD 2 | |
| 16 | +#define ADB_MOUSE 3 | |
| 17 | +#define ADB_TABLET 4 | |
| 18 | +#define ADB_MODEM 5 | |
| 19 | +#define ADB_MISC 7 /* maybe a monitor */ | |
| 20 | + | |
| 21 | +#define ADB_RET_OK 0 | |
| 22 | +#define ADB_RET_TIMEOUT 3 | |
| 23 | + | |
| 24 | +/* The kind of ADB request. The controller may emulate some | |
| 25 | + or all of those CUDA/PMU packet kinds */ | |
| 26 | +#define ADB_PACKET 0 | |
| 27 | +#define CUDA_PACKET 1 | |
| 28 | +#define ERROR_PACKET 2 | |
| 29 | +#define TIMER_PACKET 3 | |
| 30 | +#define POWER_PACKET 4 | |
| 31 | +#define MACIIC_PACKET 5 | |
| 32 | +#define PMU_PACKET 6 | |
| 33 | +#define ADB_QUERY 7 | |
| 34 | + | |
| 35 | +/* ADB queries */ | |
| 36 | + | |
| 37 | +/* ADB_QUERY_GETDEVINFO | |
| 38 | + * Query ADB slot for device presence | |
| 39 | + * data[2] = id, rep[0] = orig addr, rep[1] = handler_id | |
| 40 | + */ | |
| 41 | +#define ADB_QUERY_GETDEVINFO 1 | |
| 42 | + | |
| 43 | + | |
| 44 | +#endif /* _UAPI__ADB_H */ | |
| @@ -0,0 +1,44 @@ | ||
| 1 | +#ifndef _UAPI_ADFS_FS_H | |
| 2 | +#define _UAPI_ADFS_FS_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/magic.h> | |
| 6 | + | |
| 7 | +/* | |
| 8 | + * Disc Record at disc address 0xc00 | |
| 9 | + */ | |
| 10 | +struct adfs_discrecord { | |
| 11 | + __u8 log2secsize; | |
| 12 | + __u8 secspertrack; | |
| 13 | + __u8 heads; | |
| 14 | + __u8 density; | |
| 15 | + __u8 idlen; | |
| 16 | + __u8 log2bpmb; | |
| 17 | + __u8 skew; | |
| 18 | + __u8 bootoption; | |
| 19 | + __u8 lowsector; | |
| 20 | + __u8 nzones; | |
| 21 | + __le16 zone_spare; | |
| 22 | + __le32 root; | |
| 23 | + __le32 disc_size; | |
| 24 | + __le16 disc_id; | |
| 25 | + __u8 disc_name[10]; | |
| 26 | + __le32 disc_type; | |
| 27 | + __le32 disc_size_high; | |
| 28 | + __u8 log2sharesize:4; | |
| 29 | + __u8 unused40:4; | |
| 30 | + __u8 big_flag:1; | |
| 31 | + __u8 unused41:1; | |
| 32 | + __u8 nzones_high; | |
| 33 | + __le32 format_version; | |
| 34 | + __le32 root_size; | |
| 35 | + __u8 unused52[60 - 52]; | |
| 36 | +}; | |
| 37 | + | |
| 38 | +#define ADFS_DISCRECORD (0xc00) | |
| 39 | +#define ADFS_DR_OFFSET (0x1c0) | |
| 40 | +#define ADFS_DR_SIZE 60 | |
| 41 | +#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) | |
| 42 | + | |
| 43 | + | |
| 44 | +#endif /* _UAPI_ADFS_FS_H */ | |
| @@ -0,0 +1,68 @@ | ||
| 1 | +#ifndef AFFS_HARDBLOCKS_H | |
| 2 | +#define AFFS_HARDBLOCKS_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +/* Just the needed definitions for the RDB of an Amiga HD. */ | |
| 7 | + | |
| 8 | +struct RigidDiskBlock { | |
| 9 | + __u32 rdb_ID; | |
| 10 | + __be32 rdb_SummedLongs; | |
| 11 | + __s32 rdb_ChkSum; | |
| 12 | + __u32 rdb_HostID; | |
| 13 | + __be32 rdb_BlockBytes; | |
| 14 | + __u32 rdb_Flags; | |
| 15 | + __u32 rdb_BadBlockList; | |
| 16 | + __be32 rdb_PartitionList; | |
| 17 | + __u32 rdb_FileSysHeaderList; | |
| 18 | + __u32 rdb_DriveInit; | |
| 19 | + __u32 rdb_Reserved1[6]; | |
| 20 | + __u32 rdb_Cylinders; | |
| 21 | + __u32 rdb_Sectors; | |
| 22 | + __u32 rdb_Heads; | |
| 23 | + __u32 rdb_Interleave; | |
| 24 | + __u32 rdb_Park; | |
| 25 | + __u32 rdb_Reserved2[3]; | |
| 26 | + __u32 rdb_WritePreComp; | |
| 27 | + __u32 rdb_ReducedWrite; | |
| 28 | + __u32 rdb_StepRate; | |
| 29 | + __u32 rdb_Reserved3[5]; | |
| 30 | + __u32 rdb_RDBBlocksLo; | |
| 31 | + __u32 rdb_RDBBlocksHi; | |
| 32 | + __u32 rdb_LoCylinder; | |
| 33 | + __u32 rdb_HiCylinder; | |
| 34 | + __u32 rdb_CylBlocks; | |
| 35 | + __u32 rdb_AutoParkSeconds; | |
| 36 | + __u32 rdb_HighRDSKBlock; | |
| 37 | + __u32 rdb_Reserved4; | |
| 38 | + char rdb_DiskVendor[8]; | |
| 39 | + char rdb_DiskProduct[16]; | |
| 40 | + char rdb_DiskRevision[4]; | |
| 41 | + char rdb_ControllerVendor[8]; | |
| 42 | + char rdb_ControllerProduct[16]; | |
| 43 | + char rdb_ControllerRevision[4]; | |
| 44 | + __u32 rdb_Reserved5[10]; | |
| 45 | +}; | |
| 46 | + | |
| 47 | +#define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ | |
| 48 | + | |
| 49 | +struct PartitionBlock { | |
| 50 | + __be32 pb_ID; | |
| 51 | + __be32 pb_SummedLongs; | |
| 52 | + __s32 pb_ChkSum; | |
| 53 | + __u32 pb_HostID; | |
| 54 | + __be32 pb_Next; | |
| 55 | + __u32 pb_Flags; | |
| 56 | + __u32 pb_Reserved1[2]; | |
| 57 | + __u32 pb_DevFlags; | |
| 58 | + __u8 pb_DriveName[32]; | |
| 59 | + __u32 pb_Reserved2[15]; | |
| 60 | + __be32 pb_Environment[17]; | |
| 61 | + __u32 pb_EReserved[15]; | |
| 62 | +}; | |
| 63 | + | |
| 64 | +#define IDNAME_PARTITION 0x50415254 /* "PART" */ | |
| 65 | + | |
| 66 | +#define RDB_ALLOCATION_LIMIT 16 | |
| 67 | + | |
| 68 | +#endif /* AFFS_HARDBLOCKS_H */ | |
| @@ -0,0 +1,113 @@ | ||
| 1 | +/* | |
| 2 | + * AGPGART module version 0.99 | |
| 3 | + * Copyright (C) 1999 Jeff Hartmann | |
| 4 | + * Copyright (C) 1999 Precision Insight, Inc. | |
| 5 | + * Copyright (C) 1999 Xi Graphics, Inc. | |
| 6 | + * | |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 8 | + * copy of this software and associated documentation files (the "Software"), | |
| 9 | + * to deal in the Software without restriction, including without limitation | |
| 10 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 11 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 12 | + * Software is furnished to do so, subject to the following conditions: | |
| 13 | + * | |
| 14 | + * The above copyright notice and this permission notice shall be included | |
| 15 | + * in all copies or substantial portions of the Software. | |
| 16 | + * | |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| 18 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 20 | + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, | |
| 21 | + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
| 22 | + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
| 23 | + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 24 | + * | |
| 25 | + */ | |
| 26 | + | |
| 27 | +#ifndef _UAPI_AGP_H | |
| 28 | +#define _UAPI_AGP_H | |
| 29 | + | |
| 30 | +#define AGPIOC_BASE 'A' | |
| 31 | +#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*) | |
| 32 | +#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) | |
| 33 | +#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) | |
| 34 | +#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*) | |
| 35 | +#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*) | |
| 36 | +#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*) | |
| 37 | +#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*) | |
| 38 | +#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) | |
| 39 | +#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) | |
| 40 | +#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) | |
| 41 | +#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10) | |
| 42 | + | |
| 43 | +#define AGP_DEVICE "/dev/agpgart" | |
| 44 | + | |
| 45 | +#ifndef TRUE | |
| 46 | +#define TRUE 1 | |
| 47 | +#endif | |
| 48 | + | |
| 49 | +#ifndef FALSE | |
| 50 | +#define FALSE 0 | |
| 51 | +#endif | |
| 52 | + | |
| 53 | +#ifndef __KERNEL__ | |
| 54 | +#include <linux/types.h> | |
| 55 | + | |
| 56 | +struct agp_version { | |
| 57 | + __u16 major; | |
| 58 | + __u16 minor; | |
| 59 | +}; | |
| 60 | + | |
| 61 | +typedef struct _agp_info { | |
| 62 | + struct agp_version version; /* version of the driver */ | |
| 63 | + __u32 bridge_id; /* bridge vendor/device */ | |
| 64 | + __u32 agp_mode; /* mode info of bridge */ | |
| 65 | + unsigned long aper_base;/* base of aperture */ | |
| 66 | + size_t aper_size; /* size of aperture */ | |
| 67 | + size_t pg_total; /* max pages (swap + system) */ | |
| 68 | + size_t pg_system; /* max pages (system) */ | |
| 69 | + size_t pg_used; /* current pages used */ | |
| 70 | +} agp_info; | |
| 71 | + | |
| 72 | +typedef struct _agp_setup { | |
| 73 | + __u32 agp_mode; /* mode info of bridge */ | |
| 74 | +} agp_setup; | |
| 75 | + | |
| 76 | +/* | |
| 77 | + * The "prot" down below needs still a "sleep" flag somehow ... | |
| 78 | + */ | |
| 79 | +typedef struct _agp_segment { | |
| 80 | + __kernel_off_t pg_start; /* starting page to populate */ | |
| 81 | + __kernel_size_t pg_count; /* number of pages */ | |
| 82 | + int prot; /* prot flags for mmap */ | |
| 83 | +} agp_segment; | |
| 84 | + | |
| 85 | +typedef struct _agp_region { | |
| 86 | + __kernel_pid_t pid; /* pid of process */ | |
| 87 | + __kernel_size_t seg_count; /* number of segments */ | |
| 88 | + struct _agp_segment *seg_list; | |
| 89 | +} agp_region; | |
| 90 | + | |
| 91 | +typedef struct _agp_allocate { | |
| 92 | + int key; /* tag of allocation */ | |
| 93 | + __kernel_size_t pg_count;/* number of pages */ | |
| 94 | + __u32 type; /* 0 == normal, other devspec */ | |
| 95 | + __u32 physical; /* device specific (some devices | |
| 96 | + * need a phys address of the | |
| 97 | + * actual page behind the gatt | |
| 98 | + * table) */ | |
| 99 | +} agp_allocate; | |
| 100 | + | |
| 101 | +typedef struct _agp_bind { | |
| 102 | + int key; /* tag of allocation */ | |
| 103 | + __kernel_off_t pg_start;/* starting page to populate */ | |
| 104 | +} agp_bind; | |
| 105 | + | |
| 106 | +typedef struct _agp_unbind { | |
| 107 | + int key; /* tag of allocation */ | |
| 108 | + __u32 priority; /* priority for paging out */ | |
| 109 | +} agp_unbind; | |
| 110 | + | |
| 111 | +#endif /* __KERNEL__ */ | |
| 112 | + | |
| 113 | +#endif /* _UAPI_AGP_H */ | |
| @@ -0,0 +1,111 @@ | ||
| 1 | +/* include/linux/aio_abi.h | |
| 2 | + * | |
| 3 | + * Copyright 2000,2001,2002 Red Hat. | |
| 4 | + * | |
| 5 | + * Written by Benjamin LaHaise <bcrl@kvack.org> | |
| 6 | + * | |
| 7 | + * Distribute under the terms of the GPLv2 (see ../../COPYING) or under | |
| 8 | + * the following terms. | |
| 9 | + * | |
| 10 | + * Permission to use, copy, modify, and distribute this software and its | |
| 11 | + * documentation is hereby granted, provided that the above copyright | |
| 12 | + * notice appears in all copies. This software is provided without any | |
| 13 | + * warranty, express or implied. Red Hat makes no representations about | |
| 14 | + * the suitability of this software for any purpose. | |
| 15 | + * | |
| 16 | + * IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | |
| 17 | + * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF | |
| 18 | + * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED | |
| 19 | + * OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 20 | + * | |
| 21 | + * RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 22 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 23 | + * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND | |
| 24 | + * RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, | |
| 25 | + * ENHANCEMENTS, OR MODIFICATIONS. | |
| 26 | + */ | |
| 27 | +#ifndef __LINUX__AIO_ABI_H | |
| 28 | +#define __LINUX__AIO_ABI_H | |
| 29 | + | |
| 30 | +#include <linux/types.h> | |
| 31 | +#include <asm/byteorder.h> | |
| 32 | + | |
| 33 | +typedef __kernel_ulong_t aio_context_t; | |
| 34 | + | |
| 35 | +enum { | |
| 36 | + IOCB_CMD_PREAD = 0, | |
| 37 | + IOCB_CMD_PWRITE = 1, | |
| 38 | + IOCB_CMD_FSYNC = 2, | |
| 39 | + IOCB_CMD_FDSYNC = 3, | |
| 40 | + /* These two are experimental. | |
| 41 | + * IOCB_CMD_PREADX = 4, | |
| 42 | + * IOCB_CMD_POLL = 5, | |
| 43 | + */ | |
| 44 | + IOCB_CMD_NOOP = 6, | |
| 45 | + IOCB_CMD_PREADV = 7, | |
| 46 | + IOCB_CMD_PWRITEV = 8, | |
| 47 | +}; | |
| 48 | + | |
| 49 | +/* | |
| 50 | + * Valid flags for the "aio_flags" member of the "struct iocb". | |
| 51 | + * | |
| 52 | + * IOCB_FLAG_RESFD - Set if the "aio_resfd" member of the "struct iocb" | |
| 53 | + * is valid. | |
| 54 | + */ | |
| 55 | +#define IOCB_FLAG_RESFD (1 << 0) | |
| 56 | + | |
| 57 | +/* read() from /dev/aio returns these structures. */ | |
| 58 | +struct io_event { | |
| 59 | + __u64 data; /* the data field from the iocb */ | |
| 60 | + __u64 obj; /* what iocb this event came from */ | |
| 61 | + __s64 res; /* result code for this event */ | |
| 62 | + __s64 res2; /* secondary result */ | |
| 63 | +}; | |
| 64 | + | |
| 65 | +#if defined(__LITTLE_ENDIAN) | |
| 66 | +#define PADDED(x,y) x, y | |
| 67 | +#elif defined(__BIG_ENDIAN) | |
| 68 | +#define PADDED(x,y) y, x | |
| 69 | +#else | |
| 70 | +#error edit for your odd byteorder. | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +/* | |
| 74 | + * we always use a 64bit off_t when communicating | |
| 75 | + * with userland. its up to libraries to do the | |
| 76 | + * proper padding and aio_error abstraction | |
| 77 | + */ | |
| 78 | + | |
| 79 | +struct iocb { | |
| 80 | + /* these are internal to the kernel/libc. */ | |
| 81 | + __u64 aio_data; /* data to be returned in event's data */ | |
| 82 | + __u32 PADDED(aio_key, aio_reserved1); | |
| 83 | + /* the kernel sets aio_key to the req # */ | |
| 84 | + | |
| 85 | + /* common fields */ | |
| 86 | + __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ | |
| 87 | + __s16 aio_reqprio; | |
| 88 | + __u32 aio_fildes; | |
| 89 | + | |
| 90 | + __u64 aio_buf; | |
| 91 | + __u64 aio_nbytes; | |
| 92 | + __s64 aio_offset; | |
| 93 | + | |
| 94 | + /* extra parameters */ | |
| 95 | + __u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ | |
| 96 | + | |
| 97 | + /* flags for the "struct iocb" */ | |
| 98 | + __u32 aio_flags; | |
| 99 | + | |
| 100 | + /* | |
| 101 | + * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an | |
| 102 | + * eventfd to signal AIO readiness to | |
| 103 | + */ | |
| 104 | + __u32 aio_resfd; | |
| 105 | +}; /* 64 bytes */ | |
| 106 | + | |
| 107 | +#undef IFBIG | |
| 108 | +#undef IFLITTLE | |
| 109 | + | |
| 110 | +#endif /* __LINUX__AIO_ABI_H */ | |
| 111 | + | |
| @@ -0,0 +1,135 @@ | ||
| 1 | +/* | |
| 2 | + * Include file for the interface to an APM BIOS | |
| 3 | + * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) | |
| 4 | + * | |
| 5 | + * This program is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License as published by the | |
| 7 | + * Free Software Foundation; either version 2, or (at your option) any | |
| 8 | + * later version. | |
| 9 | + * | |
| 10 | + * This program is distributed in the hope that it will be useful, but | |
| 11 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | + * General Public License for more details. | |
| 14 | + */ | |
| 15 | +#ifndef _UAPI_LINUX_APM_H | |
| 16 | +#define _UAPI_LINUX_APM_H | |
| 17 | + | |
| 18 | + | |
| 19 | +#include <linux/types.h> | |
| 20 | + | |
| 21 | +typedef unsigned short apm_event_t; | |
| 22 | +typedef unsigned short apm_eventinfo_t; | |
| 23 | + | |
| 24 | +struct apm_bios_info { | |
| 25 | + __u16 version; | |
| 26 | + __u16 cseg; | |
| 27 | + __u32 offset; | |
| 28 | + __u16 cseg_16; | |
| 29 | + __u16 dseg; | |
| 30 | + __u16 flags; | |
| 31 | + __u16 cseg_len; | |
| 32 | + __u16 cseg_16_len; | |
| 33 | + __u16 dseg_len; | |
| 34 | +}; | |
| 35 | + | |
| 36 | + | |
| 37 | +/* | |
| 38 | + * Power states | |
| 39 | + */ | |
| 40 | +#define APM_STATE_READY 0x0000 | |
| 41 | +#define APM_STATE_STANDBY 0x0001 | |
| 42 | +#define APM_STATE_SUSPEND 0x0002 | |
| 43 | +#define APM_STATE_OFF 0x0003 | |
| 44 | +#define APM_STATE_BUSY 0x0004 | |
| 45 | +#define APM_STATE_REJECT 0x0005 | |
| 46 | +#define APM_STATE_OEM_SYS 0x0020 | |
| 47 | +#define APM_STATE_OEM_DEV 0x0040 | |
| 48 | + | |
| 49 | +#define APM_STATE_DISABLE 0x0000 | |
| 50 | +#define APM_STATE_ENABLE 0x0001 | |
| 51 | + | |
| 52 | +#define APM_STATE_DISENGAGE 0x0000 | |
| 53 | +#define APM_STATE_ENGAGE 0x0001 | |
| 54 | + | |
| 55 | +/* | |
| 56 | + * Events (results of Get PM Event) | |
| 57 | + */ | |
| 58 | +#define APM_SYS_STANDBY 0x0001 | |
| 59 | +#define APM_SYS_SUSPEND 0x0002 | |
| 60 | +#define APM_NORMAL_RESUME 0x0003 | |
| 61 | +#define APM_CRITICAL_RESUME 0x0004 | |
| 62 | +#define APM_LOW_BATTERY 0x0005 | |
| 63 | +#define APM_POWER_STATUS_CHANGE 0x0006 | |
| 64 | +#define APM_UPDATE_TIME 0x0007 | |
| 65 | +#define APM_CRITICAL_SUSPEND 0x0008 | |
| 66 | +#define APM_USER_STANDBY 0x0009 | |
| 67 | +#define APM_USER_SUSPEND 0x000a | |
| 68 | +#define APM_STANDBY_RESUME 0x000b | |
| 69 | +#define APM_CAPABILITY_CHANGE 0x000c | |
| 70 | + | |
| 71 | +/* | |
| 72 | + * Error codes | |
| 73 | + */ | |
| 74 | +#define APM_SUCCESS 0x00 | |
| 75 | +#define APM_DISABLED 0x01 | |
| 76 | +#define APM_CONNECTED 0x02 | |
| 77 | +#define APM_NOT_CONNECTED 0x03 | |
| 78 | +#define APM_16_CONNECTED 0x05 | |
| 79 | +#define APM_16_UNSUPPORTED 0x06 | |
| 80 | +#define APM_32_CONNECTED 0x07 | |
| 81 | +#define APM_32_UNSUPPORTED 0x08 | |
| 82 | +#define APM_BAD_DEVICE 0x09 | |
| 83 | +#define APM_BAD_PARAM 0x0a | |
| 84 | +#define APM_NOT_ENGAGED 0x0b | |
| 85 | +#define APM_BAD_FUNCTION 0x0c | |
| 86 | +#define APM_RESUME_DISABLED 0x0d | |
| 87 | +#define APM_NO_ERROR 0x53 | |
| 88 | +#define APM_BAD_STATE 0x60 | |
| 89 | +#define APM_NO_EVENTS 0x80 | |
| 90 | +#define APM_NOT_PRESENT 0x86 | |
| 91 | + | |
| 92 | +/* | |
| 93 | + * APM Device IDs | |
| 94 | + */ | |
| 95 | +#define APM_DEVICE_BIOS 0x0000 | |
| 96 | +#define APM_DEVICE_ALL 0x0001 | |
| 97 | +#define APM_DEVICE_DISPLAY 0x0100 | |
| 98 | +#define APM_DEVICE_STORAGE 0x0200 | |
| 99 | +#define APM_DEVICE_PARALLEL 0x0300 | |
| 100 | +#define APM_DEVICE_SERIAL 0x0400 | |
| 101 | +#define APM_DEVICE_NETWORK 0x0500 | |
| 102 | +#define APM_DEVICE_PCMCIA 0x0600 | |
| 103 | +#define APM_DEVICE_BATTERY 0x8000 | |
| 104 | +#define APM_DEVICE_OEM 0xe000 | |
| 105 | +#define APM_DEVICE_OLD_ALL 0xffff | |
| 106 | +#define APM_DEVICE_CLASS 0x00ff | |
| 107 | +#define APM_DEVICE_MASK 0xff00 | |
| 108 | + | |
| 109 | + | |
| 110 | +/* | |
| 111 | + * Battery status | |
| 112 | + */ | |
| 113 | +#define APM_MAX_BATTERIES 2 | |
| 114 | + | |
| 115 | +/* | |
| 116 | + * APM defined capability bit flags | |
| 117 | + */ | |
| 118 | +#define APM_CAP_GLOBAL_STANDBY 0x0001 | |
| 119 | +#define APM_CAP_GLOBAL_SUSPEND 0x0002 | |
| 120 | +#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ | |
| 121 | +#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ | |
| 122 | +#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ | |
| 123 | +#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ | |
| 124 | +#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ | |
| 125 | +#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ | |
| 126 | + | |
| 127 | +/* | |
| 128 | + * ioctl operations | |
| 129 | + */ | |
| 130 | +#include <linux/ioctl.h> | |
| 131 | + | |
| 132 | +#define APM_IOC_STANDBY _IO('A', 1) | |
| 133 | +#define APM_IOC_SUSPEND _IO('A', 2) | |
| 134 | + | |
| 135 | +#endif /* _UAPI_LINUX_APM_H */ | |
| @@ -0,0 +1,8 @@ | ||
| 1 | +#ifndef __LINUX_ARCFB_H__ | |
| 2 | +#define __LINUX_ARCFB_H__ | |
| 3 | + | |
| 4 | +#define FBIO_WAITEVENT _IO('F', 0x88) | |
| 5 | +#define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t) | |
| 6 | + | |
| 7 | +#endif | |
| 8 | + | |
| @@ -0,0 +1,44 @@ | ||
| 1 | +#ifndef _UAPI__LINUX_ATALK_H__ | |
| 2 | +#define _UAPI__LINUX_ATALK_H__ | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <asm/byteorder.h> | |
| 6 | +#include <linux/socket.h> | |
| 7 | + | |
| 8 | +/* | |
| 9 | + * AppleTalk networking structures | |
| 10 | + * | |
| 11 | + * The following are directly referenced from the University Of Michigan | |
| 12 | + * netatalk for compatibility reasons. | |
| 13 | + */ | |
| 14 | +#define ATPORT_FIRST 1 | |
| 15 | +#define ATPORT_RESERVED 128 | |
| 16 | +#define ATPORT_LAST 254 /* 254 is only legal on localtalk */ | |
| 17 | +#define ATADDR_ANYNET (__u16)0 | |
| 18 | +#define ATADDR_ANYNODE (__u8)0 | |
| 19 | +#define ATADDR_ANYPORT (__u8)0 | |
| 20 | +#define ATADDR_BCAST (__u8)255 | |
| 21 | +#define DDP_MAXSZ 587 | |
| 22 | +#define DDP_MAXHOPS 15 /* 4 bits of hop counter */ | |
| 23 | + | |
| 24 | +#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) | |
| 25 | + | |
| 26 | +struct atalk_addr { | |
| 27 | + __be16 s_net; | |
| 28 | + __u8 s_node; | |
| 29 | +}; | |
| 30 | + | |
| 31 | +struct sockaddr_at { | |
| 32 | + __kernel_sa_family_t sat_family; | |
| 33 | + __u8 sat_port; | |
| 34 | + struct atalk_addr sat_addr; | |
| 35 | + char sat_zero[8]; | |
| 36 | +}; | |
| 37 | + | |
| 38 | +struct atalk_netrange { | |
| 39 | + __u8 nr_phase; | |
| 40 | + __be16 nr_firstnet; | |
| 41 | + __be16 nr_lastnet; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +#endif /* _UAPI__LINUX_ATALK_H__ */ | |
| @@ -0,0 +1,241 @@ | ||
| 1 | +/* atm.h - general ATM declarations */ | |
| 2 | + | |
| 3 | +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +/* | |
| 7 | + * WARNING: User-space programs should not #include <linux/atm.h> directly. | |
| 8 | + * Instead, #include <atm.h> | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#ifndef _UAPI_LINUX_ATM_H | |
| 12 | +#define _UAPI_LINUX_ATM_H | |
| 13 | + | |
| 14 | +/* | |
| 15 | + * BEGIN_xx and END_xx markers are used for automatic generation of | |
| 16 | + * documentation. Do not change them. | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#include <linux/compiler.h> | |
| 20 | +#include <linux/atmapi.h> | |
| 21 | +#include <linux/atmsap.h> | |
| 22 | +#include <linux/atmioc.h> | |
| 23 | +#include <linux/types.h> | |
| 24 | + | |
| 25 | + | |
| 26 | +/* general ATM constants */ | |
| 27 | +#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ | |
| 28 | +#define ATM_CELL_PAYLOAD 48 /* ATM payload size */ | |
| 29 | +#define ATM_AAL0_SDU 52 /* AAL0 SDU size */ | |
| 30 | +#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */ | |
| 31 | +#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */ | |
| 32 | +#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */ | |
| 33 | +#define ATM_MAX_CDV 9999 /* maximum (default) CDV */ | |
| 34 | +#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */ | |
| 35 | + | |
| 36 | +#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */ | |
| 37 | +#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */ | |
| 38 | +#define ATM_MAX_VCI 65535 /* maximum VCI */ | |
| 39 | + | |
| 40 | + | |
| 41 | +/* "protcol" values for the socket system call */ | |
| 42 | +#define ATM_NO_AAL 0 /* AAL not specified */ | |
| 43 | +#define ATM_AAL0 13 /* "raw" ATM cells */ | |
| 44 | +#define ATM_AAL1 1 /* AAL1 (CBR) */ | |
| 45 | +#define ATM_AAL2 2 /* AAL2 (VBR) */ | |
| 46 | +#define ATM_AAL34 3 /* AAL3/4 (data) */ | |
| 47 | +#define ATM_AAL5 5 /* AAL5 (data) */ | |
| 48 | + | |
| 49 | +/* | |
| 50 | + * socket option name coding functions | |
| 51 | + * | |
| 52 | + * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the | |
| 53 | + * << 22 only reserves 9 bits for the level. On some architectures | |
| 54 | + * SOL_SOCKET is 0xFFFF, so that's a bit of a problem | |
| 55 | + */ | |
| 56 | + | |
| 57 | +#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \ | |
| 58 | + sizeof(t)) | |
| 59 | +#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) | |
| 60 | +#define __SO_NUMBER(c) (((c) >> 16) & 0x3f) | |
| 61 | +#define __SO_SIZE(c) ((c) & 0x3fff) | |
| 62 | + | |
| 63 | +/* | |
| 64 | + * ATM layer | |
| 65 | + */ | |
| 66 | + | |
| 67 | +#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) | |
| 68 | + /* set CLP bit value - TODO */ | |
| 69 | +#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) | |
| 70 | + /* connection identifier range; socket must be | |
| 71 | + bound or connected */ | |
| 72 | +#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) | |
| 73 | + /* Quality of Service setting */ | |
| 74 | +#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) | |
| 75 | + /* Service Access Point */ | |
| 76 | +#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) | |
| 77 | + /* "PVC" address (also for SVCs); get only */ | |
| 78 | +#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) | |
| 79 | + /* make this vc a p2mp */ | |
| 80 | + | |
| 81 | + | |
| 82 | +/* | |
| 83 | + * Note @@@: since the socket layers don't really distinguish the control and | |
| 84 | + * the data plane but generally seems to be data plane-centric, any layer is | |
| 85 | + * about equally wrong for the SAP. If you have a better idea about this, | |
| 86 | + * please speak up ... | |
| 87 | + */ | |
| 88 | + | |
| 89 | + | |
| 90 | +/* ATM cell header (for AAL0) */ | |
| 91 | + | |
| 92 | +/* BEGIN_CH */ | |
| 93 | +#define ATM_HDR_GFC_MASK 0xf0000000 | |
| 94 | +#define ATM_HDR_GFC_SHIFT 28 | |
| 95 | +#define ATM_HDR_VPI_MASK 0x0ff00000 | |
| 96 | +#define ATM_HDR_VPI_SHIFT 20 | |
| 97 | +#define ATM_HDR_VCI_MASK 0x000ffff0 | |
| 98 | +#define ATM_HDR_VCI_SHIFT 4 | |
| 99 | +#define ATM_HDR_PTI_MASK 0x0000000e | |
| 100 | +#define ATM_HDR_PTI_SHIFT 1 | |
| 101 | +#define ATM_HDR_CLP 0x00000001 | |
| 102 | +/* END_CH */ | |
| 103 | + | |
| 104 | + | |
| 105 | +/* PTI codings */ | |
| 106 | + | |
| 107 | +/* BEGIN_PTI */ | |
| 108 | +#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */ | |
| 109 | +#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */ | |
| 110 | +#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */ | |
| 111 | +#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */ | |
| 112 | +#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */ | |
| 113 | +#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */ | |
| 114 | +#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */ | |
| 115 | +#define ATM_PTI_RSV 7 /* reserved */ | |
| 116 | +/* END_PTI */ | |
| 117 | + | |
| 118 | + | |
| 119 | +/* | |
| 120 | + * The following items should stay in linux/atm.h, which should be linked to | |
| 121 | + * netatm/atm.h | |
| 122 | + */ | |
| 123 | + | |
| 124 | +/* Traffic description */ | |
| 125 | + | |
| 126 | +#define ATM_NONE 0 /* no traffic */ | |
| 127 | +#define ATM_UBR 1 | |
| 128 | +#define ATM_CBR 2 | |
| 129 | +#define ATM_VBR 3 | |
| 130 | +#define ATM_ABR 4 | |
| 131 | +#define ATM_ANYCLASS 5 /* compatible with everything */ | |
| 132 | + | |
| 133 | +#define ATM_MAX_PCR -1 /* maximum available PCR */ | |
| 134 | + | |
| 135 | +struct atm_trafprm { | |
| 136 | + unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ | |
| 137 | + int max_pcr; /* maximum PCR in cells per second */ | |
| 138 | + int pcr; /* desired PCR in cells per second */ | |
| 139 | + int min_pcr; /* minimum PCR in cells per second */ | |
| 140 | + int max_cdv; /* maximum CDV in microseconds */ | |
| 141 | + int max_sdu; /* maximum SDU in bytes */ | |
| 142 | + /* extra params for ABR */ | |
| 143 | + unsigned int icr; /* Initial Cell Rate (24-bit) */ | |
| 144 | + unsigned int tbe; /* Transient Buffer Exposure (24-bit) */ | |
| 145 | + unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */ | |
| 146 | + unsigned int rif : 4; /* Rate Increment Factor (4-bit) */ | |
| 147 | + unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */ | |
| 148 | + unsigned int nrm_pres :1; /* nrm present bit */ | |
| 149 | + unsigned int trm_pres :1; /* rm present bit */ | |
| 150 | + unsigned int adtf_pres :1; /* adtf present bit */ | |
| 151 | + unsigned int cdf_pres :1; /* cdf present bit*/ | |
| 152 | + unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */ | |
| 153 | + unsigned int trm :3; /* Time between forward RM cells (3-bit) */ | |
| 154 | + unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ | |
| 155 | + unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ | |
| 156 | + unsigned int spare :9; /* spare bits */ | |
| 157 | +}; | |
| 158 | + | |
| 159 | +struct atm_qos { | |
| 160 | + struct atm_trafprm txtp; /* parameters in TX direction */ | |
| 161 | + struct atm_trafprm rxtp __ATM_API_ALIGN; | |
| 162 | + /* parameters in RX direction */ | |
| 163 | + unsigned char aal __ATM_API_ALIGN; | |
| 164 | +}; | |
| 165 | + | |
| 166 | +/* PVC addressing */ | |
| 167 | + | |
| 168 | +#define ATM_ITF_ANY -1 /* "magic" PVC address values */ | |
| 169 | +#define ATM_VPI_ANY -1 | |
| 170 | +#define ATM_VCI_ANY -1 | |
| 171 | +#define ATM_VPI_UNSPEC -2 | |
| 172 | +#define ATM_VCI_UNSPEC -2 | |
| 173 | + | |
| 174 | + | |
| 175 | +struct sockaddr_atmpvc { | |
| 176 | + unsigned short sap_family; /* address family, AF_ATMPVC */ | |
| 177 | + struct { /* PVC address */ | |
| 178 | + short itf; /* ATM interface */ | |
| 179 | + short vpi; /* VPI (only 8 bits at UNI) */ | |
| 180 | + int vci; /* VCI (only 16 bits at UNI) */ | |
| 181 | + } sap_addr __ATM_API_ALIGN; /* PVC address */ | |
| 182 | +}; | |
| 183 | + | |
| 184 | +/* SVC addressing */ | |
| 185 | + | |
| 186 | +#define ATM_ESA_LEN 20 /* ATM End System Address length */ | |
| 187 | +#define ATM_E164_LEN 12 /* maximum E.164 number length */ | |
| 188 | + | |
| 189 | +#define ATM_AFI_DCC 0x39 /* DCC ATM Format */ | |
| 190 | +#define ATM_AFI_ICD 0x47 /* ICD ATM Format */ | |
| 191 | +#define ATM_AFI_E164 0x45 /* E.164 ATM Format */ | |
| 192 | +#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */ | |
| 193 | + | |
| 194 | +#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */ | |
| 195 | +#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */ | |
| 196 | +#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */ | |
| 197 | +#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */ | |
| 198 | + | |
| 199 | +#define ATM_LIJ_NONE 0 /* no leaf-initiated join */ | |
| 200 | +#define ATM_LIJ 1 /* request joining */ | |
| 201 | +#define ATM_LIJ_RPJ 2 /* set to root-prompted join */ | |
| 202 | +#define ATM_LIJ_NJ 3 /* set to network join */ | |
| 203 | + | |
| 204 | + | |
| 205 | +struct sockaddr_atmsvc { | |
| 206 | + unsigned short sas_family; /* address family, AF_ATMSVC */ | |
| 207 | + struct { /* SVC address */ | |
| 208 | + unsigned char prv[ATM_ESA_LEN];/* private ATM address */ | |
| 209 | + char pub[ATM_E164_LEN+1]; /* public address (E.164) */ | |
| 210 | + /* unused addresses must be bzero'ed */ | |
| 211 | + char lij_type; /* role in LIJ call; one of ATM_LIJ* */ | |
| 212 | + __u32 lij_id; /* LIJ call identifier */ | |
| 213 | + } sas_addr __ATM_API_ALIGN; /* SVC address */ | |
| 214 | +}; | |
| 215 | + | |
| 216 | + | |
| 217 | +static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr) | |
| 218 | +{ | |
| 219 | + return *addr.sas_addr.prv || *addr.sas_addr.pub; | |
| 220 | +} | |
| 221 | + | |
| 222 | + | |
| 223 | +static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr) | |
| 224 | +{ | |
| 225 | + return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci; | |
| 226 | +} | |
| 227 | + | |
| 228 | + | |
| 229 | +/* | |
| 230 | + * Some stuff for linux/sockios.h | |
| 231 | + */ | |
| 232 | + | |
| 233 | +struct atmif_sioc { | |
| 234 | + int number; | |
| 235 | + int length; | |
| 236 | + void __user *arg; | |
| 237 | +}; | |
| 238 | + | |
| 239 | + | |
| 240 | +typedef unsigned short atm_backend_t; | |
| 241 | +#endif /* _UAPI_LINUX_ATM_H */ | |
| @@ -0,0 +1,23 @@ | ||
| 1 | +/* atm_eni.h - Driver-specific declarations of the ENI driver (for use by | |
| 2 | + driver-specific utilities) */ | |
| 3 | + | |
| 4 | +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | |
| 5 | + | |
| 6 | + | |
| 7 | +#ifndef LINUX_ATM_ENI_H | |
| 8 | +#define LINUX_ATM_ENI_H | |
| 9 | + | |
| 10 | +#include <linux/atmioc.h> | |
| 11 | + | |
| 12 | + | |
| 13 | +struct eni_multipliers { | |
| 14 | + int tx,rx; /* values are in percent and must be > 100 */ | |
| 15 | +}; | |
| 16 | + | |
| 17 | + | |
| 18 | +#define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc) | |
| 19 | + /* printk memory map */ | |
| 20 | +#define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc) | |
| 21 | + /* set buffer multipliers */ | |
| 22 | + | |
| 23 | +#endif | |
| @@ -0,0 +1,20 @@ | ||
| 1 | +/* atm_he.h */ | |
| 2 | + | |
| 3 | +#ifndef LINUX_ATM_HE_H | |
| 4 | +#define LINUX_ATM_HE_H | |
| 5 | + | |
| 6 | +#include <linux/atmioc.h> | |
| 7 | + | |
| 8 | +#define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc) | |
| 9 | + | |
| 10 | +#define HE_REGTYPE_PCI 1 | |
| 11 | +#define HE_REGTYPE_RCM 2 | |
| 12 | +#define HE_REGTYPE_TCM 3 | |
| 13 | +#define HE_REGTYPE_MBOX 4 | |
| 14 | + | |
| 15 | +struct he_ioctl_reg { | |
| 16 | + unsigned addr, val; | |
| 17 | + char type; | |
| 18 | +}; | |
| 19 | + | |
| 20 | +#endif /* LINUX_ATM_HE_H */ | |
| @@ -0,0 +1,28 @@ | ||
| 1 | +/* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for | |
| 2 | + * use by driver-specific utilities) */ | |
| 3 | + | |
| 4 | +/* Written 1999 by Greg Banks <gnb@linuxfan.com>. Copied from atm_suni.h. */ | |
| 5 | + | |
| 6 | + | |
| 7 | +#ifndef LINUX_ATM_IDT77105_H | |
| 8 | +#define LINUX_ATM_IDT77105_H | |
| 9 | + | |
| 10 | +#include <linux/types.h> | |
| 11 | +#include <linux/atmioc.h> | |
| 12 | +#include <linux/atmdev.h> | |
| 13 | + | |
| 14 | +/* | |
| 15 | + * Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls. | |
| 16 | + * Pointed to by `arg' in atmif_sioc. | |
| 17 | + */ | |
| 18 | +struct idt77105_stats { | |
| 19 | + __u32 symbol_errors; /* wire symbol errors */ | |
| 20 | + __u32 tx_cells; /* cells transmitted */ | |
| 21 | + __u32 rx_cells; /* cells received */ | |
| 22 | + __u32 rx_hec_errors; /* Header Error Check errors on receive */ | |
| 23 | +}; | |
| 24 | + | |
| 25 | +#define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */ | |
| 26 | +#define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */ | |
| 27 | + | |
| 28 | +#endif | |
| @@ -0,0 +1,53 @@ | ||
| 1 | +/****************************************************************************** | |
| 2 | + * | |
| 3 | + * atm_nicstar.h | |
| 4 | + * | |
| 5 | + * Driver-specific declarations for use by NICSTAR driver specific utils. | |
| 6 | + * | |
| 7 | + * Author: Rui Prior | |
| 8 | + * | |
| 9 | + * (C) INESC 1998 | |
| 10 | + * | |
| 11 | + ******************************************************************************/ | |
| 12 | + | |
| 13 | + | |
| 14 | +#ifndef LINUX_ATM_NICSTAR_H | |
| 15 | +#define LINUX_ATM_NICSTAR_H | |
| 16 | + | |
| 17 | +/* Note: non-kernel programs including this file must also include | |
| 18 | + * sys/types.h for struct timeval | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#include <linux/atmapi.h> | |
| 22 | +#include <linux/atmioc.h> | |
| 23 | + | |
| 24 | +#define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc) | |
| 25 | + /* get pool statistics */ | |
| 26 | +#define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) | |
| 27 | + /* set buffer level markers */ | |
| 28 | +#define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3) | |
| 29 | + /* adjust buffer level */ | |
| 30 | + | |
| 31 | +typedef struct buf_nr | |
| 32 | +{ | |
| 33 | + unsigned min; | |
| 34 | + unsigned init; | |
| 35 | + unsigned max; | |
| 36 | +}buf_nr; | |
| 37 | + | |
| 38 | + | |
| 39 | +typedef struct pool_levels | |
| 40 | +{ | |
| 41 | + int buftype; | |
| 42 | + int count; /* (At least for now) only used in NS_GETPSTAT */ | |
| 43 | + buf_nr level; | |
| 44 | +} pool_levels; | |
| 45 | + | |
| 46 | +/* type must be one of the following: */ | |
| 47 | +#define NS_BUFTYPE_SMALL 1 | |
| 48 | +#define NS_BUFTYPE_LARGE 2 | |
| 49 | +#define NS_BUFTYPE_HUGE 3 | |
| 50 | +#define NS_BUFTYPE_IOVEC 4 | |
| 51 | + | |
| 52 | + | |
| 53 | +#endif /* LINUX_ATM_NICSTAR_H */ | |
| @@ -0,0 +1,61 @@ | ||
| 1 | +/* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by | |
| 2 | + driver-specific utilities) */ | |
| 3 | + | |
| 4 | +/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */ | |
| 5 | + | |
| 6 | + | |
| 7 | +#ifndef _UAPILINUX_ATM_TCP_H | |
| 8 | +#define _UAPILINUX_ATM_TCP_H | |
| 9 | + | |
| 10 | +#include <linux/atmapi.h> | |
| 11 | +#include <linux/atm.h> | |
| 12 | +#include <linux/atmioc.h> | |
| 13 | +#include <linux/types.h> | |
| 14 | + | |
| 15 | + | |
| 16 | +/* | |
| 17 | + * All values in struct atmtcp_hdr are in network byte order | |
| 18 | + */ | |
| 19 | + | |
| 20 | +struct atmtcp_hdr { | |
| 21 | + __u16 vpi; | |
| 22 | + __u16 vci; | |
| 23 | + __u32 length; /* ... of data part */ | |
| 24 | +}; | |
| 25 | + | |
| 26 | +/* | |
| 27 | + * All values in struct atmtcp_command are in host byte order | |
| 28 | + */ | |
| 29 | + | |
| 30 | +#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */ | |
| 31 | +#define ATMTCP_CTRL_OPEN 1 /* request/reply */ | |
| 32 | +#define ATMTCP_CTRL_CLOSE 2 /* request/reply */ | |
| 33 | + | |
| 34 | +struct atmtcp_control { | |
| 35 | + struct atmtcp_hdr hdr; /* must be first */ | |
| 36 | + int type; /* message type; both directions */ | |
| 37 | + atm_kptr_t vcc; /* both directions */ | |
| 38 | + struct sockaddr_atmpvc addr; /* suggested value from kernel */ | |
| 39 | + struct atm_qos qos; /* both directions */ | |
| 40 | + int result; /* to kernel only */ | |
| 41 | +} __ATM_API_ALIGN; | |
| 42 | + | |
| 43 | +/* | |
| 44 | + * Field usage: | |
| 45 | + * Messge type dir. hdr.v?i type addr qos vcc result | |
| 46 | + * ----------- ---- ------- ---- ---- --- --- ------ | |
| 47 | + * OPEN K->D Y Y Y Y Y 0 | |
| 48 | + * OPEN D->K - Y Y Y Y Y | |
| 49 | + * CLOSE K->D - - Y - Y 0 | |
| 50 | + * CLOSE D->K - - - - Y Y | |
| 51 | + */ | |
| 52 | + | |
| 53 | +#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */ | |
| 54 | +#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP | |
| 55 | + interface */ | |
| 56 | +#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP | |
| 57 | + interface */ | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | +#endif /* _UAPILINUX_ATM_TCP_H */ | |
| @@ -0,0 +1,52 @@ | ||
| 1 | +/* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by | |
| 2 | + driver-specific utilities) */ | |
| 3 | + | |
| 4 | +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | |
| 5 | + | |
| 6 | + | |
| 7 | +#ifndef LINUX_ATM_ZATM_H | |
| 8 | +#define LINUX_ATM_ZATM_H | |
| 9 | + | |
| 10 | +/* | |
| 11 | + * Note: non-kernel programs including this file must also include | |
| 12 | + * sys/types.h for struct timeval | |
| 13 | + */ | |
| 14 | + | |
| 15 | +#include <linux/atmapi.h> | |
| 16 | +#include <linux/atmioc.h> | |
| 17 | + | |
| 18 | +#define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc) | |
| 19 | + /* get pool statistics */ | |
| 20 | +#define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc) | |
| 21 | + /* get statistics and zero */ | |
| 22 | +#define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc) | |
| 23 | + /* set pool parameters */ | |
| 24 | + | |
| 25 | +struct zatm_pool_info { | |
| 26 | + int ref_count; /* free buffer pool usage counters */ | |
| 27 | + int low_water,high_water; /* refill parameters */ | |
| 28 | + int rqa_count,rqu_count; /* queue condition counters */ | |
| 29 | + int offset,next_off; /* alignment optimizations: offset */ | |
| 30 | + int next_cnt,next_thres; /* repetition counter and threshold */ | |
| 31 | +}; | |
| 32 | + | |
| 33 | +struct zatm_pool_req { | |
| 34 | + int pool_num; /* pool number */ | |
| 35 | + struct zatm_pool_info info; /* actual information */ | |
| 36 | +}; | |
| 37 | + | |
| 38 | +struct zatm_t_hist { | |
| 39 | + struct timeval real; /* real (wall-clock) time */ | |
| 40 | + struct timeval expected; /* expected real time */ | |
| 41 | +}; | |
| 42 | + | |
| 43 | + | |
| 44 | +#define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */ | |
| 45 | +#define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */ | |
| 46 | +#define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */ | |
| 47 | +#define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */ | |
| 48 | + | |
| 49 | +#define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to | |
| 50 | + record; must be 2^n */ | |
| 51 | + | |
| 52 | +#endif | |
| @@ -0,0 +1,29 @@ | ||
| 1 | +/* atmapi.h - ATM API user space/kernel compatibility */ | |
| 2 | + | |
| 3 | +/* Written 1999,2000 by Werner Almesberger, EPFL ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +#ifndef _LINUX_ATMAPI_H | |
| 7 | +#define _LINUX_ATMAPI_H | |
| 8 | + | |
| 9 | +#if defined(__sparc__) || defined(__ia64__) | |
| 10 | +/* such alignment is not required on 32 bit sparcs, but we can't | |
| 11 | + figure that we are on a sparc64 while compiling user-space programs. */ | |
| 12 | +#define __ATM_API_ALIGN __attribute__((aligned(8))) | |
| 13 | +#else | |
| 14 | +#define __ATM_API_ALIGN | |
| 15 | +#endif | |
| 16 | + | |
| 17 | + | |
| 18 | +/* | |
| 19 | + * Opaque type for kernel pointers. Note that _ is never accessed. We need | |
| 20 | + * the struct in order hide the array, so that we can make simple assignments | |
| 21 | + * instead of being forced to use memcpy. It also improves error reporting for | |
| 22 | + * code that still assumes that we're passing unsigned longs. | |
| 23 | + * | |
| 24 | + * Convention: NULL pointers are passed as a field of all zeroes. | |
| 25 | + */ | |
| 26 | + | |
| 27 | +typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; | |
| 28 | + | |
| 29 | +#endif | |
| @@ -0,0 +1,41 @@ | ||
| 1 | +/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */ | |
| 2 | + | |
| 3 | +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +#ifndef _LINUX_ATMARP_H | |
| 7 | +#define _LINUX_ATMARP_H | |
| 8 | + | |
| 9 | +#include <linux/types.h> | |
| 10 | +#include <linux/atmapi.h> | |
| 11 | +#include <linux/atmioc.h> | |
| 12 | + | |
| 13 | + | |
| 14 | +#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget | |
| 15 | + NAK after 30 sec - should go into | |
| 16 | + atmclip.h */ | |
| 17 | +#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while | |
| 18 | + waiting for the resolver */ | |
| 19 | + | |
| 20 | + | |
| 21 | +#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */ | |
| 22 | +#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */ | |
| 23 | +#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */ | |
| 24 | +#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */ | |
| 25 | + | |
| 26 | + | |
| 27 | +enum atmarp_ctrl_type { | |
| 28 | + act_invalid, /* catch uninitialized structures */ | |
| 29 | + act_need, /* need address resolution */ | |
| 30 | + act_up, /* interface is coming up */ | |
| 31 | + act_down, /* interface is going down */ | |
| 32 | + act_change /* interface configuration has changed */ | |
| 33 | +}; | |
| 34 | + | |
| 35 | +struct atmarp_ctrl { | |
| 36 | + enum atmarp_ctrl_type type; /* message type */ | |
| 37 | + int itf_num;/* interface number (if present) */ | |
| 38 | + __be32 ip; /* IP address (act_need only) */ | |
| 39 | +}; | |
| 40 | + | |
| 41 | +#endif | |
| @@ -0,0 +1,117 @@ | ||
| 1 | +#ifndef _LINUX_ATMBR2684_H | |
| 2 | +#define _LINUX_ATMBR2684_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/atm.h> | |
| 6 | +#include <linux/if.h> /* For IFNAMSIZ */ | |
| 7 | + | |
| 8 | +/* | |
| 9 | + * Type of media we're bridging (ethernet, token ring, etc) Currently only | |
| 10 | + * ethernet is supported | |
| 11 | + */ | |
| 12 | +#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */ | |
| 13 | +#define BR2684_MEDIA_802_4 (1) /* 802.4 */ | |
| 14 | +#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */ | |
| 15 | +#define BR2684_MEDIA_FDDI (3) | |
| 16 | +#define BR2684_MEDIA_802_6 (4) /* 802.6 */ | |
| 17 | + | |
| 18 | + /* used only at device creation: */ | |
| 19 | +#define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */ | |
| 20 | + | |
| 21 | +/* | |
| 22 | + * Is there FCS inbound on this VC? This currently isn't supported. | |
| 23 | + */ | |
| 24 | +#define BR2684_FCSIN_NO (0) | |
| 25 | +#define BR2684_FCSIN_IGNORE (1) | |
| 26 | +#define BR2684_FCSIN_VERIFY (2) | |
| 27 | + | |
| 28 | +/* | |
| 29 | + * Is there FCS outbound on this VC? This currently isn't supported. | |
| 30 | + */ | |
| 31 | +#define BR2684_FCSOUT_NO (0) | |
| 32 | +#define BR2684_FCSOUT_SENDZERO (1) | |
| 33 | +#define BR2684_FCSOUT_GENERATE (2) | |
| 34 | + | |
| 35 | +/* | |
| 36 | + * Does this VC include LLC encapsulation? | |
| 37 | + */ | |
| 38 | +#define BR2684_ENCAPS_VC (0) /* VC-mux */ | |
| 39 | +#define BR2684_ENCAPS_LLC (1) | |
| 40 | +#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ | |
| 41 | + | |
| 42 | +/* | |
| 43 | + * Is this VC bridged or routed? | |
| 44 | + */ | |
| 45 | + | |
| 46 | +#define BR2684_PAYLOAD_ROUTED (0) | |
| 47 | +#define BR2684_PAYLOAD_BRIDGED (1) | |
| 48 | + | |
| 49 | +/* | |
| 50 | + * This is for the ATM_NEWBACKENDIF call - these are like socket families: | |
| 51 | + * the first element of the structure is the backend number and the rest | |
| 52 | + * is per-backend specific | |
| 53 | + */ | |
| 54 | +struct atm_newif_br2684 { | |
| 55 | + atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ | |
| 56 | + int media; /* BR2684_MEDIA_*, flags in upper bits */ | |
| 57 | + char ifname[IFNAMSIZ]; | |
| 58 | + int mtu; | |
| 59 | +}; | |
| 60 | + | |
| 61 | +/* | |
| 62 | + * This structure is used to specify a br2684 interface - either by a | |
| 63 | + * positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name | |
| 64 | + */ | |
| 65 | +#define BR2684_FIND_BYNOTHING (0) | |
| 66 | +#define BR2684_FIND_BYNUM (1) | |
| 67 | +#define BR2684_FIND_BYIFNAME (2) | |
| 68 | +struct br2684_if_spec { | |
| 69 | + int method; /* BR2684_FIND_* */ | |
| 70 | + union { | |
| 71 | + char ifname[IFNAMSIZ]; | |
| 72 | + int devnum; | |
| 73 | + } spec; | |
| 74 | +}; | |
| 75 | + | |
| 76 | +/* | |
| 77 | + * This is for the ATM_SETBACKEND call - these are like socket families: | |
| 78 | + * the first element of the structure is the backend number and the rest | |
| 79 | + * is per-backend specific | |
| 80 | + */ | |
| 81 | +struct atm_backend_br2684 { | |
| 82 | + atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ | |
| 83 | + struct br2684_if_spec ifspec; | |
| 84 | + int fcs_in; /* BR2684_FCSIN_* */ | |
| 85 | + int fcs_out; /* BR2684_FCSOUT_* */ | |
| 86 | + int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ | |
| 87 | + int encaps; /* BR2684_ENCAPS_* */ | |
| 88 | + int has_vpiid; /* 1: use vpn_id - Unsupported */ | |
| 89 | + __u8 vpn_id[7]; | |
| 90 | + int send_padding; /* unsupported */ | |
| 91 | + int min_size; /* we will pad smaller packets than this */ | |
| 92 | +}; | |
| 93 | + | |
| 94 | +/* | |
| 95 | + * The BR2684_SETFILT ioctl is an experimental mechanism for folks | |
| 96 | + * terminating a large number of IP-only vcc's. When netfilter allows | |
| 97 | + * efficient per-if in/out filters, this support will be removed | |
| 98 | + */ | |
| 99 | +struct br2684_filter { | |
| 100 | + __be32 prefix; /* network byte order */ | |
| 101 | + __be32 netmask; /* 0 = disable filter */ | |
| 102 | +}; | |
| 103 | + | |
| 104 | +struct br2684_filter_set { | |
| 105 | + struct br2684_if_spec ifspec; | |
| 106 | + struct br2684_filter filter; | |
| 107 | +}; | |
| 108 | + | |
| 109 | +enum br2684_payload { | |
| 110 | + p_routed = BR2684_PAYLOAD_ROUTED, | |
| 111 | + p_bridged = BR2684_PAYLOAD_BRIDGED, | |
| 112 | +}; | |
| 113 | + | |
| 114 | +#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ | |
| 115 | + struct br2684_filter_set) | |
| 116 | + | |
| 117 | +#endif /* _LINUX_ATMBR2684_H */ | |
| @@ -0,0 +1,21 @@ | ||
| 1 | +/* atmclip.h - Classical IP over ATM */ | |
| 2 | + | |
| 3 | +/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +#ifndef LINUX_ATMCLIP_H | |
| 7 | +#define LINUX_ATMCLIP_H | |
| 8 | + | |
| 9 | +#include <linux/sockios.h> | |
| 10 | +#include <linux/atmioc.h> | |
| 11 | + | |
| 12 | + | |
| 13 | +#define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */ | |
| 14 | +#define RFC1626_MTU 9180 /* RFC1626 default MTU */ | |
| 15 | + | |
| 16 | +#define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */ | |
| 17 | +#define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */ | |
| 18 | + | |
| 19 | +#define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */ | |
| 20 | + | |
| 21 | +#endif | |
| @@ -0,0 +1,215 @@ | ||
| 1 | +/* atmdev.h - ATM device driver declarations and various related items */ | |
| 2 | + | |
| 3 | +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +#ifndef _UAPILINUX_ATMDEV_H | |
| 7 | +#define _UAPILINUX_ATMDEV_H | |
| 8 | + | |
| 9 | + | |
| 10 | +#include <linux/atmapi.h> | |
| 11 | +#include <linux/atm.h> | |
| 12 | +#include <linux/atmioc.h> | |
| 13 | + | |
| 14 | + | |
| 15 | +#define ESI_LEN 6 | |
| 16 | + | |
| 17 | +#define ATM_OC3_PCR (155520000/270*260/8/53) | |
| 18 | + /* OC3 link rate: 155520000 bps | |
| 19 | + SONET overhead: /270*260 (9 section, 1 path) | |
| 20 | + bits per cell: /8/53 | |
| 21 | + max cell rate: 353207.547 cells/sec */ | |
| 22 | +#define ATM_25_PCR ((25600000/8-8000)/54) | |
| 23 | + /* 25 Mbps ATM cell rate (59111) */ | |
| 24 | +#define ATM_OC12_PCR (622080000/1080*1040/8/53) | |
| 25 | + /* OC12 link rate: 622080000 bps | |
| 26 | + SONET overhead: /1080*1040 | |
| 27 | + bits per cell: /8/53 | |
| 28 | + max cell rate: 1412830.188 cells/sec */ | |
| 29 | +#define ATM_DS3_PCR (8000*12) | |
| 30 | + /* DS3: 12 cells in a 125 usec time slot */ | |
| 31 | + | |
| 32 | + | |
| 33 | +#define __AAL_STAT_ITEMS \ | |
| 34 | + __HANDLE_ITEM(tx); /* TX okay */ \ | |
| 35 | + __HANDLE_ITEM(tx_err); /* TX errors */ \ | |
| 36 | + __HANDLE_ITEM(rx); /* RX okay */ \ | |
| 37 | + __HANDLE_ITEM(rx_err); /* RX errors */ \ | |
| 38 | + __HANDLE_ITEM(rx_drop); /* RX out of memory */ | |
| 39 | + | |
| 40 | +struct atm_aal_stats { | |
| 41 | +#define __HANDLE_ITEM(i) int i | |
| 42 | + __AAL_STAT_ITEMS | |
| 43 | +#undef __HANDLE_ITEM | |
| 44 | +}; | |
| 45 | + | |
| 46 | + | |
| 47 | +struct atm_dev_stats { | |
| 48 | + struct atm_aal_stats aal0; | |
| 49 | + struct atm_aal_stats aal34; | |
| 50 | + struct atm_aal_stats aal5; | |
| 51 | +} __ATM_API_ALIGN; | |
| 52 | + | |
| 53 | + | |
| 54 | +#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) | |
| 55 | + /* get link rate */ | |
| 56 | +#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) | |
| 57 | + /* get interface names (numbers) */ | |
| 58 | +#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) | |
| 59 | + /* get interface type name */ | |
| 60 | +#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) | |
| 61 | + /* get interface ESI */ | |
| 62 | +#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) | |
| 63 | + /* get itf's local ATM addr. list */ | |
| 64 | +#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) | |
| 65 | + /* reset itf's ATM address list */ | |
| 66 | +#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) | |
| 67 | + /* add a local ATM address */ | |
| 68 | +#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) | |
| 69 | + /* remove a local ATM address */ | |
| 70 | +#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) | |
| 71 | + /* get connection identifier range */ | |
| 72 | +#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) | |
| 73 | + /* set connection identifier range */ | |
| 74 | +#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) | |
| 75 | + /* set interface ESI */ | |
| 76 | +#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) | |
| 77 | + /* force interface ESI */ | |
| 78 | +#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) | |
| 79 | + /* register a LECS address */ | |
| 80 | +#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) | |
| 81 | + /* unregister a LECS address */ | |
| 82 | +#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) | |
| 83 | + /* retrieve LECS address(es) */ | |
| 84 | + | |
| 85 | +#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) | |
| 86 | + /* get AAL layer statistics */ | |
| 87 | +#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) | |
| 88 | + /* get AAL layer statistics and zero */ | |
| 89 | +#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) | |
| 90 | + /* get loopback mode */ | |
| 91 | +#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) | |
| 92 | + /* set loopback mode */ | |
| 93 | +#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) | |
| 94 | + /* query supported loopback modes */ | |
| 95 | +#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) | |
| 96 | + /* enable or disable single-copy */ | |
| 97 | +#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) | |
| 98 | + /* set backend handler */ | |
| 99 | +#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) | |
| 100 | + /* use backend to make new if */ | |
| 101 | +#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) | |
| 102 | + /* add party to p2mp call */ | |
| 103 | +#ifdef CONFIG_COMPAT | |
| 104 | +/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */ | |
| 105 | +#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf) | |
| 106 | +#endif | |
| 107 | +#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) | |
| 108 | + /* drop party from p2mp call */ | |
| 109 | + | |
| 110 | +/* | |
| 111 | + * These are backend handkers that can be set via the ATM_SETBACKEND call | |
| 112 | + * above. In the future we may support dynamic loading of these - for now, | |
| 113 | + * they're just being used to share the ATMIOC_BACKEND ioctls | |
| 114 | + */ | |
| 115 | +#define ATM_BACKEND_RAW 0 | |
| 116 | +#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */ | |
| 117 | +#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */ | |
| 118 | + | |
| 119 | +/* for ATM_GETTYPE */ | |
| 120 | +#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */ | |
| 121 | + | |
| 122 | +/* | |
| 123 | + * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP | |
| 124 | + */ | |
| 125 | + | |
| 126 | +/* Point of loopback CPU-->SAR-->PHY-->line--> ... */ | |
| 127 | +#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */ | |
| 128 | +#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */ | |
| 129 | +#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */ | |
| 130 | +/* RESERVED 4 loop back on PHY side ---' */ | |
| 131 | +#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */ | |
| 132 | +#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */ | |
| 133 | + | |
| 134 | +/* Direction of loopback */ | |
| 135 | +#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */ | |
| 136 | +#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */ | |
| 137 | + | |
| 138 | +#define __ATM_LM_XTLOC(n) ((n) & 0xff) | |
| 139 | +#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) | |
| 140 | + | |
| 141 | +#define ATM_LM_NONE 0 /* no loopback */ | |
| 142 | + | |
| 143 | +#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) | |
| 144 | +#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) | |
| 145 | +#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) | |
| 146 | +#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) | |
| 147 | + | |
| 148 | +#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) | |
| 149 | +#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) | |
| 150 | +#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) | |
| 151 | +#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) | |
| 152 | + | |
| 153 | +/* | |
| 154 | + * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that | |
| 155 | + * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x) | |
| 156 | + */ | |
| 157 | + | |
| 158 | + | |
| 159 | +struct atm_iobuf { | |
| 160 | + int length; | |
| 161 | + void __user *buffer; | |
| 162 | +}; | |
| 163 | + | |
| 164 | +/* for ATM_GETCIRANGE / ATM_SETCIRANGE */ | |
| 165 | + | |
| 166 | +#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */ | |
| 167 | + | |
| 168 | +struct atm_cirange { | |
| 169 | + signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */ | |
| 170 | + signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */ | |
| 171 | +}; | |
| 172 | + | |
| 173 | +/* for ATM_SETSC; actually taken from the ATM_VF number space */ | |
| 174 | + | |
| 175 | +#define ATM_SC_RX 1024 /* enable RX single-copy */ | |
| 176 | +#define ATM_SC_TX 2048 /* enable TX single-copy */ | |
| 177 | + | |
| 178 | +#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out | |
| 179 | + anyway */ | |
| 180 | + | |
| 181 | +/* MF: change_qos (Modify) flags */ | |
| 182 | + | |
| 183 | +#define ATM_MF_IMMED 1 /* Block until change is effective */ | |
| 184 | +#define ATM_MF_INC_RSV 2 /* Change reservation on increase */ | |
| 185 | +#define ATM_MF_INC_SHP 4 /* Change shaping on increase */ | |
| 186 | +#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */ | |
| 187 | +#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */ | |
| 188 | +#define ATM_MF_BWD 32 /* Set the backward direction parameters */ | |
| 189 | + | |
| 190 | +#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \ | |
| 191 | + ATM_MF_DEC_SHP | ATM_MF_BWD) | |
| 192 | + | |
| 193 | +/* | |
| 194 | + * ATM_VS_* are used to express VC state in a human-friendly way. | |
| 195 | + */ | |
| 196 | + | |
| 197 | +#define ATM_VS_IDLE 0 /* VC is not used */ | |
| 198 | +#define ATM_VS_CONNECTED 1 /* VC is connected */ | |
| 199 | +#define ATM_VS_CLOSING 2 /* VC is closing */ | |
| 200 | +#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */ | |
| 201 | +#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */ | |
| 202 | +#define ATM_VS_BOUND 5 /* VC is bound */ | |
| 203 | + | |
| 204 | +#define ATM_VS2TXT_MAP \ | |
| 205 | + "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" | |
| 206 | + | |
| 207 | +#define ATM_VF2TXT_MAP \ | |
| 208 | + "ADDR", "READY", "PARTIAL", "REGIS", \ | |
| 209 | + "RELEASED", "HASQOS", "LISTEN", "META", \ | |
| 210 | + "256", "512", "1024", "2048", \ | |
| 211 | + "SESSION", "HASSAP", "BOUND", "CLOSE" | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | +#endif /* _UAPILINUX_ATMDEV_H */ | |
| @@ -0,0 +1,41 @@ | ||
| 1 | +/* atmioc.h - ranges for ATM-related ioctl numbers */ | |
| 2 | + | |
| 3 | +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +/* | |
| 7 | + * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of | |
| 8 | + * "magic" ioctl numbers. | |
| 9 | + */ | |
| 10 | + | |
| 11 | + | |
| 12 | +#ifndef _LINUX_ATMIOC_H | |
| 13 | +#define _LINUX_ATMIOC_H | |
| 14 | + | |
| 15 | +#include <asm/ioctl.h> | |
| 16 | + /* everybody including atmioc.h will also need _IO{,R,W,WR} */ | |
| 17 | + | |
| 18 | +#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ | |
| 19 | +#define ATMIOC_PHYCOM_END 0x0f | |
| 20 | +#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ | |
| 21 | +#define ATMIOC_PHYTYP_END 0x2f | |
| 22 | +#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ | |
| 23 | +#define ATMIOC_PHYPRV_END 0x4f | |
| 24 | +#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ | |
| 25 | +#define ATMIOC_SARCOM_END 0x50 | |
| 26 | +#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ | |
| 27 | +#define ATMIOC_SARPRV_END 0x7f | |
| 28 | +#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ | |
| 29 | +#define ATMIOC_ITF_END 0x8f | |
| 30 | +#define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ | |
| 31 | +#define ATMIOC_BACKEND_END 0xaf | |
| 32 | +/* 0xb0-0xbf: Reserved for future use */ | |
| 33 | +#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ | |
| 34 | +#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ | |
| 35 | +#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ | |
| 36 | +#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ | |
| 37 | +#define ATMIOC_CLIP_END 0xef | |
| 38 | +#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ | |
| 39 | +#define ATMIOC_SPECIAL_END 0xff | |
| 40 | + | |
| 41 | +#endif | |
| @@ -0,0 +1,91 @@ | ||
| 1 | +/* | |
| 2 | + * ATM Lan Emulation Daemon driver interface | |
| 3 | + * | |
| 4 | + * Marko Kiiskila <mkiiskila@yahoo.com> | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef _ATMLEC_H_ | |
| 8 | +#define _ATMLEC_H_ | |
| 9 | + | |
| 10 | +#include <linux/atmapi.h> | |
| 11 | +#include <linux/atmioc.h> | |
| 12 | +#include <linux/atm.h> | |
| 13 | +#include <linux/if_ether.h> | |
| 14 | +#include <linux/types.h> | |
| 15 | + | |
| 16 | +/* ATM lec daemon control socket */ | |
| 17 | +#define ATMLEC_CTRL _IO('a', ATMIOC_LANE) | |
| 18 | +#define ATMLEC_DATA _IO('a', ATMIOC_LANE+1) | |
| 19 | +#define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2) | |
| 20 | + | |
| 21 | +/* Maximum number of LEC interfaces (tweakable) */ | |
| 22 | +#define MAX_LEC_ITF 48 | |
| 23 | + | |
| 24 | +typedef enum { | |
| 25 | + l_set_mac_addr, | |
| 26 | + l_del_mac_addr, | |
| 27 | + l_svc_setup, | |
| 28 | + l_addr_delete, | |
| 29 | + l_topology_change, | |
| 30 | + l_flush_complete, | |
| 31 | + l_arp_update, | |
| 32 | + l_narp_req, /* LANE2 mandates the use of this */ | |
| 33 | + l_config, | |
| 34 | + l_flush_tran_id, | |
| 35 | + l_set_lecid, | |
| 36 | + l_arp_xmt, | |
| 37 | + l_rdesc_arp_xmt, | |
| 38 | + l_associate_req, | |
| 39 | + l_should_bridge /* should we bridge this MAC? */ | |
| 40 | +} atmlec_msg_type; | |
| 41 | + | |
| 42 | +#define ATMLEC_MSG_TYPE_MAX l_should_bridge | |
| 43 | + | |
| 44 | +struct atmlec_config_msg { | |
| 45 | + unsigned int maximum_unknown_frame_count; | |
| 46 | + unsigned int max_unknown_frame_time; | |
| 47 | + unsigned short max_retry_count; | |
| 48 | + unsigned int aging_time; | |
| 49 | + unsigned int forward_delay_time; | |
| 50 | + unsigned int arp_response_time; | |
| 51 | + unsigned int flush_timeout; | |
| 52 | + unsigned int path_switching_delay; | |
| 53 | + unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */ | |
| 54 | + int mtu; | |
| 55 | + int is_proxy; | |
| 56 | +}; | |
| 57 | + | |
| 58 | +struct atmlec_msg { | |
| 59 | + atmlec_msg_type type; | |
| 60 | + int sizeoftlvs; /* LANE2: if != 0, tlvs follow */ | |
| 61 | + union { | |
| 62 | + struct { | |
| 63 | + unsigned char mac_addr[ETH_ALEN]; | |
| 64 | + unsigned char atm_addr[ATM_ESA_LEN]; | |
| 65 | + unsigned int flag; /* | |
| 66 | + * Topology_change flag, | |
| 67 | + * remoteflag, permanent flag, | |
| 68 | + * lecid, transaction id | |
| 69 | + */ | |
| 70 | + unsigned int targetless_le_arp; /* LANE2 */ | |
| 71 | + unsigned int no_source_le_narp; /* LANE2 */ | |
| 72 | + } normal; | |
| 73 | + struct atmlec_config_msg config; | |
| 74 | + struct { | |
| 75 | + __u16 lec_id; /* requestor lec_id */ | |
| 76 | + __u32 tran_id; /* transaction id */ | |
| 77 | + unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ | |
| 78 | + unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ | |
| 79 | + } proxy; /* | |
| 80 | + * For mapping LE_ARP requests to responses. Filled by | |
| 81 | + * zeppelin, returned by kernel. Used only when proxying | |
| 82 | + */ | |
| 83 | + } content; | |
| 84 | +} __ATM_API_ALIGN; | |
| 85 | + | |
| 86 | +struct atmlec_ioc { | |
| 87 | + int dev_num; | |
| 88 | + unsigned char atm_addr[ATM_ESA_LEN]; | |
| 89 | + unsigned char receive; /* 1= receive vcc, 0 = send vcc */ | |
| 90 | +}; | |
| 91 | +#endif /* _ATMLEC_H_ */ | |
| @@ -0,0 +1,126 @@ | ||
| 1 | +#ifndef _ATMMPC_H_ | |
| 2 | +#define _ATMMPC_H_ | |
| 3 | + | |
| 4 | +#include <linux/atmapi.h> | |
| 5 | +#include <linux/atmioc.h> | |
| 6 | +#include <linux/atm.h> | |
| 7 | +#include <linux/types.h> | |
| 8 | + | |
| 9 | +#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) | |
| 10 | +#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) | |
| 11 | + | |
| 12 | +#define MPC_SOCKET_INGRESS 1 | |
| 13 | +#define MPC_SOCKET_EGRESS 2 | |
| 14 | + | |
| 15 | +struct atmmpc_ioc { | |
| 16 | + int dev_num; | |
| 17 | + __be32 ipaddr; /* the IP address of the shortcut */ | |
| 18 | + int type; /* ingress or egress */ | |
| 19 | +}; | |
| 20 | + | |
| 21 | +typedef struct in_ctrl_info { | |
| 22 | + __u8 Last_NHRP_CIE_code; | |
| 23 | + __u8 Last_Q2931_cause_value; | |
| 24 | + __u8 eg_MPC_ATM_addr[ATM_ESA_LEN]; | |
| 25 | + __be32 tag; | |
| 26 | + __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ | |
| 27 | + __u16 holding_time; | |
| 28 | + __u32 request_id; | |
| 29 | +} in_ctrl_info; | |
| 30 | + | |
| 31 | +typedef struct eg_ctrl_info { | |
| 32 | + __u8 DLL_header[256]; | |
| 33 | + __u8 DH_length; | |
| 34 | + __be32 cache_id; | |
| 35 | + __be32 tag; | |
| 36 | + __be32 mps_ip; | |
| 37 | + __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ | |
| 38 | + __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN]; | |
| 39 | + __u16 holding_time; | |
| 40 | +} eg_ctrl_info; | |
| 41 | + | |
| 42 | +struct mpc_parameters { | |
| 43 | + __u16 mpc_p1; /* Shortcut-Setup Frame Count */ | |
| 44 | + __u16 mpc_p2; /* Shortcut-Setup Frame Time */ | |
| 45 | + __u8 mpc_p3[8]; /* Flow-detection Protocols */ | |
| 46 | + __u16 mpc_p4; /* MPC Initial Retry Time */ | |
| 47 | + __u16 mpc_p5; /* MPC Retry Time Maximum */ | |
| 48 | + __u16 mpc_p6; /* Hold Down Time */ | |
| 49 | +} ; | |
| 50 | + | |
| 51 | +struct k_message { | |
| 52 | + __u16 type; | |
| 53 | + __be32 ip_mask; | |
| 54 | + __u8 MPS_ctrl[ATM_ESA_LEN]; | |
| 55 | + union { | |
| 56 | + in_ctrl_info in_info; | |
| 57 | + eg_ctrl_info eg_info; | |
| 58 | + struct mpc_parameters params; | |
| 59 | + } content; | |
| 60 | + struct atm_qos qos; | |
| 61 | +} __ATM_API_ALIGN; | |
| 62 | + | |
| 63 | +struct llc_snap_hdr { | |
| 64 | + /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ | |
| 65 | + __u8 dsap; /* Destination Service Access Point (0xAA) */ | |
| 66 | + __u8 ssap; /* Source Service Access Point (0xAA) */ | |
| 67 | + __u8 ui; /* Unnumbered Information (0x03) */ | |
| 68 | + __u8 org[3]; /* Organizational identification (0x000000) */ | |
| 69 | + __u8 type[2]; /* Ether type (for IP) (0x0800) */ | |
| 70 | +}; | |
| 71 | + | |
| 72 | +/* TLVs this MPC recognizes */ | |
| 73 | +#define TLV_MPOA_DEVICE_TYPE 0x00a03e2a | |
| 74 | + | |
| 75 | +/* MPOA device types in MPOA Device Type TLV */ | |
| 76 | +#define NON_MPOA 0 | |
| 77 | +#define MPS 1 | |
| 78 | +#define MPC 2 | |
| 79 | +#define MPS_AND_MPC 3 | |
| 80 | + | |
| 81 | + | |
| 82 | +/* MPC parameter defaults */ | |
| 83 | + | |
| 84 | +#define MPC_P1 10 /* Shortcut-Setup Frame Count */ | |
| 85 | +#define MPC_P2 1 /* Shortcut-Setup Frame Time */ | |
| 86 | +#define MPC_P3 0 /* Flow-detection Protocols */ | |
| 87 | +#define MPC_P4 5 /* MPC Initial Retry Time */ | |
| 88 | +#define MPC_P5 40 /* MPC Retry Time Maximum */ | |
| 89 | +#define MPC_P6 160 /* Hold Down Time */ | |
| 90 | +#define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */ | |
| 91 | + | |
| 92 | +/* MPC constants */ | |
| 93 | + | |
| 94 | +#define MPC_C1 2 /* Retry Time Multiplier */ | |
| 95 | +#define MPC_C2 60 /* Initial Keep-Alive Lifetime */ | |
| 96 | + | |
| 97 | +/* Message types - to MPOA daemon */ | |
| 98 | + | |
| 99 | +#define SND_MPOA_RES_RQST 201 | |
| 100 | +#define SET_MPS_CTRL_ADDR 202 | |
| 101 | +#define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */ | |
| 102 | +#define STOP_KEEP_ALIVE_SM 204 | |
| 103 | +#define EGRESS_ENTRY_REMOVED 205 | |
| 104 | +#define SND_EGRESS_PURGE 206 | |
| 105 | +#define DIE 207 /* tell the daemon to exit() */ | |
| 106 | +#define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */ | |
| 107 | +#define OPEN_INGRESS_SVC 209 | |
| 108 | + | |
| 109 | +/* Message types - from MPOA daemon */ | |
| 110 | + | |
| 111 | +#define MPOA_TRIGGER_RCVD 101 | |
| 112 | +#define MPOA_RES_REPLY_RCVD 102 | |
| 113 | +#define INGRESS_PURGE_RCVD 103 | |
| 114 | +#define EGRESS_PURGE_RCVD 104 | |
| 115 | +#define MPS_DEATH 105 | |
| 116 | +#define CACHE_IMPOS_RCVD 106 | |
| 117 | +#define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */ | |
| 118 | +#define SET_MPS_MAC_ADDR 108 | |
| 119 | +#define CLEAN_UP_AND_EXIT 109 | |
| 120 | +#define SET_MPC_PARAMS 110 /* MPC configuration parameters */ | |
| 121 | + | |
| 122 | +/* Message types - bidirectional */ | |
| 123 | + | |
| 124 | +#define RELOAD 301 /* kill -HUP the daemon for reload */ | |
| 125 | + | |
| 126 | +#endif /* _ATMMPC_H_ */ | |
| @@ -0,0 +1,24 @@ | ||
| 1 | +/* atmppp.h - RFC2364 PPPoATM */ | |
| 2 | + | |
| 3 | +/* Written 2000 by Mitchell Blank Jr */ | |
| 4 | + | |
| 5 | +#ifndef _LINUX_ATMPPP_H | |
| 6 | +#define _LINUX_ATMPPP_H | |
| 7 | + | |
| 8 | +#include <linux/atm.h> | |
| 9 | + | |
| 10 | +#define PPPOATM_ENCAPS_AUTODETECT (0) | |
| 11 | +#define PPPOATM_ENCAPS_VC (1) | |
| 12 | +#define PPPOATM_ENCAPS_LLC (2) | |
| 13 | + | |
| 14 | +/* | |
| 15 | + * This is for the ATM_SETBACKEND call - these are like socket families: | |
| 16 | + * the first element of the structure is the backend number and the rest | |
| 17 | + * is per-backend specific | |
| 18 | + */ | |
| 19 | +struct atm_backend_ppp { | |
| 20 | + atm_backend_t backend_num; /* ATM_BACKEND_PPP */ | |
| 21 | + int encaps; /* PPPOATM_ENCAPS_* */ | |
| 22 | +}; | |
| 23 | + | |
| 24 | +#endif /* _LINUX_ATMPPP_H */ | |
| @@ -0,0 +1,162 @@ | ||
| 1 | +/* atmsap.h - ATM Service Access Point addressing definitions */ | |
| 2 | + | |
| 3 | +/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +#ifndef _LINUX_ATMSAP_H | |
| 7 | +#define _LINUX_ATMSAP_H | |
| 8 | + | |
| 9 | +#include <linux/atmapi.h> | |
| 10 | + | |
| 11 | +/* | |
| 12 | + * BEGIN_xx and END_xx markers are used for automatic generation of | |
| 13 | + * documentation. Do not change them. | |
| 14 | + */ | |
| 15 | + | |
| 16 | + | |
| 17 | +/* | |
| 18 | + * Layer 2 protocol identifiers | |
| 19 | + */ | |
| 20 | + | |
| 21 | +/* BEGIN_L2 */ | |
| 22 | +#define ATM_L2_NONE 0 /* L2 not specified */ | |
| 23 | +#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */ | |
| 24 | +#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */ | |
| 25 | +#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */ | |
| 26 | +#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */ | |
| 27 | +#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */ | |
| 28 | +#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */ | |
| 29 | +#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */ | |
| 30 | +#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */ | |
| 31 | +#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */ | |
| 32 | +#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */ | |
| 33 | +#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */ | |
| 34 | +#define ATM_L2_USER 0x10 /* user-specified */ | |
| 35 | +#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */ | |
| 36 | +/* END_L2 */ | |
| 37 | + | |
| 38 | + | |
| 39 | +/* | |
| 40 | + * Layer 3 protocol identifiers | |
| 41 | + */ | |
| 42 | + | |
| 43 | +/* BEGIN_L3 */ | |
| 44 | +#define ATM_L3_NONE 0 /* L3 not specified */ | |
| 45 | +#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */ | |
| 46 | +#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */ | |
| 47 | +#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */ | |
| 48 | +#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */ | |
| 49 | +#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */ | |
| 50 | +#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */ | |
| 51 | +#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */ | |
| 52 | +#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */ | |
| 53 | +#define ATM_L3_USER 0x10 /* user-specified */ | |
| 54 | +/* END_L3 */ | |
| 55 | + | |
| 56 | + | |
| 57 | +/* | |
| 58 | + * High layer identifiers | |
| 59 | + */ | |
| 60 | + | |
| 61 | +/* BEGIN_HL */ | |
| 62 | +#define ATM_HL_NONE 0 /* HL not specified */ | |
| 63 | +#define ATM_HL_ISO 0x01 /* ISO */ | |
| 64 | +#define ATM_HL_USER 0x02 /* user-specific */ | |
| 65 | +#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */ | |
| 66 | +#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */ | |
| 67 | +/* END_HL */ | |
| 68 | + | |
| 69 | + | |
| 70 | +/* | |
| 71 | + * ITU-T coded mode of operation | |
| 72 | + */ | |
| 73 | + | |
| 74 | +/* BEGIN_IMD */ | |
| 75 | +#define ATM_IMD_NONE 0 /* mode not specified */ | |
| 76 | +#define ATM_IMD_NORMAL 1 /* normal mode of operation */ | |
| 77 | +#define ATM_IMD_EXTENDED 2 /* extended mode of operation */ | |
| 78 | +/* END_IMD */ | |
| 79 | + | |
| 80 | +/* | |
| 81 | + * H.310 code points | |
| 82 | + */ | |
| 83 | + | |
| 84 | +#define ATM_TT_NONE 0 /* terminal type not specified */ | |
| 85 | +#define ATM_TT_RX 1 /* receive only */ | |
| 86 | +#define ATM_TT_TX 2 /* send only */ | |
| 87 | +#define ATM_TT_RXTX 3 /* receive and send */ | |
| 88 | + | |
| 89 | +#define ATM_MC_NONE 0 /* no multiplexing */ | |
| 90 | +#define ATM_MC_TS 1 /* transport stream (TS) */ | |
| 91 | +#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */ | |
| 92 | +#define ATM_MC_PS 3 /* program stream (PS) */ | |
| 93 | +#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */ | |
| 94 | +#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */ | |
| 95 | + | |
| 96 | +/* | |
| 97 | + * SAP structures | |
| 98 | + */ | |
| 99 | + | |
| 100 | +#define ATM_MAX_HLI 8 /* maximum high-layer information length */ | |
| 101 | + | |
| 102 | + | |
| 103 | +struct atm_blli { | |
| 104 | + unsigned char l2_proto; /* layer 2 protocol */ | |
| 105 | + union { | |
| 106 | + struct { | |
| 107 | + unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ | |
| 108 | + /* absent */ | |
| 109 | + unsigned char window; /* window size (k), 1-127 (0 to omit) */ | |
| 110 | + } itu; /* ITU-T encoding */ | |
| 111 | + unsigned char user; /* user-specified l2 information */ | |
| 112 | + } l2; | |
| 113 | + unsigned char l3_proto; /* layer 3 protocol */ | |
| 114 | + union { | |
| 115 | + struct { | |
| 116 | + unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */ | |
| 117 | + /* absent */ | |
| 118 | + unsigned char def_size; /* default packet size (log2), 4-12 (0 to */ | |
| 119 | + /* omit) */ | |
| 120 | + unsigned char window;/* packet window size, 1-127 (0 to omit) */ | |
| 121 | + } itu; /* ITU-T encoding */ | |
| 122 | + unsigned char user; /* user specified l3 information */ | |
| 123 | + struct { /* if l3_proto = ATM_L3_H310 */ | |
| 124 | + unsigned char term_type; /* terminal type */ | |
| 125 | + unsigned char fw_mpx_cap; /* forward multiplexing capability */ | |
| 126 | + /* only if term_type != ATM_TT_NONE */ | |
| 127 | + unsigned char bw_mpx_cap; /* backward multiplexing capability */ | |
| 128 | + /* only if term_type != ATM_TT_NONE */ | |
| 129 | + } h310; | |
| 130 | + struct { /* if l3_proto = ATM_L3_TR9577 */ | |
| 131 | + unsigned char ipi; /* initial protocol id */ | |
| 132 | + unsigned char snap[5];/* IEEE 802.1 SNAP identifier */ | |
| 133 | + /* (only if ipi == NLPID_IEEE802_1_SNAP) */ | |
| 134 | + } tr9577; | |
| 135 | + } l3; | |
| 136 | +} __ATM_API_ALIGN; | |
| 137 | + | |
| 138 | + | |
| 139 | +struct atm_bhli { | |
| 140 | + unsigned char hl_type; /* high layer information type */ | |
| 141 | + unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */ | |
| 142 | + /* hl_type == ATM_HL_ISO) */ | |
| 143 | + unsigned char hl_info[ATM_MAX_HLI];/* high layer information */ | |
| 144 | +}; | |
| 145 | + | |
| 146 | + | |
| 147 | +#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */ | |
| 148 | + | |
| 149 | + | |
| 150 | +struct atm_sap { | |
| 151 | + struct atm_bhli bhli; /* local SAP, high-layer information */ | |
| 152 | + struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; | |
| 153 | + /* local SAP, low-layer info */ | |
| 154 | +}; | |
| 155 | + | |
| 156 | + | |
| 157 | +static __inline__ int blli_in_use(struct atm_blli blli) | |
| 158 | +{ | |
| 159 | + return blli.l2_proto || blli.l3_proto; | |
| 160 | +} | |
| 161 | + | |
| 162 | +#endif | |
| @@ -0,0 +1,55 @@ | ||
| 1 | +/* atmsvc.h - ATM signaling kernel-demon interface definitions */ | |
| 2 | + | |
| 3 | +/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | |
| 4 | + | |
| 5 | + | |
| 6 | +#ifndef _LINUX_ATMSVC_H | |
| 7 | +#define _LINUX_ATMSVC_H | |
| 8 | + | |
| 9 | +#include <linux/atmapi.h> | |
| 10 | +#include <linux/atm.h> | |
| 11 | +#include <linux/atmioc.h> | |
| 12 | + | |
| 13 | + | |
| 14 | +#define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL) | |
| 15 | + /* become ATM signaling demon control socket */ | |
| 16 | + | |
| 17 | +enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject, | |
| 18 | + as_listen, as_okay, as_error, as_indicate, as_close, | |
| 19 | + as_itf_notify, as_modify, as_identify, as_terminate, | |
| 20 | + as_addparty, as_dropparty }; | |
| 21 | + | |
| 22 | +struct atmsvc_msg { | |
| 23 | + enum atmsvc_msg_type type; | |
| 24 | + atm_kptr_t vcc; | |
| 25 | + atm_kptr_t listen_vcc; /* indicate */ | |
| 26 | + int reply; /* for okay and close: */ | |
| 27 | + /* < 0: error before active */ | |
| 28 | + /* (sigd has discarded ctx) */ | |
| 29 | + /* ==0: success */ | |
| 30 | + /* > 0: error when active (still */ | |
| 31 | + /* need to close) */ | |
| 32 | + struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */ | |
| 33 | + struct sockaddr_atmsvc local; /* local SVC address */ | |
| 34 | + struct atm_qos qos; /* QOS parameters */ | |
| 35 | + struct atm_sap sap; /* SAP */ | |
| 36 | + unsigned int session; /* for p2pm */ | |
| 37 | + struct sockaddr_atmsvc svc; /* SVC address */ | |
| 38 | +} __ATM_API_ALIGN; | |
| 39 | + | |
| 40 | +/* | |
| 41 | + * Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz | |
| 42 | + */ | |
| 43 | + | |
| 44 | +/* | |
| 45 | + * Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on | |
| 46 | + * what PCR is used to request bandwidth from the device driver. net/atm/svc.c | |
| 47 | + * tries to do better than that, but only if there's no routing decision (i.e. | |
| 48 | + * if signaling only uses one ATM interface). | |
| 49 | + */ | |
| 50 | + | |
| 51 | +#define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \ | |
| 52 | + (tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \ | |
| 53 | + (tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR) | |
| 54 | + | |
| 55 | +#endif | |
| @@ -0,0 +1,404 @@ | ||
| 1 | +/* audit.h -- Auditing support | |
| 2 | + * | |
| 3 | + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. | |
| 4 | + * All Rights Reserved. | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or modify | |
| 7 | + * it under the terms of the GNU General Public License as published by | |
| 8 | + * the Free Software Foundation; either version 2 of the License, or | |
| 9 | + * (at your option) any later version. | |
| 10 | + * | |
| 11 | + * This program is distributed in the hope that it will be useful, | |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | + * GNU General Public License for more details. | |
| 15 | + * | |
| 16 | + * You should have received a copy of the GNU General Public License | |
| 17 | + * along with this program; if not, write to the Free Software | |
| 18 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | + * | |
| 20 | + * Written by Rickard E. (Rik) Faith <faith@redhat.com> | |
| 21 | + * | |
| 22 | + */ | |
| 23 | + | |
| 24 | +#ifndef _UAPI_LINUX_AUDIT_H_ | |
| 25 | +#define _UAPI_LINUX_AUDIT_H_ | |
| 26 | + | |
| 27 | +#include <linux/types.h> | |
| 28 | +#include <linux/elf-em.h> | |
| 29 | +#include <linux/ptrace.h> | |
| 30 | + | |
| 31 | +/* The netlink messages for the audit system is divided into blocks: | |
| 32 | + * 1000 - 1099 are for commanding the audit system | |
| 33 | + * 1100 - 1199 user space trusted application messages | |
| 34 | + * 1200 - 1299 messages internal to the audit daemon | |
| 35 | + * 1300 - 1399 audit event messages | |
| 36 | + * 1400 - 1499 SE Linux use | |
| 37 | + * 1500 - 1599 kernel LSPP events | |
| 38 | + * 1600 - 1699 kernel crypto events | |
| 39 | + * 1700 - 1799 kernel anomaly records | |
| 40 | + * 1800 - 1899 kernel integrity events | |
| 41 | + * 1900 - 1999 future kernel use | |
| 42 | + * 2000 is for otherwise unclassified kernel audit messages (legacy) | |
| 43 | + * 2001 - 2099 unused (kernel) | |
| 44 | + * 2100 - 2199 user space anomaly records | |
| 45 | + * 2200 - 2299 user space actions taken in response to anomalies | |
| 46 | + * 2300 - 2399 user space generated LSPP events | |
| 47 | + * 2400 - 2499 user space crypto events | |
| 48 | + * 2500 - 2999 future user space (maybe integrity labels and related events) | |
| 49 | + * | |
| 50 | + * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are | |
| 51 | + * exclusively user space. 1300-2099 is kernel --> user space | |
| 52 | + * communication. | |
| 53 | + */ | |
| 54 | +#define AUDIT_GET 1000 /* Get status */ | |
| 55 | +#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ | |
| 56 | +#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */ | |
| 57 | +#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */ | |
| 58 | +#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */ | |
| 59 | +#define AUDIT_USER 1005 /* Message from userspace -- deprecated */ | |
| 60 | +#define AUDIT_LOGIN 1006 /* Define the login id and information */ | |
| 61 | +#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ | |
| 62 | +#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ | |
| 63 | +#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ | |
| 64 | +#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ | |
| 65 | +#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ | |
| 66 | +#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ | |
| 67 | +#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ | |
| 68 | +#define AUDIT_TRIM 1014 /* Trim junk from watched tree */ | |
| 69 | +#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */ | |
| 70 | +#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */ | |
| 71 | +#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ | |
| 72 | + | |
| 73 | +#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ | |
| 74 | +#define AUDIT_USER_AVC 1107 /* We filter this differently */ | |
| 75 | +#define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */ | |
| 76 | +#define AUDIT_LAST_USER_MSG 1199 | |
| 77 | +#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */ | |
| 78 | +#define AUDIT_LAST_USER_MSG2 2999 | |
| 79 | + | |
| 80 | +#define AUDIT_DAEMON_START 1200 /* Daemon startup record */ | |
| 81 | +#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ | |
| 82 | +#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */ | |
| 83 | +#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */ | |
| 84 | + | |
| 85 | +#define AUDIT_SYSCALL 1300 /* Syscall event */ | |
| 86 | +/* #define AUDIT_FS_WATCH 1301 * Deprecated */ | |
| 87 | +#define AUDIT_PATH 1302 /* Filename path information */ | |
| 88 | +#define AUDIT_IPC 1303 /* IPC record */ | |
| 89 | +#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */ | |
| 90 | +#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */ | |
| 91 | +#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */ | |
| 92 | +#define AUDIT_CWD 1307 /* Current working directory */ | |
| 93 | +#define AUDIT_EXECVE 1309 /* execve arguments */ | |
| 94 | +#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */ | |
| 95 | +#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */ | |
| 96 | +#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */ | |
| 97 | +#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ | |
| 98 | +#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ | |
| 99 | +#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */ | |
| 100 | +#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ | |
| 101 | +#define AUDIT_OBJ_PID 1318 /* ptrace target */ | |
| 102 | +#define AUDIT_TTY 1319 /* Input on an administrative TTY */ | |
| 103 | +#define AUDIT_EOE 1320 /* End of multi-record event */ | |
| 104 | +#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ | |
| 105 | +#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ | |
| 106 | +#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ | |
| 107 | +#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ | |
| 108 | +#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ | |
| 109 | + | |
| 110 | +#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ | |
| 111 | +#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ | |
| 112 | +#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ | |
| 113 | +#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ | |
| 114 | +#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ | |
| 115 | +#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ | |
| 116 | +#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */ | |
| 117 | +#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */ | |
| 118 | +#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ | |
| 119 | +#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ | |
| 120 | +#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ | |
| 121 | +#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */ | |
| 122 | +#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */ | |
| 123 | +#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ | |
| 124 | +#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ | |
| 125 | +#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ | |
| 126 | +#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */ | |
| 127 | +#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */ | |
| 128 | + | |
| 129 | +#define AUDIT_FIRST_KERN_ANOM_MSG 1700 | |
| 130 | +#define AUDIT_LAST_KERN_ANOM_MSG 1799 | |
| 131 | +#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */ | |
| 132 | +#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */ | |
| 133 | +#define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */ | |
| 134 | +#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */ | |
| 135 | +#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */ | |
| 136 | +#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */ | |
| 137 | +#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */ | |
| 138 | +#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */ | |
| 139 | +#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */ | |
| 140 | + | |
| 141 | +#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ | |
| 142 | + | |
| 143 | +/* Rule flags */ | |
| 144 | +#define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */ | |
| 145 | +#define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */ | |
| 146 | +#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ | |
| 147 | +#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ | |
| 148 | +#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ | |
| 149 | +#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */ | |
| 150 | + | |
| 151 | +#define AUDIT_NR_FILTERS 6 | |
| 152 | + | |
| 153 | +#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */ | |
| 154 | + | |
| 155 | +/* Rule actions */ | |
| 156 | +#define AUDIT_NEVER 0 /* Do not build context if rule matches */ | |
| 157 | +#define AUDIT_POSSIBLE 1 /* Build context if rule matches */ | |
| 158 | +#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */ | |
| 159 | + | |
| 160 | +/* Rule structure sizes -- if these change, different AUDIT_ADD and | |
| 161 | + * AUDIT_LIST commands must be implemented. */ | |
| 162 | +#define AUDIT_MAX_FIELDS 64 | |
| 163 | +#define AUDIT_MAX_KEY_LEN 256 | |
| 164 | +#define AUDIT_BITMASK_SIZE 64 | |
| 165 | +#define AUDIT_WORD(nr) ((__u32)((nr)/32)) | |
| 166 | +#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) | |
| 167 | + | |
| 168 | +#define AUDIT_SYSCALL_CLASSES 16 | |
| 169 | +#define AUDIT_CLASS_DIR_WRITE 0 | |
| 170 | +#define AUDIT_CLASS_DIR_WRITE_32 1 | |
| 171 | +#define AUDIT_CLASS_CHATTR 2 | |
| 172 | +#define AUDIT_CLASS_CHATTR_32 3 | |
| 173 | +#define AUDIT_CLASS_READ 4 | |
| 174 | +#define AUDIT_CLASS_READ_32 5 | |
| 175 | +#define AUDIT_CLASS_WRITE 6 | |
| 176 | +#define AUDIT_CLASS_WRITE_32 7 | |
| 177 | +#define AUDIT_CLASS_SIGNAL 8 | |
| 178 | +#define AUDIT_CLASS_SIGNAL_32 9 | |
| 179 | + | |
| 180 | +/* This bitmask is used to validate user input. It represents all bits that | |
| 181 | + * are currently used in an audit field constant understood by the kernel. | |
| 182 | + * If you are adding a new #define AUDIT_<whatever>, please ensure that | |
| 183 | + * AUDIT_UNUSED_BITS is updated if need be. */ | |
| 184 | +#define AUDIT_UNUSED_BITS 0x07FFFC00 | |
| 185 | + | |
| 186 | +/* AUDIT_FIELD_COMPARE rule list */ | |
| 187 | +#define AUDIT_COMPARE_UID_TO_OBJ_UID 1 | |
| 188 | +#define AUDIT_COMPARE_GID_TO_OBJ_GID 2 | |
| 189 | +#define AUDIT_COMPARE_EUID_TO_OBJ_UID 3 | |
| 190 | +#define AUDIT_COMPARE_EGID_TO_OBJ_GID 4 | |
| 191 | +#define AUDIT_COMPARE_AUID_TO_OBJ_UID 5 | |
| 192 | +#define AUDIT_COMPARE_SUID_TO_OBJ_UID 6 | |
| 193 | +#define AUDIT_COMPARE_SGID_TO_OBJ_GID 7 | |
| 194 | +#define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8 | |
| 195 | +#define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9 | |
| 196 | + | |
| 197 | +#define AUDIT_COMPARE_UID_TO_AUID 10 | |
| 198 | +#define AUDIT_COMPARE_UID_TO_EUID 11 | |
| 199 | +#define AUDIT_COMPARE_UID_TO_FSUID 12 | |
| 200 | +#define AUDIT_COMPARE_UID_TO_SUID 13 | |
| 201 | + | |
| 202 | +#define AUDIT_COMPARE_AUID_TO_FSUID 14 | |
| 203 | +#define AUDIT_COMPARE_AUID_TO_SUID 15 | |
| 204 | +#define AUDIT_COMPARE_AUID_TO_EUID 16 | |
| 205 | + | |
| 206 | +#define AUDIT_COMPARE_EUID_TO_SUID 17 | |
| 207 | +#define AUDIT_COMPARE_EUID_TO_FSUID 18 | |
| 208 | + | |
| 209 | +#define AUDIT_COMPARE_SUID_TO_FSUID 19 | |
| 210 | + | |
| 211 | +#define AUDIT_COMPARE_GID_TO_EGID 20 | |
| 212 | +#define AUDIT_COMPARE_GID_TO_FSGID 21 | |
| 213 | +#define AUDIT_COMPARE_GID_TO_SGID 22 | |
| 214 | + | |
| 215 | +#define AUDIT_COMPARE_EGID_TO_FSGID 23 | |
| 216 | +#define AUDIT_COMPARE_EGID_TO_SGID 24 | |
| 217 | +#define AUDIT_COMPARE_SGID_TO_FSGID 25 | |
| 218 | + | |
| 219 | +#define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID | |
| 220 | + | |
| 221 | +/* Rule fields */ | |
| 222 | + /* These are useful when checking the | |
| 223 | + * task structure at task creation time | |
| 224 | + * (AUDIT_PER_TASK). */ | |
| 225 | +#define AUDIT_PID 0 | |
| 226 | +#define AUDIT_UID 1 | |
| 227 | +#define AUDIT_EUID 2 | |
| 228 | +#define AUDIT_SUID 3 | |
| 229 | +#define AUDIT_FSUID 4 | |
| 230 | +#define AUDIT_GID 5 | |
| 231 | +#define AUDIT_EGID 6 | |
| 232 | +#define AUDIT_SGID 7 | |
| 233 | +#define AUDIT_FSGID 8 | |
| 234 | +#define AUDIT_LOGINUID 9 | |
| 235 | +#define AUDIT_PERS 10 | |
| 236 | +#define AUDIT_ARCH 11 | |
| 237 | +#define AUDIT_MSGTYPE 12 | |
| 238 | +#define AUDIT_SUBJ_USER 13 /* security label user */ | |
| 239 | +#define AUDIT_SUBJ_ROLE 14 /* security label role */ | |
| 240 | +#define AUDIT_SUBJ_TYPE 15 /* security label type */ | |
| 241 | +#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */ | |
| 242 | +#define AUDIT_SUBJ_CLR 17 /* security label clearance label */ | |
| 243 | +#define AUDIT_PPID 18 | |
| 244 | +#define AUDIT_OBJ_USER 19 | |
| 245 | +#define AUDIT_OBJ_ROLE 20 | |
| 246 | +#define AUDIT_OBJ_TYPE 21 | |
| 247 | +#define AUDIT_OBJ_LEV_LOW 22 | |
| 248 | +#define AUDIT_OBJ_LEV_HIGH 23 | |
| 249 | + | |
| 250 | + /* These are ONLY useful when checking | |
| 251 | + * at syscall exit time (AUDIT_AT_EXIT). */ | |
| 252 | +#define AUDIT_DEVMAJOR 100 | |
| 253 | +#define AUDIT_DEVMINOR 101 | |
| 254 | +#define AUDIT_INODE 102 | |
| 255 | +#define AUDIT_EXIT 103 | |
| 256 | +#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ | |
| 257 | +#define AUDIT_WATCH 105 | |
| 258 | +#define AUDIT_PERM 106 | |
| 259 | +#define AUDIT_DIR 107 | |
| 260 | +#define AUDIT_FILETYPE 108 | |
| 261 | +#define AUDIT_OBJ_UID 109 | |
| 262 | +#define AUDIT_OBJ_GID 110 | |
| 263 | +#define AUDIT_FIELD_COMPARE 111 | |
| 264 | + | |
| 265 | +#define AUDIT_ARG0 200 | |
| 266 | +#define AUDIT_ARG1 (AUDIT_ARG0+1) | |
| 267 | +#define AUDIT_ARG2 (AUDIT_ARG0+2) | |
| 268 | +#define AUDIT_ARG3 (AUDIT_ARG0+3) | |
| 269 | + | |
| 270 | +#define AUDIT_FILTERKEY 210 | |
| 271 | + | |
| 272 | +#define AUDIT_NEGATE 0x80000000 | |
| 273 | + | |
| 274 | +/* These are the supported operators. | |
| 275 | + * 4 2 1 8 | |
| 276 | + * = > < ? | |
| 277 | + * ---------- | |
| 278 | + * 0 0 0 0 00 nonsense | |
| 279 | + * 0 0 0 1 08 & bit mask | |
| 280 | + * 0 0 1 0 10 < | |
| 281 | + * 0 1 0 0 20 > | |
| 282 | + * 0 1 1 0 30 != | |
| 283 | + * 1 0 0 0 40 = | |
| 284 | + * 1 0 0 1 48 &= bit test | |
| 285 | + * 1 0 1 0 50 <= | |
| 286 | + * 1 1 0 0 60 >= | |
| 287 | + * 1 1 1 1 78 all operators | |
| 288 | + */ | |
| 289 | +#define AUDIT_BIT_MASK 0x08000000 | |
| 290 | +#define AUDIT_LESS_THAN 0x10000000 | |
| 291 | +#define AUDIT_GREATER_THAN 0x20000000 | |
| 292 | +#define AUDIT_NOT_EQUAL 0x30000000 | |
| 293 | +#define AUDIT_EQUAL 0x40000000 | |
| 294 | +#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL) | |
| 295 | +#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL) | |
| 296 | +#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) | |
| 297 | +#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) | |
| 298 | + | |
| 299 | +enum { | |
| 300 | + Audit_equal, | |
| 301 | + Audit_not_equal, | |
| 302 | + Audit_bitmask, | |
| 303 | + Audit_bittest, | |
| 304 | + Audit_lt, | |
| 305 | + Audit_gt, | |
| 306 | + Audit_le, | |
| 307 | + Audit_ge, | |
| 308 | + Audit_bad | |
| 309 | +}; | |
| 310 | + | |
| 311 | +/* Status symbols */ | |
| 312 | + /* Mask values */ | |
| 313 | +#define AUDIT_STATUS_ENABLED 0x0001 | |
| 314 | +#define AUDIT_STATUS_FAILURE 0x0002 | |
| 315 | +#define AUDIT_STATUS_PID 0x0004 | |
| 316 | +#define AUDIT_STATUS_RATE_LIMIT 0x0008 | |
| 317 | +#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010 | |
| 318 | + /* Failure-to-log actions */ | |
| 319 | +#define AUDIT_FAIL_SILENT 0 | |
| 320 | +#define AUDIT_FAIL_PRINTK 1 | |
| 321 | +#define AUDIT_FAIL_PANIC 2 | |
| 322 | + | |
| 323 | +/* distinguish syscall tables */ | |
| 324 | +#define __AUDIT_ARCH_64BIT 0x80000000 | |
| 325 | +#define __AUDIT_ARCH_LE 0x40000000 | |
| 326 | +#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | |
| 327 | +#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE) | |
| 328 | +#define AUDIT_ARCH_ARMEB (EM_ARM) | |
| 329 | +#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) | |
| 330 | +#define AUDIT_ARCH_FRV (EM_FRV) | |
| 331 | +#define AUDIT_ARCH_H8300 (EM_H8_300) | |
| 332 | +#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) | |
| 333 | +#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | |
| 334 | +#define AUDIT_ARCH_M32R (EM_M32R) | |
| 335 | +#define AUDIT_ARCH_M68K (EM_68K) | |
| 336 | +#define AUDIT_ARCH_MIPS (EM_MIPS) | |
| 337 | +#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) | |
| 338 | +#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) | |
| 339 | +#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | |
| 340 | +#define AUDIT_ARCH_OPENRISC (EM_OPENRISC) | |
| 341 | +#define AUDIT_ARCH_PARISC (EM_PARISC) | |
| 342 | +#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT) | |
| 343 | +#define AUDIT_ARCH_PPC (EM_PPC) | |
| 344 | +#define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) | |
| 345 | +#define AUDIT_ARCH_S390 (EM_S390) | |
| 346 | +#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) | |
| 347 | +#define AUDIT_ARCH_SH (EM_SH) | |
| 348 | +#define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE) | |
| 349 | +#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT) | |
| 350 | +#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | |
| 351 | +#define AUDIT_ARCH_SPARC (EM_SPARC) | |
| 352 | +#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT) | |
| 353 | +#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | |
| 354 | + | |
| 355 | +#define AUDIT_PERM_EXEC 1 | |
| 356 | +#define AUDIT_PERM_WRITE 2 | |
| 357 | +#define AUDIT_PERM_READ 4 | |
| 358 | +#define AUDIT_PERM_ATTR 8 | |
| 359 | + | |
| 360 | +struct audit_status { | |
| 361 | + __u32 mask; /* Bit mask for valid entries */ | |
| 362 | + __u32 enabled; /* 1 = enabled, 0 = disabled */ | |
| 363 | + __u32 failure; /* Failure-to-log action */ | |
| 364 | + __u32 pid; /* pid of auditd process */ | |
| 365 | + __u32 rate_limit; /* messages rate limit (per second) */ | |
| 366 | + __u32 backlog_limit; /* waiting messages limit */ | |
| 367 | + __u32 lost; /* messages lost */ | |
| 368 | + __u32 backlog; /* messages waiting in queue */ | |
| 369 | +}; | |
| 370 | + | |
| 371 | +struct audit_tty_status { | |
| 372 | + __u32 enabled; /* 1 = enabled, 0 = disabled */ | |
| 373 | +}; | |
| 374 | + | |
| 375 | +/* audit_rule_data supports filter rules with both integer and string | |
| 376 | + * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and | |
| 377 | + * AUDIT_LIST_RULES requests. | |
| 378 | + */ | |
| 379 | +struct audit_rule_data { | |
| 380 | + __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ | |
| 381 | + __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ | |
| 382 | + __u32 field_count; | |
| 383 | + __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */ | |
| 384 | + __u32 fields[AUDIT_MAX_FIELDS]; | |
| 385 | + __u32 values[AUDIT_MAX_FIELDS]; | |
| 386 | + __u32 fieldflags[AUDIT_MAX_FIELDS]; | |
| 387 | + __u32 buflen; /* total length of string fields */ | |
| 388 | + char buf[0]; /* string fields buffer */ | |
| 389 | +}; | |
| 390 | + | |
| 391 | +/* audit_rule is supported to maintain backward compatibility with | |
| 392 | + * userspace. It supports integer fields only and corresponds to | |
| 393 | + * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests. | |
| 394 | + */ | |
| 395 | +struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ | |
| 396 | + __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ | |
| 397 | + __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ | |
| 398 | + __u32 field_count; | |
| 399 | + __u32 mask[AUDIT_BITMASK_SIZE]; | |
| 400 | + __u32 fields[AUDIT_MAX_FIELDS]; | |
| 401 | + __u32 values[AUDIT_MAX_FIELDS]; | |
| 402 | +}; | |
| 403 | + | |
| 404 | +#endif /* _UAPI_LINUX_AUDIT_H_ */ | |
| @@ -0,0 +1,83 @@ | ||
| 1 | +/* -*- linux-c -*- ------------------------------------------------------- * | |
| 2 | + * | |
| 3 | + * linux/include/linux/auto_fs.h | |
| 4 | + * | |
| 5 | + * Copyright 1997 Transmeta Corporation - All Rights Reserved | |
| 6 | + * | |
| 7 | + * This file is part of the Linux kernel and is made available under | |
| 8 | + * the terms of the GNU General Public License, version 2, or at your | |
| 9 | + * option, any later version, incorporated herein by reference. | |
| 10 | + * | |
| 11 | + * ----------------------------------------------------------------------- */ | |
| 12 | + | |
| 13 | + | |
| 14 | +#ifndef _UAPI_LINUX_AUTO_FS_H | |
| 15 | +#define _UAPI_LINUX_AUTO_FS_H | |
| 16 | + | |
| 17 | +#include <linux/types.h> | |
| 18 | +#ifndef __KERNEL__ | |
| 19 | +#include <sys/ioctl.h> | |
| 20 | +#endif /* __KERNEL__ */ | |
| 21 | + | |
| 22 | + | |
| 23 | +/* This file describes autofs v3 */ | |
| 24 | +#define AUTOFS_PROTO_VERSION 3 | |
| 25 | + | |
| 26 | +/* Range of protocol versions defined */ | |
| 27 | +#define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION | |
| 28 | +#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION | |
| 29 | + | |
| 30 | +/* | |
| 31 | + * Architectures where both 32- and 64-bit binaries can be executed | |
| 32 | + * on 64-bit kernels need this. This keeps the structure format | |
| 33 | + * uniform, and makes sure the wait_queue_token isn't too big to be | |
| 34 | + * passed back down to the kernel. | |
| 35 | + * | |
| 36 | + * This assumes that on these architectures: | |
| 37 | + * mode 32 bit 64 bit | |
| 38 | + * ------------------------- | |
| 39 | + * int 32 bit 32 bit | |
| 40 | + * long 32 bit 64 bit | |
| 41 | + * | |
| 42 | + * If so, 32-bit user-space code should be backwards compatible. | |
| 43 | + */ | |
| 44 | + | |
| 45 | +#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \ | |
| 46 | + || defined(__powerpc__) || defined(__s390__) | |
| 47 | +typedef unsigned int autofs_wqt_t; | |
| 48 | +#else | |
| 49 | +typedef unsigned long autofs_wqt_t; | |
| 50 | +#endif | |
| 51 | + | |
| 52 | +/* Packet types */ | |
| 53 | +#define autofs_ptype_missing 0 /* Missing entry (mount request) */ | |
| 54 | +#define autofs_ptype_expire 1 /* Expire entry (umount request) */ | |
| 55 | + | |
| 56 | +struct autofs_packet_hdr { | |
| 57 | + int proto_version; /* Protocol version */ | |
| 58 | + int type; /* Type of packet */ | |
| 59 | +}; | |
| 60 | + | |
| 61 | +struct autofs_packet_missing { | |
| 62 | + struct autofs_packet_hdr hdr; | |
| 63 | + autofs_wqt_t wait_queue_token; | |
| 64 | + int len; | |
| 65 | + char name[NAME_MAX+1]; | |
| 66 | +}; | |
| 67 | + | |
| 68 | +/* v3 expire (via ioctl) */ | |
| 69 | +struct autofs_packet_expire { | |
| 70 | + struct autofs_packet_hdr hdr; | |
| 71 | + int len; | |
| 72 | + char name[NAME_MAX+1]; | |
| 73 | +}; | |
| 74 | + | |
| 75 | +#define AUTOFS_IOC_READY _IO(0x93,0x60) | |
| 76 | +#define AUTOFS_IOC_FAIL _IO(0x93,0x61) | |
| 77 | +#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) | |
| 78 | +#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) | |
| 79 | +#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t) | |
| 80 | +#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) | |
| 81 | +#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) | |
| 82 | + | |
| 83 | +#endif /* _UAPI_LINUX_AUTO_FS_H */ | |
| @@ -0,0 +1,164 @@ | ||
| 1 | +/* -*- c -*- | |
| 2 | + * linux/include/linux/auto_fs4.h | |
| 3 | + * | |
| 4 | + * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> | |
| 5 | + * | |
| 6 | + * This file is part of the Linux kernel and is made available under | |
| 7 | + * the terms of the GNU General Public License, version 2, or at your | |
| 8 | + * option, any later version, incorporated herein by reference. | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#ifndef _LINUX_AUTO_FS4_H | |
| 12 | +#define _LINUX_AUTO_FS4_H | |
| 13 | + | |
| 14 | +/* Include common v3 definitions */ | |
| 15 | +#include <linux/types.h> | |
| 16 | +#include <linux/auto_fs.h> | |
| 17 | + | |
| 18 | +/* autofs v4 definitions */ | |
| 19 | +#undef AUTOFS_PROTO_VERSION | |
| 20 | +#undef AUTOFS_MIN_PROTO_VERSION | |
| 21 | +#undef AUTOFS_MAX_PROTO_VERSION | |
| 22 | + | |
| 23 | +#define AUTOFS_PROTO_VERSION 5 | |
| 24 | +#define AUTOFS_MIN_PROTO_VERSION 3 | |
| 25 | +#define AUTOFS_MAX_PROTO_VERSION 5 | |
| 26 | + | |
| 27 | +#define AUTOFS_PROTO_SUBVERSION 2 | |
| 28 | + | |
| 29 | +/* Mask for expire behaviour */ | |
| 30 | +#define AUTOFS_EXP_IMMEDIATE 1 | |
| 31 | +#define AUTOFS_EXP_LEAVES 2 | |
| 32 | + | |
| 33 | +#define AUTOFS_TYPE_ANY 0U | |
| 34 | +#define AUTOFS_TYPE_INDIRECT 1U | |
| 35 | +#define AUTOFS_TYPE_DIRECT 2U | |
| 36 | +#define AUTOFS_TYPE_OFFSET 4U | |
| 37 | + | |
| 38 | +static inline void set_autofs_type_indirect(unsigned int *type) | |
| 39 | +{ | |
| 40 | + *type = AUTOFS_TYPE_INDIRECT; | |
| 41 | + return; | |
| 42 | +} | |
| 43 | + | |
| 44 | +static inline unsigned int autofs_type_indirect(unsigned int type) | |
| 45 | +{ | |
| 46 | + return (type == AUTOFS_TYPE_INDIRECT); | |
| 47 | +} | |
| 48 | + | |
| 49 | +static inline void set_autofs_type_direct(unsigned int *type) | |
| 50 | +{ | |
| 51 | + *type = AUTOFS_TYPE_DIRECT; | |
| 52 | + return; | |
| 53 | +} | |
| 54 | + | |
| 55 | +static inline unsigned int autofs_type_direct(unsigned int type) | |
| 56 | +{ | |
| 57 | + return (type == AUTOFS_TYPE_DIRECT); | |
| 58 | +} | |
| 59 | + | |
| 60 | +static inline void set_autofs_type_offset(unsigned int *type) | |
| 61 | +{ | |
| 62 | + *type = AUTOFS_TYPE_OFFSET; | |
| 63 | + return; | |
| 64 | +} | |
| 65 | + | |
| 66 | +static inline unsigned int autofs_type_offset(unsigned int type) | |
| 67 | +{ | |
| 68 | + return (type == AUTOFS_TYPE_OFFSET); | |
| 69 | +} | |
| 70 | + | |
| 71 | +static inline unsigned int autofs_type_trigger(unsigned int type) | |
| 72 | +{ | |
| 73 | + return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET); | |
| 74 | +} | |
| 75 | + | |
| 76 | +/* | |
| 77 | + * This isn't really a type as we use it to say "no type set" to | |
| 78 | + * indicate we want to search for "any" mount in the | |
| 79 | + * autofs_dev_ioctl_ismountpoint() device ioctl function. | |
| 80 | + */ | |
| 81 | +static inline void set_autofs_type_any(unsigned int *type) | |
| 82 | +{ | |
| 83 | + *type = AUTOFS_TYPE_ANY; | |
| 84 | + return; | |
| 85 | +} | |
| 86 | + | |
| 87 | +static inline unsigned int autofs_type_any(unsigned int type) | |
| 88 | +{ | |
| 89 | + return (type == AUTOFS_TYPE_ANY); | |
| 90 | +} | |
| 91 | + | |
| 92 | +/* Daemon notification packet types */ | |
| 93 | +enum autofs_notify { | |
| 94 | + NFY_NONE, | |
| 95 | + NFY_MOUNT, | |
| 96 | + NFY_EXPIRE | |
| 97 | +}; | |
| 98 | + | |
| 99 | +/* Kernel protocol version 4 packet types */ | |
| 100 | + | |
| 101 | +/* Expire entry (umount request) */ | |
| 102 | +#define autofs_ptype_expire_multi 2 | |
| 103 | + | |
| 104 | +/* Kernel protocol version 5 packet types */ | |
| 105 | + | |
| 106 | +/* Indirect mount missing and expire requests. */ | |
| 107 | +#define autofs_ptype_missing_indirect 3 | |
| 108 | +#define autofs_ptype_expire_indirect 4 | |
| 109 | + | |
| 110 | +/* Direct mount missing and expire requests */ | |
| 111 | +#define autofs_ptype_missing_direct 5 | |
| 112 | +#define autofs_ptype_expire_direct 6 | |
| 113 | + | |
| 114 | +/* v4 multi expire (via pipe) */ | |
| 115 | +struct autofs_packet_expire_multi { | |
| 116 | + struct autofs_packet_hdr hdr; | |
| 117 | + autofs_wqt_t wait_queue_token; | |
| 118 | + int len; | |
| 119 | + char name[NAME_MAX+1]; | |
| 120 | +}; | |
| 121 | + | |
| 122 | +union autofs_packet_union { | |
| 123 | + struct autofs_packet_hdr hdr; | |
| 124 | + struct autofs_packet_missing missing; | |
| 125 | + struct autofs_packet_expire expire; | |
| 126 | + struct autofs_packet_expire_multi expire_multi; | |
| 127 | +}; | |
| 128 | + | |
| 129 | +/* autofs v5 common packet struct */ | |
| 130 | +struct autofs_v5_packet { | |
| 131 | + struct autofs_packet_hdr hdr; | |
| 132 | + autofs_wqt_t wait_queue_token; | |
| 133 | + __u32 dev; | |
| 134 | + __u64 ino; | |
| 135 | + __u32 uid; | |
| 136 | + __u32 gid; | |
| 137 | + __u32 pid; | |
| 138 | + __u32 tgid; | |
| 139 | + __u32 len; | |
| 140 | + char name[NAME_MAX+1]; | |
| 141 | +}; | |
| 142 | + | |
| 143 | +typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; | |
| 144 | +typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; | |
| 145 | +typedef struct autofs_v5_packet autofs_packet_missing_direct_t; | |
| 146 | +typedef struct autofs_v5_packet autofs_packet_expire_direct_t; | |
| 147 | + | |
| 148 | +union autofs_v5_packet_union { | |
| 149 | + struct autofs_packet_hdr hdr; | |
| 150 | + struct autofs_v5_packet v5_packet; | |
| 151 | + autofs_packet_missing_indirect_t missing_indirect; | |
| 152 | + autofs_packet_expire_indirect_t expire_indirect; | |
| 153 | + autofs_packet_missing_direct_t missing_direct; | |
| 154 | + autofs_packet_expire_direct_t expire_direct; | |
| 155 | +}; | |
| 156 | + | |
| 157 | +#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) | |
| 158 | +#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI | |
| 159 | +#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI | |
| 160 | +#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) | |
| 161 | +#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) | |
| 162 | + | |
| 163 | + | |
| 164 | +#endif /* _LINUX_AUTO_FS4_H */ | |
| @@ -0,0 +1,35 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_AUXVEC_H | |
| 2 | +#define _UAPI_LINUX_AUXVEC_H | |
| 3 | + | |
| 4 | +#include <asm/auxvec.h> | |
| 5 | + | |
| 6 | +/* Symbolic values for the entries in the auxiliary table | |
| 7 | + put on the initial stack */ | |
| 8 | +#define AT_NULL 0 /* end of vector */ | |
| 9 | +#define AT_IGNORE 1 /* entry should be ignored */ | |
| 10 | +#define AT_EXECFD 2 /* file descriptor of program */ | |
| 11 | +#define AT_PHDR 3 /* program headers for program */ | |
| 12 | +#define AT_PHENT 4 /* size of program header entry */ | |
| 13 | +#define AT_PHNUM 5 /* number of program headers */ | |
| 14 | +#define AT_PAGESZ 6 /* system page size */ | |
| 15 | +#define AT_BASE 7 /* base address of interpreter */ | |
| 16 | +#define AT_FLAGS 8 /* flags */ | |
| 17 | +#define AT_ENTRY 9 /* entry point of program */ | |
| 18 | +#define AT_NOTELF 10 /* program is not ELF */ | |
| 19 | +#define AT_UID 11 /* real uid */ | |
| 20 | +#define AT_EUID 12 /* effective uid */ | |
| 21 | +#define AT_GID 13 /* real gid */ | |
| 22 | +#define AT_EGID 14 /* effective gid */ | |
| 23 | +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ | |
| 24 | +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ | |
| 25 | +#define AT_CLKTCK 17 /* frequency at which times() increments */ | |
| 26 | +/* AT_* values 18 through 22 are reserved */ | |
| 27 | +#define AT_SECURE 23 /* secure mode boolean */ | |
| 28 | +#define AT_BASE_PLATFORM 24 /* string identifying real platform, may | |
| 29 | + * differ from AT_PLATFORM. */ | |
| 30 | +#define AT_RANDOM 25 /* address of 16 random bytes */ | |
| 31 | + | |
| 32 | +#define AT_EXECFN 31 /* filename of program */ | |
| 33 | + | |
| 34 | + | |
| 35 | +#endif /* _UAPI_LINUX_AUXVEC_H */ | |
| @@ -0,0 +1,116 @@ | ||
| 1 | +/* | |
| 2 | + * These are the public elements of the Linux kernel AX.25 code. A similar | |
| 3 | + * file netrom.h exists for the NET/ROM protocol. | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#ifndef AX25_KERNEL_H | |
| 7 | +#define AX25_KERNEL_H | |
| 8 | + | |
| 9 | +#include <linux/socket.h> | |
| 10 | + | |
| 11 | +#define AX25_MTU 256 | |
| 12 | +#define AX25_MAX_DIGIS 8 | |
| 13 | + | |
| 14 | +#define AX25_WINDOW 1 | |
| 15 | +#define AX25_T1 2 | |
| 16 | +#define AX25_N2 3 | |
| 17 | +#define AX25_T3 4 | |
| 18 | +#define AX25_T2 5 | |
| 19 | +#define AX25_BACKOFF 6 | |
| 20 | +#define AX25_EXTSEQ 7 | |
| 21 | +#define AX25_PIDINCL 8 | |
| 22 | +#define AX25_IDLE 9 | |
| 23 | +#define AX25_PACLEN 10 | |
| 24 | +#define AX25_IAMDIGI 12 | |
| 25 | + | |
| 26 | +#define AX25_KILL 99 | |
| 27 | + | |
| 28 | +#define SIOCAX25GETUID (SIOCPROTOPRIVATE+0) | |
| 29 | +#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) | |
| 30 | +#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) | |
| 31 | +#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) | |
| 32 | +#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7) | |
| 33 | +#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8) | |
| 34 | +#define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9) | |
| 35 | +#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10) | |
| 36 | +#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11) | |
| 37 | +#define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12) | |
| 38 | +#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13) | |
| 39 | + | |
| 40 | +#define AX25_SET_RT_IPMODE 2 | |
| 41 | + | |
| 42 | +#define AX25_NOUID_DEFAULT 0 | |
| 43 | +#define AX25_NOUID_BLOCK 1 | |
| 44 | + | |
| 45 | +typedef struct { | |
| 46 | + char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ | |
| 47 | +} ax25_address; | |
| 48 | + | |
| 49 | +struct sockaddr_ax25 { | |
| 50 | + __kernel_sa_family_t sax25_family; | |
| 51 | + ax25_address sax25_call; | |
| 52 | + int sax25_ndigis; | |
| 53 | + /* Digipeater ax25_address sets follow */ | |
| 54 | +}; | |
| 55 | + | |
| 56 | +#define sax25_uid sax25_ndigis | |
| 57 | + | |
| 58 | +struct full_sockaddr_ax25 { | |
| 59 | + struct sockaddr_ax25 fsa_ax25; | |
| 60 | + ax25_address fsa_digipeater[AX25_MAX_DIGIS]; | |
| 61 | +}; | |
| 62 | + | |
| 63 | +struct ax25_routes_struct { | |
| 64 | + ax25_address port_addr; | |
| 65 | + ax25_address dest_addr; | |
| 66 | + unsigned char digi_count; | |
| 67 | + ax25_address digi_addr[AX25_MAX_DIGIS]; | |
| 68 | +}; | |
| 69 | + | |
| 70 | +struct ax25_route_opt_struct { | |
| 71 | + ax25_address port_addr; | |
| 72 | + ax25_address dest_addr; | |
| 73 | + int cmd; | |
| 74 | + int arg; | |
| 75 | +}; | |
| 76 | + | |
| 77 | +struct ax25_ctl_struct { | |
| 78 | + ax25_address port_addr; | |
| 79 | + ax25_address source_addr; | |
| 80 | + ax25_address dest_addr; | |
| 81 | + unsigned int cmd; | |
| 82 | + unsigned long arg; | |
| 83 | + unsigned char digi_count; | |
| 84 | + ax25_address digi_addr[AX25_MAX_DIGIS]; | |
| 85 | +}; | |
| 86 | + | |
| 87 | +/* this will go away. Please do not export to user land */ | |
| 88 | +struct ax25_info_struct_deprecated { | |
| 89 | + unsigned int n2, n2count; | |
| 90 | + unsigned int t1, t1timer; | |
| 91 | + unsigned int t2, t2timer; | |
| 92 | + unsigned int t3, t3timer; | |
| 93 | + unsigned int idle, idletimer; | |
| 94 | + unsigned int state; | |
| 95 | + unsigned int rcv_q, snd_q; | |
| 96 | +}; | |
| 97 | + | |
| 98 | +struct ax25_info_struct { | |
| 99 | + unsigned int n2, n2count; | |
| 100 | + unsigned int t1, t1timer; | |
| 101 | + unsigned int t2, t2timer; | |
| 102 | + unsigned int t3, t3timer; | |
| 103 | + unsigned int idle, idletimer; | |
| 104 | + unsigned int state; | |
| 105 | + unsigned int rcv_q, snd_q; | |
| 106 | + unsigned int vs, vr, va, vs_max; | |
| 107 | + unsigned int paclen; | |
| 108 | + unsigned int window; | |
| 109 | +}; | |
| 110 | + | |
| 111 | +struct ax25_fwd_struct { | |
| 112 | + ax25_address port_from; | |
| 113 | + ax25_address port_to; | |
| 114 | +}; | |
| 115 | + | |
| 116 | +#endif | |
| @@ -0,0 +1,73 @@ | ||
| 1 | +/* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $ | |
| 2 | + * | |
| 3 | + * ISDN lowlevel-module for AVM B1-card. | |
| 4 | + * | |
| 5 | + * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) | |
| 6 | + * | |
| 7 | + * This software may be used and distributed according to the terms | |
| 8 | + * of the GNU General Public License, incorporated herein by reference. | |
| 9 | + * | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef _B1LLI_H_ | |
| 13 | +#define _B1LLI_H_ | |
| 14 | +/* | |
| 15 | + * struct for loading t4 file | |
| 16 | + */ | |
| 17 | +typedef struct avmb1_t4file { | |
| 18 | + int len; | |
| 19 | + unsigned char *data; | |
| 20 | +} avmb1_t4file; | |
| 21 | + | |
| 22 | +typedef struct avmb1_loaddef { | |
| 23 | + int contr; | |
| 24 | + avmb1_t4file t4file; | |
| 25 | +} avmb1_loaddef; | |
| 26 | + | |
| 27 | +typedef struct avmb1_loadandconfigdef { | |
| 28 | + int contr; | |
| 29 | + avmb1_t4file t4file; | |
| 30 | + avmb1_t4file t4config; | |
| 31 | +} avmb1_loadandconfigdef; | |
| 32 | + | |
| 33 | +typedef struct avmb1_resetdef { | |
| 34 | + int contr; | |
| 35 | +} avmb1_resetdef; | |
| 36 | + | |
| 37 | +typedef struct avmb1_getdef { | |
| 38 | + int contr; | |
| 39 | + int cardtype; | |
| 40 | + int cardstate; | |
| 41 | +} avmb1_getdef; | |
| 42 | + | |
| 43 | +/* | |
| 44 | + * struct for adding new cards | |
| 45 | + */ | |
| 46 | +typedef struct avmb1_carddef { | |
| 47 | + int port; | |
| 48 | + int irq; | |
| 49 | +} avmb1_carddef; | |
| 50 | + | |
| 51 | +#define AVM_CARDTYPE_B1 0 | |
| 52 | +#define AVM_CARDTYPE_T1 1 | |
| 53 | +#define AVM_CARDTYPE_M1 2 | |
| 54 | +#define AVM_CARDTYPE_M2 3 | |
| 55 | + | |
| 56 | +typedef struct avmb1_extcarddef { | |
| 57 | + int port; | |
| 58 | + int irq; | |
| 59 | + int cardtype; | |
| 60 | + int cardnr; /* for HEMA/T1 */ | |
| 61 | +} avmb1_extcarddef; | |
| 62 | + | |
| 63 | +#define AVMB1_LOAD 0 /* load image to card */ | |
| 64 | +#define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */ | |
| 65 | +#define AVMB1_RESETCARD 2 /* reset a card */ | |
| 66 | +#define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */ | |
| 67 | +#define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */ | |
| 68 | +#define AVMB1_GET_CARDINFO 5 /* get cardtype */ | |
| 69 | +#define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */ | |
| 70 | + | |
| 71 | +#define AVMB1_REGISTERCARD_IS_OBSOLETE | |
| 72 | + | |
| 73 | +#endif /* _B1LLI_H_ */ | |
| @@ -0,0 +1,39 @@ | ||
| 1 | +/* | |
| 2 | + * The Linux BAYCOM driver for the Baycom serial 1200 baud modem | |
| 3 | + * and the parallel 9600 baud modem | |
| 4 | + * (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef _BAYCOM_H | |
| 8 | +#define _BAYCOM_H | |
| 9 | + | |
| 10 | +/* -------------------------------------------------------------------- */ | |
| 11 | +/* | |
| 12 | + * structs for the IOCTL commands | |
| 13 | + */ | |
| 14 | + | |
| 15 | +struct baycom_debug_data { | |
| 16 | + unsigned long debug1; | |
| 17 | + unsigned long debug2; | |
| 18 | + long debug3; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +struct baycom_ioctl { | |
| 22 | + int cmd; | |
| 23 | + union { | |
| 24 | + struct baycom_debug_data dbg; | |
| 25 | + } data; | |
| 26 | +}; | |
| 27 | + | |
| 28 | +/* -------------------------------------------------------------------- */ | |
| 29 | + | |
| 30 | +/* | |
| 31 | + * ioctl values change for baycom | |
| 32 | + */ | |
| 33 | +#define BAYCOMCTL_GETDEBUG 0x92 | |
| 34 | + | |
| 35 | +/* -------------------------------------------------------------------- */ | |
| 36 | + | |
| 37 | +#endif /* _BAYCOM_H */ | |
| 38 | + | |
| 39 | +/* --------------------------------------------------------------------- */ | |
| @@ -0,0 +1,81 @@ | ||
| 1 | +/* | |
| 2 | + * include/linux/bfs_fs.h - BFS data structures on disk. | |
| 3 | + * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#ifndef _LINUX_BFS_FS_H | |
| 7 | +#define _LINUX_BFS_FS_H | |
| 8 | + | |
| 9 | +#include <linux/types.h> | |
| 10 | + | |
| 11 | +#define BFS_BSIZE_BITS 9 | |
| 12 | +#define BFS_BSIZE (1<<BFS_BSIZE_BITS) | |
| 13 | + | |
| 14 | +#define BFS_MAGIC 0x1BADFACE | |
| 15 | +#define BFS_ROOT_INO 2 | |
| 16 | +#define BFS_INODES_PER_BLOCK 8 | |
| 17 | + | |
| 18 | +/* SVR4 vnode type values (bfs_inode->i_vtype) */ | |
| 19 | +#define BFS_VDIR 2L | |
| 20 | +#define BFS_VREG 1L | |
| 21 | + | |
| 22 | +/* BFS inode layout on disk */ | |
| 23 | +struct bfs_inode { | |
| 24 | + __le16 i_ino; | |
| 25 | + __u16 i_unused; | |
| 26 | + __le32 i_sblock; | |
| 27 | + __le32 i_eblock; | |
| 28 | + __le32 i_eoffset; | |
| 29 | + __le32 i_vtype; | |
| 30 | + __le32 i_mode; | |
| 31 | + __le32 i_uid; | |
| 32 | + __le32 i_gid; | |
| 33 | + __le32 i_nlink; | |
| 34 | + __le32 i_atime; | |
| 35 | + __le32 i_mtime; | |
| 36 | + __le32 i_ctime; | |
| 37 | + __u32 i_padding[4]; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +#define BFS_NAMELEN 14 | |
| 41 | +#define BFS_DIRENT_SIZE 16 | |
| 42 | +#define BFS_DIRS_PER_BLOCK 32 | |
| 43 | + | |
| 44 | +struct bfs_dirent { | |
| 45 | + __le16 ino; | |
| 46 | + char name[BFS_NAMELEN]; | |
| 47 | +}; | |
| 48 | + | |
| 49 | +/* BFS superblock layout on disk */ | |
| 50 | +struct bfs_super_block { | |
| 51 | + __le32 s_magic; | |
| 52 | + __le32 s_start; | |
| 53 | + __le32 s_end; | |
| 54 | + __le32 s_from; | |
| 55 | + __le32 s_to; | |
| 56 | + __s32 s_bfrom; | |
| 57 | + __s32 s_bto; | |
| 58 | + char s_fsname[6]; | |
| 59 | + char s_volume[6]; | |
| 60 | + __u32 s_padding[118]; | |
| 61 | +}; | |
| 62 | + | |
| 63 | + | |
| 64 | +#define BFS_OFF2INO(offset) \ | |
| 65 | + ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO) | |
| 66 | + | |
| 67 | +#define BFS_INO2OFF(ino) \ | |
| 68 | + ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) | |
| 69 | +#define BFS_NZFILESIZE(ip) \ | |
| 70 | + ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) | |
| 71 | + | |
| 72 | +#define BFS_FILESIZE(ip) \ | |
| 73 | + ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) | |
| 74 | + | |
| 75 | +#define BFS_FILEBLOCKS(ip) \ | |
| 76 | + ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) | |
| 77 | +#define BFS_UNCLEAN(bfs_sb, sb) \ | |
| 78 | + ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) | |
| 79 | + | |
| 80 | + | |
| 81 | +#endif /* _LINUX_BFS_FS_H */ | |
| @@ -0,0 +1,20 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_BINFMTS_H | |
| 2 | +#define _UAPI_LINUX_BINFMTS_H | |
| 3 | + | |
| 4 | +#include <linux/capability.h> | |
| 5 | + | |
| 6 | +struct pt_regs; | |
| 7 | + | |
| 8 | +/* | |
| 9 | + * These are the maximum length and maximum number of strings passed to the | |
| 10 | + * execve() system call. MAX_ARG_STRLEN is essentially random but serves to | |
| 11 | + * prevent the kernel from being unduly impacted by misaddressed pointers. | |
| 12 | + * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer. | |
| 13 | + */ | |
| 14 | +#define MAX_ARG_STRLEN (PAGE_SIZE * 32) | |
| 15 | +#define MAX_ARG_STRINGS 0x7FFFFFFF | |
| 16 | + | |
| 17 | +/* sizeof(linux_binprm->buf) */ | |
| 18 | +#define BINPRM_BUF_SIZE 128 | |
| 19 | + | |
| 20 | +#endif /* _UAPI_LINUX_BINFMTS_H */ | |
| @@ -0,0 +1,59 @@ | ||
| 1 | +#ifndef _LINUX_BLKPG_H | |
| 2 | +#define _LINUX_BLKPG_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Partition table and disk geometry handling | |
| 6 | + * | |
| 7 | + * A single ioctl with lots of subfunctions: | |
| 8 | + * | |
| 9 | + * Device number stuff: | |
| 10 | + * get_whole_disk() (given the device number of a partition, | |
| 11 | + * find the device number of the encompassing disk) | |
| 12 | + * get_all_partitions() (given the device number of a disk, return the | |
| 13 | + * device numbers of all its known partitions) | |
| 14 | + * | |
| 15 | + * Partition stuff: | |
| 16 | + * add_partition() | |
| 17 | + * delete_partition() | |
| 18 | + * test_partition_in_use() (also for test_disk_in_use) | |
| 19 | + * | |
| 20 | + * Geometry stuff: | |
| 21 | + * get_geometry() | |
| 22 | + * set_geometry() | |
| 23 | + * get_bios_drivedata() | |
| 24 | + * | |
| 25 | + * For today, only the partition stuff - aeb, 990515 | |
| 26 | + */ | |
| 27 | +#include <linux/compiler.h> | |
| 28 | +#include <linux/ioctl.h> | |
| 29 | + | |
| 30 | +#define BLKPG _IO(0x12,105) | |
| 31 | + | |
| 32 | +/* The argument structure */ | |
| 33 | +struct blkpg_ioctl_arg { | |
| 34 | + int op; | |
| 35 | + int flags; | |
| 36 | + int datalen; | |
| 37 | + void __user *data; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +/* The subfunctions (for the op field) */ | |
| 41 | +#define BLKPG_ADD_PARTITION 1 | |
| 42 | +#define BLKPG_DEL_PARTITION 2 | |
| 43 | +#define BLKPG_RESIZE_PARTITION 3 | |
| 44 | + | |
| 45 | +/* Sizes of name fields. Unused at present. */ | |
| 46 | +#define BLKPG_DEVNAMELTH 64 | |
| 47 | +#define BLKPG_VOLNAMELTH 64 | |
| 48 | + | |
| 49 | +/* The data structure for ADD_PARTITION and DEL_PARTITION */ | |
| 50 | +struct blkpg_partition { | |
| 51 | + long long start; /* starting offset in bytes */ | |
| 52 | + long long length; /* length in bytes */ | |
| 53 | + int pno; /* partition number */ | |
| 54 | + char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, | |
| 55 | + to be used in kernel messages */ | |
| 56 | + char volname[BLKPG_VOLNAMELTH]; /* volume label */ | |
| 57 | +}; | |
| 58 | + | |
| 59 | +#endif /* _LINUX_BLKPG_H */ | |
| @@ -0,0 +1,142 @@ | ||
| 1 | +#ifndef _UAPIBLKTRACE_H | |
| 2 | +#define _UAPIBLKTRACE_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +/* | |
| 7 | + * Trace categories | |
| 8 | + */ | |
| 9 | +enum blktrace_cat { | |
| 10 | + BLK_TC_READ = 1 << 0, /* reads */ | |
| 11 | + BLK_TC_WRITE = 1 << 1, /* writes */ | |
| 12 | + BLK_TC_FLUSH = 1 << 2, /* flush */ | |
| 13 | + BLK_TC_SYNC = 1 << 3, /* sync IO */ | |
| 14 | + BLK_TC_SYNCIO = BLK_TC_SYNC, | |
| 15 | + BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ | |
| 16 | + BLK_TC_REQUEUE = 1 << 5, /* requeueing */ | |
| 17 | + BLK_TC_ISSUE = 1 << 6, /* issue */ | |
| 18 | + BLK_TC_COMPLETE = 1 << 7, /* completions */ | |
| 19 | + BLK_TC_FS = 1 << 8, /* fs requests */ | |
| 20 | + BLK_TC_PC = 1 << 9, /* pc requests */ | |
| 21 | + BLK_TC_NOTIFY = 1 << 10, /* special message */ | |
| 22 | + BLK_TC_AHEAD = 1 << 11, /* readahead */ | |
| 23 | + BLK_TC_META = 1 << 12, /* metadata */ | |
| 24 | + BLK_TC_DISCARD = 1 << 13, /* discard requests */ | |
| 25 | + BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ | |
| 26 | + BLK_TC_FUA = 1 << 15, /* fua requests */ | |
| 27 | + | |
| 28 | + BLK_TC_END = 1 << 15, /* we've run out of bits! */ | |
| 29 | +}; | |
| 30 | + | |
| 31 | +#define BLK_TC_SHIFT (16) | |
| 32 | +#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT) | |
| 33 | + | |
| 34 | +/* | |
| 35 | + * Basic trace actions | |
| 36 | + */ | |
| 37 | +enum blktrace_act { | |
| 38 | + __BLK_TA_QUEUE = 1, /* queued */ | |
| 39 | + __BLK_TA_BACKMERGE, /* back merged to existing rq */ | |
| 40 | + __BLK_TA_FRONTMERGE, /* front merge to existing rq */ | |
| 41 | + __BLK_TA_GETRQ, /* allocated new request */ | |
| 42 | + __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */ | |
| 43 | + __BLK_TA_REQUEUE, /* request requeued */ | |
| 44 | + __BLK_TA_ISSUE, /* sent to driver */ | |
| 45 | + __BLK_TA_COMPLETE, /* completed by driver */ | |
| 46 | + __BLK_TA_PLUG, /* queue was plugged */ | |
| 47 | + __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */ | |
| 48 | + __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */ | |
| 49 | + __BLK_TA_INSERT, /* insert request */ | |
| 50 | + __BLK_TA_SPLIT, /* bio was split */ | |
| 51 | + __BLK_TA_BOUNCE, /* bio was bounced */ | |
| 52 | + __BLK_TA_REMAP, /* bio was remapped */ | |
| 53 | + __BLK_TA_ABORT, /* request aborted */ | |
| 54 | + __BLK_TA_DRV_DATA, /* driver-specific binary data */ | |
| 55 | +}; | |
| 56 | + | |
| 57 | +/* | |
| 58 | + * Notify events. | |
| 59 | + */ | |
| 60 | +enum blktrace_notify { | |
| 61 | + __BLK_TN_PROCESS = 0, /* establish pid/name mapping */ | |
| 62 | + __BLK_TN_TIMESTAMP, /* include system clock */ | |
| 63 | + __BLK_TN_MESSAGE, /* Character string message */ | |
| 64 | +}; | |
| 65 | + | |
| 66 | + | |
| 67 | +/* | |
| 68 | + * Trace actions in full. Additionally, read or write is masked | |
| 69 | + */ | |
| 70 | +#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 71 | +#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 72 | +#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 73 | +#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 74 | +#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 75 | +#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE)) | |
| 76 | +#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE)) | |
| 77 | +#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE)) | |
| 78 | +#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 79 | +#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 80 | +#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 81 | +#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 82 | +#define BLK_TA_SPLIT (__BLK_TA_SPLIT) | |
| 83 | +#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) | |
| 84 | +#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 85 | +#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) | |
| 86 | +#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) | |
| 87 | + | |
| 88 | +#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) | |
| 89 | +#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) | |
| 90 | +#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY)) | |
| 91 | + | |
| 92 | +#define BLK_IO_TRACE_MAGIC 0x65617400 | |
| 93 | +#define BLK_IO_TRACE_VERSION 0x07 | |
| 94 | + | |
| 95 | +/* | |
| 96 | + * The trace itself | |
| 97 | + */ | |
| 98 | +struct blk_io_trace { | |
| 99 | + __u32 magic; /* MAGIC << 8 | version */ | |
| 100 | + __u32 sequence; /* event number */ | |
| 101 | + __u64 time; /* in microseconds */ | |
| 102 | + __u64 sector; /* disk offset */ | |
| 103 | + __u32 bytes; /* transfer length */ | |
| 104 | + __u32 action; /* what happened */ | |
| 105 | + __u32 pid; /* who did it */ | |
| 106 | + __u32 device; /* device number */ | |
| 107 | + __u32 cpu; /* on what cpu did it happen */ | |
| 108 | + __u16 error; /* completion error */ | |
| 109 | + __u16 pdu_len; /* length of data after this trace */ | |
| 110 | +}; | |
| 111 | + | |
| 112 | +/* | |
| 113 | + * The remap event | |
| 114 | + */ | |
| 115 | +struct blk_io_trace_remap { | |
| 116 | + __be32 device_from; | |
| 117 | + __be32 device_to; | |
| 118 | + __be64 sector_from; | |
| 119 | +}; | |
| 120 | + | |
| 121 | +enum { | |
| 122 | + Blktrace_setup = 1, | |
| 123 | + Blktrace_running, | |
| 124 | + Blktrace_stopped, | |
| 125 | +}; | |
| 126 | + | |
| 127 | +#define BLKTRACE_BDEV_SIZE 32 | |
| 128 | + | |
| 129 | +/* | |
| 130 | + * User setup structure passed with BLKTRACESTART | |
| 131 | + */ | |
| 132 | +struct blk_user_trace_setup { | |
| 133 | + char name[BLKTRACE_BDEV_SIZE]; /* output */ | |
| 134 | + __u16 act_mask; /* input */ | |
| 135 | + __u32 buf_size; /* input */ | |
| 136 | + __u32 buf_nr; /* input */ | |
| 137 | + __u64 start_lba; | |
| 138 | + __u64 end_lba; | |
| 139 | + __u32 pid; | |
| 140 | +}; | |
| 141 | + | |
| 142 | +#endif /* _UAPIBLKTRACE_H */ | |
| @@ -0,0 +1,41 @@ | ||
| 1 | +#ifndef __BPQETHER_H | |
| 2 | +#define __BPQETHER_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Defines for the BPQETHER pseudo device driver | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef __LINUX_IF_ETHER_H | |
| 9 | +#include <linux/if_ether.h> | |
| 10 | +#endif | |
| 11 | + | |
| 12 | +#define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */ | |
| 13 | +#define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1) | |
| 14 | + | |
| 15 | +struct bpq_ethaddr { | |
| 16 | + unsigned char destination[ETH_ALEN]; | |
| 17 | + unsigned char accept[ETH_ALEN]; | |
| 18 | +}; | |
| 19 | + | |
| 20 | +/* | |
| 21 | + * For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers, | |
| 22 | + * currently not implemented, though. If someone wants to hook a radio | |
| 23 | + * to his Ethernet card he may find this useful. ;-) | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */ | |
| 27 | +#define SIOCSBPQETHPARAM 0x5001 /* set */ | |
| 28 | + | |
| 29 | +struct bpq_req { | |
| 30 | + int cmd; | |
| 31 | + int speed; /* unused */ | |
| 32 | + int clockmode; /* unused */ | |
| 33 | + int txdelay; | |
| 34 | + unsigned char persist; /* unused */ | |
| 35 | + int slotime; /* unused */ | |
| 36 | + int squeldelay; | |
| 37 | + int dmachan; /* unused */ | |
| 38 | + int irq; /* unused */ | |
| 39 | +}; | |
| 40 | + | |
| 41 | +#endif | |
| @@ -0,0 +1,65 @@ | ||
| 1 | +#ifndef _UAPIBSG_H | |
| 2 | +#define _UAPIBSG_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +#define BSG_PROTOCOL_SCSI 0 | |
| 7 | + | |
| 8 | +#define BSG_SUB_PROTOCOL_SCSI_CMD 0 | |
| 9 | +#define BSG_SUB_PROTOCOL_SCSI_TMF 1 | |
| 10 | +#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 | |
| 11 | + | |
| 12 | +/* | |
| 13 | + * For flags member below | |
| 14 | + * sg.h sg_io_hdr also has bits defined for it's flags member. However | |
| 15 | + * none of these bits are implemented/used by bsg. The bits below are | |
| 16 | + * allocated to not conflict with sg.h ones anyway. | |
| 17 | + */ | |
| 18 | +#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */ | |
| 19 | + | |
| 20 | +struct sg_io_v4 { | |
| 21 | + __s32 guard; /* [i] 'Q' to differentiate from v3 */ | |
| 22 | + __u32 protocol; /* [i] 0 -> SCSI , .... */ | |
| 23 | + __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task | |
| 24 | + management function, .... */ | |
| 25 | + | |
| 26 | + __u32 request_len; /* [i] in bytes */ | |
| 27 | + __u64 request; /* [i], [*i] {SCSI: cdb} */ | |
| 28 | + __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ | |
| 29 | + __u32 request_attr; /* [i] {SCSI: task attribute} */ | |
| 30 | + __u32 request_priority; /* [i] {SCSI: task priority} */ | |
| 31 | + __u32 request_extra; /* [i] {spare, for padding} */ | |
| 32 | + __u32 max_response_len; /* [i] in bytes */ | |
| 33 | + __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ | |
| 34 | + | |
| 35 | + /* "dout_": data out (to device); "din_": data in (from device) */ | |
| 36 | + __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else | |
| 37 | + dout_xfer points to array of iovec */ | |
| 38 | + __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ | |
| 39 | + __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ | |
| 40 | + __u32 din_xfer_len; /* [i] bytes to be transferred from device */ | |
| 41 | + __u64 dout_xferp; /* [i], [*i] */ | |
| 42 | + __u64 din_xferp; /* [i], [*o] */ | |
| 43 | + | |
| 44 | + __u32 timeout; /* [i] units: millisecond */ | |
| 45 | + __u32 flags; /* [i] bit mask */ | |
| 46 | + __u64 usr_ptr; /* [i->o] unused internally */ | |
| 47 | + __u32 spare_in; /* [i] */ | |
| 48 | + | |
| 49 | + __u32 driver_status; /* [o] 0 -> ok */ | |
| 50 | + __u32 transport_status; /* [o] 0 -> ok */ | |
| 51 | + __u32 device_status; /* [o] {SCSI: command completion status} */ | |
| 52 | + __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ | |
| 53 | + __u32 info; /* [o] additional information */ | |
| 54 | + __u32 duration; /* [o] time to complete, in milliseconds */ | |
| 55 | + __u32 response_len; /* [o] bytes of response actually written */ | |
| 56 | + __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ | |
| 57 | + __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ | |
| 58 | + __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ | |
| 59 | + __u32 spare_out; /* [o] */ | |
| 60 | + | |
| 61 | + __u32 padding; | |
| 62 | +}; | |
| 63 | + | |
| 64 | + | |
| 65 | +#endif /* _UAPIBSG_H */ | |
| @@ -0,0 +1,162 @@ | ||
| 1 | +/* | |
| 2 | + * linux/can.h | |
| 3 | + * | |
| 4 | + * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) | |
| 5 | + * | |
| 6 | + * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | |
| 7 | + * Urs Thuermann <urs.thuermann@volkswagen.de> | |
| 8 | + * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | |
| 9 | + * All rights reserved. | |
| 10 | + * | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#ifndef CAN_H | |
| 14 | +#define CAN_H | |
| 15 | + | |
| 16 | +#include <linux/types.h> | |
| 17 | +#include <linux/socket.h> | |
| 18 | + | |
| 19 | +/* controller area network (CAN) kernel definitions */ | |
| 20 | + | |
| 21 | +/* special address description flags for the CAN_ID */ | |
| 22 | +#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ | |
| 23 | +#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ | |
| 24 | +#define CAN_ERR_FLAG 0x20000000U /* error message frame */ | |
| 25 | + | |
| 26 | +/* valid bits in CAN ID for frame formats */ | |
| 27 | +#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ | |
| 28 | +#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ | |
| 29 | +#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ | |
| 30 | + | |
| 31 | +/* | |
| 32 | + * Controller Area Network Identifier structure | |
| 33 | + * | |
| 34 | + * bit 0-28 : CAN identifier (11/29 bit) | |
| 35 | + * bit 29 : error message frame flag (0 = data frame, 1 = error message) | |
| 36 | + * bit 30 : remote transmission request flag (1 = rtr frame) | |
| 37 | + * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) | |
| 38 | + */ | |
| 39 | +typedef __u32 canid_t; | |
| 40 | + | |
| 41 | +#define CAN_SFF_ID_BITS 11 | |
| 42 | +#define CAN_EFF_ID_BITS 29 | |
| 43 | + | |
| 44 | +/* | |
| 45 | + * Controller Area Network Error Message Frame Mask structure | |
| 46 | + * | |
| 47 | + * bit 0-28 : error class mask (see include/linux/can/error.h) | |
| 48 | + * bit 29-31 : set to zero | |
| 49 | + */ | |
| 50 | +typedef __u32 can_err_mask_t; | |
| 51 | + | |
| 52 | +/* CAN payload length and DLC definitions according to ISO 11898-1 */ | |
| 53 | +#define CAN_MAX_DLC 8 | |
| 54 | +#define CAN_MAX_DLEN 8 | |
| 55 | + | |
| 56 | +/* CAN FD payload length and DLC definitions according to ISO 11898-7 */ | |
| 57 | +#define CANFD_MAX_DLC 15 | |
| 58 | +#define CANFD_MAX_DLEN 64 | |
| 59 | + | |
| 60 | +/** | |
| 61 | + * struct can_frame - basic CAN frame structure | |
| 62 | + * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition | |
| 63 | + * @can_dlc: frame payload length in byte (0 .. 8) aka data length code | |
| 64 | + * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 | |
| 65 | + * mapping of the 'data length code' to the real payload length | |
| 66 | + * @data: CAN frame payload (up to 8 byte) | |
| 67 | + */ | |
| 68 | +struct can_frame { | |
| 69 | + canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ | |
| 70 | + __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ | |
| 71 | + __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); | |
| 72 | +}; | |
| 73 | + | |
| 74 | +/* | |
| 75 | + * defined bits for canfd_frame.flags | |
| 76 | + * | |
| 77 | + * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to | |
| 78 | + * be set in the CAN frame bitstream on the wire. The EDL bit switch turns | |
| 79 | + * the CAN controllers bitstream processor into the CAN FD mode which creates | |
| 80 | + * two new options within the CAN FD frame specification: | |
| 81 | + * | |
| 82 | + * Bit Rate Switch - to indicate a second bitrate is/was used for the payload | |
| 83 | + * Error State Indicator - represents the error state of the transmitting node | |
| 84 | + * | |
| 85 | + * As the CANFD_ESI bit is internally generated by the transmitting CAN | |
| 86 | + * controller only the CANFD_BRS bit is relevant for real CAN controllers when | |
| 87 | + * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make | |
| 88 | + * sense for virtual CAN interfaces to test applications with echoed frames. | |
| 89 | + */ | |
| 90 | +#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ | |
| 91 | +#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */ | |
| 92 | + | |
| 93 | +/** | |
| 94 | + * struct canfd_frame - CAN flexible data rate frame structure | |
| 95 | + * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition | |
| 96 | + * @len: frame payload length in byte (0 .. CANFD_MAX_DLEN) | |
| 97 | + * @flags: additional flags for CAN FD | |
| 98 | + * @__res0: reserved / padding | |
| 99 | + * @__res1: reserved / padding | |
| 100 | + * @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte) | |
| 101 | + */ | |
| 102 | +struct canfd_frame { | |
| 103 | + canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ | |
| 104 | + __u8 len; /* frame payload length in byte */ | |
| 105 | + __u8 flags; /* additional flags for CAN FD */ | |
| 106 | + __u8 __res0; /* reserved / padding */ | |
| 107 | + __u8 __res1; /* reserved / padding */ | |
| 108 | + __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); | |
| 109 | +}; | |
| 110 | + | |
| 111 | +#define CAN_MTU (sizeof(struct can_frame)) | |
| 112 | +#define CANFD_MTU (sizeof(struct canfd_frame)) | |
| 113 | + | |
| 114 | +/* particular protocols of the protocol family PF_CAN */ | |
| 115 | +#define CAN_RAW 1 /* RAW sockets */ | |
| 116 | +#define CAN_BCM 2 /* Broadcast Manager */ | |
| 117 | +#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ | |
| 118 | +#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ | |
| 119 | +#define CAN_MCNET 5 /* Bosch MCNet */ | |
| 120 | +#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ | |
| 121 | +#define CAN_NPROTO 7 | |
| 122 | + | |
| 123 | +#define SOL_CAN_BASE 100 | |
| 124 | + | |
| 125 | +/** | |
| 126 | + * struct sockaddr_can - the sockaddr structure for CAN sockets | |
| 127 | + * @can_family: address family number AF_CAN. | |
| 128 | + * @can_ifindex: CAN network interface index. | |
| 129 | + * @can_addr: protocol specific address information | |
| 130 | + */ | |
| 131 | +struct sockaddr_can { | |
| 132 | + __kernel_sa_family_t can_family; | |
| 133 | + int can_ifindex; | |
| 134 | + union { | |
| 135 | + /* transport protocol class address information (e.g. ISOTP) */ | |
| 136 | + struct { canid_t rx_id, tx_id; } tp; | |
| 137 | + | |
| 138 | + /* reserved for future CAN protocols address information */ | |
| 139 | + } can_addr; | |
| 140 | +}; | |
| 141 | + | |
| 142 | +/** | |
| 143 | + * struct can_filter - CAN ID based filter in can_register(). | |
| 144 | + * @can_id: relevant bits of CAN ID which are not masked out. | |
| 145 | + * @can_mask: CAN mask (see description) | |
| 146 | + * | |
| 147 | + * Description: | |
| 148 | + * A filter matches, when | |
| 149 | + * | |
| 150 | + * <received_can_id> & mask == can_id & mask | |
| 151 | + * | |
| 152 | + * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | |
| 153 | + * filter for error message frames (CAN_ERR_FLAG bit set in mask). | |
| 154 | + */ | |
| 155 | +struct can_filter { | |
| 156 | + canid_t can_id; | |
| 157 | + canid_t can_mask; | |
| 158 | +}; | |
| 159 | + | |
| 160 | +#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ | |
| 161 | + | |
| 162 | +#endif /* CAN_H */ | |
| @@ -0,0 +1,358 @@ | ||
| 1 | +/* | |
| 2 | + * This is <linux/capability.h> | |
| 3 | + * | |
| 4 | + * Andrew G. Morgan <morgan@kernel.org> | |
| 5 | + * Alexander Kjeldaas <astor@guardian.no> | |
| 6 | + * with help from Aleph1, Roland Buresund and Andrew Main. | |
| 7 | + * | |
| 8 | + * See here for the libcap library ("POSIX draft" compliance): | |
| 9 | + * | |
| 10 | + * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#ifndef _UAPI_LINUX_CAPABILITY_H | |
| 14 | +#define _UAPI_LINUX_CAPABILITY_H | |
| 15 | + | |
| 16 | +#include <linux/types.h> | |
| 17 | + | |
| 18 | +struct task_struct; | |
| 19 | + | |
| 20 | +/* User-level do most of the mapping between kernel and user | |
| 21 | + capabilities based on the version tag given by the kernel. The | |
| 22 | + kernel might be somewhat backwards compatible, but don't bet on | |
| 23 | + it. */ | |
| 24 | + | |
| 25 | +/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to | |
| 26 | + a set of three capability sets. The transposition of 3*the | |
| 27 | + following structure to such a composite is better handled in a user | |
| 28 | + library since the draft standard requires the use of malloc/free | |
| 29 | + etc.. */ | |
| 30 | + | |
| 31 | +#define _LINUX_CAPABILITY_VERSION_1 0x19980330 | |
| 32 | +#define _LINUX_CAPABILITY_U32S_1 1 | |
| 33 | + | |
| 34 | +#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */ | |
| 35 | +#define _LINUX_CAPABILITY_U32S_2 2 | |
| 36 | + | |
| 37 | +#define _LINUX_CAPABILITY_VERSION_3 0x20080522 | |
| 38 | +#define _LINUX_CAPABILITY_U32S_3 2 | |
| 39 | + | |
| 40 | +typedef struct __user_cap_header_struct { | |
| 41 | + __u32 version; | |
| 42 | + int pid; | |
| 43 | +} __user *cap_user_header_t; | |
| 44 | + | |
| 45 | +typedef struct __user_cap_data_struct { | |
| 46 | + __u32 effective; | |
| 47 | + __u32 permitted; | |
| 48 | + __u32 inheritable; | |
| 49 | +} __user *cap_user_data_t; | |
| 50 | + | |
| 51 | + | |
| 52 | +#define VFS_CAP_REVISION_MASK 0xFF000000 | |
| 53 | +#define VFS_CAP_REVISION_SHIFT 24 | |
| 54 | +#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK | |
| 55 | +#define VFS_CAP_FLAGS_EFFECTIVE 0x000001 | |
| 56 | + | |
| 57 | +#define VFS_CAP_REVISION_1 0x01000000 | |
| 58 | +#define VFS_CAP_U32_1 1 | |
| 59 | +#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1)) | |
| 60 | + | |
| 61 | +#define VFS_CAP_REVISION_2 0x02000000 | |
| 62 | +#define VFS_CAP_U32_2 2 | |
| 63 | +#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2)) | |
| 64 | + | |
| 65 | +#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2 | |
| 66 | +#define VFS_CAP_U32 VFS_CAP_U32_2 | |
| 67 | +#define VFS_CAP_REVISION VFS_CAP_REVISION_2 | |
| 68 | + | |
| 69 | +struct vfs_cap_data { | |
| 70 | + __le32 magic_etc; /* Little endian */ | |
| 71 | + struct { | |
| 72 | + __le32 permitted; /* Little endian */ | |
| 73 | + __le32 inheritable; /* Little endian */ | |
| 74 | + } data[VFS_CAP_U32]; | |
| 75 | +}; | |
| 76 | + | |
| 77 | +#ifndef __KERNEL__ | |
| 78 | + | |
| 79 | +/* | |
| 80 | + * Backwardly compatible definition for source code - trapped in a | |
| 81 | + * 32-bit world. If you find you need this, please consider using | |
| 82 | + * libcap to untrap yourself... | |
| 83 | + */ | |
| 84 | +#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1 | |
| 85 | +#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1 | |
| 86 | + | |
| 87 | +#endif | |
| 88 | + | |
| 89 | + | |
| 90 | +/** | |
| 91 | + ** POSIX-draft defined capabilities. | |
| 92 | + **/ | |
| 93 | + | |
| 94 | +/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this | |
| 95 | + overrides the restriction of changing file ownership and group | |
| 96 | + ownership. */ | |
| 97 | + | |
| 98 | +#define CAP_CHOWN 0 | |
| 99 | + | |
| 100 | +/* Override all DAC access, including ACL execute access if | |
| 101 | + [_POSIX_ACL] is defined. Excluding DAC access covered by | |
| 102 | + CAP_LINUX_IMMUTABLE. */ | |
| 103 | + | |
| 104 | +#define CAP_DAC_OVERRIDE 1 | |
| 105 | + | |
| 106 | +/* Overrides all DAC restrictions regarding read and search on files | |
| 107 | + and directories, including ACL restrictions if [_POSIX_ACL] is | |
| 108 | + defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */ | |
| 109 | + | |
| 110 | +#define CAP_DAC_READ_SEARCH 2 | |
| 111 | + | |
| 112 | +/* Overrides all restrictions about allowed operations on files, where | |
| 113 | + file owner ID must be equal to the user ID, except where CAP_FSETID | |
| 114 | + is applicable. It doesn't override MAC and DAC restrictions. */ | |
| 115 | + | |
| 116 | +#define CAP_FOWNER 3 | |
| 117 | + | |
| 118 | +/* Overrides the following restrictions that the effective user ID | |
| 119 | + shall match the file owner ID when setting the S_ISUID and S_ISGID | |
| 120 | + bits on that file; that the effective group ID (or one of the | |
| 121 | + supplementary group IDs) shall match the file owner ID when setting | |
| 122 | + the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are | |
| 123 | + cleared on successful return from chown(2) (not implemented). */ | |
| 124 | + | |
| 125 | +#define CAP_FSETID 4 | |
| 126 | + | |
| 127 | +/* Overrides the restriction that the real or effective user ID of a | |
| 128 | + process sending a signal must match the real or effective user ID | |
| 129 | + of the process receiving the signal. */ | |
| 130 | + | |
| 131 | +#define CAP_KILL 5 | |
| 132 | + | |
| 133 | +/* Allows setgid(2) manipulation */ | |
| 134 | +/* Allows setgroups(2) */ | |
| 135 | +/* Allows forged gids on socket credentials passing. */ | |
| 136 | + | |
| 137 | +#define CAP_SETGID 6 | |
| 138 | + | |
| 139 | +/* Allows set*uid(2) manipulation (including fsuid). */ | |
| 140 | +/* Allows forged pids on socket credentials passing. */ | |
| 141 | + | |
| 142 | +#define CAP_SETUID 7 | |
| 143 | + | |
| 144 | + | |
| 145 | +/** | |
| 146 | + ** Linux-specific capabilities | |
| 147 | + **/ | |
| 148 | + | |
| 149 | +/* Without VFS support for capabilities: | |
| 150 | + * Transfer any capability in your permitted set to any pid, | |
| 151 | + * remove any capability in your permitted set from any pid | |
| 152 | + * With VFS support for capabilities (neither of above, but) | |
| 153 | + * Add any capability from current's capability bounding set | |
| 154 | + * to the current process' inheritable set | |
| 155 | + * Allow taking bits out of capability bounding set | |
| 156 | + * Allow modification of the securebits for a process | |
| 157 | + */ | |
| 158 | + | |
| 159 | +#define CAP_SETPCAP 8 | |
| 160 | + | |
| 161 | +/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */ | |
| 162 | + | |
| 163 | +#define CAP_LINUX_IMMUTABLE 9 | |
| 164 | + | |
| 165 | +/* Allows binding to TCP/UDP sockets below 1024 */ | |
| 166 | +/* Allows binding to ATM VCIs below 32 */ | |
| 167 | + | |
| 168 | +#define CAP_NET_BIND_SERVICE 10 | |
| 169 | + | |
| 170 | +/* Allow broadcasting, listen to multicast */ | |
| 171 | + | |
| 172 | +#define CAP_NET_BROADCAST 11 | |
| 173 | + | |
| 174 | +/* Allow interface configuration */ | |
| 175 | +/* Allow administration of IP firewall, masquerading and accounting */ | |
| 176 | +/* Allow setting debug option on sockets */ | |
| 177 | +/* Allow modification of routing tables */ | |
| 178 | +/* Allow setting arbitrary process / process group ownership on | |
| 179 | + sockets */ | |
| 180 | +/* Allow binding to any address for transparent proxying (also via NET_RAW) */ | |
| 181 | +/* Allow setting TOS (type of service) */ | |
| 182 | +/* Allow setting promiscuous mode */ | |
| 183 | +/* Allow clearing driver statistics */ | |
| 184 | +/* Allow multicasting */ | |
| 185 | +/* Allow read/write of device-specific registers */ | |
| 186 | +/* Allow activation of ATM control sockets */ | |
| 187 | + | |
| 188 | +#define CAP_NET_ADMIN 12 | |
| 189 | + | |
| 190 | +/* Allow use of RAW sockets */ | |
| 191 | +/* Allow use of PACKET sockets */ | |
| 192 | +/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */ | |
| 193 | + | |
| 194 | +#define CAP_NET_RAW 13 | |
| 195 | + | |
| 196 | +/* Allow locking of shared memory segments */ | |
| 197 | +/* Allow mlock and mlockall (which doesn't really have anything to do | |
| 198 | + with IPC) */ | |
| 199 | + | |
| 200 | +#define CAP_IPC_LOCK 14 | |
| 201 | + | |
| 202 | +/* Override IPC ownership checks */ | |
| 203 | + | |
| 204 | +#define CAP_IPC_OWNER 15 | |
| 205 | + | |
| 206 | +/* Insert and remove kernel modules - modify kernel without limit */ | |
| 207 | +#define CAP_SYS_MODULE 16 | |
| 208 | + | |
| 209 | +/* Allow ioperm/iopl access */ | |
| 210 | +/* Allow sending USB messages to any device via /proc/bus/usb */ | |
| 211 | + | |
| 212 | +#define CAP_SYS_RAWIO 17 | |
| 213 | + | |
| 214 | +/* Allow use of chroot() */ | |
| 215 | + | |
| 216 | +#define CAP_SYS_CHROOT 18 | |
| 217 | + | |
| 218 | +/* Allow ptrace() of any process */ | |
| 219 | + | |
| 220 | +#define CAP_SYS_PTRACE 19 | |
| 221 | + | |
| 222 | +/* Allow configuration of process accounting */ | |
| 223 | + | |
| 224 | +#define CAP_SYS_PACCT 20 | |
| 225 | + | |
| 226 | +/* Allow configuration of the secure attention key */ | |
| 227 | +/* Allow administration of the random device */ | |
| 228 | +/* Allow examination and configuration of disk quotas */ | |
| 229 | +/* Allow setting the domainname */ | |
| 230 | +/* Allow setting the hostname */ | |
| 231 | +/* Allow calling bdflush() */ | |
| 232 | +/* Allow mount() and umount(), setting up new smb connection */ | |
| 233 | +/* Allow some autofs root ioctls */ | |
| 234 | +/* Allow nfsservctl */ | |
| 235 | +/* Allow VM86_REQUEST_IRQ */ | |
| 236 | +/* Allow to read/write pci config on alpha */ | |
| 237 | +/* Allow irix_prctl on mips (setstacksize) */ | |
| 238 | +/* Allow flushing all cache on m68k (sys_cacheflush) */ | |
| 239 | +/* Allow removing semaphores */ | |
| 240 | +/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores | |
| 241 | + and shared memory */ | |
| 242 | +/* Allow locking/unlocking of shared memory segment */ | |
| 243 | +/* Allow turning swap on/off */ | |
| 244 | +/* Allow forged pids on socket credentials passing */ | |
| 245 | +/* Allow setting readahead and flushing buffers on block devices */ | |
| 246 | +/* Allow setting geometry in floppy driver */ | |
| 247 | +/* Allow turning DMA on/off in xd driver */ | |
| 248 | +/* Allow administration of md devices (mostly the above, but some | |
| 249 | + extra ioctls) */ | |
| 250 | +/* Allow tuning the ide driver */ | |
| 251 | +/* Allow access to the nvram device */ | |
| 252 | +/* Allow administration of apm_bios, serial and bttv (TV) device */ | |
| 253 | +/* Allow manufacturer commands in isdn CAPI support driver */ | |
| 254 | +/* Allow reading non-standardized portions of pci configuration space */ | |
| 255 | +/* Allow DDI debug ioctl on sbpcd driver */ | |
| 256 | +/* Allow setting up serial ports */ | |
| 257 | +/* Allow sending raw qic-117 commands */ | |
| 258 | +/* Allow enabling/disabling tagged queuing on SCSI controllers and sending | |
| 259 | + arbitrary SCSI commands */ | |
| 260 | +/* Allow setting encryption key on loopback filesystem */ | |
| 261 | +/* Allow setting zone reclaim policy */ | |
| 262 | + | |
| 263 | +#define CAP_SYS_ADMIN 21 | |
| 264 | + | |
| 265 | +/* Allow use of reboot() */ | |
| 266 | + | |
| 267 | +#define CAP_SYS_BOOT 22 | |
| 268 | + | |
| 269 | +/* Allow raising priority and setting priority on other (different | |
| 270 | + UID) processes */ | |
| 271 | +/* Allow use of FIFO and round-robin (realtime) scheduling on own | |
| 272 | + processes and setting the scheduling algorithm used by another | |
| 273 | + process. */ | |
| 274 | +/* Allow setting cpu affinity on other processes */ | |
| 275 | + | |
| 276 | +#define CAP_SYS_NICE 23 | |
| 277 | + | |
| 278 | +/* Override resource limits. Set resource limits. */ | |
| 279 | +/* Override quota limits. */ | |
| 280 | +/* Override reserved space on ext2 filesystem */ | |
| 281 | +/* Modify data journaling mode on ext3 filesystem (uses journaling | |
| 282 | + resources) */ | |
| 283 | +/* NOTE: ext2 honors fsuid when checking for resource overrides, so | |
| 284 | + you can override using fsuid too */ | |
| 285 | +/* Override size restrictions on IPC message queues */ | |
| 286 | +/* Allow more than 64hz interrupts from the real-time clock */ | |
| 287 | +/* Override max number of consoles on console allocation */ | |
| 288 | +/* Override max number of keymaps */ | |
| 289 | + | |
| 290 | +#define CAP_SYS_RESOURCE 24 | |
| 291 | + | |
| 292 | +/* Allow manipulation of system clock */ | |
| 293 | +/* Allow irix_stime on mips */ | |
| 294 | +/* Allow setting the real-time clock */ | |
| 295 | + | |
| 296 | +#define CAP_SYS_TIME 25 | |
| 297 | + | |
| 298 | +/* Allow configuration of tty devices */ | |
| 299 | +/* Allow vhangup() of tty */ | |
| 300 | + | |
| 301 | +#define CAP_SYS_TTY_CONFIG 26 | |
| 302 | + | |
| 303 | +/* Allow the privileged aspects of mknod() */ | |
| 304 | + | |
| 305 | +#define CAP_MKNOD 27 | |
| 306 | + | |
| 307 | +/* Allow taking of leases on files */ | |
| 308 | + | |
| 309 | +#define CAP_LEASE 28 | |
| 310 | + | |
| 311 | +#define CAP_AUDIT_WRITE 29 | |
| 312 | + | |
| 313 | +#define CAP_AUDIT_CONTROL 30 | |
| 314 | + | |
| 315 | +#define CAP_SETFCAP 31 | |
| 316 | + | |
| 317 | +/* Override MAC access. | |
| 318 | + The base kernel enforces no MAC policy. | |
| 319 | + An LSM may enforce a MAC policy, and if it does and it chooses | |
| 320 | + to implement capability based overrides of that policy, this is | |
| 321 | + the capability it should use to do so. */ | |
| 322 | + | |
| 323 | +#define CAP_MAC_OVERRIDE 32 | |
| 324 | + | |
| 325 | +/* Allow MAC configuration or state changes. | |
| 326 | + The base kernel requires no MAC configuration. | |
| 327 | + An LSM may enforce a MAC policy, and if it does and it chooses | |
| 328 | + to implement capability based checks on modifications to that | |
| 329 | + policy or the data required to maintain it, this is the | |
| 330 | + capability it should use to do so. */ | |
| 331 | + | |
| 332 | +#define CAP_MAC_ADMIN 33 | |
| 333 | + | |
| 334 | +/* Allow configuring the kernel's syslog (printk behaviour) */ | |
| 335 | + | |
| 336 | +#define CAP_SYSLOG 34 | |
| 337 | + | |
| 338 | +/* Allow triggering something that will wake the system */ | |
| 339 | + | |
| 340 | +#define CAP_WAKE_ALARM 35 | |
| 341 | + | |
| 342 | +/* Allow preventing system suspends */ | |
| 343 | + | |
| 344 | +#define CAP_BLOCK_SUSPEND 36 | |
| 345 | + | |
| 346 | +#define CAP_LAST_CAP CAP_BLOCK_SUSPEND | |
| 347 | + | |
| 348 | +#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) | |
| 349 | + | |
| 350 | +/* | |
| 351 | + * Bit location of each capability (used by user-space library and kernel) | |
| 352 | + */ | |
| 353 | + | |
| 354 | +#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */ | |
| 355 | +#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */ | |
| 356 | + | |
| 357 | + | |
| 358 | +#endif /* _UAPI_LINUX_CAPABILITY_H */ | |
| @@ -0,0 +1,133 @@ | ||
| 1 | +/* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $ | |
| 2 | + * | |
| 3 | + * CAPI 2.0 Interface for Linux | |
| 4 | + * | |
| 5 | + * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) | |
| 6 | + * | |
| 7 | + * This software may be used and distributed according to the terms | |
| 8 | + * of the GNU General Public License, incorporated herein by reference. | |
| 9 | + * | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef __LINUX_CAPI_H__ | |
| 13 | +#define __LINUX_CAPI_H__ | |
| 14 | + | |
| 15 | +#include <linux/types.h> | |
| 16 | +#include <linux/ioctl.h> | |
| 17 | +#ifndef __KERNEL__ | |
| 18 | +#include <linux/kernelcapi.h> | |
| 19 | +#endif | |
| 20 | + | |
| 21 | +/* | |
| 22 | + * CAPI_REGISTER | |
| 23 | + */ | |
| 24 | + | |
| 25 | +typedef struct capi_register_params { /* CAPI_REGISTER */ | |
| 26 | + __u32 level3cnt; /* No. of simulatneous user data connections */ | |
| 27 | + __u32 datablkcnt; /* No. of buffered data messages */ | |
| 28 | + __u32 datablklen; /* Size of buffered data messages */ | |
| 29 | +} capi_register_params; | |
| 30 | + | |
| 31 | +#define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params) | |
| 32 | + | |
| 33 | +/* | |
| 34 | + * CAPI_GET_MANUFACTURER | |
| 35 | + */ | |
| 36 | + | |
| 37 | +#define CAPI_MANUFACTURER_LEN 64 | |
| 38 | + | |
| 39 | +#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */ | |
| 40 | + | |
| 41 | +/* | |
| 42 | + * CAPI_GET_VERSION | |
| 43 | + */ | |
| 44 | + | |
| 45 | +typedef struct capi_version { | |
| 46 | + __u32 majorversion; | |
| 47 | + __u32 minorversion; | |
| 48 | + __u32 majormanuversion; | |
| 49 | + __u32 minormanuversion; | |
| 50 | +} capi_version; | |
| 51 | + | |
| 52 | +#define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) | |
| 53 | + | |
| 54 | +/* | |
| 55 | + * CAPI_GET_SERIAL | |
| 56 | + */ | |
| 57 | + | |
| 58 | +#define CAPI_SERIAL_LEN 8 | |
| 59 | +#define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ | |
| 60 | + | |
| 61 | +/* | |
| 62 | + * CAPI_GET_PROFILE | |
| 63 | + */ | |
| 64 | + | |
| 65 | +typedef struct capi_profile { | |
| 66 | + __u16 ncontroller; /* number of installed controller */ | |
| 67 | + __u16 nbchannel; /* number of B-Channels */ | |
| 68 | + __u32 goptions; /* global options */ | |
| 69 | + __u32 support1; /* B1 protocols support */ | |
| 70 | + __u32 support2; /* B2 protocols support */ | |
| 71 | + __u32 support3; /* B3 protocols support */ | |
| 72 | + __u32 reserved[6]; /* reserved */ | |
| 73 | + __u32 manu[5]; /* manufacturer specific information */ | |
| 74 | +} capi_profile; | |
| 75 | + | |
| 76 | +#define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) | |
| 77 | + | |
| 78 | +typedef struct capi_manufacturer_cmd { | |
| 79 | + unsigned long cmd; | |
| 80 | + void __user *data; | |
| 81 | +} capi_manufacturer_cmd; | |
| 82 | + | |
| 83 | +/* | |
| 84 | + * CAPI_MANUFACTURER_CMD | |
| 85 | + */ | |
| 86 | + | |
| 87 | +#define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd) | |
| 88 | + | |
| 89 | +/* | |
| 90 | + * CAPI_GET_ERRCODE | |
| 91 | + * capi errcode is set, * if read, write, or ioctl returns EIO, | |
| 92 | + * ioctl returns errcode directly, and in arg, if != 0 | |
| 93 | + */ | |
| 94 | + | |
| 95 | +#define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) | |
| 96 | + | |
| 97 | +/* | |
| 98 | + * CAPI_INSTALLED | |
| 99 | + */ | |
| 100 | +#define CAPI_INSTALLED _IOR('C',0x22, __u16) | |
| 101 | + | |
| 102 | + | |
| 103 | +/* | |
| 104 | + * member contr is input for | |
| 105 | + * CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL | |
| 106 | + * and CAPI_GET_PROFILE | |
| 107 | + */ | |
| 108 | +typedef union capi_ioctl_struct { | |
| 109 | + __u32 contr; | |
| 110 | + capi_register_params rparams; | |
| 111 | + __u8 manufacturer[CAPI_MANUFACTURER_LEN]; | |
| 112 | + capi_version version; | |
| 113 | + __u8 serial[CAPI_SERIAL_LEN]; | |
| 114 | + capi_profile profile; | |
| 115 | + capi_manufacturer_cmd cmd; | |
| 116 | + __u16 errcode; | |
| 117 | +} capi_ioctl_struct; | |
| 118 | + | |
| 119 | +/* | |
| 120 | + * Middleware extension | |
| 121 | + */ | |
| 122 | + | |
| 123 | +#define CAPIFLAG_HIGHJACKING 0x0001 | |
| 124 | + | |
| 125 | +#define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) | |
| 126 | +#define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) | |
| 127 | +#define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) | |
| 128 | + | |
| 129 | +#define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) | |
| 130 | + | |
| 131 | +#define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) | |
| 132 | + | |
| 133 | +#endif /* __LINUX_CAPI_H__ */ | |
| @@ -0,0 +1,130 @@ | ||
| 1 | +#ifndef CCISS_DEFS_H | |
| 2 | +#define CCISS_DEFS_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +/* general boundary definitions */ | |
| 7 | +#define SENSEINFOBYTES 32 /* note that this value may vary | |
| 8 | + between host implementations */ | |
| 9 | + | |
| 10 | +/* Command Status value */ | |
| 11 | +#define CMD_SUCCESS 0x0000 | |
| 12 | +#define CMD_TARGET_STATUS 0x0001 | |
| 13 | +#define CMD_DATA_UNDERRUN 0x0002 | |
| 14 | +#define CMD_DATA_OVERRUN 0x0003 | |
| 15 | +#define CMD_INVALID 0x0004 | |
| 16 | +#define CMD_PROTOCOL_ERR 0x0005 | |
| 17 | +#define CMD_HARDWARE_ERR 0x0006 | |
| 18 | +#define CMD_CONNECTION_LOST 0x0007 | |
| 19 | +#define CMD_ABORTED 0x0008 | |
| 20 | +#define CMD_ABORT_FAILED 0x0009 | |
| 21 | +#define CMD_UNSOLICITED_ABORT 0x000A | |
| 22 | +#define CMD_TIMEOUT 0x000B | |
| 23 | +#define CMD_UNABORTABLE 0x000C | |
| 24 | + | |
| 25 | +/* transfer direction */ | |
| 26 | +#define XFER_NONE 0x00 | |
| 27 | +#define XFER_WRITE 0x01 | |
| 28 | +#define XFER_READ 0x02 | |
| 29 | +#define XFER_RSVD 0x03 | |
| 30 | + | |
| 31 | +/* task attribute */ | |
| 32 | +#define ATTR_UNTAGGED 0x00 | |
| 33 | +#define ATTR_SIMPLE 0x04 | |
| 34 | +#define ATTR_HEADOFQUEUE 0x05 | |
| 35 | +#define ATTR_ORDERED 0x06 | |
| 36 | +#define ATTR_ACA 0x07 | |
| 37 | + | |
| 38 | +/* cdb type */ | |
| 39 | +#define TYPE_CMD 0x00 | |
| 40 | +#define TYPE_MSG 0x01 | |
| 41 | + | |
| 42 | +/* Type defs used in the following structs */ | |
| 43 | +#define BYTE __u8 | |
| 44 | +#define WORD __u16 | |
| 45 | +#define HWORD __u16 | |
| 46 | +#define DWORD __u32 | |
| 47 | + | |
| 48 | +#define CISS_MAX_LUN 1024 | |
| 49 | + | |
| 50 | +#define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */ | |
| 51 | +#define LEVEL3LUN 0 | |
| 52 | + | |
| 53 | +#pragma pack(1) | |
| 54 | + | |
| 55 | +/* Command List Structure */ | |
| 56 | +typedef union _SCSI3Addr_struct { | |
| 57 | + struct { | |
| 58 | + BYTE Dev; | |
| 59 | + BYTE Bus:6; | |
| 60 | + BYTE Mode:2; /* b00 */ | |
| 61 | + } PeripDev; | |
| 62 | + struct { | |
| 63 | + BYTE DevLSB; | |
| 64 | + BYTE DevMSB:6; | |
| 65 | + BYTE Mode:2; /* b01 */ | |
| 66 | + } LogDev; | |
| 67 | + struct { | |
| 68 | + BYTE Dev:5; | |
| 69 | + BYTE Bus:3; | |
| 70 | + BYTE Targ:6; | |
| 71 | + BYTE Mode:2; /* b10 */ | |
| 72 | + } LogUnit; | |
| 73 | +} SCSI3Addr_struct; | |
| 74 | + | |
| 75 | +typedef struct _PhysDevAddr_struct { | |
| 76 | + DWORD TargetId:24; | |
| 77 | + DWORD Bus:6; | |
| 78 | + DWORD Mode:2; | |
| 79 | + SCSI3Addr_struct Target[2]; /* 2 level target device addr */ | |
| 80 | +} PhysDevAddr_struct; | |
| 81 | + | |
| 82 | +typedef struct _LogDevAddr_struct { | |
| 83 | + DWORD VolId:30; | |
| 84 | + DWORD Mode:2; | |
| 85 | + BYTE reserved[4]; | |
| 86 | +} LogDevAddr_struct; | |
| 87 | + | |
| 88 | +typedef union _LUNAddr_struct { | |
| 89 | + BYTE LunAddrBytes[8]; | |
| 90 | + SCSI3Addr_struct SCSI3Lun[4]; | |
| 91 | + PhysDevAddr_struct PhysDev; | |
| 92 | + LogDevAddr_struct LogDev; | |
| 93 | +} LUNAddr_struct; | |
| 94 | + | |
| 95 | +typedef struct _RequestBlock_struct { | |
| 96 | + BYTE CDBLen; | |
| 97 | + struct { | |
| 98 | + BYTE Type:3; | |
| 99 | + BYTE Attribute:3; | |
| 100 | + BYTE Direction:2; | |
| 101 | + } Type; | |
| 102 | + HWORD Timeout; | |
| 103 | + BYTE CDB[16]; | |
| 104 | +} RequestBlock_struct; | |
| 105 | + | |
| 106 | +typedef union _MoreErrInfo_struct{ | |
| 107 | + struct { | |
| 108 | + BYTE Reserved[3]; | |
| 109 | + BYTE Type; | |
| 110 | + DWORD ErrorInfo; | |
| 111 | + } Common_Info; | |
| 112 | + struct{ | |
| 113 | + BYTE Reserved[2]; | |
| 114 | + BYTE offense_size; /* size of offending entry */ | |
| 115 | + BYTE offense_num; /* byte # of offense 0-base */ | |
| 116 | + DWORD offense_value; | |
| 117 | + } Invalid_Cmd; | |
| 118 | +} MoreErrInfo_struct; | |
| 119 | +typedef struct _ErrorInfo_struct { | |
| 120 | + BYTE ScsiStatus; | |
| 121 | + BYTE SenseLen; | |
| 122 | + HWORD CommandStatus; | |
| 123 | + DWORD ResidualCnt; | |
| 124 | + MoreErrInfo_struct MoreErrInfo; | |
| 125 | + BYTE SenseInfo[SENSEINFOBYTES]; | |
| 126 | +} ErrorInfo_struct; | |
| 127 | + | |
| 128 | +#pragma pack() | |
| 129 | + | |
| 130 | +#endif /* CCISS_DEFS_H */ | |
| @@ -0,0 +1,88 @@ | ||
| 1 | +#ifndef _UAPICCISS_IOCTLH | |
| 2 | +#define _UAPICCISS_IOCTLH | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/ioctl.h> | |
| 6 | +#include <linux/cciss_defs.h> | |
| 7 | + | |
| 8 | +#define CCISS_IOC_MAGIC 'B' | |
| 9 | + | |
| 10 | + | |
| 11 | +typedef struct _cciss_pci_info_struct | |
| 12 | +{ | |
| 13 | + unsigned char bus; | |
| 14 | + unsigned char dev_fn; | |
| 15 | + unsigned short domain; | |
| 16 | + __u32 board_id; | |
| 17 | +} cciss_pci_info_struct; | |
| 18 | + | |
| 19 | +typedef struct _cciss_coalint_struct | |
| 20 | +{ | |
| 21 | + __u32 delay; | |
| 22 | + __u32 count; | |
| 23 | +} cciss_coalint_struct; | |
| 24 | + | |
| 25 | +typedef char NodeName_type[16]; | |
| 26 | + | |
| 27 | +typedef __u32 Heartbeat_type; | |
| 28 | + | |
| 29 | +#define CISS_PARSCSIU2 0x0001 | |
| 30 | +#define CISS_PARCSCIU3 0x0002 | |
| 31 | +#define CISS_FIBRE1G 0x0100 | |
| 32 | +#define CISS_FIBRE2G 0x0200 | |
| 33 | +typedef __u32 BusTypes_type; | |
| 34 | + | |
| 35 | +typedef char FirmwareVer_type[4]; | |
| 36 | +typedef __u32 DriverVer_type; | |
| 37 | + | |
| 38 | +#define MAX_KMALLOC_SIZE 128000 | |
| 39 | + | |
| 40 | +typedef struct _IOCTL_Command_struct { | |
| 41 | + LUNAddr_struct LUN_info; | |
| 42 | + RequestBlock_struct Request; | |
| 43 | + ErrorInfo_struct error_info; | |
| 44 | + WORD buf_size; /* size in bytes of the buf */ | |
| 45 | + BYTE __user *buf; | |
| 46 | +} IOCTL_Command_struct; | |
| 47 | + | |
| 48 | +typedef struct _BIG_IOCTL_Command_struct { | |
| 49 | + LUNAddr_struct LUN_info; | |
| 50 | + RequestBlock_struct Request; | |
| 51 | + ErrorInfo_struct error_info; | |
| 52 | + DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ | |
| 53 | + DWORD buf_size; /* size in bytes of the buf */ | |
| 54 | + /* < malloc_size * MAXSGENTRIES */ | |
| 55 | + BYTE __user *buf; | |
| 56 | +} BIG_IOCTL_Command_struct; | |
| 57 | + | |
| 58 | +typedef struct _LogvolInfo_struct{ | |
| 59 | + __u32 LunID; | |
| 60 | + int num_opens; /* number of opens on the logical volume */ | |
| 61 | + int num_parts; /* number of partitions configured on logvol */ | |
| 62 | +} LogvolInfo_struct; | |
| 63 | + | |
| 64 | +#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct) | |
| 65 | + | |
| 66 | +#define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct) | |
| 67 | +#define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct) | |
| 68 | + | |
| 69 | +#define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type) | |
| 70 | +#define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type) | |
| 71 | + | |
| 72 | +#define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type) | |
| 73 | +#define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type) | |
| 74 | +#define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type) | |
| 75 | +#define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type) | |
| 76 | +#define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10) | |
| 77 | +#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct) | |
| 78 | +#define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12) | |
| 79 | + | |
| 80 | +/* no longer used... use REGNEWD instead */ | |
| 81 | +#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int) | |
| 82 | + | |
| 83 | +#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14) | |
| 84 | +#define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16) | |
| 85 | +#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct) | |
| 86 | +#define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct) | |
| 87 | + | |
| 88 | +#endif /* _UAPICCISS_IOCTLH */ | |
| @@ -0,0 +1,912 @@ | ||
| 1 | +/* | |
| 2 | + * -- <linux/cdrom.h> | |
| 3 | + * General header file for linux CD-ROM drivers | |
| 4 | + * Copyright (C) 1992 David Giller, rafetmad@oxy.edu | |
| 5 | + * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de | |
| 6 | + * 1996 David van Leeuwen, david@tm.tno.nl | |
| 7 | + * 1997, 1998 Erik Andersen, andersee@debian.org | |
| 8 | + * 1998-2002 Jens Axboe, axboe@suse.de | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#ifndef _UAPI_LINUX_CDROM_H | |
| 12 | +#define _UAPI_LINUX_CDROM_H | |
| 13 | + | |
| 14 | +#include <linux/types.h> | |
| 15 | +#include <asm/byteorder.h> | |
| 16 | + | |
| 17 | +/******************************************************* | |
| 18 | + * As of Linux 2.1.x, all Linux CD-ROM application programs will use this | |
| 19 | + * (and only this) include file. It is my hope to provide Linux with | |
| 20 | + * a uniform interface between software accessing CD-ROMs and the various | |
| 21 | + * device drivers that actually talk to the drives. There may still be | |
| 22 | + * 23 different kinds of strange CD-ROM drives, but at least there will | |
| 23 | + * now be one, and only one, Linux CD-ROM interface. | |
| 24 | + * | |
| 25 | + * Additionally, as of Linux 2.1.x, all Linux application programs | |
| 26 | + * should use the O_NONBLOCK option when opening a CD-ROM device | |
| 27 | + * for subsequent ioctl commands. This allows for neat system errors | |
| 28 | + * like "No medium found" or "Wrong medium type" upon attempting to | |
| 29 | + * mount or play an empty slot, mount an audio disc, or play a data disc. | |
| 30 | + * Generally, changing an application program to support O_NONBLOCK | |
| 31 | + * is as easy as the following: | |
| 32 | + * - drive = open("/dev/cdrom", O_RDONLY); | |
| 33 | + * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); | |
| 34 | + * It is worth the small change. | |
| 35 | + * | |
| 36 | + * Patches for many common CD programs (provided by David A. van Leeuwen) | |
| 37 | + * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ | |
| 38 | + * | |
| 39 | + *******************************************************/ | |
| 40 | + | |
| 41 | +/* When a driver supports a certain function, but the cdrom drive we are | |
| 42 | + * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will | |
| 43 | + * borrow the "Operation not supported" error from the network folks to | |
| 44 | + * accomplish this. Maybe someday we will get a more targeted error code, | |
| 45 | + * but this will do for now... */ | |
| 46 | +#define EDRIVE_CANT_DO_THIS EOPNOTSUPP | |
| 47 | + | |
| 48 | +/******************************************************* | |
| 49 | + * The CD-ROM IOCTL commands -- these should be supported by | |
| 50 | + * all the various cdrom drivers. For the CD-ROM ioctls, we | |
| 51 | + * will commandeer byte 0x53, or 'S'. | |
| 52 | + *******************************************************/ | |
| 53 | +#define CDROMPAUSE 0x5301 /* Pause Audio Operation */ | |
| 54 | +#define CDROMRESUME 0x5302 /* Resume paused Audio Operation */ | |
| 55 | +#define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ | |
| 56 | +#define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index | |
| 57 | + (struct cdrom_ti) */ | |
| 58 | +#define CDROMREADTOCHDR 0x5305 /* Read TOC header | |
| 59 | + (struct cdrom_tochdr) */ | |
| 60 | +#define CDROMREADTOCENTRY 0x5306 /* Read TOC entry | |
| 61 | + (struct cdrom_tocentry) */ | |
| 62 | +#define CDROMSTOP 0x5307 /* Stop the cdrom drive */ | |
| 63 | +#define CDROMSTART 0x5308 /* Start the cdrom drive */ | |
| 64 | +#define CDROMEJECT 0x5309 /* Ejects the cdrom media */ | |
| 65 | +#define CDROMVOLCTRL 0x530a /* Control output volume | |
| 66 | + (struct cdrom_volctrl) */ | |
| 67 | +#define CDROMSUBCHNL 0x530b /* Read subchannel data | |
| 68 | + (struct cdrom_subchnl) */ | |
| 69 | +#define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) | |
| 70 | + (struct cdrom_read) */ | |
| 71 | +#define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes) | |
| 72 | + (struct cdrom_read) */ | |
| 73 | +#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ | |
| 74 | +#define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ | |
| 75 | +#define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session | |
| 76 | + address of multi session disks | |
| 77 | + (struct cdrom_multisession) */ | |
| 78 | +#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" | |
| 79 | + if available (struct cdrom_mcn) */ | |
| 80 | +#define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated, | |
| 81 | + but here anyway for compatibility */ | |
| 82 | +#define CDROMRESET 0x5312 /* hard-reset the drive */ | |
| 83 | +#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting | |
| 84 | + (struct cdrom_volctrl) */ | |
| 85 | +#define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) | |
| 86 | + (struct cdrom_read) */ | |
| 87 | +/* | |
| 88 | + * These ioctls are used only used in aztcd.c and optcd.c | |
| 89 | + */ | |
| 90 | +#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ | |
| 91 | +#define CDROMSEEK 0x5316 /* seek msf address */ | |
| 92 | + | |
| 93 | +/* | |
| 94 | + * This ioctl is only used by the scsi-cd driver. | |
| 95 | + It is for playing audio in logical block addressing mode. | |
| 96 | + */ | |
| 97 | +#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ | |
| 98 | + | |
| 99 | +/* | |
| 100 | + * These ioctls are only used in optcd.c | |
| 101 | + */ | |
| 102 | +#define CDROMREADALL 0x5318 /* read all 2646 bytes */ | |
| 103 | + | |
| 104 | +/* | |
| 105 | + * These ioctls are (now) only in ide-cd.c for controlling | |
| 106 | + * drive spindown time. They should be implemented in the | |
| 107 | + * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, | |
| 108 | + * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... | |
| 109 | + * -Erik | |
| 110 | + */ | |
| 111 | +#define CDROMGETSPINDOWN 0x531d | |
| 112 | +#define CDROMSETSPINDOWN 0x531e | |
| 113 | + | |
| 114 | +/* | |
| 115 | + * These ioctls are implemented through the uniform CD-ROM driver | |
| 116 | + * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM | |
| 117 | + * drivers are eventually ported to the uniform CD-ROM driver interface. | |
| 118 | + */ | |
| 119 | +#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ | |
| 120 | +#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ | |
| 121 | +#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ | |
| 122 | +#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ | |
| 123 | +#define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ | |
| 124 | +#define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ | |
| 125 | +#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ | |
| 126 | +#define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ | |
| 127 | +#define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ | |
| 128 | +#define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ | |
| 129 | +#define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ | |
| 130 | +#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ | |
| 131 | + | |
| 132 | +/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. | |
| 133 | + * Future CDROM ioctls should be kept below 0x537F | |
| 134 | + */ | |
| 135 | + | |
| 136 | +/* This ioctl is only used by sbpcd at the moment */ | |
| 137 | +#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ | |
| 138 | + /* conflict with SCSI_IOCTL_GET_IDLUN */ | |
| 139 | + | |
| 140 | +/* DVD-ROM Specific ioctls */ | |
| 141 | +#define DVD_READ_STRUCT 0x5390 /* Read structure */ | |
| 142 | +#define DVD_WRITE_STRUCT 0x5391 /* Write structure */ | |
| 143 | +#define DVD_AUTH 0x5392 /* Authentication */ | |
| 144 | + | |
| 145 | +#define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ | |
| 146 | +#define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ | |
| 147 | +#define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ | |
| 148 | + | |
| 149 | +/******************************************************* | |
| 150 | + * CDROM IOCTL structures | |
| 151 | + *******************************************************/ | |
| 152 | + | |
| 153 | +/* Address in MSF format */ | |
| 154 | +struct cdrom_msf0 | |
| 155 | +{ | |
| 156 | + __u8 minute; | |
| 157 | + __u8 second; | |
| 158 | + __u8 frame; | |
| 159 | +}; | |
| 160 | + | |
| 161 | +/* Address in either MSF or logical format */ | |
| 162 | +union cdrom_addr | |
| 163 | +{ | |
| 164 | + struct cdrom_msf0 msf; | |
| 165 | + int lba; | |
| 166 | +}; | |
| 167 | + | |
| 168 | +/* This struct is used by the CDROMPLAYMSF ioctl */ | |
| 169 | +struct cdrom_msf | |
| 170 | +{ | |
| 171 | + __u8 cdmsf_min0; /* start minute */ | |
| 172 | + __u8 cdmsf_sec0; /* start second */ | |
| 173 | + __u8 cdmsf_frame0; /* start frame */ | |
| 174 | + __u8 cdmsf_min1; /* end minute */ | |
| 175 | + __u8 cdmsf_sec1; /* end second */ | |
| 176 | + __u8 cdmsf_frame1; /* end frame */ | |
| 177 | +}; | |
| 178 | + | |
| 179 | +/* This struct is used by the CDROMPLAYTRKIND ioctl */ | |
| 180 | +struct cdrom_ti | |
| 181 | +{ | |
| 182 | + __u8 cdti_trk0; /* start track */ | |
| 183 | + __u8 cdti_ind0; /* start index */ | |
| 184 | + __u8 cdti_trk1; /* end track */ | |
| 185 | + __u8 cdti_ind1; /* end index */ | |
| 186 | +}; | |
| 187 | + | |
| 188 | +/* This struct is used by the CDROMREADTOCHDR ioctl */ | |
| 189 | +struct cdrom_tochdr | |
| 190 | +{ | |
| 191 | + __u8 cdth_trk0; /* start track */ | |
| 192 | + __u8 cdth_trk1; /* end track */ | |
| 193 | +}; | |
| 194 | + | |
| 195 | +/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ | |
| 196 | +struct cdrom_volctrl | |
| 197 | +{ | |
| 198 | + __u8 channel0; | |
| 199 | + __u8 channel1; | |
| 200 | + __u8 channel2; | |
| 201 | + __u8 channel3; | |
| 202 | +}; | |
| 203 | + | |
| 204 | +/* This struct is used by the CDROMSUBCHNL ioctl */ | |
| 205 | +struct cdrom_subchnl | |
| 206 | +{ | |
| 207 | + __u8 cdsc_format; | |
| 208 | + __u8 cdsc_audiostatus; | |
| 209 | + __u8 cdsc_adr: 4; | |
| 210 | + __u8 cdsc_ctrl: 4; | |
| 211 | + __u8 cdsc_trk; | |
| 212 | + __u8 cdsc_ind; | |
| 213 | + union cdrom_addr cdsc_absaddr; | |
| 214 | + union cdrom_addr cdsc_reladdr; | |
| 215 | +}; | |
| 216 | + | |
| 217 | + | |
| 218 | +/* This struct is used by the CDROMREADTOCENTRY ioctl */ | |
| 219 | +struct cdrom_tocentry | |
| 220 | +{ | |
| 221 | + __u8 cdte_track; | |
| 222 | + __u8 cdte_adr :4; | |
| 223 | + __u8 cdte_ctrl :4; | |
| 224 | + __u8 cdte_format; | |
| 225 | + union cdrom_addr cdte_addr; | |
| 226 | + __u8 cdte_datamode; | |
| 227 | +}; | |
| 228 | + | |
| 229 | +/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ | |
| 230 | +struct cdrom_read | |
| 231 | +{ | |
| 232 | + int cdread_lba; | |
| 233 | + char *cdread_bufaddr; | |
| 234 | + int cdread_buflen; | |
| 235 | +}; | |
| 236 | + | |
| 237 | +/* This struct is used by the CDROMREADAUDIO ioctl */ | |
| 238 | +struct cdrom_read_audio | |
| 239 | +{ | |
| 240 | + union cdrom_addr addr; /* frame address */ | |
| 241 | + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ | |
| 242 | + int nframes; /* number of 2352-byte-frames to read at once */ | |
| 243 | + __u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */ | |
| 244 | +}; | |
| 245 | + | |
| 246 | +/* This struct is used with the CDROMMULTISESSION ioctl */ | |
| 247 | +struct cdrom_multisession | |
| 248 | +{ | |
| 249 | + union cdrom_addr addr; /* frame address: start-of-last-session | |
| 250 | + (not the new "frame 16"!). Only valid | |
| 251 | + if the "xa_flag" is true. */ | |
| 252 | + __u8 xa_flag; /* 1: "is XA disk" */ | |
| 253 | + __u8 addr_format; /* CDROM_LBA or CDROM_MSF */ | |
| 254 | +}; | |
| 255 | + | |
| 256 | +/* This struct is used with the CDROM_GET_MCN ioctl. | |
| 257 | + * Very few audio discs actually have Universal Product Code information, | |
| 258 | + * which should just be the Medium Catalog Number on the box. Also note | |
| 259 | + * that the way the codeis written on CD is _not_ uniform across all discs! | |
| 260 | + */ | |
| 261 | +struct cdrom_mcn | |
| 262 | +{ | |
| 263 | + __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ | |
| 264 | +}; | |
| 265 | + | |
| 266 | +/* This is used by the CDROMPLAYBLK ioctl */ | |
| 267 | +struct cdrom_blk | |
| 268 | +{ | |
| 269 | + unsigned from; | |
| 270 | + unsigned short len; | |
| 271 | +}; | |
| 272 | + | |
| 273 | +#define CDROM_PACKET_SIZE 12 | |
| 274 | + | |
| 275 | +#define CGC_DATA_UNKNOWN 0 | |
| 276 | +#define CGC_DATA_WRITE 1 | |
| 277 | +#define CGC_DATA_READ 2 | |
| 278 | +#define CGC_DATA_NONE 3 | |
| 279 | + | |
| 280 | +/* for CDROM_PACKET_COMMAND ioctl */ | |
| 281 | +struct cdrom_generic_command | |
| 282 | +{ | |
| 283 | + unsigned char cmd[CDROM_PACKET_SIZE]; | |
| 284 | + unsigned char __user *buffer; | |
| 285 | + unsigned int buflen; | |
| 286 | + int stat; | |
| 287 | + struct request_sense __user *sense; | |
| 288 | + unsigned char data_direction; | |
| 289 | + int quiet; | |
| 290 | + int timeout; | |
| 291 | + void __user *reserved[1]; /* unused, actually */ | |
| 292 | +}; | |
| 293 | + | |
| 294 | +/* | |
| 295 | + * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, | |
| 296 | + * 2340, or 2352 bytes long. | |
| 297 | + | |
| 298 | +* Sector types of the standard CD-ROM data formats: | |
| 299 | + * | |
| 300 | + * format sector type user data size (bytes) | |
| 301 | + * ----------------------------------------------------------------------------- | |
| 302 | + * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) | |
| 303 | + * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) | |
| 304 | + * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) | |
| 305 | + * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) | |
| 306 | + * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) | |
| 307 | + * | |
| 308 | + * | |
| 309 | + * The layout of the standard CD-ROM data formats: | |
| 310 | + * ----------------------------------------------------------------------------- | |
| 311 | + * - audio (red): | audio_sample_bytes | | |
| 312 | + * | 2352 | | |
| 313 | + * | |
| 314 | + * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | | |
| 315 | + * | 12 - 4 - 2048 - 4 - 8 - 276 | | |
| 316 | + * | |
| 317 | + * - data (yellow, mode2): | sync - head - data | | |
| 318 | + * | 12 - 4 - 2336 | | |
| 319 | + * | |
| 320 | + * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | | |
| 321 | + * | 12 - 4 - 8 - 2048 - 4 - 276 | | |
| 322 | + * | |
| 323 | + * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | | |
| 324 | + * | 12 - 4 - 8 - 2324 - 4 | | |
| 325 | + * | |
| 326 | + */ | |
| 327 | + | |
| 328 | +/* Some generally useful CD-ROM information -- mostly based on the above */ | |
| 329 | +#define CD_MINS 74 /* max. minutes per CD, not really a limit */ | |
| 330 | +#define CD_SECS 60 /* seconds per minute */ | |
| 331 | +#define CD_FRAMES 75 /* frames per second */ | |
| 332 | +#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ | |
| 333 | +#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ | |
| 334 | +#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ | |
| 335 | +#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ | |
| 336 | +#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ | |
| 337 | +#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ | |
| 338 | +#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ | |
| 339 | +#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ | |
| 340 | +#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ | |
| 341 | +#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ | |
| 342 | +#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ | |
| 343 | +#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ | |
| 344 | +#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ | |
| 345 | +/* most drives don't deliver everything: */ | |
| 346 | +#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ | |
| 347 | +#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ | |
| 348 | + | |
| 349 | +#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ | |
| 350 | +#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ | |
| 351 | +#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ | |
| 352 | + | |
| 353 | +/* CD-ROM address types (cdrom_tocentry.cdte_format) */ | |
| 354 | +#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ | |
| 355 | +#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ | |
| 356 | + | |
| 357 | +/* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ | |
| 358 | +#define CDROM_DATA_TRACK 0x04 | |
| 359 | + | |
| 360 | +/* The leadout track is always 0xAA, regardless of # of tracks on disc */ | |
| 361 | +#define CDROM_LEADOUT 0xAA | |
| 362 | + | |
| 363 | +/* audio states (from SCSI-2, but seen with other drives, too) */ | |
| 364 | +#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ | |
| 365 | +#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ | |
| 366 | +#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ | |
| 367 | +#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ | |
| 368 | +#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ | |
| 369 | +#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ | |
| 370 | + | |
| 371 | +/* capability flags used with the uniform CD-ROM driver */ | |
| 372 | +#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ | |
| 373 | +#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ | |
| 374 | +#define CDC_LOCK 0x4 /* disable manual eject */ | |
| 375 | +#define CDC_SELECT_SPEED 0x8 /* programmable speed */ | |
| 376 | +#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ | |
| 377 | +#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ | |
| 378 | +#define CDC_MCN 0x40 /* Medium Catalog Number */ | |
| 379 | +#define CDC_MEDIA_CHANGED 0x80 /* media changed */ | |
| 380 | +#define CDC_PLAY_AUDIO 0x100 /* audio functions */ | |
| 381 | +#define CDC_RESET 0x200 /* hard reset device */ | |
| 382 | +#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ | |
| 383 | +#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ | |
| 384 | +#define CDC_CD_R 0x2000 /* drive is a CD-R */ | |
| 385 | +#define CDC_CD_RW 0x4000 /* drive is a CD-RW */ | |
| 386 | +#define CDC_DVD 0x8000 /* drive is a DVD */ | |
| 387 | +#define CDC_DVD_R 0x10000 /* drive can write DVD-R */ | |
| 388 | +#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ | |
| 389 | +#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ | |
| 390 | +#define CDC_MRW 0x80000 /* drive can read MRW */ | |
| 391 | +#define CDC_MRW_W 0x100000 /* drive can write MRW */ | |
| 392 | +#define CDC_RAM 0x200000 /* ok to open for WRITE */ | |
| 393 | + | |
| 394 | +/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ | |
| 395 | +#define CDS_NO_INFO 0 /* if not implemented */ | |
| 396 | +#define CDS_NO_DISC 1 | |
| 397 | +#define CDS_TRAY_OPEN 2 | |
| 398 | +#define CDS_DRIVE_NOT_READY 3 | |
| 399 | +#define CDS_DISC_OK 4 | |
| 400 | + | |
| 401 | +/* return values for the CDROM_DISC_STATUS ioctl */ | |
| 402 | +/* can also return CDS_NO_[INFO|DISC], from above */ | |
| 403 | +#define CDS_AUDIO 100 | |
| 404 | +#define CDS_DATA_1 101 | |
| 405 | +#define CDS_DATA_2 102 | |
| 406 | +#define CDS_XA_2_1 103 | |
| 407 | +#define CDS_XA_2_2 104 | |
| 408 | +#define CDS_MIXED 105 | |
| 409 | + | |
| 410 | +/* User-configurable behavior options for the uniform CD-ROM driver */ | |
| 411 | +#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ | |
| 412 | +#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ | |
| 413 | +#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ | |
| 414 | +#define CDO_LOCK 0x8 /* lock tray on open files */ | |
| 415 | +#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ | |
| 416 | + | |
| 417 | +/* Special codes used when specifying changer slots. */ | |
| 418 | +#define CDSL_NONE (INT_MAX-1) | |
| 419 | +#define CDSL_CURRENT INT_MAX | |
| 420 | + | |
| 421 | +/* For partition based multisession access. IDE can handle 64 partitions | |
| 422 | + * per drive - SCSI CD-ROM's use minors to differentiate between the | |
| 423 | + * various drives, so we can't do multisessions the same way there. | |
| 424 | + * Use the -o session=x option to mount on them. | |
| 425 | + */ | |
| 426 | +#define CD_PART_MAX 64 | |
| 427 | +#define CD_PART_MASK (CD_PART_MAX - 1) | |
| 428 | + | |
| 429 | +/********************************************************************* | |
| 430 | + * Generic Packet commands, MMC commands, and such | |
| 431 | + *********************************************************************/ | |
| 432 | + | |
| 433 | + /* The generic packet command opcodes for CD/DVD Logical Units, | |
| 434 | + * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ | |
| 435 | +#define GPCMD_BLANK 0xa1 | |
| 436 | +#define GPCMD_CLOSE_TRACK 0x5b | |
| 437 | +#define GPCMD_FLUSH_CACHE 0x35 | |
| 438 | +#define GPCMD_FORMAT_UNIT 0x04 | |
| 439 | +#define GPCMD_GET_CONFIGURATION 0x46 | |
| 440 | +#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a | |
| 441 | +#define GPCMD_GET_PERFORMANCE 0xac | |
| 442 | +#define GPCMD_INQUIRY 0x12 | |
| 443 | +#define GPCMD_LOAD_UNLOAD 0xa6 | |
| 444 | +#define GPCMD_MECHANISM_STATUS 0xbd | |
| 445 | +#define GPCMD_MODE_SELECT_10 0x55 | |
| 446 | +#define GPCMD_MODE_SENSE_10 0x5a | |
| 447 | +#define GPCMD_PAUSE_RESUME 0x4b | |
| 448 | +#define GPCMD_PLAY_AUDIO_10 0x45 | |
| 449 | +#define GPCMD_PLAY_AUDIO_MSF 0x47 | |
| 450 | +#define GPCMD_PLAY_AUDIO_TI 0x48 | |
| 451 | +#define GPCMD_PLAY_CD 0xbc | |
| 452 | +#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e | |
| 453 | +#define GPCMD_READ_10 0x28 | |
| 454 | +#define GPCMD_READ_12 0xa8 | |
| 455 | +#define GPCMD_READ_BUFFER 0x3c | |
| 456 | +#define GPCMD_READ_BUFFER_CAPACITY 0x5c | |
| 457 | +#define GPCMD_READ_CDVD_CAPACITY 0x25 | |
| 458 | +#define GPCMD_READ_CD 0xbe | |
| 459 | +#define GPCMD_READ_CD_MSF 0xb9 | |
| 460 | +#define GPCMD_READ_DISC_INFO 0x51 | |
| 461 | +#define GPCMD_READ_DVD_STRUCTURE 0xad | |
| 462 | +#define GPCMD_READ_FORMAT_CAPACITIES 0x23 | |
| 463 | +#define GPCMD_READ_HEADER 0x44 | |
| 464 | +#define GPCMD_READ_TRACK_RZONE_INFO 0x52 | |
| 465 | +#define GPCMD_READ_SUBCHANNEL 0x42 | |
| 466 | +#define GPCMD_READ_TOC_PMA_ATIP 0x43 | |
| 467 | +#define GPCMD_REPAIR_RZONE_TRACK 0x58 | |
| 468 | +#define GPCMD_REPORT_KEY 0xa4 | |
| 469 | +#define GPCMD_REQUEST_SENSE 0x03 | |
| 470 | +#define GPCMD_RESERVE_RZONE_TRACK 0x53 | |
| 471 | +#define GPCMD_SEND_CUE_SHEET 0x5d | |
| 472 | +#define GPCMD_SCAN 0xba | |
| 473 | +#define GPCMD_SEEK 0x2b | |
| 474 | +#define GPCMD_SEND_DVD_STRUCTURE 0xbf | |
| 475 | +#define GPCMD_SEND_EVENT 0xa2 | |
| 476 | +#define GPCMD_SEND_KEY 0xa3 | |
| 477 | +#define GPCMD_SEND_OPC 0x54 | |
| 478 | +#define GPCMD_SET_READ_AHEAD 0xa7 | |
| 479 | +#define GPCMD_SET_STREAMING 0xb6 | |
| 480 | +#define GPCMD_START_STOP_UNIT 0x1b | |
| 481 | +#define GPCMD_STOP_PLAY_SCAN 0x4e | |
| 482 | +#define GPCMD_TEST_UNIT_READY 0x00 | |
| 483 | +#define GPCMD_VERIFY_10 0x2f | |
| 484 | +#define GPCMD_WRITE_10 0x2a | |
| 485 | +#define GPCMD_WRITE_12 0xaa | |
| 486 | +#define GPCMD_WRITE_AND_VERIFY_10 0x2e | |
| 487 | +#define GPCMD_WRITE_BUFFER 0x3b | |
| 488 | +/* This is listed as optional in ATAPI 2.6, but is (curiously) | |
| 489 | + * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji | |
| 490 | + * Table 377 as an MMC command for SCSi devices though... Most ATAPI | |
| 491 | + * drives support it. */ | |
| 492 | +#define GPCMD_SET_SPEED 0xbb | |
| 493 | +/* This seems to be a SCSI specific CD-ROM opcode | |
| 494 | + * to play data at track/index */ | |
| 495 | +#define GPCMD_PLAYAUDIO_TI 0x48 | |
| 496 | +/* | |
| 497 | + * From MS Media Status Notification Support Specification. For | |
| 498 | + * older drives only. | |
| 499 | + */ | |
| 500 | +#define GPCMD_GET_MEDIA_STATUS 0xda | |
| 501 | + | |
| 502 | +/* Mode page codes for mode sense/set */ | |
| 503 | +#define GPMODE_VENDOR_PAGE 0x00 | |
| 504 | +#define GPMODE_R_W_ERROR_PAGE 0x01 | |
| 505 | +#define GPMODE_WRITE_PARMS_PAGE 0x05 | |
| 506 | +#define GPMODE_WCACHING_PAGE 0x08 | |
| 507 | +#define GPMODE_AUDIO_CTL_PAGE 0x0e | |
| 508 | +#define GPMODE_POWER_PAGE 0x1a | |
| 509 | +#define GPMODE_FAULT_FAIL_PAGE 0x1c | |
| 510 | +#define GPMODE_TO_PROTECT_PAGE 0x1d | |
| 511 | +#define GPMODE_CAPABILITIES_PAGE 0x2a | |
| 512 | +#define GPMODE_ALL_PAGES 0x3f | |
| 513 | +/* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor | |
| 514 | + * of MODE_SENSE_POWER_PAGE */ | |
| 515 | +#define GPMODE_CDROM_PAGE 0x0d | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | +/* DVD struct types */ | |
| 520 | +#define DVD_STRUCT_PHYSICAL 0x00 | |
| 521 | +#define DVD_STRUCT_COPYRIGHT 0x01 | |
| 522 | +#define DVD_STRUCT_DISCKEY 0x02 | |
| 523 | +#define DVD_STRUCT_BCA 0x03 | |
| 524 | +#define DVD_STRUCT_MANUFACT 0x04 | |
| 525 | + | |
| 526 | +struct dvd_layer { | |
| 527 | + __u8 book_version : 4; | |
| 528 | + __u8 book_type : 4; | |
| 529 | + __u8 min_rate : 4; | |
| 530 | + __u8 disc_size : 4; | |
| 531 | + __u8 layer_type : 4; | |
| 532 | + __u8 track_path : 1; | |
| 533 | + __u8 nlayers : 2; | |
| 534 | + __u8 track_density : 4; | |
| 535 | + __u8 linear_density : 4; | |
| 536 | + __u8 bca : 1; | |
| 537 | + __u32 start_sector; | |
| 538 | + __u32 end_sector; | |
| 539 | + __u32 end_sector_l0; | |
| 540 | +}; | |
| 541 | + | |
| 542 | +#define DVD_LAYERS 4 | |
| 543 | + | |
| 544 | +struct dvd_physical { | |
| 545 | + __u8 type; | |
| 546 | + __u8 layer_num; | |
| 547 | + struct dvd_layer layer[DVD_LAYERS]; | |
| 548 | +}; | |
| 549 | + | |
| 550 | +struct dvd_copyright { | |
| 551 | + __u8 type; | |
| 552 | + | |
| 553 | + __u8 layer_num; | |
| 554 | + __u8 cpst; | |
| 555 | + __u8 rmi; | |
| 556 | +}; | |
| 557 | + | |
| 558 | +struct dvd_disckey { | |
| 559 | + __u8 type; | |
| 560 | + | |
| 561 | + unsigned agid : 2; | |
| 562 | + __u8 value[2048]; | |
| 563 | +}; | |
| 564 | + | |
| 565 | +struct dvd_bca { | |
| 566 | + __u8 type; | |
| 567 | + | |
| 568 | + int len; | |
| 569 | + __u8 value[188]; | |
| 570 | +}; | |
| 571 | + | |
| 572 | +struct dvd_manufact { | |
| 573 | + __u8 type; | |
| 574 | + | |
| 575 | + __u8 layer_num; | |
| 576 | + int len; | |
| 577 | + __u8 value[2048]; | |
| 578 | +}; | |
| 579 | + | |
| 580 | +typedef union { | |
| 581 | + __u8 type; | |
| 582 | + | |
| 583 | + struct dvd_physical physical; | |
| 584 | + struct dvd_copyright copyright; | |
| 585 | + struct dvd_disckey disckey; | |
| 586 | + struct dvd_bca bca; | |
| 587 | + struct dvd_manufact manufact; | |
| 588 | +} dvd_struct; | |
| 589 | + | |
| 590 | +/* | |
| 591 | + * DVD authentication ioctl | |
| 592 | + */ | |
| 593 | + | |
| 594 | +/* Authentication states */ | |
| 595 | +#define DVD_LU_SEND_AGID 0 | |
| 596 | +#define DVD_HOST_SEND_CHALLENGE 1 | |
| 597 | +#define DVD_LU_SEND_KEY1 2 | |
| 598 | +#define DVD_LU_SEND_CHALLENGE 3 | |
| 599 | +#define DVD_HOST_SEND_KEY2 4 | |
| 600 | + | |
| 601 | +/* Termination states */ | |
| 602 | +#define DVD_AUTH_ESTABLISHED 5 | |
| 603 | +#define DVD_AUTH_FAILURE 6 | |
| 604 | + | |
| 605 | +/* Other functions */ | |
| 606 | +#define DVD_LU_SEND_TITLE_KEY 7 | |
| 607 | +#define DVD_LU_SEND_ASF 8 | |
| 608 | +#define DVD_INVALIDATE_AGID 9 | |
| 609 | +#define DVD_LU_SEND_RPC_STATE 10 | |
| 610 | +#define DVD_HOST_SEND_RPC_STATE 11 | |
| 611 | + | |
| 612 | +/* State data */ | |
| 613 | +typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ | |
| 614 | +typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ | |
| 615 | + | |
| 616 | +struct dvd_lu_send_agid { | |
| 617 | + __u8 type; | |
| 618 | + unsigned agid : 2; | |
| 619 | +}; | |
| 620 | + | |
| 621 | +struct dvd_host_send_challenge { | |
| 622 | + __u8 type; | |
| 623 | + unsigned agid : 2; | |
| 624 | + | |
| 625 | + dvd_challenge chal; | |
| 626 | +}; | |
| 627 | + | |
| 628 | +struct dvd_send_key { | |
| 629 | + __u8 type; | |
| 630 | + unsigned agid : 2; | |
| 631 | + | |
| 632 | + dvd_key key; | |
| 633 | +}; | |
| 634 | + | |
| 635 | +struct dvd_lu_send_challenge { | |
| 636 | + __u8 type; | |
| 637 | + unsigned agid : 2; | |
| 638 | + | |
| 639 | + dvd_challenge chal; | |
| 640 | +}; | |
| 641 | + | |
| 642 | +#define DVD_CPM_NO_COPYRIGHT 0 | |
| 643 | +#define DVD_CPM_COPYRIGHTED 1 | |
| 644 | + | |
| 645 | +#define DVD_CP_SEC_NONE 0 | |
| 646 | +#define DVD_CP_SEC_EXIST 1 | |
| 647 | + | |
| 648 | +#define DVD_CGMS_UNRESTRICTED 0 | |
| 649 | +#define DVD_CGMS_SINGLE 2 | |
| 650 | +#define DVD_CGMS_RESTRICTED 3 | |
| 651 | + | |
| 652 | +struct dvd_lu_send_title_key { | |
| 653 | + __u8 type; | |
| 654 | + unsigned agid : 2; | |
| 655 | + | |
| 656 | + dvd_key title_key; | |
| 657 | + int lba; | |
| 658 | + unsigned cpm : 1; | |
| 659 | + unsigned cp_sec : 1; | |
| 660 | + unsigned cgms : 2; | |
| 661 | +}; | |
| 662 | + | |
| 663 | +struct dvd_lu_send_asf { | |
| 664 | + __u8 type; | |
| 665 | + unsigned agid : 2; | |
| 666 | + | |
| 667 | + unsigned asf : 1; | |
| 668 | +}; | |
| 669 | + | |
| 670 | +struct dvd_host_send_rpcstate { | |
| 671 | + __u8 type; | |
| 672 | + __u8 pdrc; | |
| 673 | +}; | |
| 674 | + | |
| 675 | +struct dvd_lu_send_rpcstate { | |
| 676 | + __u8 type : 2; | |
| 677 | + __u8 vra : 3; | |
| 678 | + __u8 ucca : 3; | |
| 679 | + __u8 region_mask; | |
| 680 | + __u8 rpc_scheme; | |
| 681 | +}; | |
| 682 | + | |
| 683 | +typedef union { | |
| 684 | + __u8 type; | |
| 685 | + | |
| 686 | + struct dvd_lu_send_agid lsa; | |
| 687 | + struct dvd_host_send_challenge hsc; | |
| 688 | + struct dvd_send_key lsk; | |
| 689 | + struct dvd_lu_send_challenge lsc; | |
| 690 | + struct dvd_send_key hsk; | |
| 691 | + struct dvd_lu_send_title_key lstk; | |
| 692 | + struct dvd_lu_send_asf lsasf; | |
| 693 | + struct dvd_host_send_rpcstate hrpcs; | |
| 694 | + struct dvd_lu_send_rpcstate lrpcs; | |
| 695 | +} dvd_authinfo; | |
| 696 | + | |
| 697 | +struct request_sense { | |
| 698 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 699 | + __u8 valid : 1; | |
| 700 | + __u8 error_code : 7; | |
| 701 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 702 | + __u8 error_code : 7; | |
| 703 | + __u8 valid : 1; | |
| 704 | +#endif | |
| 705 | + __u8 segment_number; | |
| 706 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 707 | + __u8 reserved1 : 2; | |
| 708 | + __u8 ili : 1; | |
| 709 | + __u8 reserved2 : 1; | |
| 710 | + __u8 sense_key : 4; | |
| 711 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 712 | + __u8 sense_key : 4; | |
| 713 | + __u8 reserved2 : 1; | |
| 714 | + __u8 ili : 1; | |
| 715 | + __u8 reserved1 : 2; | |
| 716 | +#endif | |
| 717 | + __u8 information[4]; | |
| 718 | + __u8 add_sense_len; | |
| 719 | + __u8 command_info[4]; | |
| 720 | + __u8 asc; | |
| 721 | + __u8 ascq; | |
| 722 | + __u8 fruc; | |
| 723 | + __u8 sks[3]; | |
| 724 | + __u8 asb[46]; | |
| 725 | +}; | |
| 726 | + | |
| 727 | +/* | |
| 728 | + * feature profile | |
| 729 | + */ | |
| 730 | +#define CDF_RWRT 0x0020 /* "Random Writable" */ | |
| 731 | +#define CDF_HWDM 0x0024 /* "Hardware Defect Management" */ | |
| 732 | +#define CDF_MRW 0x0028 | |
| 733 | + | |
| 734 | +/* | |
| 735 | + * media status bits | |
| 736 | + */ | |
| 737 | +#define CDM_MRW_NOTMRW 0 | |
| 738 | +#define CDM_MRW_BGFORMAT_INACTIVE 1 | |
| 739 | +#define CDM_MRW_BGFORMAT_ACTIVE 2 | |
| 740 | +#define CDM_MRW_BGFORMAT_COMPLETE 3 | |
| 741 | + | |
| 742 | +/* | |
| 743 | + * mrw address spaces | |
| 744 | + */ | |
| 745 | +#define MRW_LBA_DMA 0 | |
| 746 | +#define MRW_LBA_GAA 1 | |
| 747 | + | |
| 748 | +/* | |
| 749 | + * mrw mode pages (first is deprecated) -- probed at init time and | |
| 750 | + * cdi->mrw_mode_page is set | |
| 751 | + */ | |
| 752 | +#define MRW_MODE_PC_PRE1 0x2c | |
| 753 | +#define MRW_MODE_PC 0x03 | |
| 754 | + | |
| 755 | +struct mrw_feature_desc { | |
| 756 | + __be16 feature_code; | |
| 757 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 758 | + __u8 reserved1 : 2; | |
| 759 | + __u8 feature_version : 4; | |
| 760 | + __u8 persistent : 1; | |
| 761 | + __u8 curr : 1; | |
| 762 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 763 | + __u8 curr : 1; | |
| 764 | + __u8 persistent : 1; | |
| 765 | + __u8 feature_version : 4; | |
| 766 | + __u8 reserved1 : 2; | |
| 767 | +#endif | |
| 768 | + __u8 add_len; | |
| 769 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 770 | + __u8 reserved2 : 7; | |
| 771 | + __u8 write : 1; | |
| 772 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 773 | + __u8 write : 1; | |
| 774 | + __u8 reserved2 : 7; | |
| 775 | +#endif | |
| 776 | + __u8 reserved3; | |
| 777 | + __u8 reserved4; | |
| 778 | + __u8 reserved5; | |
| 779 | +}; | |
| 780 | + | |
| 781 | +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ | |
| 782 | +struct rwrt_feature_desc { | |
| 783 | + __be16 feature_code; | |
| 784 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 785 | + __u8 reserved1 : 2; | |
| 786 | + __u8 feature_version : 4; | |
| 787 | + __u8 persistent : 1; | |
| 788 | + __u8 curr : 1; | |
| 789 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 790 | + __u8 curr : 1; | |
| 791 | + __u8 persistent : 1; | |
| 792 | + __u8 feature_version : 4; | |
| 793 | + __u8 reserved1 : 2; | |
| 794 | +#endif | |
| 795 | + __u8 add_len; | |
| 796 | + __u32 last_lba; | |
| 797 | + __u32 block_size; | |
| 798 | + __u16 blocking; | |
| 799 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 800 | + __u8 reserved2 : 7; | |
| 801 | + __u8 page_present : 1; | |
| 802 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 803 | + __u8 page_present : 1; | |
| 804 | + __u8 reserved2 : 7; | |
| 805 | +#endif | |
| 806 | + __u8 reserved3; | |
| 807 | +}; | |
| 808 | + | |
| 809 | +typedef struct { | |
| 810 | + __be16 disc_information_length; | |
| 811 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 812 | + __u8 reserved1 : 3; | |
| 813 | + __u8 erasable : 1; | |
| 814 | + __u8 border_status : 2; | |
| 815 | + __u8 disc_status : 2; | |
| 816 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 817 | + __u8 disc_status : 2; | |
| 818 | + __u8 border_status : 2; | |
| 819 | + __u8 erasable : 1; | |
| 820 | + __u8 reserved1 : 3; | |
| 821 | +#else | |
| 822 | +#error "Please fix <asm/byteorder.h>" | |
| 823 | +#endif | |
| 824 | + __u8 n_first_track; | |
| 825 | + __u8 n_sessions_lsb; | |
| 826 | + __u8 first_track_lsb; | |
| 827 | + __u8 last_track_lsb; | |
| 828 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 829 | + __u8 did_v : 1; | |
| 830 | + __u8 dbc_v : 1; | |
| 831 | + __u8 uru : 1; | |
| 832 | + __u8 reserved2 : 2; | |
| 833 | + __u8 dbit : 1; | |
| 834 | + __u8 mrw_status : 2; | |
| 835 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 836 | + __u8 mrw_status : 2; | |
| 837 | + __u8 dbit : 1; | |
| 838 | + __u8 reserved2 : 2; | |
| 839 | + __u8 uru : 1; | |
| 840 | + __u8 dbc_v : 1; | |
| 841 | + __u8 did_v : 1; | |
| 842 | +#endif | |
| 843 | + __u8 disc_type; | |
| 844 | + __u8 n_sessions_msb; | |
| 845 | + __u8 first_track_msb; | |
| 846 | + __u8 last_track_msb; | |
| 847 | + __u32 disc_id; | |
| 848 | + __u32 lead_in; | |
| 849 | + __u32 lead_out; | |
| 850 | + __u8 disc_bar_code[8]; | |
| 851 | + __u8 reserved3; | |
| 852 | + __u8 n_opc; | |
| 853 | +} disc_information; | |
| 854 | + | |
| 855 | +typedef struct { | |
| 856 | + __be16 track_information_length; | |
| 857 | + __u8 track_lsb; | |
| 858 | + __u8 session_lsb; | |
| 859 | + __u8 reserved1; | |
| 860 | +#if defined(__BIG_ENDIAN_BITFIELD) | |
| 861 | + __u8 reserved2 : 2; | |
| 862 | + __u8 damage : 1; | |
| 863 | + __u8 copy : 1; | |
| 864 | + __u8 track_mode : 4; | |
| 865 | + __u8 rt : 1; | |
| 866 | + __u8 blank : 1; | |
| 867 | + __u8 packet : 1; | |
| 868 | + __u8 fp : 1; | |
| 869 | + __u8 data_mode : 4; | |
| 870 | + __u8 reserved3 : 6; | |
| 871 | + __u8 lra_v : 1; | |
| 872 | + __u8 nwa_v : 1; | |
| 873 | +#elif defined(__LITTLE_ENDIAN_BITFIELD) | |
| 874 | + __u8 track_mode : 4; | |
| 875 | + __u8 copy : 1; | |
| 876 | + __u8 damage : 1; | |
| 877 | + __u8 reserved2 : 2; | |
| 878 | + __u8 data_mode : 4; | |
| 879 | + __u8 fp : 1; | |
| 880 | + __u8 packet : 1; | |
| 881 | + __u8 blank : 1; | |
| 882 | + __u8 rt : 1; | |
| 883 | + __u8 nwa_v : 1; | |
| 884 | + __u8 lra_v : 1; | |
| 885 | + __u8 reserved3 : 6; | |
| 886 | +#endif | |
| 887 | + __be32 track_start; | |
| 888 | + __be32 next_writable; | |
| 889 | + __be32 free_blocks; | |
| 890 | + __be32 fixed_packet_size; | |
| 891 | + __be32 track_size; | |
| 892 | + __be32 last_rec_address; | |
| 893 | +} track_information; | |
| 894 | + | |
| 895 | +struct feature_header { | |
| 896 | + __u32 data_len; | |
| 897 | + __u8 reserved1; | |
| 898 | + __u8 reserved2; | |
| 899 | + __u16 curr_profile; | |
| 900 | +}; | |
| 901 | + | |
| 902 | +struct mode_page_header { | |
| 903 | + __be16 mode_data_length; | |
| 904 | + __u8 medium_type; | |
| 905 | + __u8 reserved1; | |
| 906 | + __u8 reserved2; | |
| 907 | + __u8 reserved3; | |
| 908 | + __be16 desc_length; | |
| 909 | +}; | |
| 910 | + | |
| 911 | + | |
| 912 | +#endif /* _UAPI_LINUX_CDROM_H */ | |
| @@ -0,0 +1,71 @@ | ||
| 1 | +/* cgroupstats.h - exporting per-cgroup statistics | |
| 2 | + * | |
| 3 | + * Copyright IBM Corporation, 2007 | |
| 4 | + * Author Balbir Singh <balbir@linux.vnet.ibm.com> | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or modify it | |
| 7 | + * under the terms of version 2.1 of the GNU Lesser General Public License | |
| 8 | + * as published by the Free Software Foundation. | |
| 9 | + * | |
| 10 | + * This program is distributed in the hope that it would be useful, but | |
| 11 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 13 | + */ | |
| 14 | + | |
| 15 | +#ifndef _LINUX_CGROUPSTATS_H | |
| 16 | +#define _LINUX_CGROUPSTATS_H | |
| 17 | + | |
| 18 | +#include <linux/types.h> | |
| 19 | +#include <linux/taskstats.h> | |
| 20 | + | |
| 21 | +/* | |
| 22 | + * Data shared between user space and kernel space on a per cgroup | |
| 23 | + * basis. This data is shared using taskstats. | |
| 24 | + * | |
| 25 | + * Most of these states are derived by looking at the task->state value | |
| 26 | + * For the nr_io_wait state, a flag in the delay accounting structure | |
| 27 | + * indicates that the task is waiting on IO | |
| 28 | + * | |
| 29 | + * Each member is aligned to a 8 byte boundary. | |
| 30 | + */ | |
| 31 | +struct cgroupstats { | |
| 32 | + __u64 nr_sleeping; /* Number of tasks sleeping */ | |
| 33 | + __u64 nr_running; /* Number of tasks running */ | |
| 34 | + __u64 nr_stopped; /* Number of tasks in stopped state */ | |
| 35 | + __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */ | |
| 36 | + /* state */ | |
| 37 | + __u64 nr_io_wait; /* Number of tasks waiting on IO */ | |
| 38 | +}; | |
| 39 | + | |
| 40 | +/* | |
| 41 | + * Commands sent from userspace | |
| 42 | + * Not versioned. New commands should only be inserted at the enum's end | |
| 43 | + * prior to __CGROUPSTATS_CMD_MAX | |
| 44 | + */ | |
| 45 | + | |
| 46 | +enum { | |
| 47 | + CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */ | |
| 48 | + CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */ | |
| 49 | + CGROUPSTATS_CMD_NEW, /* kernel->user event */ | |
| 50 | + __CGROUPSTATS_CMD_MAX, | |
| 51 | +}; | |
| 52 | + | |
| 53 | +#define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1) | |
| 54 | + | |
| 55 | +enum { | |
| 56 | + CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */ | |
| 57 | + CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */ | |
| 58 | + __CGROUPSTATS_TYPE_MAX, | |
| 59 | +}; | |
| 60 | + | |
| 61 | +#define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1) | |
| 62 | + | |
| 63 | +enum { | |
| 64 | + CGROUPSTATS_CMD_ATTR_UNSPEC = 0, | |
| 65 | + CGROUPSTATS_CMD_ATTR_FD, | |
| 66 | + __CGROUPSTATS_CMD_ATTR_MAX, | |
| 67 | +}; | |
| 68 | + | |
| 69 | +#define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1) | |
| 70 | + | |
| 71 | +#endif /* _LINUX_CGROUPSTATS_H */ | |
| @@ -0,0 +1,168 @@ | ||
| 1 | +/* | |
| 2 | + * ioctl interface for the scsi media changer driver | |
| 3 | + */ | |
| 4 | + | |
| 5 | +/* changer element types */ | |
| 6 | +#define CHET_MT 0 /* media transport element (robot) */ | |
| 7 | +#define CHET_ST 1 /* storage element (media slots) */ | |
| 8 | +#define CHET_IE 2 /* import/export element */ | |
| 9 | +#define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */ | |
| 10 | +#define CHET_V1 4 /* vendor specific #1 */ | |
| 11 | +#define CHET_V2 5 /* vendor specific #2 */ | |
| 12 | +#define CHET_V3 6 /* vendor specific #3 */ | |
| 13 | +#define CHET_V4 7 /* vendor specific #4 */ | |
| 14 | + | |
| 15 | + | |
| 16 | +/* | |
| 17 | + * CHIOGPARAMS | |
| 18 | + * query changer properties | |
| 19 | + * | |
| 20 | + * CHIOVGPARAMS | |
| 21 | + * query vendor-specific element types | |
| 22 | + * | |
| 23 | + * accessing elements works by specifing type and unit of the element. | |
| 24 | + * for example, storage elements are addressed with type = CHET_ST and | |
| 25 | + * unit = 0 .. cp_nslots-1 | |
| 26 | + * | |
| 27 | + */ | |
| 28 | +struct changer_params { | |
| 29 | + int cp_curpicker; /* current transport element */ | |
| 30 | + int cp_npickers; /* number of transport elements (CHET_MT) */ | |
| 31 | + int cp_nslots; /* number of storage elements (CHET_ST) */ | |
| 32 | + int cp_nportals; /* number of import/export elements (CHET_IE) */ | |
| 33 | + int cp_ndrives; /* number of data transfer elements (CHET_DT) */ | |
| 34 | +}; | |
| 35 | +struct changer_vendor_params { | |
| 36 | + int cvp_n1; /* number of vendor specific elems (CHET_V1) */ | |
| 37 | + char cvp_label1[16]; | |
| 38 | + int cvp_n2; /* number of vendor specific elems (CHET_V2) */ | |
| 39 | + char cvp_label2[16]; | |
| 40 | + int cvp_n3; /* number of vendor specific elems (CHET_V3) */ | |
| 41 | + char cvp_label3[16]; | |
| 42 | + int cvp_n4; /* number of vendor specific elems (CHET_V4) */ | |
| 43 | + char cvp_label4[16]; | |
| 44 | + int reserved[8]; | |
| 45 | +}; | |
| 46 | + | |
| 47 | + | |
| 48 | +/* | |
| 49 | + * CHIOMOVE | |
| 50 | + * move a medium from one element to another | |
| 51 | + */ | |
| 52 | +struct changer_move { | |
| 53 | + int cm_fromtype; /* type/unit of source element */ | |
| 54 | + int cm_fromunit; | |
| 55 | + int cm_totype; /* type/unit of destination element */ | |
| 56 | + int cm_tounit; | |
| 57 | + int cm_flags; | |
| 58 | +}; | |
| 59 | +#define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */ | |
| 60 | + | |
| 61 | + | |
| 62 | +/* | |
| 63 | + * CHIOEXCHANGE | |
| 64 | + * move one medium from element #1 to element #2, | |
| 65 | + * and another one from element #2 to element #3. | |
| 66 | + * element #1 and #3 are allowed to be identical. | |
| 67 | + */ | |
| 68 | +struct changer_exchange { | |
| 69 | + int ce_srctype; /* type/unit of element #1 */ | |
| 70 | + int ce_srcunit; | |
| 71 | + int ce_fdsttype; /* type/unit of element #2 */ | |
| 72 | + int ce_fdstunit; | |
| 73 | + int ce_sdsttype; /* type/unit of element #3 */ | |
| 74 | + int ce_sdstunit; | |
| 75 | + int ce_flags; | |
| 76 | +}; | |
| 77 | +#define CE_INVERT1 1 | |
| 78 | +#define CE_INVERT2 2 | |
| 79 | + | |
| 80 | + | |
| 81 | +/* | |
| 82 | + * CHIOPOSITION | |
| 83 | + * move the transport element (robot arm) to a specific element. | |
| 84 | + */ | |
| 85 | +struct changer_position { | |
| 86 | + int cp_type; | |
| 87 | + int cp_unit; | |
| 88 | + int cp_flags; | |
| 89 | +}; | |
| 90 | +#define CP_INVERT 1 | |
| 91 | + | |
| 92 | + | |
| 93 | +/* | |
| 94 | + * CHIOGSTATUS | |
| 95 | + * get element status for all elements of a specific type | |
| 96 | + */ | |
| 97 | +struct changer_element_status { | |
| 98 | + int ces_type; | |
| 99 | + unsigned char __user *ces_data; | |
| 100 | +}; | |
| 101 | +#define CESTATUS_FULL 0x01 /* full */ | |
| 102 | +#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ | |
| 103 | +#define CESTATUS_EXCEPT 0x04 /* error condition */ | |
| 104 | +#define CESTATUS_ACCESS 0x08 /* access allowed */ | |
| 105 | +#define CESTATUS_EXENAB 0x10 /* element can export media */ | |
| 106 | +#define CESTATUS_INENAB 0x20 /* element can import media */ | |
| 107 | + | |
| 108 | + | |
| 109 | +/* | |
| 110 | + * CHIOGELEM | |
| 111 | + * get more detailed status information for a single element | |
| 112 | + */ | |
| 113 | +struct changer_get_element { | |
| 114 | + int cge_type; /* type/unit */ | |
| 115 | + int cge_unit; | |
| 116 | + int cge_status; /* status */ | |
| 117 | + int cge_errno; /* errno */ | |
| 118 | + int cge_srctype; /* source element of the last move/exchange */ | |
| 119 | + int cge_srcunit; | |
| 120 | + int cge_id; /* scsi id (for data transfer elements) */ | |
| 121 | + int cge_lun; /* scsi lun (for data transfer elements) */ | |
| 122 | + char cge_pvoltag[36]; /* primary volume tag */ | |
| 123 | + char cge_avoltag[36]; /* alternate volume tag */ | |
| 124 | + int cge_flags; | |
| 125 | +}; | |
| 126 | +/* flags */ | |
| 127 | +#define CGE_ERRNO 0x01 /* errno available */ | |
| 128 | +#define CGE_INVERT 0x02 /* media inverted */ | |
| 129 | +#define CGE_SRC 0x04 /* media src available */ | |
| 130 | +#define CGE_IDLUN 0x08 /* ID+LUN available */ | |
| 131 | +#define CGE_PVOLTAG 0x10 /* primary volume tag available */ | |
| 132 | +#define CGE_AVOLTAG 0x20 /* alternate volume tag available */ | |
| 133 | + | |
| 134 | + | |
| 135 | +/* | |
| 136 | + * CHIOSVOLTAG | |
| 137 | + * set volume tag | |
| 138 | + */ | |
| 139 | +struct changer_set_voltag { | |
| 140 | + int csv_type; /* type/unit */ | |
| 141 | + int csv_unit; | |
| 142 | + char csv_voltag[36]; /* volume tag */ | |
| 143 | + int csv_flags; | |
| 144 | +}; | |
| 145 | +#define CSV_PVOLTAG 0x01 /* primary volume tag */ | |
| 146 | +#define CSV_AVOLTAG 0x02 /* alternate volume tag */ | |
| 147 | +#define CSV_CLEARTAG 0x04 /* clear volume tag */ | |
| 148 | + | |
| 149 | +/* ioctls */ | |
| 150 | +#define CHIOMOVE _IOW('c', 1,struct changer_move) | |
| 151 | +#define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange) | |
| 152 | +#define CHIOPOSITION _IOW('c', 3,struct changer_position) | |
| 153 | +#define CHIOGPICKER _IOR('c', 4,int) /* not impl. */ | |
| 154 | +#define CHIOSPICKER _IOW('c', 5,int) /* not impl. */ | |
| 155 | +#define CHIOGPARAMS _IOR('c', 6,struct changer_params) | |
| 156 | +#define CHIOGSTATUS _IOW('c', 8,struct changer_element_status) | |
| 157 | +#define CHIOGELEM _IOW('c',16,struct changer_get_element) | |
| 158 | +#define CHIOINITELEM _IO('c',17) | |
| 159 | +#define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag) | |
| 160 | +#define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params) | |
| 161 | + | |
| 162 | +/* ---------------------------------------------------------------------- */ | |
| 163 | + | |
| 164 | +/* | |
| 165 | + * Local variables: | |
| 166 | + * c-basic-offset: 8 | |
| 167 | + * End: | |
| 168 | + */ | |
| @@ -0,0 +1,62 @@ | ||
| 1 | +#ifndef _UAPI_CM4000_H_ | |
| 2 | +#define _UAPI_CM4000_H_ | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +#define MAX_ATR 33 | |
| 7 | + | |
| 8 | +#define CM4000_MAX_DEV 4 | |
| 9 | + | |
| 10 | +/* those two structures are passed via ioctl() from/to userspace. They are | |
| 11 | + * used by existing userspace programs, so I kepth the awkward "bIFSD" naming | |
| 12 | + * not to break compilation of userspace apps. -HW */ | |
| 13 | + | |
| 14 | +typedef struct atreq { | |
| 15 | + __s32 atr_len; | |
| 16 | + unsigned char atr[64]; | |
| 17 | + __s32 power_act; | |
| 18 | + unsigned char bIFSD; | |
| 19 | + unsigned char bIFSC; | |
| 20 | +} atreq_t; | |
| 21 | + | |
| 22 | + | |
| 23 | +/* what is particularly stupid in the original driver is the arch-dependent | |
| 24 | + * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace | |
| 25 | + * will lay out the structure members differently than the 64bit kernel. | |
| 26 | + * | |
| 27 | + * I've changed "ptsreq.protocol" from "unsigned long" to "__u32". | |
| 28 | + * On 32bit this will make no difference. With 64bit kernels, it will make | |
| 29 | + * 32bit apps work, too. | |
| 30 | + */ | |
| 31 | + | |
| 32 | +typedef struct ptsreq { | |
| 33 | + __u32 protocol; /*T=0: 2^0, T=1: 2^1*/ | |
| 34 | + unsigned char flags; | |
| 35 | + unsigned char pts1; | |
| 36 | + unsigned char pts2; | |
| 37 | + unsigned char pts3; | |
| 38 | +} ptsreq_t; | |
| 39 | + | |
| 40 | +#define CM_IOC_MAGIC 'c' | |
| 41 | +#define CM_IOC_MAXNR 255 | |
| 42 | + | |
| 43 | +#define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *) | |
| 44 | +#define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *) | |
| 45 | +#define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *) | |
| 46 | +#define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3) | |
| 47 | +#define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4) | |
| 48 | + | |
| 49 | +#define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*) | |
| 50 | + | |
| 51 | +/* card and device states */ | |
| 52 | +#define CM_CARD_INSERTED 0x01 | |
| 53 | +#define CM_CARD_POWERED 0x02 | |
| 54 | +#define CM_ATR_PRESENT 0x04 | |
| 55 | +#define CM_ATR_VALID 0x08 | |
| 56 | +#define CM_STATE_VALID 0x0f | |
| 57 | +/* extra info only from CM4000 */ | |
| 58 | +#define CM_NO_READER 0x10 | |
| 59 | +#define CM_BAD_CARD 0x20 | |
| 60 | + | |
| 61 | + | |
| 62 | +#endif /* _UAPI_CM4000_H_ */ | |
| @@ -0,0 +1,121 @@ | ||
| 1 | +/* | |
| 2 | + * cn_proc.h - process events connector | |
| 3 | + * | |
| 4 | + * Copyright (C) Matt Helsley, IBM Corp. 2005 | |
| 5 | + * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin | |
| 6 | + * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com> | |
| 7 | + * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net> | |
| 8 | + * | |
| 9 | + * This program is free software; you can redistribute it and/or modify it | |
| 10 | + * under the terms of version 2.1 of the GNU Lesser General Public License | |
| 11 | + * as published by the Free Software Foundation. | |
| 12 | + * | |
| 13 | + * This program is distributed in the hope that it would be useful, but | |
| 14 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#ifndef _UAPICN_PROC_H | |
| 19 | +#define _UAPICN_PROC_H | |
| 20 | + | |
| 21 | +#include <linux/types.h> | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * Userspace sends this enum to register with the kernel that it is listening | |
| 25 | + * for events on the connector. | |
| 26 | + */ | |
| 27 | +enum proc_cn_mcast_op { | |
| 28 | + PROC_CN_MCAST_LISTEN = 1, | |
| 29 | + PROC_CN_MCAST_IGNORE = 2 | |
| 30 | +}; | |
| 31 | + | |
| 32 | +/* | |
| 33 | + * From the user's point of view, the process | |
| 34 | + * ID is the thread group ID and thread ID is the internal | |
| 35 | + * kernel "pid". So, fields are assigned as follow: | |
| 36 | + * | |
| 37 | + * In user space - In kernel space | |
| 38 | + * | |
| 39 | + * parent process ID = parent->tgid | |
| 40 | + * parent thread ID = parent->pid | |
| 41 | + * child process ID = child->tgid | |
| 42 | + * child thread ID = child->pid | |
| 43 | + */ | |
| 44 | + | |
| 45 | +struct proc_event { | |
| 46 | + enum what { | |
| 47 | + /* Use successive bits so the enums can be used to record | |
| 48 | + * sets of events as well | |
| 49 | + */ | |
| 50 | + PROC_EVENT_NONE = 0x00000000, | |
| 51 | + PROC_EVENT_FORK = 0x00000001, | |
| 52 | + PROC_EVENT_EXEC = 0x00000002, | |
| 53 | + PROC_EVENT_UID = 0x00000004, | |
| 54 | + PROC_EVENT_GID = 0x00000040, | |
| 55 | + PROC_EVENT_SID = 0x00000080, | |
| 56 | + PROC_EVENT_PTRACE = 0x00000100, | |
| 57 | + PROC_EVENT_COMM = 0x00000200, | |
| 58 | + /* "next" should be 0x00000400 */ | |
| 59 | + /* "last" is the last process event: exit */ | |
| 60 | + PROC_EVENT_EXIT = 0x80000000 | |
| 61 | + } what; | |
| 62 | + __u32 cpu; | |
| 63 | + __u64 __attribute__((aligned(8))) timestamp_ns; | |
| 64 | + /* Number of nano seconds since system boot */ | |
| 65 | + union { /* must be last field of proc_event struct */ | |
| 66 | + struct { | |
| 67 | + __u32 err; | |
| 68 | + } ack; | |
| 69 | + | |
| 70 | + struct fork_proc_event { | |
| 71 | + __kernel_pid_t parent_pid; | |
| 72 | + __kernel_pid_t parent_tgid; | |
| 73 | + __kernel_pid_t child_pid; | |
| 74 | + __kernel_pid_t child_tgid; | |
| 75 | + } fork; | |
| 76 | + | |
| 77 | + struct exec_proc_event { | |
| 78 | + __kernel_pid_t process_pid; | |
| 79 | + __kernel_pid_t process_tgid; | |
| 80 | + } exec; | |
| 81 | + | |
| 82 | + struct id_proc_event { | |
| 83 | + __kernel_pid_t process_pid; | |
| 84 | + __kernel_pid_t process_tgid; | |
| 85 | + union { | |
| 86 | + __u32 ruid; /* task uid */ | |
| 87 | + __u32 rgid; /* task gid */ | |
| 88 | + } r; | |
| 89 | + union { | |
| 90 | + __u32 euid; | |
| 91 | + __u32 egid; | |
| 92 | + } e; | |
| 93 | + } id; | |
| 94 | + | |
| 95 | + struct sid_proc_event { | |
| 96 | + __kernel_pid_t process_pid; | |
| 97 | + __kernel_pid_t process_tgid; | |
| 98 | + } sid; | |
| 99 | + | |
| 100 | + struct ptrace_proc_event { | |
| 101 | + __kernel_pid_t process_pid; | |
| 102 | + __kernel_pid_t process_tgid; | |
| 103 | + __kernel_pid_t tracer_pid; | |
| 104 | + __kernel_pid_t tracer_tgid; | |
| 105 | + } ptrace; | |
| 106 | + | |
| 107 | + struct comm_proc_event { | |
| 108 | + __kernel_pid_t process_pid; | |
| 109 | + __kernel_pid_t process_tgid; | |
| 110 | + char comm[16]; | |
| 111 | + } comm; | |
| 112 | + | |
| 113 | + struct exit_proc_event { | |
| 114 | + __kernel_pid_t process_pid; | |
| 115 | + __kernel_pid_t process_tgid; | |
| 116 | + __u32 exit_code, exit_signal; | |
| 117 | + } exit; | |
| 118 | + } event_data; | |
| 119 | +}; | |
| 120 | + | |
| 121 | +#endif /* _UAPICN_PROC_H */ | |
| @@ -0,0 +1,741 @@ | ||
| 1 | +/* | |
| 2 | + You may distribute this file under either of the two licenses that | |
| 3 | + follow at your discretion. | |
| 4 | +*/ | |
| 5 | + | |
| 6 | +/* BLURB lgpl | |
| 7 | + | |
| 8 | + Coda File System | |
| 9 | + Release 5 | |
| 10 | + | |
| 11 | + Copyright (c) 1987-1999 Carnegie Mellon University | |
| 12 | + Additional copyrights listed below | |
| 13 | + | |
| 14 | +This code is distributed "AS IS" without warranty of any kind under | |
| 15 | +the terms of the GNU Library General Public Licence Version 2, as | |
| 16 | +shown in the file LICENSE, or under the license shown below. The | |
| 17 | +technical and financial contributors to Coda are listed in the file | |
| 18 | +CREDITS. | |
| 19 | + | |
| 20 | + Additional copyrights | |
| 21 | +*/ | |
| 22 | + | |
| 23 | +/* | |
| 24 | + | |
| 25 | + Coda: an Experimental Distributed File System | |
| 26 | + Release 4.0 | |
| 27 | + | |
| 28 | + Copyright (c) 1987-1999 Carnegie Mellon University | |
| 29 | + All Rights Reserved | |
| 30 | + | |
| 31 | +Permission to use, copy, modify and distribute this software and its | |
| 32 | +documentation is hereby granted, provided that both the copyright | |
| 33 | +notice and this permission notice appear in all copies of the | |
| 34 | +software, derivative works or modified versions, and any portions | |
| 35 | +thereof, and that both notices appear in supporting documentation, and | |
| 36 | +that credit is given to Carnegie Mellon University in all documents | |
| 37 | +and publicity pertaining to direct or indirect use of this code or its | |
| 38 | +derivatives. | |
| 39 | + | |
| 40 | +CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, | |
| 41 | +SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS | |
| 42 | +FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON | |
| 43 | +DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER | |
| 44 | +RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF | |
| 45 | +ANY DERIVATIVE WORK. | |
| 46 | + | |
| 47 | +Carnegie Mellon encourages users of this software to return any | |
| 48 | +improvements or extensions that they make, and to grant Carnegie | |
| 49 | +Mellon the rights to redistribute these changes without encumbrance. | |
| 50 | +*/ | |
| 51 | + | |
| 52 | +/* | |
| 53 | + * | |
| 54 | + * Based on cfs.h from Mach, but revamped for increased simplicity. | |
| 55 | + * Linux modifications by | |
| 56 | + * Peter Braam, Aug 1996 | |
| 57 | + */ | |
| 58 | + | |
| 59 | +#ifndef _UAPI_CODA_HEADER_ | |
| 60 | +#define _UAPI_CODA_HEADER_ | |
| 61 | + | |
| 62 | + | |
| 63 | +/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */ | |
| 64 | +#if defined(__NetBSD__) || \ | |
| 65 | + ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL)) | |
| 66 | +#include <sys/types.h> | |
| 67 | +#endif | |
| 68 | + | |
| 69 | +#ifndef CODA_MAXSYMLINKS | |
| 70 | +#define CODA_MAXSYMLINKS 10 | |
| 71 | +#endif | |
| 72 | + | |
| 73 | +#if defined(DJGPP) || defined(__CYGWIN32__) | |
| 74 | +#ifdef KERNEL | |
| 75 | +typedef unsigned long u_long; | |
| 76 | +typedef unsigned int u_int; | |
| 77 | +typedef unsigned short u_short; | |
| 78 | +typedef u_long ino_t; | |
| 79 | +typedef u_long dev_t; | |
| 80 | +typedef void * caddr_t; | |
| 81 | +#ifdef DOS | |
| 82 | +typedef unsigned __int64 u_quad_t; | |
| 83 | +#else | |
| 84 | +typedef unsigned long long u_quad_t; | |
| 85 | +#endif | |
| 86 | + | |
| 87 | +#define inline | |
| 88 | + | |
| 89 | +struct timespec { | |
| 90 | + long ts_sec; | |
| 91 | + long ts_nsec; | |
| 92 | +}; | |
| 93 | +#else /* DJGPP but not KERNEL */ | |
| 94 | +#include <sys/time.h> | |
| 95 | +typedef unsigned long long u_quad_t; | |
| 96 | +#endif /* !KERNEL */ | |
| 97 | +#endif /* !DJGPP */ | |
| 98 | + | |
| 99 | + | |
| 100 | +#if defined(__linux__) | |
| 101 | +#include <linux/time.h> | |
| 102 | +#define cdev_t u_quad_t | |
| 103 | +#ifndef __KERNEL__ | |
| 104 | +#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) | |
| 105 | +#define _UQUAD_T_ 1 | |
| 106 | +typedef unsigned long long u_quad_t; | |
| 107 | +#endif | |
| 108 | +#endif /* __KERNEL__ */ | |
| 109 | +#else | |
| 110 | +#define cdev_t dev_t | |
| 111 | +#endif | |
| 112 | + | |
| 113 | +#ifdef __CYGWIN32__ | |
| 114 | +struct timespec { | |
| 115 | + time_t tv_sec; /* seconds */ | |
| 116 | + long tv_nsec; /* nanoseconds */ | |
| 117 | +}; | |
| 118 | +#endif | |
| 119 | + | |
| 120 | +#ifndef __BIT_TYPES_DEFINED__ | |
| 121 | +#define __BIT_TYPES_DEFINED__ | |
| 122 | +typedef signed char int8_t; | |
| 123 | +typedef unsigned char u_int8_t; | |
| 124 | +typedef short int16_t; | |
| 125 | +typedef unsigned short u_int16_t; | |
| 126 | +typedef int int32_t; | |
| 127 | +typedef unsigned int u_int32_t; | |
| 128 | +#endif | |
| 129 | + | |
| 130 | + | |
| 131 | +/* | |
| 132 | + * Cfs constants | |
| 133 | + */ | |
| 134 | +#define CODA_MAXNAMLEN 255 | |
| 135 | +#define CODA_MAXPATHLEN 1024 | |
| 136 | +#define CODA_MAXSYMLINK 10 | |
| 137 | + | |
| 138 | +/* these are Coda's version of O_RDONLY etc combinations | |
| 139 | + * to deal with VFS open modes | |
| 140 | + */ | |
| 141 | +#define C_O_READ 0x001 | |
| 142 | +#define C_O_WRITE 0x002 | |
| 143 | +#define C_O_TRUNC 0x010 | |
| 144 | +#define C_O_EXCL 0x100 | |
| 145 | +#define C_O_CREAT 0x200 | |
| 146 | + | |
| 147 | +/* these are to find mode bits in Venus */ | |
| 148 | +#define C_M_READ 00400 | |
| 149 | +#define C_M_WRITE 00200 | |
| 150 | + | |
| 151 | +/* for access Venus will use */ | |
| 152 | +#define C_A_C_OK 8 /* Test for writing upon create. */ | |
| 153 | +#define C_A_R_OK 4 /* Test for read permission. */ | |
| 154 | +#define C_A_W_OK 2 /* Test for write permission. */ | |
| 155 | +#define C_A_X_OK 1 /* Test for execute permission. */ | |
| 156 | +#define C_A_F_OK 0 /* Test for existence. */ | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | +#ifndef _VENUS_DIRENT_T_ | |
| 161 | +#define _VENUS_DIRENT_T_ 1 | |
| 162 | +struct venus_dirent { | |
| 163 | + u_int32_t d_fileno; /* file number of entry */ | |
| 164 | + u_int16_t d_reclen; /* length of this record */ | |
| 165 | + u_int8_t d_type; /* file type, see below */ | |
| 166 | + u_int8_t d_namlen; /* length of string in d_name */ | |
| 167 | + char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ | |
| 168 | +}; | |
| 169 | +#undef DIRSIZ | |
| 170 | +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ | |
| 171 | + (((dp)->d_namlen+1 + 3) &~ 3)) | |
| 172 | + | |
| 173 | +/* | |
| 174 | + * File types | |
| 175 | + */ | |
| 176 | +#define CDT_UNKNOWN 0 | |
| 177 | +#define CDT_FIFO 1 | |
| 178 | +#define CDT_CHR 2 | |
| 179 | +#define CDT_DIR 4 | |
| 180 | +#define CDT_BLK 6 | |
| 181 | +#define CDT_REG 8 | |
| 182 | +#define CDT_LNK 10 | |
| 183 | +#define CDT_SOCK 12 | |
| 184 | +#define CDT_WHT 14 | |
| 185 | + | |
| 186 | +/* | |
| 187 | + * Convert between stat structure types and directory types. | |
| 188 | + */ | |
| 189 | +#define IFTOCDT(mode) (((mode) & 0170000) >> 12) | |
| 190 | +#define CDTTOIF(dirtype) ((dirtype) << 12) | |
| 191 | + | |
| 192 | +#endif | |
| 193 | + | |
| 194 | +#ifndef _VUID_T_ | |
| 195 | +#define _VUID_T_ | |
| 196 | +typedef u_int32_t vuid_t; | |
| 197 | +typedef u_int32_t vgid_t; | |
| 198 | +#endif /*_VUID_T_ */ | |
| 199 | + | |
| 200 | +struct CodaFid { | |
| 201 | + u_int32_t opaque[4]; | |
| 202 | +}; | |
| 203 | + | |
| 204 | +#define coda_f2i(fid)\ | |
| 205 | + (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) | |
| 206 | + | |
| 207 | +#ifndef _VENUS_VATTR_T_ | |
| 208 | +#define _VENUS_VATTR_T_ | |
| 209 | +/* | |
| 210 | + * Vnode types. VNON means no type. | |
| 211 | + */ | |
| 212 | +enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; | |
| 213 | + | |
| 214 | +struct coda_vattr { | |
| 215 | + long va_type; /* vnode type (for create) */ | |
| 216 | + u_short va_mode; /* files access mode and type */ | |
| 217 | + short va_nlink; /* number of references to file */ | |
| 218 | + vuid_t va_uid; /* owner user id */ | |
| 219 | + vgid_t va_gid; /* owner group id */ | |
| 220 | + long va_fileid; /* file id */ | |
| 221 | + u_quad_t va_size; /* file size in bytes */ | |
| 222 | + long va_blocksize; /* blocksize preferred for i/o */ | |
| 223 | + struct timespec va_atime; /* time of last access */ | |
| 224 | + struct timespec va_mtime; /* time of last modification */ | |
| 225 | + struct timespec va_ctime; /* time file changed */ | |
| 226 | + u_long va_gen; /* generation number of file */ | |
| 227 | + u_long va_flags; /* flags defined for file */ | |
| 228 | + cdev_t va_rdev; /* device special file represents */ | |
| 229 | + u_quad_t va_bytes; /* bytes of disk space held by file */ | |
| 230 | + u_quad_t va_filerev; /* file modification number */ | |
| 231 | +}; | |
| 232 | + | |
| 233 | +#endif | |
| 234 | + | |
| 235 | +/* structure used by CODA_STATFS for getting cache information from venus */ | |
| 236 | +struct coda_statfs { | |
| 237 | + int32_t f_blocks; | |
| 238 | + int32_t f_bfree; | |
| 239 | + int32_t f_bavail; | |
| 240 | + int32_t f_files; | |
| 241 | + int32_t f_ffree; | |
| 242 | +}; | |
| 243 | + | |
| 244 | +/* | |
| 245 | + * Kernel <--> Venus communications. | |
| 246 | + */ | |
| 247 | + | |
| 248 | +#define CODA_ROOT 2 | |
| 249 | +#define CODA_OPEN_BY_FD 3 | |
| 250 | +#define CODA_OPEN 4 | |
| 251 | +#define CODA_CLOSE 5 | |
| 252 | +#define CODA_IOCTL 6 | |
| 253 | +#define CODA_GETATTR 7 | |
| 254 | +#define CODA_SETATTR 8 | |
| 255 | +#define CODA_ACCESS 9 | |
| 256 | +#define CODA_LOOKUP 10 | |
| 257 | +#define CODA_CREATE 11 | |
| 258 | +#define CODA_REMOVE 12 | |
| 259 | +#define CODA_LINK 13 | |
| 260 | +#define CODA_RENAME 14 | |
| 261 | +#define CODA_MKDIR 15 | |
| 262 | +#define CODA_RMDIR 16 | |
| 263 | +#define CODA_SYMLINK 18 | |
| 264 | +#define CODA_READLINK 19 | |
| 265 | +#define CODA_FSYNC 20 | |
| 266 | +#define CODA_VGET 22 | |
| 267 | +#define CODA_SIGNAL 23 | |
| 268 | +#define CODA_REPLACE 24 /* DOWNCALL */ | |
| 269 | +#define CODA_FLUSH 25 /* DOWNCALL */ | |
| 270 | +#define CODA_PURGEUSER 26 /* DOWNCALL */ | |
| 271 | +#define CODA_ZAPFILE 27 /* DOWNCALL */ | |
| 272 | +#define CODA_ZAPDIR 28 /* DOWNCALL */ | |
| 273 | +#define CODA_PURGEFID 30 /* DOWNCALL */ | |
| 274 | +#define CODA_OPEN_BY_PATH 31 | |
| 275 | +#define CODA_RESOLVE 32 | |
| 276 | +#define CODA_REINTEGRATE 33 | |
| 277 | +#define CODA_STATFS 34 | |
| 278 | +#define CODA_STORE 35 | |
| 279 | +#define CODA_RELEASE 36 | |
| 280 | +#define CODA_NCALLS 37 | |
| 281 | + | |
| 282 | +#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) | |
| 283 | + | |
| 284 | +#define VC_MAXDATASIZE 8192 | |
| 285 | +#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ | |
| 286 | + VC_MAXDATASIZE | |
| 287 | + | |
| 288 | +#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) | |
| 289 | + | |
| 290 | +#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ | |
| 291 | + | |
| 292 | +/* | |
| 293 | + * Venus <-> Coda RPC arguments | |
| 294 | + */ | |
| 295 | +struct coda_in_hdr { | |
| 296 | + u_int32_t opcode; | |
| 297 | + u_int32_t unique; /* Keep multiple outstanding msgs distinct */ | |
| 298 | + pid_t pid; | |
| 299 | + pid_t pgid; | |
| 300 | + vuid_t uid; | |
| 301 | +}; | |
| 302 | + | |
| 303 | +/* Really important that opcode and unique are 1st two fields! */ | |
| 304 | +struct coda_out_hdr { | |
| 305 | + u_int32_t opcode; | |
| 306 | + u_int32_t unique; | |
| 307 | + u_int32_t result; | |
| 308 | +}; | |
| 309 | + | |
| 310 | +/* coda_root: NO_IN */ | |
| 311 | +struct coda_root_out { | |
| 312 | + struct coda_out_hdr oh; | |
| 313 | + struct CodaFid VFid; | |
| 314 | +}; | |
| 315 | + | |
| 316 | +struct coda_root_in { | |
| 317 | + struct coda_in_hdr in; | |
| 318 | +}; | |
| 319 | + | |
| 320 | +/* coda_open: */ | |
| 321 | +struct coda_open_in { | |
| 322 | + struct coda_in_hdr ih; | |
| 323 | + struct CodaFid VFid; | |
| 324 | + int flags; | |
| 325 | +}; | |
| 326 | + | |
| 327 | +struct coda_open_out { | |
| 328 | + struct coda_out_hdr oh; | |
| 329 | + cdev_t dev; | |
| 330 | + ino_t inode; | |
| 331 | +}; | |
| 332 | + | |
| 333 | + | |
| 334 | +/* coda_store: */ | |
| 335 | +struct coda_store_in { | |
| 336 | + struct coda_in_hdr ih; | |
| 337 | + struct CodaFid VFid; | |
| 338 | + int flags; | |
| 339 | +}; | |
| 340 | + | |
| 341 | +struct coda_store_out { | |
| 342 | + struct coda_out_hdr out; | |
| 343 | +}; | |
| 344 | + | |
| 345 | +/* coda_release: */ | |
| 346 | +struct coda_release_in { | |
| 347 | + struct coda_in_hdr ih; | |
| 348 | + struct CodaFid VFid; | |
| 349 | + int flags; | |
| 350 | +}; | |
| 351 | + | |
| 352 | +struct coda_release_out { | |
| 353 | + struct coda_out_hdr out; | |
| 354 | +}; | |
| 355 | + | |
| 356 | +/* coda_close: */ | |
| 357 | +struct coda_close_in { | |
| 358 | + struct coda_in_hdr ih; | |
| 359 | + struct CodaFid VFid; | |
| 360 | + int flags; | |
| 361 | +}; | |
| 362 | + | |
| 363 | +struct coda_close_out { | |
| 364 | + struct coda_out_hdr out; | |
| 365 | +}; | |
| 366 | + | |
| 367 | +/* coda_ioctl: */ | |
| 368 | +struct coda_ioctl_in { | |
| 369 | + struct coda_in_hdr ih; | |
| 370 | + struct CodaFid VFid; | |
| 371 | + int cmd; | |
| 372 | + int len; | |
| 373 | + int rwflag; | |
| 374 | + char *data; /* Place holder for data. */ | |
| 375 | +}; | |
| 376 | + | |
| 377 | +struct coda_ioctl_out { | |
| 378 | + struct coda_out_hdr oh; | |
| 379 | + int len; | |
| 380 | + caddr_t data; /* Place holder for data. */ | |
| 381 | +}; | |
| 382 | + | |
| 383 | + | |
| 384 | +/* coda_getattr: */ | |
| 385 | +struct coda_getattr_in { | |
| 386 | + struct coda_in_hdr ih; | |
| 387 | + struct CodaFid VFid; | |
| 388 | +}; | |
| 389 | + | |
| 390 | +struct coda_getattr_out { | |
| 391 | + struct coda_out_hdr oh; | |
| 392 | + struct coda_vattr attr; | |
| 393 | +}; | |
| 394 | + | |
| 395 | + | |
| 396 | +/* coda_setattr: NO_OUT */ | |
| 397 | +struct coda_setattr_in { | |
| 398 | + struct coda_in_hdr ih; | |
| 399 | + struct CodaFid VFid; | |
| 400 | + struct coda_vattr attr; | |
| 401 | +}; | |
| 402 | + | |
| 403 | +struct coda_setattr_out { | |
| 404 | + struct coda_out_hdr out; | |
| 405 | +}; | |
| 406 | + | |
| 407 | +/* coda_access: NO_OUT */ | |
| 408 | +struct coda_access_in { | |
| 409 | + struct coda_in_hdr ih; | |
| 410 | + struct CodaFid VFid; | |
| 411 | + int flags; | |
| 412 | +}; | |
| 413 | + | |
| 414 | +struct coda_access_out { | |
| 415 | + struct coda_out_hdr out; | |
| 416 | +}; | |
| 417 | + | |
| 418 | + | |
| 419 | +/* lookup flags */ | |
| 420 | +#define CLU_CASE_SENSITIVE 0x01 | |
| 421 | +#define CLU_CASE_INSENSITIVE 0x02 | |
| 422 | + | |
| 423 | +/* coda_lookup: */ | |
| 424 | +struct coda_lookup_in { | |
| 425 | + struct coda_in_hdr ih; | |
| 426 | + struct CodaFid VFid; | |
| 427 | + int name; /* Place holder for data. */ | |
| 428 | + int flags; | |
| 429 | +}; | |
| 430 | + | |
| 431 | +struct coda_lookup_out { | |
| 432 | + struct coda_out_hdr oh; | |
| 433 | + struct CodaFid VFid; | |
| 434 | + int vtype; | |
| 435 | +}; | |
| 436 | + | |
| 437 | + | |
| 438 | +/* coda_create: */ | |
| 439 | +struct coda_create_in { | |
| 440 | + struct coda_in_hdr ih; | |
| 441 | + struct CodaFid VFid; | |
| 442 | + struct coda_vattr attr; | |
| 443 | + int excl; | |
| 444 | + int mode; | |
| 445 | + int name; /* Place holder for data. */ | |
| 446 | +}; | |
| 447 | + | |
| 448 | +struct coda_create_out { | |
| 449 | + struct coda_out_hdr oh; | |
| 450 | + struct CodaFid VFid; | |
| 451 | + struct coda_vattr attr; | |
| 452 | +}; | |
| 453 | + | |
| 454 | + | |
| 455 | +/* coda_remove: NO_OUT */ | |
| 456 | +struct coda_remove_in { | |
| 457 | + struct coda_in_hdr ih; | |
| 458 | + struct CodaFid VFid; | |
| 459 | + int name; /* Place holder for data. */ | |
| 460 | +}; | |
| 461 | + | |
| 462 | +struct coda_remove_out { | |
| 463 | + struct coda_out_hdr out; | |
| 464 | +}; | |
| 465 | + | |
| 466 | +/* coda_link: NO_OUT */ | |
| 467 | +struct coda_link_in { | |
| 468 | + struct coda_in_hdr ih; | |
| 469 | + struct CodaFid sourceFid; /* cnode to link *to* */ | |
| 470 | + struct CodaFid destFid; /* Directory in which to place link */ | |
| 471 | + int tname; /* Place holder for data. */ | |
| 472 | +}; | |
| 473 | + | |
| 474 | +struct coda_link_out { | |
| 475 | + struct coda_out_hdr out; | |
| 476 | +}; | |
| 477 | + | |
| 478 | + | |
| 479 | +/* coda_rename: NO_OUT */ | |
| 480 | +struct coda_rename_in { | |
| 481 | + struct coda_in_hdr ih; | |
| 482 | + struct CodaFid sourceFid; | |
| 483 | + int srcname; | |
| 484 | + struct CodaFid destFid; | |
| 485 | + int destname; | |
| 486 | +}; | |
| 487 | + | |
| 488 | +struct coda_rename_out { | |
| 489 | + struct coda_out_hdr out; | |
| 490 | +}; | |
| 491 | + | |
| 492 | +/* coda_mkdir: */ | |
| 493 | +struct coda_mkdir_in { | |
| 494 | + struct coda_in_hdr ih; | |
| 495 | + struct CodaFid VFid; | |
| 496 | + struct coda_vattr attr; | |
| 497 | + int name; /* Place holder for data. */ | |
| 498 | +}; | |
| 499 | + | |
| 500 | +struct coda_mkdir_out { | |
| 501 | + struct coda_out_hdr oh; | |
| 502 | + struct CodaFid VFid; | |
| 503 | + struct coda_vattr attr; | |
| 504 | +}; | |
| 505 | + | |
| 506 | + | |
| 507 | +/* coda_rmdir: NO_OUT */ | |
| 508 | +struct coda_rmdir_in { | |
| 509 | + struct coda_in_hdr ih; | |
| 510 | + struct CodaFid VFid; | |
| 511 | + int name; /* Place holder for data. */ | |
| 512 | +}; | |
| 513 | + | |
| 514 | +struct coda_rmdir_out { | |
| 515 | + struct coda_out_hdr out; | |
| 516 | +}; | |
| 517 | + | |
| 518 | +/* coda_symlink: NO_OUT */ | |
| 519 | +struct coda_symlink_in { | |
| 520 | + struct coda_in_hdr ih; | |
| 521 | + struct CodaFid VFid; /* Directory to put symlink in */ | |
| 522 | + int srcname; | |
| 523 | + struct coda_vattr attr; | |
| 524 | + int tname; | |
| 525 | +}; | |
| 526 | + | |
| 527 | +struct coda_symlink_out { | |
| 528 | + struct coda_out_hdr out; | |
| 529 | +}; | |
| 530 | + | |
| 531 | +/* coda_readlink: */ | |
| 532 | +struct coda_readlink_in { | |
| 533 | + struct coda_in_hdr ih; | |
| 534 | + struct CodaFid VFid; | |
| 535 | +}; | |
| 536 | + | |
| 537 | +struct coda_readlink_out { | |
| 538 | + struct coda_out_hdr oh; | |
| 539 | + int count; | |
| 540 | + caddr_t data; /* Place holder for data. */ | |
| 541 | +}; | |
| 542 | + | |
| 543 | + | |
| 544 | +/* coda_fsync: NO_OUT */ | |
| 545 | +struct coda_fsync_in { | |
| 546 | + struct coda_in_hdr ih; | |
| 547 | + struct CodaFid VFid; | |
| 548 | +}; | |
| 549 | + | |
| 550 | +struct coda_fsync_out { | |
| 551 | + struct coda_out_hdr out; | |
| 552 | +}; | |
| 553 | + | |
| 554 | +/* coda_vget: */ | |
| 555 | +struct coda_vget_in { | |
| 556 | + struct coda_in_hdr ih; | |
| 557 | + struct CodaFid VFid; | |
| 558 | +}; | |
| 559 | + | |
| 560 | +struct coda_vget_out { | |
| 561 | + struct coda_out_hdr oh; | |
| 562 | + struct CodaFid VFid; | |
| 563 | + int vtype; | |
| 564 | +}; | |
| 565 | + | |
| 566 | + | |
| 567 | +/* CODA_SIGNAL is out-of-band, doesn't need data. */ | |
| 568 | +/* CODA_INVALIDATE is a venus->kernel call */ | |
| 569 | +/* CODA_FLUSH is a venus->kernel call */ | |
| 570 | + | |
| 571 | +/* coda_purgeuser: */ | |
| 572 | +/* CODA_PURGEUSER is a venus->kernel call */ | |
| 573 | +struct coda_purgeuser_out { | |
| 574 | + struct coda_out_hdr oh; | |
| 575 | + vuid_t uid; | |
| 576 | +}; | |
| 577 | + | |
| 578 | +/* coda_zapfile: */ | |
| 579 | +/* CODA_ZAPFILE is a venus->kernel call */ | |
| 580 | +struct coda_zapfile_out { | |
| 581 | + struct coda_out_hdr oh; | |
| 582 | + struct CodaFid CodaFid; | |
| 583 | +}; | |
| 584 | + | |
| 585 | +/* coda_zapdir: */ | |
| 586 | +/* CODA_ZAPDIR is a venus->kernel call */ | |
| 587 | +struct coda_zapdir_out { | |
| 588 | + struct coda_out_hdr oh; | |
| 589 | + struct CodaFid CodaFid; | |
| 590 | +}; | |
| 591 | + | |
| 592 | +/* coda_purgefid: */ | |
| 593 | +/* CODA_PURGEFID is a venus->kernel call */ | |
| 594 | +struct coda_purgefid_out { | |
| 595 | + struct coda_out_hdr oh; | |
| 596 | + struct CodaFid CodaFid; | |
| 597 | +}; | |
| 598 | + | |
| 599 | +/* coda_replace: */ | |
| 600 | +/* CODA_REPLACE is a venus->kernel call */ | |
| 601 | +struct coda_replace_out { /* coda_replace is a venus->kernel call */ | |
| 602 | + struct coda_out_hdr oh; | |
| 603 | + struct CodaFid NewFid; | |
| 604 | + struct CodaFid OldFid; | |
| 605 | +}; | |
| 606 | + | |
| 607 | +/* coda_open_by_fd: */ | |
| 608 | +struct coda_open_by_fd_in { | |
| 609 | + struct coda_in_hdr ih; | |
| 610 | + struct CodaFid VFid; | |
| 611 | + int flags; | |
| 612 | +}; | |
| 613 | + | |
| 614 | +struct coda_open_by_fd_out { | |
| 615 | + struct coda_out_hdr oh; | |
| 616 | + int fd; | |
| 617 | + | |
| 618 | +#ifdef __KERNEL__ | |
| 619 | + struct file *fh; /* not passed from userspace but used in-kernel only */ | |
| 620 | +#endif | |
| 621 | +}; | |
| 622 | + | |
| 623 | +/* coda_open_by_path: */ | |
| 624 | +struct coda_open_by_path_in { | |
| 625 | + struct coda_in_hdr ih; | |
| 626 | + struct CodaFid VFid; | |
| 627 | + int flags; | |
| 628 | +}; | |
| 629 | + | |
| 630 | +struct coda_open_by_path_out { | |
| 631 | + struct coda_out_hdr oh; | |
| 632 | + int path; | |
| 633 | +}; | |
| 634 | + | |
| 635 | +/* coda_statfs: NO_IN */ | |
| 636 | +struct coda_statfs_in { | |
| 637 | + struct coda_in_hdr in; | |
| 638 | +}; | |
| 639 | + | |
| 640 | +struct coda_statfs_out { | |
| 641 | + struct coda_out_hdr oh; | |
| 642 | + struct coda_statfs stat; | |
| 643 | +}; | |
| 644 | + | |
| 645 | +/* | |
| 646 | + * Occasionally, we don't cache the fid returned by CODA_LOOKUP. | |
| 647 | + * For instance, if the fid is inconsistent. | |
| 648 | + * This case is handled by setting the top bit of the type result parameter. | |
| 649 | + */ | |
| 650 | +#define CODA_NOCACHE 0x80000000 | |
| 651 | + | |
| 652 | +union inputArgs { | |
| 653 | + struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ | |
| 654 | + struct coda_open_in coda_open; | |
| 655 | + struct coda_store_in coda_store; | |
| 656 | + struct coda_release_in coda_release; | |
| 657 | + struct coda_close_in coda_close; | |
| 658 | + struct coda_ioctl_in coda_ioctl; | |
| 659 | + struct coda_getattr_in coda_getattr; | |
| 660 | + struct coda_setattr_in coda_setattr; | |
| 661 | + struct coda_access_in coda_access; | |
| 662 | + struct coda_lookup_in coda_lookup; | |
| 663 | + struct coda_create_in coda_create; | |
| 664 | + struct coda_remove_in coda_remove; | |
| 665 | + struct coda_link_in coda_link; | |
| 666 | + struct coda_rename_in coda_rename; | |
| 667 | + struct coda_mkdir_in coda_mkdir; | |
| 668 | + struct coda_rmdir_in coda_rmdir; | |
| 669 | + struct coda_symlink_in coda_symlink; | |
| 670 | + struct coda_readlink_in coda_readlink; | |
| 671 | + struct coda_fsync_in coda_fsync; | |
| 672 | + struct coda_vget_in coda_vget; | |
| 673 | + struct coda_open_by_fd_in coda_open_by_fd; | |
| 674 | + struct coda_open_by_path_in coda_open_by_path; | |
| 675 | + struct coda_statfs_in coda_statfs; | |
| 676 | +}; | |
| 677 | + | |
| 678 | +union outputArgs { | |
| 679 | + struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ | |
| 680 | + struct coda_root_out coda_root; | |
| 681 | + struct coda_open_out coda_open; | |
| 682 | + struct coda_ioctl_out coda_ioctl; | |
| 683 | + struct coda_getattr_out coda_getattr; | |
| 684 | + struct coda_lookup_out coda_lookup; | |
| 685 | + struct coda_create_out coda_create; | |
| 686 | + struct coda_mkdir_out coda_mkdir; | |
| 687 | + struct coda_readlink_out coda_readlink; | |
| 688 | + struct coda_vget_out coda_vget; | |
| 689 | + struct coda_purgeuser_out coda_purgeuser; | |
| 690 | + struct coda_zapfile_out coda_zapfile; | |
| 691 | + struct coda_zapdir_out coda_zapdir; | |
| 692 | + struct coda_purgefid_out coda_purgefid; | |
| 693 | + struct coda_replace_out coda_replace; | |
| 694 | + struct coda_open_by_fd_out coda_open_by_fd; | |
| 695 | + struct coda_open_by_path_out coda_open_by_path; | |
| 696 | + struct coda_statfs_out coda_statfs; | |
| 697 | +}; | |
| 698 | + | |
| 699 | +union coda_downcalls { | |
| 700 | + /* CODA_INVALIDATE is a venus->kernel call */ | |
| 701 | + /* CODA_FLUSH is a venus->kernel call */ | |
| 702 | + struct coda_purgeuser_out purgeuser; | |
| 703 | + struct coda_zapfile_out zapfile; | |
| 704 | + struct coda_zapdir_out zapdir; | |
| 705 | + struct coda_purgefid_out purgefid; | |
| 706 | + struct coda_replace_out replace; | |
| 707 | +}; | |
| 708 | + | |
| 709 | + | |
| 710 | +/* | |
| 711 | + * Used for identifying usage of "Control" and pioctls | |
| 712 | + */ | |
| 713 | + | |
| 714 | +#define PIOCPARM_MASK 0x0000ffff | |
| 715 | +struct ViceIoctl { | |
| 716 | + void __user *in; /* Data to be transferred in */ | |
| 717 | + void __user *out; /* Data to be transferred out */ | |
| 718 | + u_short in_size; /* Size of input buffer <= 2K */ | |
| 719 | + u_short out_size; /* Maximum size of output buffer, <= 2K */ | |
| 720 | +}; | |
| 721 | + | |
| 722 | +struct PioctlData { | |
| 723 | + const char __user *path; | |
| 724 | + int follow; | |
| 725 | + struct ViceIoctl vi; | |
| 726 | +}; | |
| 727 | + | |
| 728 | +#define CODA_CONTROL ".CONTROL" | |
| 729 | +#define CODA_CONTROLLEN 8 | |
| 730 | +#define CTL_INO -1 | |
| 731 | + | |
| 732 | +/* Data passed to mount */ | |
| 733 | + | |
| 734 | +#define CODA_MOUNT_VERSION 1 | |
| 735 | + | |
| 736 | +struct coda_mount_data { | |
| 737 | + int version; | |
| 738 | + int fd; /* Opened device */ | |
| 739 | +}; | |
| 740 | + | |
| 741 | +#endif /* _UAPI_CODA_HEADER_ */ | |
| @@ -0,0 +1,27 @@ | ||
| 1 | +#ifndef _UAPI__CODA_PSDEV_H | |
| 2 | +#define _UAPI__CODA_PSDEV_H | |
| 3 | + | |
| 4 | +#include <linux/magic.h> | |
| 5 | + | |
| 6 | +#define CODA_PSDEV_MAJOR 67 | |
| 7 | +#define MAX_CODADEVS 5 /* how many do we allow */ | |
| 8 | + | |
| 9 | + | |
| 10 | +/* messages between coda filesystem in kernel and Venus */ | |
| 11 | +struct upc_req { | |
| 12 | + struct list_head uc_chain; | |
| 13 | + caddr_t uc_data; | |
| 14 | + u_short uc_flags; | |
| 15 | + u_short uc_inSize; /* Size is at most 5000 bytes */ | |
| 16 | + u_short uc_outSize; | |
| 17 | + u_short uc_opcode; /* copied from data to save lookup */ | |
| 18 | + int uc_unique; | |
| 19 | + wait_queue_head_t uc_sleep; /* process' wait queue */ | |
| 20 | +}; | |
| 21 | + | |
| 22 | +#define CODA_REQ_ASYNC 0x1 | |
| 23 | +#define CODA_REQ_READ 0x2 | |
| 24 | +#define CODA_REQ_WRITE 0x4 | |
| 25 | +#define CODA_REQ_ABORT 0x8 | |
| 26 | + | |
| 27 | +#endif /* _UAPI__CODA_PSDEV_H */ | |
| @@ -0,0 +1,351 @@ | ||
| 1 | +/* This file is derived from the GAS 2.1.4 assembler control file. | |
| 2 | + The GAS product is under the GNU General Public License, version 2 or later. | |
| 3 | + As such, this file is also under that license. | |
| 4 | + | |
| 5 | + If the file format changes in the COFF object, this file should be | |
| 6 | + subsequently updated to reflect the changes. | |
| 7 | + | |
| 8 | + The actual loader module only uses a few of these structures. The full | |
| 9 | + set is documented here because I received the full set. If you wish | |
| 10 | + more information about COFF, then O'Reilly has a very excellent book. | |
| 11 | +*/ | |
| 12 | + | |
| 13 | +#define E_SYMNMLEN 8 /* Number of characters in a symbol name */ | |
| 14 | +#define E_FILNMLEN 14 /* Number of characters in a file name */ | |
| 15 | +#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */ | |
| 16 | + | |
| 17 | +/* | |
| 18 | + * These defines are byte order independent. There is no alignment of fields | |
| 19 | + * permitted in the structures. Therefore they are declared as characters | |
| 20 | + * and the values loaded from the character positions. It also makes it | |
| 21 | + * nice to have it "endian" independent. | |
| 22 | + */ | |
| 23 | + | |
| 24 | +/* Load a short int from the following tables with little-endian formats */ | |
| 25 | +#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ | |
| 26 | + ((unsigned short)((unsigned char)ps[0])))) | |
| 27 | + | |
| 28 | +/* Load a long int from the following tables with little-endian formats */ | |
| 29 | +#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ | |
| 30 | + ((unsigned long)((unsigned char)ps[2])<<16) |\ | |
| 31 | + ((unsigned long)((unsigned char)ps[1])<<8) |\ | |
| 32 | + ((unsigned long)((unsigned char)ps[0]))))) | |
| 33 | + | |
| 34 | +/* Load a short int from the following tables with big-endian formats */ | |
| 35 | +#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\ | |
| 36 | + ((unsigned short)((unsigned char)ps[1])))) | |
| 37 | + | |
| 38 | +/* Load a long int from the following tables with big-endian formats */ | |
| 39 | +#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ | |
| 40 | + ((unsigned long)((unsigned char)ps[1])<<16) |\ | |
| 41 | + ((unsigned long)((unsigned char)ps[2])<<8) |\ | |
| 42 | + ((unsigned long)((unsigned char)ps[3]))))) | |
| 43 | + | |
| 44 | +/* These may be overridden later by brain dead implementations which generate | |
| 45 | + a big-endian header with little-endian data. In that case, generate a | |
| 46 | + replacement macro which tests a flag and uses either of the two above | |
| 47 | + as appropriate. */ | |
| 48 | + | |
| 49 | +#define COFF_LONG(v) COFF_LONG_L(v) | |
| 50 | +#define COFF_SHORT(v) COFF_SHORT_L(v) | |
| 51 | + | |
| 52 | +/*** coff information for Intel 386/486. */ | |
| 53 | + | |
| 54 | +/********************** FILE HEADER **********************/ | |
| 55 | + | |
| 56 | +struct COFF_filehdr { | |
| 57 | + char f_magic[2]; /* magic number */ | |
| 58 | + char f_nscns[2]; /* number of sections */ | |
| 59 | + char f_timdat[4]; /* time & date stamp */ | |
| 60 | + char f_symptr[4]; /* file pointer to symtab */ | |
| 61 | + char f_nsyms[4]; /* number of symtab entries */ | |
| 62 | + char f_opthdr[2]; /* sizeof(optional hdr) */ | |
| 63 | + char f_flags[2]; /* flags */ | |
| 64 | +}; | |
| 65 | + | |
| 66 | +/* | |
| 67 | + * Bits for f_flags: | |
| 68 | + * | |
| 69 | + * F_RELFLG relocation info stripped from file | |
| 70 | + * F_EXEC file is executable (i.e. no unresolved external | |
| 71 | + * references) | |
| 72 | + * F_LNNO line numbers stripped from file | |
| 73 | + * F_LSYMS local symbols stripped from file | |
| 74 | + * F_MINMAL this is a minimal object file (".m") output of fextract | |
| 75 | + * F_UPDATE this is a fully bound update file, output of ogen | |
| 76 | + * F_SWABD this file has had its bytes swabbed (in names) | |
| 77 | + * F_AR16WR this file has the byte ordering of an AR16WR | |
| 78 | + * (e.g. 11/70) machine | |
| 79 | + * F_AR32WR this file has the byte ordering of an AR32WR machine | |
| 80 | + * (e.g. vax and iNTEL 386) | |
| 81 | + * F_AR32W this file has the byte ordering of an AR32W machine | |
| 82 | + * (e.g. 3b,maxi) | |
| 83 | + * F_PATCH file contains "patch" list in optional header | |
| 84 | + * F_NODF (minimal file only) no decision functions for | |
| 85 | + * replaced functions | |
| 86 | + */ | |
| 87 | + | |
| 88 | +#define COFF_F_RELFLG 0000001 | |
| 89 | +#define COFF_F_EXEC 0000002 | |
| 90 | +#define COFF_F_LNNO 0000004 | |
| 91 | +#define COFF_F_LSYMS 0000010 | |
| 92 | +#define COFF_F_MINMAL 0000020 | |
| 93 | +#define COFF_F_UPDATE 0000040 | |
| 94 | +#define COFF_F_SWABD 0000100 | |
| 95 | +#define COFF_F_AR16WR 0000200 | |
| 96 | +#define COFF_F_AR32WR 0000400 | |
| 97 | +#define COFF_F_AR32W 0001000 | |
| 98 | +#define COFF_F_PATCH 0002000 | |
| 99 | +#define COFF_F_NODF 0002000 | |
| 100 | + | |
| 101 | +#define COFF_I386MAGIC 0x14c /* Linux's system */ | |
| 102 | + | |
| 103 | +#if 0 /* Perhaps, someday, these formats may be used. */ | |
| 104 | +#define COFF_I386PTXMAGIC 0x154 | |
| 105 | +#define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */ | |
| 106 | +#define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \ | |
| 107 | + && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \ | |
| 108 | + && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC) | |
| 109 | +#else | |
| 110 | +#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) | |
| 111 | +#endif | |
| 112 | + | |
| 113 | +#define COFF_FILHDR struct COFF_filehdr | |
| 114 | +#define COFF_FILHSZ sizeof(COFF_FILHDR) | |
| 115 | + | |
| 116 | +/********************** AOUT "OPTIONAL HEADER" **********************/ | |
| 117 | + | |
| 118 | +/* Linux COFF must have this "optional" header. Standard COFF has no entry | |
| 119 | + location for the "entry" point. They normally would start with the first | |
| 120 | + location of the .text section. This is not a good idea for linux. So, | |
| 121 | + the use of this "optional" header is not optional. It is required. | |
| 122 | + | |
| 123 | + Do not be tempted to assume that the size of the optional header is | |
| 124 | + a constant and simply index the next byte by the size of this structure. | |
| 125 | + Use the 'f_opthdr' field in the main coff header for the size of the | |
| 126 | + structure actually written to the file!! | |
| 127 | +*/ | |
| 128 | + | |
| 129 | +typedef struct | |
| 130 | +{ | |
| 131 | + char magic[2]; /* type of file */ | |
| 132 | + char vstamp[2]; /* version stamp */ | |
| 133 | + char tsize[4]; /* text size in bytes, padded to FW bdry */ | |
| 134 | + char dsize[4]; /* initialized data " " */ | |
| 135 | + char bsize[4]; /* uninitialized data " " */ | |
| 136 | + char entry[4]; /* entry pt. */ | |
| 137 | + char text_start[4]; /* base of text used for this file */ | |
| 138 | + char data_start[4]; /* base of data used for this file */ | |
| 139 | +} | |
| 140 | +COFF_AOUTHDR; | |
| 141 | + | |
| 142 | +#define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) | |
| 143 | + | |
| 144 | +#define COFF_STMAGIC 0401 | |
| 145 | +#define COFF_OMAGIC 0404 | |
| 146 | +#define COFF_JMAGIC 0407 /* dirty text and data image, can't share */ | |
| 147 | +#define COFF_DMAGIC 0410 /* dirty text segment, data aligned */ | |
| 148 | +#define COFF_ZMAGIC 0413 /* The proper magic number for executables */ | |
| 149 | +#define COFF_SHMAGIC 0443 /* shared library header */ | |
| 150 | + | |
| 151 | +/********************** SECTION HEADER **********************/ | |
| 152 | + | |
| 153 | +struct COFF_scnhdr { | |
| 154 | + char s_name[8]; /* section name */ | |
| 155 | + char s_paddr[4]; /* physical address, aliased s_nlib */ | |
| 156 | + char s_vaddr[4]; /* virtual address */ | |
| 157 | + char s_size[4]; /* section size */ | |
| 158 | + char s_scnptr[4]; /* file ptr to raw data for section */ | |
| 159 | + char s_relptr[4]; /* file ptr to relocation */ | |
| 160 | + char s_lnnoptr[4]; /* file ptr to line numbers */ | |
| 161 | + char s_nreloc[2]; /* number of relocation entries */ | |
| 162 | + char s_nlnno[2]; /* number of line number entries */ | |
| 163 | + char s_flags[4]; /* flags */ | |
| 164 | +}; | |
| 165 | + | |
| 166 | +#define COFF_SCNHDR struct COFF_scnhdr | |
| 167 | +#define COFF_SCNHSZ sizeof(COFF_SCNHDR) | |
| 168 | + | |
| 169 | +/* | |
| 170 | + * names of "special" sections | |
| 171 | + */ | |
| 172 | + | |
| 173 | +#define COFF_TEXT ".text" | |
| 174 | +#define COFF_DATA ".data" | |
| 175 | +#define COFF_BSS ".bss" | |
| 176 | +#define COFF_COMMENT ".comment" | |
| 177 | +#define COFF_LIB ".lib" | |
| 178 | + | |
| 179 | +#define COFF_SECT_TEXT 0 /* Section for instruction code */ | |
| 180 | +#define COFF_SECT_DATA 1 /* Section for initialized globals */ | |
| 181 | +#define COFF_SECT_BSS 2 /* Section for un-initialized globals */ | |
| 182 | +#define COFF_SECT_REQD 3 /* Minimum number of sections for good file */ | |
| 183 | + | |
| 184 | +#define COFF_STYP_REG 0x00 /* regular segment */ | |
| 185 | +#define COFF_STYP_DSECT 0x01 /* dummy segment */ | |
| 186 | +#define COFF_STYP_NOLOAD 0x02 /* no-load segment */ | |
| 187 | +#define COFF_STYP_GROUP 0x04 /* group segment */ | |
| 188 | +#define COFF_STYP_PAD 0x08 /* .pad segment */ | |
| 189 | +#define COFF_STYP_COPY 0x10 /* copy section */ | |
| 190 | +#define COFF_STYP_TEXT 0x20 /* .text segment */ | |
| 191 | +#define COFF_STYP_DATA 0x40 /* .data segment */ | |
| 192 | +#define COFF_STYP_BSS 0x80 /* .bss segment */ | |
| 193 | +#define COFF_STYP_INFO 0x200 /* .comment section */ | |
| 194 | +#define COFF_STYP_OVER 0x400 /* overlay section */ | |
| 195 | +#define COFF_STYP_LIB 0x800 /* library section */ | |
| 196 | + | |
| 197 | +/* | |
| 198 | + * Shared libraries have the following section header in the data field for | |
| 199 | + * each library. | |
| 200 | + */ | |
| 201 | + | |
| 202 | +struct COFF_slib { | |
| 203 | + char sl_entsz[4]; /* Size of this entry */ | |
| 204 | + char sl_pathndx[4]; /* size of the header field */ | |
| 205 | +}; | |
| 206 | + | |
| 207 | +#define COFF_SLIBHD struct COFF_slib | |
| 208 | +#define COFF_SLIBSZ sizeof(COFF_SLIBHD) | |
| 209 | + | |
| 210 | +/********************** LINE NUMBERS **********************/ | |
| 211 | + | |
| 212 | +/* 1 line number entry for every "breakpointable" source line in a section. | |
| 213 | + * Line numbers are grouped on a per function basis; first entry in a function | |
| 214 | + * grouping will have l_lnno = 0 and in place of physical address will be the | |
| 215 | + * symbol table index of the function name. | |
| 216 | + */ | |
| 217 | + | |
| 218 | +struct COFF_lineno { | |
| 219 | + union { | |
| 220 | + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ | |
| 221 | + char l_paddr[4]; /* (physical) address of line number */ | |
| 222 | + } l_addr; | |
| 223 | + char l_lnno[2]; /* line number */ | |
| 224 | +}; | |
| 225 | + | |
| 226 | +#define COFF_LINENO struct COFF_lineno | |
| 227 | +#define COFF_LINESZ 6 | |
| 228 | + | |
| 229 | +/********************** SYMBOLS **********************/ | |
| 230 | + | |
| 231 | +#define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */ | |
| 232 | +#define COFF_E_FILNMLEN 14 /* # characters in a file name */ | |
| 233 | +#define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */ | |
| 234 | + | |
| 235 | +/* | |
| 236 | + * All symbols and sections have the following definition | |
| 237 | + */ | |
| 238 | + | |
| 239 | +struct COFF_syment | |
| 240 | +{ | |
| 241 | + union { | |
| 242 | + char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */ | |
| 243 | + struct { | |
| 244 | + char e_zeroes[4]; /* Leading zeros */ | |
| 245 | + char e_offset[4]; /* Offset if this is a header section */ | |
| 246 | + } e; | |
| 247 | + } e; | |
| 248 | + | |
| 249 | + char e_value[4]; /* Value (address) of the segment */ | |
| 250 | + char e_scnum[2]; /* Section number */ | |
| 251 | + char e_type[2]; /* Type of section */ | |
| 252 | + char e_sclass[1]; /* Loader class */ | |
| 253 | + char e_numaux[1]; /* Number of auxiliary entries which follow */ | |
| 254 | +}; | |
| 255 | + | |
| 256 | +#define COFF_N_BTMASK (0xf) /* Mask for important class bits */ | |
| 257 | +#define COFF_N_TMASK (0x30) /* Mask for important type bits */ | |
| 258 | +#define COFF_N_BTSHFT (4) /* # bits to shift class field */ | |
| 259 | +#define COFF_N_TSHIFT (2) /* # bits to shift type field */ | |
| 260 | + | |
| 261 | +/* | |
| 262 | + * Auxiliary entries because the main table is too limiting. | |
| 263 | + */ | |
| 264 | + | |
| 265 | +union COFF_auxent { | |
| 266 | + | |
| 267 | +/* | |
| 268 | + * Debugger information | |
| 269 | + */ | |
| 270 | + | |
| 271 | + struct { | |
| 272 | + char x_tagndx[4]; /* str, un, or enum tag indx */ | |
| 273 | + union { | |
| 274 | + struct { | |
| 275 | + char x_lnno[2]; /* declaration line number */ | |
| 276 | + char x_size[2]; /* str/union/array size */ | |
| 277 | + } x_lnsz; | |
| 278 | + char x_fsize[4]; /* size of function */ | |
| 279 | + } x_misc; | |
| 280 | + | |
| 281 | + union { | |
| 282 | + struct { /* if ISFCN, tag, or .bb */ | |
| 283 | + char x_lnnoptr[4]; /* ptr to fcn line # */ | |
| 284 | + char x_endndx[4]; /* entry ndx past block end */ | |
| 285 | + } x_fcn; | |
| 286 | + | |
| 287 | + struct { /* if ISARY, up to 4 dimen. */ | |
| 288 | + char x_dimen[E_DIMNUM][2]; | |
| 289 | + } x_ary; | |
| 290 | + } x_fcnary; | |
| 291 | + | |
| 292 | + char x_tvndx[2]; /* tv index */ | |
| 293 | + } x_sym; | |
| 294 | + | |
| 295 | +/* | |
| 296 | + * Source file names (debugger information) | |
| 297 | + */ | |
| 298 | + | |
| 299 | + union { | |
| 300 | + char x_fname[E_FILNMLEN]; | |
| 301 | + struct { | |
| 302 | + char x_zeroes[4]; | |
| 303 | + char x_offset[4]; | |
| 304 | + } x_n; | |
| 305 | + } x_file; | |
| 306 | + | |
| 307 | +/* | |
| 308 | + * Section information | |
| 309 | + */ | |
| 310 | + | |
| 311 | + struct { | |
| 312 | + char x_scnlen[4]; /* section length */ | |
| 313 | + char x_nreloc[2]; /* # relocation entries */ | |
| 314 | + char x_nlinno[2]; /* # line numbers */ | |
| 315 | + } x_scn; | |
| 316 | + | |
| 317 | +/* | |
| 318 | + * Transfer vector (branch table) | |
| 319 | + */ | |
| 320 | + | |
| 321 | + struct { | |
| 322 | + char x_tvfill[4]; /* tv fill value */ | |
| 323 | + char x_tvlen[2]; /* length of .tv */ | |
| 324 | + char x_tvran[2][2]; /* tv range */ | |
| 325 | + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | |
| 326 | +}; | |
| 327 | + | |
| 328 | +#define COFF_SYMENT struct COFF_syment | |
| 329 | +#define COFF_SYMESZ 18 | |
| 330 | +#define COFF_AUXENT union COFF_auxent | |
| 331 | +#define COFF_AUXESZ 18 | |
| 332 | + | |
| 333 | +#define COFF_ETEXT "etext" | |
| 334 | + | |
| 335 | +/********************** RELOCATION DIRECTIVES **********************/ | |
| 336 | + | |
| 337 | +struct COFF_reloc { | |
| 338 | + char r_vaddr[4]; /* Virtual address of item */ | |
| 339 | + char r_symndx[4]; /* Symbol index in the symtab */ | |
| 340 | + char r_type[2]; /* Relocation type */ | |
| 341 | +}; | |
| 342 | + | |
| 343 | +#define COFF_RELOC struct COFF_reloc | |
| 344 | +#define COFF_RELSZ 10 | |
| 345 | + | |
| 346 | +#define COFF_DEF_DATA_SECTION_ALIGNMENT 4 | |
| 347 | +#define COFF_DEF_BSS_SECTION_ALIGNMENT 4 | |
| 348 | +#define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 | |
| 349 | + | |
| 350 | +/* For new sections we haven't heard of before */ | |
| 351 | +#define COFF_DEF_SECTION_ALIGNMENT 4 | |
| @@ -0,0 +1,77 @@ | ||
| 1 | +/* | |
| 2 | + * connector.h | |
| 3 | + * | |
| 4 | + * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> | |
| 5 | + * All rights reserved. | |
| 6 | + * | |
| 7 | + * This program is free software; you can redistribute it and/or modify | |
| 8 | + * it under the terms of the GNU General Public License as published by | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or | |
| 10 | + * (at your option) any later version. | |
| 11 | + * | |
| 12 | + * This program is distributed in the hope that it will be useful, | |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + * GNU General Public License for more details. | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License | |
| 18 | + * along with this program; if not, write to the Free Software | |
| 19 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 | + */ | |
| 21 | + | |
| 22 | +#ifndef _UAPI__CONNECTOR_H | |
| 23 | +#define _UAPI__CONNECTOR_H | |
| 24 | + | |
| 25 | +#include <linux/types.h> | |
| 26 | + | |
| 27 | +/* | |
| 28 | + * Process Events connector unique ids -- used for message routing | |
| 29 | + */ | |
| 30 | +#define CN_IDX_PROC 0x1 | |
| 31 | +#define CN_VAL_PROC 0x1 | |
| 32 | +#define CN_IDX_CIFS 0x2 | |
| 33 | +#define CN_VAL_CIFS 0x1 | |
| 34 | +#define CN_W1_IDX 0x3 /* w1 communication */ | |
| 35 | +#define CN_W1_VAL 0x1 | |
| 36 | +#define CN_IDX_V86D 0x4 | |
| 37 | +#define CN_VAL_V86D_UVESAFB 0x1 | |
| 38 | +#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ | |
| 39 | +#define CN_DST_IDX 0x6 | |
| 40 | +#define CN_DST_VAL 0x1 | |
| 41 | +#define CN_IDX_DM 0x7 /* Device Mapper */ | |
| 42 | +#define CN_VAL_DM_USERSPACE_LOG 0x1 | |
| 43 | +#define CN_IDX_DRBD 0x8 | |
| 44 | +#define CN_VAL_DRBD 0x1 | |
| 45 | +#define CN_KVP_IDX 0x9 /* HyperV KVP */ | |
| 46 | +#define CN_KVP_VAL 0x1 /* queries from the kernel */ | |
| 47 | + | |
| 48 | +#define CN_NETLINK_USERS 10 /* Highest index + 1 */ | |
| 49 | + | |
| 50 | +/* | |
| 51 | + * Maximum connector's message size. | |
| 52 | + */ | |
| 53 | +#define CONNECTOR_MAX_MSG_SIZE 16384 | |
| 54 | + | |
| 55 | +/* | |
| 56 | + * idx and val are unique identifiers which | |
| 57 | + * are used for message routing and | |
| 58 | + * must be registered in connector.h for in-kernel usage. | |
| 59 | + */ | |
| 60 | + | |
| 61 | +struct cb_id { | |
| 62 | + __u32 idx; | |
| 63 | + __u32 val; | |
| 64 | +}; | |
| 65 | + | |
| 66 | +struct cn_msg { | |
| 67 | + struct cb_id id; | |
| 68 | + | |
| 69 | + __u32 seq; | |
| 70 | + __u32 ack; | |
| 71 | + | |
| 72 | + __u16 len; /* Length of the following data */ | |
| 73 | + __u16 flags; | |
| 74 | + __u8 data[0]; | |
| 75 | +}; | |
| 76 | + | |
| 77 | +#endif /* _UAPI__CONNECTOR_H */ | |
| @@ -0,0 +1,24 @@ | ||
| 1 | +/* const.h: Macros for dealing with constants. */ | |
| 2 | + | |
| 3 | +#ifndef _LINUX_CONST_H | |
| 4 | +#define _LINUX_CONST_H | |
| 5 | + | |
| 6 | +/* Some constant macros are used in both assembler and | |
| 7 | + * C code. Therefore we cannot annotate them always with | |
| 8 | + * 'UL' and other type specifiers unilaterally. We | |
| 9 | + * use the following macros to deal with this. | |
| 10 | + * | |
| 11 | + * Similarly, _AT() will cast an expression with a type in C, but | |
| 12 | + * leave it unchanged in asm. | |
| 13 | + */ | |
| 14 | + | |
| 15 | +#ifdef __ASSEMBLY__ | |
| 16 | +#define _AC(X,Y) X | |
| 17 | +#define _AT(T,X) X | |
| 18 | +#else | |
| 19 | +#define __AC(X,Y) (X##Y) | |
| 20 | +#define _AC(X,Y) __AC(X,Y) | |
| 21 | +#define _AT(T,X) ((T)(X)) | |
| 22 | +#endif | |
| 23 | + | |
| 24 | +#endif /* !(_LINUX_CONST_H) */ | |
| @@ -0,0 +1,88 @@ | ||
| 1 | +#ifndef _UAPI__CRAMFS_H | |
| 2 | +#define _UAPI__CRAMFS_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/magic.h> | |
| 6 | + | |
| 7 | +#define CRAMFS_SIGNATURE "Compressed ROMFS" | |
| 8 | + | |
| 9 | +/* | |
| 10 | + * Width of various bitfields in struct cramfs_inode. | |
| 11 | + * Primarily used to generate warnings in mkcramfs. | |
| 12 | + */ | |
| 13 | +#define CRAMFS_MODE_WIDTH 16 | |
| 14 | +#define CRAMFS_UID_WIDTH 16 | |
| 15 | +#define CRAMFS_SIZE_WIDTH 24 | |
| 16 | +#define CRAMFS_GID_WIDTH 8 | |
| 17 | +#define CRAMFS_NAMELEN_WIDTH 6 | |
| 18 | +#define CRAMFS_OFFSET_WIDTH 26 | |
| 19 | + | |
| 20 | +/* | |
| 21 | + * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs | |
| 22 | + * path length is 63 << 2 = 252. | |
| 23 | + */ | |
| 24 | +#define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2) | |
| 25 | + | |
| 26 | +/* | |
| 27 | + * Reasonably terse representation of the inode data. | |
| 28 | + */ | |
| 29 | +struct cramfs_inode { | |
| 30 | + __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH; | |
| 31 | + /* SIZE for device files is i_rdev */ | |
| 32 | + __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH; | |
| 33 | + /* NAMELEN is the length of the file name, divided by 4 and | |
| 34 | + rounded up. (cramfs doesn't support hard links.) */ | |
| 35 | + /* OFFSET: For symlinks and non-empty regular files, this | |
| 36 | + contains the offset (divided by 4) of the file data in | |
| 37 | + compressed form (starting with an array of block pointers; | |
| 38 | + see README). For non-empty directories it is the offset | |
| 39 | + (divided by 4) of the inode of the first file in that | |
| 40 | + directory. For anything else, offset is zero. */ | |
| 41 | + __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +struct cramfs_info { | |
| 45 | + __u32 crc; | |
| 46 | + __u32 edition; | |
| 47 | + __u32 blocks; | |
| 48 | + __u32 files; | |
| 49 | +}; | |
| 50 | + | |
| 51 | +/* | |
| 52 | + * Superblock information at the beginning of the FS. | |
| 53 | + */ | |
| 54 | +struct cramfs_super { | |
| 55 | + __u32 magic; /* 0x28cd3d45 - random number */ | |
| 56 | + __u32 size; /* length in bytes */ | |
| 57 | + __u32 flags; /* feature flags */ | |
| 58 | + __u32 future; /* reserved for future use */ | |
| 59 | + __u8 signature[16]; /* "Compressed ROMFS" */ | |
| 60 | + struct cramfs_info fsid; /* unique filesystem info */ | |
| 61 | + __u8 name[16]; /* user-defined name */ | |
| 62 | + struct cramfs_inode root; /* root inode data */ | |
| 63 | +}; | |
| 64 | + | |
| 65 | +/* | |
| 66 | + * Feature flags | |
| 67 | + * | |
| 68 | + * 0x00000000 - 0x000000ff: features that work for all past kernels | |
| 69 | + * 0x00000100 - 0xffffffff: features that don't work for past kernels | |
| 70 | + */ | |
| 71 | +#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ | |
| 72 | +#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ | |
| 73 | +#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ | |
| 74 | +#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ | |
| 75 | +#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ | |
| 76 | + | |
| 77 | +/* | |
| 78 | + * Valid values in super.flags. Currently we refuse to mount | |
| 79 | + * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be | |
| 80 | + * changed to test super.future instead. | |
| 81 | + */ | |
| 82 | +#define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \ | |
| 83 | + | CRAMFS_FLAG_HOLES \ | |
| 84 | + | CRAMFS_FLAG_WRONG_SIGNATURE \ | |
| 85 | + | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET ) | |
| 86 | + | |
| 87 | + | |
| 88 | +#endif /* _UAPI__CRAMFS_H */ | |
| @@ -0,0 +1,33 @@ | ||
| 1 | +/* | |
| 2 | + * Definitions for talking to the CUDA. The CUDA is a microcontroller | |
| 3 | + * which controls the ADB, system power, RTC, and various other things. | |
| 4 | + * | |
| 5 | + * Copyright (C) 1996 Paul Mackerras. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef _UAPI_LINUX_CUDA_H | |
| 9 | +#define _UAPI_LINUX_CUDA_H | |
| 10 | + | |
| 11 | +/* CUDA commands (2nd byte) */ | |
| 12 | +#define CUDA_WARM_START 0 | |
| 13 | +#define CUDA_AUTOPOLL 1 | |
| 14 | +#define CUDA_GET_6805_ADDR 2 | |
| 15 | +#define CUDA_GET_TIME 3 | |
| 16 | +#define CUDA_GET_PRAM 7 | |
| 17 | +#define CUDA_SET_6805_ADDR 8 | |
| 18 | +#define CUDA_SET_TIME 9 | |
| 19 | +#define CUDA_POWERDOWN 0xa | |
| 20 | +#define CUDA_POWERUP_TIME 0xb | |
| 21 | +#define CUDA_SET_PRAM 0xc | |
| 22 | +#define CUDA_MS_RESET 0xd | |
| 23 | +#define CUDA_SEND_DFAC 0xe | |
| 24 | +#define CUDA_RESET_SYSTEM 0x11 | |
| 25 | +#define CUDA_SET_IPL 0x12 | |
| 26 | +#define CUDA_SET_AUTO_RATE 0x14 | |
| 27 | +#define CUDA_GET_AUTO_RATE 0x16 | |
| 28 | +#define CUDA_SET_DEVICE_LIST 0x19 | |
| 29 | +#define CUDA_GET_DEVICE_LIST 0x1a | |
| 30 | +#define CUDA_GET_SET_IIC 0x22 | |
| 31 | + | |
| 32 | + | |
| 33 | +#endif /* _UAPI_LINUX_CUDA_H */ | |
| @@ -0,0 +1,493 @@ | ||
| 1 | +/* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $ | |
| 2 | + * linux/include/linux/cyclades.h | |
| 3 | + * | |
| 4 | + * This file was initially written by | |
| 5 | + * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by | |
| 6 | + * Ivan Passos <ivan@cyclades.com>. | |
| 7 | + * | |
| 8 | + * This file contains the general definitions for the cyclades.c driver | |
| 9 | + *$Log: cyclades.h,v $ | |
| 10 | + *Revision 3.1 2002/01/29 11:36:16 henrique | |
| 11 | + *added throttle field on struct cyclades_port to indicate whether the | |
| 12 | + *port is throttled or not | |
| 13 | + * | |
| 14 | + *Revision 3.1 2000/04/19 18:52:52 ivan | |
| 15 | + *converted address fields to unsigned long and added fields for physical | |
| 16 | + *addresses on cyclades_card structure; | |
| 17 | + * | |
| 18 | + *Revision 3.0 1998/11/02 14:20:59 ivan | |
| 19 | + *added nports field on cyclades_card structure; | |
| 20 | + * | |
| 21 | + *Revision 2.5 1998/08/03 16:57:01 ivan | |
| 22 | + *added cyclades_idle_stats structure; | |
| 23 | + * | |
| 24 | + *Revision 2.4 1998/06/01 12:09:53 ivan | |
| 25 | + *removed closing_wait2 from cyclades_port structure; | |
| 26 | + * | |
| 27 | + *Revision 2.3 1998/03/16 18:01:12 ivan | |
| 28 | + *changes in the cyclades_port structure to get it closer to the | |
| 29 | + *standard serial port structure; | |
| 30 | + *added constants for new ioctls; | |
| 31 | + * | |
| 32 | + *Revision 2.2 1998/02/17 16:50:00 ivan | |
| 33 | + *changes in the cyclades_port structure (addition of shutdown_wait and | |
| 34 | + *chip_rev variables); | |
| 35 | + *added constants for new ioctls and for CD1400 rev. numbers. | |
| 36 | + * | |
| 37 | + *Revision 2.1 1997/10/24 16:03:00 ivan | |
| 38 | + *added rflow (which allows enabling the CD1400 special flow control | |
| 39 | + *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to | |
| 40 | + *cyclades_port structure; | |
| 41 | + *added Alpha support | |
| 42 | + * | |
| 43 | + *Revision 2.0 1997/06/30 10:30:00 ivan | |
| 44 | + *added some new doorbell command constants related to IOCTLW and | |
| 45 | + *UART error signaling | |
| 46 | + * | |
| 47 | + *Revision 1.8 1997/06/03 15:30:00 ivan | |
| 48 | + *added constant ZFIRM_HLT | |
| 49 | + *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin) | |
| 50 | + * | |
| 51 | + *Revision 1.7 1997/03/26 10:30:00 daniel | |
| 52 | + *new entries at the end of cyclades_port struct to reallocate | |
| 53 | + *variables illegally allocated within card memory. | |
| 54 | + * | |
| 55 | + *Revision 1.6 1996/09/09 18:35:30 bentson | |
| 56 | + *fold in changes for Cyclom-Z -- including structures for | |
| 57 | + *communicating with board as well modest changes to original | |
| 58 | + *structures to support new features. | |
| 59 | + * | |
| 60 | + *Revision 1.5 1995/11/13 21:13:31 bentson | |
| 61 | + *changes suggested by Michael Chastain <mec@duracef.shout.net> | |
| 62 | + *to support use of this file in non-kernel applications | |
| 63 | + * | |
| 64 | + * | |
| 65 | + */ | |
| 66 | + | |
| 67 | +#ifndef _UAPI_LINUX_CYCLADES_H | |
| 68 | +#define _UAPI_LINUX_CYCLADES_H | |
| 69 | + | |
| 70 | +#include <linux/types.h> | |
| 71 | + | |
| 72 | +struct cyclades_monitor { | |
| 73 | + unsigned long int_count; | |
| 74 | + unsigned long char_count; | |
| 75 | + unsigned long char_max; | |
| 76 | + unsigned long char_last; | |
| 77 | +}; | |
| 78 | + | |
| 79 | +/* | |
| 80 | + * These stats all reflect activity since the device was last initialized. | |
| 81 | + * (i.e., since the port was opened with no other processes already having it | |
| 82 | + * open) | |
| 83 | + */ | |
| 84 | +struct cyclades_idle_stats { | |
| 85 | + __kernel_time_t in_use; /* Time device has been in use (secs) */ | |
| 86 | + __kernel_time_t recv_idle; /* Time since last char received (secs) */ | |
| 87 | + __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ | |
| 88 | + unsigned long recv_bytes; /* Bytes received */ | |
| 89 | + unsigned long xmit_bytes; /* Bytes transmitted */ | |
| 90 | + unsigned long overruns; /* Input overruns */ | |
| 91 | + unsigned long frame_errs; /* Input framing errors */ | |
| 92 | + unsigned long parity_errs; /* Input parity errors */ | |
| 93 | +}; | |
| 94 | + | |
| 95 | +#define CYCLADES_MAGIC 0x4359 | |
| 96 | + | |
| 97 | +#define CYGETMON 0x435901 | |
| 98 | +#define CYGETTHRESH 0x435902 | |
| 99 | +#define CYSETTHRESH 0x435903 | |
| 100 | +#define CYGETDEFTHRESH 0x435904 | |
| 101 | +#define CYSETDEFTHRESH 0x435905 | |
| 102 | +#define CYGETTIMEOUT 0x435906 | |
| 103 | +#define CYSETTIMEOUT 0x435907 | |
| 104 | +#define CYGETDEFTIMEOUT 0x435908 | |
| 105 | +#define CYSETDEFTIMEOUT 0x435909 | |
| 106 | +#define CYSETRFLOW 0x43590a | |
| 107 | +#define CYGETRFLOW 0x43590b | |
| 108 | +#define CYSETRTSDTR_INV 0x43590c | |
| 109 | +#define CYGETRTSDTR_INV 0x43590d | |
| 110 | +#define CYZSETPOLLCYCLE 0x43590e | |
| 111 | +#define CYZGETPOLLCYCLE 0x43590f | |
| 112 | +#define CYGETCD1400VER 0x435910 | |
| 113 | +#define CYSETWAIT 0x435912 | |
| 114 | +#define CYGETWAIT 0x435913 | |
| 115 | + | |
| 116 | +/*************** CYCLOM-Z ADDITIONS ***************/ | |
| 117 | + | |
| 118 | +#define CZIOC ('M' << 8) | |
| 119 | +#define CZ_NBOARDS (CZIOC|0xfa) | |
| 120 | +#define CZ_BOOT_START (CZIOC|0xfb) | |
| 121 | +#define CZ_BOOT_DATA (CZIOC|0xfc) | |
| 122 | +#define CZ_BOOT_END (CZIOC|0xfd) | |
| 123 | +#define CZ_TEST (CZIOC|0xfe) | |
| 124 | + | |
| 125 | +#define CZ_DEF_POLL (HZ/25) | |
| 126 | + | |
| 127 | +#define MAX_BOARD 4 /* Max number of boards */ | |
| 128 | +#define MAX_DEV 256 /* Max number of ports total */ | |
| 129 | +#define CYZ_MAX_SPEED 921600 | |
| 130 | + | |
| 131 | +#define CYZ_FIFO_SIZE 16 | |
| 132 | + | |
| 133 | +#define CYZ_BOOT_NWORDS 0x100 | |
| 134 | +struct CYZ_BOOT_CTRL { | |
| 135 | + unsigned short nboard; | |
| 136 | + int status[MAX_BOARD]; | |
| 137 | + int nchannel[MAX_BOARD]; | |
| 138 | + int fw_rev[MAX_BOARD]; | |
| 139 | + unsigned long offset; | |
| 140 | + unsigned long data[CYZ_BOOT_NWORDS]; | |
| 141 | +}; | |
| 142 | + | |
| 143 | + | |
| 144 | +#ifndef DP_WINDOW_SIZE | |
| 145 | +/* | |
| 146 | + * Memory Window Sizes | |
| 147 | + */ | |
| 148 | + | |
| 149 | +#define DP_WINDOW_SIZE (0x00080000) /* window size 512 Kb */ | |
| 150 | +#define ZE_DP_WINDOW_SIZE (0x00100000) /* window size 1 Mb (Ze and | |
| 151 | + 8Zo V.2 */ | |
| 152 | +#define CTRL_WINDOW_SIZE (0x00000080) /* runtime regs 128 bytes */ | |
| 153 | + | |
| 154 | +/* | |
| 155 | + * CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver | |
| 156 | + * normally will access only interested on the fpga_id, fpga_version, | |
| 157 | + * start_cpu and stop_cpu. | |
| 158 | + */ | |
| 159 | + | |
| 160 | +struct CUSTOM_REG { | |
| 161 | + __u32 fpga_id; /* FPGA Identification Register */ | |
| 162 | + __u32 fpga_version; /* FPGA Version Number Register */ | |
| 163 | + __u32 cpu_start; /* CPU start Register (write) */ | |
| 164 | + __u32 cpu_stop; /* CPU stop Register (write) */ | |
| 165 | + __u32 misc_reg; /* Miscellaneous Register */ | |
| 166 | + __u32 idt_mode; /* IDT mode Register */ | |
| 167 | + __u32 uart_irq_status; /* UART IRQ status Register */ | |
| 168 | + __u32 clear_timer0_irq; /* Clear timer interrupt Register */ | |
| 169 | + __u32 clear_timer1_irq; /* Clear timer interrupt Register */ | |
| 170 | + __u32 clear_timer2_irq; /* Clear timer interrupt Register */ | |
| 171 | + __u32 test_register; /* Test Register */ | |
| 172 | + __u32 test_count; /* Test Count Register */ | |
| 173 | + __u32 timer_select; /* Timer select register */ | |
| 174 | + __u32 pr_uart_irq_status; /* Prioritized UART IRQ stat Reg */ | |
| 175 | + __u32 ram_wait_state; /* RAM wait-state Register */ | |
| 176 | + __u32 uart_wait_state; /* UART wait-state Register */ | |
| 177 | + __u32 timer_wait_state; /* timer wait-state Register */ | |
| 178 | + __u32 ack_wait_state; /* ACK wait State Register */ | |
| 179 | +}; | |
| 180 | + | |
| 181 | +/* | |
| 182 | + * RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime | |
| 183 | + * registers. This structure can be used to access the 9060 registers | |
| 184 | + * (memory mapped). | |
| 185 | + */ | |
| 186 | + | |
| 187 | +struct RUNTIME_9060 { | |
| 188 | + __u32 loc_addr_range; /* 00h - Local Address Range */ | |
| 189 | + __u32 loc_addr_base; /* 04h - Local Address Base */ | |
| 190 | + __u32 loc_arbitr; /* 08h - Local Arbitration */ | |
| 191 | + __u32 endian_descr; /* 0Ch - Big/Little Endian Descriptor */ | |
| 192 | + __u32 loc_rom_range; /* 10h - Local ROM Range */ | |
| 193 | + __u32 loc_rom_base; /* 14h - Local ROM Base */ | |
| 194 | + __u32 loc_bus_descr; /* 18h - Local Bus descriptor */ | |
| 195 | + __u32 loc_range_mst; /* 1Ch - Local Range for Master to PCI */ | |
| 196 | + __u32 loc_base_mst; /* 20h - Local Base for Master PCI */ | |
| 197 | + __u32 loc_range_io; /* 24h - Local Range for Master IO */ | |
| 198 | + __u32 pci_base_mst; /* 28h - PCI Base for Master PCI */ | |
| 199 | + __u32 pci_conf_io; /* 2Ch - PCI configuration for Master IO */ | |
| 200 | + __u32 filler1; /* 30h */ | |
| 201 | + __u32 filler2; /* 34h */ | |
| 202 | + __u32 filler3; /* 38h */ | |
| 203 | + __u32 filler4; /* 3Ch */ | |
| 204 | + __u32 mail_box_0; /* 40h - Mail Box 0 */ | |
| 205 | + __u32 mail_box_1; /* 44h - Mail Box 1 */ | |
| 206 | + __u32 mail_box_2; /* 48h - Mail Box 2 */ | |
| 207 | + __u32 mail_box_3; /* 4Ch - Mail Box 3 */ | |
| 208 | + __u32 filler5; /* 50h */ | |
| 209 | + __u32 filler6; /* 54h */ | |
| 210 | + __u32 filler7; /* 58h */ | |
| 211 | + __u32 filler8; /* 5Ch */ | |
| 212 | + __u32 pci_doorbell; /* 60h - PCI to Local Doorbell */ | |
| 213 | + __u32 loc_doorbell; /* 64h - Local to PCI Doorbell */ | |
| 214 | + __u32 intr_ctrl_stat; /* 68h - Interrupt Control/Status */ | |
| 215 | + __u32 init_ctrl; /* 6Ch - EEPROM control, Init Control, etc */ | |
| 216 | +}; | |
| 217 | + | |
| 218 | +/* Values for the Local Base Address re-map register */ | |
| 219 | + | |
| 220 | +#define WIN_RAM 0x00000001L /* set the sliding window to RAM */ | |
| 221 | +#define WIN_CREG 0x14000001L /* set the window to custom Registers */ | |
| 222 | + | |
| 223 | +/* Values timer select registers */ | |
| 224 | + | |
| 225 | +#define TIMER_BY_1M 0x00 /* clock divided by 1M */ | |
| 226 | +#define TIMER_BY_256K 0x01 /* clock divided by 256k */ | |
| 227 | +#define TIMER_BY_128K 0x02 /* clock divided by 128k */ | |
| 228 | +#define TIMER_BY_32K 0x03 /* clock divided by 32k */ | |
| 229 | + | |
| 230 | +/****************** ****************** *******************/ | |
| 231 | +#endif | |
| 232 | + | |
| 233 | +#ifndef ZFIRM_ID | |
| 234 | +/* #include "zfwint.h" */ | |
| 235 | +/****************** ****************** *******************/ | |
| 236 | +/* | |
| 237 | + * This file contains the definitions for interfacing with the | |
| 238 | + * Cyclom-Z ZFIRM Firmware. | |
| 239 | + */ | |
| 240 | + | |
| 241 | +/* General Constant definitions */ | |
| 242 | + | |
| 243 | +#define MAX_CHAN 64 /* max number of channels per board */ | |
| 244 | + | |
| 245 | +/* firmware id structure (set after boot) */ | |
| 246 | + | |
| 247 | +#define ID_ADDRESS 0x00000180L /* signature/pointer address */ | |
| 248 | +#define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */ | |
| 249 | +#define ZFIRM_HLT 0x59505B5CL /* ZFIRM needs external power supply */ | |
| 250 | +#define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */ | |
| 251 | + | |
| 252 | +#define ZF_TINACT_DEF 1000 /* default inactivity timeout | |
| 253 | + (1000 ms) */ | |
| 254 | +#define ZF_TINACT ZF_TINACT_DEF | |
| 255 | + | |
| 256 | +struct FIRM_ID { | |
| 257 | + __u32 signature; /* ZFIRM/U signature */ | |
| 258 | + __u32 zfwctrl_addr; /* pointer to ZFW_CTRL structure */ | |
| 259 | +}; | |
| 260 | + | |
| 261 | +/* Op. System id */ | |
| 262 | + | |
| 263 | +#define C_OS_LINUX 0x00000030 /* generic Linux system */ | |
| 264 | + | |
| 265 | +/* channel op_mode */ | |
| 266 | + | |
| 267 | +#define C_CH_DISABLE 0x00000000 /* channel is disabled */ | |
| 268 | +#define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */ | |
| 269 | +#define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */ | |
| 270 | +#define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */ | |
| 271 | +#define C_CH_LOOPBACK 0x00000004 /* Loopback mode */ | |
| 272 | + | |
| 273 | +/* comm_parity - parity */ | |
| 274 | + | |
| 275 | +#define C_PR_NONE 0x00000000 /* None */ | |
| 276 | +#define C_PR_ODD 0x00000001 /* Odd */ | |
| 277 | +#define C_PR_EVEN 0x00000002 /* Even */ | |
| 278 | +#define C_PR_MARK 0x00000004 /* Mark */ | |
| 279 | +#define C_PR_SPACE 0x00000008 /* Space */ | |
| 280 | +#define C_PR_PARITY 0x000000ff | |
| 281 | + | |
| 282 | +#define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */ | |
| 283 | +#define C_PR_IGNORE 0x00000200 /* ignore frame/par error */ | |
| 284 | + | |
| 285 | +/* comm_data_l - data length and stop bits */ | |
| 286 | + | |
| 287 | +#define C_DL_CS5 0x00000001 | |
| 288 | +#define C_DL_CS6 0x00000002 | |
| 289 | +#define C_DL_CS7 0x00000004 | |
| 290 | +#define C_DL_CS8 0x00000008 | |
| 291 | +#define C_DL_CS 0x0000000f | |
| 292 | +#define C_DL_1STOP 0x00000010 | |
| 293 | +#define C_DL_15STOP 0x00000020 | |
| 294 | +#define C_DL_2STOP 0x00000040 | |
| 295 | +#define C_DL_STOP 0x000000f0 | |
| 296 | + | |
| 297 | +/* interrupt enabling/status */ | |
| 298 | + | |
| 299 | +#define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */ | |
| 300 | +#define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */ | |
| 301 | +#define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */ | |
| 302 | +#define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */ | |
| 303 | +#define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */ | |
| 304 | +#define C_IN_MDCD 0x00000100 /* modem DCD change */ | |
| 305 | +#define C_IN_MDSR 0x00000200 /* modem DSR change */ | |
| 306 | +#define C_IN_MRI 0x00000400 /* modem RI change */ | |
| 307 | +#define C_IN_MCTS 0x00000800 /* modem CTS change */ | |
| 308 | +#define C_IN_RXBRK 0x00001000 /* Break received */ | |
| 309 | +#define C_IN_PR_ERROR 0x00002000 /* parity error */ | |
| 310 | +#define C_IN_FR_ERROR 0x00004000 /* frame error */ | |
| 311 | +#define C_IN_OVR_ERROR 0x00008000 /* overrun error */ | |
| 312 | +#define C_IN_RXOFL 0x00010000 /* RX buffer overflow */ | |
| 313 | +#define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */ | |
| 314 | +#define C_IN_MRTS 0x00040000 /* modem RTS drop */ | |
| 315 | +#define C_IN_ICHAR 0x00080000 | |
| 316 | + | |
| 317 | +/* flow control */ | |
| 318 | + | |
| 319 | +#define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */ | |
| 320 | +#define C_FL_IXX 0x00000002 /* output Xon/Xoff flow control */ | |
| 321 | +#define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */ | |
| 322 | +#define C_FL_SWFLOW 0x0000000f | |
| 323 | + | |
| 324 | +/* flow status */ | |
| 325 | + | |
| 326 | +#define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */ | |
| 327 | +#define C_FS_SENDING 0x00000001 /* UART is sending data */ | |
| 328 | +#define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */ | |
| 329 | + | |
| 330 | +/* rs_control/rs_status RS-232 signals */ | |
| 331 | + | |
| 332 | +#define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in | |
| 333 | + IOCTLM command */ | |
| 334 | +#define C_RS_RTS 0x00000001 /* RTS */ | |
| 335 | +#define C_RS_DTR 0x00000004 /* DTR */ | |
| 336 | +#define C_RS_DCD 0x00000100 /* CD */ | |
| 337 | +#define C_RS_DSR 0x00000200 /* DSR */ | |
| 338 | +#define C_RS_RI 0x00000400 /* RI */ | |
| 339 | +#define C_RS_CTS 0x00000800 /* CTS */ | |
| 340 | + | |
| 341 | +/* commands Host <-> Board */ | |
| 342 | + | |
| 343 | +#define C_CM_RESET 0x01 /* reset/flush buffers */ | |
| 344 | +#define C_CM_IOCTL 0x02 /* re-read CH_CTRL */ | |
| 345 | +#define C_CM_IOCTLW 0x03 /* re-read CH_CTRL, intr when done */ | |
| 346 | +#define C_CM_IOCTLM 0x04 /* RS-232 outputs change */ | |
| 347 | +#define C_CM_SENDXOFF 0x10 /* send Xoff */ | |
| 348 | +#define C_CM_SENDXON 0x11 /* send Xon */ | |
| 349 | +#define C_CM_CLFLOW 0x12 /* Clear flow control (resume) */ | |
| 350 | +#define C_CM_SENDBRK 0x41 /* send break */ | |
| 351 | +#define C_CM_INTBACK 0x42 /* Interrupt back */ | |
| 352 | +#define C_CM_SET_BREAK 0x43 /* Tx break on */ | |
| 353 | +#define C_CM_CLR_BREAK 0x44 /* Tx break off */ | |
| 354 | +#define C_CM_CMD_DONE 0x45 /* Previous command done */ | |
| 355 | +#define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */ | |
| 356 | +#define C_CM_TINACT 0x51 /* set inactivity detection */ | |
| 357 | +#define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */ | |
| 358 | +#define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */ | |
| 359 | +#define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */ | |
| 360 | +#define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */ | |
| 361 | +#define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */ | |
| 362 | +#define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */ | |
| 363 | +#define C_CM_Q_ENABLE 0x58 /* enables queue access from the | |
| 364 | + driver */ | |
| 365 | +#define C_CM_Q_DISABLE 0x59 /* disables queue access from the | |
| 366 | + driver */ | |
| 367 | + | |
| 368 | +#define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */ | |
| 369 | +#define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */ | |
| 370 | +#define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */ | |
| 371 | +#define C_CM_RXNNDT 0x63 /* rx no new data timeout */ | |
| 372 | +#define C_CM_TXFEMPTY 0x64 | |
| 373 | +#define C_CM_ICHAR 0x65 | |
| 374 | +#define C_CM_MDCD 0x70 /* modem DCD change */ | |
| 375 | +#define C_CM_MDSR 0x71 /* modem DSR change */ | |
| 376 | +#define C_CM_MRI 0x72 /* modem RI change */ | |
| 377 | +#define C_CM_MCTS 0x73 /* modem CTS change */ | |
| 378 | +#define C_CM_MRTS 0x74 /* modem RTS drop */ | |
| 379 | +#define C_CM_RXBRK 0x84 /* Break received */ | |
| 380 | +#define C_CM_PR_ERROR 0x85 /* Parity error */ | |
| 381 | +#define C_CM_FR_ERROR 0x86 /* Frame error */ | |
| 382 | +#define C_CM_OVR_ERROR 0x87 /* Overrun error */ | |
| 383 | +#define C_CM_RXOFL 0x88 /* RX buffer overflow */ | |
| 384 | +#define C_CM_CMDERROR 0x90 /* command error */ | |
| 385 | +#define C_CM_FATAL 0x91 /* fatal error */ | |
| 386 | +#define C_CM_HW_RESET 0x92 /* reset board */ | |
| 387 | + | |
| 388 | +/* | |
| 389 | + * CH_CTRL - This per port structure contains all parameters | |
| 390 | + * that control an specific port. It can be seen as the | |
| 391 | + * configuration registers of a "super-serial-controller". | |
| 392 | + */ | |
| 393 | + | |
| 394 | +struct CH_CTRL { | |
| 395 | + __u32 op_mode; /* operation mode */ | |
| 396 | + __u32 intr_enable; /* interrupt masking */ | |
| 397 | + __u32 sw_flow; /* SW flow control */ | |
| 398 | + __u32 flow_status; /* output flow status */ | |
| 399 | + __u32 comm_baud; /* baud rate - numerically specified */ | |
| 400 | + __u32 comm_parity; /* parity */ | |
| 401 | + __u32 comm_data_l; /* data length/stop */ | |
| 402 | + __u32 comm_flags; /* other flags */ | |
| 403 | + __u32 hw_flow; /* HW flow control */ | |
| 404 | + __u32 rs_control; /* RS-232 outputs */ | |
| 405 | + __u32 rs_status; /* RS-232 inputs */ | |
| 406 | + __u32 flow_xon; /* xon char */ | |
| 407 | + __u32 flow_xoff; /* xoff char */ | |
| 408 | + __u32 hw_overflow; /* hw overflow counter */ | |
| 409 | + __u32 sw_overflow; /* sw overflow counter */ | |
| 410 | + __u32 comm_error; /* frame/parity error counter */ | |
| 411 | + __u32 ichar; | |
| 412 | + __u32 filler[7]; | |
| 413 | +}; | |
| 414 | + | |
| 415 | + | |
| 416 | +/* | |
| 417 | + * BUF_CTRL - This per channel structure contains | |
| 418 | + * all Tx and Rx buffer control for a given channel. | |
| 419 | + */ | |
| 420 | + | |
| 421 | +struct BUF_CTRL { | |
| 422 | + __u32 flag_dma; /* buffers are in Host memory */ | |
| 423 | + __u32 tx_bufaddr; /* address of the tx buffer */ | |
| 424 | + __u32 tx_bufsize; /* tx buffer size */ | |
| 425 | + __u32 tx_threshold; /* tx low water mark */ | |
| 426 | + __u32 tx_get; /* tail index tx buf */ | |
| 427 | + __u32 tx_put; /* head index tx buf */ | |
| 428 | + __u32 rx_bufaddr; /* address of the rx buffer */ | |
| 429 | + __u32 rx_bufsize; /* rx buffer size */ | |
| 430 | + __u32 rx_threshold; /* rx high water mark */ | |
| 431 | + __u32 rx_get; /* tail index rx buf */ | |
| 432 | + __u32 rx_put; /* head index rx buf */ | |
| 433 | + __u32 filler[5]; /* filler to align structures */ | |
| 434 | +}; | |
| 435 | + | |
| 436 | +/* | |
| 437 | + * BOARD_CTRL - This per board structure contains all global | |
| 438 | + * control fields related to the board. | |
| 439 | + */ | |
| 440 | + | |
| 441 | +struct BOARD_CTRL { | |
| 442 | + | |
| 443 | + /* static info provided by the on-board CPU */ | |
| 444 | + __u32 n_channel; /* number of channels */ | |
| 445 | + __u32 fw_version; /* firmware version */ | |
| 446 | + | |
| 447 | + /* static info provided by the driver */ | |
| 448 | + __u32 op_system; /* op_system id */ | |
| 449 | + __u32 dr_version; /* driver version */ | |
| 450 | + | |
| 451 | + /* board control area */ | |
| 452 | + __u32 inactivity; /* inactivity control */ | |
| 453 | + | |
| 454 | + /* host to FW commands */ | |
| 455 | + __u32 hcmd_channel; /* channel number */ | |
| 456 | + __u32 hcmd_param; /* pointer to parameters */ | |
| 457 | + | |
| 458 | + /* FW to Host commands */ | |
| 459 | + __u32 fwcmd_channel; /* channel number */ | |
| 460 | + __u32 fwcmd_param; /* pointer to parameters */ | |
| 461 | + __u32 zf_int_queue_addr; /* offset for INT_QUEUE structure */ | |
| 462 | + | |
| 463 | + /* filler so the structures are aligned */ | |
| 464 | + __u32 filler[6]; | |
| 465 | +}; | |
| 466 | + | |
| 467 | +/* Host Interrupt Queue */ | |
| 468 | + | |
| 469 | +#define QUEUE_SIZE (10*MAX_CHAN) | |
| 470 | + | |
| 471 | +struct INT_QUEUE { | |
| 472 | + unsigned char intr_code[QUEUE_SIZE]; | |
| 473 | + unsigned long channel[QUEUE_SIZE]; | |
| 474 | + unsigned long param[QUEUE_SIZE]; | |
| 475 | + unsigned long put; | |
| 476 | + unsigned long get; | |
| 477 | +}; | |
| 478 | + | |
| 479 | +/* | |
| 480 | + * ZFW_CTRL - This is the data structure that includes all other | |
| 481 | + * data structures used by the Firmware. | |
| 482 | + */ | |
| 483 | + | |
| 484 | +struct ZFW_CTRL { | |
| 485 | + struct BOARD_CTRL board_ctrl; | |
| 486 | + struct CH_CTRL ch_ctrl[MAX_CHAN]; | |
| 487 | + struct BUF_CTRL buf_ctrl[MAX_CHAN]; | |
| 488 | +}; | |
| 489 | + | |
| 490 | +/****************** ****************** *******************/ | |
| 491 | +#endif | |
| 492 | + | |
| 493 | +#endif /* _UAPI_LINUX_CYCLADES_H */ | |
| @@ -0,0 +1,101 @@ | ||
| 1 | +/* | |
| 2 | +* cycx_cfm.h Cyclom 2X WAN Link Driver. | |
| 3 | +* Definitions for the Cyclom 2X Firmware Module (CFM). | |
| 4 | +* | |
| 5 | +* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | |
| 6 | +* | |
| 7 | +* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo | |
| 8 | +* | |
| 9 | +* Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com> | |
| 10 | +* | |
| 11 | +* This program is free software; you can redistribute it and/or | |
| 12 | +* modify it under the terms of the GNU General Public License | |
| 13 | +* as published by the Free Software Foundation; either version | |
| 14 | +* 2 of the License, or (at your option) any later version. | |
| 15 | +* ============================================================================ | |
| 16 | +* 1998/08/08 acme Initial version. | |
| 17 | +*/ | |
| 18 | +#ifndef _CYCX_CFM_H | |
| 19 | +#define _CYCX_CFM_H | |
| 20 | + | |
| 21 | +/* Defines */ | |
| 22 | + | |
| 23 | +#define CFM_VERSION 2 | |
| 24 | +#define CFM_SIGNATURE "CFM - Cyclades CYCX Firmware Module" | |
| 25 | + | |
| 26 | +/* min/max */ | |
| 27 | +#define CFM_IMAGE_SIZE 0x20000 /* max size of CYCX code image file */ | |
| 28 | +#define CFM_DESCR_LEN 256 /* max length of description string */ | |
| 29 | +#define CFM_MAX_CYCX 1 /* max number of compatible adapters */ | |
| 30 | +#define CFM_LOAD_BUFSZ 0x400 /* buffer size for reset code (buffer_load) */ | |
| 31 | + | |
| 32 | +/* Firmware Commands */ | |
| 33 | +#define GEN_POWER_ON 0x1280 | |
| 34 | + | |
| 35 | +#define GEN_SET_SEG 0x1401 /* boot segment setting. */ | |
| 36 | +#define GEN_BOOT_DAT 0x1402 /* boot data. */ | |
| 37 | +#define GEN_START 0x1403 /* board start. */ | |
| 38 | +#define GEN_DEFPAR 0x1404 /* buffer length for boot. */ | |
| 39 | + | |
| 40 | +/* Adapter Types */ | |
| 41 | +#define CYCX_2X 2 | |
| 42 | +/* for now only the 2X is supported, no plans to support 8X or 16X */ | |
| 43 | +#define CYCX_8X 8 | |
| 44 | +#define CYCX_16X 16 | |
| 45 | + | |
| 46 | +#define CFID_X25_2X 5200 | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * struct cycx_fw_info - firmware module information. | |
| 50 | + * @codeid - firmware ID | |
| 51 | + * @version - firmware version number | |
| 52 | + * @adapter - compatible adapter types | |
| 53 | + * @memsize - minimum memory size | |
| 54 | + * @reserved - reserved | |
| 55 | + * @startoffs - entry point offset | |
| 56 | + * @winoffs - dual-port memory window offset | |
| 57 | + * @codeoffs - code load offset | |
| 58 | + * @codesize - code size | |
| 59 | + * @dataoffs - configuration data load offset | |
| 60 | + * @datasize - configuration data size | |
| 61 | + */ | |
| 62 | +struct cycx_fw_info { | |
| 63 | + unsigned short codeid; | |
| 64 | + unsigned short version; | |
| 65 | + unsigned short adapter[CFM_MAX_CYCX]; | |
| 66 | + unsigned long memsize; | |
| 67 | + unsigned short reserved[2]; | |
| 68 | + unsigned short startoffs; | |
| 69 | + unsigned short winoffs; | |
| 70 | + unsigned short codeoffs; | |
| 71 | + unsigned long codesize; | |
| 72 | + unsigned short dataoffs; | |
| 73 | + unsigned long datasize; | |
| 74 | +}; | |
| 75 | + | |
| 76 | +/** | |
| 77 | + * struct cycx_firmware - CYCX firmware file structure | |
| 78 | + * @signature - CFM file signature | |
| 79 | + * @version - file format version | |
| 80 | + * @checksum - info + image | |
| 81 | + * @reserved - reserved | |
| 82 | + * @descr - description string | |
| 83 | + * @info - firmware module info | |
| 84 | + * @image - code image (variable size) | |
| 85 | + */ | |
| 86 | +struct cycx_firmware { | |
| 87 | + char signature[80]; | |
| 88 | + unsigned short version; | |
| 89 | + unsigned short checksum; | |
| 90 | + unsigned short reserved[6]; | |
| 91 | + char descr[CFM_DESCR_LEN]; | |
| 92 | + struct cycx_fw_info info; | |
| 93 | + unsigned char image[0]; | |
| 94 | +}; | |
| 95 | + | |
| 96 | +struct cycx_fw_header { | |
| 97 | + unsigned long reset_size; | |
| 98 | + unsigned long data_size; | |
| 99 | + unsigned long code_size; | |
| 100 | +}; | |
| 101 | +#endif /* _CYCX_CFM_H */ | |
| @@ -0,0 +1,684 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2008-2011, Intel Corporation. | |
| 3 | + * | |
| 4 | + * This program is free software; you can redistribute it and/or modify it | |
| 5 | + * under the terms and conditions of the GNU General Public License, | |
| 6 | + * version 2, as published by the Free Software Foundation. | |
| 7 | + * | |
| 8 | + * This program is distributed in the hope it will be useful, but WITHOUT | |
| 9 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 10 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 11 | + * more details. | |
| 12 | + * | |
| 13 | + * You should have received a copy of the GNU General Public License along with | |
| 14 | + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
| 15 | + * Place - Suite 330, Boston, MA 02111-1307 USA. | |
| 16 | + * | |
| 17 | + * Author: Lucy Liu <lucy.liu@intel.com> | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#ifndef __LINUX_DCBNL_H__ | |
| 21 | +#define __LINUX_DCBNL_H__ | |
| 22 | + | |
| 23 | +#include <linux/types.h> | |
| 24 | + | |
| 25 | +/* IEEE 802.1Qaz std supported values */ | |
| 26 | +#define IEEE_8021QAZ_MAX_TCS 8 | |
| 27 | + | |
| 28 | +#define IEEE_8021QAZ_TSA_STRICT 0 | |
| 29 | +#define IEEE_8021QAZ_TSA_CB_SHAPER 1 | |
| 30 | +#define IEEE_8021QAZ_TSA_ETS 2 | |
| 31 | +#define IEEE_8021QAZ_TSA_VENDOR 255 | |
| 32 | + | |
| 33 | +/* This structure contains the IEEE 802.1Qaz ETS managed object | |
| 34 | + * | |
| 35 | + * @willing: willing bit in ETS configuration TLV | |
| 36 | + * @ets_cap: indicates supported capacity of ets feature | |
| 37 | + * @cbs: credit based shaper ets algorithm supported | |
| 38 | + * @tc_tx_bw: tc tx bandwidth indexed by traffic class | |
| 39 | + * @tc_rx_bw: tc rx bandwidth indexed by traffic class | |
| 40 | + * @tc_tsa: TSA Assignment table, indexed by traffic class | |
| 41 | + * @prio_tc: priority assignment table mapping 8021Qp to traffic class | |
| 42 | + * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV | |
| 43 | + * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV | |
| 44 | + * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV | |
| 45 | + * | |
| 46 | + * Recommended values are used to set fields in the ETS recommendation TLV | |
| 47 | + * with hardware offloaded LLDP. | |
| 48 | + * | |
| 49 | + * ---- | |
| 50 | + * TSA Assignment 8 bit identifiers | |
| 51 | + * 0 strict priority | |
| 52 | + * 1 credit-based shaper | |
| 53 | + * 2 enhanced transmission selection | |
| 54 | + * 3-254 reserved | |
| 55 | + * 255 vendor specific | |
| 56 | + */ | |
| 57 | +struct ieee_ets { | |
| 58 | + __u8 willing; | |
| 59 | + __u8 ets_cap; | |
| 60 | + __u8 cbs; | |
| 61 | + __u8 tc_tx_bw[IEEE_8021QAZ_MAX_TCS]; | |
| 62 | + __u8 tc_rx_bw[IEEE_8021QAZ_MAX_TCS]; | |
| 63 | + __u8 tc_tsa[IEEE_8021QAZ_MAX_TCS]; | |
| 64 | + __u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; | |
| 65 | + __u8 tc_reco_bw[IEEE_8021QAZ_MAX_TCS]; | |
| 66 | + __u8 tc_reco_tsa[IEEE_8021QAZ_MAX_TCS]; | |
| 67 | + __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; | |
| 68 | +}; | |
| 69 | + | |
| 70 | +/* This structure contains rate limit extension to the IEEE 802.1Qaz ETS | |
| 71 | + * managed object. | |
| 72 | + * Values are 64 bits long and specified in Kbps to enable usage over both | |
| 73 | + * slow and very fast networks. | |
| 74 | + * | |
| 75 | + * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class | |
| 76 | + */ | |
| 77 | +struct ieee_maxrate { | |
| 78 | + __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; | |
| 79 | +}; | |
| 80 | + | |
| 81 | +/* This structure contains the IEEE 802.1Qaz PFC managed object | |
| 82 | + * | |
| 83 | + * @pfc_cap: Indicates the number of traffic classes on the local device | |
| 84 | + * that may simultaneously have PFC enabled. | |
| 85 | + * @pfc_en: bitmap indicating pfc enabled traffic classes | |
| 86 | + * @mbc: enable macsec bypass capability | |
| 87 | + * @delay: the allowance made for a round-trip propagation delay of the | |
| 88 | + * link in bits. | |
| 89 | + * @requests: count of the sent pfc frames | |
| 90 | + * @indications: count of the received pfc frames | |
| 91 | + */ | |
| 92 | +struct ieee_pfc { | |
| 93 | + __u8 pfc_cap; | |
| 94 | + __u8 pfc_en; | |
| 95 | + __u8 mbc; | |
| 96 | + __u16 delay; | |
| 97 | + __u64 requests[IEEE_8021QAZ_MAX_TCS]; | |
| 98 | + __u64 indications[IEEE_8021QAZ_MAX_TCS]; | |
| 99 | +}; | |
| 100 | + | |
| 101 | +/* CEE DCBX std supported values */ | |
| 102 | +#define CEE_DCBX_MAX_PGS 8 | |
| 103 | +#define CEE_DCBX_MAX_PRIO 8 | |
| 104 | + | |
| 105 | +/** | |
| 106 | + * struct cee_pg - CEE Priority-Group managed object | |
| 107 | + * | |
| 108 | + * @willing: willing bit in the PG tlv | |
| 109 | + * @error: error bit in the PG tlv | |
| 110 | + * @pg_en: enable bit of the PG feature | |
| 111 | + * @tcs_supported: number of traffic classes supported | |
| 112 | + * @pg_bw: bandwidth percentage for each priority group | |
| 113 | + * @prio_pg: priority to PG mapping indexed by priority | |
| 114 | + */ | |
| 115 | +struct cee_pg { | |
| 116 | + __u8 willing; | |
| 117 | + __u8 error; | |
| 118 | + __u8 pg_en; | |
| 119 | + __u8 tcs_supported; | |
| 120 | + __u8 pg_bw[CEE_DCBX_MAX_PGS]; | |
| 121 | + __u8 prio_pg[CEE_DCBX_MAX_PGS]; | |
| 122 | +}; | |
| 123 | + | |
| 124 | +/** | |
| 125 | + * struct cee_pfc - CEE PFC managed object | |
| 126 | + * | |
| 127 | + * @willing: willing bit in the PFC tlv | |
| 128 | + * @error: error bit in the PFC tlv | |
| 129 | + * @pfc_en: bitmap indicating pfc enabled traffic classes | |
| 130 | + * @tcs_supported: number of traffic classes supported | |
| 131 | + */ | |
| 132 | +struct cee_pfc { | |
| 133 | + __u8 willing; | |
| 134 | + __u8 error; | |
| 135 | + __u8 pfc_en; | |
| 136 | + __u8 tcs_supported; | |
| 137 | +}; | |
| 138 | + | |
| 139 | +/* IEEE 802.1Qaz std supported values */ | |
| 140 | +#define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1 | |
| 141 | +#define IEEE_8021QAZ_APP_SEL_STREAM 2 | |
| 142 | +#define IEEE_8021QAZ_APP_SEL_DGRAM 3 | |
| 143 | +#define IEEE_8021QAZ_APP_SEL_ANY 4 | |
| 144 | + | |
| 145 | +/* This structure contains the IEEE 802.1Qaz APP managed object. This | |
| 146 | + * object is also used for the CEE std as well. There is no difference | |
| 147 | + * between the objects. | |
| 148 | + * | |
| 149 | + * @selector: protocol identifier type | |
| 150 | + * @protocol: protocol of type indicated | |
| 151 | + * @priority: 3-bit unsigned integer indicating priority | |
| 152 | + * | |
| 153 | + * ---- | |
| 154 | + * Selector field values | |
| 155 | + * 0 Reserved | |
| 156 | + * 1 Ethertype | |
| 157 | + * 2 Well known port number over TCP or SCTP | |
| 158 | + * 3 Well known port number over UDP or DCCP | |
| 159 | + * 4 Well known port number over TCP, SCTP, UDP, or DCCP | |
| 160 | + * 5-7 Reserved | |
| 161 | + */ | |
| 162 | +struct dcb_app { | |
| 163 | + __u8 selector; | |
| 164 | + __u8 priority; | |
| 165 | + __u16 protocol; | |
| 166 | +}; | |
| 167 | + | |
| 168 | +/** | |
| 169 | + * struct dcb_peer_app_info - APP feature information sent by the peer | |
| 170 | + * | |
| 171 | + * @willing: willing bit in the peer APP tlv | |
| 172 | + * @error: error bit in the peer APP tlv | |
| 173 | + * | |
| 174 | + * In addition to this information the full peer APP tlv also contains | |
| 175 | + * a table of 'app_count' APP objects defined above. | |
| 176 | + */ | |
| 177 | +struct dcb_peer_app_info { | |
| 178 | + __u8 willing; | |
| 179 | + __u8 error; | |
| 180 | +}; | |
| 181 | + | |
| 182 | +struct dcbmsg { | |
| 183 | + __u8 dcb_family; | |
| 184 | + __u8 cmd; | |
| 185 | + __u16 dcb_pad; | |
| 186 | +}; | |
| 187 | + | |
| 188 | +/** | |
| 189 | + * enum dcbnl_commands - supported DCB commands | |
| 190 | + * | |
| 191 | + * @DCB_CMD_UNDEFINED: unspecified command to catch errors | |
| 192 | + * @DCB_CMD_GSTATE: request the state of DCB in the device | |
| 193 | + * @DCB_CMD_SSTATE: set the state of DCB in the device | |
| 194 | + * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx | |
| 195 | + * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx | |
| 196 | + * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx | |
| 197 | + * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx | |
| 198 | + * @DCB_CMD_PFC_GCFG: request the priority flow control configuration | |
| 199 | + * @DCB_CMD_PFC_SCFG: set the priority flow control configuration | |
| 200 | + * @DCB_CMD_SET_ALL: apply all changes to the underlying device | |
| 201 | + * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying | |
| 202 | + * device. Only useful when using bonding. | |
| 203 | + * @DCB_CMD_GCAP: request the DCB capabilities of the device | |
| 204 | + * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported | |
| 205 | + * @DCB_CMD_SNUMTCS: set the number of traffic classes | |
| 206 | + * @DCB_CMD_GBCN: set backward congestion notification configuration | |
| 207 | + * @DCB_CMD_SBCN: get backward congestion notification configration. | |
| 208 | + * @DCB_CMD_GAPP: get application protocol configuration | |
| 209 | + * @DCB_CMD_SAPP: set application protocol configuration | |
| 210 | + * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration | |
| 211 | + * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration | |
| 212 | + * @DCB_CMD_GDCBX: get DCBX engine configuration | |
| 213 | + * @DCB_CMD_SDCBX: set DCBX engine configuration | |
| 214 | + * @DCB_CMD_GFEATCFG: get DCBX features flags | |
| 215 | + * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags | |
| 216 | + * @DCB_CMD_CEE_GET: get CEE aggregated configuration | |
| 217 | + * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration | |
| 218 | + */ | |
| 219 | +enum dcbnl_commands { | |
| 220 | + DCB_CMD_UNDEFINED, | |
| 221 | + | |
| 222 | + DCB_CMD_GSTATE, | |
| 223 | + DCB_CMD_SSTATE, | |
| 224 | + | |
| 225 | + DCB_CMD_PGTX_GCFG, | |
| 226 | + DCB_CMD_PGTX_SCFG, | |
| 227 | + DCB_CMD_PGRX_GCFG, | |
| 228 | + DCB_CMD_PGRX_SCFG, | |
| 229 | + | |
| 230 | + DCB_CMD_PFC_GCFG, | |
| 231 | + DCB_CMD_PFC_SCFG, | |
| 232 | + | |
| 233 | + DCB_CMD_SET_ALL, | |
| 234 | + | |
| 235 | + DCB_CMD_GPERM_HWADDR, | |
| 236 | + | |
| 237 | + DCB_CMD_GCAP, | |
| 238 | + | |
| 239 | + DCB_CMD_GNUMTCS, | |
| 240 | + DCB_CMD_SNUMTCS, | |
| 241 | + | |
| 242 | + DCB_CMD_PFC_GSTATE, | |
| 243 | + DCB_CMD_PFC_SSTATE, | |
| 244 | + | |
| 245 | + DCB_CMD_BCN_GCFG, | |
| 246 | + DCB_CMD_BCN_SCFG, | |
| 247 | + | |
| 248 | + DCB_CMD_GAPP, | |
| 249 | + DCB_CMD_SAPP, | |
| 250 | + | |
| 251 | + DCB_CMD_IEEE_SET, | |
| 252 | + DCB_CMD_IEEE_GET, | |
| 253 | + | |
| 254 | + DCB_CMD_GDCBX, | |
| 255 | + DCB_CMD_SDCBX, | |
| 256 | + | |
| 257 | + DCB_CMD_GFEATCFG, | |
| 258 | + DCB_CMD_SFEATCFG, | |
| 259 | + | |
| 260 | + DCB_CMD_CEE_GET, | |
| 261 | + DCB_CMD_IEEE_DEL, | |
| 262 | + | |
| 263 | + __DCB_CMD_ENUM_MAX, | |
| 264 | + DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, | |
| 265 | +}; | |
| 266 | + | |
| 267 | +/** | |
| 268 | + * enum dcbnl_attrs - DCB top-level netlink attributes | |
| 269 | + * | |
| 270 | + * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors | |
| 271 | + * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING) | |
| 272 | + * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8) | |
| 273 | + * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8) | |
| 274 | + * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED) | |
| 275 | + * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8) | |
| 276 | + * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED) | |
| 277 | + * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8) | |
| 278 | + * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED) | |
| 279 | + * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED) | |
| 280 | + * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED) | |
| 281 | + * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED) | |
| 282 | + * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) | |
| 283 | + * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) | |
| 284 | + * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) | |
| 285 | + * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED) | |
| 286 | + */ | |
| 287 | +enum dcbnl_attrs { | |
| 288 | + DCB_ATTR_UNDEFINED, | |
| 289 | + | |
| 290 | + DCB_ATTR_IFNAME, | |
| 291 | + DCB_ATTR_STATE, | |
| 292 | + DCB_ATTR_PFC_STATE, | |
| 293 | + DCB_ATTR_PFC_CFG, | |
| 294 | + DCB_ATTR_NUM_TC, | |
| 295 | + DCB_ATTR_PG_CFG, | |
| 296 | + DCB_ATTR_SET_ALL, | |
| 297 | + DCB_ATTR_PERM_HWADDR, | |
| 298 | + DCB_ATTR_CAP, | |
| 299 | + DCB_ATTR_NUMTCS, | |
| 300 | + DCB_ATTR_BCN, | |
| 301 | + DCB_ATTR_APP, | |
| 302 | + | |
| 303 | + /* IEEE std attributes */ | |
| 304 | + DCB_ATTR_IEEE, | |
| 305 | + | |
| 306 | + DCB_ATTR_DCBX, | |
| 307 | + DCB_ATTR_FEATCFG, | |
| 308 | + | |
| 309 | + /* CEE nested attributes */ | |
| 310 | + DCB_ATTR_CEE, | |
| 311 | + | |
| 312 | + __DCB_ATTR_ENUM_MAX, | |
| 313 | + DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, | |
| 314 | +}; | |
| 315 | + | |
| 316 | +/** | |
| 317 | + * enum ieee_attrs - IEEE 802.1Qaz get/set attributes | |
| 318 | + * | |
| 319 | + * @DCB_ATTR_IEEE_UNSPEC: unspecified | |
| 320 | + * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration | |
| 321 | + * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration | |
| 322 | + * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration | |
| 323 | + * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only | |
| 324 | + * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only | |
| 325 | + * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only | |
| 326 | + */ | |
| 327 | +enum ieee_attrs { | |
| 328 | + DCB_ATTR_IEEE_UNSPEC, | |
| 329 | + DCB_ATTR_IEEE_ETS, | |
| 330 | + DCB_ATTR_IEEE_PFC, | |
| 331 | + DCB_ATTR_IEEE_APP_TABLE, | |
| 332 | + DCB_ATTR_IEEE_PEER_ETS, | |
| 333 | + DCB_ATTR_IEEE_PEER_PFC, | |
| 334 | + DCB_ATTR_IEEE_PEER_APP, | |
| 335 | + DCB_ATTR_IEEE_MAXRATE, | |
| 336 | + __DCB_ATTR_IEEE_MAX | |
| 337 | +}; | |
| 338 | +#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) | |
| 339 | + | |
| 340 | +enum ieee_attrs_app { | |
| 341 | + DCB_ATTR_IEEE_APP_UNSPEC, | |
| 342 | + DCB_ATTR_IEEE_APP, | |
| 343 | + __DCB_ATTR_IEEE_APP_MAX | |
| 344 | +}; | |
| 345 | +#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) | |
| 346 | + | |
| 347 | +/** | |
| 348 | + * enum cee_attrs - CEE DCBX get attributes. | |
| 349 | + * | |
| 350 | + * @DCB_ATTR_CEE_UNSPEC: unspecified | |
| 351 | + * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only | |
| 352 | + * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only | |
| 353 | + * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only | |
| 354 | + * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG) | |
| 355 | + * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG) | |
| 356 | + * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG) | |
| 357 | + * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP) | |
| 358 | + * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG) | |
| 359 | + * | |
| 360 | + * An aggregated collection of the cee std negotiated parameters. | |
| 361 | + */ | |
| 362 | +enum cee_attrs { | |
| 363 | + DCB_ATTR_CEE_UNSPEC, | |
| 364 | + DCB_ATTR_CEE_PEER_PG, | |
| 365 | + DCB_ATTR_CEE_PEER_PFC, | |
| 366 | + DCB_ATTR_CEE_PEER_APP_TABLE, | |
| 367 | + DCB_ATTR_CEE_TX_PG, | |
| 368 | + DCB_ATTR_CEE_RX_PG, | |
| 369 | + DCB_ATTR_CEE_PFC, | |
| 370 | + DCB_ATTR_CEE_APP_TABLE, | |
| 371 | + DCB_ATTR_CEE_FEAT, | |
| 372 | + __DCB_ATTR_CEE_MAX | |
| 373 | +}; | |
| 374 | +#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1) | |
| 375 | + | |
| 376 | +enum peer_app_attr { | |
| 377 | + DCB_ATTR_CEE_PEER_APP_UNSPEC, | |
| 378 | + DCB_ATTR_CEE_PEER_APP_INFO, | |
| 379 | + DCB_ATTR_CEE_PEER_APP, | |
| 380 | + __DCB_ATTR_CEE_PEER_APP_MAX | |
| 381 | +}; | |
| 382 | +#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1) | |
| 383 | + | |
| 384 | +enum cee_attrs_app { | |
| 385 | + DCB_ATTR_CEE_APP_UNSPEC, | |
| 386 | + DCB_ATTR_CEE_APP, | |
| 387 | + __DCB_ATTR_CEE_APP_MAX | |
| 388 | +}; | |
| 389 | +#define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1) | |
| 390 | + | |
| 391 | +/** | |
| 392 | + * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs | |
| 393 | + * | |
| 394 | + * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors | |
| 395 | + * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8) | |
| 396 | + * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8) | |
| 397 | + * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8) | |
| 398 | + * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8) | |
| 399 | + * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8) | |
| 400 | + * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8) | |
| 401 | + * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8) | |
| 402 | + * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8) | |
| 403 | + * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined | |
| 404 | + * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG) | |
| 405 | + * | |
| 406 | + */ | |
| 407 | +enum dcbnl_pfc_up_attrs { | |
| 408 | + DCB_PFC_UP_ATTR_UNDEFINED, | |
| 409 | + | |
| 410 | + DCB_PFC_UP_ATTR_0, | |
| 411 | + DCB_PFC_UP_ATTR_1, | |
| 412 | + DCB_PFC_UP_ATTR_2, | |
| 413 | + DCB_PFC_UP_ATTR_3, | |
| 414 | + DCB_PFC_UP_ATTR_4, | |
| 415 | + DCB_PFC_UP_ATTR_5, | |
| 416 | + DCB_PFC_UP_ATTR_6, | |
| 417 | + DCB_PFC_UP_ATTR_7, | |
| 418 | + DCB_PFC_UP_ATTR_ALL, | |
| 419 | + | |
| 420 | + __DCB_PFC_UP_ATTR_ENUM_MAX, | |
| 421 | + DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1, | |
| 422 | +}; | |
| 423 | + | |
| 424 | +/** | |
| 425 | + * enum dcbnl_pg_attrs - DCB Priority Group attributes | |
| 426 | + * | |
| 427 | + * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors | |
| 428 | + * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED) | |
| 429 | + * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED) | |
| 430 | + * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED) | |
| 431 | + * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED) | |
| 432 | + * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED) | |
| 433 | + * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED) | |
| 434 | + * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED) | |
| 435 | + * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED) | |
| 436 | + * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined | |
| 437 | + * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED) | |
| 438 | + * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8) | |
| 439 | + * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8) | |
| 440 | + * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8) | |
| 441 | + * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8) | |
| 442 | + * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8) | |
| 443 | + * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8) | |
| 444 | + * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8) | |
| 445 | + * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8) | |
| 446 | + * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined | |
| 447 | + * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG) | |
| 448 | + * | |
| 449 | + */ | |
| 450 | +enum dcbnl_pg_attrs { | |
| 451 | + DCB_PG_ATTR_UNDEFINED, | |
| 452 | + | |
| 453 | + DCB_PG_ATTR_TC_0, | |
| 454 | + DCB_PG_ATTR_TC_1, | |
| 455 | + DCB_PG_ATTR_TC_2, | |
| 456 | + DCB_PG_ATTR_TC_3, | |
| 457 | + DCB_PG_ATTR_TC_4, | |
| 458 | + DCB_PG_ATTR_TC_5, | |
| 459 | + DCB_PG_ATTR_TC_6, | |
| 460 | + DCB_PG_ATTR_TC_7, | |
| 461 | + DCB_PG_ATTR_TC_MAX, | |
| 462 | + DCB_PG_ATTR_TC_ALL, | |
| 463 | + | |
| 464 | + DCB_PG_ATTR_BW_ID_0, | |
| 465 | + DCB_PG_ATTR_BW_ID_1, | |
| 466 | + DCB_PG_ATTR_BW_ID_2, | |
| 467 | + DCB_PG_ATTR_BW_ID_3, | |
| 468 | + DCB_PG_ATTR_BW_ID_4, | |
| 469 | + DCB_PG_ATTR_BW_ID_5, | |
| 470 | + DCB_PG_ATTR_BW_ID_6, | |
| 471 | + DCB_PG_ATTR_BW_ID_7, | |
| 472 | + DCB_PG_ATTR_BW_ID_MAX, | |
| 473 | + DCB_PG_ATTR_BW_ID_ALL, | |
| 474 | + | |
| 475 | + __DCB_PG_ATTR_ENUM_MAX, | |
| 476 | + DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1, | |
| 477 | +}; | |
| 478 | + | |
| 479 | +/** | |
| 480 | + * enum dcbnl_tc_attrs - DCB Traffic Class attributes | |
| 481 | + * | |
| 482 | + * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors | |
| 483 | + * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to | |
| 484 | + * Valid values are: 0-7 | |
| 485 | + * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map | |
| 486 | + * Some devices may not support changing the | |
| 487 | + * user priority map of a TC. | |
| 488 | + * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting | |
| 489 | + * 0 - none | |
| 490 | + * 1 - group strict | |
| 491 | + * 2 - link strict | |
| 492 | + * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and | |
| 493 | + * not configured to use link strict priority, | |
| 494 | + * this is the percentage of bandwidth of the | |
| 495 | + * priority group this traffic class belongs to | |
| 496 | + * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters | |
| 497 | + * | |
| 498 | + */ | |
| 499 | +enum dcbnl_tc_attrs { | |
| 500 | + DCB_TC_ATTR_PARAM_UNDEFINED, | |
| 501 | + | |
| 502 | + DCB_TC_ATTR_PARAM_PGID, | |
| 503 | + DCB_TC_ATTR_PARAM_UP_MAPPING, | |
| 504 | + DCB_TC_ATTR_PARAM_STRICT_PRIO, | |
| 505 | + DCB_TC_ATTR_PARAM_BW_PCT, | |
| 506 | + DCB_TC_ATTR_PARAM_ALL, | |
| 507 | + | |
| 508 | + __DCB_TC_ATTR_PARAM_ENUM_MAX, | |
| 509 | + DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1, | |
| 510 | +}; | |
| 511 | + | |
| 512 | +/** | |
| 513 | + * enum dcbnl_cap_attrs - DCB Capability attributes | |
| 514 | + * | |
| 515 | + * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors | |
| 516 | + * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters | |
| 517 | + * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups | |
| 518 | + * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control | |
| 519 | + * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to | |
| 520 | + * traffic class mapping | |
| 521 | + * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a | |
| 522 | + * number of traffic classes the device | |
| 523 | + * can be configured to use for Priority Groups | |
| 524 | + * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a | |
| 525 | + * number of traffic classes the device can be | |
| 526 | + * configured to use for Priority Flow Control | |
| 527 | + * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority | |
| 528 | + * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion | |
| 529 | + * Notification | |
| 530 | + * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine | |
| 531 | + * | |
| 532 | + */ | |
| 533 | +enum dcbnl_cap_attrs { | |
| 534 | + DCB_CAP_ATTR_UNDEFINED, | |
| 535 | + DCB_CAP_ATTR_ALL, | |
| 536 | + DCB_CAP_ATTR_PG, | |
| 537 | + DCB_CAP_ATTR_PFC, | |
| 538 | + DCB_CAP_ATTR_UP2TC, | |
| 539 | + DCB_CAP_ATTR_PG_TCS, | |
| 540 | + DCB_CAP_ATTR_PFC_TCS, | |
| 541 | + DCB_CAP_ATTR_GSP, | |
| 542 | + DCB_CAP_ATTR_BCN, | |
| 543 | + DCB_CAP_ATTR_DCBX, | |
| 544 | + | |
| 545 | + __DCB_CAP_ATTR_ENUM_MAX, | |
| 546 | + DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, | |
| 547 | +}; | |
| 548 | + | |
| 549 | +/** | |
| 550 | + * DCBX capability flags | |
| 551 | + * | |
| 552 | + * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent. | |
| 553 | + * 'set' routines are used to configure the device with | |
| 554 | + * the negotiated parameters | |
| 555 | + * | |
| 556 | + * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but | |
| 557 | + * by another entity | |
| 558 | + * 'get' routines are used to retrieve the | |
| 559 | + * negotiated parameters | |
| 560 | + * 'set' routines can be used to set the initial | |
| 561 | + * negotiation configuration | |
| 562 | + * | |
| 563 | + * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine | |
| 564 | + * supports the CEE protocol flavor | |
| 565 | + * | |
| 566 | + * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine | |
| 567 | + * supports the IEEE protocol flavor | |
| 568 | + * | |
| 569 | + * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine | |
| 570 | + * supports static configuration (i.e no actual | |
| 571 | + * negotiation is performed negotiated parameters equal | |
| 572 | + * the initial configuration) | |
| 573 | + * | |
| 574 | + */ | |
| 575 | +#define DCB_CAP_DCBX_HOST 0x01 | |
| 576 | +#define DCB_CAP_DCBX_LLD_MANAGED 0x02 | |
| 577 | +#define DCB_CAP_DCBX_VER_CEE 0x04 | |
| 578 | +#define DCB_CAP_DCBX_VER_IEEE 0x08 | |
| 579 | +#define DCB_CAP_DCBX_STATIC 0x10 | |
| 580 | + | |
| 581 | +/** | |
| 582 | + * enum dcbnl_numtcs_attrs - number of traffic classes | |
| 583 | + * | |
| 584 | + * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors | |
| 585 | + * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes | |
| 586 | + * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for | |
| 587 | + * priority groups | |
| 588 | + * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can | |
| 589 | + * support priority flow control | |
| 590 | + */ | |
| 591 | +enum dcbnl_numtcs_attrs { | |
| 592 | + DCB_NUMTCS_ATTR_UNDEFINED, | |
| 593 | + DCB_NUMTCS_ATTR_ALL, | |
| 594 | + DCB_NUMTCS_ATTR_PG, | |
| 595 | + DCB_NUMTCS_ATTR_PFC, | |
| 596 | + | |
| 597 | + __DCB_NUMTCS_ATTR_ENUM_MAX, | |
| 598 | + DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1, | |
| 599 | +}; | |
| 600 | + | |
| 601 | +enum dcbnl_bcn_attrs{ | |
| 602 | + DCB_BCN_ATTR_UNDEFINED = 0, | |
| 603 | + | |
| 604 | + DCB_BCN_ATTR_RP_0, | |
| 605 | + DCB_BCN_ATTR_RP_1, | |
| 606 | + DCB_BCN_ATTR_RP_2, | |
| 607 | + DCB_BCN_ATTR_RP_3, | |
| 608 | + DCB_BCN_ATTR_RP_4, | |
| 609 | + DCB_BCN_ATTR_RP_5, | |
| 610 | + DCB_BCN_ATTR_RP_6, | |
| 611 | + DCB_BCN_ATTR_RP_7, | |
| 612 | + DCB_BCN_ATTR_RP_ALL, | |
| 613 | + | |
| 614 | + DCB_BCN_ATTR_BCNA_0, | |
| 615 | + DCB_BCN_ATTR_BCNA_1, | |
| 616 | + DCB_BCN_ATTR_ALPHA, | |
| 617 | + DCB_BCN_ATTR_BETA, | |
| 618 | + DCB_BCN_ATTR_GD, | |
| 619 | + DCB_BCN_ATTR_GI, | |
| 620 | + DCB_BCN_ATTR_TMAX, | |
| 621 | + DCB_BCN_ATTR_TD, | |
| 622 | + DCB_BCN_ATTR_RMIN, | |
| 623 | + DCB_BCN_ATTR_W, | |
| 624 | + DCB_BCN_ATTR_RD, | |
| 625 | + DCB_BCN_ATTR_RU, | |
| 626 | + DCB_BCN_ATTR_WRTT, | |
| 627 | + DCB_BCN_ATTR_RI, | |
| 628 | + DCB_BCN_ATTR_C, | |
| 629 | + DCB_BCN_ATTR_ALL, | |
| 630 | + | |
| 631 | + __DCB_BCN_ATTR_ENUM_MAX, | |
| 632 | + DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1, | |
| 633 | +}; | |
| 634 | + | |
| 635 | +/** | |
| 636 | + * enum dcb_general_attr_values - general DCB attribute values | |
| 637 | + * | |
| 638 | + * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported | |
| 639 | + * | |
| 640 | + */ | |
| 641 | +enum dcb_general_attr_values { | |
| 642 | + DCB_ATTR_VALUE_UNDEFINED = 0xff | |
| 643 | +}; | |
| 644 | + | |
| 645 | +#define DCB_APP_IDTYPE_ETHTYPE 0x00 | |
| 646 | +#define DCB_APP_IDTYPE_PORTNUM 0x01 | |
| 647 | +enum dcbnl_app_attrs { | |
| 648 | + DCB_APP_ATTR_UNDEFINED, | |
| 649 | + | |
| 650 | + DCB_APP_ATTR_IDTYPE, | |
| 651 | + DCB_APP_ATTR_ID, | |
| 652 | + DCB_APP_ATTR_PRIORITY, | |
| 653 | + | |
| 654 | + __DCB_APP_ATTR_ENUM_MAX, | |
| 655 | + DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1, | |
| 656 | +}; | |
| 657 | + | |
| 658 | +/** | |
| 659 | + * enum dcbnl_featcfg_attrs - features conifiguration flags | |
| 660 | + * | |
| 661 | + * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors | |
| 662 | + * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes | |
| 663 | + * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups | |
| 664 | + * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority | |
| 665 | + * flow control | |
| 666 | + * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV | |
| 667 | + * | |
| 668 | + */ | |
| 669 | +#define DCB_FEATCFG_ERROR 0x01 /* error in feature resolution */ | |
| 670 | +#define DCB_FEATCFG_ENABLE 0x02 /* enable feature */ | |
| 671 | +#define DCB_FEATCFG_WILLING 0x04 /* feature is willing */ | |
| 672 | +#define DCB_FEATCFG_ADVERTISE 0x08 /* advertise feature */ | |
| 673 | +enum dcbnl_featcfg_attrs { | |
| 674 | + DCB_FEATCFG_ATTR_UNDEFINED, | |
| 675 | + DCB_FEATCFG_ATTR_ALL, | |
| 676 | + DCB_FEATCFG_ATTR_PG, | |
| 677 | + DCB_FEATCFG_ATTR_PFC, | |
| 678 | + DCB_FEATCFG_ATTR_APP, | |
| 679 | + | |
| 680 | + __DCB_FEATCFG_ATTR_ENUM_MAX, | |
| 681 | + DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1, | |
| 682 | +}; | |
| 683 | + | |
| 684 | +#endif /* __LINUX_DCBNL_H__ */ | |
| @@ -0,0 +1,237 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_DCCP_H | |
| 2 | +#define _UAPI_LINUX_DCCP_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <asm/byteorder.h> | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * struct dccp_hdr - generic part of DCCP packet header | |
| 9 | + * | |
| 10 | + * @dccph_sport - Relevant port on the endpoint that sent this packet | |
| 11 | + * @dccph_dport - Relevant port on the other endpoint | |
| 12 | + * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words | |
| 13 | + * @dccph_ccval - Used by the HC-Sender CCID | |
| 14 | + * @dccph_cscov - Parts of the packet that are covered by the Checksum field | |
| 15 | + * @dccph_checksum - Internet checksum, depends on dccph_cscov | |
| 16 | + * @dccph_x - 0 = 24 bit sequence number, 1 = 48 | |
| 17 | + * @dccph_type - packet type, see DCCP_PKT_ prefixed macros | |
| 18 | + * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x | |
| 19 | + */ | |
| 20 | +struct dccp_hdr { | |
| 21 | + __be16 dccph_sport, | |
| 22 | + dccph_dport; | |
| 23 | + __u8 dccph_doff; | |
| 24 | +#if defined(__LITTLE_ENDIAN_BITFIELD) | |
| 25 | + __u8 dccph_cscov:4, | |
| 26 | + dccph_ccval:4; | |
| 27 | +#elif defined(__BIG_ENDIAN_BITFIELD) | |
| 28 | + __u8 dccph_ccval:4, | |
| 29 | + dccph_cscov:4; | |
| 30 | +#else | |
| 31 | +#error "Adjust your <asm/byteorder.h> defines" | |
| 32 | +#endif | |
| 33 | + __sum16 dccph_checksum; | |
| 34 | +#if defined(__LITTLE_ENDIAN_BITFIELD) | |
| 35 | + __u8 dccph_x:1, | |
| 36 | + dccph_type:4, | |
| 37 | + dccph_reserved:3; | |
| 38 | +#elif defined(__BIG_ENDIAN_BITFIELD) | |
| 39 | + __u8 dccph_reserved:3, | |
| 40 | + dccph_type:4, | |
| 41 | + dccph_x:1; | |
| 42 | +#else | |
| 43 | +#error "Adjust your <asm/byteorder.h> defines" | |
| 44 | +#endif | |
| 45 | + __u8 dccph_seq2; | |
| 46 | + __be16 dccph_seq; | |
| 47 | +}; | |
| 48 | + | |
| 49 | +/** | |
| 50 | + * struct dccp_hdr_ext - the low bits of a 48 bit seq packet | |
| 51 | + * | |
| 52 | + * @dccph_seq_low - low 24 bits of a 48 bit seq packet | |
| 53 | + */ | |
| 54 | +struct dccp_hdr_ext { | |
| 55 | + __be32 dccph_seq_low; | |
| 56 | +}; | |
| 57 | + | |
| 58 | +/** | |
| 59 | + * struct dccp_hdr_request - Connection initiation request header | |
| 60 | + * | |
| 61 | + * @dccph_req_service - Service to which the client app wants to connect | |
| 62 | + */ | |
| 63 | +struct dccp_hdr_request { | |
| 64 | + __be32 dccph_req_service; | |
| 65 | +}; | |
| 66 | +/** | |
| 67 | + * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets | |
| 68 | + * | |
| 69 | + * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR | |
| 70 | + * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR | |
| 71 | + */ | |
| 72 | +struct dccp_hdr_ack_bits { | |
| 73 | + __be16 dccph_reserved1; | |
| 74 | + __be16 dccph_ack_nr_high; | |
| 75 | + __be32 dccph_ack_nr_low; | |
| 76 | +}; | |
| 77 | +/** | |
| 78 | + * struct dccp_hdr_response - Connection initiation response header | |
| 79 | + * | |
| 80 | + * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3) | |
| 81 | + * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request | |
| 82 | + */ | |
| 83 | +struct dccp_hdr_response { | |
| 84 | + struct dccp_hdr_ack_bits dccph_resp_ack; | |
| 85 | + __be32 dccph_resp_service; | |
| 86 | +}; | |
| 87 | + | |
| 88 | +/** | |
| 89 | + * struct dccp_hdr_reset - Unconditionally shut down a connection | |
| 90 | + * | |
| 91 | + * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6) | |
| 92 | + * @dccph_reset_code - one of %dccp_reset_codes | |
| 93 | + * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6 | |
| 94 | + */ | |
| 95 | +struct dccp_hdr_reset { | |
| 96 | + struct dccp_hdr_ack_bits dccph_reset_ack; | |
| 97 | + __u8 dccph_reset_code, | |
| 98 | + dccph_reset_data[3]; | |
| 99 | +}; | |
| 100 | + | |
| 101 | +enum dccp_pkt_type { | |
| 102 | + DCCP_PKT_REQUEST = 0, | |
| 103 | + DCCP_PKT_RESPONSE, | |
| 104 | + DCCP_PKT_DATA, | |
| 105 | + DCCP_PKT_ACK, | |
| 106 | + DCCP_PKT_DATAACK, | |
| 107 | + DCCP_PKT_CLOSEREQ, | |
| 108 | + DCCP_PKT_CLOSE, | |
| 109 | + DCCP_PKT_RESET, | |
| 110 | + DCCP_PKT_SYNC, | |
| 111 | + DCCP_PKT_SYNCACK, | |
| 112 | + DCCP_PKT_INVALID, | |
| 113 | +}; | |
| 114 | + | |
| 115 | +#define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID | |
| 116 | + | |
| 117 | +static inline unsigned int dccp_packet_hdr_len(const __u8 type) | |
| 118 | +{ | |
| 119 | + if (type == DCCP_PKT_DATA) | |
| 120 | + return 0; | |
| 121 | + if (type == DCCP_PKT_DATAACK || | |
| 122 | + type == DCCP_PKT_ACK || | |
| 123 | + type == DCCP_PKT_SYNC || | |
| 124 | + type == DCCP_PKT_SYNCACK || | |
| 125 | + type == DCCP_PKT_CLOSE || | |
| 126 | + type == DCCP_PKT_CLOSEREQ) | |
| 127 | + return sizeof(struct dccp_hdr_ack_bits); | |
| 128 | + if (type == DCCP_PKT_REQUEST) | |
| 129 | + return sizeof(struct dccp_hdr_request); | |
| 130 | + if (type == DCCP_PKT_RESPONSE) | |
| 131 | + return sizeof(struct dccp_hdr_response); | |
| 132 | + return sizeof(struct dccp_hdr_reset); | |
| 133 | +} | |
| 134 | +enum dccp_reset_codes { | |
| 135 | + DCCP_RESET_CODE_UNSPECIFIED = 0, | |
| 136 | + DCCP_RESET_CODE_CLOSED, | |
| 137 | + DCCP_RESET_CODE_ABORTED, | |
| 138 | + DCCP_RESET_CODE_NO_CONNECTION, | |
| 139 | + DCCP_RESET_CODE_PACKET_ERROR, | |
| 140 | + DCCP_RESET_CODE_OPTION_ERROR, | |
| 141 | + DCCP_RESET_CODE_MANDATORY_ERROR, | |
| 142 | + DCCP_RESET_CODE_CONNECTION_REFUSED, | |
| 143 | + DCCP_RESET_CODE_BAD_SERVICE_CODE, | |
| 144 | + DCCP_RESET_CODE_TOO_BUSY, | |
| 145 | + DCCP_RESET_CODE_BAD_INIT_COOKIE, | |
| 146 | + DCCP_RESET_CODE_AGGRESSION_PENALTY, | |
| 147 | + | |
| 148 | + DCCP_MAX_RESET_CODES /* Leave at the end! */ | |
| 149 | +}; | |
| 150 | + | |
| 151 | +/* DCCP options */ | |
| 152 | +enum { | |
| 153 | + DCCPO_PADDING = 0, | |
| 154 | + DCCPO_MANDATORY = 1, | |
| 155 | + DCCPO_MIN_RESERVED = 3, | |
| 156 | + DCCPO_MAX_RESERVED = 31, | |
| 157 | + DCCPO_CHANGE_L = 32, | |
| 158 | + DCCPO_CONFIRM_L = 33, | |
| 159 | + DCCPO_CHANGE_R = 34, | |
| 160 | + DCCPO_CONFIRM_R = 35, | |
| 161 | + DCCPO_NDP_COUNT = 37, | |
| 162 | + DCCPO_ACK_VECTOR_0 = 38, | |
| 163 | + DCCPO_ACK_VECTOR_1 = 39, | |
| 164 | + DCCPO_TIMESTAMP = 41, | |
| 165 | + DCCPO_TIMESTAMP_ECHO = 42, | |
| 166 | + DCCPO_ELAPSED_TIME = 43, | |
| 167 | + DCCPO_MAX = 45, | |
| 168 | + DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */ | |
| 169 | + DCCPO_MAX_RX_CCID_SPECIFIC = 191, | |
| 170 | + DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */ | |
| 171 | + DCCPO_MAX_TX_CCID_SPECIFIC = 255, | |
| 172 | +}; | |
| 173 | +/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */ | |
| 174 | +#define DCCP_SINGLE_OPT_MAXLEN 253 | |
| 175 | + | |
| 176 | +/* DCCP CCIDS */ | |
| 177 | +enum { | |
| 178 | + DCCPC_CCID2 = 2, | |
| 179 | + DCCPC_CCID3 = 3, | |
| 180 | +}; | |
| 181 | + | |
| 182 | +/* DCCP features (RFC 4340 section 6.4) */ | |
| 183 | +enum dccp_feature_numbers { | |
| 184 | + DCCPF_RESERVED = 0, | |
| 185 | + DCCPF_CCID = 1, | |
| 186 | + DCCPF_SHORT_SEQNOS = 2, | |
| 187 | + DCCPF_SEQUENCE_WINDOW = 3, | |
| 188 | + DCCPF_ECN_INCAPABLE = 4, | |
| 189 | + DCCPF_ACK_RATIO = 5, | |
| 190 | + DCCPF_SEND_ACK_VECTOR = 6, | |
| 191 | + DCCPF_SEND_NDP_COUNT = 7, | |
| 192 | + DCCPF_MIN_CSUM_COVER = 8, | |
| 193 | + DCCPF_DATA_CHECKSUM = 9, | |
| 194 | + /* 10-127 reserved */ | |
| 195 | + DCCPF_MIN_CCID_SPECIFIC = 128, | |
| 196 | + DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */ | |
| 197 | + DCCPF_MAX_CCID_SPECIFIC = 255, | |
| 198 | +}; | |
| 199 | + | |
| 200 | +/* DCCP socket control message types for cmsg */ | |
| 201 | +enum dccp_cmsg_type { | |
| 202 | + DCCP_SCM_PRIORITY = 1, | |
| 203 | + DCCP_SCM_QPOLICY_MAX = 0xFFFF, | |
| 204 | + /* ^-- Up to here reserved exclusively for qpolicy parameters */ | |
| 205 | + DCCP_SCM_MAX | |
| 206 | +}; | |
| 207 | + | |
| 208 | +/* DCCP priorities for outgoing/queued packets */ | |
| 209 | +enum dccp_packet_dequeueing_policy { | |
| 210 | + DCCPQ_POLICY_SIMPLE, | |
| 211 | + DCCPQ_POLICY_PRIO, | |
| 212 | + DCCPQ_POLICY_MAX | |
| 213 | +}; | |
| 214 | + | |
| 215 | +/* DCCP socket options */ | |
| 216 | +#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ | |
| 217 | +#define DCCP_SOCKOPT_SERVICE 2 | |
| 218 | +#define DCCP_SOCKOPT_CHANGE_L 3 | |
| 219 | +#define DCCP_SOCKOPT_CHANGE_R 4 | |
| 220 | +#define DCCP_SOCKOPT_GET_CUR_MPS 5 | |
| 221 | +#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 | |
| 222 | +#define DCCP_SOCKOPT_SEND_CSCOV 10 | |
| 223 | +#define DCCP_SOCKOPT_RECV_CSCOV 11 | |
| 224 | +#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12 | |
| 225 | +#define DCCP_SOCKOPT_CCID 13 | |
| 226 | +#define DCCP_SOCKOPT_TX_CCID 14 | |
| 227 | +#define DCCP_SOCKOPT_RX_CCID 15 | |
| 228 | +#define DCCP_SOCKOPT_QPOLICY_ID 16 | |
| 229 | +#define DCCP_SOCKOPT_QPOLICY_TXQLEN 17 | |
| 230 | +#define DCCP_SOCKOPT_CCID_RX_INFO 128 | |
| 231 | +#define DCCP_SOCKOPT_CCID_TX_INFO 192 | |
| 232 | + | |
| 233 | +/* maximum number of services provided on the same listening port */ | |
| 234 | +#define DCCP_SERVICE_LIST_MAX_LEN 32 | |
| 235 | + | |
| 236 | + | |
| 237 | +#endif /* _UAPI_LINUX_DCCP_H */ | |
| @@ -0,0 +1,75 @@ | ||
| 1 | +/****************************************************************************** | |
| 2 | +******************************************************************************* | |
| 3 | +** | |
| 4 | +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | |
| 5 | +** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. | |
| 6 | +** | |
| 7 | +** This copyrighted material is made available to anyone wishing to use, | |
| 8 | +** modify, copy, or redistribute it subject to the terms and conditions | |
| 9 | +** of the GNU General Public License v.2. | |
| 10 | +** | |
| 11 | +******************************************************************************* | |
| 12 | +******************************************************************************/ | |
| 13 | + | |
| 14 | +#ifndef _UAPI__DLM_DOT_H__ | |
| 15 | +#define _UAPI__DLM_DOT_H__ | |
| 16 | + | |
| 17 | +/* | |
| 18 | + * Interface to Distributed Lock Manager (DLM) | |
| 19 | + * routines and structures to use DLM lockspaces | |
| 20 | + */ | |
| 21 | + | |
| 22 | +/* Lock levels and flags are here */ | |
| 23 | +#include <linux/dlmconstants.h> | |
| 24 | +#include <linux/types.h> | |
| 25 | + | |
| 26 | +typedef void dlm_lockspace_t; | |
| 27 | + | |
| 28 | +/* | |
| 29 | + * Lock status block | |
| 30 | + * | |
| 31 | + * Use this structure to specify the contents of the lock value block. For a | |
| 32 | + * conversion request, this structure is used to specify the lock ID of the | |
| 33 | + * lock. DLM writes the status of the lock request and the lock ID assigned | |
| 34 | + * to the request in the lock status block. | |
| 35 | + * | |
| 36 | + * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests. | |
| 37 | + * It is available when dlm_lock returns. | |
| 38 | + * | |
| 39 | + * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules | |
| 40 | + * shown for the DLM_LKF_VALBLK flag. | |
| 41 | + * | |
| 42 | + * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock, | |
| 43 | + * it was first demoted to NL to avoid conversion deadlock. | |
| 44 | + * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid. | |
| 45 | + * | |
| 46 | + * sb_status: the returned status of the lock request set prior to AST | |
| 47 | + * execution. Possible return values: | |
| 48 | + * | |
| 49 | + * 0 if lock request was successful | |
| 50 | + * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE | |
| 51 | + * -DLM_EUNLOCK if unlock request was successful | |
| 52 | + * -DLM_ECANCEL if a cancel completed successfully | |
| 53 | + * -EDEADLK if a deadlock was detected | |
| 54 | + * -ETIMEDOUT if the lock request was canceled due to a timeout | |
| 55 | + */ | |
| 56 | + | |
| 57 | +#define DLM_SBF_DEMOTED 0x01 | |
| 58 | +#define DLM_SBF_VALNOTVALID 0x02 | |
| 59 | +#define DLM_SBF_ALTMODE 0x04 | |
| 60 | + | |
| 61 | +struct dlm_lksb { | |
| 62 | + int sb_status; | |
| 63 | + __u32 sb_lkid; | |
| 64 | + char sb_flags; | |
| 65 | + char * sb_lvbptr; | |
| 66 | +}; | |
| 67 | + | |
| 68 | +/* dlm_new_lockspace() flags */ | |
| 69 | + | |
| 70 | +#define DLM_LSFL_TIMEWARN 0x00000002 | |
| 71 | +#define DLM_LSFL_FS 0x00000004 | |
| 72 | +#define DLM_LSFL_NEWEXCL 0x00000008 | |
| 73 | + | |
| 74 | + | |
| 75 | +#endif /* _UAPI__DLM_DOT_H__ */ | |
| @@ -0,0 +1,108 @@ | ||
| 1 | +/****************************************************************************** | |
| 2 | +******************************************************************************* | |
| 3 | +** | |
| 4 | +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | |
| 5 | +** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | |
| 6 | +** | |
| 7 | +** This copyrighted material is made available to anyone wishing to use, | |
| 8 | +** modify, copy, or redistribute it subject to the terms and conditions | |
| 9 | +** of the GNU General Public License v.2. | |
| 10 | +** | |
| 11 | +******************************************************************************* | |
| 12 | +******************************************************************************/ | |
| 13 | + | |
| 14 | +#ifndef _LINUX_DLM_DEVICE_H | |
| 15 | +#define _LINUX_DLM_DEVICE_H | |
| 16 | + | |
| 17 | +/* This is the device interface for dlm, most users will use a library | |
| 18 | + * interface. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#include <linux/dlm.h> | |
| 22 | +#include <linux/types.h> | |
| 23 | + | |
| 24 | +#define DLM_USER_LVB_LEN 32 | |
| 25 | + | |
| 26 | +/* Version of the device interface */ | |
| 27 | +#define DLM_DEVICE_VERSION_MAJOR 6 | |
| 28 | +#define DLM_DEVICE_VERSION_MINOR 0 | |
| 29 | +#define DLM_DEVICE_VERSION_PATCH 1 | |
| 30 | + | |
| 31 | +/* struct passed to the lock write */ | |
| 32 | +struct dlm_lock_params { | |
| 33 | + __u8 mode; | |
| 34 | + __u8 namelen; | |
| 35 | + __u16 unused; | |
| 36 | + __u32 flags; | |
| 37 | + __u32 lkid; | |
| 38 | + __u32 parent; | |
| 39 | + __u64 xid; | |
| 40 | + __u64 timeout; | |
| 41 | + void __user *castparam; | |
| 42 | + void __user *castaddr; | |
| 43 | + void __user *bastparam; | |
| 44 | + void __user *bastaddr; | |
| 45 | + struct dlm_lksb __user *lksb; | |
| 46 | + char lvb[DLM_USER_LVB_LEN]; | |
| 47 | + char name[0]; | |
| 48 | +}; | |
| 49 | + | |
| 50 | +struct dlm_lspace_params { | |
| 51 | + __u32 flags; | |
| 52 | + __u32 minor; | |
| 53 | + char name[0]; | |
| 54 | +}; | |
| 55 | + | |
| 56 | +struct dlm_purge_params { | |
| 57 | + __u32 nodeid; | |
| 58 | + __u32 pid; | |
| 59 | +}; | |
| 60 | + | |
| 61 | +struct dlm_write_request { | |
| 62 | + __u32 version[3]; | |
| 63 | + __u8 cmd; | |
| 64 | + __u8 is64bit; | |
| 65 | + __u8 unused[2]; | |
| 66 | + | |
| 67 | + union { | |
| 68 | + struct dlm_lock_params lock; | |
| 69 | + struct dlm_lspace_params lspace; | |
| 70 | + struct dlm_purge_params purge; | |
| 71 | + } i; | |
| 72 | +}; | |
| 73 | + | |
| 74 | +struct dlm_device_version { | |
| 75 | + __u32 version[3]; | |
| 76 | +}; | |
| 77 | + | |
| 78 | +/* struct read from the "device" fd, | |
| 79 | + consists mainly of userspace pointers for the library to use */ | |
| 80 | + | |
| 81 | +struct dlm_lock_result { | |
| 82 | + __u32 version[3]; | |
| 83 | + __u32 length; | |
| 84 | + void __user * user_astaddr; | |
| 85 | + void __user * user_astparam; | |
| 86 | + struct dlm_lksb __user * user_lksb; | |
| 87 | + struct dlm_lksb lksb; | |
| 88 | + __u8 bast_mode; | |
| 89 | + __u8 unused[3]; | |
| 90 | + /* Offsets may be zero if no data is present */ | |
| 91 | + __u32 lvb_offset; | |
| 92 | +}; | |
| 93 | + | |
| 94 | +/* Commands passed to the device */ | |
| 95 | +#define DLM_USER_LOCK 1 | |
| 96 | +#define DLM_USER_UNLOCK 2 | |
| 97 | +#define DLM_USER_QUERY 3 | |
| 98 | +#define DLM_USER_CREATE_LOCKSPACE 4 | |
| 99 | +#define DLM_USER_REMOVE_LOCKSPACE 5 | |
| 100 | +#define DLM_USER_PURGE 6 | |
| 101 | +#define DLM_USER_DEADLOCK 7 | |
| 102 | + | |
| 103 | +/* Lockspace flags */ | |
| 104 | +#define DLM_USER_LSFLG_AUTOFREE 1 | |
| 105 | +#define DLM_USER_LSFLG_FORCEFREE 2 | |
| 106 | + | |
| 107 | +#endif | |
| 108 | + | |
| @@ -0,0 +1,58 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2007 Red Hat, Inc. All rights reserved. | |
| 3 | + * | |
| 4 | + * This copyrighted material is made available to anyone wishing to use, | |
| 5 | + * modify, copy, or redistribute it subject to the terms and conditions | |
| 6 | + * of the GNU General Public License v.2. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef _DLM_NETLINK_H | |
| 10 | +#define _DLM_NETLINK_H | |
| 11 | + | |
| 12 | +#include <linux/types.h> | |
| 13 | + | |
| 14 | +enum { | |
| 15 | + DLM_STATUS_WAITING = 1, | |
| 16 | + DLM_STATUS_GRANTED = 2, | |
| 17 | + DLM_STATUS_CONVERT = 3, | |
| 18 | +}; | |
| 19 | + | |
| 20 | +#define DLM_LOCK_DATA_VERSION 1 | |
| 21 | + | |
| 22 | +struct dlm_lock_data { | |
| 23 | + __u16 version; | |
| 24 | + __u32 lockspace_id; | |
| 25 | + int nodeid; | |
| 26 | + int ownpid; | |
| 27 | + __u32 id; | |
| 28 | + __u32 remid; | |
| 29 | + __u64 xid; | |
| 30 | + __s8 status; | |
| 31 | + __s8 grmode; | |
| 32 | + __s8 rqmode; | |
| 33 | + unsigned long timestamp; | |
| 34 | + int resource_namelen; | |
| 35 | + char resource_name[DLM_RESNAME_MAXLEN]; | |
| 36 | +}; | |
| 37 | + | |
| 38 | +enum { | |
| 39 | + DLM_CMD_UNSPEC = 0, | |
| 40 | + DLM_CMD_HELLO, /* user->kernel */ | |
| 41 | + DLM_CMD_TIMEOUT, /* kernel->user */ | |
| 42 | + __DLM_CMD_MAX, | |
| 43 | +}; | |
| 44 | + | |
| 45 | +#define DLM_CMD_MAX (__DLM_CMD_MAX - 1) | |
| 46 | + | |
| 47 | +enum { | |
| 48 | + DLM_TYPE_UNSPEC = 0, | |
| 49 | + DLM_TYPE_LOCK, | |
| 50 | + __DLM_TYPE_MAX, | |
| 51 | +}; | |
| 52 | + | |
| 53 | +#define DLM_TYPE_MAX (__DLM_TYPE_MAX - 1) | |
| 54 | + | |
| 55 | +#define DLM_GENL_VERSION 0x1 | |
| 56 | +#define DLM_GENL_NAME "DLM" | |
| 57 | + | |
| 58 | +#endif /* _DLM_NETLINK_H */ | |
| @@ -0,0 +1,45 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. | |
| 3 | + * | |
| 4 | + * This copyrighted material is made available to anyone wishing to use, | |
| 5 | + * modify, copy, or redistribute it subject to the terms and conditions | |
| 6 | + * of the GNU General Public License v.2. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef _UAPI__DLM_PLOCK_DOT_H__ | |
| 10 | +#define _UAPI__DLM_PLOCK_DOT_H__ | |
| 11 | + | |
| 12 | +#include <linux/types.h> | |
| 13 | + | |
| 14 | +#define DLM_PLOCK_MISC_NAME "dlm_plock" | |
| 15 | + | |
| 16 | +#define DLM_PLOCK_VERSION_MAJOR 1 | |
| 17 | +#define DLM_PLOCK_VERSION_MINOR 2 | |
| 18 | +#define DLM_PLOCK_VERSION_PATCH 0 | |
| 19 | + | |
| 20 | +enum { | |
| 21 | + DLM_PLOCK_OP_LOCK = 1, | |
| 22 | + DLM_PLOCK_OP_UNLOCK, | |
| 23 | + DLM_PLOCK_OP_GET, | |
| 24 | +}; | |
| 25 | + | |
| 26 | +#define DLM_PLOCK_FL_CLOSE 1 | |
| 27 | + | |
| 28 | +struct dlm_plock_info { | |
| 29 | + __u32 version[3]; | |
| 30 | + __u8 optype; | |
| 31 | + __u8 ex; | |
| 32 | + __u8 wait; | |
| 33 | + __u8 flags; | |
| 34 | + __u32 pid; | |
| 35 | + __s32 nodeid; | |
| 36 | + __s32 rv; | |
| 37 | + __u32 fsid; | |
| 38 | + __u64 number; | |
| 39 | + __u64 start; | |
| 40 | + __u64 end; | |
| 41 | + __u64 owner; | |
| 42 | +}; | |
| 43 | + | |
| 44 | + | |
| 45 | +#endif /* _UAPI__DLM_PLOCK_DOT_H__ */ | |
| @@ -0,0 +1,163 @@ | ||
| 1 | +/****************************************************************************** | |
| 2 | +******************************************************************************* | |
| 3 | +** | |
| 4 | +** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | |
| 5 | +** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | |
| 6 | +** | |
| 7 | +** This copyrighted material is made available to anyone wishing to use, | |
| 8 | +** modify, copy, or redistribute it subject to the terms and conditions | |
| 9 | +** of the GNU General Public License v.2. | |
| 10 | +** | |
| 11 | +******************************************************************************* | |
| 12 | +******************************************************************************/ | |
| 13 | + | |
| 14 | +#ifndef __DLMCONSTANTS_DOT_H__ | |
| 15 | +#define __DLMCONSTANTS_DOT_H__ | |
| 16 | + | |
| 17 | +/* | |
| 18 | + * Constants used by DLM interface. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#define DLM_LOCKSPACE_LEN 64 | |
| 22 | +#define DLM_RESNAME_MAXLEN 64 | |
| 23 | + | |
| 24 | + | |
| 25 | +/* | |
| 26 | + * Lock Modes | |
| 27 | + */ | |
| 28 | + | |
| 29 | +#define DLM_LOCK_IV (-1) /* invalid */ | |
| 30 | +#define DLM_LOCK_NL 0 /* null */ | |
| 31 | +#define DLM_LOCK_CR 1 /* concurrent read */ | |
| 32 | +#define DLM_LOCK_CW 2 /* concurrent write */ | |
| 33 | +#define DLM_LOCK_PR 3 /* protected read */ | |
| 34 | +#define DLM_LOCK_PW 4 /* protected write */ | |
| 35 | +#define DLM_LOCK_EX 5 /* exclusive */ | |
| 36 | + | |
| 37 | + | |
| 38 | +/* | |
| 39 | + * Flags to dlm_lock | |
| 40 | + * | |
| 41 | + * DLM_LKF_NOQUEUE | |
| 42 | + * | |
| 43 | + * Do not queue the lock request on the wait queue if it cannot be granted | |
| 44 | + * immediately. If the lock cannot be granted because of this flag, DLM will | |
| 45 | + * either return -EAGAIN from the dlm_lock call or will return 0 from | |
| 46 | + * dlm_lock and -EAGAIN in the lock status block when the AST is executed. | |
| 47 | + * | |
| 48 | + * DLM_LKF_CANCEL | |
| 49 | + * | |
| 50 | + * Used to cancel a pending lock request or conversion. A converting lock is | |
| 51 | + * returned to its previously granted mode. | |
| 52 | + * | |
| 53 | + * DLM_LKF_CONVERT | |
| 54 | + * | |
| 55 | + * Indicates a lock conversion request. For conversions the name and namelen | |
| 56 | + * are ignored and the lock ID in the LKSB is used to identify the lock. | |
| 57 | + * | |
| 58 | + * DLM_LKF_VALBLK | |
| 59 | + * | |
| 60 | + * Requests DLM to return the current contents of the lock value block in the | |
| 61 | + * lock status block. When this flag is set in a lock conversion from PW or EX | |
| 62 | + * modes, DLM assigns the value specified in the lock status block to the lock | |
| 63 | + * value block of the lock resource. The LVB is a DLM_LVB_LEN size array | |
| 64 | + * containing application-specific information. | |
| 65 | + * | |
| 66 | + * DLM_LKF_QUECVT | |
| 67 | + * | |
| 68 | + * Force a conversion request to be queued, even if it is compatible with | |
| 69 | + * the granted modes of other locks on the same resource. | |
| 70 | + * | |
| 71 | + * DLM_LKF_IVVALBLK | |
| 72 | + * | |
| 73 | + * Invalidate the lock value block. | |
| 74 | + * | |
| 75 | + * DLM_LKF_CONVDEADLK | |
| 76 | + * | |
| 77 | + * Allows the dlm to resolve conversion deadlocks internally by demoting the | |
| 78 | + * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is | |
| 79 | + * returned for a conversion that's been effected by this. | |
| 80 | + * | |
| 81 | + * DLM_LKF_PERSISTENT | |
| 82 | + * | |
| 83 | + * Only relevant to locks originating in userspace. A persistent lock will not | |
| 84 | + * be removed if the process holding the lock exits. | |
| 85 | + * | |
| 86 | + * DLM_LKF_NODLCKWT | |
| 87 | + * | |
| 88 | + * Do not cancel the lock if it gets into conversion deadlock. | |
| 89 | + * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN. | |
| 90 | + * | |
| 91 | + * DLM_LKF_NODLCKBLK | |
| 92 | + * | |
| 93 | + * net yet implemented | |
| 94 | + * | |
| 95 | + * DLM_LKF_EXPEDITE | |
| 96 | + * | |
| 97 | + * Used only with new requests for NL mode locks. Tells the lock manager | |
| 98 | + * to grant the lock, ignoring other locks in convert and wait queues. | |
| 99 | + * | |
| 100 | + * DLM_LKF_NOQUEUEBAST | |
| 101 | + * | |
| 102 | + * Send blocking AST's before returning -EAGAIN to the caller. It is only | |
| 103 | + * used along with the NOQUEUE flag. Blocking AST's are not sent for failed | |
| 104 | + * NOQUEUE requests otherwise. | |
| 105 | + * | |
| 106 | + * DLM_LKF_HEADQUE | |
| 107 | + * | |
| 108 | + * Add a lock to the head of the convert or wait queue rather than the tail. | |
| 109 | + * | |
| 110 | + * DLM_LKF_NOORDER | |
| 111 | + * | |
| 112 | + * Disregard the standard grant order rules and grant a lock as soon as it | |
| 113 | + * is compatible with other granted locks. | |
| 114 | + * | |
| 115 | + * DLM_LKF_ORPHAN | |
| 116 | + * | |
| 117 | + * not yet implemented | |
| 118 | + * | |
| 119 | + * DLM_LKF_ALTPR | |
| 120 | + * | |
| 121 | + * If the requested mode cannot be granted immediately, try to grant the lock | |
| 122 | + * in PR mode instead. If this alternate mode is granted instead of the | |
| 123 | + * requested mode, DLM_SBF_ALTMODE is returned in the lksb. | |
| 124 | + * | |
| 125 | + * DLM_LKF_ALTCW | |
| 126 | + * | |
| 127 | + * The same as ALTPR, but the alternate mode is CW. | |
| 128 | + * | |
| 129 | + * DLM_LKF_FORCEUNLOCK | |
| 130 | + * | |
| 131 | + * Unlock the lock even if it is converting or waiting or has sublocks. | |
| 132 | + * Only really for use by the userland device.c code. | |
| 133 | + * | |
| 134 | + */ | |
| 135 | + | |
| 136 | +#define DLM_LKF_NOQUEUE 0x00000001 | |
| 137 | +#define DLM_LKF_CANCEL 0x00000002 | |
| 138 | +#define DLM_LKF_CONVERT 0x00000004 | |
| 139 | +#define DLM_LKF_VALBLK 0x00000008 | |
| 140 | +#define DLM_LKF_QUECVT 0x00000010 | |
| 141 | +#define DLM_LKF_IVVALBLK 0x00000020 | |
| 142 | +#define DLM_LKF_CONVDEADLK 0x00000040 | |
| 143 | +#define DLM_LKF_PERSISTENT 0x00000080 | |
| 144 | +#define DLM_LKF_NODLCKWT 0x00000100 | |
| 145 | +#define DLM_LKF_NODLCKBLK 0x00000200 | |
| 146 | +#define DLM_LKF_EXPEDITE 0x00000400 | |
| 147 | +#define DLM_LKF_NOQUEUEBAST 0x00000800 | |
| 148 | +#define DLM_LKF_HEADQUE 0x00001000 | |
| 149 | +#define DLM_LKF_NOORDER 0x00002000 | |
| 150 | +#define DLM_LKF_ORPHAN 0x00004000 | |
| 151 | +#define DLM_LKF_ALTPR 0x00008000 | |
| 152 | +#define DLM_LKF_ALTCW 0x00010000 | |
| 153 | +#define DLM_LKF_FORCEUNLOCK 0x00020000 | |
| 154 | +#define DLM_LKF_TIMEOUT 0x00040000 | |
| 155 | + | |
| 156 | +/* | |
| 157 | + * Some return codes that are not in errno.h | |
| 158 | + */ | |
| 159 | + | |
| 160 | +#define DLM_ECANCEL 0x10001 | |
| 161 | +#define DLM_EUNLOCK 0x10002 | |
| 162 | + | |
| 163 | +#endif /* __DLMCONSTANTS_DOT_H__ */ | |
| @@ -0,0 +1,339 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited. | |
| 3 | + * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved. | |
| 4 | + * | |
| 5 | + * This file is released under the LGPL. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#ifndef _LINUX_DM_IOCTL_V4_H | |
| 9 | +#define _LINUX_DM_IOCTL_V4_H | |
| 10 | + | |
| 11 | +#include <linux/types.h> | |
| 12 | + | |
| 13 | +#define DM_DIR "mapper" /* Slashes not supported */ | |
| 14 | +#define DM_CONTROL_NODE "control" | |
| 15 | +#define DM_MAX_TYPE_NAME 16 | |
| 16 | +#define DM_NAME_LEN 128 | |
| 17 | +#define DM_UUID_LEN 129 | |
| 18 | + | |
| 19 | +/* | |
| 20 | + * A traditional ioctl interface for the device mapper. | |
| 21 | + * | |
| 22 | + * Each device can have two tables associated with it, an | |
| 23 | + * 'active' table which is the one currently used by io passing | |
| 24 | + * through the device, and an 'inactive' one which is a table | |
| 25 | + * that is being prepared as a replacement for the 'active' one. | |
| 26 | + * | |
| 27 | + * DM_VERSION: | |
| 28 | + * Just get the version information for the ioctl interface. | |
| 29 | + * | |
| 30 | + * DM_REMOVE_ALL: | |
| 31 | + * Remove all dm devices, destroy all tables. Only really used | |
| 32 | + * for debug. | |
| 33 | + * | |
| 34 | + * DM_LIST_DEVICES: | |
| 35 | + * Get a list of all the dm device names. | |
| 36 | + * | |
| 37 | + * DM_DEV_CREATE: | |
| 38 | + * Create a new device, neither the 'active' or 'inactive' table | |
| 39 | + * slots will be filled. The device will be in suspended state | |
| 40 | + * after creation, however any io to the device will get errored | |
| 41 | + * since it will be out-of-bounds. | |
| 42 | + * | |
| 43 | + * DM_DEV_REMOVE: | |
| 44 | + * Remove a device, destroy any tables. | |
| 45 | + * | |
| 46 | + * DM_DEV_RENAME: | |
| 47 | + * Rename a device or set its uuid if none was previously supplied. | |
| 48 | + * | |
| 49 | + * DM_SUSPEND: | |
| 50 | + * This performs both suspend and resume, depending which flag is | |
| 51 | + * passed in. | |
| 52 | + * Suspend: This command will not return until all pending io to | |
| 53 | + * the device has completed. Further io will be deferred until | |
| 54 | + * the device is resumed. | |
| 55 | + * Resume: It is no longer an error to issue this command on an | |
| 56 | + * unsuspended device. If a table is present in the 'inactive' | |
| 57 | + * slot, it will be moved to the active slot, then the old table | |
| 58 | + * from the active slot will be _destroyed_. Finally the device | |
| 59 | + * is resumed. | |
| 60 | + * | |
| 61 | + * DM_DEV_STATUS: | |
| 62 | + * Retrieves the status for the table in the 'active' slot. | |
| 63 | + * | |
| 64 | + * DM_DEV_WAIT: | |
| 65 | + * Wait for a significant event to occur to the device. This | |
| 66 | + * could either be caused by an event triggered by one of the | |
| 67 | + * targets of the table in the 'active' slot, or a table change. | |
| 68 | + * | |
| 69 | + * DM_TABLE_LOAD: | |
| 70 | + * Load a table into the 'inactive' slot for the device. The | |
| 71 | + * device does _not_ need to be suspended prior to this command. | |
| 72 | + * | |
| 73 | + * DM_TABLE_CLEAR: | |
| 74 | + * Destroy any table in the 'inactive' slot (ie. abort). | |
| 75 | + * | |
| 76 | + * DM_TABLE_DEPS: | |
| 77 | + * Return a set of device dependencies for the 'active' table. | |
| 78 | + * | |
| 79 | + * DM_TABLE_STATUS: | |
| 80 | + * Return the targets status for the 'active' table. | |
| 81 | + * | |
| 82 | + * DM_TARGET_MSG: | |
| 83 | + * Pass a message string to the target at a specific offset of a device. | |
| 84 | + * | |
| 85 | + * DM_DEV_SET_GEOMETRY: | |
| 86 | + * Set the geometry of a device by passing in a string in this format: | |
| 87 | + * | |
| 88 | + * "cylinders heads sectors_per_track start_sector" | |
| 89 | + * | |
| 90 | + * Beware that CHS geometry is nearly obsolete and only provided | |
| 91 | + * for compatibility with dm devices that can be booted by a PC | |
| 92 | + * BIOS. See struct hd_geometry for range limits. Also note that | |
| 93 | + * the geometry is erased if the device size changes. | |
| 94 | + */ | |
| 95 | + | |
| 96 | +/* | |
| 97 | + * All ioctl arguments consist of a single chunk of memory, with | |
| 98 | + * this structure at the start. If a uuid is specified any | |
| 99 | + * lookup (eg. for a DM_INFO) will be done on that, *not* the | |
| 100 | + * name. | |
| 101 | + */ | |
| 102 | +struct dm_ioctl { | |
| 103 | + /* | |
| 104 | + * The version number is made up of three parts: | |
| 105 | + * major - no backward or forward compatibility, | |
| 106 | + * minor - only backwards compatible, | |
| 107 | + * patch - both backwards and forwards compatible. | |
| 108 | + * | |
| 109 | + * All clients of the ioctl interface should fill in the | |
| 110 | + * version number of the interface that they were | |
| 111 | + * compiled with. | |
| 112 | + * | |
| 113 | + * All recognised ioctl commands (ie. those that don't | |
| 114 | + * return -ENOTTY) fill out this field, even if the | |
| 115 | + * command failed. | |
| 116 | + */ | |
| 117 | + __u32 version[3]; /* in/out */ | |
| 118 | + __u32 data_size; /* total size of data passed in | |
| 119 | + * including this struct */ | |
| 120 | + | |
| 121 | + __u32 data_start; /* offset to start of data | |
| 122 | + * relative to start of this struct */ | |
| 123 | + | |
| 124 | + __u32 target_count; /* in/out */ | |
| 125 | + __s32 open_count; /* out */ | |
| 126 | + __u32 flags; /* in/out */ | |
| 127 | + | |
| 128 | + /* | |
| 129 | + * event_nr holds either the event number (input and output) or the | |
| 130 | + * udev cookie value (input only). | |
| 131 | + * The DM_DEV_WAIT ioctl takes an event number as input. | |
| 132 | + * The DM_SUSPEND, DM_DEV_REMOVE and DM_DEV_RENAME ioctls | |
| 133 | + * use the field as a cookie to return in the DM_COOKIE | |
| 134 | + * variable with the uevents they issue. | |
| 135 | + * For output, the ioctls return the event number, not the cookie. | |
| 136 | + */ | |
| 137 | + __u32 event_nr; /* in/out */ | |
| 138 | + __u32 padding; | |
| 139 | + | |
| 140 | + __u64 dev; /* in/out */ | |
| 141 | + | |
| 142 | + char name[DM_NAME_LEN]; /* device name */ | |
| 143 | + char uuid[DM_UUID_LEN]; /* unique identifier for | |
| 144 | + * the block device */ | |
| 145 | + char data[7]; /* padding or data */ | |
| 146 | +}; | |
| 147 | + | |
| 148 | +/* | |
| 149 | + * Used to specify tables. These structures appear after the | |
| 150 | + * dm_ioctl. | |
| 151 | + */ | |
| 152 | +struct dm_target_spec { | |
| 153 | + __u64 sector_start; | |
| 154 | + __u64 length; | |
| 155 | + __s32 status; /* used when reading from kernel only */ | |
| 156 | + | |
| 157 | + /* | |
| 158 | + * Location of the next dm_target_spec. | |
| 159 | + * - When specifying targets on a DM_TABLE_LOAD command, this value is | |
| 160 | + * the number of bytes from the start of the "current" dm_target_spec | |
| 161 | + * to the start of the "next" dm_target_spec. | |
| 162 | + * - When retrieving targets on a DM_TABLE_STATUS command, this value | |
| 163 | + * is the number of bytes from the start of the first dm_target_spec | |
| 164 | + * (that follows the dm_ioctl struct) to the start of the "next" | |
| 165 | + * dm_target_spec. | |
| 166 | + */ | |
| 167 | + __u32 next; | |
| 168 | + | |
| 169 | + char target_type[DM_MAX_TYPE_NAME]; | |
| 170 | + | |
| 171 | + /* | |
| 172 | + * Parameter string starts immediately after this object. | |
| 173 | + * Be careful to add padding after string to ensure correct | |
| 174 | + * alignment of subsequent dm_target_spec. | |
| 175 | + */ | |
| 176 | +}; | |
| 177 | + | |
| 178 | +/* | |
| 179 | + * Used to retrieve the target dependencies. | |
| 180 | + */ | |
| 181 | +struct dm_target_deps { | |
| 182 | + __u32 count; /* Array size */ | |
| 183 | + __u32 padding; /* unused */ | |
| 184 | + __u64 dev[0]; /* out */ | |
| 185 | +}; | |
| 186 | + | |
| 187 | +/* | |
| 188 | + * Used to get a list of all dm devices. | |
| 189 | + */ | |
| 190 | +struct dm_name_list { | |
| 191 | + __u64 dev; | |
| 192 | + __u32 next; /* offset to the next record from | |
| 193 | + the _start_ of this */ | |
| 194 | + char name[0]; | |
| 195 | +}; | |
| 196 | + | |
| 197 | +/* | |
| 198 | + * Used to retrieve the target versions | |
| 199 | + */ | |
| 200 | +struct dm_target_versions { | |
| 201 | + __u32 next; | |
| 202 | + __u32 version[3]; | |
| 203 | + | |
| 204 | + char name[0]; | |
| 205 | +}; | |
| 206 | + | |
| 207 | +/* | |
| 208 | + * Used to pass message to a target | |
| 209 | + */ | |
| 210 | +struct dm_target_msg { | |
| 211 | + __u64 sector; /* Device sector */ | |
| 212 | + | |
| 213 | + char message[0]; | |
| 214 | +}; | |
| 215 | + | |
| 216 | +/* | |
| 217 | + * If you change this make sure you make the corresponding change | |
| 218 | + * to dm-ioctl.c:lookup_ioctl() | |
| 219 | + */ | |
| 220 | +enum { | |
| 221 | + /* Top level cmds */ | |
| 222 | + DM_VERSION_CMD = 0, | |
| 223 | + DM_REMOVE_ALL_CMD, | |
| 224 | + DM_LIST_DEVICES_CMD, | |
| 225 | + | |
| 226 | + /* device level cmds */ | |
| 227 | + DM_DEV_CREATE_CMD, | |
| 228 | + DM_DEV_REMOVE_CMD, | |
| 229 | + DM_DEV_RENAME_CMD, | |
| 230 | + DM_DEV_SUSPEND_CMD, | |
| 231 | + DM_DEV_STATUS_CMD, | |
| 232 | + DM_DEV_WAIT_CMD, | |
| 233 | + | |
| 234 | + /* Table level cmds */ | |
| 235 | + DM_TABLE_LOAD_CMD, | |
| 236 | + DM_TABLE_CLEAR_CMD, | |
| 237 | + DM_TABLE_DEPS_CMD, | |
| 238 | + DM_TABLE_STATUS_CMD, | |
| 239 | + | |
| 240 | + /* Added later */ | |
| 241 | + DM_LIST_VERSIONS_CMD, | |
| 242 | + DM_TARGET_MSG_CMD, | |
| 243 | + DM_DEV_SET_GEOMETRY_CMD | |
| 244 | +}; | |
| 245 | + | |
| 246 | +#define DM_IOCTL 0xfd | |
| 247 | + | |
| 248 | +#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) | |
| 249 | +#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) | |
| 250 | +#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) | |
| 251 | + | |
| 252 | +#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) | |
| 253 | +#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) | |
| 254 | +#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) | |
| 255 | +#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) | |
| 256 | +#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) | |
| 257 | +#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) | |
| 258 | + | |
| 259 | +#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) | |
| 260 | +#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) | |
| 261 | +#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) | |
| 262 | +#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) | |
| 263 | + | |
| 264 | +#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) | |
| 265 | + | |
| 266 | +#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) | |
| 267 | +#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | |
| 268 | + | |
| 269 | +#define DM_VERSION_MAJOR 4 | |
| 270 | +#define DM_VERSION_MINOR 23 | |
| 271 | +#define DM_VERSION_PATCHLEVEL 0 | |
| 272 | +#define DM_VERSION_EXTRA "-ioctl (2012-07-25)" | |
| 273 | + | |
| 274 | +/* Status bits */ | |
| 275 | +#define DM_READONLY_FLAG (1 << 0) /* In/Out */ | |
| 276 | +#define DM_SUSPEND_FLAG (1 << 1) /* In/Out */ | |
| 277 | +#define DM_PERSISTENT_DEV_FLAG (1 << 3) /* In */ | |
| 278 | + | |
| 279 | +/* | |
| 280 | + * Flag passed into ioctl STATUS command to get table information | |
| 281 | + * rather than current status. | |
| 282 | + */ | |
| 283 | +#define DM_STATUS_TABLE_FLAG (1 << 4) /* In */ | |
| 284 | + | |
| 285 | +/* | |
| 286 | + * Flags that indicate whether a table is present in either of | |
| 287 | + * the two table slots that a device has. | |
| 288 | + */ | |
| 289 | +#define DM_ACTIVE_PRESENT_FLAG (1 << 5) /* Out */ | |
| 290 | +#define DM_INACTIVE_PRESENT_FLAG (1 << 6) /* Out */ | |
| 291 | + | |
| 292 | +/* | |
| 293 | + * Indicates that the buffer passed in wasn't big enough for the | |
| 294 | + * results. | |
| 295 | + */ | |
| 296 | +#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ | |
| 297 | + | |
| 298 | +/* | |
| 299 | + * This flag is now ignored. | |
| 300 | + */ | |
| 301 | +#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ | |
| 302 | + | |
| 303 | +/* | |
| 304 | + * Set this to avoid attempting to freeze any filesystem when suspending. | |
| 305 | + */ | |
| 306 | +#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */ | |
| 307 | + | |
| 308 | +/* | |
| 309 | + * Set this to suspend without flushing queued ios. | |
| 310 | + * Also disables flushing uncommitted changes in the thin target before | |
| 311 | + * generating statistics for DM_TABLE_STATUS and DM_DEV_WAIT. | |
| 312 | + */ | |
| 313 | +#define DM_NOFLUSH_FLAG (1 << 11) /* In */ | |
| 314 | + | |
| 315 | +/* | |
| 316 | + * If set, any table information returned will relate to the inactive | |
| 317 | + * table instead of the live one. Always check DM_INACTIVE_PRESENT_FLAG | |
| 318 | + * is set before using the data returned. | |
| 319 | + */ | |
| 320 | +#define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12) /* In */ | |
| 321 | + | |
| 322 | +/* | |
| 323 | + * If set, a uevent was generated for which the caller may need to wait. | |
| 324 | + */ | |
| 325 | +#define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */ | |
| 326 | + | |
| 327 | +/* | |
| 328 | + * If set, rename changes the uuid not the name. Only permitted | |
| 329 | + * if no uuid was previously supplied: an existing uuid cannot be changed. | |
| 330 | + */ | |
| 331 | +#define DM_UUID_FLAG (1 << 14) /* In */ | |
| 332 | + | |
| 333 | +/* | |
| 334 | + * If set, all buffers are wiped after use. Use when sending | |
| 335 | + * or requesting sensitive data such as an encryption key. | |
| 336 | + */ | |
| 337 | +#define DM_SECURE_DATA_FLAG (1 << 15) /* In */ | |
| 338 | + | |
| 339 | +#endif /* _LINUX_DM_IOCTL_H */ | |
| @@ -0,0 +1,416 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2006-2009 Red Hat, Inc. | |
| 3 | + * | |
| 4 | + * This file is released under the LGPL. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef __DM_LOG_USERSPACE_H__ | |
| 8 | +#define __DM_LOG_USERSPACE_H__ | |
| 9 | + | |
| 10 | +#include <linux/dm-ioctl.h> /* For DM_UUID_LEN */ | |
| 11 | + | |
| 12 | +/* | |
| 13 | + * The device-mapper userspace log module consists of a kernel component and | |
| 14 | + * a user-space component. The kernel component implements the API defined | |
| 15 | + * in dm-dirty-log.h. Its purpose is simply to pass the parameters and | |
| 16 | + * return values of those API functions between kernel and user-space. | |
| 17 | + * | |
| 18 | + * Below are defined the 'request_types' - DM_ULOG_CTR, DM_ULOG_DTR, etc. | |
| 19 | + * These request types represent the different functions in the device-mapper | |
| 20 | + * dirty log API. Each of these is described in more detail below. | |
| 21 | + * | |
| 22 | + * The user-space program must listen for requests from the kernel (representing | |
| 23 | + * the various API functions) and process them. | |
| 24 | + * | |
| 25 | + * User-space begins by setting up the communication link (error checking | |
| 26 | + * removed for clarity): | |
| 27 | + * fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); | |
| 28 | + * addr.nl_family = AF_NETLINK; | |
| 29 | + * addr.nl_groups = CN_IDX_DM; | |
| 30 | + * addr.nl_pid = 0; | |
| 31 | + * r = bind(fd, (struct sockaddr *) &addr, sizeof(addr)); | |
| 32 | + * opt = addr.nl_groups; | |
| 33 | + * setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &opt, sizeof(opt)); | |
| 34 | + * | |
| 35 | + * User-space will then wait to receive requests form the kernel, which it | |
| 36 | + * will process as described below. The requests are received in the form, | |
| 37 | + * ((struct dm_ulog_request) + (additional data)). Depending on the request | |
| 38 | + * type, there may or may not be 'additional data'. In the descriptions below, | |
| 39 | + * you will see 'Payload-to-userspace' and 'Payload-to-kernel'. The | |
| 40 | + * 'Payload-to-userspace' is what the kernel sends in 'additional data' as | |
| 41 | + * necessary parameters to complete the request. The 'Payload-to-kernel' is | |
| 42 | + * the 'additional data' returned to the kernel that contains the necessary | |
| 43 | + * results of the request. The 'data_size' field in the dm_ulog_request | |
| 44 | + * structure denotes the availability and amount of payload data. | |
| 45 | + */ | |
| 46 | + | |
| 47 | +/* | |
| 48 | + * DM_ULOG_CTR corresponds to (found in dm-dirty-log.h): | |
| 49 | + * int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, | |
| 50 | + * unsigned argc, char **argv); | |
| 51 | + * | |
| 52 | + * Payload-to-userspace: | |
| 53 | + * A single string containing all the argv arguments separated by ' 's | |
| 54 | + * Payload-to-kernel: | |
| 55 | + * A NUL-terminated string that is the name of the device that is used | |
| 56 | + * as the backing store for the log data. 'dm_get_device' will be called | |
| 57 | + * on this device. ('dm_put_device' will be called on this device | |
| 58 | + * automatically after calling DM_ULOG_DTR.) If there is no device needed | |
| 59 | + * for log data, 'data_size' in the dm_ulog_request struct should be 0. | |
| 60 | + * | |
| 61 | + * The UUID contained in the dm_ulog_request structure is the reference that | |
| 62 | + * will be used by all request types to a specific log. The constructor must | |
| 63 | + * record this association with the instance created. | |
| 64 | + * | |
| 65 | + * When the request has been processed, user-space must return the | |
| 66 | + * dm_ulog_request to the kernel - setting the 'error' field, filling the | |
| 67 | + * data field with the log device if necessary, and setting 'data_size' | |
| 68 | + * appropriately. | |
| 69 | + */ | |
| 70 | +#define DM_ULOG_CTR 1 | |
| 71 | + | |
| 72 | +/* | |
| 73 | + * DM_ULOG_DTR corresponds to (found in dm-dirty-log.h): | |
| 74 | + * void (*dtr)(struct dm_dirty_log *log); | |
| 75 | + * | |
| 76 | + * Payload-to-userspace: | |
| 77 | + * A single string containing all the argv arguments separated by ' 's | |
| 78 | + * Payload-to-kernel: | |
| 79 | + * None. ('data_size' in the dm_ulog_request struct should be 0.) | |
| 80 | + * | |
| 81 | + * The UUID contained in the dm_ulog_request structure is all that is | |
| 82 | + * necessary to identify the log instance being destroyed. There is no | |
| 83 | + * payload data. | |
| 84 | + * | |
| 85 | + * When the request has been processed, user-space must return the | |
| 86 | + * dm_ulog_request to the kernel - setting the 'error' field and clearing | |
| 87 | + * 'data_size' appropriately. | |
| 88 | + */ | |
| 89 | +#define DM_ULOG_DTR 2 | |
| 90 | + | |
| 91 | +/* | |
| 92 | + * DM_ULOG_PRESUSPEND corresponds to (found in dm-dirty-log.h): | |
| 93 | + * int (*presuspend)(struct dm_dirty_log *log); | |
| 94 | + * | |
| 95 | + * Payload-to-userspace: | |
| 96 | + * None. | |
| 97 | + * Payload-to-kernel: | |
| 98 | + * None. | |
| 99 | + * | |
| 100 | + * The UUID contained in the dm_ulog_request structure is all that is | |
| 101 | + * necessary to identify the log instance being presuspended. There is no | |
| 102 | + * payload data. | |
| 103 | + * | |
| 104 | + * When the request has been processed, user-space must return the | |
| 105 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 106 | + * 'data_size' appropriately. | |
| 107 | + */ | |
| 108 | +#define DM_ULOG_PRESUSPEND 3 | |
| 109 | + | |
| 110 | +/* | |
| 111 | + * DM_ULOG_POSTSUSPEND corresponds to (found in dm-dirty-log.h): | |
| 112 | + * int (*postsuspend)(struct dm_dirty_log *log); | |
| 113 | + * | |
| 114 | + * Payload-to-userspace: | |
| 115 | + * None. | |
| 116 | + * Payload-to-kernel: | |
| 117 | + * None. | |
| 118 | + * | |
| 119 | + * The UUID contained in the dm_ulog_request structure is all that is | |
| 120 | + * necessary to identify the log instance being postsuspended. There is no | |
| 121 | + * payload data. | |
| 122 | + * | |
| 123 | + * When the request has been processed, user-space must return the | |
| 124 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 125 | + * 'data_size' appropriately. | |
| 126 | + */ | |
| 127 | +#define DM_ULOG_POSTSUSPEND 4 | |
| 128 | + | |
| 129 | +/* | |
| 130 | + * DM_ULOG_RESUME corresponds to (found in dm-dirty-log.h): | |
| 131 | + * int (*resume)(struct dm_dirty_log *log); | |
| 132 | + * | |
| 133 | + * Payload-to-userspace: | |
| 134 | + * None. | |
| 135 | + * Payload-to-kernel: | |
| 136 | + * None. | |
| 137 | + * | |
| 138 | + * The UUID contained in the dm_ulog_request structure is all that is | |
| 139 | + * necessary to identify the log instance being resumed. There is no | |
| 140 | + * payload data. | |
| 141 | + * | |
| 142 | + * When the request has been processed, user-space must return the | |
| 143 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 144 | + * 'data_size' appropriately. | |
| 145 | + */ | |
| 146 | +#define DM_ULOG_RESUME 5 | |
| 147 | + | |
| 148 | +/* | |
| 149 | + * DM_ULOG_GET_REGION_SIZE corresponds to (found in dm-dirty-log.h): | |
| 150 | + * uint32_t (*get_region_size)(struct dm_dirty_log *log); | |
| 151 | + * | |
| 152 | + * Payload-to-userspace: | |
| 153 | + * None. | |
| 154 | + * Payload-to-kernel: | |
| 155 | + * uint64_t - contains the region size | |
| 156 | + * | |
| 157 | + * The region size is something that was determined at constructor time. | |
| 158 | + * It is returned in the payload area and 'data_size' is set to | |
| 159 | + * reflect this. | |
| 160 | + * | |
| 161 | + * When the request has been processed, user-space must return the | |
| 162 | + * dm_ulog_request to the kernel - setting the 'error' field appropriately. | |
| 163 | + */ | |
| 164 | +#define DM_ULOG_GET_REGION_SIZE 6 | |
| 165 | + | |
| 166 | +/* | |
| 167 | + * DM_ULOG_IS_CLEAN corresponds to (found in dm-dirty-log.h): | |
| 168 | + * int (*is_clean)(struct dm_dirty_log *log, region_t region); | |
| 169 | + * | |
| 170 | + * Payload-to-userspace: | |
| 171 | + * uint64_t - the region to get clean status on | |
| 172 | + * Payload-to-kernel: | |
| 173 | + * int64_t - 1 if clean, 0 otherwise | |
| 174 | + * | |
| 175 | + * Payload is sizeof(uint64_t) and contains the region for which the clean | |
| 176 | + * status is being made. | |
| 177 | + * | |
| 178 | + * When the request has been processed, user-space must return the | |
| 179 | + * dm_ulog_request to the kernel - filling the payload with 0 (not clean) or | |
| 180 | + * 1 (clean), setting 'data_size' and 'error' appropriately. | |
| 181 | + */ | |
| 182 | +#define DM_ULOG_IS_CLEAN 7 | |
| 183 | + | |
| 184 | +/* | |
| 185 | + * DM_ULOG_IN_SYNC corresponds to (found in dm-dirty-log.h): | |
| 186 | + * int (*in_sync)(struct dm_dirty_log *log, region_t region, | |
| 187 | + * int can_block); | |
| 188 | + * | |
| 189 | + * Payload-to-userspace: | |
| 190 | + * uint64_t - the region to get sync status on | |
| 191 | + * Payload-to-kernel: | |
| 192 | + * int64_t - 1 if in-sync, 0 otherwise | |
| 193 | + * | |
| 194 | + * Exactly the same as 'is_clean' above, except this time asking "has the | |
| 195 | + * region been recovered?" vs. "is the region not being modified?" | |
| 196 | + */ | |
| 197 | +#define DM_ULOG_IN_SYNC 8 | |
| 198 | + | |
| 199 | +/* | |
| 200 | + * DM_ULOG_FLUSH corresponds to (found in dm-dirty-log.h): | |
| 201 | + * int (*flush)(struct dm_dirty_log *log); | |
| 202 | + * | |
| 203 | + * Payload-to-userspace: | |
| 204 | + * None. | |
| 205 | + * Payload-to-kernel: | |
| 206 | + * None. | |
| 207 | + * | |
| 208 | + * No incoming or outgoing payload. Simply flush log state to disk. | |
| 209 | + * | |
| 210 | + * When the request has been processed, user-space must return the | |
| 211 | + * dm_ulog_request to the kernel - setting the 'error' field and clearing | |
| 212 | + * 'data_size' appropriately. | |
| 213 | + */ | |
| 214 | +#define DM_ULOG_FLUSH 9 | |
| 215 | + | |
| 216 | +/* | |
| 217 | + * DM_ULOG_MARK_REGION corresponds to (found in dm-dirty-log.h): | |
| 218 | + * void (*mark_region)(struct dm_dirty_log *log, region_t region); | |
| 219 | + * | |
| 220 | + * Payload-to-userspace: | |
| 221 | + * uint64_t [] - region(s) to mark | |
| 222 | + * Payload-to-kernel: | |
| 223 | + * None. | |
| 224 | + * | |
| 225 | + * Incoming payload contains the one or more regions to mark dirty. | |
| 226 | + * The number of regions contained in the payload can be determined from | |
| 227 | + * 'data_size/sizeof(uint64_t)'. | |
| 228 | + * | |
| 229 | + * When the request has been processed, user-space must return the | |
| 230 | + * dm_ulog_request to the kernel - setting the 'error' field and clearing | |
| 231 | + * 'data_size' appropriately. | |
| 232 | + */ | |
| 233 | +#define DM_ULOG_MARK_REGION 10 | |
| 234 | + | |
| 235 | +/* | |
| 236 | + * DM_ULOG_CLEAR_REGION corresponds to (found in dm-dirty-log.h): | |
| 237 | + * void (*clear_region)(struct dm_dirty_log *log, region_t region); | |
| 238 | + * | |
| 239 | + * Payload-to-userspace: | |
| 240 | + * uint64_t [] - region(s) to clear | |
| 241 | + * Payload-to-kernel: | |
| 242 | + * None. | |
| 243 | + * | |
| 244 | + * Incoming payload contains the one or more regions to mark clean. | |
| 245 | + * The number of regions contained in the payload can be determined from | |
| 246 | + * 'data_size/sizeof(uint64_t)'. | |
| 247 | + * | |
| 248 | + * When the request has been processed, user-space must return the | |
| 249 | + * dm_ulog_request to the kernel - setting the 'error' field and clearing | |
| 250 | + * 'data_size' appropriately. | |
| 251 | + */ | |
| 252 | +#define DM_ULOG_CLEAR_REGION 11 | |
| 253 | + | |
| 254 | +/* | |
| 255 | + * DM_ULOG_GET_RESYNC_WORK corresponds to (found in dm-dirty-log.h): | |
| 256 | + * int (*get_resync_work)(struct dm_dirty_log *log, region_t *region); | |
| 257 | + * | |
| 258 | + * Payload-to-userspace: | |
| 259 | + * None. | |
| 260 | + * Payload-to-kernel: | |
| 261 | + * { | |
| 262 | + * int64_t i; -- 1 if recovery necessary, 0 otherwise | |
| 263 | + * uint64_t r; -- The region to recover if i=1 | |
| 264 | + * } | |
| 265 | + * 'data_size' should be set appropriately. | |
| 266 | + * | |
| 267 | + * When the request has been processed, user-space must return the | |
| 268 | + * dm_ulog_request to the kernel - setting the 'error' field appropriately. | |
| 269 | + */ | |
| 270 | +#define DM_ULOG_GET_RESYNC_WORK 12 | |
| 271 | + | |
| 272 | +/* | |
| 273 | + * DM_ULOG_SET_REGION_SYNC corresponds to (found in dm-dirty-log.h): | |
| 274 | + * void (*set_region_sync)(struct dm_dirty_log *log, | |
| 275 | + * region_t region, int in_sync); | |
| 276 | + * | |
| 277 | + * Payload-to-userspace: | |
| 278 | + * { | |
| 279 | + * uint64_t - region to set sync state on | |
| 280 | + * int64_t - 0 if not-in-sync, 1 if in-sync | |
| 281 | + * } | |
| 282 | + * Payload-to-kernel: | |
| 283 | + * None. | |
| 284 | + * | |
| 285 | + * When the request has been processed, user-space must return the | |
| 286 | + * dm_ulog_request to the kernel - setting the 'error' field and clearing | |
| 287 | + * 'data_size' appropriately. | |
| 288 | + */ | |
| 289 | +#define DM_ULOG_SET_REGION_SYNC 13 | |
| 290 | + | |
| 291 | +/* | |
| 292 | + * DM_ULOG_GET_SYNC_COUNT corresponds to (found in dm-dirty-log.h): | |
| 293 | + * region_t (*get_sync_count)(struct dm_dirty_log *log); | |
| 294 | + * | |
| 295 | + * Payload-to-userspace: | |
| 296 | + * None. | |
| 297 | + * Payload-to-kernel: | |
| 298 | + * uint64_t - the number of in-sync regions | |
| 299 | + * | |
| 300 | + * No incoming payload. Kernel-bound payload contains the number of | |
| 301 | + * regions that are in-sync (in a size_t). | |
| 302 | + * | |
| 303 | + * When the request has been processed, user-space must return the | |
| 304 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 305 | + * 'data_size' appropriately. | |
| 306 | + */ | |
| 307 | +#define DM_ULOG_GET_SYNC_COUNT 14 | |
| 308 | + | |
| 309 | +/* | |
| 310 | + * DM_ULOG_STATUS_INFO corresponds to (found in dm-dirty-log.h): | |
| 311 | + * int (*status)(struct dm_dirty_log *log, STATUSTYPE_INFO, | |
| 312 | + * char *result, unsigned maxlen); | |
| 313 | + * | |
| 314 | + * Payload-to-userspace: | |
| 315 | + * None. | |
| 316 | + * Payload-to-kernel: | |
| 317 | + * Character string containing STATUSTYPE_INFO | |
| 318 | + * | |
| 319 | + * When the request has been processed, user-space must return the | |
| 320 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 321 | + * 'data_size' appropriately. | |
| 322 | + */ | |
| 323 | +#define DM_ULOG_STATUS_INFO 15 | |
| 324 | + | |
| 325 | +/* | |
| 326 | + * DM_ULOG_STATUS_TABLE corresponds to (found in dm-dirty-log.h): | |
| 327 | + * int (*status)(struct dm_dirty_log *log, STATUSTYPE_TABLE, | |
| 328 | + * char *result, unsigned maxlen); | |
| 329 | + * | |
| 330 | + * Payload-to-userspace: | |
| 331 | + * None. | |
| 332 | + * Payload-to-kernel: | |
| 333 | + * Character string containing STATUSTYPE_TABLE | |
| 334 | + * | |
| 335 | + * When the request has been processed, user-space must return the | |
| 336 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 337 | + * 'data_size' appropriately. | |
| 338 | + */ | |
| 339 | +#define DM_ULOG_STATUS_TABLE 16 | |
| 340 | + | |
| 341 | +/* | |
| 342 | + * DM_ULOG_IS_REMOTE_RECOVERING corresponds to (found in dm-dirty-log.h): | |
| 343 | + * int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region); | |
| 344 | + * | |
| 345 | + * Payload-to-userspace: | |
| 346 | + * uint64_t - region to determine recovery status on | |
| 347 | + * Payload-to-kernel: | |
| 348 | + * { | |
| 349 | + * int64_t is_recovering; -- 0 if no, 1 if yes | |
| 350 | + * uint64_t in_sync_hint; -- lowest region still needing resync | |
| 351 | + * } | |
| 352 | + * | |
| 353 | + * When the request has been processed, user-space must return the | |
| 354 | + * dm_ulog_request to the kernel - setting the 'error' field and | |
| 355 | + * 'data_size' appropriately. | |
| 356 | + */ | |
| 357 | +#define DM_ULOG_IS_REMOTE_RECOVERING 17 | |
| 358 | + | |
| 359 | +/* | |
| 360 | + * (DM_ULOG_REQUEST_MASK & request_type) to get the request type | |
| 361 | + * | |
| 362 | + * Payload-to-userspace: | |
| 363 | + * A single string containing all the argv arguments separated by ' 's | |
| 364 | + * Payload-to-kernel: | |
| 365 | + * None. ('data_size' in the dm_ulog_request struct should be 0.) | |
| 366 | + * | |
| 367 | + * We are reserving 8 bits of the 32-bit 'request_type' field for the | |
| 368 | + * various request types above. The remaining 24-bits are currently | |
| 369 | + * set to zero and are reserved for future use and compatibility concerns. | |
| 370 | + * | |
| 371 | + * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the | |
| 372 | + * request type from the 'request_type' field to maintain forward compatibility. | |
| 373 | + */ | |
| 374 | +#define DM_ULOG_REQUEST_MASK 0xFF | |
| 375 | +#define DM_ULOG_REQUEST_TYPE(request_type) \ | |
| 376 | + (DM_ULOG_REQUEST_MASK & (request_type)) | |
| 377 | + | |
| 378 | +/* | |
| 379 | + * DM_ULOG_REQUEST_VERSION is incremented when there is a | |
| 380 | + * change to the way information is passed between kernel | |
| 381 | + * and userspace. This could be a structure change of | |
| 382 | + * dm_ulog_request or a change in the way requests are | |
| 383 | + * issued/handled. Changes are outlined here: | |
| 384 | + * version 1: Initial implementation | |
| 385 | + * version 2: DM_ULOG_CTR allowed to return a string containing a | |
| 386 | + * device name that is to be registered with DM via | |
| 387 | + * 'dm_get_device'. | |
| 388 | + */ | |
| 389 | +#define DM_ULOG_REQUEST_VERSION 2 | |
| 390 | + | |
| 391 | +struct dm_ulog_request { | |
| 392 | + /* | |
| 393 | + * The local unique identifier (luid) and the universally unique | |
| 394 | + * identifier (uuid) are used to tie a request to a specific | |
| 395 | + * mirror log. A single machine log could probably make due with | |
| 396 | + * just the 'luid', but a cluster-aware log must use the 'uuid' and | |
| 397 | + * the 'luid'. The uuid is what is required for node to node | |
| 398 | + * communication concerning a particular log, but the 'luid' helps | |
| 399 | + * differentiate between logs that are being swapped and have the | |
| 400 | + * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) | |
| 401 | + */ | |
| 402 | + uint64_t luid; | |
| 403 | + char uuid[DM_UUID_LEN]; | |
| 404 | + char padding[3]; /* Padding because DM_UUID_LEN = 129 */ | |
| 405 | + | |
| 406 | + uint32_t version; /* See DM_ULOG_REQUEST_VERSION */ | |
| 407 | + int32_t error; /* Used to report back processing errors */ | |
| 408 | + | |
| 409 | + uint32_t seq; /* Sequence number for request */ | |
| 410 | + uint32_t request_type; /* DM_ULOG_* defined above */ | |
| 411 | + uint32_t data_size; /* How much data (not including this struct) */ | |
| 412 | + | |
| 413 | + char data[0]; | |
| 414 | +}; | |
| 415 | + | |
| 416 | +#endif /* __DM_LOG_USERSPACE_H__ */ | |
| @@ -0,0 +1,146 @@ | ||
| 1 | +#ifndef _LINUX_DN_H | |
| 2 | +#define _LINUX_DN_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +/* | |
| 7 | + | |
| 8 | + DECnet Data Structures and Constants | |
| 9 | + | |
| 10 | +*/ | |
| 11 | + | |
| 12 | +/* | |
| 13 | + * DNPROTO_NSP can't be the same as SOL_SOCKET, | |
| 14 | + * so increment each by one (compared to ULTRIX) | |
| 15 | + */ | |
| 16 | +#define DNPROTO_NSP 2 /* NSP protocol number */ | |
| 17 | +#define DNPROTO_ROU 3 /* Routing protocol number */ | |
| 18 | +#define DNPROTO_NML 4 /* Net mgt protocol number */ | |
| 19 | +#define DNPROTO_EVL 5 /* Evl protocol number (usr) */ | |
| 20 | +#define DNPROTO_EVR 6 /* Evl protocol number (evl) */ | |
| 21 | +#define DNPROTO_NSPT 7 /* NSP trace protocol number */ | |
| 22 | + | |
| 23 | + | |
| 24 | +#define DN_ADDL 2 | |
| 25 | +#define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */ | |
| 26 | +#define DN_MAXOPTL 16 | |
| 27 | +#define DN_MAXOBJL 16 | |
| 28 | +#define DN_MAXACCL 40 | |
| 29 | +#define DN_MAXALIASL 128 | |
| 30 | +#define DN_MAXNODEL 256 | |
| 31 | +#define DNBUFSIZE 65023 | |
| 32 | + | |
| 33 | +/* | |
| 34 | + * SET/GET Socket options - must match the DSO_ numbers below | |
| 35 | + */ | |
| 36 | +#define SO_CONDATA 1 | |
| 37 | +#define SO_CONACCESS 2 | |
| 38 | +#define SO_PROXYUSR 3 | |
| 39 | +#define SO_LINKINFO 7 | |
| 40 | + | |
| 41 | +#define DSO_CONDATA 1 /* Set/Get connect data */ | |
| 42 | +#define DSO_DISDATA 10 /* Set/Get disconnect data */ | |
| 43 | +#define DSO_CONACCESS 2 /* Set/Get connect access data */ | |
| 44 | +#define DSO_ACCEPTMODE 4 /* Set/Get accept mode */ | |
| 45 | +#define DSO_CONACCEPT 5 /* Accept deferred connection */ | |
| 46 | +#define DSO_CONREJECT 6 /* Reject deferred connection */ | |
| 47 | +#define DSO_LINKINFO 7 /* Set/Get link information */ | |
| 48 | +#define DSO_STREAM 8 /* Set socket type to stream */ | |
| 49 | +#define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */ | |
| 50 | +#define DSO_MAXWINDOW 11 /* Maximum window size allowed */ | |
| 51 | +#define DSO_NODELAY 12 /* Turn off nagle */ | |
| 52 | +#define DSO_CORK 13 /* Wait for more data! */ | |
| 53 | +#define DSO_SERVICES 14 /* NSP Services field */ | |
| 54 | +#define DSO_INFO 15 /* NSP Info field */ | |
| 55 | +#define DSO_MAX 15 /* Maximum option number */ | |
| 56 | + | |
| 57 | + | |
| 58 | +/* LINK States */ | |
| 59 | +#define LL_INACTIVE 0 | |
| 60 | +#define LL_CONNECTING 1 | |
| 61 | +#define LL_RUNNING 2 | |
| 62 | +#define LL_DISCONNECTING 3 | |
| 63 | + | |
| 64 | +#define ACC_IMMED 0 | |
| 65 | +#define ACC_DEFER 1 | |
| 66 | + | |
| 67 | +#define SDF_WILD 1 /* Wild card object */ | |
| 68 | +#define SDF_PROXY 2 /* Addr eligible for proxy */ | |
| 69 | +#define SDF_UICPROXY 4 /* Use uic-based proxy */ | |
| 70 | + | |
| 71 | +/* Structures */ | |
| 72 | + | |
| 73 | + | |
| 74 | +struct dn_naddr { | |
| 75 | + __le16 a_len; | |
| 76 | + __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */ | |
| 77 | +}; | |
| 78 | + | |
| 79 | +struct sockaddr_dn { | |
| 80 | + __u16 sdn_family; | |
| 81 | + __u8 sdn_flags; | |
| 82 | + __u8 sdn_objnum; | |
| 83 | + __le16 sdn_objnamel; | |
| 84 | + __u8 sdn_objname[DN_MAXOBJL]; | |
| 85 | + struct dn_naddr sdn_add; | |
| 86 | +}; | |
| 87 | +#define sdn_nodeaddrl sdn_add.a_len /* Node address length */ | |
| 88 | +#define sdn_nodeaddr sdn_add.a_addr /* Node address */ | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | +/* | |
| 93 | + * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure | |
| 94 | + */ | |
| 95 | +struct optdata_dn { | |
| 96 | + __le16 opt_status; /* Extended status return */ | |
| 97 | +#define opt_sts opt_status | |
| 98 | + __le16 opt_optl; /* Length of user data */ | |
| 99 | + __u8 opt_data[16]; /* User data */ | |
| 100 | +}; | |
| 101 | + | |
| 102 | +struct accessdata_dn { | |
| 103 | + __u8 acc_accl; | |
| 104 | + __u8 acc_acc[DN_MAXACCL]; | |
| 105 | + __u8 acc_passl; | |
| 106 | + __u8 acc_pass[DN_MAXACCL]; | |
| 107 | + __u8 acc_userl; | |
| 108 | + __u8 acc_user[DN_MAXACCL]; | |
| 109 | +}; | |
| 110 | + | |
| 111 | +/* | |
| 112 | + * DECnet logical link information structure | |
| 113 | + */ | |
| 114 | +struct linkinfo_dn { | |
| 115 | + __u16 idn_segsize; /* Segment size for link */ | |
| 116 | + __u8 idn_linkstate; /* Logical link state */ | |
| 117 | +}; | |
| 118 | + | |
| 119 | +/* | |
| 120 | + * Ethernet address format (for DECnet) | |
| 121 | + */ | |
| 122 | +union etheraddress { | |
| 123 | + __u8 dne_addr[6]; /* Full ethernet address */ | |
| 124 | + struct { | |
| 125 | + __u8 dne_hiord[4]; /* DECnet HIORD prefix */ | |
| 126 | + __u8 dne_nodeaddr[2]; /* DECnet node address */ | |
| 127 | + } dne_remote; | |
| 128 | +}; | |
| 129 | + | |
| 130 | + | |
| 131 | +/* | |
| 132 | + * DECnet physical socket address format | |
| 133 | + */ | |
| 134 | +struct dn_addr { | |
| 135 | + __le16 dna_family; /* AF_DECnet */ | |
| 136 | + union etheraddress dna_netaddr; /* DECnet ethernet address */ | |
| 137 | +}; | |
| 138 | + | |
| 139 | +#define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */ | |
| 140 | + | |
| 141 | +#define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr) | |
| 142 | +#define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr) | |
| 143 | +#define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int) | |
| 144 | +#define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int) | |
| 145 | + | |
| 146 | +#endif /* _LINUX_DN_H */ | |
| @@ -0,0 +1,166 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved. | |
| 3 | + * | |
| 4 | + * This program is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public License | |
| 6 | + * as published by the Free Software Foundation. | |
| 7 | + * | |
| 8 | + * This program is distributed in the hope that it will be useful, | |
| 9 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11 | + * GNU Lesser General Public License for more details. | |
| 12 | + * | |
| 13 | + * You should have received a copy of the GNU Lesset General Public License | |
| 14 | + * along with this program; if not, write to the Free Software Foundation, | |
| 15 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 16 | + */ | |
| 17 | +#ifndef _LINUX_DQBLK_XFS_H | |
| 18 | +#define _LINUX_DQBLK_XFS_H | |
| 19 | + | |
| 20 | +#include <linux/types.h> | |
| 21 | + | |
| 22 | +/* | |
| 23 | + * Disk quota - quotactl(2) commands for the XFS Quota Manager (XQM). | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ | |
| 27 | +#define XQM_COMMAND(x) (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */ | |
| 28 | + | |
| 29 | +#define XQM_USRQUOTA 0 /* system call user quota type */ | |
| 30 | +#define XQM_GRPQUOTA 1 /* system call group quota type */ | |
| 31 | +#define XQM_PRJQUOTA 2 /* system call project quota type */ | |
| 32 | +#define XQM_MAXQUOTAS 3 | |
| 33 | + | |
| 34 | +#define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ | |
| 35 | +#define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ | |
| 36 | +#define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */ | |
| 37 | +#define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ | |
| 38 | +#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ | |
| 39 | +#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ | |
| 40 | +#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ | |
| 41 | + | |
| 42 | +/* | |
| 43 | + * fs_disk_quota structure: | |
| 44 | + * | |
| 45 | + * This contains the current quota information regarding a user/proj/group. | |
| 46 | + * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of | |
| 47 | + * 512 bytes. | |
| 48 | + */ | |
| 49 | +#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ | |
| 50 | +typedef struct fs_disk_quota { | |
| 51 | + __s8 d_version; /* version of this structure */ | |
| 52 | + __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */ | |
| 53 | + __u16 d_fieldmask; /* field specifier */ | |
| 54 | + __u32 d_id; /* user, project, or group ID */ | |
| 55 | + __u64 d_blk_hardlimit;/* absolute limit on disk blks */ | |
| 56 | + __u64 d_blk_softlimit;/* preferred limit on disk blks */ | |
| 57 | + __u64 d_ino_hardlimit;/* maximum # allocated inodes */ | |
| 58 | + __u64 d_ino_softlimit;/* preferred inode limit */ | |
| 59 | + __u64 d_bcount; /* # disk blocks owned by the user */ | |
| 60 | + __u64 d_icount; /* # inodes owned by the user */ | |
| 61 | + __s32 d_itimer; /* zero if within inode limits */ | |
| 62 | + /* if not, we refuse service */ | |
| 63 | + __s32 d_btimer; /* similar to above; for disk blocks */ | |
| 64 | + __u16 d_iwarns; /* # warnings issued wrt num inodes */ | |
| 65 | + __u16 d_bwarns; /* # warnings issued wrt disk blocks */ | |
| 66 | + __s32 d_padding2; /* padding2 - for future use */ | |
| 67 | + __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ | |
| 68 | + __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ | |
| 69 | + __u64 d_rtbcount; /* # realtime blocks owned */ | |
| 70 | + __s32 d_rtbtimer; /* similar to above; for RT disk blks */ | |
| 71 | + __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ | |
| 72 | + __s16 d_padding3; /* padding3 - for future use */ | |
| 73 | + char d_padding4[8]; /* yet more padding */ | |
| 74 | +} fs_disk_quota_t; | |
| 75 | + | |
| 76 | +/* | |
| 77 | + * These fields are sent to Q_XSETQLIM to specify fields that need to change. | |
| 78 | + */ | |
| 79 | +#define FS_DQ_ISOFT (1<<0) | |
| 80 | +#define FS_DQ_IHARD (1<<1) | |
| 81 | +#define FS_DQ_BSOFT (1<<2) | |
| 82 | +#define FS_DQ_BHARD (1<<3) | |
| 83 | +#define FS_DQ_RTBSOFT (1<<4) | |
| 84 | +#define FS_DQ_RTBHARD (1<<5) | |
| 85 | +#define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ | |
| 86 | + FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) | |
| 87 | +/* | |
| 88 | + * These timers can only be set in super user's dquot. For others, timers are | |
| 89 | + * automatically started and stopped. Superusers timer values set the limits | |
| 90 | + * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values | |
| 91 | + * defined below are used. | |
| 92 | + * These values also apply only to the d_fieldmask field for Q_XSETQLIM. | |
| 93 | + */ | |
| 94 | +#define FS_DQ_BTIMER (1<<6) | |
| 95 | +#define FS_DQ_ITIMER (1<<7) | |
| 96 | +#define FS_DQ_RTBTIMER (1<<8) | |
| 97 | +#define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) | |
| 98 | + | |
| 99 | +/* | |
| 100 | + * Warning counts are set in both super user's dquot and others. For others, | |
| 101 | + * warnings are set/cleared by the administrators (or automatically by going | |
| 102 | + * below the soft limit). Superusers warning values set the warning limits | |
| 103 | + * for the rest. In case these values are zero, the DQ_{F,B}WARNLIMIT values | |
| 104 | + * defined below are used. | |
| 105 | + * These values also apply only to the d_fieldmask field for Q_XSETQLIM. | |
| 106 | + */ | |
| 107 | +#define FS_DQ_BWARNS (1<<9) | |
| 108 | +#define FS_DQ_IWARNS (1<<10) | |
| 109 | +#define FS_DQ_RTBWARNS (1<<11) | |
| 110 | +#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) | |
| 111 | + | |
| 112 | +/* | |
| 113 | + * Accounting values. These can only be set for filesystem with | |
| 114 | + * non-transactional quotas that require quotacheck(8) in userspace. | |
| 115 | + */ | |
| 116 | +#define FS_DQ_BCOUNT (1<<12) | |
| 117 | +#define FS_DQ_ICOUNT (1<<13) | |
| 118 | +#define FS_DQ_RTBCOUNT (1<<14) | |
| 119 | +#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT) | |
| 120 | + | |
| 121 | +/* | |
| 122 | + * Various flags related to quotactl(2). | |
| 123 | + */ | |
| 124 | +#define FS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ | |
| 125 | +#define FS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ | |
| 126 | +#define FS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ | |
| 127 | +#define FS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ | |
| 128 | +#define FS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */ | |
| 129 | +#define FS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */ | |
| 130 | + | |
| 131 | +#define FS_USER_QUOTA (1<<0) /* user quota type */ | |
| 132 | +#define FS_PROJ_QUOTA (1<<1) /* project quota type */ | |
| 133 | +#define FS_GROUP_QUOTA (1<<2) /* group quota type */ | |
| 134 | + | |
| 135 | +/* | |
| 136 | + * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. | |
| 137 | + * Provides a centralized way to get meta information about the quota subsystem. | |
| 138 | + * eg. space taken up for user and group quotas, number of dquots currently | |
| 139 | + * incore. | |
| 140 | + */ | |
| 141 | +#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ | |
| 142 | + | |
| 143 | +/* | |
| 144 | + * Some basic information about 'quota files'. | |
| 145 | + */ | |
| 146 | +typedef struct fs_qfilestat { | |
| 147 | + __u64 qfs_ino; /* inode number */ | |
| 148 | + __u64 qfs_nblks; /* number of BBs 512-byte-blks */ | |
| 149 | + __u32 qfs_nextents; /* number of extents */ | |
| 150 | +} fs_qfilestat_t; | |
| 151 | + | |
| 152 | +typedef struct fs_quota_stat { | |
| 153 | + __s8 qs_version; /* version number for future changes */ | |
| 154 | + __u16 qs_flags; /* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ | |
| 155 | + __s8 qs_pad; /* unused */ | |
| 156 | + fs_qfilestat_t qs_uquota; /* user quota storage information */ | |
| 157 | + fs_qfilestat_t qs_gquota; /* group quota storage information */ | |
| 158 | + __u32 qs_incoredqs; /* number of dquots incore */ | |
| 159 | + __s32 qs_btimelimit; /* limit for blks timer */ | |
| 160 | + __s32 qs_itimelimit; /* limit for inodes timer */ | |
| 161 | + __s32 qs_rtbtimelimit;/* limit for rt blks timer */ | |
| 162 | + __u16 qs_bwarnlimit; /* limit for num warnings */ | |
| 163 | + __u16 qs_iwarnlimit; /* limit for num warnings */ | |
| 164 | +} fs_quota_stat_t; | |
| 165 | + | |
| 166 | +#endif /* _LINUX_DQBLK_XFS_H */ | |
| @@ -0,0 +1,191 @@ | ||
| 1 | +/* | |
| 2 | + * linux/include/linux/edd.h | |
| 3 | + * Copyright (C) 2002, 2003, 2004 Dell Inc. | |
| 4 | + * by Matt Domsch <Matt_Domsch@dell.com> | |
| 5 | + * | |
| 6 | + * structures and definitions for the int 13h, ax={41,48}h | |
| 7 | + * BIOS Enhanced Disk Drive Services | |
| 8 | + * This is based on the T13 group document D1572 Revision 0 (August 14 2002) | |
| 9 | + * available at http://www.t13.org/docs2002/d1572r0.pdf. It is | |
| 10 | + * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf | |
| 11 | + * | |
| 12 | + * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch | |
| 13 | + * table in the boot_params that contains a list of BIOS-enumerated | |
| 14 | + * boot devices. | |
| 15 | + * In arch/{i386,x86_64}/kernel/setup.c, this information is | |
| 16 | + * transferred into the edd structure, and in drivers/firmware/edd.c, that | |
| 17 | + * information is used to identify BIOS boot disk. The code in setup.S | |
| 18 | + * is very sensitive to the size of these structures. | |
| 19 | + * | |
| 20 | + * This program is free software; you can redistribute it and/or modify | |
| 21 | + * it under the terms of the GNU General Public License v2.0 as published by | |
| 22 | + * the Free Software Foundation | |
| 23 | + * | |
| 24 | + * This program is distributed in the hope that it will be useful, | |
| 25 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 26 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 27 | + * GNU General Public License for more details. | |
| 28 | + * | |
| 29 | + */ | |
| 30 | +#ifndef _UAPI_LINUX_EDD_H | |
| 31 | +#define _UAPI_LINUX_EDD_H | |
| 32 | + | |
| 33 | +#include <linux/types.h> | |
| 34 | + | |
| 35 | +#define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF | |
| 36 | + in boot_params - treat this as 1 byte */ | |
| 37 | +#define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ | |
| 38 | +#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ | |
| 39 | +#define EDDEXTSIZE 8 /* change these if you muck with the structures */ | |
| 40 | +#define EDDPARMSIZE 74 | |
| 41 | +#define CHECKEXTENSIONSPRESENT 0x41 | |
| 42 | +#define GETDEVICEPARAMETERS 0x48 | |
| 43 | +#define LEGACYGETDEVICEPARAMETERS 0x08 | |
| 44 | +#define EDDMAGIC1 0x55AA | |
| 45 | +#define EDDMAGIC2 0xAA55 | |
| 46 | + | |
| 47 | + | |
| 48 | +#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ | |
| 49 | +#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ | |
| 50 | +#define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ | |
| 51 | +#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ | |
| 52 | +#define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF | |
| 53 | + in boot_params - treat this as 1 byte */ | |
| 54 | + | |
| 55 | +#ifndef __ASSEMBLY__ | |
| 56 | + | |
| 57 | +#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) | |
| 58 | +#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) | |
| 59 | +#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) | |
| 60 | +#define EDD_EXT_64BIT_EXTENSIONS (1 << 3) | |
| 61 | + | |
| 62 | +#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) | |
| 63 | +#define EDD_INFO_GEOMETRY_VALID (1 << 1) | |
| 64 | +#define EDD_INFO_REMOVABLE (1 << 2) | |
| 65 | +#define EDD_INFO_WRITE_VERIFY (1 << 3) | |
| 66 | +#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) | |
| 67 | +#define EDD_INFO_LOCKABLE (1 << 5) | |
| 68 | +#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) | |
| 69 | +#define EDD_INFO_USE_INT13_FN50 (1 << 7) | |
| 70 | + | |
| 71 | +struct edd_device_params { | |
| 72 | + __u16 length; | |
| 73 | + __u16 info_flags; | |
| 74 | + __u32 num_default_cylinders; | |
| 75 | + __u32 num_default_heads; | |
| 76 | + __u32 sectors_per_track; | |
| 77 | + __u64 number_of_sectors; | |
| 78 | + __u16 bytes_per_sector; | |
| 79 | + __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ | |
| 80 | + __u16 key; /* = 0xBEDD */ | |
| 81 | + __u8 device_path_info_length; /* = 44 */ | |
| 82 | + __u8 reserved2; | |
| 83 | + __u16 reserved3; | |
| 84 | + __u8 host_bus_type[4]; | |
| 85 | + __u8 interface_type[8]; | |
| 86 | + union { | |
| 87 | + struct { | |
| 88 | + __u16 base_address; | |
| 89 | + __u16 reserved1; | |
| 90 | + __u32 reserved2; | |
| 91 | + } __attribute__ ((packed)) isa; | |
| 92 | + struct { | |
| 93 | + __u8 bus; | |
| 94 | + __u8 slot; | |
| 95 | + __u8 function; | |
| 96 | + __u8 channel; | |
| 97 | + __u32 reserved; | |
| 98 | + } __attribute__ ((packed)) pci; | |
| 99 | + /* pcix is same as pci */ | |
| 100 | + struct { | |
| 101 | + __u64 reserved; | |
| 102 | + } __attribute__ ((packed)) ibnd; | |
| 103 | + struct { | |
| 104 | + __u64 reserved; | |
| 105 | + } __attribute__ ((packed)) xprs; | |
| 106 | + struct { | |
| 107 | + __u64 reserved; | |
| 108 | + } __attribute__ ((packed)) htpt; | |
| 109 | + struct { | |
| 110 | + __u64 reserved; | |
| 111 | + } __attribute__ ((packed)) unknown; | |
| 112 | + } interface_path; | |
| 113 | + union { | |
| 114 | + struct { | |
| 115 | + __u8 device; | |
| 116 | + __u8 reserved1; | |
| 117 | + __u16 reserved2; | |
| 118 | + __u32 reserved3; | |
| 119 | + __u64 reserved4; | |
| 120 | + } __attribute__ ((packed)) ata; | |
| 121 | + struct { | |
| 122 | + __u8 device; | |
| 123 | + __u8 lun; | |
| 124 | + __u8 reserved1; | |
| 125 | + __u8 reserved2; | |
| 126 | + __u32 reserved3; | |
| 127 | + __u64 reserved4; | |
| 128 | + } __attribute__ ((packed)) atapi; | |
| 129 | + struct { | |
| 130 | + __u16 id; | |
| 131 | + __u64 lun; | |
| 132 | + __u16 reserved1; | |
| 133 | + __u32 reserved2; | |
| 134 | + } __attribute__ ((packed)) scsi; | |
| 135 | + struct { | |
| 136 | + __u64 serial_number; | |
| 137 | + __u64 reserved; | |
| 138 | + } __attribute__ ((packed)) usb; | |
| 139 | + struct { | |
| 140 | + __u64 eui; | |
| 141 | + __u64 reserved; | |
| 142 | + } __attribute__ ((packed)) i1394; | |
| 143 | + struct { | |
| 144 | + __u64 wwid; | |
| 145 | + __u64 lun; | |
| 146 | + } __attribute__ ((packed)) fibre; | |
| 147 | + struct { | |
| 148 | + __u64 identity_tag; | |
| 149 | + __u64 reserved; | |
| 150 | + } __attribute__ ((packed)) i2o; | |
| 151 | + struct { | |
| 152 | + __u32 array_number; | |
| 153 | + __u32 reserved1; | |
| 154 | + __u64 reserved2; | |
| 155 | + } __attribute__ ((packed)) raid; | |
| 156 | + struct { | |
| 157 | + __u8 device; | |
| 158 | + __u8 reserved1; | |
| 159 | + __u16 reserved2; | |
| 160 | + __u32 reserved3; | |
| 161 | + __u64 reserved4; | |
| 162 | + } __attribute__ ((packed)) sata; | |
| 163 | + struct { | |
| 164 | + __u64 reserved1; | |
| 165 | + __u64 reserved2; | |
| 166 | + } __attribute__ ((packed)) unknown; | |
| 167 | + } device_path; | |
| 168 | + __u8 reserved4; | |
| 169 | + __u8 checksum; | |
| 170 | +} __attribute__ ((packed)); | |
| 171 | + | |
| 172 | +struct edd_info { | |
| 173 | + __u8 device; | |
| 174 | + __u8 version; | |
| 175 | + __u16 interface_support; | |
| 176 | + __u16 legacy_max_cylinder; | |
| 177 | + __u8 legacy_max_head; | |
| 178 | + __u8 legacy_sectors_per_track; | |
| 179 | + struct edd_device_params params; | |
| 180 | +} __attribute__ ((packed)); | |
| 181 | + | |
| 182 | +struct edd { | |
| 183 | + unsigned int mbr_signature[EDD_MBR_SIG_MAX]; | |
| 184 | + struct edd_info edd_info[EDDMAXNR]; | |
| 185 | + unsigned char mbr_signature_nr; | |
| 186 | + unsigned char edd_info_nr; | |
| 187 | +}; | |
| 188 | + | |
| 189 | +#endif /*!__ASSEMBLY__ */ | |
| 190 | + | |
| 191 | +#endif /* _UAPI_LINUX_EDD_H */ | |
| @@ -0,0 +1,62 @@ | ||
| 1 | +/* | |
| 2 | + * efs_fs_sb.h | |
| 3 | + * | |
| 4 | + * Copyright (c) 1999 Al Smith | |
| 5 | + * | |
| 6 | + * Portions derived from IRIX header files (c) 1988 Silicon Graphics | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifndef __EFS_FS_SB_H__ | |
| 10 | +#define __EFS_FS_SB_H__ | |
| 11 | + | |
| 12 | +#include <linux/types.h> | |
| 13 | +#include <linux/magic.h> | |
| 14 | + | |
| 15 | +/* EFS superblock magic numbers */ | |
| 16 | +#define EFS_MAGIC 0x072959 | |
| 17 | +#define EFS_NEWMAGIC 0x07295a | |
| 18 | + | |
| 19 | +#define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) | |
| 20 | + | |
| 21 | +#define EFS_SUPER 1 | |
| 22 | +#define EFS_ROOTINODE 2 | |
| 23 | + | |
| 24 | +/* efs superblock on disk */ | |
| 25 | +struct efs_super { | |
| 26 | + __be32 fs_size; /* size of filesystem, in sectors */ | |
| 27 | + __be32 fs_firstcg; /* bb offset to first cg */ | |
| 28 | + __be32 fs_cgfsize; /* size of cylinder group in bb's */ | |
| 29 | + __be16 fs_cgisize; /* bb's of inodes per cylinder group */ | |
| 30 | + __be16 fs_sectors; /* sectors per track */ | |
| 31 | + __be16 fs_heads; /* heads per cylinder */ | |
| 32 | + __be16 fs_ncg; /* # of cylinder groups in filesystem */ | |
| 33 | + __be16 fs_dirty; /* fs needs to be fsck'd */ | |
| 34 | + __be32 fs_time; /* last super-block update */ | |
| 35 | + __be32 fs_magic; /* magic number */ | |
| 36 | + char fs_fname[6]; /* file system name */ | |
| 37 | + char fs_fpack[6]; /* file system pack name */ | |
| 38 | + __be32 fs_bmsize; /* size of bitmap in bytes */ | |
| 39 | + __be32 fs_tfree; /* total free data blocks */ | |
| 40 | + __be32 fs_tinode; /* total free inodes */ | |
| 41 | + __be32 fs_bmblock; /* bitmap location. */ | |
| 42 | + __be32 fs_replsb; /* Location of replicated superblock. */ | |
| 43 | + __be32 fs_lastialloc; /* last allocated inode */ | |
| 44 | + char fs_spare[20]; /* space for expansion - MUST BE ZERO */ | |
| 45 | + __be32 fs_checksum; /* checksum of volume portion of fs */ | |
| 46 | +}; | |
| 47 | + | |
| 48 | +/* efs superblock information in memory */ | |
| 49 | +struct efs_sb_info { | |
| 50 | + __u32 fs_magic; /* superblock magic number */ | |
| 51 | + __u32 fs_start; /* first block of filesystem */ | |
| 52 | + __u32 first_block; /* first data block in filesystem */ | |
| 53 | + __u32 total_blocks; /* total number of blocks in filesystem */ | |
| 54 | + __u32 group_size; /* # of blocks a group consists of */ | |
| 55 | + __u32 data_free; /* # of free data blocks */ | |
| 56 | + __u32 inode_free; /* # of free inodes */ | |
| 57 | + __u16 inode_blocks; /* # of blocks used for inodes in every grp */ | |
| 58 | + __u16 total_groups; /* # of groups */ | |
| 59 | +}; | |
| 60 | + | |
| 61 | +#endif /* __EFS_FS_SB_H__ */ | |
| 62 | + | |
| @@ -0,0 +1,56 @@ | ||
| 1 | +#ifndef _LINUX_ELF_EM_H | |
| 2 | +#define _LINUX_ELF_EM_H | |
| 3 | + | |
| 4 | +/* These constants define the various ELF target machines */ | |
| 5 | +#define EM_NONE 0 | |
| 6 | +#define EM_M32 1 | |
| 7 | +#define EM_SPARC 2 | |
| 8 | +#define EM_386 3 | |
| 9 | +#define EM_68K 4 | |
| 10 | +#define EM_88K 5 | |
| 11 | +#define EM_486 6 /* Perhaps disused */ | |
| 12 | +#define EM_860 7 | |
| 13 | +#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ | |
| 14 | + /* Next two are historical and binaries and | |
| 15 | + modules of these types will be rejected by | |
| 16 | + Linux. */ | |
| 17 | +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ | |
| 18 | +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ | |
| 19 | + | |
| 20 | +#define EM_PARISC 15 /* HPPA */ | |
| 21 | +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ | |
| 22 | +#define EM_PPC 20 /* PowerPC */ | |
| 23 | +#define EM_PPC64 21 /* PowerPC64 */ | |
| 24 | +#define EM_SPU 23 /* Cell BE SPU */ | |
| 25 | +#define EM_SH 42 /* SuperH */ | |
| 26 | +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ | |
| 27 | +#define EM_IA_64 50 /* HP/Intel IA-64 */ | |
| 28 | +#define EM_X86_64 62 /* AMD x86-64 */ | |
| 29 | +#define EM_S390 22 /* IBM S/390 */ | |
| 30 | +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ | |
| 31 | +#define EM_V850 87 /* NEC v850 */ | |
| 32 | +#define EM_M32R 88 /* Renesas M32R */ | |
| 33 | +#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ | |
| 34 | +#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ | |
| 35 | +#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ | |
| 36 | +#define EM_TI_C6000 140 /* TI C6X DSPs */ | |
| 37 | +#define EM_FRV 0x5441 /* Fujitsu FR-V */ | |
| 38 | +#define EM_AVR32 0x18ad /* Atmel AVR32 */ | |
| 39 | + | |
| 40 | +/* | |
| 41 | + * This is an interim value that we will use until the committee comes | |
| 42 | + * up with a final number. | |
| 43 | + */ | |
| 44 | +#define EM_ALPHA 0x9026 | |
| 45 | + | |
| 46 | +/* Bogus old v850 magic number, used by old tools. */ | |
| 47 | +#define EM_CYGNUS_V850 0x9080 | |
| 48 | +/* Bogus old m32r magic number, used by old tools. */ | |
| 49 | +#define EM_CYGNUS_M32R 0x9041 | |
| 50 | +/* This is the old interim value for S/390 architecture */ | |
| 51 | +#define EM_S390_OLD 0xA390 | |
| 52 | +/* Also Panasonic/MEI MN10300, AM33 */ | |
| 53 | +#define EM_CYGNUS_MN10300 0xbeef | |
| 54 | + | |
| 55 | + | |
| 56 | +#endif /* _LINUX_ELF_EM_H */ | |
| @@ -0,0 +1,70 @@ | ||
| 1 | +/* elf-fdpic.h: FDPIC ELF load map | |
| 2 | + * | |
| 3 | + * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. | |
| 4 | + * Written by David Howells (dhowells@redhat.com) | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or | |
| 7 | + * modify it under the terms of the GNU General Public License | |
| 8 | + * as published by the Free Software Foundation; either version | |
| 9 | + * 2 of the License, or (at your option) any later version. | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef _LINUX_ELF_FDPIC_H | |
| 13 | +#define _LINUX_ELF_FDPIC_H | |
| 14 | + | |
| 15 | +#include <linux/elf.h> | |
| 16 | + | |
| 17 | +#define PT_GNU_STACK (PT_LOOS + 0x474e551) | |
| 18 | + | |
| 19 | +/* segment mappings for ELF FDPIC libraries/executables/interpreters */ | |
| 20 | +struct elf32_fdpic_loadseg { | |
| 21 | + Elf32_Addr addr; /* core address to which mapped */ | |
| 22 | + Elf32_Addr p_vaddr; /* VMA recorded in file */ | |
| 23 | + Elf32_Word p_memsz; /* allocation size recorded in file */ | |
| 24 | +}; | |
| 25 | + | |
| 26 | +struct elf32_fdpic_loadmap { | |
| 27 | + Elf32_Half version; /* version of these structures, just in case... */ | |
| 28 | + Elf32_Half nsegs; /* number of segments */ | |
| 29 | + struct elf32_fdpic_loadseg segs[]; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +#define ELF32_FDPIC_LOADMAP_VERSION 0x0000 | |
| 33 | + | |
| 34 | +#ifndef __KERNEL__ | |
| 35 | +/* | |
| 36 | + * binfmt binary parameters structure | |
| 37 | + */ | |
| 38 | +struct elf_fdpic_params { | |
| 39 | + struct elfhdr hdr; /* ref copy of ELF header */ | |
| 40 | + struct elf_phdr *phdrs; /* ref copy of PT_PHDR table */ | |
| 41 | + struct elf32_fdpic_loadmap *loadmap; /* loadmap to be passed to userspace */ | |
| 42 | + unsigned long elfhdr_addr; /* mapped ELF header user address */ | |
| 43 | + unsigned long ph_addr; /* mapped PT_PHDR user address */ | |
| 44 | + unsigned long map_addr; /* mapped loadmap user address */ | |
| 45 | + unsigned long entry_addr; /* mapped entry user address */ | |
| 46 | + unsigned long stack_size; /* stack size requested (PT_GNU_STACK) */ | |
| 47 | + unsigned long dynamic_addr; /* mapped PT_DYNAMIC user address */ | |
| 48 | + unsigned long load_addr; /* user address at which to map binary */ | |
| 49 | + unsigned long flags; | |
| 50 | +#define ELF_FDPIC_FLAG_ARRANGEMENT 0x0000000f /* PT_LOAD arrangement flags */ | |
| 51 | +#define ELF_FDPIC_FLAG_INDEPENDENT 0x00000000 /* PT_LOADs can be put anywhere */ | |
| 52 | +#define ELF_FDPIC_FLAG_HONOURVADDR 0x00000001 /* PT_LOAD.vaddr must be honoured */ | |
| 53 | +#define ELF_FDPIC_FLAG_CONSTDISP 0x00000002 /* PT_LOADs require constant | |
| 54 | + * displacement */ | |
| 55 | +#define ELF_FDPIC_FLAG_CONTIGUOUS 0x00000003 /* PT_LOADs should be contiguous */ | |
| 56 | +#define ELF_FDPIC_FLAG_EXEC_STACK 0x00000010 /* T if stack to be executable */ | |
| 57 | +#define ELF_FDPIC_FLAG_NOEXEC_STACK 0x00000020 /* T if stack not to be executable */ | |
| 58 | +#define ELF_FDPIC_FLAG_EXECUTABLE 0x00000040 /* T if this object is the executable */ | |
| 59 | +#define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */ | |
| 60 | +}; | |
| 61 | + | |
| 62 | +#ifdef CONFIG_MMU | |
| 63 | +extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params, | |
| 64 | + struct elf_fdpic_params *interp_params, | |
| 65 | + unsigned long *start_stack, | |
| 66 | + unsigned long *start_brk); | |
| 67 | +#endif | |
| 68 | +#endif /* __KERNEL__ */ | |
| 69 | + | |
| 70 | +#endif /* _LINUX_ELF_FDPIC_H */ | |
| @@ -0,0 +1,414 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_ELF_H | |
| 2 | +#define _UAPI_LINUX_ELF_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/elf-em.h> | |
| 6 | + | |
| 7 | +/* 32-bit ELF base types. */ | |
| 8 | +typedef __u32 Elf32_Addr; | |
| 9 | +typedef __u16 Elf32_Half; | |
| 10 | +typedef __u32 Elf32_Off; | |
| 11 | +typedef __s32 Elf32_Sword; | |
| 12 | +typedef __u32 Elf32_Word; | |
| 13 | + | |
| 14 | +/* 64-bit ELF base types. */ | |
| 15 | +typedef __u64 Elf64_Addr; | |
| 16 | +typedef __u16 Elf64_Half; | |
| 17 | +typedef __s16 Elf64_SHalf; | |
| 18 | +typedef __u64 Elf64_Off; | |
| 19 | +typedef __s32 Elf64_Sword; | |
| 20 | +typedef __u32 Elf64_Word; | |
| 21 | +typedef __u64 Elf64_Xword; | |
| 22 | +typedef __s64 Elf64_Sxword; | |
| 23 | + | |
| 24 | +/* These constants are for the segment types stored in the image headers */ | |
| 25 | +#define PT_NULL 0 | |
| 26 | +#define PT_LOAD 1 | |
| 27 | +#define PT_DYNAMIC 2 | |
| 28 | +#define PT_INTERP 3 | |
| 29 | +#define PT_NOTE 4 | |
| 30 | +#define PT_SHLIB 5 | |
| 31 | +#define PT_PHDR 6 | |
| 32 | +#define PT_TLS 7 /* Thread local storage segment */ | |
| 33 | +#define PT_LOOS 0x60000000 /* OS-specific */ | |
| 34 | +#define PT_HIOS 0x6fffffff /* OS-specific */ | |
| 35 | +#define PT_LOPROC 0x70000000 | |
| 36 | +#define PT_HIPROC 0x7fffffff | |
| 37 | +#define PT_GNU_EH_FRAME 0x6474e550 | |
| 38 | + | |
| 39 | +#define PT_GNU_STACK (PT_LOOS + 0x474e551) | |
| 40 | + | |
| 41 | +/* | |
| 42 | + * Extended Numbering | |
| 43 | + * | |
| 44 | + * If the real number of program header table entries is larger than | |
| 45 | + * or equal to PN_XNUM(0xffff), it is set to sh_info field of the | |
| 46 | + * section header at index 0, and PN_XNUM is set to e_phnum | |
| 47 | + * field. Otherwise, the section header at index 0 is zero | |
| 48 | + * initialized, if it exists. | |
| 49 | + * | |
| 50 | + * Specifications are available in: | |
| 51 | + * | |
| 52 | + * - Sun microsystems: Linker and Libraries. | |
| 53 | + * Part No: 817-1984-17, September 2008. | |
| 54 | + * URL: http://docs.sun.com/app/docs/doc/817-1984 | |
| 55 | + * | |
| 56 | + * - System V ABI AMD64 Architecture Processor Supplement | |
| 57 | + * Draft Version 0.99., | |
| 58 | + * May 11, 2009. | |
| 59 | + * URL: http://www.x86-64.org/ | |
| 60 | + */ | |
| 61 | +#define PN_XNUM 0xffff | |
| 62 | + | |
| 63 | +/* These constants define the different elf file types */ | |
| 64 | +#define ET_NONE 0 | |
| 65 | +#define ET_REL 1 | |
| 66 | +#define ET_EXEC 2 | |
| 67 | +#define ET_DYN 3 | |
| 68 | +#define ET_CORE 4 | |
| 69 | +#define ET_LOPROC 0xff00 | |
| 70 | +#define ET_HIPROC 0xffff | |
| 71 | + | |
| 72 | +/* This is the info that is needed to parse the dynamic section of the file */ | |
| 73 | +#define DT_NULL 0 | |
| 74 | +#define DT_NEEDED 1 | |
| 75 | +#define DT_PLTRELSZ 2 | |
| 76 | +#define DT_PLTGOT 3 | |
| 77 | +#define DT_HASH 4 | |
| 78 | +#define DT_STRTAB 5 | |
| 79 | +#define DT_SYMTAB 6 | |
| 80 | +#define DT_RELA 7 | |
| 81 | +#define DT_RELASZ 8 | |
| 82 | +#define DT_RELAENT 9 | |
| 83 | +#define DT_STRSZ 10 | |
| 84 | +#define DT_SYMENT 11 | |
| 85 | +#define DT_INIT 12 | |
| 86 | +#define DT_FINI 13 | |
| 87 | +#define DT_SONAME 14 | |
| 88 | +#define DT_RPATH 15 | |
| 89 | +#define DT_SYMBOLIC 16 | |
| 90 | +#define DT_REL 17 | |
| 91 | +#define DT_RELSZ 18 | |
| 92 | +#define DT_RELENT 19 | |
| 93 | +#define DT_PLTREL 20 | |
| 94 | +#define DT_DEBUG 21 | |
| 95 | +#define DT_TEXTREL 22 | |
| 96 | +#define DT_JMPREL 23 | |
| 97 | +#define DT_ENCODING 32 | |
| 98 | +#define OLD_DT_LOOS 0x60000000 | |
| 99 | +#define DT_LOOS 0x6000000d | |
| 100 | +#define DT_HIOS 0x6ffff000 | |
| 101 | +#define DT_VALRNGLO 0x6ffffd00 | |
| 102 | +#define DT_VALRNGHI 0x6ffffdff | |
| 103 | +#define DT_ADDRRNGLO 0x6ffffe00 | |
| 104 | +#define DT_ADDRRNGHI 0x6ffffeff | |
| 105 | +#define DT_VERSYM 0x6ffffff0 | |
| 106 | +#define DT_RELACOUNT 0x6ffffff9 | |
| 107 | +#define DT_RELCOUNT 0x6ffffffa | |
| 108 | +#define DT_FLAGS_1 0x6ffffffb | |
| 109 | +#define DT_VERDEF 0x6ffffffc | |
| 110 | +#define DT_VERDEFNUM 0x6ffffffd | |
| 111 | +#define DT_VERNEED 0x6ffffffe | |
| 112 | +#define DT_VERNEEDNUM 0x6fffffff | |
| 113 | +#define OLD_DT_HIOS 0x6fffffff | |
| 114 | +#define DT_LOPROC 0x70000000 | |
| 115 | +#define DT_HIPROC 0x7fffffff | |
| 116 | + | |
| 117 | +/* This info is needed when parsing the symbol table */ | |
| 118 | +#define STB_LOCAL 0 | |
| 119 | +#define STB_GLOBAL 1 | |
| 120 | +#define STB_WEAK 2 | |
| 121 | + | |
| 122 | +#define STT_NOTYPE 0 | |
| 123 | +#define STT_OBJECT 1 | |
| 124 | +#define STT_FUNC 2 | |
| 125 | +#define STT_SECTION 3 | |
| 126 | +#define STT_FILE 4 | |
| 127 | +#define STT_COMMON 5 | |
| 128 | +#define STT_TLS 6 | |
| 129 | + | |
| 130 | +#define ELF_ST_BIND(x) ((x) >> 4) | |
| 131 | +#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) | |
| 132 | +#define ELF32_ST_BIND(x) ELF_ST_BIND(x) | |
| 133 | +#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) | |
| 134 | +#define ELF64_ST_BIND(x) ELF_ST_BIND(x) | |
| 135 | +#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) | |
| 136 | + | |
| 137 | +typedef struct dynamic{ | |
| 138 | + Elf32_Sword d_tag; | |
| 139 | + union{ | |
| 140 | + Elf32_Sword d_val; | |
| 141 | + Elf32_Addr d_ptr; | |
| 142 | + } d_un; | |
| 143 | +} Elf32_Dyn; | |
| 144 | + | |
| 145 | +typedef struct { | |
| 146 | + Elf64_Sxword d_tag; /* entry tag value */ | |
| 147 | + union { | |
| 148 | + Elf64_Xword d_val; | |
| 149 | + Elf64_Addr d_ptr; | |
| 150 | + } d_un; | |
| 151 | +} Elf64_Dyn; | |
| 152 | + | |
| 153 | +/* The following are used with relocations */ | |
| 154 | +#define ELF32_R_SYM(x) ((x) >> 8) | |
| 155 | +#define ELF32_R_TYPE(x) ((x) & 0xff) | |
| 156 | + | |
| 157 | +#define ELF64_R_SYM(i) ((i) >> 32) | |
| 158 | +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) | |
| 159 | + | |
| 160 | +typedef struct elf32_rel { | |
| 161 | + Elf32_Addr r_offset; | |
| 162 | + Elf32_Word r_info; | |
| 163 | +} Elf32_Rel; | |
| 164 | + | |
| 165 | +typedef struct elf64_rel { | |
| 166 | + Elf64_Addr r_offset; /* Location at which to apply the action */ | |
| 167 | + Elf64_Xword r_info; /* index and type of relocation */ | |
| 168 | +} Elf64_Rel; | |
| 169 | + | |
| 170 | +typedef struct elf32_rela{ | |
| 171 | + Elf32_Addr r_offset; | |
| 172 | + Elf32_Word r_info; | |
| 173 | + Elf32_Sword r_addend; | |
| 174 | +} Elf32_Rela; | |
| 175 | + | |
| 176 | +typedef struct elf64_rela { | |
| 177 | + Elf64_Addr r_offset; /* Location at which to apply the action */ | |
| 178 | + Elf64_Xword r_info; /* index and type of relocation */ | |
| 179 | + Elf64_Sxword r_addend; /* Constant addend used to compute value */ | |
| 180 | +} Elf64_Rela; | |
| 181 | + | |
| 182 | +typedef struct elf32_sym{ | |
| 183 | + Elf32_Word st_name; | |
| 184 | + Elf32_Addr st_value; | |
| 185 | + Elf32_Word st_size; | |
| 186 | + unsigned char st_info; | |
| 187 | + unsigned char st_other; | |
| 188 | + Elf32_Half st_shndx; | |
| 189 | +} Elf32_Sym; | |
| 190 | + | |
| 191 | +typedef struct elf64_sym { | |
| 192 | + Elf64_Word st_name; /* Symbol name, index in string tbl */ | |
| 193 | + unsigned char st_info; /* Type and binding attributes */ | |
| 194 | + unsigned char st_other; /* No defined meaning, 0 */ | |
| 195 | + Elf64_Half st_shndx; /* Associated section index */ | |
| 196 | + Elf64_Addr st_value; /* Value of the symbol */ | |
| 197 | + Elf64_Xword st_size; /* Associated symbol size */ | |
| 198 | +} Elf64_Sym; | |
| 199 | + | |
| 200 | + | |
| 201 | +#define EI_NIDENT 16 | |
| 202 | + | |
| 203 | +typedef struct elf32_hdr{ | |
| 204 | + unsigned char e_ident[EI_NIDENT]; | |
| 205 | + Elf32_Half e_type; | |
| 206 | + Elf32_Half e_machine; | |
| 207 | + Elf32_Word e_version; | |
| 208 | + Elf32_Addr e_entry; /* Entry point */ | |
| 209 | + Elf32_Off e_phoff; | |
| 210 | + Elf32_Off e_shoff; | |
| 211 | + Elf32_Word e_flags; | |
| 212 | + Elf32_Half e_ehsize; | |
| 213 | + Elf32_Half e_phentsize; | |
| 214 | + Elf32_Half e_phnum; | |
| 215 | + Elf32_Half e_shentsize; | |
| 216 | + Elf32_Half e_shnum; | |
| 217 | + Elf32_Half e_shstrndx; | |
| 218 | +} Elf32_Ehdr; | |
| 219 | + | |
| 220 | +typedef struct elf64_hdr { | |
| 221 | + unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ | |
| 222 | + Elf64_Half e_type; | |
| 223 | + Elf64_Half e_machine; | |
| 224 | + Elf64_Word e_version; | |
| 225 | + Elf64_Addr e_entry; /* Entry point virtual address */ | |
| 226 | + Elf64_Off e_phoff; /* Program header table file offset */ | |
| 227 | + Elf64_Off e_shoff; /* Section header table file offset */ | |
| 228 | + Elf64_Word e_flags; | |
| 229 | + Elf64_Half e_ehsize; | |
| 230 | + Elf64_Half e_phentsize; | |
| 231 | + Elf64_Half e_phnum; | |
| 232 | + Elf64_Half e_shentsize; | |
| 233 | + Elf64_Half e_shnum; | |
| 234 | + Elf64_Half e_shstrndx; | |
| 235 | +} Elf64_Ehdr; | |
| 236 | + | |
| 237 | +/* These constants define the permissions on sections in the program | |
| 238 | + header, p_flags. */ | |
| 239 | +#define PF_R 0x4 | |
| 240 | +#define PF_W 0x2 | |
| 241 | +#define PF_X 0x1 | |
| 242 | + | |
| 243 | +typedef struct elf32_phdr{ | |
| 244 | + Elf32_Word p_type; | |
| 245 | + Elf32_Off p_offset; | |
| 246 | + Elf32_Addr p_vaddr; | |
| 247 | + Elf32_Addr p_paddr; | |
| 248 | + Elf32_Word p_filesz; | |
| 249 | + Elf32_Word p_memsz; | |
| 250 | + Elf32_Word p_flags; | |
| 251 | + Elf32_Word p_align; | |
| 252 | +} Elf32_Phdr; | |
| 253 | + | |
| 254 | +typedef struct elf64_phdr { | |
| 255 | + Elf64_Word p_type; | |
| 256 | + Elf64_Word p_flags; | |
| 257 | + Elf64_Off p_offset; /* Segment file offset */ | |
| 258 | + Elf64_Addr p_vaddr; /* Segment virtual address */ | |
| 259 | + Elf64_Addr p_paddr; /* Segment physical address */ | |
| 260 | + Elf64_Xword p_filesz; /* Segment size in file */ | |
| 261 | + Elf64_Xword p_memsz; /* Segment size in memory */ | |
| 262 | + Elf64_Xword p_align; /* Segment alignment, file & memory */ | |
| 263 | +} Elf64_Phdr; | |
| 264 | + | |
| 265 | +/* sh_type */ | |
| 266 | +#define SHT_NULL 0 | |
| 267 | +#define SHT_PROGBITS 1 | |
| 268 | +#define SHT_SYMTAB 2 | |
| 269 | +#define SHT_STRTAB 3 | |
| 270 | +#define SHT_RELA 4 | |
| 271 | +#define SHT_HASH 5 | |
| 272 | +#define SHT_DYNAMIC 6 | |
| 273 | +#define SHT_NOTE 7 | |
| 274 | +#define SHT_NOBITS 8 | |
| 275 | +#define SHT_REL 9 | |
| 276 | +#define SHT_SHLIB 10 | |
| 277 | +#define SHT_DYNSYM 11 | |
| 278 | +#define SHT_NUM 12 | |
| 279 | +#define SHT_LOPROC 0x70000000 | |
| 280 | +#define SHT_HIPROC 0x7fffffff | |
| 281 | +#define SHT_LOUSER 0x80000000 | |
| 282 | +#define SHT_HIUSER 0xffffffff | |
| 283 | + | |
| 284 | +/* sh_flags */ | |
| 285 | +#define SHF_WRITE 0x1 | |
| 286 | +#define SHF_ALLOC 0x2 | |
| 287 | +#define SHF_EXECINSTR 0x4 | |
| 288 | +#define SHF_MASKPROC 0xf0000000 | |
| 289 | + | |
| 290 | +/* special section indexes */ | |
| 291 | +#define SHN_UNDEF 0 | |
| 292 | +#define SHN_LORESERVE 0xff00 | |
| 293 | +#define SHN_LOPROC 0xff00 | |
| 294 | +#define SHN_HIPROC 0xff1f | |
| 295 | +#define SHN_ABS 0xfff1 | |
| 296 | +#define SHN_COMMON 0xfff2 | |
| 297 | +#define SHN_HIRESERVE 0xffff | |
| 298 | + | |
| 299 | +typedef struct elf32_shdr { | |
| 300 | + Elf32_Word sh_name; | |
| 301 | + Elf32_Word sh_type; | |
| 302 | + Elf32_Word sh_flags; | |
| 303 | + Elf32_Addr sh_addr; | |
| 304 | + Elf32_Off sh_offset; | |
| 305 | + Elf32_Word sh_size; | |
| 306 | + Elf32_Word sh_link; | |
| 307 | + Elf32_Word sh_info; | |
| 308 | + Elf32_Word sh_addralign; | |
| 309 | + Elf32_Word sh_entsize; | |
| 310 | +} Elf32_Shdr; | |
| 311 | + | |
| 312 | +typedef struct elf64_shdr { | |
| 313 | + Elf64_Word sh_name; /* Section name, index in string tbl */ | |
| 314 | + Elf64_Word sh_type; /* Type of section */ | |
| 315 | + Elf64_Xword sh_flags; /* Miscellaneous section attributes */ | |
| 316 | + Elf64_Addr sh_addr; /* Section virtual addr at execution */ | |
| 317 | + Elf64_Off sh_offset; /* Section file offset */ | |
| 318 | + Elf64_Xword sh_size; /* Size of section in bytes */ | |
| 319 | + Elf64_Word sh_link; /* Index of another section */ | |
| 320 | + Elf64_Word sh_info; /* Additional section information */ | |
| 321 | + Elf64_Xword sh_addralign; /* Section alignment */ | |
| 322 | + Elf64_Xword sh_entsize; /* Entry size if section holds table */ | |
| 323 | +} Elf64_Shdr; | |
| 324 | + | |
| 325 | +#define EI_MAG0 0 /* e_ident[] indexes */ | |
| 326 | +#define EI_MAG1 1 | |
| 327 | +#define EI_MAG2 2 | |
| 328 | +#define EI_MAG3 3 | |
| 329 | +#define EI_CLASS 4 | |
| 330 | +#define EI_DATA 5 | |
| 331 | +#define EI_VERSION 6 | |
| 332 | +#define EI_OSABI 7 | |
| 333 | +#define EI_PAD 8 | |
| 334 | + | |
| 335 | +#define ELFMAG0 0x7f /* EI_MAG */ | |
| 336 | +#define ELFMAG1 'E' | |
| 337 | +#define ELFMAG2 'L' | |
| 338 | +#define ELFMAG3 'F' | |
| 339 | +#define ELFMAG "\177ELF" | |
| 340 | +#define SELFMAG 4 | |
| 341 | + | |
| 342 | +#define ELFCLASSNONE 0 /* EI_CLASS */ | |
| 343 | +#define ELFCLASS32 1 | |
| 344 | +#define ELFCLASS64 2 | |
| 345 | +#define ELFCLASSNUM 3 | |
| 346 | + | |
| 347 | +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ | |
| 348 | +#define ELFDATA2LSB 1 | |
| 349 | +#define ELFDATA2MSB 2 | |
| 350 | + | |
| 351 | +#define EV_NONE 0 /* e_version, EI_VERSION */ | |
| 352 | +#define EV_CURRENT 1 | |
| 353 | +#define EV_NUM 2 | |
| 354 | + | |
| 355 | +#define ELFOSABI_NONE 0 | |
| 356 | +#define ELFOSABI_LINUX 3 | |
| 357 | + | |
| 358 | +#ifndef ELF_OSABI | |
| 359 | +#define ELF_OSABI ELFOSABI_NONE | |
| 360 | +#endif | |
| 361 | + | |
| 362 | +/* | |
| 363 | + * Notes used in ET_CORE. Architectures export some of the arch register sets | |
| 364 | + * using the corresponding note types via the PTRACE_GETREGSET and | |
| 365 | + * PTRACE_SETREGSET requests. | |
| 366 | + */ | |
| 367 | +#define NT_PRSTATUS 1 | |
| 368 | +#define NT_PRFPREG 2 | |
| 369 | +#define NT_PRPSINFO 3 | |
| 370 | +#define NT_TASKSTRUCT 4 | |
| 371 | +#define NT_AUXV 6 | |
| 372 | +/* | |
| 373 | + * Note to userspace developers: size of NT_SIGINFO note may increase | |
| 374 | + * in the future to accomodate more fields, don't assume it is fixed! | |
| 375 | + */ | |
| 376 | +#define NT_SIGINFO 0x53494749 | |
| 377 | +#define NT_FILE 0x46494c45 | |
| 378 | +#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ | |
| 379 | +#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ | |
| 380 | +#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ | |
| 381 | +#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | |
| 382 | +#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | |
| 383 | +#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | |
| 384 | +#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ | |
| 385 | +#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ | |
| 386 | +#define NT_S390_TIMER 0x301 /* s390 timer register */ | |
| 387 | +#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ | |
| 388 | +#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ | |
| 389 | +#define NT_S390_CTRS 0x304 /* s390 control registers */ | |
| 390 | +#define NT_S390_PREFIX 0x305 /* s390 prefix register */ | |
| 391 | +#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ | |
| 392 | +#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ | |
| 393 | +#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ | |
| 394 | +#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ | |
| 395 | +#define NT_ARM_TLS 0x401 /* ARM TLS register */ | |
| 396 | +#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ | |
| 397 | +#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ | |
| 398 | + | |
| 399 | + | |
| 400 | +/* Note header in a PT_NOTE section */ | |
| 401 | +typedef struct elf32_note { | |
| 402 | + Elf32_Word n_namesz; /* Name size */ | |
| 403 | + Elf32_Word n_descsz; /* Content size */ | |
| 404 | + Elf32_Word n_type; /* Content type */ | |
| 405 | +} Elf32_Nhdr; | |
| 406 | + | |
| 407 | +/* Note header in a PT_NOTE section */ | |
| 408 | +typedef struct elf64_note { | |
| 409 | + Elf64_Word n_namesz; /* Name size */ | |
| 410 | + Elf64_Word n_descsz; /* Content size */ | |
| 411 | + Elf64_Word n_type; /* Content type */ | |
| 412 | +} Elf64_Nhdr; | |
| 413 | + | |
| 414 | +#endif /* _UAPI_LINUX_ELF_H */ | |
| @@ -0,0 +1,100 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_ELFCORE_H | |
| 2 | +#define _UAPI_LINUX_ELFCORE_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/signal.h> | |
| 6 | +#include <linux/time.h> | |
| 7 | +#include <linux/ptrace.h> | |
| 8 | +#include <linux/elf.h> | |
| 9 | +#include <linux/fs.h> | |
| 10 | + | |
| 11 | +struct elf_siginfo | |
| 12 | +{ | |
| 13 | + int si_signo; /* signal number */ | |
| 14 | + int si_code; /* extra code */ | |
| 15 | + int si_errno; /* errno */ | |
| 16 | +}; | |
| 17 | + | |
| 18 | + | |
| 19 | +#ifndef __KERNEL__ | |
| 20 | +typedef elf_greg_t greg_t; | |
| 21 | +typedef elf_gregset_t gregset_t; | |
| 22 | +typedef elf_fpregset_t fpregset_t; | |
| 23 | +typedef elf_fpxregset_t fpxregset_t; | |
| 24 | +#define NGREG ELF_NGREG | |
| 25 | +#endif | |
| 26 | + | |
| 27 | +/* | |
| 28 | + * Definitions to generate Intel SVR4-like core files. | |
| 29 | + * These mostly have the same names as the SVR4 types with "elf_" | |
| 30 | + * tacked on the front to prevent clashes with linux definitions, | |
| 31 | + * and the typedef forms have been avoided. This is mostly like | |
| 32 | + * the SVR4 structure, but more Linuxy, with things that Linux does | |
| 33 | + * not support and which gdb doesn't really use excluded. | |
| 34 | + * Fields present but not used are marked with "XXX". | |
| 35 | + */ | |
| 36 | +struct elf_prstatus | |
| 37 | +{ | |
| 38 | +#if 0 | |
| 39 | + long pr_flags; /* XXX Process flags */ | |
| 40 | + short pr_why; /* XXX Reason for process halt */ | |
| 41 | + short pr_what; /* XXX More detailed reason */ | |
| 42 | +#endif | |
| 43 | + struct elf_siginfo pr_info; /* Info associated with signal */ | |
| 44 | + short pr_cursig; /* Current signal */ | |
| 45 | + unsigned long pr_sigpend; /* Set of pending signals */ | |
| 46 | + unsigned long pr_sighold; /* Set of held signals */ | |
| 47 | +#if 0 | |
| 48 | + struct sigaltstack pr_altstack; /* Alternate stack info */ | |
| 49 | + struct sigaction pr_action; /* Signal action for current sig */ | |
| 50 | +#endif | |
| 51 | + pid_t pr_pid; | |
| 52 | + pid_t pr_ppid; | |
| 53 | + pid_t pr_pgrp; | |
| 54 | + pid_t pr_sid; | |
| 55 | + struct timeval pr_utime; /* User time */ | |
| 56 | + struct timeval pr_stime; /* System time */ | |
| 57 | + struct timeval pr_cutime; /* Cumulative user time */ | |
| 58 | + struct timeval pr_cstime; /* Cumulative system time */ | |
| 59 | +#if 0 | |
| 60 | + long pr_instr; /* Current instruction */ | |
| 61 | +#endif | |
| 62 | + elf_gregset_t pr_reg; /* GP registers */ | |
| 63 | +#ifdef CONFIG_BINFMT_ELF_FDPIC | |
| 64 | + /* When using FDPIC, the loadmap addresses need to be communicated | |
| 65 | + * to GDB in order for GDB to do the necessary relocations. The | |
| 66 | + * fields (below) used to communicate this information are placed | |
| 67 | + * immediately after ``pr_reg'', so that the loadmap addresses may | |
| 68 | + * be viewed as part of the register set if so desired. | |
| 69 | + */ | |
| 70 | + unsigned long pr_exec_fdpic_loadmap; | |
| 71 | + unsigned long pr_interp_fdpic_loadmap; | |
| 72 | +#endif | |
| 73 | + int pr_fpvalid; /* True if math co-processor being used. */ | |
| 74 | +}; | |
| 75 | + | |
| 76 | +#define ELF_PRARGSZ (80) /* Number of chars for args */ | |
| 77 | + | |
| 78 | +struct elf_prpsinfo | |
| 79 | +{ | |
| 80 | + char pr_state; /* numeric process state */ | |
| 81 | + char pr_sname; /* char for pr_state */ | |
| 82 | + char pr_zomb; /* zombie */ | |
| 83 | + char pr_nice; /* nice val */ | |
| 84 | + unsigned long pr_flag; /* flags */ | |
| 85 | + __kernel_uid_t pr_uid; | |
| 86 | + __kernel_gid_t pr_gid; | |
| 87 | + pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; | |
| 88 | + /* Lots missing */ | |
| 89 | + char pr_fname[16]; /* filename of executable */ | |
| 90 | + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ | |
| 91 | +}; | |
| 92 | + | |
| 93 | +#ifndef __KERNEL__ | |
| 94 | +typedef struct elf_prstatus prstatus_t; | |
| 95 | +typedef struct elf_prpsinfo prpsinfo_t; | |
| 96 | +#define PRARGSZ ELF_PRARGSZ | |
| 97 | +#endif | |
| 98 | + | |
| 99 | + | |
| 100 | +#endif /* _UAPI_LINUX_ELFCORE_H */ | |
| @@ -0,0 +1 @@ | ||
| 1 | +#include <asm/errno.h> | |
| @@ -0,0 +1,26 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_ERRQUEUE_H | |
| 2 | +#define _UAPI_LINUX_ERRQUEUE_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +struct sock_extended_err { | |
| 7 | + __u32 ee_errno; | |
| 8 | + __u8 ee_origin; | |
| 9 | + __u8 ee_type; | |
| 10 | + __u8 ee_code; | |
| 11 | + __u8 ee_pad; | |
| 12 | + __u32 ee_info; | |
| 13 | + __u32 ee_data; | |
| 14 | +}; | |
| 15 | + | |
| 16 | +#define SO_EE_ORIGIN_NONE 0 | |
| 17 | +#define SO_EE_ORIGIN_LOCAL 1 | |
| 18 | +#define SO_EE_ORIGIN_ICMP 2 | |
| 19 | +#define SO_EE_ORIGIN_ICMP6 3 | |
| 20 | +#define SO_EE_ORIGIN_TXSTATUS 4 | |
| 21 | +#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS | |
| 22 | + | |
| 23 | +#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) | |
| 24 | + | |
| 25 | + | |
| 26 | +#endif /* _UAPI_LINUX_ERRQUEUE_H */ | |
| @@ -0,0 +1,1085 @@ | ||
| 1 | +/* | |
| 2 | + * ethtool.h: Defines for Linux ethtool. | |
| 3 | + * | |
| 4 | + * Copyright (C) 1998 David S. Miller (davem@redhat.com) | |
| 5 | + * Copyright 2001 Jeff Garzik <jgarzik@pobox.com> | |
| 6 | + * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) | |
| 7 | + * Portions Copyright 2002 Intel (eli.kupermann@intel.com, | |
| 8 | + * christopher.leech@intel.com, | |
| 9 | + * scott.feldman@intel.com) | |
| 10 | + * Portions Copyright (C) Sun Microsystems 2008 | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#ifndef _UAPI_LINUX_ETHTOOL_H | |
| 14 | +#define _UAPI_LINUX_ETHTOOL_H | |
| 15 | + | |
| 16 | +#include <linux/types.h> | |
| 17 | +#include <linux/if_ether.h> | |
| 18 | + | |
| 19 | +/* This should work for both 32 and 64 bit userland. */ | |
| 20 | +struct ethtool_cmd { | |
| 21 | + __u32 cmd; | |
| 22 | + __u32 supported; /* Features this interface supports */ | |
| 23 | + __u32 advertising; /* Features this interface advertises */ | |
| 24 | + __u16 speed; /* The forced speed (lower bits) in | |
| 25 | + * Mbps. Please use | |
| 26 | + * ethtool_cmd_speed()/_set() to | |
| 27 | + * access it */ | |
| 28 | + __u8 duplex; /* Duplex, half or full */ | |
| 29 | + __u8 port; /* Which connector port */ | |
| 30 | + __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45). | |
| 31 | + * May be read-only or read-write | |
| 32 | + * depending on the driver. | |
| 33 | + */ | |
| 34 | + __u8 transceiver; /* Which transceiver to use */ | |
| 35 | + __u8 autoneg; /* Enable or disable autonegotiation */ | |
| 36 | + __u8 mdio_support; /* MDIO protocols supported. Read-only. | |
| 37 | + * Not set by all drivers. | |
| 38 | + */ | |
| 39 | + __u32 maxtxpkt; /* Tx pkts before generating tx int */ | |
| 40 | + __u32 maxrxpkt; /* Rx pkts before generating rx int */ | |
| 41 | + __u16 speed_hi; /* The forced speed (upper | |
| 42 | + * bits) in Mbps. Please use | |
| 43 | + * ethtool_cmd_speed()/_set() to | |
| 44 | + * access it */ | |
| 45 | + __u8 eth_tp_mdix; /* twisted pair MDI-X status */ | |
| 46 | + __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set, | |
| 47 | + * link should be renegotiated if necessary | |
| 48 | + */ | |
| 49 | + __u32 lp_advertising; /* Features the link partner advertises */ | |
| 50 | + __u32 reserved[2]; | |
| 51 | +}; | |
| 52 | + | |
| 53 | +static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, | |
| 54 | + __u32 speed) | |
| 55 | +{ | |
| 56 | + | |
| 57 | + ep->speed = (__u16)speed; | |
| 58 | + ep->speed_hi = (__u16)(speed >> 16); | |
| 59 | +} | |
| 60 | + | |
| 61 | +static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) | |
| 62 | +{ | |
| 63 | + return (ep->speed_hi << 16) | ep->speed; | |
| 64 | +} | |
| 65 | + | |
| 66 | +/* Device supports clause 22 register access to PHY or peripherals | |
| 67 | + * using the interface defined in <linux/mii.h>. This should not be | |
| 68 | + * set if there are known to be no such peripherals present or if | |
| 69 | + * the driver only emulates clause 22 registers for compatibility. | |
| 70 | + */ | |
| 71 | +#define ETH_MDIO_SUPPORTS_C22 1 | |
| 72 | + | |
| 73 | +/* Device supports clause 45 register access to PHY or peripherals | |
| 74 | + * using the interface defined in <linux/mii.h> and <linux/mdio.h>. | |
| 75 | + * This should not be set if there are known to be no such peripherals | |
| 76 | + * present. | |
| 77 | + */ | |
| 78 | +#define ETH_MDIO_SUPPORTS_C45 2 | |
| 79 | + | |
| 80 | +#define ETHTOOL_FWVERS_LEN 32 | |
| 81 | +#define ETHTOOL_BUSINFO_LEN 32 | |
| 82 | +/* these strings are set to whatever the driver author decides... */ | |
| 83 | +struct ethtool_drvinfo { | |
| 84 | + __u32 cmd; | |
| 85 | + char driver[32]; /* driver short name, "tulip", "eepro100" */ | |
| 86 | + char version[32]; /* driver version string */ | |
| 87 | + char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */ | |
| 88 | + char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ | |
| 89 | + /* For PCI devices, use pci_name(pci_dev). */ | |
| 90 | + char reserved1[32]; | |
| 91 | + char reserved2[12]; | |
| 92 | + /* | |
| 93 | + * Some struct members below are filled in | |
| 94 | + * using ops->get_sset_count(). Obtaining | |
| 95 | + * this info from ethtool_drvinfo is now | |
| 96 | + * deprecated; Use ETHTOOL_GSSET_INFO | |
| 97 | + * instead. | |
| 98 | + */ | |
| 99 | + __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ | |
| 100 | + __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ | |
| 101 | + __u32 testinfo_len; | |
| 102 | + __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ | |
| 103 | + __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ | |
| 104 | +}; | |
| 105 | + | |
| 106 | +#define SOPASS_MAX 6 | |
| 107 | +/* wake-on-lan settings */ | |
| 108 | +struct ethtool_wolinfo { | |
| 109 | + __u32 cmd; | |
| 110 | + __u32 supported; | |
| 111 | + __u32 wolopts; | |
| 112 | + __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ | |
| 113 | +}; | |
| 114 | + | |
| 115 | +/* for passing single values */ | |
| 116 | +struct ethtool_value { | |
| 117 | + __u32 cmd; | |
| 118 | + __u32 data; | |
| 119 | +}; | |
| 120 | + | |
| 121 | +/* for passing big chunks of data */ | |
| 122 | +struct ethtool_regs { | |
| 123 | + __u32 cmd; | |
| 124 | + __u32 version; /* driver-specific, indicates different chips/revs */ | |
| 125 | + __u32 len; /* bytes */ | |
| 126 | + __u8 data[0]; | |
| 127 | +}; | |
| 128 | + | |
| 129 | +/* for passing EEPROM chunks */ | |
| 130 | +struct ethtool_eeprom { | |
| 131 | + __u32 cmd; | |
| 132 | + __u32 magic; | |
| 133 | + __u32 offset; /* in bytes */ | |
| 134 | + __u32 len; /* in bytes */ | |
| 135 | + __u8 data[0]; | |
| 136 | +}; | |
| 137 | + | |
| 138 | +/** | |
| 139 | + * struct ethtool_eee - Energy Efficient Ethernet information | |
| 140 | + * @cmd: ETHTOOL_{G,S}EEE | |
| 141 | + * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations | |
| 142 | + * for which there is EEE support. | |
| 143 | + * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations | |
| 144 | + * advertised as eee capable. | |
| 145 | + * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex | |
| 146 | + * combinations advertised by the link partner as eee capable. | |
| 147 | + * @eee_active: Result of the eee auto negotiation. | |
| 148 | + * @eee_enabled: EEE configured mode (enabled/disabled). | |
| 149 | + * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given | |
| 150 | + * that eee was negotiated. | |
| 151 | + * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting | |
| 152 | + * its tx lpi (after reaching 'idle' state). Effective only when eee | |
| 153 | + * was negotiated and tx_lpi_enabled was set. | |
| 154 | + */ | |
| 155 | +struct ethtool_eee { | |
| 156 | + __u32 cmd; | |
| 157 | + __u32 supported; | |
| 158 | + __u32 advertised; | |
| 159 | + __u32 lp_advertised; | |
| 160 | + __u32 eee_active; | |
| 161 | + __u32 eee_enabled; | |
| 162 | + __u32 tx_lpi_enabled; | |
| 163 | + __u32 tx_lpi_timer; | |
| 164 | + __u32 reserved[2]; | |
| 165 | +}; | |
| 166 | + | |
| 167 | +/** | |
| 168 | + * struct ethtool_modinfo - plugin module eeprom information | |
| 169 | + * @cmd: %ETHTOOL_GMODULEINFO | |
| 170 | + * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx | |
| 171 | + * @eeprom_len: Length of the eeprom | |
| 172 | + * | |
| 173 | + * This structure is used to return the information to | |
| 174 | + * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. | |
| 175 | + * The type code indicates the eeprom data format | |
| 176 | + */ | |
| 177 | +struct ethtool_modinfo { | |
| 178 | + __u32 cmd; | |
| 179 | + __u32 type; | |
| 180 | + __u32 eeprom_len; | |
| 181 | + __u32 reserved[8]; | |
| 182 | +}; | |
| 183 | + | |
| 184 | +/** | |
| 185 | + * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates | |
| 186 | + * @cmd: ETHTOOL_{G,S}COALESCE | |
| 187 | + * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after | |
| 188 | + * a packet arrives. | |
| 189 | + * @rx_max_coalesced_frames: Maximum number of packets to receive | |
| 190 | + * before an RX interrupt. | |
| 191 | + * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that | |
| 192 | + * this value applies while an IRQ is being serviced by the host. | |
| 193 | + * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, | |
| 194 | + * except that this value applies while an IRQ is being serviced | |
| 195 | + * by the host. | |
| 196 | + * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after | |
| 197 | + * a packet is sent. | |
| 198 | + * @tx_max_coalesced_frames: Maximum number of packets to be sent | |
| 199 | + * before a TX interrupt. | |
| 200 | + * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that | |
| 201 | + * this value applies while an IRQ is being serviced by the host. | |
| 202 | + * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, | |
| 203 | + * except that this value applies while an IRQ is being serviced | |
| 204 | + * by the host. | |
| 205 | + * @stats_block_coalesce_usecs: How many usecs to delay in-memory | |
| 206 | + * statistics block updates. Some drivers do not have an | |
| 207 | + * in-memory statistic block, and in such cases this value is | |
| 208 | + * ignored. This value must not be zero. | |
| 209 | + * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. | |
| 210 | + * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. | |
| 211 | + * @pkt_rate_low: Threshold for low packet rate (packets per second). | |
| 212 | + * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after | |
| 213 | + * a packet arrives, when the packet rate is below @pkt_rate_low. | |
| 214 | + * @rx_max_coalesced_frames_low: Maximum number of packets to be received | |
| 215 | + * before an RX interrupt, when the packet rate is below @pkt_rate_low. | |
| 216 | + * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after | |
| 217 | + * a packet is sent, when the packet rate is below @pkt_rate_low. | |
| 218 | + * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before | |
| 219 | + * a TX interrupt, when the packet rate is below @pkt_rate_low. | |
| 220 | + * @pkt_rate_high: Threshold for high packet rate (packets per second). | |
| 221 | + * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after | |
| 222 | + * a packet arrives, when the packet rate is above @pkt_rate_high. | |
| 223 | + * @rx_max_coalesced_frames_high: Maximum number of packets to be received | |
| 224 | + * before an RX interrupt, when the packet rate is above @pkt_rate_high. | |
| 225 | + * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after | |
| 226 | + * a packet is sent, when the packet rate is above @pkt_rate_high. | |
| 227 | + * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before | |
| 228 | + * a TX interrupt, when the packet rate is above @pkt_rate_high. | |
| 229 | + * @rate_sample_interval: How often to do adaptive coalescing packet rate | |
| 230 | + * sampling, measured in seconds. Must not be zero. | |
| 231 | + * | |
| 232 | + * Each pair of (usecs, max_frames) fields specifies this exit | |
| 233 | + * condition for interrupt coalescing: | |
| 234 | + * (usecs > 0 && time_since_first_completion >= usecs) || | |
| 235 | + * (max_frames > 0 && completed_frames >= max_frames) | |
| 236 | + * It is illegal to set both usecs and max_frames to zero as this | |
| 237 | + * would cause interrupts to never be generated. To disable | |
| 238 | + * coalescing, set usecs = 0 and max_frames = 1. | |
| 239 | + * | |
| 240 | + * Some implementations ignore the value of max_frames and use the | |
| 241 | + * condition: | |
| 242 | + * time_since_first_completion >= usecs | |
| 243 | + * This is deprecated. Drivers for hardware that does not support | |
| 244 | + * counting completions should validate that max_frames == !rx_usecs. | |
| 245 | + * | |
| 246 | + * Adaptive RX/TX coalescing is an algorithm implemented by some | |
| 247 | + * drivers to improve latency under low packet rates and improve | |
| 248 | + * throughput under high packet rates. Some drivers only implement | |
| 249 | + * one of RX or TX adaptive coalescing. Anything not implemented by | |
| 250 | + * the driver causes these values to be silently ignored. | |
| 251 | + * | |
| 252 | + * When the packet rate is below @pkt_rate_high but above | |
| 253 | + * @pkt_rate_low (both measured in packets per second) the | |
| 254 | + * normal {rx,tx}_* coalescing parameters are used. | |
| 255 | + */ | |
| 256 | +struct ethtool_coalesce { | |
| 257 | + __u32 cmd; | |
| 258 | + __u32 rx_coalesce_usecs; | |
| 259 | + __u32 rx_max_coalesced_frames; | |
| 260 | + __u32 rx_coalesce_usecs_irq; | |
| 261 | + __u32 rx_max_coalesced_frames_irq; | |
| 262 | + __u32 tx_coalesce_usecs; | |
| 263 | + __u32 tx_max_coalesced_frames; | |
| 264 | + __u32 tx_coalesce_usecs_irq; | |
| 265 | + __u32 tx_max_coalesced_frames_irq; | |
| 266 | + __u32 stats_block_coalesce_usecs; | |
| 267 | + __u32 use_adaptive_rx_coalesce; | |
| 268 | + __u32 use_adaptive_tx_coalesce; | |
| 269 | + __u32 pkt_rate_low; | |
| 270 | + __u32 rx_coalesce_usecs_low; | |
| 271 | + __u32 rx_max_coalesced_frames_low; | |
| 272 | + __u32 tx_coalesce_usecs_low; | |
| 273 | + __u32 tx_max_coalesced_frames_low; | |
| 274 | + __u32 pkt_rate_high; | |
| 275 | + __u32 rx_coalesce_usecs_high; | |
| 276 | + __u32 rx_max_coalesced_frames_high; | |
| 277 | + __u32 tx_coalesce_usecs_high; | |
| 278 | + __u32 tx_max_coalesced_frames_high; | |
| 279 | + __u32 rate_sample_interval; | |
| 280 | +}; | |
| 281 | + | |
| 282 | +/* for configuring RX/TX ring parameters */ | |
| 283 | +struct ethtool_ringparam { | |
| 284 | + __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ | |
| 285 | + | |
| 286 | + /* Read only attributes. These indicate the maximum number | |
| 287 | + * of pending RX/TX ring entries the driver will allow the | |
| 288 | + * user to set. | |
| 289 | + */ | |
| 290 | + __u32 rx_max_pending; | |
| 291 | + __u32 rx_mini_max_pending; | |
| 292 | + __u32 rx_jumbo_max_pending; | |
| 293 | + __u32 tx_max_pending; | |
| 294 | + | |
| 295 | + /* Values changeable by the user. The valid values are | |
| 296 | + * in the range 1 to the "*_max_pending" counterpart above. | |
| 297 | + */ | |
| 298 | + __u32 rx_pending; | |
| 299 | + __u32 rx_mini_pending; | |
| 300 | + __u32 rx_jumbo_pending; | |
| 301 | + __u32 tx_pending; | |
| 302 | +}; | |
| 303 | + | |
| 304 | +/** | |
| 305 | + * struct ethtool_channels - configuring number of network channel | |
| 306 | + * @cmd: ETHTOOL_{G,S}CHANNELS | |
| 307 | + * @max_rx: Read only. Maximum number of receive channel the driver support. | |
| 308 | + * @max_tx: Read only. Maximum number of transmit channel the driver support. | |
| 309 | + * @max_other: Read only. Maximum number of other channel the driver support. | |
| 310 | + * @max_combined: Read only. Maximum number of combined channel the driver | |
| 311 | + * support. Set of queues RX, TX or other. | |
| 312 | + * @rx_count: Valid values are in the range 1 to the max_rx. | |
| 313 | + * @tx_count: Valid values are in the range 1 to the max_tx. | |
| 314 | + * @other_count: Valid values are in the range 1 to the max_other. | |
| 315 | + * @combined_count: Valid values are in the range 1 to the max_combined. | |
| 316 | + * | |
| 317 | + * This can be used to configure RX, TX and other channels. | |
| 318 | + */ | |
| 319 | + | |
| 320 | +struct ethtool_channels { | |
| 321 | + __u32 cmd; | |
| 322 | + __u32 max_rx; | |
| 323 | + __u32 max_tx; | |
| 324 | + __u32 max_other; | |
| 325 | + __u32 max_combined; | |
| 326 | + __u32 rx_count; | |
| 327 | + __u32 tx_count; | |
| 328 | + __u32 other_count; | |
| 329 | + __u32 combined_count; | |
| 330 | +}; | |
| 331 | + | |
| 332 | +/* for configuring link flow control parameters */ | |
| 333 | +struct ethtool_pauseparam { | |
| 334 | + __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ | |
| 335 | + | |
| 336 | + /* If the link is being auto-negotiated (via ethtool_cmd.autoneg | |
| 337 | + * being true) the user may set 'autoneg' here non-zero to have the | |
| 338 | + * pause parameters be auto-negotiated too. In such a case, the | |
| 339 | + * {rx,tx}_pause values below determine what capabilities are | |
| 340 | + * advertised. | |
| 341 | + * | |
| 342 | + * If 'autoneg' is zero or the link is not being auto-negotiated, | |
| 343 | + * then {rx,tx}_pause force the driver to use/not-use pause | |
| 344 | + * flow control. | |
| 345 | + */ | |
| 346 | + __u32 autoneg; | |
| 347 | + __u32 rx_pause; | |
| 348 | + __u32 tx_pause; | |
| 349 | +}; | |
| 350 | + | |
| 351 | +#define ETH_GSTRING_LEN 32 | |
| 352 | +enum ethtool_stringset { | |
| 353 | + ETH_SS_TEST = 0, | |
| 354 | + ETH_SS_STATS, | |
| 355 | + ETH_SS_PRIV_FLAGS, | |
| 356 | + ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */ | |
| 357 | + ETH_SS_FEATURES, | |
| 358 | +}; | |
| 359 | + | |
| 360 | +/* for passing string sets for data tagging */ | |
| 361 | +struct ethtool_gstrings { | |
| 362 | + __u32 cmd; /* ETHTOOL_GSTRINGS */ | |
| 363 | + __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ | |
| 364 | + __u32 len; /* number of strings in the string set */ | |
| 365 | + __u8 data[0]; | |
| 366 | +}; | |
| 367 | + | |
| 368 | +struct ethtool_sset_info { | |
| 369 | + __u32 cmd; /* ETHTOOL_GSSET_INFO */ | |
| 370 | + __u32 reserved; | |
| 371 | + __u64 sset_mask; /* input: each bit selects an sset to query */ | |
| 372 | + /* output: each bit a returned sset */ | |
| 373 | + __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits | |
| 374 | + in sset_mask. One bit implies one | |
| 375 | + __u32, two bits implies two | |
| 376 | + __u32's, etc. */ | |
| 377 | +}; | |
| 378 | + | |
| 379 | +/** | |
| 380 | + * enum ethtool_test_flags - flags definition of ethtool_test | |
| 381 | + * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise | |
| 382 | + * only online tests. | |
| 383 | + * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. | |
| 384 | + * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback | |
| 385 | + * test. | |
| 386 | + * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test | |
| 387 | + */ | |
| 388 | + | |
| 389 | +enum ethtool_test_flags { | |
| 390 | + ETH_TEST_FL_OFFLINE = (1 << 0), | |
| 391 | + ETH_TEST_FL_FAILED = (1 << 1), | |
| 392 | + ETH_TEST_FL_EXTERNAL_LB = (1 << 2), | |
| 393 | + ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), | |
| 394 | +}; | |
| 395 | + | |
| 396 | +/* for requesting NIC test and getting results*/ | |
| 397 | +struct ethtool_test { | |
| 398 | + __u32 cmd; /* ETHTOOL_TEST */ | |
| 399 | + __u32 flags; /* ETH_TEST_FL_xxx */ | |
| 400 | + __u32 reserved; | |
| 401 | + __u32 len; /* result length, in number of u64 elements */ | |
| 402 | + __u64 data[0]; | |
| 403 | +}; | |
| 404 | + | |
| 405 | +/* for dumping NIC-specific statistics */ | |
| 406 | +struct ethtool_stats { | |
| 407 | + __u32 cmd; /* ETHTOOL_GSTATS */ | |
| 408 | + __u32 n_stats; /* number of u64's being returned */ | |
| 409 | + __u64 data[0]; | |
| 410 | +}; | |
| 411 | + | |
| 412 | +struct ethtool_perm_addr { | |
| 413 | + __u32 cmd; /* ETHTOOL_GPERMADDR */ | |
| 414 | + __u32 size; | |
| 415 | + __u8 data[0]; | |
| 416 | +}; | |
| 417 | + | |
| 418 | +/* boolean flags controlling per-interface behavior characteristics. | |
| 419 | + * When reading, the flag indicates whether or not a certain behavior | |
| 420 | + * is enabled/present. When writing, the flag indicates whether | |
| 421 | + * or not the driver should turn on (set) or off (clear) a behavior. | |
| 422 | + * | |
| 423 | + * Some behaviors may read-only (unconditionally absent or present). | |
| 424 | + * If such is the case, return EINVAL in the set-flags operation if the | |
| 425 | + * flag differs from the read-only value. | |
| 426 | + */ | |
| 427 | +enum ethtool_flags { | |
| 428 | + ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ | |
| 429 | + ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ | |
| 430 | + ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ | |
| 431 | + ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ | |
| 432 | + ETH_FLAG_RXHASH = (1 << 28), | |
| 433 | +}; | |
| 434 | + | |
| 435 | +/* The following structures are for supporting RX network flow | |
| 436 | + * classification and RX n-tuple configuration. Note, all multibyte | |
| 437 | + * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to | |
| 438 | + * be in network byte order. | |
| 439 | + */ | |
| 440 | + | |
| 441 | +/** | |
| 442 | + * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. | |
| 443 | + * @ip4src: Source host | |
| 444 | + * @ip4dst: Destination host | |
| 445 | + * @psrc: Source port | |
| 446 | + * @pdst: Destination port | |
| 447 | + * @tos: Type-of-service | |
| 448 | + * | |
| 449 | + * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. | |
| 450 | + */ | |
| 451 | +struct ethtool_tcpip4_spec { | |
| 452 | + __be32 ip4src; | |
| 453 | + __be32 ip4dst; | |
| 454 | + __be16 psrc; | |
| 455 | + __be16 pdst; | |
| 456 | + __u8 tos; | |
| 457 | +}; | |
| 458 | + | |
| 459 | +/** | |
| 460 | + * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 | |
| 461 | + * @ip4src: Source host | |
| 462 | + * @ip4dst: Destination host | |
| 463 | + * @spi: Security parameters index | |
| 464 | + * @tos: Type-of-service | |
| 465 | + * | |
| 466 | + * This can be used to specify an IPsec transport or tunnel over IPv4. | |
| 467 | + */ | |
| 468 | +struct ethtool_ah_espip4_spec { | |
| 469 | + __be32 ip4src; | |
| 470 | + __be32 ip4dst; | |
| 471 | + __be32 spi; | |
| 472 | + __u8 tos; | |
| 473 | +}; | |
| 474 | + | |
| 475 | +#define ETH_RX_NFC_IP4 1 | |
| 476 | + | |
| 477 | +/** | |
| 478 | + * struct ethtool_usrip4_spec - general flow specification for IPv4 | |
| 479 | + * @ip4src: Source host | |
| 480 | + * @ip4dst: Destination host | |
| 481 | + * @l4_4_bytes: First 4 bytes of transport (layer 4) header | |
| 482 | + * @tos: Type-of-service | |
| 483 | + * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 | |
| 484 | + * @proto: Transport protocol number; mask must be 0 | |
| 485 | + */ | |
| 486 | +struct ethtool_usrip4_spec { | |
| 487 | + __be32 ip4src; | |
| 488 | + __be32 ip4dst; | |
| 489 | + __be32 l4_4_bytes; | |
| 490 | + __u8 tos; | |
| 491 | + __u8 ip_ver; | |
| 492 | + __u8 proto; | |
| 493 | +}; | |
| 494 | + | |
| 495 | +union ethtool_flow_union { | |
| 496 | + struct ethtool_tcpip4_spec tcp_ip4_spec; | |
| 497 | + struct ethtool_tcpip4_spec udp_ip4_spec; | |
| 498 | + struct ethtool_tcpip4_spec sctp_ip4_spec; | |
| 499 | + struct ethtool_ah_espip4_spec ah_ip4_spec; | |
| 500 | + struct ethtool_ah_espip4_spec esp_ip4_spec; | |
| 501 | + struct ethtool_usrip4_spec usr_ip4_spec; | |
| 502 | + struct ethhdr ether_spec; | |
| 503 | + __u8 hdata[60]; | |
| 504 | +}; | |
| 505 | + | |
| 506 | +struct ethtool_flow_ext { | |
| 507 | + __be16 vlan_etype; | |
| 508 | + __be16 vlan_tci; | |
| 509 | + __be32 data[2]; | |
| 510 | +}; | |
| 511 | + | |
| 512 | +/** | |
| 513 | + * struct ethtool_rx_flow_spec - classification rule for RX flows | |
| 514 | + * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW | |
| 515 | + * @h_u: Flow fields to match (dependent on @flow_type) | |
| 516 | + * @h_ext: Additional fields to match | |
| 517 | + * @m_u: Masks for flow field bits to be matched | |
| 518 | + * @m_ext: Masks for additional field bits to be matched | |
| 519 | + * Note, all additional fields must be ignored unless @flow_type | |
| 520 | + * includes the %FLOW_EXT flag. | |
| 521 | + * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC | |
| 522 | + * if packets should be discarded | |
| 523 | + * @location: Location of rule in the table. Locations must be | |
| 524 | + * numbered such that a flow matching multiple rules will be | |
| 525 | + * classified according to the first (lowest numbered) rule. | |
| 526 | + */ | |
| 527 | +struct ethtool_rx_flow_spec { | |
| 528 | + __u32 flow_type; | |
| 529 | + union ethtool_flow_union h_u; | |
| 530 | + struct ethtool_flow_ext h_ext; | |
| 531 | + union ethtool_flow_union m_u; | |
| 532 | + struct ethtool_flow_ext m_ext; | |
| 533 | + __u64 ring_cookie; | |
| 534 | + __u32 location; | |
| 535 | +}; | |
| 536 | + | |
| 537 | +/** | |
| 538 | + * struct ethtool_rxnfc - command to get or set RX flow classification rules | |
| 539 | + * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, | |
| 540 | + * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, | |
| 541 | + * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS | |
| 542 | + * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW | |
| 543 | + * @data: Command-dependent value | |
| 544 | + * @fs: Flow classification rule | |
| 545 | + * @rule_cnt: Number of rules to be affected | |
| 546 | + * @rule_locs: Array of used rule locations | |
| 547 | + * | |
| 548 | + * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating | |
| 549 | + * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following | |
| 550 | + * structure fields must not be used. | |
| 551 | + * | |
| 552 | + * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues | |
| 553 | + * on return. | |
| 554 | + * | |
| 555 | + * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined | |
| 556 | + * rules on return. If @data is non-zero on return then it is the | |
| 557 | + * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the | |
| 558 | + * driver supports any special location values. If that flag is not | |
| 559 | + * set in @data then special location values should not be used. | |
| 560 | + * | |
| 561 | + * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an | |
| 562 | + * existing rule on entry and @fs contains the rule on return. | |
| 563 | + * | |
| 564 | + * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the | |
| 565 | + * user buffer for @rule_locs on entry. On return, @data is the size | |
| 566 | + * of the rule table, @rule_cnt is the number of defined rules, and | |
| 567 | + * @rule_locs contains the locations of the defined rules. Drivers | |
| 568 | + * must use the second parameter to get_rxnfc() instead of @rule_locs. | |
| 569 | + * | |
| 570 | + * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. | |
| 571 | + * @fs.@location either specifies the location to use or is a special | |
| 572 | + * location value with %RX_CLS_LOC_SPECIAL flag set. On return, | |
| 573 | + * @fs.@location is the actual rule location. | |
| 574 | + * | |
| 575 | + * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an | |
| 576 | + * existing rule on entry. | |
| 577 | + * | |
| 578 | + * A driver supporting the special location values for | |
| 579 | + * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused | |
| 580 | + * location, and may remove a rule at a later location (lower | |
| 581 | + * priority) that matches exactly the same set of flows. The special | |
| 582 | + * values are: %RX_CLS_LOC_ANY, selecting any location; | |
| 583 | + * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum | |
| 584 | + * priority); and %RX_CLS_LOC_LAST, selecting the last suitable | |
| 585 | + * location (minimum priority). Additional special values may be | |
| 586 | + * defined in future and drivers must return -%EINVAL for any | |
| 587 | + * unrecognised value. | |
| 588 | + */ | |
| 589 | +struct ethtool_rxnfc { | |
| 590 | + __u32 cmd; | |
| 591 | + __u32 flow_type; | |
| 592 | + __u64 data; | |
| 593 | + struct ethtool_rx_flow_spec fs; | |
| 594 | + __u32 rule_cnt; | |
| 595 | + __u32 rule_locs[0]; | |
| 596 | +}; | |
| 597 | + | |
| 598 | + | |
| 599 | +/** | |
| 600 | + * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection | |
| 601 | + * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR | |
| 602 | + * @size: On entry, the array size of the user buffer, which may be zero. | |
| 603 | + * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware | |
| 604 | + * indirection table. | |
| 605 | + * @ring_index: RX ring/queue index for each hash value | |
| 606 | + * | |
| 607 | + * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size | |
| 608 | + * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means | |
| 609 | + * the table should be reset to default values. This last feature | |
| 610 | + * is not supported by the original implementations. | |
| 611 | + */ | |
| 612 | +struct ethtool_rxfh_indir { | |
| 613 | + __u32 cmd; | |
| 614 | + __u32 size; | |
| 615 | + __u32 ring_index[0]; | |
| 616 | +}; | |
| 617 | + | |
| 618 | +/** | |
| 619 | + * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter | |
| 620 | + * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW | |
| 621 | + * @h_u: Flow field values to match (dependent on @flow_type) | |
| 622 | + * @m_u: Masks for flow field value bits to be ignored | |
| 623 | + * @vlan_tag: VLAN tag to match | |
| 624 | + * @vlan_tag_mask: Mask for VLAN tag bits to be ignored | |
| 625 | + * @data: Driver-dependent data to match | |
| 626 | + * @data_mask: Mask for driver-dependent data bits to be ignored | |
| 627 | + * @action: RX ring/queue index to deliver to (non-negative) or other action | |
| 628 | + * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) | |
| 629 | + * | |
| 630 | + * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where | |
| 631 | + * a field value and mask are both zero this is treated as if all mask | |
| 632 | + * bits are set i.e. the field is ignored. | |
| 633 | + */ | |
| 634 | +struct ethtool_rx_ntuple_flow_spec { | |
| 635 | + __u32 flow_type; | |
| 636 | + union { | |
| 637 | + struct ethtool_tcpip4_spec tcp_ip4_spec; | |
| 638 | + struct ethtool_tcpip4_spec udp_ip4_spec; | |
| 639 | + struct ethtool_tcpip4_spec sctp_ip4_spec; | |
| 640 | + struct ethtool_ah_espip4_spec ah_ip4_spec; | |
| 641 | + struct ethtool_ah_espip4_spec esp_ip4_spec; | |
| 642 | + struct ethtool_usrip4_spec usr_ip4_spec; | |
| 643 | + struct ethhdr ether_spec; | |
| 644 | + __u8 hdata[72]; | |
| 645 | + } h_u, m_u; | |
| 646 | + | |
| 647 | + __u16 vlan_tag; | |
| 648 | + __u16 vlan_tag_mask; | |
| 649 | + __u64 data; | |
| 650 | + __u64 data_mask; | |
| 651 | + | |
| 652 | + __s32 action; | |
| 653 | +#define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ | |
| 654 | +#define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ | |
| 655 | +}; | |
| 656 | + | |
| 657 | +/** | |
| 658 | + * struct ethtool_rx_ntuple - command to set or clear RX flow filter | |
| 659 | + * @cmd: Command number - %ETHTOOL_SRXNTUPLE | |
| 660 | + * @fs: Flow filter specification | |
| 661 | + */ | |
| 662 | +struct ethtool_rx_ntuple { | |
| 663 | + __u32 cmd; | |
| 664 | + struct ethtool_rx_ntuple_flow_spec fs; | |
| 665 | +}; | |
| 666 | + | |
| 667 | +#define ETHTOOL_FLASH_MAX_FILENAME 128 | |
| 668 | +enum ethtool_flash_op_type { | |
| 669 | + ETHTOOL_FLASH_ALL_REGIONS = 0, | |
| 670 | +}; | |
| 671 | + | |
| 672 | +/* for passing firmware flashing related parameters */ | |
| 673 | +struct ethtool_flash { | |
| 674 | + __u32 cmd; | |
| 675 | + __u32 region; | |
| 676 | + char data[ETHTOOL_FLASH_MAX_FILENAME]; | |
| 677 | +}; | |
| 678 | + | |
| 679 | +/** | |
| 680 | + * struct ethtool_dump - used for retrieving, setting device dump | |
| 681 | + * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or | |
| 682 | + * %ETHTOOL_SET_DUMP | |
| 683 | + * @version: FW version of the dump, filled in by driver | |
| 684 | + * @flag: driver dependent flag for dump setting, filled in by driver during | |
| 685 | + * get and filled in by ethtool for set operation. | |
| 686 | + * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when | |
| 687 | + * firmware dump is disabled. | |
| 688 | + * @len: length of dump data, used as the length of the user buffer on entry to | |
| 689 | + * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver | |
| 690 | + * for %ETHTOOL_GET_DUMP_FLAG command | |
| 691 | + * @data: data collected for get dump data operation | |
| 692 | + */ | |
| 693 | + | |
| 694 | +#define ETH_FW_DUMP_DISABLE 0 | |
| 695 | + | |
| 696 | +struct ethtool_dump { | |
| 697 | + __u32 cmd; | |
| 698 | + __u32 version; | |
| 699 | + __u32 flag; | |
| 700 | + __u32 len; | |
| 701 | + __u8 data[0]; | |
| 702 | +}; | |
| 703 | + | |
| 704 | +/* for returning and changing feature sets */ | |
| 705 | + | |
| 706 | +/** | |
| 707 | + * struct ethtool_get_features_block - block with state of 32 features | |
| 708 | + * @available: mask of changeable features | |
| 709 | + * @requested: mask of features requested to be enabled if possible | |
| 710 | + * @active: mask of currently enabled features | |
| 711 | + * @never_changed: mask of features not changeable for any device | |
| 712 | + */ | |
| 713 | +struct ethtool_get_features_block { | |
| 714 | + __u32 available; | |
| 715 | + __u32 requested; | |
| 716 | + __u32 active; | |
| 717 | + __u32 never_changed; | |
| 718 | +}; | |
| 719 | + | |
| 720 | +/** | |
| 721 | + * struct ethtool_gfeatures - command to get state of device's features | |
| 722 | + * @cmd: command number = %ETHTOOL_GFEATURES | |
| 723 | + * @size: in: number of elements in the features[] array; | |
| 724 | + * out: number of elements in features[] needed to hold all features | |
| 725 | + * @features: state of features | |
| 726 | + */ | |
| 727 | +struct ethtool_gfeatures { | |
| 728 | + __u32 cmd; | |
| 729 | + __u32 size; | |
| 730 | + struct ethtool_get_features_block features[0]; | |
| 731 | +}; | |
| 732 | + | |
| 733 | +/** | |
| 734 | + * struct ethtool_set_features_block - block with request for 32 features | |
| 735 | + * @valid: mask of features to be changed | |
| 736 | + * @requested: values of features to be changed | |
| 737 | + */ | |
| 738 | +struct ethtool_set_features_block { | |
| 739 | + __u32 valid; | |
| 740 | + __u32 requested; | |
| 741 | +}; | |
| 742 | + | |
| 743 | +/** | |
| 744 | + * struct ethtool_sfeatures - command to request change in device's features | |
| 745 | + * @cmd: command number = %ETHTOOL_SFEATURES | |
| 746 | + * @size: array size of the features[] array | |
| 747 | + * @features: feature change masks | |
| 748 | + */ | |
| 749 | +struct ethtool_sfeatures { | |
| 750 | + __u32 cmd; | |
| 751 | + __u32 size; | |
| 752 | + struct ethtool_set_features_block features[0]; | |
| 753 | +}; | |
| 754 | + | |
| 755 | +/** | |
| 756 | + * struct ethtool_ts_info - holds a device's timestamping and PHC association | |
| 757 | + * @cmd: command number = %ETHTOOL_GET_TS_INFO | |
| 758 | + * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags | |
| 759 | + * @phc_index: device index of the associated PHC, or -1 if there is none | |
| 760 | + * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values | |
| 761 | + * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values | |
| 762 | + * | |
| 763 | + * The bits in the 'tx_types' and 'rx_filters' fields correspond to | |
| 764 | + * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, | |
| 765 | + * respectively. For example, if the device supports HWTSTAMP_TX_ON, | |
| 766 | + * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set. | |
| 767 | + */ | |
| 768 | +struct ethtool_ts_info { | |
| 769 | + __u32 cmd; | |
| 770 | + __u32 so_timestamping; | |
| 771 | + __s32 phc_index; | |
| 772 | + __u32 tx_types; | |
| 773 | + __u32 tx_reserved[3]; | |
| 774 | + __u32 rx_filters; | |
| 775 | + __u32 rx_reserved[3]; | |
| 776 | +}; | |
| 777 | + | |
| 778 | +/* | |
| 779 | + * %ETHTOOL_SFEATURES changes features present in features[].valid to the | |
| 780 | + * values of corresponding bits in features[].requested. Bits in .requested | |
| 781 | + * not set in .valid or not changeable are ignored. | |
| 782 | + * | |
| 783 | + * Returns %EINVAL when .valid contains undefined or never-changeable bits | |
| 784 | + * or size is not equal to required number of features words (32-bit blocks). | |
| 785 | + * Returns >= 0 if request was completed; bits set in the value mean: | |
| 786 | + * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not | |
| 787 | + * changeable (not present in %ETHTOOL_GFEATURES' features[].available) | |
| 788 | + * those bits were ignored. | |
| 789 | + * %ETHTOOL_F_WISH - some or all changes requested were recorded but the | |
| 790 | + * resulting state of bits masked by .valid is not equal to .requested. | |
| 791 | + * Probably there are other device-specific constraints on some features | |
| 792 | + * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered | |
| 793 | + * here as though ignored bits were cleared. | |
| 794 | + * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling | |
| 795 | + * compatibility functions. Requested offload state cannot be properly | |
| 796 | + * managed by kernel. | |
| 797 | + * | |
| 798 | + * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of | |
| 799 | + * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands | |
| 800 | + * for ETH_SS_FEATURES string set. First entry in the table corresponds to least | |
| 801 | + * significant bit in features[0] fields. Empty strings mark undefined features. | |
| 802 | + */ | |
| 803 | +enum ethtool_sfeatures_retval_bits { | |
| 804 | + ETHTOOL_F_UNSUPPORTED__BIT, | |
| 805 | + ETHTOOL_F_WISH__BIT, | |
| 806 | + ETHTOOL_F_COMPAT__BIT, | |
| 807 | +}; | |
| 808 | + | |
| 809 | +#define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) | |
| 810 | +#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) | |
| 811 | +#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) | |
| 812 | + | |
| 813 | + | |
| 814 | +/* CMDs currently supported */ | |
| 815 | +#define ETHTOOL_GSET 0x00000001 /* Get settings. */ | |
| 816 | +#define ETHTOOL_SSET 0x00000002 /* Set settings. */ | |
| 817 | +#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ | |
| 818 | +#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ | |
| 819 | +#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ | |
| 820 | +#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ | |
| 821 | +#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ | |
| 822 | +#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ | |
| 823 | +#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ | |
| 824 | +/* Get link status for host, i.e. whether the interface *and* the | |
| 825 | + * physical port (if there is one) are up (ethtool_value). */ | |
| 826 | +#define ETHTOOL_GLINK 0x0000000a | |
| 827 | +#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ | |
| 828 | +#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ | |
| 829 | +#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ | |
| 830 | +#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ | |
| 831 | +#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ | |
| 832 | +#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ | |
| 833 | +#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ | |
| 834 | +#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ | |
| 835 | +#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ | |
| 836 | +#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ | |
| 837 | +#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ | |
| 838 | +#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ | |
| 839 | +#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable | |
| 840 | + * (ethtool_value) */ | |
| 841 | +#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable | |
| 842 | + * (ethtool_value). */ | |
| 843 | +#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ | |
| 844 | +#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ | |
| 845 | +#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ | |
| 846 | +#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ | |
| 847 | +#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ | |
| 848 | +#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ | |
| 849 | +#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ | |
| 850 | +#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ | |
| 851 | +#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ | |
| 852 | +#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ | |
| 853 | +#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ | |
| 854 | +#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ | |
| 855 | +#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ | |
| 856 | +#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ | |
| 857 | +#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ | |
| 858 | + | |
| 859 | +#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ | |
| 860 | +#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ | |
| 861 | +#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ | |
| 862 | +#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ | |
| 863 | +#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ | |
| 864 | +#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ | |
| 865 | +#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ | |
| 866 | +#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ | |
| 867 | +#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ | |
| 868 | +#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ | |
| 869 | +#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ | |
| 870 | +#define ETHTOOL_RESET 0x00000034 /* Reset hardware */ | |
| 871 | +#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ | |
| 872 | +#define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */ | |
| 873 | +#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ | |
| 874 | +#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ | |
| 875 | +#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ | |
| 876 | + | |
| 877 | +#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ | |
| 878 | +#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ | |
| 879 | +#define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */ | |
| 880 | +#define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */ | |
| 881 | +#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ | |
| 882 | +#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ | |
| 883 | +#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ | |
| 884 | +#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */ | |
| 885 | +#define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */ | |
| 886 | +#define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */ | |
| 887 | +#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ | |
| 888 | +#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ | |
| 889 | + | |
| 890 | +/* compatibility with older code */ | |
| 891 | +#define SPARC_ETH_GSET ETHTOOL_GSET | |
| 892 | +#define SPARC_ETH_SSET ETHTOOL_SSET | |
| 893 | + | |
| 894 | +/* Indicates what features are supported by the interface. */ | |
| 895 | +#define SUPPORTED_10baseT_Half (1 << 0) | |
| 896 | +#define SUPPORTED_10baseT_Full (1 << 1) | |
| 897 | +#define SUPPORTED_100baseT_Half (1 << 2) | |
| 898 | +#define SUPPORTED_100baseT_Full (1 << 3) | |
| 899 | +#define SUPPORTED_1000baseT_Half (1 << 4) | |
| 900 | +#define SUPPORTED_1000baseT_Full (1 << 5) | |
| 901 | +#define SUPPORTED_Autoneg (1 << 6) | |
| 902 | +#define SUPPORTED_TP (1 << 7) | |
| 903 | +#define SUPPORTED_AUI (1 << 8) | |
| 904 | +#define SUPPORTED_MII (1 << 9) | |
| 905 | +#define SUPPORTED_FIBRE (1 << 10) | |
| 906 | +#define SUPPORTED_BNC (1 << 11) | |
| 907 | +#define SUPPORTED_10000baseT_Full (1 << 12) | |
| 908 | +#define SUPPORTED_Pause (1 << 13) | |
| 909 | +#define SUPPORTED_Asym_Pause (1 << 14) | |
| 910 | +#define SUPPORTED_2500baseX_Full (1 << 15) | |
| 911 | +#define SUPPORTED_Backplane (1 << 16) | |
| 912 | +#define SUPPORTED_1000baseKX_Full (1 << 17) | |
| 913 | +#define SUPPORTED_10000baseKX4_Full (1 << 18) | |
| 914 | +#define SUPPORTED_10000baseKR_Full (1 << 19) | |
| 915 | +#define SUPPORTED_10000baseR_FEC (1 << 20) | |
| 916 | +#define SUPPORTED_20000baseMLD2_Full (1 << 21) | |
| 917 | +#define SUPPORTED_20000baseKR2_Full (1 << 22) | |
| 918 | +#define SUPPORTED_40000baseKR4_Full (1 << 23) | |
| 919 | +#define SUPPORTED_40000baseCR4_Full (1 << 24) | |
| 920 | +#define SUPPORTED_40000baseSR4_Full (1 << 25) | |
| 921 | +#define SUPPORTED_40000baseLR4_Full (1 << 26) | |
| 922 | + | |
| 923 | +/* Indicates what features are advertised by the interface. */ | |
| 924 | +#define ADVERTISED_10baseT_Half (1 << 0) | |
| 925 | +#define ADVERTISED_10baseT_Full (1 << 1) | |
| 926 | +#define ADVERTISED_100baseT_Half (1 << 2) | |
| 927 | +#define ADVERTISED_100baseT_Full (1 << 3) | |
| 928 | +#define ADVERTISED_1000baseT_Half (1 << 4) | |
| 929 | +#define ADVERTISED_1000baseT_Full (1 << 5) | |
| 930 | +#define ADVERTISED_Autoneg (1 << 6) | |
| 931 | +#define ADVERTISED_TP (1 << 7) | |
| 932 | +#define ADVERTISED_AUI (1 << 8) | |
| 933 | +#define ADVERTISED_MII (1 << 9) | |
| 934 | +#define ADVERTISED_FIBRE (1 << 10) | |
| 935 | +#define ADVERTISED_BNC (1 << 11) | |
| 936 | +#define ADVERTISED_10000baseT_Full (1 << 12) | |
| 937 | +#define ADVERTISED_Pause (1 << 13) | |
| 938 | +#define ADVERTISED_Asym_Pause (1 << 14) | |
| 939 | +#define ADVERTISED_2500baseX_Full (1 << 15) | |
| 940 | +#define ADVERTISED_Backplane (1 << 16) | |
| 941 | +#define ADVERTISED_1000baseKX_Full (1 << 17) | |
| 942 | +#define ADVERTISED_10000baseKX4_Full (1 << 18) | |
| 943 | +#define ADVERTISED_10000baseKR_Full (1 << 19) | |
| 944 | +#define ADVERTISED_10000baseR_FEC (1 << 20) | |
| 945 | +#define ADVERTISED_20000baseMLD2_Full (1 << 21) | |
| 946 | +#define ADVERTISED_20000baseKR2_Full (1 << 22) | |
| 947 | +#define ADVERTISED_40000baseKR4_Full (1 << 23) | |
| 948 | +#define ADVERTISED_40000baseCR4_Full (1 << 24) | |
| 949 | +#define ADVERTISED_40000baseSR4_Full (1 << 25) | |
| 950 | +#define ADVERTISED_40000baseLR4_Full (1 << 26) | |
| 951 | + | |
| 952 | +/* The following are all involved in forcing a particular link | |
| 953 | + * mode for the device for setting things. When getting the | |
| 954 | + * devices settings, these indicate the current mode and whether | |
| 955 | + * it was forced up into this mode or autonegotiated. | |
| 956 | + */ | |
| 957 | + | |
| 958 | +/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ | |
| 959 | +#define SPEED_10 10 | |
| 960 | +#define SPEED_100 100 | |
| 961 | +#define SPEED_1000 1000 | |
| 962 | +#define SPEED_2500 2500 | |
| 963 | +#define SPEED_10000 10000 | |
| 964 | +#define SPEED_UNKNOWN -1 | |
| 965 | + | |
| 966 | +/* Duplex, half or full. */ | |
| 967 | +#define DUPLEX_HALF 0x00 | |
| 968 | +#define DUPLEX_FULL 0x01 | |
| 969 | +#define DUPLEX_UNKNOWN 0xff | |
| 970 | + | |
| 971 | +/* Which connector port. */ | |
| 972 | +#define PORT_TP 0x00 | |
| 973 | +#define PORT_AUI 0x01 | |
| 974 | +#define PORT_MII 0x02 | |
| 975 | +#define PORT_FIBRE 0x03 | |
| 976 | +#define PORT_BNC 0x04 | |
| 977 | +#define PORT_DA 0x05 | |
| 978 | +#define PORT_NONE 0xef | |
| 979 | +#define PORT_OTHER 0xff | |
| 980 | + | |
| 981 | +/* Which transceiver to use. */ | |
| 982 | +#define XCVR_INTERNAL 0x00 | |
| 983 | +#define XCVR_EXTERNAL 0x01 | |
| 984 | +#define XCVR_DUMMY1 0x02 | |
| 985 | +#define XCVR_DUMMY2 0x03 | |
| 986 | +#define XCVR_DUMMY3 0x04 | |
| 987 | + | |
| 988 | +/* Enable or disable autonegotiation. If this is set to enable, | |
| 989 | + * the forced link modes above are completely ignored. | |
| 990 | + */ | |
| 991 | +#define AUTONEG_DISABLE 0x00 | |
| 992 | +#define AUTONEG_ENABLE 0x01 | |
| 993 | + | |
| 994 | +/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then | |
| 995 | + * the driver is required to renegotiate link | |
| 996 | + */ | |
| 997 | +#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */ | |
| 998 | +#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */ | |
| 999 | +#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */ | |
| 1000 | +#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */ | |
| 1001 | + | |
| 1002 | +/* Wake-On-Lan options. */ | |
| 1003 | +#define WAKE_PHY (1 << 0) | |
| 1004 | +#define WAKE_UCAST (1 << 1) | |
| 1005 | +#define WAKE_MCAST (1 << 2) | |
| 1006 | +#define WAKE_BCAST (1 << 3) | |
| 1007 | +#define WAKE_ARP (1 << 4) | |
| 1008 | +#define WAKE_MAGIC (1 << 5) | |
| 1009 | +#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ | |
| 1010 | + | |
| 1011 | +/* L2-L4 network traffic flow types */ | |
| 1012 | +#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ | |
| 1013 | +#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ | |
| 1014 | +#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ | |
| 1015 | +#define AH_ESP_V4_FLOW 0x04 /* hash only */ | |
| 1016 | +#define TCP_V6_FLOW 0x05 /* hash only */ | |
| 1017 | +#define UDP_V6_FLOW 0x06 /* hash only */ | |
| 1018 | +#define SCTP_V6_FLOW 0x07 /* hash only */ | |
| 1019 | +#define AH_ESP_V6_FLOW 0x08 /* hash only */ | |
| 1020 | +#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ | |
| 1021 | +#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ | |
| 1022 | +#define AH_V6_FLOW 0x0b /* hash only */ | |
| 1023 | +#define ESP_V6_FLOW 0x0c /* hash only */ | |
| 1024 | +#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ | |
| 1025 | +#define IPV4_FLOW 0x10 /* hash only */ | |
| 1026 | +#define IPV6_FLOW 0x11 /* hash only */ | |
| 1027 | +#define ETHER_FLOW 0x12 /* spec only (ether_spec) */ | |
| 1028 | +/* Flag to enable additional fields in struct ethtool_rx_flow_spec */ | |
| 1029 | +#define FLOW_EXT 0x80000000 | |
| 1030 | + | |
| 1031 | +/* L3-L4 network traffic flow hash options */ | |
| 1032 | +#define RXH_L2DA (1 << 1) | |
| 1033 | +#define RXH_VLAN (1 << 2) | |
| 1034 | +#define RXH_L3_PROTO (1 << 3) | |
| 1035 | +#define RXH_IP_SRC (1 << 4) | |
| 1036 | +#define RXH_IP_DST (1 << 5) | |
| 1037 | +#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ | |
| 1038 | +#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ | |
| 1039 | +#define RXH_DISCARD (1 << 31) | |
| 1040 | + | |
| 1041 | +#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL | |
| 1042 | + | |
| 1043 | +/* Special RX classification rule insert location values */ | |
| 1044 | +#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */ | |
| 1045 | +#define RX_CLS_LOC_ANY 0xffffffff | |
| 1046 | +#define RX_CLS_LOC_FIRST 0xfffffffe | |
| 1047 | +#define RX_CLS_LOC_LAST 0xfffffffd | |
| 1048 | + | |
| 1049 | +/* EEPROM Standards for plug in modules */ | |
| 1050 | +#define ETH_MODULE_SFF_8079 0x1 | |
| 1051 | +#define ETH_MODULE_SFF_8079_LEN 256 | |
| 1052 | +#define ETH_MODULE_SFF_8472 0x2 | |
| 1053 | +#define ETH_MODULE_SFF_8472_LEN 512 | |
| 1054 | + | |
| 1055 | +/* Reset flags */ | |
| 1056 | +/* The reset() operation must clear the flags for the components which | |
| 1057 | + * were actually reset. On successful return, the flags indicate the | |
| 1058 | + * components which were not reset, either because they do not exist | |
| 1059 | + * in the hardware or because they cannot be reset independently. The | |
| 1060 | + * driver must never reset any components that were not requested. | |
| 1061 | + */ | |
| 1062 | +enum ethtool_reset_flags { | |
| 1063 | + /* These flags represent components dedicated to the interface | |
| 1064 | + * the command is addressed to. Shift any flag left by | |
| 1065 | + * ETH_RESET_SHARED_SHIFT to reset a shared component of the | |
| 1066 | + * same type. | |
| 1067 | + */ | |
| 1068 | + ETH_RESET_MGMT = 1 << 0, /* Management processor */ | |
| 1069 | + ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ | |
| 1070 | + ETH_RESET_DMA = 1 << 2, /* DMA engine */ | |
| 1071 | + ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ | |
| 1072 | + ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ | |
| 1073 | + ETH_RESET_MAC = 1 << 5, /* Media access controller */ | |
| 1074 | + ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ | |
| 1075 | + ETH_RESET_RAM = 1 << 7, /* RAM shared between | |
| 1076 | + * multiple components */ | |
| 1077 | + | |
| 1078 | + ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to | |
| 1079 | + * this interface */ | |
| 1080 | + ETH_RESET_ALL = 0xffffffff, /* All components used by this | |
| 1081 | + * interface, even if shared */ | |
| 1082 | +}; | |
| 1083 | +#define ETH_RESET_SHARED_SHIFT 16 | |
| 1084 | + | |
| 1085 | +#endif /* _UAPI_LINUX_ETHTOOL_H */ | |
| @@ -0,0 +1,66 @@ | ||
| 1 | +/* | |
| 2 | + * include/linux/eventpoll.h ( Efficient event polling implementation ) | |
| 3 | + * Copyright (C) 2001,...,2006 Davide Libenzi | |
| 4 | + * | |
| 5 | + * This program is free software; you can redistribute it and/or modify | |
| 6 | + * it under the terms of the GNU General Public License as published by | |
| 7 | + * the Free Software Foundation; either version 2 of the License, or | |
| 8 | + * (at your option) any later version. | |
| 9 | + * | |
| 10 | + * Davide Libenzi <davidel@xmailserver.org> | |
| 11 | + * | |
| 12 | + */ | |
| 13 | + | |
| 14 | +#ifndef _UAPI_LINUX_EVENTPOLL_H | |
| 15 | +#define _UAPI_LINUX_EVENTPOLL_H | |
| 16 | + | |
| 17 | +/* For O_CLOEXEC */ | |
| 18 | +#include <linux/fcntl.h> | |
| 19 | +#include <linux/types.h> | |
| 20 | + | |
| 21 | +/* Flags for epoll_create1. */ | |
| 22 | +#define EPOLL_CLOEXEC O_CLOEXEC | |
| 23 | + | |
| 24 | +/* Valid opcodes to issue to sys_epoll_ctl() */ | |
| 25 | +#define EPOLL_CTL_ADD 1 | |
| 26 | +#define EPOLL_CTL_DEL 2 | |
| 27 | +#define EPOLL_CTL_MOD 3 | |
| 28 | +#define EPOLL_CTL_DISABLE 4 | |
| 29 | + | |
| 30 | +/* | |
| 31 | + * Request the handling of system wakeup events so as to prevent system suspends | |
| 32 | + * from happening while those events are being processed. | |
| 33 | + * | |
| 34 | + * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be | |
| 35 | + * re-allowed until epoll_wait is called again after consuming the wakeup | |
| 36 | + * event(s). | |
| 37 | + * | |
| 38 | + * Requires CAP_BLOCK_SUSPEND | |
| 39 | + */ | |
| 40 | +#define EPOLLWAKEUP (1 << 29) | |
| 41 | + | |
| 42 | +/* Set the One Shot behaviour for the target file descriptor */ | |
| 43 | +#define EPOLLONESHOT (1 << 30) | |
| 44 | + | |
| 45 | +/* Set the Edge Triggered behaviour for the target file descriptor */ | |
| 46 | +#define EPOLLET (1 << 31) | |
| 47 | + | |
| 48 | +/* | |
| 49 | + * On x86-64 make the 64bit structure have the same alignment as the | |
| 50 | + * 32bit structure. This makes 32bit emulation easier. | |
| 51 | + * | |
| 52 | + * UML/x86_64 needs the same packing as x86_64 | |
| 53 | + */ | |
| 54 | +#ifdef __x86_64__ | |
| 55 | +#define EPOLL_PACKED __attribute__((packed)) | |
| 56 | +#else | |
| 57 | +#define EPOLL_PACKED | |
| 58 | +#endif | |
| 59 | + | |
| 60 | +struct epoll_event { | |
| 61 | + __u32 events; | |
| 62 | + __u64 data; | |
| 63 | +} EPOLL_PACKED; | |
| 64 | + | |
| 65 | + | |
| 66 | +#endif /* _UAPI_LINUX_EVENTPOLL_H */ | |
| @@ -0,0 +1,21 @@ | ||
| 1 | +#ifndef FADVISE_H_INCLUDED | |
| 2 | +#define FADVISE_H_INCLUDED | |
| 3 | + | |
| 4 | +#define POSIX_FADV_NORMAL 0 /* No further special treatment. */ | |
| 5 | +#define POSIX_FADV_RANDOM 1 /* Expect random page references. */ | |
| 6 | +#define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ | |
| 7 | +#define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ | |
| 8 | + | |
| 9 | +/* | |
| 10 | + * The advise values for POSIX_FADV_DONTNEED and POSIX_ADV_NOREUSE | |
| 11 | + * for s390-64 differ from the values for the rest of the world. | |
| 12 | + */ | |
| 13 | +#if defined(__s390x__) | |
| 14 | +#define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */ | |
| 15 | +#define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */ | |
| 16 | +#else | |
| 17 | +#define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ | |
| 18 | +#define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ | |
| 19 | +#endif | |
| 20 | + | |
| 21 | +#endif /* FADVISE_H_INCLUDED */ | |
| @@ -0,0 +1,9 @@ | ||
| 1 | +#ifndef _UAPI_FALLOC_H_ | |
| 2 | +#define _UAPI_FALLOC_H_ | |
| 3 | + | |
| 4 | +#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ | |
| 5 | +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ | |
| 6 | +#define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */ | |
| 7 | + | |
| 8 | + | |
| 9 | +#endif /* _UAPI_FALLOC_H_ */ | |
| @@ -0,0 +1,116 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_FANOTIFY_H | |
| 2 | +#define _UAPI_LINUX_FANOTIFY_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +/* the following events that user-space can register for */ | |
| 7 | +#define FAN_ACCESS 0x00000001 /* File was accessed */ | |
| 8 | +#define FAN_MODIFY 0x00000002 /* File was modified */ | |
| 9 | +#define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */ | |
| 10 | +#define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ | |
| 11 | +#define FAN_OPEN 0x00000020 /* File was opened */ | |
| 12 | + | |
| 13 | +#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ | |
| 14 | + | |
| 15 | +#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */ | |
| 16 | +#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */ | |
| 17 | + | |
| 18 | +#define FAN_ONDIR 0x40000000 /* event occurred against dir */ | |
| 19 | + | |
| 20 | +#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */ | |
| 21 | + | |
| 22 | +/* helper events */ | |
| 23 | +#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */ | |
| 24 | + | |
| 25 | +/* flags used for fanotify_init() */ | |
| 26 | +#define FAN_CLOEXEC 0x00000001 | |
| 27 | +#define FAN_NONBLOCK 0x00000002 | |
| 28 | + | |
| 29 | +/* These are NOT bitwise flags. Both bits are used togther. */ | |
| 30 | +#define FAN_CLASS_NOTIF 0x00000000 | |
| 31 | +#define FAN_CLASS_CONTENT 0x00000004 | |
| 32 | +#define FAN_CLASS_PRE_CONTENT 0x00000008 | |
| 33 | +#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \ | |
| 34 | + FAN_CLASS_PRE_CONTENT) | |
| 35 | + | |
| 36 | +#define FAN_UNLIMITED_QUEUE 0x00000010 | |
| 37 | +#define FAN_UNLIMITED_MARKS 0x00000020 | |
| 38 | + | |
| 39 | +#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ | |
| 40 | + FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ | |
| 41 | + FAN_UNLIMITED_MARKS) | |
| 42 | + | |
| 43 | +/* flags used for fanotify_modify_mark() */ | |
| 44 | +#define FAN_MARK_ADD 0x00000001 | |
| 45 | +#define FAN_MARK_REMOVE 0x00000002 | |
| 46 | +#define FAN_MARK_DONT_FOLLOW 0x00000004 | |
| 47 | +#define FAN_MARK_ONLYDIR 0x00000008 | |
| 48 | +#define FAN_MARK_MOUNT 0x00000010 | |
| 49 | +#define FAN_MARK_IGNORED_MASK 0x00000020 | |
| 50 | +#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040 | |
| 51 | +#define FAN_MARK_FLUSH 0x00000080 | |
| 52 | + | |
| 53 | +#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\ | |
| 54 | + FAN_MARK_REMOVE |\ | |
| 55 | + FAN_MARK_DONT_FOLLOW |\ | |
| 56 | + FAN_MARK_ONLYDIR |\ | |
| 57 | + FAN_MARK_MOUNT |\ | |
| 58 | + FAN_MARK_IGNORED_MASK |\ | |
| 59 | + FAN_MARK_IGNORED_SURV_MODIFY |\ | |
| 60 | + FAN_MARK_FLUSH) | |
| 61 | + | |
| 62 | +/* | |
| 63 | + * All of the events - we build the list by hand so that we can add flags in | |
| 64 | + * the future and not break backward compatibility. Apps will get only the | |
| 65 | + * events that they originally wanted. Be sure to add new events here! | |
| 66 | + */ | |
| 67 | +#define FAN_ALL_EVENTS (FAN_ACCESS |\ | |
| 68 | + FAN_MODIFY |\ | |
| 69 | + FAN_CLOSE |\ | |
| 70 | + FAN_OPEN) | |
| 71 | + | |
| 72 | +/* | |
| 73 | + * All events which require a permission response from userspace | |
| 74 | + */ | |
| 75 | +#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\ | |
| 76 | + FAN_ACCESS_PERM) | |
| 77 | + | |
| 78 | +#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\ | |
| 79 | + FAN_ALL_PERM_EVENTS |\ | |
| 80 | + FAN_Q_OVERFLOW) | |
| 81 | + | |
| 82 | +#define FANOTIFY_METADATA_VERSION 3 | |
| 83 | + | |
| 84 | +struct fanotify_event_metadata { | |
| 85 | + __u32 event_len; | |
| 86 | + __u8 vers; | |
| 87 | + __u8 reserved; | |
| 88 | + __u16 metadata_len; | |
| 89 | + __aligned_u64 mask; | |
| 90 | + __s32 fd; | |
| 91 | + __s32 pid; | |
| 92 | +}; | |
| 93 | + | |
| 94 | +struct fanotify_response { | |
| 95 | + __s32 fd; | |
| 96 | + __u32 response; | |
| 97 | +}; | |
| 98 | + | |
| 99 | +/* Legit userspace responses to a _PERM event */ | |
| 100 | +#define FAN_ALLOW 0x01 | |
| 101 | +#define FAN_DENY 0x02 | |
| 102 | +/* No fd set in event */ | |
| 103 | +#define FAN_NOFD -1 | |
| 104 | + | |
| 105 | +/* Helper functions to deal with fanotify_event_metadata buffers */ | |
| 106 | +#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata)) | |
| 107 | + | |
| 108 | +#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \ | |
| 109 | + (struct fanotify_event_metadata*)(((char *)(meta)) + \ | |
| 110 | + (meta)->event_len)) | |
| 111 | + | |
| 112 | +#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \ | |
| 113 | + (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \ | |
| 114 | + (long)(meta)->event_len <= (long)(len)) | |
| 115 | + | |
| 116 | +#endif /* _UAPI_LINUX_FANOTIFY_H */ | |
| @@ -0,0 +1,402 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_FB_H | |
| 2 | +#define _UAPI_LINUX_FB_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/i2c.h> | |
| 6 | + | |
| 7 | +/* Definitions of frame buffers */ | |
| 8 | + | |
| 9 | +#define FB_MAX 32 /* sufficient for now */ | |
| 10 | + | |
| 11 | +/* ioctls | |
| 12 | + 0x46 is 'F' */ | |
| 13 | +#define FBIOGET_VSCREENINFO 0x4600 | |
| 14 | +#define FBIOPUT_VSCREENINFO 0x4601 | |
| 15 | +#define FBIOGET_FSCREENINFO 0x4602 | |
| 16 | +#define FBIOGETCMAP 0x4604 | |
| 17 | +#define FBIOPUTCMAP 0x4605 | |
| 18 | +#define FBIOPAN_DISPLAY 0x4606 | |
| 19 | +#ifndef __KERNEL__ | |
| 20 | +#define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor) | |
| 21 | +#endif | |
| 22 | +/* 0x4607-0x460B are defined below */ | |
| 23 | +/* #define FBIOGET_MONITORSPEC 0x460C */ | |
| 24 | +/* #define FBIOPUT_MONITORSPEC 0x460D */ | |
| 25 | +/* #define FBIOSWITCH_MONIBIT 0x460E */ | |
| 26 | +#define FBIOGET_CON2FBMAP 0x460F | |
| 27 | +#define FBIOPUT_CON2FBMAP 0x4610 | |
| 28 | +#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ | |
| 29 | +#define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank) | |
| 30 | +#define FBIO_ALLOC 0x4613 | |
| 31 | +#define FBIO_FREE 0x4614 | |
| 32 | +#define FBIOGET_GLYPH 0x4615 | |
| 33 | +#define FBIOGET_HWCINFO 0x4616 | |
| 34 | +#define FBIOPUT_MODEINFO 0x4617 | |
| 35 | +#define FBIOGET_DISPINFO 0x4618 | |
| 36 | +#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) | |
| 37 | + | |
| 38 | +#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ | |
| 39 | +#define FB_TYPE_PLANES 1 /* Non interleaved planes */ | |
| 40 | +#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ | |
| 41 | +#define FB_TYPE_TEXT 3 /* Text/attributes */ | |
| 42 | +#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ | |
| 43 | +#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */ | |
| 44 | + | |
| 45 | +#define FB_AUX_TEXT_MDA 0 /* Monochrome text */ | |
| 46 | +#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ | |
| 47 | +#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ | |
| 48 | +#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ | |
| 49 | +#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ | |
| 50 | +#define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */ | |
| 51 | +#define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */ | |
| 52 | +#define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */ | |
| 53 | +#define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */ | |
| 54 | +#define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */ | |
| 55 | +#define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */ | |
| 56 | +#define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */ | |
| 57 | + | |
| 58 | +#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */ | |
| 59 | +#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */ | |
| 60 | +#define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */ | |
| 61 | + | |
| 62 | +#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ | |
| 63 | +#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ | |
| 64 | +#define FB_VISUAL_TRUECOLOR 2 /* True color */ | |
| 65 | +#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ | |
| 66 | +#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ | |
| 67 | +#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ | |
| 68 | +#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */ | |
| 69 | + | |
| 70 | +#define FB_ACCEL_NONE 0 /* no hardware accelerator */ | |
| 71 | +#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ | |
| 72 | +#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */ | |
| 73 | +#define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */ | |
| 74 | +#define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */ | |
| 75 | +#define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */ | |
| 76 | +#define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */ | |
| 77 | +#define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */ | |
| 78 | +#define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */ | |
| 79 | +#define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */ | |
| 80 | +#define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */ | |
| 81 | +#define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */ | |
| 82 | +#define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */ | |
| 83 | +#define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */ | |
| 84 | +#define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */ | |
| 85 | +#define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */ | |
| 86 | +#define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */ | |
| 87 | +#define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */ | |
| 88 | +#define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */ | |
| 89 | +#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */ | |
| 90 | +#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */ | |
| 91 | +#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */ | |
| 92 | +#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */ | |
| 93 | +#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ | |
| 94 | +#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ | |
| 95 | +#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ | |
| 96 | +#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ | |
| 97 | +#define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */ | |
| 98 | +#define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */ | |
| 99 | +#define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */ | |
| 100 | +#define FB_ACCEL_CT_6555x 30 /* C&T 6555x */ | |
| 101 | +#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */ | |
| 102 | +#define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */ | |
| 103 | +#define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */ | |
| 104 | +#define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */ | |
| 105 | +#define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */ | |
| 106 | +#define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */ | |
| 107 | +#define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */ | |
| 108 | +#define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */ | |
| 109 | +#define FB_ACCEL_I810 39 /* Intel 810/815 */ | |
| 110 | +#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */ | |
| 111 | +#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */ | |
| 112 | +#define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */ | |
| 113 | +#define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */ | |
| 114 | +#define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */ | |
| 115 | +#define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */ | |
| 116 | +#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */ | |
| 117 | +#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */ | |
| 118 | +#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */ | |
| 119 | +#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */ | |
| 120 | +#define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */ | |
| 121 | +#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ | |
| 122 | +#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ | |
| 123 | +#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ | |
| 124 | +#define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */ | |
| 125 | +#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ | |
| 126 | +#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ | |
| 127 | +#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ | |
| 128 | +#define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */ | |
| 129 | +#define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */ | |
| 130 | +#define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */ | |
| 131 | +#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */ | |
| 132 | +#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */ | |
| 133 | +#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */ | |
| 134 | +#define FB_ACCEL_PXA3XX 99 /* PXA3xx */ | |
| 135 | + | |
| 136 | +#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */ | |
| 137 | +#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */ | |
| 138 | +#define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */ | |
| 139 | +#define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */ | |
| 140 | +#define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */ | |
| 141 | +#define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */ | |
| 142 | +#define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */ | |
| 143 | +#define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */ | |
| 144 | +#define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */ | |
| 145 | +#define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */ | |
| 146 | +#define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */ | |
| 147 | +#define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */ | |
| 148 | +#define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */ | |
| 149 | +#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */ | |
| 150 | +#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ | |
| 151 | + | |
| 152 | +#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */ | |
| 153 | + | |
| 154 | +#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */ | |
| 155 | + | |
| 156 | +struct fb_fix_screeninfo { | |
| 157 | + char id[16]; /* identification string eg "TT Builtin" */ | |
| 158 | + unsigned long smem_start; /* Start of frame buffer mem */ | |
| 159 | + /* (physical address) */ | |
| 160 | + __u32 smem_len; /* Length of frame buffer mem */ | |
| 161 | + __u32 type; /* see FB_TYPE_* */ | |
| 162 | + __u32 type_aux; /* Interleave for interleaved Planes */ | |
| 163 | + __u32 visual; /* see FB_VISUAL_* */ | |
| 164 | + __u16 xpanstep; /* zero if no hardware panning */ | |
| 165 | + __u16 ypanstep; /* zero if no hardware panning */ | |
| 166 | + __u16 ywrapstep; /* zero if no hardware ywrap */ | |
| 167 | + __u32 line_length; /* length of a line in bytes */ | |
| 168 | + unsigned long mmio_start; /* Start of Memory Mapped I/O */ | |
| 169 | + /* (physical address) */ | |
| 170 | + __u32 mmio_len; /* Length of Memory Mapped I/O */ | |
| 171 | + __u32 accel; /* Indicate to driver which */ | |
| 172 | + /* specific chip/card we have */ | |
| 173 | + __u16 capabilities; /* see FB_CAP_* */ | |
| 174 | + __u16 reserved[2]; /* Reserved for future compatibility */ | |
| 175 | +}; | |
| 176 | + | |
| 177 | +/* Interpretation of offset for color fields: All offsets are from the right, | |
| 178 | + * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you | |
| 179 | + * can use the offset as right argument to <<). A pixel afterwards is a bit | |
| 180 | + * stream and is written to video memory as that unmodified. | |
| 181 | + * | |
| 182 | + * For pseudocolor: offset and length should be the same for all color | |
| 183 | + * components. Offset specifies the position of the least significant bit | |
| 184 | + * of the pallette index in a pixel value. Length indicates the number | |
| 185 | + * of available palette entries (i.e. # of entries = 1 << length). | |
| 186 | + */ | |
| 187 | +struct fb_bitfield { | |
| 188 | + __u32 offset; /* beginning of bitfield */ | |
| 189 | + __u32 length; /* length of bitfield */ | |
| 190 | + __u32 msb_right; /* != 0 : Most significant bit is */ | |
| 191 | + /* right */ | |
| 192 | +}; | |
| 193 | + | |
| 194 | +#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ | |
| 195 | +#define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */ | |
| 196 | + | |
| 197 | +#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ | |
| 198 | +#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ | |
| 199 | +#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ | |
| 200 | +#define FB_ACTIVATE_MASK 15 | |
| 201 | + /* values */ | |
| 202 | +#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ | |
| 203 | +#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ | |
| 204 | +#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */ | |
| 205 | +#define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/ | |
| 206 | +#define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */ | |
| 207 | + | |
| 208 | +#define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */ | |
| 209 | + | |
| 210 | +#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ | |
| 211 | +#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ | |
| 212 | +#define FB_SYNC_EXT 4 /* external sync */ | |
| 213 | +#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ | |
| 214 | +#define FB_SYNC_BROADCAST 16 /* broadcast video timings */ | |
| 215 | + /* vtotal = 144d/288n/576i => PAL */ | |
| 216 | + /* vtotal = 121d/242n/484i => NTSC */ | |
| 217 | +#define FB_SYNC_ON_GREEN 32 /* sync on green */ | |
| 218 | + | |
| 219 | +#define FB_VMODE_NONINTERLACED 0 /* non interlaced */ | |
| 220 | +#define FB_VMODE_INTERLACED 1 /* interlaced */ | |
| 221 | +#define FB_VMODE_DOUBLE 2 /* double scan */ | |
| 222 | +#define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */ | |
| 223 | +#define FB_VMODE_MASK 255 | |
| 224 | + | |
| 225 | +#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ | |
| 226 | +#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ | |
| 227 | +#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ | |
| 228 | + | |
| 229 | +/* | |
| 230 | + * Display rotation support | |
| 231 | + */ | |
| 232 | +#define FB_ROTATE_UR 0 | |
| 233 | +#define FB_ROTATE_CW 1 | |
| 234 | +#define FB_ROTATE_UD 2 | |
| 235 | +#define FB_ROTATE_CCW 3 | |
| 236 | + | |
| 237 | +#define PICOS2KHZ(a) (1000000000UL/(a)) | |
| 238 | +#define KHZ2PICOS(a) (1000000000UL/(a)) | |
| 239 | + | |
| 240 | +struct fb_var_screeninfo { | |
| 241 | + __u32 xres; /* visible resolution */ | |
| 242 | + __u32 yres; | |
| 243 | + __u32 xres_virtual; /* virtual resolution */ | |
| 244 | + __u32 yres_virtual; | |
| 245 | + __u32 xoffset; /* offset from virtual to visible */ | |
| 246 | + __u32 yoffset; /* resolution */ | |
| 247 | + | |
| 248 | + __u32 bits_per_pixel; /* guess what */ | |
| 249 | + __u32 grayscale; /* 0 = color, 1 = grayscale, */ | |
| 250 | + /* >1 = FOURCC */ | |
| 251 | + struct fb_bitfield red; /* bitfield in fb mem if true color, */ | |
| 252 | + struct fb_bitfield green; /* else only length is significant */ | |
| 253 | + struct fb_bitfield blue; | |
| 254 | + struct fb_bitfield transp; /* transparency */ | |
| 255 | + | |
| 256 | + __u32 nonstd; /* != 0 Non standard pixel format */ | |
| 257 | + | |
| 258 | + __u32 activate; /* see FB_ACTIVATE_* */ | |
| 259 | + | |
| 260 | + __u32 height; /* height of picture in mm */ | |
| 261 | + __u32 width; /* width of picture in mm */ | |
| 262 | + | |
| 263 | + __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ | |
| 264 | + | |
| 265 | + /* Timing: All values in pixclocks, except pixclock (of course) */ | |
| 266 | + __u32 pixclock; /* pixel clock in ps (pico seconds) */ | |
| 267 | + __u32 left_margin; /* time from sync to picture */ | |
| 268 | + __u32 right_margin; /* time from picture to sync */ | |
| 269 | + __u32 upper_margin; /* time from sync to picture */ | |
| 270 | + __u32 lower_margin; | |
| 271 | + __u32 hsync_len; /* length of horizontal sync */ | |
| 272 | + __u32 vsync_len; /* length of vertical sync */ | |
| 273 | + __u32 sync; /* see FB_SYNC_* */ | |
| 274 | + __u32 vmode; /* see FB_VMODE_* */ | |
| 275 | + __u32 rotate; /* angle we rotate counter clockwise */ | |
| 276 | + __u32 colorspace; /* colorspace for FOURCC-based modes */ | |
| 277 | + __u32 reserved[4]; /* Reserved for future compatibility */ | |
| 278 | +}; | |
| 279 | + | |
| 280 | +struct fb_cmap { | |
| 281 | + __u32 start; /* First entry */ | |
| 282 | + __u32 len; /* Number of entries */ | |
| 283 | + __u16 *red; /* Red values */ | |
| 284 | + __u16 *green; | |
| 285 | + __u16 *blue; | |
| 286 | + __u16 *transp; /* transparency, can be NULL */ | |
| 287 | +}; | |
| 288 | + | |
| 289 | +struct fb_con2fbmap { | |
| 290 | + __u32 console; | |
| 291 | + __u32 framebuffer; | |
| 292 | +}; | |
| 293 | + | |
| 294 | +/* VESA Blanking Levels */ | |
| 295 | +#define VESA_NO_BLANKING 0 | |
| 296 | +#define VESA_VSYNC_SUSPEND 1 | |
| 297 | +#define VESA_HSYNC_SUSPEND 2 | |
| 298 | +#define VESA_POWERDOWN 3 | |
| 299 | + | |
| 300 | + | |
| 301 | +enum { | |
| 302 | + /* screen: unblanked, hsync: on, vsync: on */ | |
| 303 | + FB_BLANK_UNBLANK = VESA_NO_BLANKING, | |
| 304 | + | |
| 305 | + /* screen: blanked, hsync: on, vsync: on */ | |
| 306 | + FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, | |
| 307 | + | |
| 308 | + /* screen: blanked, hsync: on, vsync: off */ | |
| 309 | + FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, | |
| 310 | + | |
| 311 | + /* screen: blanked, hsync: off, vsync: on */ | |
| 312 | + FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, | |
| 313 | + | |
| 314 | + /* screen: blanked, hsync: off, vsync: off */ | |
| 315 | + FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1 | |
| 316 | +}; | |
| 317 | + | |
| 318 | +#define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */ | |
| 319 | +#define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */ | |
| 320 | +#define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */ | |
| 321 | +#define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */ | |
| 322 | +#define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */ | |
| 323 | +#define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */ | |
| 324 | +#define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */ | |
| 325 | +#define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */ | |
| 326 | +#define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */ | |
| 327 | + | |
| 328 | +struct fb_vblank { | |
| 329 | + __u32 flags; /* FB_VBLANK flags */ | |
| 330 | + __u32 count; /* counter of retraces since boot */ | |
| 331 | + __u32 vcount; /* current scanline position */ | |
| 332 | + __u32 hcount; /* current scandot position */ | |
| 333 | + __u32 reserved[4]; /* reserved for future compatibility */ | |
| 334 | +}; | |
| 335 | + | |
| 336 | +/* Internal HW accel */ | |
| 337 | +#define ROP_COPY 0 | |
| 338 | +#define ROP_XOR 1 | |
| 339 | + | |
| 340 | +struct fb_copyarea { | |
| 341 | + __u32 dx; | |
| 342 | + __u32 dy; | |
| 343 | + __u32 width; | |
| 344 | + __u32 height; | |
| 345 | + __u32 sx; | |
| 346 | + __u32 sy; | |
| 347 | +}; | |
| 348 | + | |
| 349 | +struct fb_fillrect { | |
| 350 | + __u32 dx; /* screen-relative */ | |
| 351 | + __u32 dy; | |
| 352 | + __u32 width; | |
| 353 | + __u32 height; | |
| 354 | + __u32 color; | |
| 355 | + __u32 rop; | |
| 356 | +}; | |
| 357 | + | |
| 358 | +struct fb_image { | |
| 359 | + __u32 dx; /* Where to place image */ | |
| 360 | + __u32 dy; | |
| 361 | + __u32 width; /* Size of image */ | |
| 362 | + __u32 height; | |
| 363 | + __u32 fg_color; /* Only used when a mono bitmap */ | |
| 364 | + __u32 bg_color; | |
| 365 | + __u8 depth; /* Depth of the image */ | |
| 366 | + const char *data; /* Pointer to image data */ | |
| 367 | + struct fb_cmap cmap; /* color map info */ | |
| 368 | +}; | |
| 369 | + | |
| 370 | +/* | |
| 371 | + * hardware cursor control | |
| 372 | + */ | |
| 373 | + | |
| 374 | +#define FB_CUR_SETIMAGE 0x01 | |
| 375 | +#define FB_CUR_SETPOS 0x02 | |
| 376 | +#define FB_CUR_SETHOT 0x04 | |
| 377 | +#define FB_CUR_SETCMAP 0x08 | |
| 378 | +#define FB_CUR_SETSHAPE 0x10 | |
| 379 | +#define FB_CUR_SETSIZE 0x20 | |
| 380 | +#define FB_CUR_SETALL 0xFF | |
| 381 | + | |
| 382 | +struct fbcurpos { | |
| 383 | + __u16 x, y; | |
| 384 | +}; | |
| 385 | + | |
| 386 | +struct fb_cursor { | |
| 387 | + __u16 set; /* what to set */ | |
| 388 | + __u16 enable; /* cursor on/off */ | |
| 389 | + __u16 rop; /* bitop operation */ | |
| 390 | + const char *mask; /* cursor mask bits */ | |
| 391 | + struct fbcurpos hot; /* cursor hot spot */ | |
| 392 | + struct fb_image image; /* Cursor image */ | |
| 393 | +}; | |
| 394 | + | |
| 395 | +#ifdef CONFIG_FB_BACKLIGHT | |
| 396 | +/* Settings for the generic backlight code */ | |
| 397 | +#define FB_BACKLIGHT_LEVELS 128 | |
| 398 | +#define FB_BACKLIGHT_MAX 0xFF | |
| 399 | +#endif | |
| 400 | + | |
| 401 | + | |
| 402 | +#endif /* _UAPI_LINUX_FB_H */ | |
| @@ -0,0 +1,52 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_FCNTL_H | |
| 2 | +#define _UAPI_LINUX_FCNTL_H | |
| 3 | + | |
| 4 | +#include <asm/fcntl.h> | |
| 5 | + | |
| 6 | +#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0) | |
| 7 | +#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1) | |
| 8 | + | |
| 9 | +/* | |
| 10 | + * Cancel a blocking posix lock; internal use only until we expose an | |
| 11 | + * asynchronous lock api to userspace: | |
| 12 | + */ | |
| 13 | +#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5) | |
| 14 | + | |
| 15 | +/* Create a file descriptor with FD_CLOEXEC set. */ | |
| 16 | +#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) | |
| 17 | + | |
| 18 | +/* | |
| 19 | + * Request nofications on a directory. | |
| 20 | + * See below for events that may be notified. | |
| 21 | + */ | |
| 22 | +#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) | |
| 23 | + | |
| 24 | +/* | |
| 25 | + * Set and get of pipe page size array | |
| 26 | + */ | |
| 27 | +#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7) | |
| 28 | +#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) | |
| 29 | + | |
| 30 | +/* | |
| 31 | + * Types of directory notifications that may be requested. | |
| 32 | + */ | |
| 33 | +#define DN_ACCESS 0x00000001 /* File accessed */ | |
| 34 | +#define DN_MODIFY 0x00000002 /* File modified */ | |
| 35 | +#define DN_CREATE 0x00000004 /* File created */ | |
| 36 | +#define DN_DELETE 0x00000008 /* File removed */ | |
| 37 | +#define DN_RENAME 0x00000010 /* File renamed */ | |
| 38 | +#define DN_ATTRIB 0x00000020 /* File changed attibutes */ | |
| 39 | +#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ | |
| 40 | + | |
| 41 | +#define AT_FDCWD -100 /* Special value used to indicate | |
| 42 | + openat should use the current | |
| 43 | + working directory. */ | |
| 44 | +#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */ | |
| 45 | +#define AT_REMOVEDIR 0x200 /* Remove directory instead of | |
| 46 | + unlinking file. */ | |
| 47 | +#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ | |
| 48 | +#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ | |
| 49 | +#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ | |
| 50 | + | |
| 51 | + | |
| 52 | +#endif /* _UAPI_LINUX_FCNTL_H */ | |
| @@ -0,0 +1,382 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_FD_H | |
| 2 | +#define _UAPI_LINUX_FD_H | |
| 3 | + | |
| 4 | +#include <linux/ioctl.h> | |
| 5 | +#include <linux/compiler.h> | |
| 6 | + | |
| 7 | +/* New file layout: Now the ioctl definitions immediately follow the | |
| 8 | + * definitions of the structures that they use */ | |
| 9 | + | |
| 10 | +/* | |
| 11 | + * Geometry | |
| 12 | + */ | |
| 13 | +struct floppy_struct { | |
| 14 | + unsigned int size, /* nr of sectors total */ | |
| 15 | + sect, /* sectors per track */ | |
| 16 | + head, /* nr of heads */ | |
| 17 | + track, /* nr of tracks */ | |
| 18 | + stretch; /* bit 0 !=0 means double track steps */ | |
| 19 | + /* bit 1 != 0 means swap sides */ | |
| 20 | + /* bits 2..9 give the first sector */ | |
| 21 | + /* number (the LSB is flipped) */ | |
| 22 | +#define FD_STRETCH 1 | |
| 23 | +#define FD_SWAPSIDES 2 | |
| 24 | +#define FD_ZEROBASED 4 | |
| 25 | +#define FD_SECTBASEMASK 0x3FC | |
| 26 | +#define FD_MKSECTBASE(s) (((s) ^ 1) << 2) | |
| 27 | +#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) | |
| 28 | + | |
| 29 | + unsigned char gap, /* gap1 size */ | |
| 30 | + | |
| 31 | + rate, /* data rate. |= 0x40 for perpendicular */ | |
| 32 | +#define FD_2M 0x4 | |
| 33 | +#define FD_SIZECODEMASK 0x38 | |
| 34 | +#define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) | |
| 35 | +#define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \ | |
| 36 | + 512 : 128 << FD_SIZECODE(floppy) ) | |
| 37 | +#define FD_PERP 0x40 | |
| 38 | + | |
| 39 | + spec1, /* stepping rate, head unload time */ | |
| 40 | + fmt_gap; /* gap2 size */ | |
| 41 | + const char * name; /* used only for predefined formats */ | |
| 42 | +}; | |
| 43 | + | |
| 44 | + | |
| 45 | +/* commands needing write access have 0x40 set */ | |
| 46 | +/* commands needing super user access have 0x80 set */ | |
| 47 | + | |
| 48 | +#define FDCLRPRM _IO(2, 0x41) | |
| 49 | +/* clear user-defined parameters */ | |
| 50 | + | |
| 51 | +#define FDSETPRM _IOW(2, 0x42, struct floppy_struct) | |
| 52 | +#define FDSETMEDIAPRM FDSETPRM | |
| 53 | +/* set user-defined parameters for current media */ | |
| 54 | + | |
| 55 | +#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) | |
| 56 | +#define FDGETPRM _IOR(2, 0x04, struct floppy_struct) | |
| 57 | +#define FDDEFMEDIAPRM FDDEFPRM | |
| 58 | +#define FDGETMEDIAPRM FDGETPRM | |
| 59 | +/* set/get disk parameters */ | |
| 60 | + | |
| 61 | + | |
| 62 | +#define FDMSGON _IO(2,0x45) | |
| 63 | +#define FDMSGOFF _IO(2,0x46) | |
| 64 | +/* issue/don't issue kernel messages on media type change */ | |
| 65 | + | |
| 66 | + | |
| 67 | +/* | |
| 68 | + * Formatting (obsolete) | |
| 69 | + */ | |
| 70 | +#define FD_FILL_BYTE 0xF6 /* format fill byte. */ | |
| 71 | + | |
| 72 | +struct format_descr { | |
| 73 | + unsigned int device,head,track; | |
| 74 | +}; | |
| 75 | + | |
| 76 | +#define FDFMTBEG _IO(2,0x47) | |
| 77 | +/* begin formatting a disk */ | |
| 78 | +#define FDFMTTRK _IOW(2,0x48, struct format_descr) | |
| 79 | +/* format the specified track */ | |
| 80 | +#define FDFMTEND _IO(2,0x49) | |
| 81 | +/* end formatting a disk */ | |
| 82 | + | |
| 83 | + | |
| 84 | +/* | |
| 85 | + * Error thresholds | |
| 86 | + */ | |
| 87 | +struct floppy_max_errors { | |
| 88 | + unsigned int | |
| 89 | + abort, /* number of errors to be reached before aborting */ | |
| 90 | + read_track, /* maximal number of errors permitted to read an | |
| 91 | + * entire track at once */ | |
| 92 | + reset, /* maximal number of errors before a reset is tried */ | |
| 93 | + recal, /* maximal number of errors before a recalibrate is | |
| 94 | + * tried */ | |
| 95 | + | |
| 96 | + /* | |
| 97 | + * Threshold for reporting FDC errors to the console. | |
| 98 | + * Setting this to zero may flood your screen when using | |
| 99 | + * ultra cheap floppies ;-) | |
| 100 | + */ | |
| 101 | + reporting; | |
| 102 | + | |
| 103 | +}; | |
| 104 | + | |
| 105 | +#define FDSETEMSGTRESH _IO(2,0x4a) | |
| 106 | +/* set fdc error reporting threshold */ | |
| 107 | + | |
| 108 | +#define FDFLUSH _IO(2,0x4b) | |
| 109 | +/* flush buffers for media; either for verifying media, or for | |
| 110 | + * handling a media change without closing the file descriptor */ | |
| 111 | + | |
| 112 | +#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) | |
| 113 | +#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) | |
| 114 | +/* set/get abortion and read_track threshold. See also floppy_drive_params | |
| 115 | + * structure */ | |
| 116 | + | |
| 117 | + | |
| 118 | +typedef char floppy_drive_name[16]; | |
| 119 | +#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) | |
| 120 | +/* get drive type: 5 1/4 or 3 1/2 */ | |
| 121 | + | |
| 122 | + | |
| 123 | +/* | |
| 124 | + * Drive parameters (user modifiable) | |
| 125 | + */ | |
| 126 | +struct floppy_drive_params { | |
| 127 | + signed char cmos; /* CMOS type */ | |
| 128 | + | |
| 129 | + /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms | |
| 130 | + * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). | |
| 131 | + */ | |
| 132 | + unsigned long max_dtr; /* Step rate, usec */ | |
| 133 | + unsigned long hlt; /* Head load/settle time, msec */ | |
| 134 | + unsigned long hut; /* Head unload time (remnant of | |
| 135 | + * 8" drives) */ | |
| 136 | + unsigned long srt; /* Step rate, usec */ | |
| 137 | + | |
| 138 | + unsigned long spinup; /* time needed for spinup (expressed | |
| 139 | + * in jiffies) */ | |
| 140 | + unsigned long spindown; /* timeout needed for spindown */ | |
| 141 | + unsigned char spindown_offset; /* decides in which position the disk | |
| 142 | + * will stop */ | |
| 143 | + unsigned char select_delay; /* delay to wait after select */ | |
| 144 | + unsigned char rps; /* rotations per second */ | |
| 145 | + unsigned char tracks; /* maximum number of tracks */ | |
| 146 | + unsigned long timeout; /* timeout for interrupt requests */ | |
| 147 | + | |
| 148 | + unsigned char interleave_sect; /* if there are more sectors, use | |
| 149 | + * interleave */ | |
| 150 | + | |
| 151 | + struct floppy_max_errors max_errors; | |
| 152 | + | |
| 153 | + char flags; /* various flags, including ftd_msg */ | |
| 154 | +/* | |
| 155 | + * Announce successful media type detection and media information loss after | |
| 156 | + * disk changes. | |
| 157 | + * Also used to enable/disable printing of overrun warnings. | |
| 158 | + */ | |
| 159 | + | |
| 160 | +#define FTD_MSG 0x10 | |
| 161 | +#define FD_BROKEN_DCL 0x20 | |
| 162 | +#define FD_DEBUG 0x02 | |
| 163 | +#define FD_SILENT_DCL_CLEAR 0x4 | |
| 164 | +#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware | |
| 165 | + considerations */ | |
| 166 | + | |
| 167 | + char read_track; /* use readtrack during probing? */ | |
| 168 | + | |
| 169 | +/* | |
| 170 | + * Auto-detection. Each drive type has eight formats which are | |
| 171 | + * used in succession to try to read the disk. If the FDC cannot lock onto | |
| 172 | + * the disk, the next format is tried. This uses the variable 'probing'. | |
| 173 | + */ | |
| 174 | + short autodetect[8]; /* autodetected formats */ | |
| 175 | + | |
| 176 | + int checkfreq; /* how often should the drive be checked for disk | |
| 177 | + * changes */ | |
| 178 | + int native_format; /* native format of this drive */ | |
| 179 | +}; | |
| 180 | + | |
| 181 | +enum { | |
| 182 | + FD_NEED_TWADDLE_BIT, /* more magic */ | |
| 183 | + FD_VERIFY_BIT, /* inquire for write protection */ | |
| 184 | + FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet | |
| 185 | + * to clear media change status */ | |
| 186 | + FD_UNUSED_BIT, | |
| 187 | + FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ | |
| 188 | + FD_DISK_WRITABLE_BIT /* disk is writable */ | |
| 189 | +}; | |
| 190 | + | |
| 191 | +#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) | |
| 192 | +#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) | |
| 193 | +/* set/get drive parameters */ | |
| 194 | + | |
| 195 | + | |
| 196 | +/* | |
| 197 | + * Current drive state (not directly modifiable by user, readonly) | |
| 198 | + */ | |
| 199 | +struct floppy_drive_struct { | |
| 200 | + unsigned long flags; | |
| 201 | +/* values for these flags */ | |
| 202 | +#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) | |
| 203 | +#define FD_VERIFY (1 << FD_VERIFY_BIT) | |
| 204 | +#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) | |
| 205 | +#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) | |
| 206 | +#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) | |
| 207 | + | |
| 208 | + unsigned long spinup_date; | |
| 209 | + unsigned long select_date; | |
| 210 | + unsigned long first_read_date; | |
| 211 | + short probed_format; | |
| 212 | + short track; /* current track */ | |
| 213 | + short maxblock; /* id of highest block read */ | |
| 214 | + short maxtrack; /* id of highest half track read */ | |
| 215 | + int generation; /* how many diskchanges? */ | |
| 216 | + | |
| 217 | +/* | |
| 218 | + * (User-provided) media information is _not_ discarded after a media change | |
| 219 | + * if the corresponding keep_data flag is non-zero. Positive values are | |
| 220 | + * decremented after each probe. | |
| 221 | + */ | |
| 222 | + int keep_data; | |
| 223 | + | |
| 224 | + /* Prevent "aliased" accesses. */ | |
| 225 | + int fd_ref; | |
| 226 | + int fd_device; | |
| 227 | + unsigned long last_checked; /* when was the drive last checked for a disk | |
| 228 | + * change? */ | |
| 229 | + | |
| 230 | + char *dmabuf; | |
| 231 | + int bufblocks; | |
| 232 | +}; | |
| 233 | + | |
| 234 | +#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) | |
| 235 | +#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) | |
| 236 | +/* get drive state: GET returns the cached state, POLL polls for new state */ | |
| 237 | + | |
| 238 | + | |
| 239 | +/* | |
| 240 | + * reset FDC | |
| 241 | + */ | |
| 242 | +enum reset_mode { | |
| 243 | + FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */ | |
| 244 | + FD_RESET_IF_RAWCMD, /* obsolete */ | |
| 245 | + FD_RESET_ALWAYS /* reset always */ | |
| 246 | +}; | |
| 247 | +#define FDRESET _IO(2, 0x54) | |
| 248 | + | |
| 249 | + | |
| 250 | +/* | |
| 251 | + * FDC state | |
| 252 | + */ | |
| 253 | +struct floppy_fdc_state { | |
| 254 | + int spec1; /* spec1 value last used */ | |
| 255 | + int spec2; /* spec2 value last used */ | |
| 256 | + int dtr; | |
| 257 | + unsigned char version; /* FDC version code */ | |
| 258 | + unsigned char dor; | |
| 259 | + unsigned long address; /* io address */ | |
| 260 | + unsigned int rawcmd:2; | |
| 261 | + unsigned int reset:1; | |
| 262 | + unsigned int need_configure:1; | |
| 263 | + unsigned int perp_mode:2; | |
| 264 | + unsigned int has_fifo:1; | |
| 265 | + unsigned int driver_version; /* version code for floppy driver */ | |
| 266 | +#define FD_DRIVER_VERSION 0x100 | |
| 267 | +/* user programs using the floppy API should use floppy_fdc_state to | |
| 268 | + * get the version number of the floppy driver that they are running | |
| 269 | + * on. If this version number is bigger than the one compiled into the | |
| 270 | + * user program (the FD_DRIVER_VERSION define), it should be prepared | |
| 271 | + * to bigger structures | |
| 272 | + */ | |
| 273 | + | |
| 274 | + unsigned char track[4]; | |
| 275 | + /* Position of the heads of the 4 units attached to this FDC, | |
| 276 | + * as stored on the FDC. In the future, the position as stored | |
| 277 | + * on the FDC might not agree with the actual physical | |
| 278 | + * position of these drive heads. By allowing such | |
| 279 | + * disagreement, it will be possible to reset the FDC without | |
| 280 | + * incurring the expensive cost of repositioning all heads. | |
| 281 | + * Right now, these positions are hard wired to 0. */ | |
| 282 | + | |
| 283 | +}; | |
| 284 | + | |
| 285 | +#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) | |
| 286 | + | |
| 287 | + | |
| 288 | +/* | |
| 289 | + * Asynchronous Write error tracking | |
| 290 | + */ | |
| 291 | +struct floppy_write_errors { | |
| 292 | + /* Write error logging. | |
| 293 | + * | |
| 294 | + * These fields can be cleared with the FDWERRORCLR ioctl. | |
| 295 | + * Only writes that were attempted but failed due to a physical media | |
| 296 | + * error are logged. write(2) calls that fail and return an error code | |
| 297 | + * to the user process are not counted. | |
| 298 | + */ | |
| 299 | + | |
| 300 | + unsigned int write_errors; /* number of physical write errors | |
| 301 | + * encountered */ | |
| 302 | + | |
| 303 | + /* position of first and last write errors */ | |
| 304 | + unsigned long first_error_sector; | |
| 305 | + int first_error_generation; | |
| 306 | + unsigned long last_error_sector; | |
| 307 | + int last_error_generation; | |
| 308 | + | |
| 309 | + unsigned int badness; /* highest retry count for a read or write | |
| 310 | + * operation */ | |
| 311 | +}; | |
| 312 | + | |
| 313 | +#define FDWERRORCLR _IO(2, 0x56) | |
| 314 | +/* clear write error and badness information */ | |
| 315 | +#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) | |
| 316 | +/* get write error and badness information */ | |
| 317 | + | |
| 318 | + | |
| 319 | +/* | |
| 320 | + * Raw commands | |
| 321 | + */ | |
| 322 | +/* new interface flag: now we can do them in batches */ | |
| 323 | +#define FDHAVEBATCHEDRAWCMD | |
| 324 | + | |
| 325 | +struct floppy_raw_cmd { | |
| 326 | + unsigned int flags; | |
| 327 | +#define FD_RAW_READ 1 | |
| 328 | +#define FD_RAW_WRITE 2 | |
| 329 | +#define FD_RAW_NO_MOTOR 4 | |
| 330 | +#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ | |
| 331 | +#define FD_RAW_INTR 8 /* wait for an interrupt */ | |
| 332 | +#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ | |
| 333 | +#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command | |
| 334 | + * completion */ | |
| 335 | +#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ | |
| 336 | +#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ | |
| 337 | + | |
| 338 | +/* more "in" flags */ | |
| 339 | +#define FD_RAW_MORE 0x100 /* more records follow */ | |
| 340 | +#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */ | |
| 341 | +#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */ | |
| 342 | +#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure | |
| 343 | + * detection too */ | |
| 344 | + | |
| 345 | +/* more "out" flags */ | |
| 346 | +#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ | |
| 347 | +#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ | |
| 348 | + | |
| 349 | + void __user *data; | |
| 350 | + char *kernel_data; /* location of data buffer in the kernel */ | |
| 351 | + struct floppy_raw_cmd *next; /* used for chaining of raw cmd's | |
| 352 | + * within the kernel */ | |
| 353 | + long length; /* in: length of dma transfer. out: remaining bytes */ | |
| 354 | + long phys_length; /* physical length, if different from dma length */ | |
| 355 | + int buffer_length; /* length of allocated buffer */ | |
| 356 | + | |
| 357 | + unsigned char rate; | |
| 358 | + unsigned char cmd_count; | |
| 359 | + unsigned char cmd[16]; | |
| 360 | + unsigned char reply_count; | |
| 361 | + unsigned char reply[16]; | |
| 362 | + int track; | |
| 363 | + int resultcode; | |
| 364 | + | |
| 365 | + int reserved1; | |
| 366 | + int reserved2; | |
| 367 | +}; | |
| 368 | + | |
| 369 | +#define FDRAWCMD _IO(2, 0x58) | |
| 370 | +/* send a raw command to the fdc. Structure size not included, because of | |
| 371 | + * batches */ | |
| 372 | + | |
| 373 | +#define FDTWADDLE _IO(2, 0x59) | |
| 374 | +/* flicker motor-on bit before reading a sector. Experimental */ | |
| 375 | + | |
| 376 | + | |
| 377 | +#define FDEJECT _IO(2, 0x5a) | |
| 378 | +/* eject the disk */ | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | +#endif /* _UAPI_LINUX_FD_H */ | |
| @@ -0,0 +1,137 @@ | ||
| 1 | +#ifndef _LINUX_FDREG_H | |
| 2 | +#define _LINUX_FDREG_H | |
| 3 | +/* | |
| 4 | + * This file contains some defines for the floppy disk controller. | |
| 5 | + * Various sources. Mostly "IBM Microcomputers: A Programmers | |
| 6 | + * Handbook", Sanches and Canton. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#ifdef FDPATCHES | |
| 10 | +#define FD_IOPORT fdc_state[fdc].address | |
| 11 | +#else | |
| 12 | +/* It would be a lot saner just to force fdc_state[fdc].address to always | |
| 13 | + be set ! FIXME */ | |
| 14 | +#define FD_IOPORT 0x3f0 | |
| 15 | +#endif | |
| 16 | + | |
| 17 | +/* Fd controller regs. S&C, about page 340 */ | |
| 18 | +#define FD_STATUS (4 + FD_IOPORT ) | |
| 19 | +#define FD_DATA (5 + FD_IOPORT ) | |
| 20 | + | |
| 21 | +/* Digital Output Register */ | |
| 22 | +#define FD_DOR (2 + FD_IOPORT ) | |
| 23 | + | |
| 24 | +/* Digital Input Register (read) */ | |
| 25 | +#define FD_DIR (7 + FD_IOPORT ) | |
| 26 | + | |
| 27 | +/* Diskette Control Register (write)*/ | |
| 28 | +#define FD_DCR (7 + FD_IOPORT ) | |
| 29 | + | |
| 30 | +/* Bits of main status register */ | |
| 31 | +#define STATUS_BUSYMASK 0x0F /* drive busy mask */ | |
| 32 | +#define STATUS_BUSY 0x10 /* FDC busy */ | |
| 33 | +#define STATUS_DMA 0x20 /* 0- DMA mode */ | |
| 34 | +#define STATUS_DIR 0x40 /* 0- cpu->fdc */ | |
| 35 | +#define STATUS_READY 0x80 /* Data reg ready */ | |
| 36 | + | |
| 37 | +/* Bits of FD_ST0 */ | |
| 38 | +#define ST0_DS 0x03 /* drive select mask */ | |
| 39 | +#define ST0_HA 0x04 /* Head (Address) */ | |
| 40 | +#define ST0_NR 0x08 /* Not Ready */ | |
| 41 | +#define ST0_ECE 0x10 /* Equipment check error */ | |
| 42 | +#define ST0_SE 0x20 /* Seek end */ | |
| 43 | +#define ST0_INTR 0xC0 /* Interrupt code mask */ | |
| 44 | + | |
| 45 | +/* Bits of FD_ST1 */ | |
| 46 | +#define ST1_MAM 0x01 /* Missing Address Mark */ | |
| 47 | +#define ST1_WP 0x02 /* Write Protect */ | |
| 48 | +#define ST1_ND 0x04 /* No Data - unreadable */ | |
| 49 | +#define ST1_OR 0x10 /* OverRun */ | |
| 50 | +#define ST1_CRC 0x20 /* CRC error in data or addr */ | |
| 51 | +#define ST1_EOC 0x80 /* End Of Cylinder */ | |
| 52 | + | |
| 53 | +/* Bits of FD_ST2 */ | |
| 54 | +#define ST2_MAM 0x01 /* Missing Address Mark (again) */ | |
| 55 | +#define ST2_BC 0x02 /* Bad Cylinder */ | |
| 56 | +#define ST2_SNS 0x04 /* Scan Not Satisfied */ | |
| 57 | +#define ST2_SEH 0x08 /* Scan Equal Hit */ | |
| 58 | +#define ST2_WC 0x10 /* Wrong Cylinder */ | |
| 59 | +#define ST2_CRC 0x20 /* CRC error in data field */ | |
| 60 | +#define ST2_CM 0x40 /* Control Mark = deleted */ | |
| 61 | + | |
| 62 | +/* Bits of FD_ST3 */ | |
| 63 | +#define ST3_HA 0x04 /* Head (Address) */ | |
| 64 | +#define ST3_DS 0x08 /* drive is double-sided */ | |
| 65 | +#define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */ | |
| 66 | +#define ST3_RY 0x20 /* drive is ready */ | |
| 67 | +#define ST3_WP 0x40 /* Write Protect */ | |
| 68 | +#define ST3_FT 0x80 /* Drive Fault */ | |
| 69 | + | |
| 70 | +/* Values for FD_COMMAND */ | |
| 71 | +#define FD_RECALIBRATE 0x07 /* move to track 0 */ | |
| 72 | +#define FD_SEEK 0x0F /* seek track */ | |
| 73 | +#define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */ | |
| 74 | +#define FD_WRITE 0xC5 /* write with MT, MFM */ | |
| 75 | +#define FD_SENSEI 0x08 /* Sense Interrupt Status */ | |
| 76 | +#define FD_SPECIFY 0x03 /* specify HUT etc */ | |
| 77 | +#define FD_FORMAT 0x4D /* format one track */ | |
| 78 | +#define FD_VERSION 0x10 /* get version code */ | |
| 79 | +#define FD_CONFIGURE 0x13 /* configure FIFO operation */ | |
| 80 | +#define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */ | |
| 81 | +#define FD_GETSTATUS 0x04 /* read ST3 */ | |
| 82 | +#define FD_DUMPREGS 0x0E /* dump the contents of the fdc regs */ | |
| 83 | +#define FD_READID 0xEA /* prints the header of a sector */ | |
| 84 | +#define FD_UNLOCK 0x14 /* Fifo config unlock */ | |
| 85 | +#define FD_LOCK 0x94 /* Fifo config lock */ | |
| 86 | +#define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */ | |
| 87 | +#define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */ | |
| 88 | + | |
| 89 | +/* the following commands are new in the 82078. They are not used in the | |
| 90 | + * floppy driver, except the first three. These commands may be useful for apps | |
| 91 | + * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at | |
| 92 | + * http://www.intel.com/design/archives/periphrl/docs/29046803.htm */ | |
| 93 | + | |
| 94 | +#define FD_PARTID 0x18 /* part id ("extended" version cmd) */ | |
| 95 | +#define FD_SAVE 0x2e /* save fdc regs for later restore */ | |
| 96 | +#define FD_DRIVESPEC 0x8e /* drive specification: Access to the | |
| 97 | + * 2 Mbps data transfer rate for tape | |
| 98 | + * drives */ | |
| 99 | + | |
| 100 | +#define FD_RESTORE 0x4e /* later restore */ | |
| 101 | +#define FD_POWERDOWN 0x27 /* configure FDC's powersave features */ | |
| 102 | +#define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */ | |
| 103 | +#define FD_OPTION 0x33 /* ISO format (which is a clean way to | |
| 104 | + * pack more sectors on a track) */ | |
| 105 | + | |
| 106 | +/* DMA commands */ | |
| 107 | +#define DMA_READ 0x46 | |
| 108 | +#define DMA_WRITE 0x4A | |
| 109 | + | |
| 110 | +/* FDC version return types */ | |
| 111 | +#define FDC_NONE 0x00 | |
| 112 | +#define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION | |
| 113 | + FAILS EARLY */ | |
| 114 | +#define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */ | |
| 115 | +#define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */ | |
| 116 | +#define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */ | |
| 117 | +#define FDC_82072A 0x45 /* 82072A (on Sparcs) */ | |
| 118 | +#define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */ | |
| 119 | +#define FDC_82077 0x52 /* 82077AA-1 */ | |
| 120 | +#define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */ | |
| 121 | +#define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */ | |
| 122 | +#define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */ | |
| 123 | +#define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB | |
| 124 | + * SCSI/EIDE/Floppy controller) */ | |
| 125 | +#define FDC_87306 0x63 /* National Semiconductor PC 87306 */ | |
| 126 | + | |
| 127 | +/* | |
| 128 | + * Beware: the fdc type list is roughly sorted by increasing features. | |
| 129 | + * Presence of features is tested by comparing the FDC version id with the | |
| 130 | + * "oldest" version that has the needed feature. | |
| 131 | + * If during FDC detection, an obscure test fails late in the sequence, don't | |
| 132 | + * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse. | |
| 133 | + * This is especially true if the tests are unneeded. | |
| 134 | + */ | |
| 135 | + | |
| 136 | +#define FD_RESET_DELAY 20 | |
| 137 | +#endif | |
| @@ -0,0 +1,72 @@ | ||
| 1 | +#ifndef __LINUX_FIB_RULES_H | |
| 2 | +#define __LINUX_FIB_RULES_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/rtnetlink.h> | |
| 6 | + | |
| 7 | +/* rule is permanent, and cannot be deleted */ | |
| 8 | +#define FIB_RULE_PERMANENT 0x00000001 | |
| 9 | +#define FIB_RULE_INVERT 0x00000002 | |
| 10 | +#define FIB_RULE_UNRESOLVED 0x00000004 | |
| 11 | +#define FIB_RULE_IIF_DETACHED 0x00000008 | |
| 12 | +#define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED | |
| 13 | +#define FIB_RULE_OIF_DETACHED 0x00000010 | |
| 14 | + | |
| 15 | +/* try to find source address in routing lookups */ | |
| 16 | +#define FIB_RULE_FIND_SADDR 0x00010000 | |
| 17 | + | |
| 18 | +struct fib_rule_hdr { | |
| 19 | + __u8 family; | |
| 20 | + __u8 dst_len; | |
| 21 | + __u8 src_len; | |
| 22 | + __u8 tos; | |
| 23 | + | |
| 24 | + __u8 table; | |
| 25 | + __u8 res1; /* reserved */ | |
| 26 | + __u8 res2; /* reserved */ | |
| 27 | + __u8 action; | |
| 28 | + | |
| 29 | + __u32 flags; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +enum { | |
| 33 | + FRA_UNSPEC, | |
| 34 | + FRA_DST, /* destination address */ | |
| 35 | + FRA_SRC, /* source address */ | |
| 36 | + FRA_IIFNAME, /* interface name */ | |
| 37 | +#define FRA_IFNAME FRA_IIFNAME | |
| 38 | + FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ | |
| 39 | + FRA_UNUSED2, | |
| 40 | + FRA_PRIORITY, /* priority/preference */ | |
| 41 | + FRA_UNUSED3, | |
| 42 | + FRA_UNUSED4, | |
| 43 | + FRA_UNUSED5, | |
| 44 | + FRA_FWMARK, /* mark */ | |
| 45 | + FRA_FLOW, /* flow/class id */ | |
| 46 | + FRA_UNUSED6, | |
| 47 | + FRA_UNUSED7, | |
| 48 | + FRA_UNUSED8, | |
| 49 | + FRA_TABLE, /* Extended table id */ | |
| 50 | + FRA_FWMASK, /* mask for netfilter mark */ | |
| 51 | + FRA_OIFNAME, | |
| 52 | + __FRA_MAX | |
| 53 | +}; | |
| 54 | + | |
| 55 | +#define FRA_MAX (__FRA_MAX - 1) | |
| 56 | + | |
| 57 | +enum { | |
| 58 | + FR_ACT_UNSPEC, | |
| 59 | + FR_ACT_TO_TBL, /* Pass to fixed table */ | |
| 60 | + FR_ACT_GOTO, /* Jump to another rule */ | |
| 61 | + FR_ACT_NOP, /* No operation */ | |
| 62 | + FR_ACT_RES3, | |
| 63 | + FR_ACT_RES4, | |
| 64 | + FR_ACT_BLACKHOLE, /* Drop without notification */ | |
| 65 | + FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ | |
| 66 | + FR_ACT_PROHIBIT, /* Drop with EACCES */ | |
| 67 | + __FR_ACT_MAX, | |
| 68 | +}; | |
| 69 | + | |
| 70 | +#define FR_ACT_MAX (__FR_ACT_MAX - 1) | |
| 71 | + | |
| 72 | +#endif | |
| @@ -0,0 +1,68 @@ | ||
| 1 | +/* | |
| 2 | + * FS_IOC_FIEMAP ioctl infrastructure. | |
| 3 | + * | |
| 4 | + * Some portions copyright (C) 2007 Cluster File Systems, Inc | |
| 5 | + * | |
| 6 | + * Authors: Mark Fasheh <mfasheh@suse.com> | |
| 7 | + * Kalpak Shah <kalpak.shah@sun.com> | |
| 8 | + * Andreas Dilger <adilger@sun.com> | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#ifndef _LINUX_FIEMAP_H | |
| 12 | +#define _LINUX_FIEMAP_H | |
| 13 | + | |
| 14 | +#include <linux/types.h> | |
| 15 | + | |
| 16 | +struct fiemap_extent { | |
| 17 | + __u64 fe_logical; /* logical offset in bytes for the start of | |
| 18 | + * the extent from the beginning of the file */ | |
| 19 | + __u64 fe_physical; /* physical offset in bytes for the start | |
| 20 | + * of the extent from the beginning of the disk */ | |
| 21 | + __u64 fe_length; /* length in bytes for this extent */ | |
| 22 | + __u64 fe_reserved64[2]; | |
| 23 | + __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ | |
| 24 | + __u32 fe_reserved[3]; | |
| 25 | +}; | |
| 26 | + | |
| 27 | +struct fiemap { | |
| 28 | + __u64 fm_start; /* logical offset (inclusive) at | |
| 29 | + * which to start mapping (in) */ | |
| 30 | + __u64 fm_length; /* logical length of mapping which | |
| 31 | + * userspace wants (in) */ | |
| 32 | + __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ | |
| 33 | + __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ | |
| 34 | + __u32 fm_extent_count; /* size of fm_extents array (in) */ | |
| 35 | + __u32 fm_reserved; | |
| 36 | + struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ | |
| 37 | +}; | |
| 38 | + | |
| 39 | +#define FIEMAP_MAX_OFFSET (~0ULL) | |
| 40 | + | |
| 41 | +#define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ | |
| 42 | +#define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ | |
| 43 | + | |
| 44 | +#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) | |
| 45 | + | |
| 46 | +#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ | |
| 47 | +#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ | |
| 48 | +#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. | |
| 49 | + * Sets EXTENT_UNKNOWN. */ | |
| 50 | +#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read | |
| 51 | + * while fs is unmounted */ | |
| 52 | +#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. | |
| 53 | + * Sets EXTENT_NO_BYPASS. */ | |
| 54 | +#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be | |
| 55 | + * block aligned. */ | |
| 56 | +#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. | |
| 57 | + * Sets EXTENT_NOT_ALIGNED.*/ | |
| 58 | +#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. | |
| 59 | + * Sets EXTENT_NOT_ALIGNED.*/ | |
| 60 | +#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but | |
| 61 | + * no data (i.e. zero). */ | |
| 62 | +#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | |
| 63 | + * support extents. Result | |
| 64 | + * merged for efficiency. */ | |
| 65 | +#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other | |
| 66 | + * files. */ | |
| 67 | + | |
| 68 | +#endif /* _LINUX_FIEMAP_H */ | |
| @@ -0,0 +1,135 @@ | ||
| 1 | +/* | |
| 2 | + * Linux Socket Filter Data Structures | |
| 3 | + */ | |
| 4 | + | |
| 5 | +#ifndef _UAPI__LINUX_FILTER_H__ | |
| 6 | +#define _UAPI__LINUX_FILTER_H__ | |
| 7 | + | |
| 8 | +#include <linux/compiler.h> | |
| 9 | +#include <linux/types.h> | |
| 10 | + | |
| 11 | + | |
| 12 | +/* | |
| 13 | + * Current version of the filter code architecture. | |
| 14 | + */ | |
| 15 | +#define BPF_MAJOR_VERSION 1 | |
| 16 | +#define BPF_MINOR_VERSION 1 | |
| 17 | + | |
| 18 | +/* | |
| 19 | + * Try and keep these values and structures similar to BSD, especially | |
| 20 | + * the BPF code definitions which need to match so you can share filters | |
| 21 | + */ | |
| 22 | + | |
| 23 | +struct sock_filter { /* Filter block */ | |
| 24 | + __u16 code; /* Actual filter code */ | |
| 25 | + __u8 jt; /* Jump true */ | |
| 26 | + __u8 jf; /* Jump false */ | |
| 27 | + __u32 k; /* Generic multiuse field */ | |
| 28 | +}; | |
| 29 | + | |
| 30 | +struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ | |
| 31 | + unsigned short len; /* Number of filter blocks */ | |
| 32 | + struct sock_filter __user *filter; | |
| 33 | +}; | |
| 34 | + | |
| 35 | +/* | |
| 36 | + * Instruction classes | |
| 37 | + */ | |
| 38 | + | |
| 39 | +#define BPF_CLASS(code) ((code) & 0x07) | |
| 40 | +#define BPF_LD 0x00 | |
| 41 | +#define BPF_LDX 0x01 | |
| 42 | +#define BPF_ST 0x02 | |
| 43 | +#define BPF_STX 0x03 | |
| 44 | +#define BPF_ALU 0x04 | |
| 45 | +#define BPF_JMP 0x05 | |
| 46 | +#define BPF_RET 0x06 | |
| 47 | +#define BPF_MISC 0x07 | |
| 48 | + | |
| 49 | +/* ld/ldx fields */ | |
| 50 | +#define BPF_SIZE(code) ((code) & 0x18) | |
| 51 | +#define BPF_W 0x00 | |
| 52 | +#define BPF_H 0x08 | |
| 53 | +#define BPF_B 0x10 | |
| 54 | +#define BPF_MODE(code) ((code) & 0xe0) | |
| 55 | +#define BPF_IMM 0x00 | |
| 56 | +#define BPF_ABS 0x20 | |
| 57 | +#define BPF_IND 0x40 | |
| 58 | +#define BPF_MEM 0x60 | |
| 59 | +#define BPF_LEN 0x80 | |
| 60 | +#define BPF_MSH 0xa0 | |
| 61 | + | |
| 62 | +/* alu/jmp fields */ | |
| 63 | +#define BPF_OP(code) ((code) & 0xf0) | |
| 64 | +#define BPF_ADD 0x00 | |
| 65 | +#define BPF_SUB 0x10 | |
| 66 | +#define BPF_MUL 0x20 | |
| 67 | +#define BPF_DIV 0x30 | |
| 68 | +#define BPF_OR 0x40 | |
| 69 | +#define BPF_AND 0x50 | |
| 70 | +#define BPF_LSH 0x60 | |
| 71 | +#define BPF_RSH 0x70 | |
| 72 | +#define BPF_NEG 0x80 | |
| 73 | +#define BPF_MOD 0x90 | |
| 74 | +#define BPF_XOR 0xa0 | |
| 75 | + | |
| 76 | +#define BPF_JA 0x00 | |
| 77 | +#define BPF_JEQ 0x10 | |
| 78 | +#define BPF_JGT 0x20 | |
| 79 | +#define BPF_JGE 0x30 | |
| 80 | +#define BPF_JSET 0x40 | |
| 81 | +#define BPF_SRC(code) ((code) & 0x08) | |
| 82 | +#define BPF_K 0x00 | |
| 83 | +#define BPF_X 0x08 | |
| 84 | + | |
| 85 | +/* ret - BPF_K and BPF_X also apply */ | |
| 86 | +#define BPF_RVAL(code) ((code) & 0x18) | |
| 87 | +#define BPF_A 0x10 | |
| 88 | + | |
| 89 | +/* misc */ | |
| 90 | +#define BPF_MISCOP(code) ((code) & 0xf8) | |
| 91 | +#define BPF_TAX 0x00 | |
| 92 | +#define BPF_TXA 0x80 | |
| 93 | + | |
| 94 | +#ifndef BPF_MAXINSNS | |
| 95 | +#define BPF_MAXINSNS 4096 | |
| 96 | +#endif | |
| 97 | + | |
| 98 | +/* | |
| 99 | + * Macros for filter block array initializers. | |
| 100 | + */ | |
| 101 | +#ifndef BPF_STMT | |
| 102 | +#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } | |
| 103 | +#endif | |
| 104 | +#ifndef BPF_JUMP | |
| 105 | +#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } | |
| 106 | +#endif | |
| 107 | + | |
| 108 | +/* | |
| 109 | + * Number of scratch memory words for: BPF_ST and BPF_STX | |
| 110 | + */ | |
| 111 | +#define BPF_MEMWORDS 16 | |
| 112 | + | |
| 113 | +/* RATIONALE. Negative offsets are invalid in BPF. | |
| 114 | + We use them to reference ancillary data. | |
| 115 | + Unlike introduction new instructions, it does not break | |
| 116 | + existing compilers/optimizers. | |
| 117 | + */ | |
| 118 | +#define SKF_AD_OFF (-0x1000) | |
| 119 | +#define SKF_AD_PROTOCOL 0 | |
| 120 | +#define SKF_AD_PKTTYPE 4 | |
| 121 | +#define SKF_AD_IFINDEX 8 | |
| 122 | +#define SKF_AD_NLATTR 12 | |
| 123 | +#define SKF_AD_NLATTR_NEST 16 | |
| 124 | +#define SKF_AD_MARK 20 | |
| 125 | +#define SKF_AD_QUEUE 24 | |
| 126 | +#define SKF_AD_HATYPE 28 | |
| 127 | +#define SKF_AD_RXHASH 32 | |
| 128 | +#define SKF_AD_CPU 36 | |
| 129 | +#define SKF_AD_ALU_XOR_X 40 | |
| 130 | +#define SKF_AD_MAX 44 | |
| 131 | +#define SKF_NET_OFF (-0x100000) | |
| 132 | +#define SKF_LL_OFF (-0x200000) | |
| 133 | + | |
| 134 | + | |
| 135 | +#endif /* _UAPI__LINUX_FILTER_H__ */ | |
| @@ -0,0 +1,1039 @@ | ||
| 1 | +/* | |
| 2 | + * Char device interface. | |
| 3 | + * | |
| 4 | + * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> | |
| 5 | + * | |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 7 | + * copy of this software and associated documentation files (the "Software"), | |
| 8 | + * to deal in the Software without restriction, including without limitation | |
| 9 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 10 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 11 | + * Software is furnished to do so, subject to the following conditions: | |
| 12 | + * | |
| 13 | + * The above copyright notice and this permission notice (including the next | |
| 14 | + * paragraph) shall be included in all copies or substantial portions of the | |
| 15 | + * Software. | |
| 16 | + * | |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 20 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 21 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 22 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 23 | + * DEALINGS IN THE SOFTWARE. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#ifndef _LINUX_FIREWIRE_CDEV_H | |
| 27 | +#define _LINUX_FIREWIRE_CDEV_H | |
| 28 | + | |
| 29 | +#include <linux/ioctl.h> | |
| 30 | +#include <linux/types.h> | |
| 31 | +#include <linux/firewire-constants.h> | |
| 32 | + | |
| 33 | +/* available since kernel version 2.6.22 */ | |
| 34 | +#define FW_CDEV_EVENT_BUS_RESET 0x00 | |
| 35 | +#define FW_CDEV_EVENT_RESPONSE 0x01 | |
| 36 | +#define FW_CDEV_EVENT_REQUEST 0x02 | |
| 37 | +#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 | |
| 38 | + | |
| 39 | +/* available since kernel version 2.6.30 */ | |
| 40 | +#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 | |
| 41 | +#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 | |
| 42 | + | |
| 43 | +/* available since kernel version 2.6.36 */ | |
| 44 | +#define FW_CDEV_EVENT_REQUEST2 0x06 | |
| 45 | +#define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07 | |
| 46 | +#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08 | |
| 47 | +#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09 | |
| 48 | + | |
| 49 | +/** | |
| 50 | + * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types | |
| 51 | + * @closure: For arbitrary use by userspace | |
| 52 | + * @type: Discriminates the fw_cdev_event_ types | |
| 53 | + * | |
| 54 | + * This struct may be used to access generic members of all fw_cdev_event_ | |
| 55 | + * types regardless of the specific type. | |
| 56 | + * | |
| 57 | + * Data passed in the @closure field for a request will be returned in the | |
| 58 | + * corresponding event. It is big enough to hold a pointer on all platforms. | |
| 59 | + * The ioctl used to set @closure depends on the @type of event. | |
| 60 | + */ | |
| 61 | +struct fw_cdev_event_common { | |
| 62 | + __u64 closure; | |
| 63 | + __u32 type; | |
| 64 | +}; | |
| 65 | + | |
| 66 | +/** | |
| 67 | + * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred | |
| 68 | + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl | |
| 69 | + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET | |
| 70 | + * @node_id: New node ID of this node | |
| 71 | + * @local_node_id: Node ID of the local node, i.e. of the controller | |
| 72 | + * @bm_node_id: Node ID of the bus manager | |
| 73 | + * @irm_node_id: Node ID of the iso resource manager | |
| 74 | + * @root_node_id: Node ID of the root node | |
| 75 | + * @generation: New bus generation | |
| 76 | + * | |
| 77 | + * This event is sent when the bus the device belongs to goes through a bus | |
| 78 | + * reset. It provides information about the new bus configuration, such as | |
| 79 | + * new node ID for this device, new root ID, and others. | |
| 80 | + * | |
| 81 | + * If @bm_node_id is 0xffff right after bus reset it can be reread by an | |
| 82 | + * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished. | |
| 83 | + * Kernels with ABI version < 4 do not set @bm_node_id. | |
| 84 | + */ | |
| 85 | +struct fw_cdev_event_bus_reset { | |
| 86 | + __u64 closure; | |
| 87 | + __u32 type; | |
| 88 | + __u32 node_id; | |
| 89 | + __u32 local_node_id; | |
| 90 | + __u32 bm_node_id; | |
| 91 | + __u32 irm_node_id; | |
| 92 | + __u32 root_node_id; | |
| 93 | + __u32 generation; | |
| 94 | +}; | |
| 95 | + | |
| 96 | +/** | |
| 97 | + * struct fw_cdev_event_response - Sent when a response packet was received | |
| 98 | + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST | |
| 99 | + * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST | |
| 100 | + * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl | |
| 101 | + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE | |
| 102 | + * @rcode: Response code returned by the remote node | |
| 103 | + * @length: Data length, i.e. the response's payload size in bytes | |
| 104 | + * @data: Payload data, if any | |
| 105 | + * | |
| 106 | + * This event is sent when the stack receives a response to an outgoing request | |
| 107 | + * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses | |
| 108 | + * carrying data (read and lock responses) follows immediately and can be | |
| 109 | + * accessed through the @data field. | |
| 110 | + * | |
| 111 | + * The event is also generated after conclusions of transactions that do not | |
| 112 | + * involve response packets. This includes unified write transactions, | |
| 113 | + * broadcast write transactions, and transmission of asynchronous stream | |
| 114 | + * packets. @rcode indicates success or failure of such transmissions. | |
| 115 | + */ | |
| 116 | +struct fw_cdev_event_response { | |
| 117 | + __u64 closure; | |
| 118 | + __u32 type; | |
| 119 | + __u32 rcode; | |
| 120 | + __u32 length; | |
| 121 | + __u32 data[0]; | |
| 122 | +}; | |
| 123 | + | |
| 124 | +/** | |
| 125 | + * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2 | |
| 126 | + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST | |
| 127 | + * | |
| 128 | + * This event is sent instead of &fw_cdev_event_request2 if the kernel or | |
| 129 | + * the client implements ABI version <= 3. &fw_cdev_event_request lacks | |
| 130 | + * essential information; use &fw_cdev_event_request2 instead. | |
| 131 | + */ | |
| 132 | +struct fw_cdev_event_request { | |
| 133 | + __u64 closure; | |
| 134 | + __u32 type; | |
| 135 | + __u32 tcode; | |
| 136 | + __u64 offset; | |
| 137 | + __u32 handle; | |
| 138 | + __u32 length; | |
| 139 | + __u32 data[0]; | |
| 140 | +}; | |
| 141 | + | |
| 142 | +/** | |
| 143 | + * struct fw_cdev_event_request2 - Sent on incoming request to an address region | |
| 144 | + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl | |
| 145 | + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2 | |
| 146 | + * @tcode: Transaction code of the incoming request | |
| 147 | + * @offset: The offset into the 48-bit per-node address space | |
| 148 | + * @source_node_id: Sender node ID | |
| 149 | + * @destination_node_id: Destination node ID | |
| 150 | + * @card: The index of the card from which the request came | |
| 151 | + * @generation: Bus generation in which the request is valid | |
| 152 | + * @handle: Reference to the kernel-side pending request | |
| 153 | + * @length: Data length, i.e. the request's payload size in bytes | |
| 154 | + * @data: Incoming data, if any | |
| 155 | + * | |
| 156 | + * This event is sent when the stack receives an incoming request to an address | |
| 157 | + * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is | |
| 158 | + * guaranteed to be completely contained in the specified region. Userspace is | |
| 159 | + * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, | |
| 160 | + * using the same @handle. | |
| 161 | + * | |
| 162 | + * The payload data for requests carrying data (write and lock requests) | |
| 163 | + * follows immediately and can be accessed through the @data field. | |
| 164 | + * | |
| 165 | + * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the | |
| 166 | + * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT, | |
| 167 | + * i.e. encodes the extended transaction code. | |
| 168 | + * | |
| 169 | + * @card may differ from &fw_cdev_get_info.card because requests are received | |
| 170 | + * from all cards of the Linux host. @source_node_id, @destination_node_id, and | |
| 171 | + * @generation pertain to that card. Destination node ID and bus generation may | |
| 172 | + * therefore differ from the corresponding fields of the last | |
| 173 | + * &fw_cdev_event_bus_reset. | |
| 174 | + * | |
| 175 | + * @destination_node_id may also differ from the current node ID because of a | |
| 176 | + * non-local bus ID part or in case of a broadcast write request. Note, a | |
| 177 | + * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a | |
| 178 | + * broadcast write request; the kernel will then release the kernel-side pending | |
| 179 | + * request but will not actually send a response packet. | |
| 180 | + * | |
| 181 | + * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already | |
| 182 | + * sent a write response immediately after the request was received; in this | |
| 183 | + * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to | |
| 184 | + * release the kernel-side pending request, though another response won't be | |
| 185 | + * sent. | |
| 186 | + * | |
| 187 | + * If the client subsequently needs to initiate requests to the sender node of | |
| 188 | + * an &fw_cdev_event_request2, it needs to use a device file with matching | |
| 189 | + * card index, node ID, and generation for outbound requests. | |
| 190 | + */ | |
| 191 | +struct fw_cdev_event_request2 { | |
| 192 | + __u64 closure; | |
| 193 | + __u32 type; | |
| 194 | + __u32 tcode; | |
| 195 | + __u64 offset; | |
| 196 | + __u32 source_node_id; | |
| 197 | + __u32 destination_node_id; | |
| 198 | + __u32 card; | |
| 199 | + __u32 generation; | |
| 200 | + __u32 handle; | |
| 201 | + __u32 length; | |
| 202 | + __u32 data[0]; | |
| 203 | +}; | |
| 204 | + | |
| 205 | +/** | |
| 206 | + * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed | |
| 207 | + * @closure: See &fw_cdev_event_common; | |
| 208 | + * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl | |
| 209 | + * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT | |
| 210 | + * @cycle: Cycle counter of the last completed packet | |
| 211 | + * @header_length: Total length of following headers, in bytes | |
| 212 | + * @header: Stripped headers, if any | |
| 213 | + * | |
| 214 | + * This event is sent when the controller has completed an &fw_cdev_iso_packet | |
| 215 | + * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with | |
| 216 | + * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets | |
| 217 | + * without the interrupt bit set that the kernel's internal buffer for @header | |
| 218 | + * is about to overflow. (In the last case, kernels with ABI version < 5 drop | |
| 219 | + * header data up to the next interrupt packet.) | |
| 220 | + * | |
| 221 | + * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): | |
| 222 | + * | |
| 223 | + * In version 3 and some implementations of version 2 of the ABI, &header_length | |
| 224 | + * is a multiple of 4 and &header contains timestamps of all packets up until | |
| 225 | + * the interrupt packet. The format of the timestamps is as described below for | |
| 226 | + * isochronous reception. In version 1 of the ABI, &header_length was 0. | |
| 227 | + * | |
| 228 | + * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE): | |
| 229 | + * | |
| 230 | + * The headers stripped of all packets up until and including the interrupt | |
| 231 | + * packet are returned in the @header field. The amount of header data per | |
| 232 | + * packet is as specified at iso context creation by | |
| 233 | + * &fw_cdev_create_iso_context.header_size. | |
| 234 | + * | |
| 235 | + * Hence, _interrupt.header_length / _context.header_size is the number of | |
| 236 | + * packets received in this interrupt event. The client can now iterate | |
| 237 | + * through the mmap()'ed DMA buffer according to this number of packets and | |
| 238 | + * to the buffer sizes as the client specified in &fw_cdev_queue_iso. | |
| 239 | + * | |
| 240 | + * Since version 2 of this ABI, the portion for each packet in _interrupt.header | |
| 241 | + * consists of the 1394 isochronous packet header, followed by a timestamp | |
| 242 | + * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets | |
| 243 | + * from the packet payload if &fw_cdev_create_iso_context.header_size > 8. | |
| 244 | + * | |
| 245 | + * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits | |
| 246 | + * channel, 4 bits tcode, 4 bits sy, in big endian byte order. | |
| 247 | + * data_length is the actual received size of the packet without the four | |
| 248 | + * 1394 iso packet header bytes. | |
| 249 | + * | |
| 250 | + * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits | |
| 251 | + * cycleCount, in big endian byte order. | |
| 252 | + * | |
| 253 | + * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload | |
| 254 | + * data followed directly after the 1394 is header if header_size > 4. | |
| 255 | + * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. | |
| 256 | + */ | |
| 257 | +struct fw_cdev_event_iso_interrupt { | |
| 258 | + __u64 closure; | |
| 259 | + __u32 type; | |
| 260 | + __u32 cycle; | |
| 261 | + __u32 header_length; | |
| 262 | + __u32 header[0]; | |
| 263 | +}; | |
| 264 | + | |
| 265 | +/** | |
| 266 | + * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed | |
| 267 | + * @closure: See &fw_cdev_event_common; | |
| 268 | + * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl | |
| 269 | + * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | |
| 270 | + * @completed: Offset into the receive buffer; data before this offset is valid | |
| 271 | + * | |
| 272 | + * This event is sent in multichannel contexts (context type | |
| 273 | + * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer | |
| 274 | + * chunks that have been completely filled and that have the | |
| 275 | + * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with | |
| 276 | + * %FW_CDEV_IOC_FLUSH_ISO. | |
| 277 | + * | |
| 278 | + * The buffer is continuously filled with the following data, per packet: | |
| 279 | + * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, | |
| 280 | + * but in little endian byte order, | |
| 281 | + * - packet payload (as many bytes as specified in the data_length field of | |
| 282 | + * the 1394 iso packet header) in big endian byte order, | |
| 283 | + * - 0...3 padding bytes as needed to align the following trailer quadlet, | |
| 284 | + * - trailer quadlet, containing the reception timestamp as described at | |
| 285 | + * &fw_cdev_event_iso_interrupt, but in little endian byte order. | |
| 286 | + * | |
| 287 | + * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8. | |
| 288 | + * When processing the data, stop before a packet that would cross the | |
| 289 | + * @completed offset. | |
| 290 | + * | |
| 291 | + * A packet near the end of a buffer chunk will typically spill over into the | |
| 292 | + * next queued buffer chunk. It is the responsibility of the client to check | |
| 293 | + * for this condition, assemble a broken-up packet from its parts, and not to | |
| 294 | + * re-queue any buffer chunks in which as yet unread packet parts reside. | |
| 295 | + */ | |
| 296 | +struct fw_cdev_event_iso_interrupt_mc { | |
| 297 | + __u64 closure; | |
| 298 | + __u32 type; | |
| 299 | + __u32 completed; | |
| 300 | +}; | |
| 301 | + | |
| 302 | +/** | |
| 303 | + * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed | |
| 304 | + * @closure: See &fw_cdev_event_common; | |
| 305 | + * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl | |
| 306 | + * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or | |
| 307 | + * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED | |
| 308 | + * @handle: Reference by which an allocated resource can be deallocated | |
| 309 | + * @channel: Isochronous channel which was (de)allocated, if any | |
| 310 | + * @bandwidth: Bandwidth allocation units which were (de)allocated, if any | |
| 311 | + * | |
| 312 | + * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous | |
| 313 | + * resource was allocated at the IRM. The client has to check @channel and | |
| 314 | + * @bandwidth for whether the allocation actually succeeded. | |
| 315 | + * | |
| 316 | + * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous | |
| 317 | + * resource was deallocated at the IRM. It is also sent when automatic | |
| 318 | + * reallocation after a bus reset failed. | |
| 319 | + * | |
| 320 | + * @channel is <0 if no channel was (de)allocated or if reallocation failed. | |
| 321 | + * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed. | |
| 322 | + */ | |
| 323 | +struct fw_cdev_event_iso_resource { | |
| 324 | + __u64 closure; | |
| 325 | + __u32 type; | |
| 326 | + __u32 handle; | |
| 327 | + __s32 channel; | |
| 328 | + __s32 bandwidth; | |
| 329 | +}; | |
| 330 | + | |
| 331 | +/** | |
| 332 | + * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received | |
| 333 | + * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET | |
| 334 | + * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl | |
| 335 | + * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED | |
| 336 | + * @rcode: %RCODE_..., indicates success or failure of transmission | |
| 337 | + * @length: Data length in bytes | |
| 338 | + * @data: Incoming data | |
| 339 | + * | |
| 340 | + * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty, | |
| 341 | + * except in case of a ping packet: Then, @length is 4, and @data[0] is the | |
| 342 | + * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE. | |
| 343 | + * | |
| 344 | + * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data | |
| 345 | + * consists of the two PHY packet quadlets, in host byte order. | |
| 346 | + */ | |
| 347 | +struct fw_cdev_event_phy_packet { | |
| 348 | + __u64 closure; | |
| 349 | + __u32 type; | |
| 350 | + __u32 rcode; | |
| 351 | + __u32 length; | |
| 352 | + __u32 data[0]; | |
| 353 | +}; | |
| 354 | + | |
| 355 | +/** | |
| 356 | + * union fw_cdev_event - Convenience union of fw_cdev_event_ types | |
| 357 | + * @common: Valid for all types | |
| 358 | + * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET | |
| 359 | + * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE | |
| 360 | + * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST | |
| 361 | + * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2 | |
| 362 | + * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT | |
| 363 | + * @iso_interrupt_mc: Valid if @common.type == | |
| 364 | + * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | |
| 365 | + * @iso_resource: Valid if @common.type == | |
| 366 | + * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or | |
| 367 | + * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED | |
| 368 | + * @phy_packet: Valid if @common.type == | |
| 369 | + * %FW_CDEV_EVENT_PHY_PACKET_SENT or | |
| 370 | + * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED | |
| 371 | + * | |
| 372 | + * Convenience union for userspace use. Events could be read(2) into an | |
| 373 | + * appropriately aligned char buffer and then cast to this union for further | |
| 374 | + * processing. Note that for a request, response or iso_interrupt event, | |
| 375 | + * the data[] or header[] may make the size of the full event larger than | |
| 376 | + * sizeof(union fw_cdev_event). Also note that if you attempt to read(2) | |
| 377 | + * an event into a buffer that is not large enough for it, the data that does | |
| 378 | + * not fit will be discarded so that the next read(2) will return a new event. | |
| 379 | + */ | |
| 380 | +union fw_cdev_event { | |
| 381 | + struct fw_cdev_event_common common; | |
| 382 | + struct fw_cdev_event_bus_reset bus_reset; | |
| 383 | + struct fw_cdev_event_response response; | |
| 384 | + struct fw_cdev_event_request request; | |
| 385 | + struct fw_cdev_event_request2 request2; /* added in 2.6.36 */ | |
| 386 | + struct fw_cdev_event_iso_interrupt iso_interrupt; | |
| 387 | + struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */ | |
| 388 | + struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */ | |
| 389 | + struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */ | |
| 390 | +}; | |
| 391 | + | |
| 392 | +/* available since kernel version 2.6.22 */ | |
| 393 | +#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) | |
| 394 | +#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) | |
| 395 | +#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) | |
| 396 | +#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) | |
| 397 | +#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) | |
| 398 | +#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) | |
| 399 | +#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) | |
| 400 | +#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) | |
| 401 | +#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) | |
| 402 | +#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) | |
| 403 | +#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) | |
| 404 | +#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) | |
| 405 | + | |
| 406 | +/* available since kernel version 2.6.24 */ | |
| 407 | +#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer) | |
| 408 | + | |
| 409 | +/* available since kernel version 2.6.30 */ | |
| 410 | +#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource) | |
| 411 | +#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate) | |
| 412 | +#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource) | |
| 413 | +#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource) | |
| 414 | +#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */ | |
| 415 | +#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) | |
| 416 | +#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) | |
| 417 | + | |
| 418 | +/* available since kernel version 2.6.34 */ | |
| 419 | +#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) | |
| 420 | + | |
| 421 | +/* available since kernel version 2.6.36 */ | |
| 422 | +#define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet) | |
| 423 | +#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) | |
| 424 | +#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) | |
| 425 | + | |
| 426 | +/* available since kernel version 3.4 */ | |
| 427 | +#define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso) | |
| 428 | + | |
| 429 | +/* | |
| 430 | + * ABI version history | |
| 431 | + * 1 (2.6.22) - initial version | |
| 432 | + * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER | |
| 433 | + * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if | |
| 434 | + * &fw_cdev_create_iso_context.header_size is 8 or more | |
| 435 | + * - added %FW_CDEV_IOC_*_ISO_RESOURCE*, | |
| 436 | + * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST, | |
| 437 | + * %FW_CDEV_IOC_SEND_STREAM_PACKET | |
| 438 | + * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt | |
| 439 | + * (2.6.33) - IR has always packet-per-buffer semantics now, not one of | |
| 440 | + * dual-buffer or packet-per-buffer depending on hardware | |
| 441 | + * - shared use and auto-response for FCP registers | |
| 442 | + * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable | |
| 443 | + * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2 | |
| 444 | + * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*, | |
| 445 | + * and &fw_cdev_allocate.region_end | |
| 446 | + * - implemented &fw_cdev_event_bus_reset.bm_node_id | |
| 447 | + * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS | |
| 448 | + * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, | |
| 449 | + * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and | |
| 450 | + * %FW_CDEV_IOC_SET_ISO_CHANNELS | |
| 451 | + * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to | |
| 452 | + * avoid dropping data | |
| 453 | + * - added %FW_CDEV_IOC_FLUSH_ISO | |
| 454 | + */ | |
| 455 | + | |
| 456 | +/** | |
| 457 | + * struct fw_cdev_get_info - General purpose information ioctl | |
| 458 | + * @version: The version field is just a running serial number. Both an | |
| 459 | + * input parameter (ABI version implemented by the client) and | |
| 460 | + * output parameter (ABI version implemented by the kernel). | |
| 461 | + * A client shall fill in the ABI @version for which the client | |
| 462 | + * was implemented. This is necessary for forward compatibility. | |
| 463 | + * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration | |
| 464 | + * ROM will be copied into that user space address. In either | |
| 465 | + * case, @rom_length is updated with the actual length of the | |
| 466 | + * Configuration ROM. | |
| 467 | + * @rom: If non-zero, address of a buffer to be filled by a copy of the | |
| 468 | + * device's Configuration ROM | |
| 469 | + * @bus_reset: If non-zero, address of a buffer to be filled by a | |
| 470 | + * &struct fw_cdev_event_bus_reset with the current state | |
| 471 | + * of the bus. This does not cause a bus reset to happen. | |
| 472 | + * @bus_reset_closure: Value of &closure in this and subsequent bus reset events | |
| 473 | + * @card: The index of the card this device belongs to | |
| 474 | + * | |
| 475 | + * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client | |
| 476 | + * performs right after it opened a /dev/fw* file. | |
| 477 | + * | |
| 478 | + * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2) | |
| 479 | + * is started by this ioctl. | |
| 480 | + */ | |
| 481 | +struct fw_cdev_get_info { | |
| 482 | + __u32 version; | |
| 483 | + __u32 rom_length; | |
| 484 | + __u64 rom; | |
| 485 | + __u64 bus_reset; | |
| 486 | + __u64 bus_reset_closure; | |
| 487 | + __u32 card; | |
| 488 | +}; | |
| 489 | + | |
| 490 | +/** | |
| 491 | + * struct fw_cdev_send_request - Send an asynchronous request packet | |
| 492 | + * @tcode: Transaction code of the request | |
| 493 | + * @length: Length of outgoing payload, in bytes | |
| 494 | + * @offset: 48-bit offset at destination node | |
| 495 | + * @closure: Passed back to userspace in the response event | |
| 496 | + * @data: Userspace pointer to payload | |
| 497 | + * @generation: The bus generation where packet is valid | |
| 498 | + * | |
| 499 | + * Send a request to the device. This ioctl implements all outgoing requests. | |
| 500 | + * Both quadlet and block request specify the payload as a pointer to the data | |
| 501 | + * in the @data field. Once the transaction completes, the kernel writes an | |
| 502 | + * &fw_cdev_event_response event back. The @closure field is passed back to | |
| 503 | + * user space in the response event. | |
| 504 | + */ | |
| 505 | +struct fw_cdev_send_request { | |
| 506 | + __u32 tcode; | |
| 507 | + __u32 length; | |
| 508 | + __u64 offset; | |
| 509 | + __u64 closure; | |
| 510 | + __u64 data; | |
| 511 | + __u32 generation; | |
| 512 | +}; | |
| 513 | + | |
| 514 | +/** | |
| 515 | + * struct fw_cdev_send_response - Send an asynchronous response packet | |
| 516 | + * @rcode: Response code as determined by the userspace handler | |
| 517 | + * @length: Length of outgoing payload, in bytes | |
| 518 | + * @data: Userspace pointer to payload | |
| 519 | + * @handle: The handle from the &fw_cdev_event_request | |
| 520 | + * | |
| 521 | + * Send a response to an incoming request. By setting up an address range using | |
| 522 | + * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An | |
| 523 | + * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must | |
| 524 | + * send a reply using this ioctl. The event has a handle to the kernel-side | |
| 525 | + * pending transaction, which should be used with this ioctl. | |
| 526 | + */ | |
| 527 | +struct fw_cdev_send_response { | |
| 528 | + __u32 rcode; | |
| 529 | + __u32 length; | |
| 530 | + __u64 data; | |
| 531 | + __u32 handle; | |
| 532 | +}; | |
| 533 | + | |
| 534 | +/** | |
| 535 | + * struct fw_cdev_allocate - Allocate a CSR in an address range | |
| 536 | + * @offset: Start offset of the address range | |
| 537 | + * @closure: To be passed back to userspace in request events | |
| 538 | + * @length: Length of the CSR, in bytes | |
| 539 | + * @handle: Handle to the allocation, written by the kernel | |
| 540 | + * @region_end: First address above the address range (added in ABI v4, 2.6.36) | |
| 541 | + * | |
| 542 | + * Allocate an address range in the 48-bit address space on the local node | |
| 543 | + * (the controller). This allows userspace to listen for requests with an | |
| 544 | + * offset within that address range. Every time when the kernel receives a | |
| 545 | + * request within the range, an &fw_cdev_event_request2 event will be emitted. | |
| 546 | + * (If the kernel or the client implements ABI version <= 3, an | |
| 547 | + * &fw_cdev_event_request will be generated instead.) | |
| 548 | + * | |
| 549 | + * The @closure field is passed back to userspace in these request events. | |
| 550 | + * The @handle field is an out parameter, returning a handle to the allocated | |
| 551 | + * range to be used for later deallocation of the range. | |
| 552 | + * | |
| 553 | + * The address range is allocated on all local nodes. The address allocation | |
| 554 | + * is exclusive except for the FCP command and response registers. If an | |
| 555 | + * exclusive address region is already in use, the ioctl fails with errno set | |
| 556 | + * to %EBUSY. | |
| 557 | + * | |
| 558 | + * If kernel and client implement ABI version >= 4, the kernel looks up a free | |
| 559 | + * spot of size @length inside [@offset..@region_end) and, if found, writes | |
| 560 | + * the start address of the new CSR back in @offset. I.e. @offset is an | |
| 561 | + * in and out parameter. If this automatic placement of a CSR in a bigger | |
| 562 | + * address range is not desired, the client simply needs to set @region_end | |
| 563 | + * = @offset + @length. | |
| 564 | + * | |
| 565 | + * If the kernel or the client implements ABI version <= 3, @region_end is | |
| 566 | + * ignored and effectively assumed to be @offset + @length. | |
| 567 | + * | |
| 568 | + * @region_end is only present in a kernel header >= 2.6.36. If necessary, | |
| 569 | + * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2. | |
| 570 | + */ | |
| 571 | +struct fw_cdev_allocate { | |
| 572 | + __u64 offset; | |
| 573 | + __u64 closure; | |
| 574 | + __u32 length; | |
| 575 | + __u32 handle; | |
| 576 | + __u64 region_end; /* available since kernel version 2.6.36 */ | |
| 577 | +}; | |
| 578 | + | |
| 579 | +/** | |
| 580 | + * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource | |
| 581 | + * @handle: Handle to the address range or iso resource, as returned by the | |
| 582 | + * kernel when the range or resource was allocated | |
| 583 | + */ | |
| 584 | +struct fw_cdev_deallocate { | |
| 585 | + __u32 handle; | |
| 586 | +}; | |
| 587 | + | |
| 588 | +#define FW_CDEV_LONG_RESET 0 | |
| 589 | +#define FW_CDEV_SHORT_RESET 1 | |
| 590 | + | |
| 591 | +/** | |
| 592 | + * struct fw_cdev_initiate_bus_reset - Initiate a bus reset | |
| 593 | + * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET | |
| 594 | + * | |
| 595 | + * Initiate a bus reset for the bus this device is on. The bus reset can be | |
| 596 | + * either the original (long) bus reset or the arbitrated (short) bus reset | |
| 597 | + * introduced in 1394a-2000. | |
| 598 | + * | |
| 599 | + * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset | |
| 600 | + * indicates when the reset actually happened. Since ABI v4, this may be | |
| 601 | + * considerably later than the ioctl because the kernel ensures a grace period | |
| 602 | + * between subsequent bus resets as per IEEE 1394 bus management specification. | |
| 603 | + */ | |
| 604 | +struct fw_cdev_initiate_bus_reset { | |
| 605 | + __u32 type; | |
| 606 | +}; | |
| 607 | + | |
| 608 | +/** | |
| 609 | + * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM | |
| 610 | + * @immediate: If non-zero, immediate key to insert before pointer | |
| 611 | + * @key: Upper 8 bits of root directory pointer | |
| 612 | + * @data: Userspace pointer to contents of descriptor block | |
| 613 | + * @length: Length of descriptor block data, in quadlets | |
| 614 | + * @handle: Handle to the descriptor, written by the kernel | |
| 615 | + * | |
| 616 | + * Add a descriptor block and optionally a preceding immediate key to the local | |
| 617 | + * node's Configuration ROM. | |
| 618 | + * | |
| 619 | + * The @key field specifies the upper 8 bits of the descriptor root directory | |
| 620 | + * pointer and the @data and @length fields specify the contents. The @key | |
| 621 | + * should be of the form 0xXX000000. The offset part of the root directory entry | |
| 622 | + * will be filled in by the kernel. | |
| 623 | + * | |
| 624 | + * If not 0, the @immediate field specifies an immediate key which will be | |
| 625 | + * inserted before the root directory pointer. | |
| 626 | + * | |
| 627 | + * @immediate, @key, and @data array elements are CPU-endian quadlets. | |
| 628 | + * | |
| 629 | + * If successful, the kernel adds the descriptor and writes back a @handle to | |
| 630 | + * the kernel-side object to be used for later removal of the descriptor block | |
| 631 | + * and immediate key. The kernel will also generate a bus reset to signal the | |
| 632 | + * change of the Configuration ROM to other nodes. | |
| 633 | + * | |
| 634 | + * This ioctl affects the Configuration ROMs of all local nodes. | |
| 635 | + * The ioctl only succeeds on device files which represent a local node. | |
| 636 | + */ | |
| 637 | +struct fw_cdev_add_descriptor { | |
| 638 | + __u32 immediate; | |
| 639 | + __u32 key; | |
| 640 | + __u64 data; | |
| 641 | + __u32 length; | |
| 642 | + __u32 handle; | |
| 643 | +}; | |
| 644 | + | |
| 645 | +/** | |
| 646 | + * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM | |
| 647 | + * @handle: Handle to the descriptor, as returned by the kernel when the | |
| 648 | + * descriptor was added | |
| 649 | + * | |
| 650 | + * Remove a descriptor block and accompanying immediate key from the local | |
| 651 | + * nodes' Configuration ROMs. The kernel will also generate a bus reset to | |
| 652 | + * signal the change of the Configuration ROM to other nodes. | |
| 653 | + */ | |
| 654 | +struct fw_cdev_remove_descriptor { | |
| 655 | + __u32 handle; | |
| 656 | +}; | |
| 657 | + | |
| 658 | +#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 | |
| 659 | +#define FW_CDEV_ISO_CONTEXT_RECEIVE 1 | |
| 660 | +#define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */ | |
| 661 | + | |
| 662 | +/** | |
| 663 | + * struct fw_cdev_create_iso_context - Create a context for isochronous I/O | |
| 664 | + * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or | |
| 665 | + * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL | |
| 666 | + * @header_size: Header size to strip in single-channel reception | |
| 667 | + * @channel: Channel to bind to in single-channel reception or transmission | |
| 668 | + * @speed: Transmission speed | |
| 669 | + * @closure: To be returned in &fw_cdev_event_iso_interrupt or | |
| 670 | + * &fw_cdev_event_iso_interrupt_multichannel | |
| 671 | + * @handle: Handle to context, written back by kernel | |
| 672 | + * | |
| 673 | + * Prior to sending or receiving isochronous I/O, a context must be created. | |
| 674 | + * The context records information about the transmit or receive configuration | |
| 675 | + * and typically maps to an underlying hardware resource. A context is set up | |
| 676 | + * for either sending or receiving. It is bound to a specific isochronous | |
| 677 | + * @channel. | |
| 678 | + * | |
| 679 | + * In case of multichannel reception, @header_size and @channel are ignored | |
| 680 | + * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS. | |
| 681 | + * | |
| 682 | + * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4 | |
| 683 | + * and must be a multiple of 4. It is ignored in other context types. | |
| 684 | + * | |
| 685 | + * @speed is ignored in receive context types. | |
| 686 | + * | |
| 687 | + * If a context was successfully created, the kernel writes back a handle to the | |
| 688 | + * context, which must be passed in for subsequent operations on that context. | |
| 689 | + * | |
| 690 | + * Limitations: | |
| 691 | + * No more than one iso context can be created per fd. | |
| 692 | + * The total number of contexts that all userspace and kernelspace drivers can | |
| 693 | + * create on a card at a time is a hardware limit, typically 4 or 8 contexts per | |
| 694 | + * direction, and of them at most one multichannel receive context. | |
| 695 | + */ | |
| 696 | +struct fw_cdev_create_iso_context { | |
| 697 | + __u32 type; | |
| 698 | + __u32 header_size; | |
| 699 | + __u32 channel; | |
| 700 | + __u32 speed; | |
| 701 | + __u64 closure; | |
| 702 | + __u32 handle; | |
| 703 | +}; | |
| 704 | + | |
| 705 | +/** | |
| 706 | + * struct fw_cdev_set_iso_channels - Select channels in multichannel reception | |
| 707 | + * @channels: Bitmask of channels to listen to | |
| 708 | + * @handle: Handle of the mutichannel receive context | |
| 709 | + * | |
| 710 | + * @channels is the bitwise or of 1ULL << n for each channel n to listen to. | |
| 711 | + * | |
| 712 | + * The ioctl fails with errno %EBUSY if there is already another receive context | |
| 713 | + * on a channel in @channels. In that case, the bitmask of all unoccupied | |
| 714 | + * channels is returned in @channels. | |
| 715 | + */ | |
| 716 | +struct fw_cdev_set_iso_channels { | |
| 717 | + __u64 channels; | |
| 718 | + __u32 handle; | |
| 719 | +}; | |
| 720 | + | |
| 721 | +#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) | |
| 722 | +#define FW_CDEV_ISO_INTERRUPT (1 << 16) | |
| 723 | +#define FW_CDEV_ISO_SKIP (1 << 17) | |
| 724 | +#define FW_CDEV_ISO_SYNC (1 << 17) | |
| 725 | +#define FW_CDEV_ISO_TAG(v) ((v) << 18) | |
| 726 | +#define FW_CDEV_ISO_SY(v) ((v) << 20) | |
| 727 | +#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24) | |
| 728 | + | |
| 729 | +/** | |
| 730 | + * struct fw_cdev_iso_packet - Isochronous packet | |
| 731 | + * @control: Contains the header length (8 uppermost bits), | |
| 732 | + * the sy field (4 bits), the tag field (2 bits), a sync flag | |
| 733 | + * or a skip flag (1 bit), an interrupt flag (1 bit), and the | |
| 734 | + * payload length (16 lowermost bits) | |
| 735 | + * @header: Header and payload in case of a transmit context. | |
| 736 | + * | |
| 737 | + * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. | |
| 738 | + * Use the FW_CDEV_ISO_ macros to fill in @control. | |
| 739 | + * The @header array is empty in case of receive contexts. | |
| 740 | + * | |
| 741 | + * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT: | |
| 742 | + * | |
| 743 | + * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of | |
| 744 | + * bytes in @header that will be prepended to the packet's payload. These bytes | |
| 745 | + * are copied into the kernel and will not be accessed after the ioctl has | |
| 746 | + * returned. | |
| 747 | + * | |
| 748 | + * The @control.SY and TAG fields are copied to the iso packet header. These | |
| 749 | + * fields are specified by IEEE 1394a and IEC 61883-1. | |
| 750 | + * | |
| 751 | + * The @control.SKIP flag specifies that no packet is to be sent in a frame. | |
| 752 | + * When using this, all other fields except @control.INTERRUPT must be zero. | |
| 753 | + * | |
| 754 | + * When a packet with the @control.INTERRUPT flag set has been completed, an | |
| 755 | + * &fw_cdev_event_iso_interrupt event will be sent. | |
| 756 | + * | |
| 757 | + * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE: | |
| 758 | + * | |
| 759 | + * @control.HEADER_LENGTH must be a multiple of the context's header_size. | |
| 760 | + * If the HEADER_LENGTH is larger than the context's header_size, multiple | |
| 761 | + * packets are queued for this entry. | |
| 762 | + * | |
| 763 | + * The @control.SY and TAG fields are ignored. | |
| 764 | + * | |
| 765 | + * If the @control.SYNC flag is set, the context drops all packets until a | |
| 766 | + * packet with a sy field is received which matches &fw_cdev_start_iso.sync. | |
| 767 | + * | |
| 768 | + * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for | |
| 769 | + * one packet (in addition to payload quadlets that have been defined as headers | |
| 770 | + * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure). | |
| 771 | + * If more bytes are received, the additional bytes are dropped. If less bytes | |
| 772 | + * are received, the remaining bytes in this part of the payload buffer will not | |
| 773 | + * be written to, not even by the next packet. I.e., packets received in | |
| 774 | + * consecutive frames will not necessarily be consecutive in memory. If an | |
| 775 | + * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally | |
| 776 | + * among them. | |
| 777 | + * | |
| 778 | + * When a packet with the @control.INTERRUPT flag set has been completed, an | |
| 779 | + * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued | |
| 780 | + * multiple receive packets is completed when its last packet is completed. | |
| 781 | + * | |
| 782 | + * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL: | |
| 783 | + * | |
| 784 | + * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since | |
| 785 | + * it specifies a chunk of the mmap()'ed buffer, while the number and alignment | |
| 786 | + * of packets to be placed into the buffer chunk is not known beforehand. | |
| 787 | + * | |
| 788 | + * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room | |
| 789 | + * for header, payload, padding, and trailer bytes of one or more packets. | |
| 790 | + * It must be a multiple of 4. | |
| 791 | + * | |
| 792 | + * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described | |
| 793 | + * for single-channel reception. | |
| 794 | + * | |
| 795 | + * When a buffer chunk with the @control.INTERRUPT flag set has been filled | |
| 796 | + * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent. | |
| 797 | + */ | |
| 798 | +struct fw_cdev_iso_packet { | |
| 799 | + __u32 control; | |
| 800 | + __u32 header[0]; | |
| 801 | +}; | |
| 802 | + | |
| 803 | +/** | |
| 804 | + * struct fw_cdev_queue_iso - Queue isochronous packets for I/O | |
| 805 | + * @packets: Userspace pointer to an array of &fw_cdev_iso_packet | |
| 806 | + * @data: Pointer into mmap()'ed payload buffer | |
| 807 | + * @size: Size of the @packets array, in bytes | |
| 808 | + * @handle: Isochronous context handle | |
| 809 | + * | |
| 810 | + * Queue a number of isochronous packets for reception or transmission. | |
| 811 | + * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs, | |
| 812 | + * which describe how to transmit from or receive into a contiguous region | |
| 813 | + * of a mmap()'ed payload buffer. As part of transmit packet descriptors, | |
| 814 | + * a series of headers can be supplied, which will be prepended to the | |
| 815 | + * payload during DMA. | |
| 816 | + * | |
| 817 | + * The kernel may or may not queue all packets, but will write back updated | |
| 818 | + * values of the @packets, @data and @size fields, so the ioctl can be | |
| 819 | + * resubmitted easily. | |
| 820 | + * | |
| 821 | + * In case of a multichannel receive context, @data must be quadlet-aligned | |
| 822 | + * relative to the buffer start. | |
| 823 | + */ | |
| 824 | +struct fw_cdev_queue_iso { | |
| 825 | + __u64 packets; | |
| 826 | + __u64 data; | |
| 827 | + __u32 size; | |
| 828 | + __u32 handle; | |
| 829 | +}; | |
| 830 | + | |
| 831 | +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1 | |
| 832 | +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2 | |
| 833 | +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4 | |
| 834 | +#define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8 | |
| 835 | +#define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15 | |
| 836 | + | |
| 837 | +/** | |
| 838 | + * struct fw_cdev_start_iso - Start an isochronous transmission or reception | |
| 839 | + * @cycle: Cycle in which to start I/O. If @cycle is greater than or | |
| 840 | + * equal to 0, the I/O will start on that cycle. | |
| 841 | + * @sync: Determines the value to wait for for receive packets that have | |
| 842 | + * the %FW_CDEV_ISO_SYNC bit set | |
| 843 | + * @tags: Tag filter bit mask. Only valid for isochronous reception. | |
| 844 | + * Determines the tag values for which packets will be accepted. | |
| 845 | + * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags. | |
| 846 | + * @handle: Isochronous context handle within which to transmit or receive | |
| 847 | + */ | |
| 848 | +struct fw_cdev_start_iso { | |
| 849 | + __s32 cycle; | |
| 850 | + __u32 sync; | |
| 851 | + __u32 tags; | |
| 852 | + __u32 handle; | |
| 853 | +}; | |
| 854 | + | |
| 855 | +/** | |
| 856 | + * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception | |
| 857 | + * @handle: Handle of isochronous context to stop | |
| 858 | + */ | |
| 859 | +struct fw_cdev_stop_iso { | |
| 860 | + __u32 handle; | |
| 861 | +}; | |
| 862 | + | |
| 863 | +/** | |
| 864 | + * struct fw_cdev_flush_iso - flush completed iso packets | |
| 865 | + * @handle: handle of isochronous context to flush | |
| 866 | + * | |
| 867 | + * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, | |
| 868 | + * report any completed packets. | |
| 869 | + * | |
| 870 | + * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current | |
| 871 | + * offset in the receive buffer, if it has changed; this is typically in the | |
| 872 | + * middle of some buffer chunk. | |
| 873 | + * | |
| 874 | + * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | |
| 875 | + * events generated by this ioctl are sent synchronously, i.e., are available | |
| 876 | + * for reading from the file descriptor when this ioctl returns. | |
| 877 | + */ | |
| 878 | +struct fw_cdev_flush_iso { | |
| 879 | + __u32 handle; | |
| 880 | +}; | |
| 881 | + | |
| 882 | +/** | |
| 883 | + * struct fw_cdev_get_cycle_timer - read cycle timer register | |
| 884 | + * @local_time: system time, in microseconds since the Epoch | |
| 885 | + * @cycle_timer: Cycle Time register contents | |
| 886 | + * | |
| 887 | + * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME | |
| 888 | + * and only with microseconds resolution. | |
| 889 | + * | |
| 890 | + * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- | |
| 891 | + * monotonic) @cycle_timer values on certain controllers. | |
| 892 | + */ | |
| 893 | +struct fw_cdev_get_cycle_timer { | |
| 894 | + __u64 local_time; | |
| 895 | + __u32 cycle_timer; | |
| 896 | +}; | |
| 897 | + | |
| 898 | +/** | |
| 899 | + * struct fw_cdev_get_cycle_timer2 - read cycle timer register | |
| 900 | + * @tv_sec: system time, seconds | |
| 901 | + * @tv_nsec: system time, sub-seconds part in nanoseconds | |
| 902 | + * @clk_id: input parameter, clock from which to get the system time | |
| 903 | + * @cycle_timer: Cycle Time register contents | |
| 904 | + * | |
| 905 | + * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer | |
| 906 | + * and also the system clock. This allows to correlate reception time of | |
| 907 | + * isochronous packets with system time. | |
| 908 | + * | |
| 909 | + * @clk_id lets you choose a clock like with POSIX' clock_gettime function. | |
| 910 | + * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC | |
| 911 | + * and Linux' %CLOCK_MONOTONIC_RAW. | |
| 912 | + * | |
| 913 | + * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and | |
| 914 | + * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register | |
| 915 | + * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394. | |
| 916 | + */ | |
| 917 | +struct fw_cdev_get_cycle_timer2 { | |
| 918 | + __s64 tv_sec; | |
| 919 | + __s32 tv_nsec; | |
| 920 | + __s32 clk_id; | |
| 921 | + __u32 cycle_timer; | |
| 922 | +}; | |
| 923 | + | |
| 924 | +/** | |
| 925 | + * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth | |
| 926 | + * @closure: Passed back to userspace in corresponding iso resource events | |
| 927 | + * @channels: Isochronous channels of which one is to be (de)allocated | |
| 928 | + * @bandwidth: Isochronous bandwidth units to be (de)allocated | |
| 929 | + * @handle: Handle to the allocation, written by the kernel (only valid in | |
| 930 | + * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls) | |
| 931 | + * | |
| 932 | + * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an | |
| 933 | + * isochronous channel and/or of isochronous bandwidth at the isochronous | |
| 934 | + * resource manager (IRM). Only one of the channels specified in @channels is | |
| 935 | + * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after | |
| 936 | + * communication with the IRM, indicating success or failure in the event data. | |
| 937 | + * The kernel will automatically reallocate the resources after bus resets. | |
| 938 | + * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event | |
| 939 | + * will be sent. The kernel will also automatically deallocate the resources | |
| 940 | + * when the file descriptor is closed. | |
| 941 | + * | |
| 942 | + * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate | |
| 943 | + * deallocation of resources which were allocated as described above. | |
| 944 | + * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | |
| 945 | + * | |
| 946 | + * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation | |
| 947 | + * without automatic re- or deallocation. | |
| 948 | + * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation, | |
| 949 | + * indicating success or failure in its data. | |
| 950 | + * | |
| 951 | + * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like | |
| 952 | + * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed | |
| 953 | + * instead of allocated. | |
| 954 | + * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation. | |
| 955 | + * | |
| 956 | + * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources | |
| 957 | + * for the lifetime of the fd or @handle. | |
| 958 | + * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources | |
| 959 | + * for the duration of a bus generation. | |
| 960 | + * | |
| 961 | + * @channels is a host-endian bitfield with the least significant bit | |
| 962 | + * representing channel 0 and the most significant bit representing channel 63: | |
| 963 | + * 1ULL << c for each channel c that is a candidate for (de)allocation. | |
| 964 | + * | |
| 965 | + * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send | |
| 966 | + * one quadlet of data (payload or header data) at speed S1600. | |
| 967 | + */ | |
| 968 | +struct fw_cdev_allocate_iso_resource { | |
| 969 | + __u64 closure; | |
| 970 | + __u64 channels; | |
| 971 | + __u32 bandwidth; | |
| 972 | + __u32 handle; | |
| 973 | +}; | |
| 974 | + | |
| 975 | +/** | |
| 976 | + * struct fw_cdev_send_stream_packet - send an asynchronous stream packet | |
| 977 | + * @length: Length of outgoing payload, in bytes | |
| 978 | + * @tag: Data format tag | |
| 979 | + * @channel: Isochronous channel to transmit to | |
| 980 | + * @sy: Synchronization code | |
| 981 | + * @closure: Passed back to userspace in the response event | |
| 982 | + * @data: Userspace pointer to payload | |
| 983 | + * @generation: The bus generation where packet is valid | |
| 984 | + * @speed: Speed to transmit at | |
| 985 | + * | |
| 986 | + * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet | |
| 987 | + * to every device which is listening to the specified channel. The kernel | |
| 988 | + * writes an &fw_cdev_event_response event which indicates success or failure of | |
| 989 | + * the transmission. | |
| 990 | + */ | |
| 991 | +struct fw_cdev_send_stream_packet { | |
| 992 | + __u32 length; | |
| 993 | + __u32 tag; | |
| 994 | + __u32 channel; | |
| 995 | + __u32 sy; | |
| 996 | + __u64 closure; | |
| 997 | + __u64 data; | |
| 998 | + __u32 generation; | |
| 999 | + __u32 speed; | |
| 1000 | +}; | |
| 1001 | + | |
| 1002 | +/** | |
| 1003 | + * struct fw_cdev_send_phy_packet - send a PHY packet | |
| 1004 | + * @closure: Passed back to userspace in the PHY-packet-sent event | |
| 1005 | + * @data: First and second quadlet of the PHY packet | |
| 1006 | + * @generation: The bus generation where packet is valid | |
| 1007 | + * | |
| 1008 | + * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes | |
| 1009 | + * on the same card as this device. After transmission, an | |
| 1010 | + * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated. | |
| 1011 | + * | |
| 1012 | + * The payload @data[] shall be specified in host byte order. Usually, | |
| 1013 | + * @data[1] needs to be the bitwise inverse of @data[0]. VersaPHY packets | |
| 1014 | + * are an exception to this rule. | |
| 1015 | + * | |
| 1016 | + * The ioctl is only permitted on device files which represent a local node. | |
| 1017 | + */ | |
| 1018 | +struct fw_cdev_send_phy_packet { | |
| 1019 | + __u64 closure; | |
| 1020 | + __u32 data[2]; | |
| 1021 | + __u32 generation; | |
| 1022 | +}; | |
| 1023 | + | |
| 1024 | +/** | |
| 1025 | + * struct fw_cdev_receive_phy_packets - start reception of PHY packets | |
| 1026 | + * @closure: Passed back to userspace in phy packet events | |
| 1027 | + * | |
| 1028 | + * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to | |
| 1029 | + * incoming PHY packets from any node on the same bus as the device. | |
| 1030 | + * | |
| 1031 | + * The ioctl is only permitted on device files which represent a local node. | |
| 1032 | + */ | |
| 1033 | +struct fw_cdev_receive_phy_packets { | |
| 1034 | + __u64 closure; | |
| 1035 | +}; | |
| 1036 | + | |
| 1037 | +#define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */ | |
| 1038 | + | |
| 1039 | +#endif /* _LINUX_FIREWIRE_CDEV_H */ | |
| @@ -0,0 +1,92 @@ | ||
| 1 | +/* | |
| 2 | + * IEEE 1394 constants. | |
| 3 | + * | |
| 4 | + * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> | |
| 5 | + * | |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a | |
| 7 | + * copy of this software and associated documentation files (the "Software"), | |
| 8 | + * to deal in the Software without restriction, including without limitation | |
| 9 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 10 | + * and/or sell copies of the Software, and to permit persons to whom the | |
| 11 | + * Software is furnished to do so, subject to the following conditions: | |
| 12 | + * | |
| 13 | + * The above copyright notice and this permission notice (including the next | |
| 14 | + * paragraph) shall be included in all copies or substantial portions of the | |
| 15 | + * Software. | |
| 16 | + * | |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 20 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 21 | + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 22 | + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 23 | + * DEALINGS IN THE SOFTWARE. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#ifndef _LINUX_FIREWIRE_CONSTANTS_H | |
| 27 | +#define _LINUX_FIREWIRE_CONSTANTS_H | |
| 28 | + | |
| 29 | +#define TCODE_WRITE_QUADLET_REQUEST 0x0 | |
| 30 | +#define TCODE_WRITE_BLOCK_REQUEST 0x1 | |
| 31 | +#define TCODE_WRITE_RESPONSE 0x2 | |
| 32 | +#define TCODE_READ_QUADLET_REQUEST 0x4 | |
| 33 | +#define TCODE_READ_BLOCK_REQUEST 0x5 | |
| 34 | +#define TCODE_READ_QUADLET_RESPONSE 0x6 | |
| 35 | +#define TCODE_READ_BLOCK_RESPONSE 0x7 | |
| 36 | +#define TCODE_CYCLE_START 0x8 | |
| 37 | +#define TCODE_LOCK_REQUEST 0x9 | |
| 38 | +#define TCODE_STREAM_DATA 0xa | |
| 39 | +#define TCODE_LOCK_RESPONSE 0xb | |
| 40 | + | |
| 41 | +#define EXTCODE_MASK_SWAP 0x1 | |
| 42 | +#define EXTCODE_COMPARE_SWAP 0x2 | |
| 43 | +#define EXTCODE_FETCH_ADD 0x3 | |
| 44 | +#define EXTCODE_LITTLE_ADD 0x4 | |
| 45 | +#define EXTCODE_BOUNDED_ADD 0x5 | |
| 46 | +#define EXTCODE_WRAP_ADD 0x6 | |
| 47 | +#define EXTCODE_VENDOR_DEPENDENT 0x7 | |
| 48 | + | |
| 49 | +/* Linux firewire-core (Juju) specific tcodes */ | |
| 50 | +#define TCODE_LOCK_MASK_SWAP (0x10 | EXTCODE_MASK_SWAP) | |
| 51 | +#define TCODE_LOCK_COMPARE_SWAP (0x10 | EXTCODE_COMPARE_SWAP) | |
| 52 | +#define TCODE_LOCK_FETCH_ADD (0x10 | EXTCODE_FETCH_ADD) | |
| 53 | +#define TCODE_LOCK_LITTLE_ADD (0x10 | EXTCODE_LITTLE_ADD) | |
| 54 | +#define TCODE_LOCK_BOUNDED_ADD (0x10 | EXTCODE_BOUNDED_ADD) | |
| 55 | +#define TCODE_LOCK_WRAP_ADD (0x10 | EXTCODE_WRAP_ADD) | |
| 56 | +#define TCODE_LOCK_VENDOR_DEPENDENT (0x10 | EXTCODE_VENDOR_DEPENDENT) | |
| 57 | + | |
| 58 | +#define RCODE_COMPLETE 0x0 | |
| 59 | +#define RCODE_CONFLICT_ERROR 0x4 | |
| 60 | +#define RCODE_DATA_ERROR 0x5 | |
| 61 | +#define RCODE_TYPE_ERROR 0x6 | |
| 62 | +#define RCODE_ADDRESS_ERROR 0x7 | |
| 63 | + | |
| 64 | +/* Linux firewire-core (Juju) specific rcodes */ | |
| 65 | +#define RCODE_SEND_ERROR 0x10 | |
| 66 | +#define RCODE_CANCELLED 0x11 | |
| 67 | +#define RCODE_BUSY 0x12 | |
| 68 | +#define RCODE_GENERATION 0x13 | |
| 69 | +#define RCODE_NO_ACK 0x14 | |
| 70 | + | |
| 71 | +#define SCODE_100 0x0 | |
| 72 | +#define SCODE_200 0x1 | |
| 73 | +#define SCODE_400 0x2 | |
| 74 | +#define SCODE_800 0x3 | |
| 75 | +#define SCODE_1600 0x4 | |
| 76 | +#define SCODE_3200 0x5 | |
| 77 | +#define SCODE_BETA 0x3 | |
| 78 | + | |
| 79 | +#define ACK_COMPLETE 0x1 | |
| 80 | +#define ACK_PENDING 0x2 | |
| 81 | +#define ACK_BUSY_X 0x4 | |
| 82 | +#define ACK_BUSY_A 0x5 | |
| 83 | +#define ACK_BUSY_B 0x6 | |
| 84 | +#define ACK_DATA_ERROR 0xd | |
| 85 | +#define ACK_TYPE_ERROR 0xe | |
| 86 | + | |
| 87 | +#define RETRY_1 0x00 | |
| 88 | +#define RETRY_X 0x01 | |
| 89 | +#define RETRY_A 0x02 | |
| 90 | +#define RETRY_B 0x03 | |
| 91 | + | |
| 92 | +#endif /* _LINUX_FIREWIRE_CONSTANTS_H */ | |
| @@ -0,0 +1,58 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com> | |
| 3 | + * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com> | |
| 4 | + * The Silver Hammer Group, Ltd. | |
| 5 | + * | |
| 6 | + * This file provides the definitions and structures needed to | |
| 7 | + * support uClinux flat-format executables. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#ifndef _UAPI_LINUX_FLAT_H | |
| 11 | +#define _UAPI_LINUX_FLAT_H | |
| 12 | + | |
| 13 | + | |
| 14 | +#define FLAT_VERSION 0x00000004L | |
| 15 | + | |
| 16 | +#ifdef CONFIG_BINFMT_SHARED_FLAT | |
| 17 | +#define MAX_SHARED_LIBS (4) | |
| 18 | +#else | |
| 19 | +#define MAX_SHARED_LIBS (1) | |
| 20 | +#endif | |
| 21 | + | |
| 22 | +/* | |
| 23 | + * To make everything easier to port and manage cross platform | |
| 24 | + * development, all fields are in network byte order. | |
| 25 | + */ | |
| 26 | + | |
| 27 | +struct flat_hdr { | |
| 28 | + char magic[4]; | |
| 29 | + unsigned long rev; /* version (as above) */ | |
| 30 | + unsigned long entry; /* Offset of first executable instruction | |
| 31 | + with text segment from beginning of file */ | |
| 32 | + unsigned long data_start; /* Offset of data segment from beginning of | |
| 33 | + file */ | |
| 34 | + unsigned long data_end; /* Offset of end of data segment | |
| 35 | + from beginning of file */ | |
| 36 | + unsigned long bss_end; /* Offset of end of bss segment from beginning | |
| 37 | + of file */ | |
| 38 | + | |
| 39 | + /* (It is assumed that data_end through bss_end forms the bss segment.) */ | |
| 40 | + | |
| 41 | + unsigned long stack_size; /* Size of stack, in bytes */ | |
| 42 | + unsigned long reloc_start; /* Offset of relocation records from | |
| 43 | + beginning of file */ | |
| 44 | + unsigned long reloc_count; /* Number of relocation records */ | |
| 45 | + unsigned long flags; | |
| 46 | + unsigned long build_date; /* When the program/library was built */ | |
| 47 | + unsigned long filler[5]; /* Reservered, set to zero */ | |
| 48 | +}; | |
| 49 | + | |
| 50 | +#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */ | |
| 51 | +#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */ | |
| 52 | +#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */ | |
| 53 | +#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */ | |
| 54 | +#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */ | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | +#endif /* _UAPI_LINUX_FLAT_H */ | |
| @@ -0,0 +1,334 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_FS_H | |
| 2 | +#define _UAPI_LINUX_FS_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * This file has definitions for some important file table | |
| 6 | + * structures etc. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +#include <linux/limits.h> | |
| 10 | +#include <linux/ioctl.h> | |
| 11 | +#include <linux/types.h> | |
| 12 | + | |
| 13 | +/* | |
| 14 | + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | |
| 15 | + * the file limit at runtime and only root can increase the per-process | |
| 16 | + * nr_file rlimit, so it's safe to set up a ridiculously high absolute | |
| 17 | + * upper limit on files-per-process. | |
| 18 | + * | |
| 19 | + * Some programs (notably those using select()) may have to be | |
| 20 | + * recompiled to take full advantage of the new limits.. | |
| 21 | + */ | |
| 22 | + | |
| 23 | +/* Fixed constants first: */ | |
| 24 | +#undef NR_OPEN | |
| 25 | +#define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */ | |
| 26 | +#define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */ | |
| 27 | + | |
| 28 | +#define BLOCK_SIZE_BITS 10 | |
| 29 | +#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) | |
| 30 | + | |
| 31 | +#define SEEK_SET 0 /* seek relative to beginning of file */ | |
| 32 | +#define SEEK_CUR 1 /* seek relative to current file position */ | |
| 33 | +#define SEEK_END 2 /* seek relative to end of file */ | |
| 34 | +#define SEEK_DATA 3 /* seek to the next data */ | |
| 35 | +#define SEEK_HOLE 4 /* seek to the next hole */ | |
| 36 | +#define SEEK_MAX SEEK_HOLE | |
| 37 | + | |
| 38 | +struct fstrim_range { | |
| 39 | + __u64 start; | |
| 40 | + __u64 len; | |
| 41 | + __u64 minlen; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +/* And dynamically-tunable limits and defaults: */ | |
| 45 | +struct files_stat_struct { | |
| 46 | + unsigned long nr_files; /* read only */ | |
| 47 | + unsigned long nr_free_files; /* read only */ | |
| 48 | + unsigned long max_files; /* tunable */ | |
| 49 | +}; | |
| 50 | + | |
| 51 | +struct inodes_stat_t { | |
| 52 | + int nr_inodes; | |
| 53 | + int nr_unused; | |
| 54 | + int dummy[5]; /* padding for sysctl ABI compatibility */ | |
| 55 | +}; | |
| 56 | + | |
| 57 | + | |
| 58 | +#define NR_FILE 8192 /* this can well be larger on a larger system */ | |
| 59 | + | |
| 60 | +#define MAY_EXEC 0x00000001 | |
| 61 | +#define MAY_WRITE 0x00000002 | |
| 62 | +#define MAY_READ 0x00000004 | |
| 63 | +#define MAY_APPEND 0x00000008 | |
| 64 | +#define MAY_ACCESS 0x00000010 | |
| 65 | +#define MAY_OPEN 0x00000020 | |
| 66 | +#define MAY_CHDIR 0x00000040 | |
| 67 | +/* called from RCU mode, don't block */ | |
| 68 | +#define MAY_NOT_BLOCK 0x00000080 | |
| 69 | + | |
| 70 | +/* | |
| 71 | + * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond | |
| 72 | + * to O_WRONLY and O_RDWR via the strange trick in __dentry_open() | |
| 73 | + */ | |
| 74 | + | |
| 75 | +/* file is open for reading */ | |
| 76 | +#define FMODE_READ ((__force fmode_t)0x1) | |
| 77 | +/* file is open for writing */ | |
| 78 | +#define FMODE_WRITE ((__force fmode_t)0x2) | |
| 79 | +/* file is seekable */ | |
| 80 | +#define FMODE_LSEEK ((__force fmode_t)0x4) | |
| 81 | +/* file can be accessed using pread */ | |
| 82 | +#define FMODE_PREAD ((__force fmode_t)0x8) | |
| 83 | +/* file can be accessed using pwrite */ | |
| 84 | +#define FMODE_PWRITE ((__force fmode_t)0x10) | |
| 85 | +/* File is opened for execution with sys_execve / sys_uselib */ | |
| 86 | +#define FMODE_EXEC ((__force fmode_t)0x20) | |
| 87 | +/* File is opened with O_NDELAY (only set for block devices) */ | |
| 88 | +#define FMODE_NDELAY ((__force fmode_t)0x40) | |
| 89 | +/* File is opened with O_EXCL (only set for block devices) */ | |
| 90 | +#define FMODE_EXCL ((__force fmode_t)0x80) | |
| 91 | +/* File is opened using open(.., 3, ..) and is writeable only for ioctls | |
| 92 | + (specialy hack for floppy.c) */ | |
| 93 | +#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100) | |
| 94 | +/* 32bit hashes as llseek() offset (for directories) */ | |
| 95 | +#define FMODE_32BITHASH ((__force fmode_t)0x200) | |
| 96 | +/* 64bit hashes as llseek() offset (for directories) */ | |
| 97 | +#define FMODE_64BITHASH ((__force fmode_t)0x400) | |
| 98 | + | |
| 99 | +/* | |
| 100 | + * Don't update ctime and mtime. | |
| 101 | + * | |
| 102 | + * Currently a special hack for the XFS open_by_handle ioctl, but we'll | |
| 103 | + * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon. | |
| 104 | + */ | |
| 105 | +#define FMODE_NOCMTIME ((__force fmode_t)0x800) | |
| 106 | + | |
| 107 | +/* Expect random access pattern */ | |
| 108 | +#define FMODE_RANDOM ((__force fmode_t)0x1000) | |
| 109 | + | |
| 110 | +/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ | |
| 111 | +#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) | |
| 112 | + | |
| 113 | +/* File is opened with O_PATH; almost nothing can be done with it */ | |
| 114 | +#define FMODE_PATH ((__force fmode_t)0x4000) | |
| 115 | + | |
| 116 | +/* File was opened by fanotify and shouldn't generate fanotify events */ | |
| 117 | +#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | |
| 118 | + | |
| 119 | +/* | |
| 120 | + * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector | |
| 121 | + * that indicates that they should check the contents of the iovec are | |
| 122 | + * valid, but not check the memory that the iovec elements | |
| 123 | + * points too. | |
| 124 | + */ | |
| 125 | +#define CHECK_IOVEC_ONLY -1 | |
| 126 | + | |
| 127 | +#define SEL_IN 1 | |
| 128 | +#define SEL_OUT 2 | |
| 129 | +#define SEL_EX 4 | |
| 130 | + | |
| 131 | +/* public flags for file_system_type */ | |
| 132 | +#define FS_REQUIRES_DEV 1 | |
| 133 | +#define FS_BINARY_MOUNTDATA 2 | |
| 134 | +#define FS_HAS_SUBTYPE 4 | |
| 135 | +#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ | |
| 136 | +#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() | |
| 137 | + * during rename() internally. | |
| 138 | + */ | |
| 139 | + | |
| 140 | +/* | |
| 141 | + * These are the fs-independent mount-flags: up to 32 flags are supported | |
| 142 | + */ | |
| 143 | +#define MS_RDONLY 1 /* Mount read-only */ | |
| 144 | +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ | |
| 145 | +#define MS_NODEV 4 /* Disallow access to device special files */ | |
| 146 | +#define MS_NOEXEC 8 /* Disallow program execution */ | |
| 147 | +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ | |
| 148 | +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ | |
| 149 | +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ | |
| 150 | +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ | |
| 151 | +#define MS_NOATIME 1024 /* Do not update access times. */ | |
| 152 | +#define MS_NODIRATIME 2048 /* Do not update directory access times */ | |
| 153 | +#define MS_BIND 4096 | |
| 154 | +#define MS_MOVE 8192 | |
| 155 | +#define MS_REC 16384 | |
| 156 | +#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence. | |
| 157 | + MS_VERBOSE is deprecated. */ | |
| 158 | +#define MS_SILENT 32768 | |
| 159 | +#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ | |
| 160 | +#define MS_UNBINDABLE (1<<17) /* change to unbindable */ | |
| 161 | +#define MS_PRIVATE (1<<18) /* change to private */ | |
| 162 | +#define MS_SLAVE (1<<19) /* change to slave */ | |
| 163 | +#define MS_SHARED (1<<20) /* change to shared */ | |
| 164 | +#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ | |
| 165 | +#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ | |
| 166 | +#define MS_I_VERSION (1<<23) /* Update inode I_version field */ | |
| 167 | +#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ | |
| 168 | +#define MS_NOSEC (1<<28) | |
| 169 | +#define MS_BORN (1<<29) | |
| 170 | +#define MS_ACTIVE (1<<30) | |
| 171 | +#define MS_NOUSER (1<<31) | |
| 172 | + | |
| 173 | +/* | |
| 174 | + * Superblock flags that can be altered by MS_REMOUNT | |
| 175 | + */ | |
| 176 | +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION) | |
| 177 | + | |
| 178 | +/* | |
| 179 | + * Old magic mount flag and mask | |
| 180 | + */ | |
| 181 | +#define MS_MGC_VAL 0xC0ED0000 | |
| 182 | +#define MS_MGC_MSK 0xffff0000 | |
| 183 | + | |
| 184 | +/* Inode flags - they have nothing to superblock flags now */ | |
| 185 | + | |
| 186 | +#define S_SYNC 1 /* Writes are synced at once */ | |
| 187 | +#define S_NOATIME 2 /* Do not update access times */ | |
| 188 | +#define S_APPEND 4 /* Append-only file */ | |
| 189 | +#define S_IMMUTABLE 8 /* Immutable file */ | |
| 190 | +#define S_DEAD 16 /* removed, but still open directory */ | |
| 191 | +#define S_NOQUOTA 32 /* Inode is not counted to quota */ | |
| 192 | +#define S_DIRSYNC 64 /* Directory modifications are synchronous */ | |
| 193 | +#define S_NOCMTIME 128 /* Do not update file c/mtime */ | |
| 194 | +#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ | |
| 195 | +#define S_PRIVATE 512 /* Inode is fs-internal */ | |
| 196 | +#define S_IMA 1024 /* Inode has an associated IMA struct */ | |
| 197 | +#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */ | |
| 198 | +#define S_NOSEC 4096 /* no suid or xattr security attributes */ | |
| 199 | + | |
| 200 | +/* | |
| 201 | + * Note that nosuid etc flags are inode-specific: setting some file-system | |
| 202 | + * flags just means all the inodes inherit those flags by default. It might be | |
| 203 | + * possible to override it selectively if you really wanted to with some | |
| 204 | + * ioctl() that is not currently implemented. | |
| 205 | + * | |
| 206 | + * Exception: MS_RDONLY is always applied to the entire file system. | |
| 207 | + * | |
| 208 | + * Unfortunately, it is possible to change a filesystems flags with it mounted | |
| 209 | + * with files in use. This means that all of the inodes will not have their | |
| 210 | + * i_flags updated. Hence, i_flags no longer inherit the superblock mount | |
| 211 | + * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org | |
| 212 | + */ | |
| 213 | +#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg)) | |
| 214 | + | |
| 215 | +#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) | |
| 216 | +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ | |
| 217 | + ((inode)->i_flags & S_SYNC)) | |
| 218 | +#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ | |
| 219 | + ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) | |
| 220 | +#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) | |
| 221 | +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) | |
| 222 | +#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) | |
| 223 | + | |
| 224 | +#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) | |
| 225 | +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) | |
| 226 | +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) | |
| 227 | +#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) | |
| 228 | + | |
| 229 | +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) | |
| 230 | +#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) | |
| 231 | +#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) | |
| 232 | +#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) | |
| 233 | +#define IS_IMA(inode) ((inode)->i_flags & S_IMA) | |
| 234 | +#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) | |
| 235 | +#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) | |
| 236 | + | |
| 237 | +/* the read-only stuff doesn't really belong here, but any other place is | |
| 238 | + probably as bad and I don't want to create yet another include file. */ | |
| 239 | + | |
| 240 | +#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ | |
| 241 | +#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ | |
| 242 | +#define BLKRRPART _IO(0x12,95) /* re-read partition table */ | |
| 243 | +#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ | |
| 244 | +#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ | |
| 245 | +#define BLKRASET _IO(0x12,98) /* set read ahead for block device */ | |
| 246 | +#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ | |
| 247 | +#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ | |
| 248 | +#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ | |
| 249 | +#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ | |
| 250 | +#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ | |
| 251 | +#define BLKSSZGET _IO(0x12,104)/* get block device sector size */ | |
| 252 | +#if 0 | |
| 253 | +#define BLKPG _IO(0x12,105)/* See blkpg.h */ | |
| 254 | + | |
| 255 | +/* Some people are morons. Do not use sizeof! */ | |
| 256 | + | |
| 257 | +#define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ | |
| 258 | +#define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ | |
| 259 | +/* This was here just to show that the number is taken - | |
| 260 | + probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ | |
| 261 | +#endif | |
| 262 | +/* A jump here: 108-111 have been used for various private purposes. */ | |
| 263 | +#define BLKBSZGET _IOR(0x12,112,size_t) | |
| 264 | +#define BLKBSZSET _IOW(0x12,113,size_t) | |
| 265 | +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ | |
| 266 | +#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) | |
| 267 | +#define BLKTRACESTART _IO(0x12,116) | |
| 268 | +#define BLKTRACESTOP _IO(0x12,117) | |
| 269 | +#define BLKTRACETEARDOWN _IO(0x12,118) | |
| 270 | +#define BLKDISCARD _IO(0x12,119) | |
| 271 | +#define BLKIOMIN _IO(0x12,120) | |
| 272 | +#define BLKIOOPT _IO(0x12,121) | |
| 273 | +#define BLKALIGNOFF _IO(0x12,122) | |
| 274 | +#define BLKPBSZGET _IO(0x12,123) | |
| 275 | +#define BLKDISCARDZEROES _IO(0x12,124) | |
| 276 | +#define BLKSECDISCARD _IO(0x12,125) | |
| 277 | +#define BLKROTATIONAL _IO(0x12,126) | |
| 278 | +#define BLKZEROOUT _IO(0x12,127) | |
| 279 | + | |
| 280 | +#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | |
| 281 | +#define FIBMAP _IO(0x00,1) /* bmap access */ | |
| 282 | +#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ | |
| 283 | +#define FIFREEZE _IOWR('X', 119, int) /* Freeze */ | |
| 284 | +#define FITHAW _IOWR('X', 120, int) /* Thaw */ | |
| 285 | +#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ | |
| 286 | + | |
| 287 | +#define FS_IOC_GETFLAGS _IOR('f', 1, long) | |
| 288 | +#define FS_IOC_SETFLAGS _IOW('f', 2, long) | |
| 289 | +#define FS_IOC_GETVERSION _IOR('v', 1, long) | |
| 290 | +#define FS_IOC_SETVERSION _IOW('v', 2, long) | |
| 291 | +#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) | |
| 292 | +#define FS_IOC32_GETFLAGS _IOR('f', 1, int) | |
| 293 | +#define FS_IOC32_SETFLAGS _IOW('f', 2, int) | |
| 294 | +#define FS_IOC32_GETVERSION _IOR('v', 1, int) | |
| 295 | +#define FS_IOC32_SETVERSION _IOW('v', 2, int) | |
| 296 | + | |
| 297 | +/* | |
| 298 | + * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) | |
| 299 | + */ | |
| 300 | +#define FS_SECRM_FL 0x00000001 /* Secure deletion */ | |
| 301 | +#define FS_UNRM_FL 0x00000002 /* Undelete */ | |
| 302 | +#define FS_COMPR_FL 0x00000004 /* Compress file */ | |
| 303 | +#define FS_SYNC_FL 0x00000008 /* Synchronous updates */ | |
| 304 | +#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ | |
| 305 | +#define FS_APPEND_FL 0x00000020 /* writes to file may only append */ | |
| 306 | +#define FS_NODUMP_FL 0x00000040 /* do not dump file */ | |
| 307 | +#define FS_NOATIME_FL 0x00000080 /* do not update atime */ | |
| 308 | +/* Reserved for compression usage... */ | |
| 309 | +#define FS_DIRTY_FL 0x00000100 | |
| 310 | +#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ | |
| 311 | +#define FS_NOCOMP_FL 0x00000400 /* Don't compress */ | |
| 312 | +#define FS_ECOMPR_FL 0x00000800 /* Compression error */ | |
| 313 | +/* End compression flags --- maybe not all used */ | |
| 314 | +#define FS_BTREE_FL 0x00001000 /* btree format dir */ | |
| 315 | +#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ | |
| 316 | +#define FS_IMAGIC_FL 0x00002000 /* AFS directory */ | |
| 317 | +#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ | |
| 318 | +#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | |
| 319 | +#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ | |
| 320 | +#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | |
| 321 | +#define FS_EXTENT_FL 0x00080000 /* Extents */ | |
| 322 | +#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ | |
| 323 | +#define FS_NOCOW_FL 0x00800000 /* Do not cow file */ | |
| 324 | +#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ | |
| 325 | + | |
| 326 | +#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | |
| 327 | +#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ | |
| 328 | + | |
| 329 | + | |
| 330 | +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 | |
| 331 | +#define SYNC_FILE_RANGE_WRITE 2 | |
| 332 | +#define SYNC_FILE_RANGE_WAIT_AFTER 4 | |
| 333 | + | |
| 334 | +#endif /* _UAPI_LINUX_FS_H */ | |
| @@ -0,0 +1,220 @@ | ||
| 1 | +/* | |
| 2 | + * Freescale hypervisor ioctl and kernel interface | |
| 3 | + * | |
| 4 | + * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. | |
| 5 | + * Author: Timur Tabi <timur@freescale.com> | |
| 6 | + * | |
| 7 | + * Redistribution and use in source and binary forms, with or without | |
| 8 | + * modification, are permitted provided that the following conditions are met: | |
| 9 | + * * Redistributions of source code must retain the above copyright | |
| 10 | + * notice, this list of conditions and the following disclaimer. | |
| 11 | + * * Redistributions in binary form must reproduce the above copyright | |
| 12 | + * notice, this list of conditions and the following disclaimer in the | |
| 13 | + * documentation and/or other materials provided with the distribution. | |
| 14 | + * * Neither the name of Freescale Semiconductor nor the | |
| 15 | + * names of its contributors may be used to endorse or promote products | |
| 16 | + * derived from this software without specific prior written permission. | |
| 17 | + * | |
| 18 | + * | |
| 19 | + * ALTERNATIVELY, this software may be distributed under the terms of the | |
| 20 | + * GNU General Public License ("GPL") as published by the Free Software | |
| 21 | + * Foundation, either version 2 of that License or (at your option) any | |
| 22 | + * later version. | |
| 23 | + * | |
| 24 | + * This software is provided by Freescale Semiconductor "as is" and any | |
| 25 | + * express or implied warranties, including, but not limited to, the implied | |
| 26 | + * warranties of merchantability and fitness for a particular purpose are | |
| 27 | + * disclaimed. In no event shall Freescale Semiconductor be liable for any | |
| 28 | + * direct, indirect, incidental, special, exemplary, or consequential damages | |
| 29 | + * (including, but not limited to, procurement of substitute goods or services; | |
| 30 | + * loss of use, data, or profits; or business interruption) however caused and | |
| 31 | + * on any theory of liability, whether in contract, strict liability, or tort | |
| 32 | + * (including negligence or otherwise) arising in any way out of the use of this | |
| 33 | + * software, even if advised of the possibility of such damage. | |
| 34 | + * | |
| 35 | + * This file is used by the Freescale hypervisor management driver. It can | |
| 36 | + * also be included by applications that need to communicate with the driver | |
| 37 | + * via the ioctl interface. | |
| 38 | + */ | |
| 39 | + | |
| 40 | +#ifndef _UAPIFSL_HYPERVISOR_H | |
| 41 | +#define _UAPIFSL_HYPERVISOR_H | |
| 42 | + | |
| 43 | +#include <linux/types.h> | |
| 44 | + | |
| 45 | +/** | |
| 46 | + * struct fsl_hv_ioctl_restart - restart a partition | |
| 47 | + * @ret: return error code from the hypervisor | |
| 48 | + * @partition: the ID of the partition to restart, or -1 for the | |
| 49 | + * calling partition | |
| 50 | + * | |
| 51 | + * Used by FSL_HV_IOCTL_PARTITION_RESTART | |
| 52 | + */ | |
| 53 | +struct fsl_hv_ioctl_restart { | |
| 54 | + __u32 ret; | |
| 55 | + __u32 partition; | |
| 56 | +}; | |
| 57 | + | |
| 58 | +/** | |
| 59 | + * struct fsl_hv_ioctl_status - get a partition's status | |
| 60 | + * @ret: return error code from the hypervisor | |
| 61 | + * @partition: the ID of the partition to query, or -1 for the | |
| 62 | + * calling partition | |
| 63 | + * @status: The returned status of the partition | |
| 64 | + * | |
| 65 | + * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS | |
| 66 | + * | |
| 67 | + * Values of 'status': | |
| 68 | + * 0 = Stopped | |
| 69 | + * 1 = Running | |
| 70 | + * 2 = Starting | |
| 71 | + * 3 = Stopping | |
| 72 | + */ | |
| 73 | +struct fsl_hv_ioctl_status { | |
| 74 | + __u32 ret; | |
| 75 | + __u32 partition; | |
| 76 | + __u32 status; | |
| 77 | +}; | |
| 78 | + | |
| 79 | +/** | |
| 80 | + * struct fsl_hv_ioctl_start - start a partition | |
| 81 | + * @ret: return error code from the hypervisor | |
| 82 | + * @partition: the ID of the partition to control | |
| 83 | + * @entry_point: The offset within the guest IMA to start execution | |
| 84 | + * @load: If non-zero, reload the partition's images before starting | |
| 85 | + * | |
| 86 | + * Used by FSL_HV_IOCTL_PARTITION_START | |
| 87 | + */ | |
| 88 | +struct fsl_hv_ioctl_start { | |
| 89 | + __u32 ret; | |
| 90 | + __u32 partition; | |
| 91 | + __u32 entry_point; | |
| 92 | + __u32 load; | |
| 93 | +}; | |
| 94 | + | |
| 95 | +/** | |
| 96 | + * struct fsl_hv_ioctl_stop - stop a partition | |
| 97 | + * @ret: return error code from the hypervisor | |
| 98 | + * @partition: the ID of the partition to stop, or -1 for the calling | |
| 99 | + * partition | |
| 100 | + * | |
| 101 | + * Used by FSL_HV_IOCTL_PARTITION_STOP | |
| 102 | + */ | |
| 103 | +struct fsl_hv_ioctl_stop { | |
| 104 | + __u32 ret; | |
| 105 | + __u32 partition; | |
| 106 | +}; | |
| 107 | + | |
| 108 | +/** | |
| 109 | + * struct fsl_hv_ioctl_memcpy - copy memory between partitions | |
| 110 | + * @ret: return error code from the hypervisor | |
| 111 | + * @source: the partition ID of the source partition, or -1 for this | |
| 112 | + * partition | |
| 113 | + * @target: the partition ID of the target partition, or -1 for this | |
| 114 | + * partition | |
| 115 | + * @reserved: reserved, must be set to 0 | |
| 116 | + * @local_addr: user-space virtual address of a buffer in the local | |
| 117 | + * partition | |
| 118 | + * @remote_addr: guest physical address of a buffer in the | |
| 119 | + * remote partition | |
| 120 | + * @count: the number of bytes to copy. Both the local and remote | |
| 121 | + * buffers must be at least 'count' bytes long | |
| 122 | + * | |
| 123 | + * Used by FSL_HV_IOCTL_MEMCPY | |
| 124 | + * | |
| 125 | + * The 'local' partition is the partition that calls this ioctl. The | |
| 126 | + * 'remote' partition is a different partition. The data is copied from | |
| 127 | + * the 'source' paritition' to the 'target' partition. | |
| 128 | + * | |
| 129 | + * The buffer in the remote partition must be guest physically | |
| 130 | + * contiguous. | |
| 131 | + * | |
| 132 | + * This ioctl does not support copying memory between two remote | |
| 133 | + * partitions or within the same partition, so either 'source' or | |
| 134 | + * 'target' (but not both) must be -1. In other words, either | |
| 135 | + * | |
| 136 | + * source == local and target == remote | |
| 137 | + * or | |
| 138 | + * source == remote and target == local | |
| 139 | + */ | |
| 140 | +struct fsl_hv_ioctl_memcpy { | |
| 141 | + __u32 ret; | |
| 142 | + __u32 source; | |
| 143 | + __u32 target; | |
| 144 | + __u32 reserved; /* padding to ensure local_vaddr is aligned */ | |
| 145 | + __u64 local_vaddr; | |
| 146 | + __u64 remote_paddr; | |
| 147 | + __u64 count; | |
| 148 | +}; | |
| 149 | + | |
| 150 | +/** | |
| 151 | + * struct fsl_hv_ioctl_doorbell - ring a doorbell | |
| 152 | + * @ret: return error code from the hypervisor | |
| 153 | + * @doorbell: the handle of the doorbell to ring doorbell | |
| 154 | + * | |
| 155 | + * Used by FSL_HV_IOCTL_DOORBELL | |
| 156 | + */ | |
| 157 | +struct fsl_hv_ioctl_doorbell { | |
| 158 | + __u32 ret; | |
| 159 | + __u32 doorbell; | |
| 160 | +}; | |
| 161 | + | |
| 162 | +/** | |
| 163 | + * struct fsl_hv_ioctl_prop - get/set a device tree property | |
| 164 | + * @ret: return error code from the hypervisor | |
| 165 | + * @handle: handle of partition whose tree to access | |
| 166 | + * @path: virtual address of path name of node to access | |
| 167 | + * @propname: virtual address of name of property to access | |
| 168 | + * @propval: virtual address of property data buffer | |
| 169 | + * @proplen: Size of property data buffer | |
| 170 | + * @reserved: reserved, must be set to 0 | |
| 171 | + * | |
| 172 | + * Used by FSL_HV_IOCTL_DOORBELL | |
| 173 | + */ | |
| 174 | +struct fsl_hv_ioctl_prop { | |
| 175 | + __u32 ret; | |
| 176 | + __u32 handle; | |
| 177 | + __u64 path; | |
| 178 | + __u64 propname; | |
| 179 | + __u64 propval; | |
| 180 | + __u32 proplen; | |
| 181 | + __u32 reserved; /* padding to ensure structure is aligned */ | |
| 182 | +}; | |
| 183 | + | |
| 184 | +/* The ioctl type, documented in ioctl-number.txt */ | |
| 185 | +#define FSL_HV_IOCTL_TYPE 0xAF | |
| 186 | + | |
| 187 | +/* Restart another partition */ | |
| 188 | +#define FSL_HV_IOCTL_PARTITION_RESTART \ | |
| 189 | + _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart) | |
| 190 | + | |
| 191 | +/* Get a partition's status */ | |
| 192 | +#define FSL_HV_IOCTL_PARTITION_GET_STATUS \ | |
| 193 | + _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status) | |
| 194 | + | |
| 195 | +/* Boot another partition */ | |
| 196 | +#define FSL_HV_IOCTL_PARTITION_START \ | |
| 197 | + _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start) | |
| 198 | + | |
| 199 | +/* Stop this or another partition */ | |
| 200 | +#define FSL_HV_IOCTL_PARTITION_STOP \ | |
| 201 | + _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop) | |
| 202 | + | |
| 203 | +/* Copy data from one partition to another */ | |
| 204 | +#define FSL_HV_IOCTL_MEMCPY \ | |
| 205 | + _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy) | |
| 206 | + | |
| 207 | +/* Ring a doorbell */ | |
| 208 | +#define FSL_HV_IOCTL_DOORBELL \ | |
| 209 | + _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell) | |
| 210 | + | |
| 211 | +/* Get a property from another guest's device tree */ | |
| 212 | +#define FSL_HV_IOCTL_GETPROP \ | |
| 213 | + _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop) | |
| 214 | + | |
| 215 | +/* Set a property in another guest's device tree */ | |
| 216 | +#define FSL_HV_IOCTL_SETPROP \ | |
| 217 | + _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop) | |
| 218 | + | |
| 219 | + | |
| 220 | +#endif /* _UAPIFSL_HYPERVISOR_H */ | |
| @@ -0,0 +1,677 @@ | ||
| 1 | +/* | |
| 2 | + FUSE: Filesystem in Userspace | |
| 3 | + Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu> | |
| 4 | + | |
| 5 | + This program can be distributed under the terms of the GNU GPL. | |
| 6 | + See the file COPYING. | |
| 7 | +*/ | |
| 8 | + | |
| 9 | +/* | |
| 10 | + * This file defines the kernel interface of FUSE | |
| 11 | + * | |
| 12 | + * Protocol changelog: | |
| 13 | + * | |
| 14 | + * 7.9: | |
| 15 | + * - new fuse_getattr_in input argument of GETATTR | |
| 16 | + * - add lk_flags in fuse_lk_in | |
| 17 | + * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in | |
| 18 | + * - add blksize field to fuse_attr | |
| 19 | + * - add file flags field to fuse_read_in and fuse_write_in | |
| 20 | + * | |
| 21 | + * 7.10 | |
| 22 | + * - add nonseekable open flag | |
| 23 | + * | |
| 24 | + * 7.11 | |
| 25 | + * - add IOCTL message | |
| 26 | + * - add unsolicited notification support | |
| 27 | + * - add POLL message and NOTIFY_POLL notification | |
| 28 | + * | |
| 29 | + * 7.12 | |
| 30 | + * - add umask flag to input argument of open, mknod and mkdir | |
| 31 | + * - add notification messages for invalidation of inodes and | |
| 32 | + * directory entries | |
| 33 | + * | |
| 34 | + * 7.13 | |
| 35 | + * - make max number of background requests and congestion threshold | |
| 36 | + * tunables | |
| 37 | + * | |
| 38 | + * 7.14 | |
| 39 | + * - add splice support to fuse device | |
| 40 | + * | |
| 41 | + * 7.15 | |
| 42 | + * - add store notify | |
| 43 | + * - add retrieve notify | |
| 44 | + * | |
| 45 | + * 7.16 | |
| 46 | + * - add BATCH_FORGET request | |
| 47 | + * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct | |
| 48 | + * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' | |
| 49 | + * - add FUSE_IOCTL_32BIT flag | |
| 50 | + * | |
| 51 | + * 7.17 | |
| 52 | + * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK | |
| 53 | + * | |
| 54 | + * 7.18 | |
| 55 | + * - add FUSE_IOCTL_DIR flag | |
| 56 | + * - add FUSE_NOTIFY_DELETE | |
| 57 | + * | |
| 58 | + * 7.19 | |
| 59 | + * - add FUSE_FALLOCATE | |
| 60 | + * | |
| 61 | + * 7.20 | |
| 62 | + * - add FUSE_AUTO_INVAL_DATA | |
| 63 | + */ | |
| 64 | + | |
| 65 | +#ifndef _LINUX_FUSE_H | |
| 66 | +#define _LINUX_FUSE_H | |
| 67 | + | |
| 68 | +#include <linux/types.h> | |
| 69 | + | |
| 70 | +/* | |
| 71 | + * Version negotiation: | |
| 72 | + * | |
| 73 | + * Both the kernel and userspace send the version they support in the | |
| 74 | + * INIT request and reply respectively. | |
| 75 | + * | |
| 76 | + * If the major versions match then both shall use the smallest | |
| 77 | + * of the two minor versions for communication. | |
| 78 | + * | |
| 79 | + * If the kernel supports a larger major version, then userspace shall | |
| 80 | + * reply with the major version it supports, ignore the rest of the | |
| 81 | + * INIT message and expect a new INIT message from the kernel with a | |
| 82 | + * matching major version. | |
| 83 | + * | |
| 84 | + * If the library supports a larger major version, then it shall fall | |
| 85 | + * back to the major protocol version sent by the kernel for | |
| 86 | + * communication and reply with that major version (and an arbitrary | |
| 87 | + * supported minor version). | |
| 88 | + */ | |
| 89 | + | |
| 90 | +/** Version number of this interface */ | |
| 91 | +#define FUSE_KERNEL_VERSION 7 | |
| 92 | + | |
| 93 | +/** Minor version number of this interface */ | |
| 94 | +#define FUSE_KERNEL_MINOR_VERSION 20 | |
| 95 | + | |
| 96 | +/** The node ID of the root inode */ | |
| 97 | +#define FUSE_ROOT_ID 1 | |
| 98 | + | |
| 99 | +/* Make sure all structures are padded to 64bit boundary, so 32bit | |
| 100 | + userspace works under 64bit kernels */ | |
| 101 | + | |
| 102 | +struct fuse_attr { | |
| 103 | + __u64 ino; | |
| 104 | + __u64 size; | |
| 105 | + __u64 blocks; | |
| 106 | + __u64 atime; | |
| 107 | + __u64 mtime; | |
| 108 | + __u64 ctime; | |
| 109 | + __u32 atimensec; | |
| 110 | + __u32 mtimensec; | |
| 111 | + __u32 ctimensec; | |
| 112 | + __u32 mode; | |
| 113 | + __u32 nlink; | |
| 114 | + __u32 uid; | |
| 115 | + __u32 gid; | |
| 116 | + __u32 rdev; | |
| 117 | + __u32 blksize; | |
| 118 | + __u32 padding; | |
| 119 | +}; | |
| 120 | + | |
| 121 | +struct fuse_kstatfs { | |
| 122 | + __u64 blocks; | |
| 123 | + __u64 bfree; | |
| 124 | + __u64 bavail; | |
| 125 | + __u64 files; | |
| 126 | + __u64 ffree; | |
| 127 | + __u32 bsize; | |
| 128 | + __u32 namelen; | |
| 129 | + __u32 frsize; | |
| 130 | + __u32 padding; | |
| 131 | + __u32 spare[6]; | |
| 132 | +}; | |
| 133 | + | |
| 134 | +struct fuse_file_lock { | |
| 135 | + __u64 start; | |
| 136 | + __u64 end; | |
| 137 | + __u32 type; | |
| 138 | + __u32 pid; /* tgid */ | |
| 139 | +}; | |
| 140 | + | |
| 141 | +/** | |
| 142 | + * Bitmasks for fuse_setattr_in.valid | |
| 143 | + */ | |
| 144 | +#define FATTR_MODE (1 << 0) | |
| 145 | +#define FATTR_UID (1 << 1) | |
| 146 | +#define FATTR_GID (1 << 2) | |
| 147 | +#define FATTR_SIZE (1 << 3) | |
| 148 | +#define FATTR_ATIME (1 << 4) | |
| 149 | +#define FATTR_MTIME (1 << 5) | |
| 150 | +#define FATTR_FH (1 << 6) | |
| 151 | +#define FATTR_ATIME_NOW (1 << 7) | |
| 152 | +#define FATTR_MTIME_NOW (1 << 8) | |
| 153 | +#define FATTR_LOCKOWNER (1 << 9) | |
| 154 | + | |
| 155 | +/** | |
| 156 | + * Flags returned by the OPEN request | |
| 157 | + * | |
| 158 | + * FOPEN_DIRECT_IO: bypass page cache for this open file | |
| 159 | + * FOPEN_KEEP_CACHE: don't invalidate the data cache on open | |
| 160 | + * FOPEN_NONSEEKABLE: the file is not seekable | |
| 161 | + */ | |
| 162 | +#define FOPEN_DIRECT_IO (1 << 0) | |
| 163 | +#define FOPEN_KEEP_CACHE (1 << 1) | |
| 164 | +#define FOPEN_NONSEEKABLE (1 << 2) | |
| 165 | + | |
| 166 | +/** | |
| 167 | + * INIT request/reply flags | |
| 168 | + * | |
| 169 | + * FUSE_ASYNC_READ: asynchronous read requests | |
| 170 | + * FUSE_POSIX_LOCKS: remote locking for POSIX file locks | |
| 171 | + * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported) | |
| 172 | + * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem | |
| 173 | + * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." | |
| 174 | + * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB | |
| 175 | + * FUSE_DONT_MASK: don't apply umask to file mode on create operations | |
| 176 | + * FUSE_SPLICE_WRITE: kernel supports splice write on the device | |
| 177 | + * FUSE_SPLICE_MOVE: kernel supports splice move on the device | |
| 178 | + * FUSE_SPLICE_READ: kernel supports splice read on the device | |
| 179 | + * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks | |
| 180 | + * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories | |
| 181 | + * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages | |
| 182 | + */ | |
| 183 | +#define FUSE_ASYNC_READ (1 << 0) | |
| 184 | +#define FUSE_POSIX_LOCKS (1 << 1) | |
| 185 | +#define FUSE_FILE_OPS (1 << 2) | |
| 186 | +#define FUSE_ATOMIC_O_TRUNC (1 << 3) | |
| 187 | +#define FUSE_EXPORT_SUPPORT (1 << 4) | |
| 188 | +#define FUSE_BIG_WRITES (1 << 5) | |
| 189 | +#define FUSE_DONT_MASK (1 << 6) | |
| 190 | +#define FUSE_SPLICE_WRITE (1 << 7) | |
| 191 | +#define FUSE_SPLICE_MOVE (1 << 8) | |
| 192 | +#define FUSE_SPLICE_READ (1 << 9) | |
| 193 | +#define FUSE_FLOCK_LOCKS (1 << 10) | |
| 194 | +#define FUSE_HAS_IOCTL_DIR (1 << 11) | |
| 195 | +#define FUSE_AUTO_INVAL_DATA (1 << 12) | |
| 196 | + | |
| 197 | +/** | |
| 198 | + * CUSE INIT request/reply flags | |
| 199 | + * | |
| 200 | + * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl | |
| 201 | + */ | |
| 202 | +#define CUSE_UNRESTRICTED_IOCTL (1 << 0) | |
| 203 | + | |
| 204 | +/** | |
| 205 | + * Release flags | |
| 206 | + */ | |
| 207 | +#define FUSE_RELEASE_FLUSH (1 << 0) | |
| 208 | +#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1) | |
| 209 | + | |
| 210 | +/** | |
| 211 | + * Getattr flags | |
| 212 | + */ | |
| 213 | +#define FUSE_GETATTR_FH (1 << 0) | |
| 214 | + | |
| 215 | +/** | |
| 216 | + * Lock flags | |
| 217 | + */ | |
| 218 | +#define FUSE_LK_FLOCK (1 << 0) | |
| 219 | + | |
| 220 | +/** | |
| 221 | + * WRITE flags | |
| 222 | + * | |
| 223 | + * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed | |
| 224 | + * FUSE_WRITE_LOCKOWNER: lock_owner field is valid | |
| 225 | + */ | |
| 226 | +#define FUSE_WRITE_CACHE (1 << 0) | |
| 227 | +#define FUSE_WRITE_LOCKOWNER (1 << 1) | |
| 228 | + | |
| 229 | +/** | |
| 230 | + * Read flags | |
| 231 | + */ | |
| 232 | +#define FUSE_READ_LOCKOWNER (1 << 1) | |
| 233 | + | |
| 234 | +/** | |
| 235 | + * Ioctl flags | |
| 236 | + * | |
| 237 | + * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine | |
| 238 | + * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed | |
| 239 | + * FUSE_IOCTL_RETRY: retry with new iovecs | |
| 240 | + * FUSE_IOCTL_32BIT: 32bit ioctl | |
| 241 | + * FUSE_IOCTL_DIR: is a directory | |
| 242 | + * | |
| 243 | + * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs | |
| 244 | + */ | |
| 245 | +#define FUSE_IOCTL_COMPAT (1 << 0) | |
| 246 | +#define FUSE_IOCTL_UNRESTRICTED (1 << 1) | |
| 247 | +#define FUSE_IOCTL_RETRY (1 << 2) | |
| 248 | +#define FUSE_IOCTL_32BIT (1 << 3) | |
| 249 | +#define FUSE_IOCTL_DIR (1 << 4) | |
| 250 | + | |
| 251 | +#define FUSE_IOCTL_MAX_IOV 256 | |
| 252 | + | |
| 253 | +/** | |
| 254 | + * Poll flags | |
| 255 | + * | |
| 256 | + * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify | |
| 257 | + */ | |
| 258 | +#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) | |
| 259 | + | |
| 260 | +enum fuse_opcode { | |
| 261 | + FUSE_LOOKUP = 1, | |
| 262 | + FUSE_FORGET = 2, /* no reply */ | |
| 263 | + FUSE_GETATTR = 3, | |
| 264 | + FUSE_SETATTR = 4, | |
| 265 | + FUSE_READLINK = 5, | |
| 266 | + FUSE_SYMLINK = 6, | |
| 267 | + FUSE_MKNOD = 8, | |
| 268 | + FUSE_MKDIR = 9, | |
| 269 | + FUSE_UNLINK = 10, | |
| 270 | + FUSE_RMDIR = 11, | |
| 271 | + FUSE_RENAME = 12, | |
| 272 | + FUSE_LINK = 13, | |
| 273 | + FUSE_OPEN = 14, | |
| 274 | + FUSE_READ = 15, | |
| 275 | + FUSE_WRITE = 16, | |
| 276 | + FUSE_STATFS = 17, | |
| 277 | + FUSE_RELEASE = 18, | |
| 278 | + FUSE_FSYNC = 20, | |
| 279 | + FUSE_SETXATTR = 21, | |
| 280 | + FUSE_GETXATTR = 22, | |
| 281 | + FUSE_LISTXATTR = 23, | |
| 282 | + FUSE_REMOVEXATTR = 24, | |
| 283 | + FUSE_FLUSH = 25, | |
| 284 | + FUSE_INIT = 26, | |
| 285 | + FUSE_OPENDIR = 27, | |
| 286 | + FUSE_READDIR = 28, | |
| 287 | + FUSE_RELEASEDIR = 29, | |
| 288 | + FUSE_FSYNCDIR = 30, | |
| 289 | + FUSE_GETLK = 31, | |
| 290 | + FUSE_SETLK = 32, | |
| 291 | + FUSE_SETLKW = 33, | |
| 292 | + FUSE_ACCESS = 34, | |
| 293 | + FUSE_CREATE = 35, | |
| 294 | + FUSE_INTERRUPT = 36, | |
| 295 | + FUSE_BMAP = 37, | |
| 296 | + FUSE_DESTROY = 38, | |
| 297 | + FUSE_IOCTL = 39, | |
| 298 | + FUSE_POLL = 40, | |
| 299 | + FUSE_NOTIFY_REPLY = 41, | |
| 300 | + FUSE_BATCH_FORGET = 42, | |
| 301 | + FUSE_FALLOCATE = 43, | |
| 302 | + | |
| 303 | + /* CUSE specific operations */ | |
| 304 | + CUSE_INIT = 4096, | |
| 305 | +}; | |
| 306 | + | |
| 307 | +enum fuse_notify_code { | |
| 308 | + FUSE_NOTIFY_POLL = 1, | |
| 309 | + FUSE_NOTIFY_INVAL_INODE = 2, | |
| 310 | + FUSE_NOTIFY_INVAL_ENTRY = 3, | |
| 311 | + FUSE_NOTIFY_STORE = 4, | |
| 312 | + FUSE_NOTIFY_RETRIEVE = 5, | |
| 313 | + FUSE_NOTIFY_DELETE = 6, | |
| 314 | + FUSE_NOTIFY_CODE_MAX, | |
| 315 | +}; | |
| 316 | + | |
| 317 | +/* The read buffer is required to be at least 8k, but may be much larger */ | |
| 318 | +#define FUSE_MIN_READ_BUFFER 8192 | |
| 319 | + | |
| 320 | +#define FUSE_COMPAT_ENTRY_OUT_SIZE 120 | |
| 321 | + | |
| 322 | +struct fuse_entry_out { | |
| 323 | + __u64 nodeid; /* Inode ID */ | |
| 324 | + __u64 generation; /* Inode generation: nodeid:gen must | |
| 325 | + be unique for the fs's lifetime */ | |
| 326 | + __u64 entry_valid; /* Cache timeout for the name */ | |
| 327 | + __u64 attr_valid; /* Cache timeout for the attributes */ | |
| 328 | + __u32 entry_valid_nsec; | |
| 329 | + __u32 attr_valid_nsec; | |
| 330 | + struct fuse_attr attr; | |
| 331 | +}; | |
| 332 | + | |
| 333 | +struct fuse_forget_in { | |
| 334 | + __u64 nlookup; | |
| 335 | +}; | |
| 336 | + | |
| 337 | +struct fuse_forget_one { | |
| 338 | + __u64 nodeid; | |
| 339 | + __u64 nlookup; | |
| 340 | +}; | |
| 341 | + | |
| 342 | +struct fuse_batch_forget_in { | |
| 343 | + __u32 count; | |
| 344 | + __u32 dummy; | |
| 345 | +}; | |
| 346 | + | |
| 347 | +struct fuse_getattr_in { | |
| 348 | + __u32 getattr_flags; | |
| 349 | + __u32 dummy; | |
| 350 | + __u64 fh; | |
| 351 | +}; | |
| 352 | + | |
| 353 | +#define FUSE_COMPAT_ATTR_OUT_SIZE 96 | |
| 354 | + | |
| 355 | +struct fuse_attr_out { | |
| 356 | + __u64 attr_valid; /* Cache timeout for the attributes */ | |
| 357 | + __u32 attr_valid_nsec; | |
| 358 | + __u32 dummy; | |
| 359 | + struct fuse_attr attr; | |
| 360 | +}; | |
| 361 | + | |
| 362 | +#define FUSE_COMPAT_MKNOD_IN_SIZE 8 | |
| 363 | + | |
| 364 | +struct fuse_mknod_in { | |
| 365 | + __u32 mode; | |
| 366 | + __u32 rdev; | |
| 367 | + __u32 umask; | |
| 368 | + __u32 padding; | |
| 369 | +}; | |
| 370 | + | |
| 371 | +struct fuse_mkdir_in { | |
| 372 | + __u32 mode; | |
| 373 | + __u32 umask; | |
| 374 | +}; | |
| 375 | + | |
| 376 | +struct fuse_rename_in { | |
| 377 | + __u64 newdir; | |
| 378 | +}; | |
| 379 | + | |
| 380 | +struct fuse_link_in { | |
| 381 | + __u64 oldnodeid; | |
| 382 | +}; | |
| 383 | + | |
| 384 | +struct fuse_setattr_in { | |
| 385 | + __u32 valid; | |
| 386 | + __u32 padding; | |
| 387 | + __u64 fh; | |
| 388 | + __u64 size; | |
| 389 | + __u64 lock_owner; | |
| 390 | + __u64 atime; | |
| 391 | + __u64 mtime; | |
| 392 | + __u64 unused2; | |
| 393 | + __u32 atimensec; | |
| 394 | + __u32 mtimensec; | |
| 395 | + __u32 unused3; | |
| 396 | + __u32 mode; | |
| 397 | + __u32 unused4; | |
| 398 | + __u32 uid; | |
| 399 | + __u32 gid; | |
| 400 | + __u32 unused5; | |
| 401 | +}; | |
| 402 | + | |
| 403 | +struct fuse_open_in { | |
| 404 | + __u32 flags; | |
| 405 | + __u32 unused; | |
| 406 | +}; | |
| 407 | + | |
| 408 | +struct fuse_create_in { | |
| 409 | + __u32 flags; | |
| 410 | + __u32 mode; | |
| 411 | + __u32 umask; | |
| 412 | + __u32 padding; | |
| 413 | +}; | |
| 414 | + | |
| 415 | +struct fuse_open_out { | |
| 416 | + __u64 fh; | |
| 417 | + __u32 open_flags; | |
| 418 | + __u32 padding; | |
| 419 | +}; | |
| 420 | + | |
| 421 | +struct fuse_release_in { | |
| 422 | + __u64 fh; | |
| 423 | + __u32 flags; | |
| 424 | + __u32 release_flags; | |
| 425 | + __u64 lock_owner; | |
| 426 | +}; | |
| 427 | + | |
| 428 | +struct fuse_flush_in { | |
| 429 | + __u64 fh; | |
| 430 | + __u32 unused; | |
| 431 | + __u32 padding; | |
| 432 | + __u64 lock_owner; | |
| 433 | +}; | |
| 434 | + | |
| 435 | +struct fuse_read_in { | |
| 436 | + __u64 fh; | |
| 437 | + __u64 offset; | |
| 438 | + __u32 size; | |
| 439 | + __u32 read_flags; | |
| 440 | + __u64 lock_owner; | |
| 441 | + __u32 flags; | |
| 442 | + __u32 padding; | |
| 443 | +}; | |
| 444 | + | |
| 445 | +#define FUSE_COMPAT_WRITE_IN_SIZE 24 | |
| 446 | + | |
| 447 | +struct fuse_write_in { | |
| 448 | + __u64 fh; | |
| 449 | + __u64 offset; | |
| 450 | + __u32 size; | |
| 451 | + __u32 write_flags; | |
| 452 | + __u64 lock_owner; | |
| 453 | + __u32 flags; | |
| 454 | + __u32 padding; | |
| 455 | +}; | |
| 456 | + | |
| 457 | +struct fuse_write_out { | |
| 458 | + __u32 size; | |
| 459 | + __u32 padding; | |
| 460 | +}; | |
| 461 | + | |
| 462 | +#define FUSE_COMPAT_STATFS_SIZE 48 | |
| 463 | + | |
| 464 | +struct fuse_statfs_out { | |
| 465 | + struct fuse_kstatfs st; | |
| 466 | +}; | |
| 467 | + | |
| 468 | +struct fuse_fsync_in { | |
| 469 | + __u64 fh; | |
| 470 | + __u32 fsync_flags; | |
| 471 | + __u32 padding; | |
| 472 | +}; | |
| 473 | + | |
| 474 | +struct fuse_setxattr_in { | |
| 475 | + __u32 size; | |
| 476 | + __u32 flags; | |
| 477 | +}; | |
| 478 | + | |
| 479 | +struct fuse_getxattr_in { | |
| 480 | + __u32 size; | |
| 481 | + __u32 padding; | |
| 482 | +}; | |
| 483 | + | |
| 484 | +struct fuse_getxattr_out { | |
| 485 | + __u32 size; | |
| 486 | + __u32 padding; | |
| 487 | +}; | |
| 488 | + | |
| 489 | +struct fuse_lk_in { | |
| 490 | + __u64 fh; | |
| 491 | + __u64 owner; | |
| 492 | + struct fuse_file_lock lk; | |
| 493 | + __u32 lk_flags; | |
| 494 | + __u32 padding; | |
| 495 | +}; | |
| 496 | + | |
| 497 | +struct fuse_lk_out { | |
| 498 | + struct fuse_file_lock lk; | |
| 499 | +}; | |
| 500 | + | |
| 501 | +struct fuse_access_in { | |
| 502 | + __u32 mask; | |
| 503 | + __u32 padding; | |
| 504 | +}; | |
| 505 | + | |
| 506 | +struct fuse_init_in { | |
| 507 | + __u32 major; | |
| 508 | + __u32 minor; | |
| 509 | + __u32 max_readahead; | |
| 510 | + __u32 flags; | |
| 511 | +}; | |
| 512 | + | |
| 513 | +struct fuse_init_out { | |
| 514 | + __u32 major; | |
| 515 | + __u32 minor; | |
| 516 | + __u32 max_readahead; | |
| 517 | + __u32 flags; | |
| 518 | + __u16 max_background; | |
| 519 | + __u16 congestion_threshold; | |
| 520 | + __u32 max_write; | |
| 521 | +}; | |
| 522 | + | |
| 523 | +#define CUSE_INIT_INFO_MAX 4096 | |
| 524 | + | |
| 525 | +struct cuse_init_in { | |
| 526 | + __u32 major; | |
| 527 | + __u32 minor; | |
| 528 | + __u32 unused; | |
| 529 | + __u32 flags; | |
| 530 | +}; | |
| 531 | + | |
| 532 | +struct cuse_init_out { | |
| 533 | + __u32 major; | |
| 534 | + __u32 minor; | |
| 535 | + __u32 unused; | |
| 536 | + __u32 flags; | |
| 537 | + __u32 max_read; | |
| 538 | + __u32 max_write; | |
| 539 | + __u32 dev_major; /* chardev major */ | |
| 540 | + __u32 dev_minor; /* chardev minor */ | |
| 541 | + __u32 spare[10]; | |
| 542 | +}; | |
| 543 | + | |
| 544 | +struct fuse_interrupt_in { | |
| 545 | + __u64 unique; | |
| 546 | +}; | |
| 547 | + | |
| 548 | +struct fuse_bmap_in { | |
| 549 | + __u64 block; | |
| 550 | + __u32 blocksize; | |
| 551 | + __u32 padding; | |
| 552 | +}; | |
| 553 | + | |
| 554 | +struct fuse_bmap_out { | |
| 555 | + __u64 block; | |
| 556 | +}; | |
| 557 | + | |
| 558 | +struct fuse_ioctl_in { | |
| 559 | + __u64 fh; | |
| 560 | + __u32 flags; | |
| 561 | + __u32 cmd; | |
| 562 | + __u64 arg; | |
| 563 | + __u32 in_size; | |
| 564 | + __u32 out_size; | |
| 565 | +}; | |
| 566 | + | |
| 567 | +struct fuse_ioctl_iovec { | |
| 568 | + __u64 base; | |
| 569 | + __u64 len; | |
| 570 | +}; | |
| 571 | + | |
| 572 | +struct fuse_ioctl_out { | |
| 573 | + __s32 result; | |
| 574 | + __u32 flags; | |
| 575 | + __u32 in_iovs; | |
| 576 | + __u32 out_iovs; | |
| 577 | +}; | |
| 578 | + | |
| 579 | +struct fuse_poll_in { | |
| 580 | + __u64 fh; | |
| 581 | + __u64 kh; | |
| 582 | + __u32 flags; | |
| 583 | + __u32 padding; | |
| 584 | +}; | |
| 585 | + | |
| 586 | +struct fuse_poll_out { | |
| 587 | + __u32 revents; | |
| 588 | + __u32 padding; | |
| 589 | +}; | |
| 590 | + | |
| 591 | +struct fuse_notify_poll_wakeup_out { | |
| 592 | + __u64 kh; | |
| 593 | +}; | |
| 594 | + | |
| 595 | +struct fuse_fallocate_in { | |
| 596 | + __u64 fh; | |
| 597 | + __u64 offset; | |
| 598 | + __u64 length; | |
| 599 | + __u32 mode; | |
| 600 | + __u32 padding; | |
| 601 | +}; | |
| 602 | + | |
| 603 | +struct fuse_in_header { | |
| 604 | + __u32 len; | |
| 605 | + __u32 opcode; | |
| 606 | + __u64 unique; | |
| 607 | + __u64 nodeid; | |
| 608 | + __u32 uid; | |
| 609 | + __u32 gid; | |
| 610 | + __u32 pid; | |
| 611 | + __u32 padding; | |
| 612 | +}; | |
| 613 | + | |
| 614 | +struct fuse_out_header { | |
| 615 | + __u32 len; | |
| 616 | + __s32 error; | |
| 617 | + __u64 unique; | |
| 618 | +}; | |
| 619 | + | |
| 620 | +struct fuse_dirent { | |
| 621 | + __u64 ino; | |
| 622 | + __u64 off; | |
| 623 | + __u32 namelen; | |
| 624 | + __u32 type; | |
| 625 | + char name[]; | |
| 626 | +}; | |
| 627 | + | |
| 628 | +#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) | |
| 629 | +#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | |
| 630 | +#define FUSE_DIRENT_SIZE(d) \ | |
| 631 | + FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | |
| 632 | + | |
| 633 | +struct fuse_notify_inval_inode_out { | |
| 634 | + __u64 ino; | |
| 635 | + __s64 off; | |
| 636 | + __s64 len; | |
| 637 | +}; | |
| 638 | + | |
| 639 | +struct fuse_notify_inval_entry_out { | |
| 640 | + __u64 parent; | |
| 641 | + __u32 namelen; | |
| 642 | + __u32 padding; | |
| 643 | +}; | |
| 644 | + | |
| 645 | +struct fuse_notify_delete_out { | |
| 646 | + __u64 parent; | |
| 647 | + __u64 child; | |
| 648 | + __u32 namelen; | |
| 649 | + __u32 padding; | |
| 650 | +}; | |
| 651 | + | |
| 652 | +struct fuse_notify_store_out { | |
| 653 | + __u64 nodeid; | |
| 654 | + __u64 offset; | |
| 655 | + __u32 size; | |
| 656 | + __u32 padding; | |
| 657 | +}; | |
| 658 | + | |
| 659 | +struct fuse_notify_retrieve_out { | |
| 660 | + __u64 notify_unique; | |
| 661 | + __u64 nodeid; | |
| 662 | + __u64 offset; | |
| 663 | + __u32 size; | |
| 664 | + __u32 padding; | |
| 665 | +}; | |
| 666 | + | |
| 667 | +/* Matches the size of fuse_write_in */ | |
| 668 | +struct fuse_notify_retrieve_in { | |
| 669 | + __u64 dummy1; | |
| 670 | + __u64 offset; | |
| 671 | + __u32 size; | |
| 672 | + __u32 dummy2; | |
| 673 | + __u64 dummy3; | |
| 674 | + __u64 dummy4; | |
| 675 | +}; | |
| 676 | + | |
| 677 | +#endif /* _LINUX_FUSE_H */ | |
| @@ -0,0 +1,152 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_FUTEX_H | |
| 2 | +#define _UAPI_LINUX_FUTEX_H | |
| 3 | + | |
| 4 | +#include <linux/compiler.h> | |
| 5 | +#include <linux/types.h> | |
| 6 | + | |
| 7 | +/* Second argument to futex syscall */ | |
| 8 | + | |
| 9 | + | |
| 10 | +#define FUTEX_WAIT 0 | |
| 11 | +#define FUTEX_WAKE 1 | |
| 12 | +#define FUTEX_FD 2 | |
| 13 | +#define FUTEX_REQUEUE 3 | |
| 14 | +#define FUTEX_CMP_REQUEUE 4 | |
| 15 | +#define FUTEX_WAKE_OP 5 | |
| 16 | +#define FUTEX_LOCK_PI 6 | |
| 17 | +#define FUTEX_UNLOCK_PI 7 | |
| 18 | +#define FUTEX_TRYLOCK_PI 8 | |
| 19 | +#define FUTEX_WAIT_BITSET 9 | |
| 20 | +#define FUTEX_WAKE_BITSET 10 | |
| 21 | +#define FUTEX_WAIT_REQUEUE_PI 11 | |
| 22 | +#define FUTEX_CMP_REQUEUE_PI 12 | |
| 23 | + | |
| 24 | +#define FUTEX_PRIVATE_FLAG 128 | |
| 25 | +#define FUTEX_CLOCK_REALTIME 256 | |
| 26 | +#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) | |
| 27 | + | |
| 28 | +#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) | |
| 29 | +#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) | |
| 30 | +#define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG) | |
| 31 | +#define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG) | |
| 32 | +#define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG) | |
| 33 | +#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) | |
| 34 | +#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) | |
| 35 | +#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) | |
| 36 | +#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG) | |
| 37 | +#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG) | |
| 38 | +#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \ | |
| 39 | + FUTEX_PRIVATE_FLAG) | |
| 40 | +#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \ | |
| 41 | + FUTEX_PRIVATE_FLAG) | |
| 42 | + | |
| 43 | +/* | |
| 44 | + * Support for robust futexes: the kernel cleans up held futexes at | |
| 45 | + * thread exit time. | |
| 46 | + */ | |
| 47 | + | |
| 48 | +/* | |
| 49 | + * Per-lock list entry - embedded in user-space locks, somewhere close | |
| 50 | + * to the futex field. (Note: user-space uses a double-linked list to | |
| 51 | + * achieve O(1) list add and remove, but the kernel only needs to know | |
| 52 | + * about the forward link) | |
| 53 | + * | |
| 54 | + * NOTE: this structure is part of the syscall ABI, and must not be | |
| 55 | + * changed. | |
| 56 | + */ | |
| 57 | +struct robust_list { | |
| 58 | + struct robust_list __user *next; | |
| 59 | +}; | |
| 60 | + | |
| 61 | +/* | |
| 62 | + * Per-thread list head: | |
| 63 | + * | |
| 64 | + * NOTE: this structure is part of the syscall ABI, and must only be | |
| 65 | + * changed if the change is first communicated with the glibc folks. | |
| 66 | + * (When an incompatible change is done, we'll increase the structure | |
| 67 | + * size, which glibc will detect) | |
| 68 | + */ | |
| 69 | +struct robust_list_head { | |
| 70 | + /* | |
| 71 | + * The head of the list. Points back to itself if empty: | |
| 72 | + */ | |
| 73 | + struct robust_list list; | |
| 74 | + | |
| 75 | + /* | |
| 76 | + * This relative offset is set by user-space, it gives the kernel | |
| 77 | + * the relative position of the futex field to examine. This way | |
| 78 | + * we keep userspace flexible, to freely shape its data-structure, | |
| 79 | + * without hardcoding any particular offset into the kernel: | |
| 80 | + */ | |
| 81 | + long futex_offset; | |
| 82 | + | |
| 83 | + /* | |
| 84 | + * The death of the thread may race with userspace setting | |
| 85 | + * up a lock's links. So to handle this race, userspace first | |
| 86 | + * sets this field to the address of the to-be-taken lock, | |
| 87 | + * then does the lock acquire, and then adds itself to the | |
| 88 | + * list, and then clears this field. Hence the kernel will | |
| 89 | + * always have full knowledge of all locks that the thread | |
| 90 | + * _might_ have taken. We check the owner TID in any case, | |
| 91 | + * so only truly owned locks will be handled. | |
| 92 | + */ | |
| 93 | + struct robust_list __user *list_op_pending; | |
| 94 | +}; | |
| 95 | + | |
| 96 | +/* | |
| 97 | + * Are there any waiters for this robust futex: | |
| 98 | + */ | |
| 99 | +#define FUTEX_WAITERS 0x80000000 | |
| 100 | + | |
| 101 | +/* | |
| 102 | + * The kernel signals via this bit that a thread holding a futex | |
| 103 | + * has exited without unlocking the futex. The kernel also does | |
| 104 | + * a FUTEX_WAKE on such futexes, after setting the bit, to wake | |
| 105 | + * up any possible waiters: | |
| 106 | + */ | |
| 107 | +#define FUTEX_OWNER_DIED 0x40000000 | |
| 108 | + | |
| 109 | +/* | |
| 110 | + * The rest of the robust-futex field is for the TID: | |
| 111 | + */ | |
| 112 | +#define FUTEX_TID_MASK 0x3fffffff | |
| 113 | + | |
| 114 | +/* | |
| 115 | + * This limit protects against a deliberately circular list. | |
| 116 | + * (Not worth introducing an rlimit for it) | |
| 117 | + */ | |
| 118 | +#define ROBUST_LIST_LIMIT 2048 | |
| 119 | + | |
| 120 | +/* | |
| 121 | + * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a | |
| 122 | + * match of any bit. | |
| 123 | + */ | |
| 124 | +#define FUTEX_BITSET_MATCH_ANY 0xffffffff | |
| 125 | + | |
| 126 | + | |
| 127 | +#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ | |
| 128 | +#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ | |
| 129 | +#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ | |
| 130 | +#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */ | |
| 131 | +#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */ | |
| 132 | + | |
| 133 | +#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */ | |
| 134 | + | |
| 135 | +#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */ | |
| 136 | +#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */ | |
| 137 | +#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */ | |
| 138 | +#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */ | |
| 139 | +#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ | |
| 140 | +#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ | |
| 141 | + | |
| 142 | +/* FUTEX_WAKE_OP will perform atomically | |
| 143 | + int oldval = *(int *)UADDR2; | |
| 144 | + *(int *)UADDR2 = oldval OP OPARG; | |
| 145 | + if (oldval CMP CMPARG) | |
| 146 | + wake UADDR2; */ | |
| 147 | + | |
| 148 | +#define FUTEX_OP(op, oparg, cmp, cmparg) \ | |
| 149 | + (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \ | |
| 150 | + | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)) | |
| 151 | + | |
| 152 | +#endif /* _UAPI_LINUX_FUTEX_H */ | |
| @@ -0,0 +1,28 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1999-2002 Vojtech Pavlik | |
| 3 | + * | |
| 4 | + * This program is free software; you can redistribute it and/or modify it | |
| 5 | + * under the terms of the GNU General Public License version 2 as published by | |
| 6 | + * the Free Software Foundation. | |
| 7 | + */ | |
| 8 | +#ifndef _UAPI_GAMEPORT_H | |
| 9 | +#define _UAPI_GAMEPORT_H | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | +#define GAMEPORT_MODE_DISABLED 0 | |
| 14 | +#define GAMEPORT_MODE_RAW 1 | |
| 15 | +#define GAMEPORT_MODE_COOKED 2 | |
| 16 | + | |
| 17 | +#define GAMEPORT_ID_VENDOR_ANALOG 0x0001 | |
| 18 | +#define GAMEPORT_ID_VENDOR_MADCATZ 0x0002 | |
| 19 | +#define GAMEPORT_ID_VENDOR_LOGITECH 0x0003 | |
| 20 | +#define GAMEPORT_ID_VENDOR_CREATIVE 0x0004 | |
| 21 | +#define GAMEPORT_ID_VENDOR_GENIUS 0x0005 | |
| 22 | +#define GAMEPORT_ID_VENDOR_INTERACT 0x0006 | |
| 23 | +#define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007 | |
| 24 | +#define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008 | |
| 25 | +#define GAMEPORT_ID_VENDOR_GRAVIS 0x0009 | |
| 26 | +#define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a | |
| 27 | + | |
| 28 | +#endif /* _UAPI_GAMEPORT_H */ | |
| @@ -0,0 +1,67 @@ | ||
| 1 | +#ifndef __LINUX_GEN_STATS_H | |
| 2 | +#define __LINUX_GEN_STATS_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +enum { | |
| 7 | + TCA_STATS_UNSPEC, | |
| 8 | + TCA_STATS_BASIC, | |
| 9 | + TCA_STATS_RATE_EST, | |
| 10 | + TCA_STATS_QUEUE, | |
| 11 | + TCA_STATS_APP, | |
| 12 | + __TCA_STATS_MAX, | |
| 13 | +}; | |
| 14 | +#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * struct gnet_stats_basic - byte/packet throughput statistics | |
| 18 | + * @bytes: number of seen bytes | |
| 19 | + * @packets: number of seen packets | |
| 20 | + */ | |
| 21 | +struct gnet_stats_basic { | |
| 22 | + __u64 bytes; | |
| 23 | + __u32 packets; | |
| 24 | +}; | |
| 25 | +struct gnet_stats_basic_packed { | |
| 26 | + __u64 bytes; | |
| 27 | + __u32 packets; | |
| 28 | +} __attribute__ ((packed)); | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * struct gnet_stats_rate_est - rate estimator | |
| 32 | + * @bps: current byte rate | |
| 33 | + * @pps: current packet rate | |
| 34 | + */ | |
| 35 | +struct gnet_stats_rate_est { | |
| 36 | + __u32 bps; | |
| 37 | + __u32 pps; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * struct gnet_stats_queue - queuing statistics | |
| 42 | + * @qlen: queue length | |
| 43 | + * @backlog: backlog size of queue | |
| 44 | + * @drops: number of dropped packets | |
| 45 | + * @requeues: number of requeues | |
| 46 | + * @overlimits: number of enqueues over the limit | |
| 47 | + */ | |
| 48 | +struct gnet_stats_queue { | |
| 49 | + __u32 qlen; | |
| 50 | + __u32 backlog; | |
| 51 | + __u32 drops; | |
| 52 | + __u32 requeues; | |
| 53 | + __u32 overlimits; | |
| 54 | +}; | |
| 55 | + | |
| 56 | +/** | |
| 57 | + * struct gnet_estimator - rate estimator configuration | |
| 58 | + * @interval: sampling period | |
| 59 | + * @ewma_log: the log of measurement window weight | |
| 60 | + */ | |
| 61 | +struct gnet_estimator { | |
| 62 | + signed char interval; | |
| 63 | + unsigned char ewma_log; | |
| 64 | +}; | |
| 65 | + | |
| 66 | + | |
| 67 | +#endif /* __LINUX_GEN_STATS_H */ | |
| @@ -0,0 +1,84 @@ | ||
| 1 | +#ifndef _UAPI__LINUX_GENERIC_NETLINK_H | |
| 2 | +#define _UAPI__LINUX_GENERIC_NETLINK_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/netlink.h> | |
| 6 | + | |
| 7 | +#define GENL_NAMSIZ 16 /* length of family name */ | |
| 8 | + | |
| 9 | +#define GENL_MIN_ID NLMSG_MIN_TYPE | |
| 10 | +#define GENL_MAX_ID 1023 | |
| 11 | + | |
| 12 | +struct genlmsghdr { | |
| 13 | + __u8 cmd; | |
| 14 | + __u8 version; | |
| 15 | + __u16 reserved; | |
| 16 | +}; | |
| 17 | + | |
| 18 | +#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) | |
| 19 | + | |
| 20 | +#define GENL_ADMIN_PERM 0x01 | |
| 21 | +#define GENL_CMD_CAP_DO 0x02 | |
| 22 | +#define GENL_CMD_CAP_DUMP 0x04 | |
| 23 | +#define GENL_CMD_CAP_HASPOL 0x08 | |
| 24 | + | |
| 25 | +/* | |
| 26 | + * List of reserved static generic netlink identifiers: | |
| 27 | + */ | |
| 28 | +#define GENL_ID_GENERATE 0 | |
| 29 | +#define GENL_ID_CTRL NLMSG_MIN_TYPE | |
| 30 | + | |
| 31 | +/************************************************************************** | |
| 32 | + * Controller | |
| 33 | + **************************************************************************/ | |
| 34 | + | |
| 35 | +enum { | |
| 36 | + CTRL_CMD_UNSPEC, | |
| 37 | + CTRL_CMD_NEWFAMILY, | |
| 38 | + CTRL_CMD_DELFAMILY, | |
| 39 | + CTRL_CMD_GETFAMILY, | |
| 40 | + CTRL_CMD_NEWOPS, | |
| 41 | + CTRL_CMD_DELOPS, | |
| 42 | + CTRL_CMD_GETOPS, | |
| 43 | + CTRL_CMD_NEWMCAST_GRP, | |
| 44 | + CTRL_CMD_DELMCAST_GRP, | |
| 45 | + CTRL_CMD_GETMCAST_GRP, /* unused */ | |
| 46 | + __CTRL_CMD_MAX, | |
| 47 | +}; | |
| 48 | + | |
| 49 | +#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) | |
| 50 | + | |
| 51 | +enum { | |
| 52 | + CTRL_ATTR_UNSPEC, | |
| 53 | + CTRL_ATTR_FAMILY_ID, | |
| 54 | + CTRL_ATTR_FAMILY_NAME, | |
| 55 | + CTRL_ATTR_VERSION, | |
| 56 | + CTRL_ATTR_HDRSIZE, | |
| 57 | + CTRL_ATTR_MAXATTR, | |
| 58 | + CTRL_ATTR_OPS, | |
| 59 | + CTRL_ATTR_MCAST_GROUPS, | |
| 60 | + __CTRL_ATTR_MAX, | |
| 61 | +}; | |
| 62 | + | |
| 63 | +#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) | |
| 64 | + | |
| 65 | +enum { | |
| 66 | + CTRL_ATTR_OP_UNSPEC, | |
| 67 | + CTRL_ATTR_OP_ID, | |
| 68 | + CTRL_ATTR_OP_FLAGS, | |
| 69 | + __CTRL_ATTR_OP_MAX, | |
| 70 | +}; | |
| 71 | + | |
| 72 | +#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) | |
| 73 | + | |
| 74 | +enum { | |
| 75 | + CTRL_ATTR_MCAST_GRP_UNSPEC, | |
| 76 | + CTRL_ATTR_MCAST_GRP_NAME, | |
| 77 | + CTRL_ATTR_MCAST_GRP_ID, | |
| 78 | + __CTRL_ATTR_MCAST_GRP_MAX, | |
| 79 | +}; | |
| 80 | + | |
| 81 | +#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) | |
| 82 | + | |
| 83 | + | |
| 84 | +#endif /* _UAPI__LINUX_GENERIC_NETLINK_H */ | |
| @@ -0,0 +1,464 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | |
| 3 | + * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. | |
| 4 | + * | |
| 5 | + * This copyrighted material is made available to anyone wishing to use, | |
| 6 | + * modify, copy, or redistribute it subject to the terms and conditions | |
| 7 | + * of the GNU General Public License v.2. | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#ifndef __GFS2_ONDISK_DOT_H__ | |
| 11 | +#define __GFS2_ONDISK_DOT_H__ | |
| 12 | + | |
| 13 | +#include <linux/types.h> | |
| 14 | + | |
| 15 | +#define GFS2_MAGIC 0x01161970 | |
| 16 | +#define GFS2_BASIC_BLOCK 512 | |
| 17 | +#define GFS2_BASIC_BLOCK_SHIFT 9 | |
| 18 | + | |
| 19 | +/* Lock numbers of the LM_TYPE_NONDISK type */ | |
| 20 | + | |
| 21 | +#define GFS2_MOUNT_LOCK 0 | |
| 22 | +#define GFS2_LIVE_LOCK 1 | |
| 23 | +#define GFS2_TRANS_LOCK 2 | |
| 24 | +#define GFS2_RENAME_LOCK 3 | |
| 25 | +#define GFS2_CONTROL_LOCK 4 | |
| 26 | +#define GFS2_MOUNTED_LOCK 5 | |
| 27 | + | |
| 28 | +/* Format numbers for various metadata types */ | |
| 29 | + | |
| 30 | +#define GFS2_FORMAT_NONE 0 | |
| 31 | +#define GFS2_FORMAT_SB 100 | |
| 32 | +#define GFS2_FORMAT_RG 200 | |
| 33 | +#define GFS2_FORMAT_RB 300 | |
| 34 | +#define GFS2_FORMAT_DI 400 | |
| 35 | +#define GFS2_FORMAT_IN 500 | |
| 36 | +#define GFS2_FORMAT_LF 600 | |
| 37 | +#define GFS2_FORMAT_JD 700 | |
| 38 | +#define GFS2_FORMAT_LH 800 | |
| 39 | +#define GFS2_FORMAT_LD 900 | |
| 40 | +#define GFS2_FORMAT_LB 1000 | |
| 41 | +#define GFS2_FORMAT_EA 1600 | |
| 42 | +#define GFS2_FORMAT_ED 1700 | |
| 43 | +#define GFS2_FORMAT_QC 1400 | |
| 44 | +/* These are format numbers for entities contained in files */ | |
| 45 | +#define GFS2_FORMAT_RI 1100 | |
| 46 | +#define GFS2_FORMAT_DE 1200 | |
| 47 | +#define GFS2_FORMAT_QU 1500 | |
| 48 | +/* These are part of the superblock */ | |
| 49 | +#define GFS2_FORMAT_FS 1801 | |
| 50 | +#define GFS2_FORMAT_MULTI 1900 | |
| 51 | + | |
| 52 | +/* | |
| 53 | + * An on-disk inode number | |
| 54 | + */ | |
| 55 | + | |
| 56 | +struct gfs2_inum { | |
| 57 | + __be64 no_formal_ino; | |
| 58 | + __be64 no_addr; | |
| 59 | +}; | |
| 60 | + | |
| 61 | +/* | |
| 62 | + * Generic metadata head structure | |
| 63 | + * Every inplace buffer logged in the journal must start with this. | |
| 64 | + */ | |
| 65 | + | |
| 66 | +#define GFS2_METATYPE_NONE 0 | |
| 67 | +#define GFS2_METATYPE_SB 1 | |
| 68 | +#define GFS2_METATYPE_RG 2 | |
| 69 | +#define GFS2_METATYPE_RB 3 | |
| 70 | +#define GFS2_METATYPE_DI 4 | |
| 71 | +#define GFS2_METATYPE_IN 5 | |
| 72 | +#define GFS2_METATYPE_LF 6 | |
| 73 | +#define GFS2_METATYPE_JD 7 | |
| 74 | +#define GFS2_METATYPE_LH 8 | |
| 75 | +#define GFS2_METATYPE_LD 9 | |
| 76 | +#define GFS2_METATYPE_LB 12 | |
| 77 | +#define GFS2_METATYPE_EA 10 | |
| 78 | +#define GFS2_METATYPE_ED 11 | |
| 79 | +#define GFS2_METATYPE_QC 14 | |
| 80 | + | |
| 81 | +struct gfs2_meta_header { | |
| 82 | + __be32 mh_magic; | |
| 83 | + __be32 mh_type; | |
| 84 | + __be64 __pad0; /* Was generation number in gfs1 */ | |
| 85 | + __be32 mh_format; | |
| 86 | + /* This union is to keep userspace happy */ | |
| 87 | + union { | |
| 88 | + __be32 mh_jid; /* Was incarnation number in gfs1 */ | |
| 89 | + __be32 __pad1; | |
| 90 | + }; | |
| 91 | +}; | |
| 92 | + | |
| 93 | +/* | |
| 94 | + * super-block structure | |
| 95 | + * | |
| 96 | + * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes) | |
| 97 | + * | |
| 98 | + * Order is important, need to be able to read old superblocks to do on-disk | |
| 99 | + * version upgrades. | |
| 100 | + */ | |
| 101 | + | |
| 102 | +/* Address of superblock in GFS2 basic blocks */ | |
| 103 | +#define GFS2_SB_ADDR 128 | |
| 104 | + | |
| 105 | +/* The lock number for the superblock (must be zero) */ | |
| 106 | +#define GFS2_SB_LOCK 0 | |
| 107 | + | |
| 108 | +/* Requirement: GFS2_LOCKNAME_LEN % 8 == 0 | |
| 109 | + Includes: the fencing zero at the end */ | |
| 110 | +#define GFS2_LOCKNAME_LEN 64 | |
| 111 | + | |
| 112 | +struct gfs2_sb { | |
| 113 | + struct gfs2_meta_header sb_header; | |
| 114 | + | |
| 115 | + __be32 sb_fs_format; | |
| 116 | + __be32 sb_multihost_format; | |
| 117 | + __u32 __pad0; /* Was superblock flags in gfs1 */ | |
| 118 | + | |
| 119 | + __be32 sb_bsize; | |
| 120 | + __be32 sb_bsize_shift; | |
| 121 | + __u32 __pad1; /* Was journal segment size in gfs1 */ | |
| 122 | + | |
| 123 | + struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ | |
| 124 | + struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ | |
| 125 | + struct gfs2_inum sb_root_dir; | |
| 126 | + | |
| 127 | + char sb_lockproto[GFS2_LOCKNAME_LEN]; | |
| 128 | + char sb_locktable[GFS2_LOCKNAME_LEN]; | |
| 129 | + | |
| 130 | + struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ | |
| 131 | + struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ | |
| 132 | +#define GFS2_HAS_UUID 1 | |
| 133 | + __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ | |
| 134 | +}; | |
| 135 | + | |
| 136 | +/* | |
| 137 | + * resource index structure | |
| 138 | + */ | |
| 139 | + | |
| 140 | +struct gfs2_rindex { | |
| 141 | + __be64 ri_addr; /* grp block disk address */ | |
| 142 | + __be32 ri_length; /* length of rgrp header in fs blocks */ | |
| 143 | + __u32 __pad; | |
| 144 | + | |
| 145 | + __be64 ri_data0; /* first data location */ | |
| 146 | + __be32 ri_data; /* num of data blocks in rgrp */ | |
| 147 | + | |
| 148 | + __be32 ri_bitbytes; /* number of bytes in data bitmaps */ | |
| 149 | + | |
| 150 | + __u8 ri_reserved[64]; | |
| 151 | +}; | |
| 152 | + | |
| 153 | +/* | |
| 154 | + * resource group header structure | |
| 155 | + */ | |
| 156 | + | |
| 157 | +/* Number of blocks per byte in rgrp */ | |
| 158 | +#define GFS2_NBBY 4 | |
| 159 | +#define GFS2_BIT_SIZE 2 | |
| 160 | +#define GFS2_BIT_MASK 0x00000003 | |
| 161 | + | |
| 162 | +#define GFS2_BLKST_FREE 0 | |
| 163 | +#define GFS2_BLKST_USED 1 | |
| 164 | +#define GFS2_BLKST_UNLINKED 2 | |
| 165 | +#define GFS2_BLKST_DINODE 3 | |
| 166 | + | |
| 167 | +#define GFS2_RGF_JOURNAL 0x00000001 | |
| 168 | +#define GFS2_RGF_METAONLY 0x00000002 | |
| 169 | +#define GFS2_RGF_DATAONLY 0x00000004 | |
| 170 | +#define GFS2_RGF_NOALLOC 0x00000008 | |
| 171 | +#define GFS2_RGF_TRIMMED 0x00000010 | |
| 172 | + | |
| 173 | +struct gfs2_rgrp_lvb { | |
| 174 | + __be32 rl_magic; | |
| 175 | + __be32 rl_flags; | |
| 176 | + __be32 rl_free; | |
| 177 | + __be32 rl_dinodes; | |
| 178 | + __be64 rl_igeneration; | |
| 179 | + __be32 rl_unlinked; | |
| 180 | + __be32 __pad; | |
| 181 | +}; | |
| 182 | + | |
| 183 | +struct gfs2_rgrp { | |
| 184 | + struct gfs2_meta_header rg_header; | |
| 185 | + | |
| 186 | + __be32 rg_flags; | |
| 187 | + __be32 rg_free; | |
| 188 | + __be32 rg_dinodes; | |
| 189 | + __be32 __pad; | |
| 190 | + __be64 rg_igeneration; | |
| 191 | + | |
| 192 | + __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */ | |
| 193 | +}; | |
| 194 | + | |
| 195 | +/* | |
| 196 | + * quota structure | |
| 197 | + */ | |
| 198 | + | |
| 199 | +struct gfs2_quota { | |
| 200 | + __be64 qu_limit; | |
| 201 | + __be64 qu_warn; | |
| 202 | + __be64 qu_value; | |
| 203 | + __u8 qu_reserved[64]; | |
| 204 | +}; | |
| 205 | + | |
| 206 | +/* | |
| 207 | + * dinode structure | |
| 208 | + */ | |
| 209 | + | |
| 210 | +#define GFS2_MAX_META_HEIGHT 10 | |
| 211 | +#define GFS2_DIR_MAX_DEPTH 17 | |
| 212 | + | |
| 213 | +#define DT2IF(dt) (((dt) << 12) & S_IFMT) | |
| 214 | +#define IF2DT(sif) (((sif) & S_IFMT) >> 12) | |
| 215 | + | |
| 216 | +enum { | |
| 217 | + gfs2fl_Jdata = 0, | |
| 218 | + gfs2fl_ExHash = 1, | |
| 219 | + gfs2fl_Unused = 2, | |
| 220 | + gfs2fl_EaIndirect = 3, | |
| 221 | + gfs2fl_Directio = 4, | |
| 222 | + gfs2fl_Immutable = 5, | |
| 223 | + gfs2fl_AppendOnly = 6, | |
| 224 | + gfs2fl_NoAtime = 7, | |
| 225 | + gfs2fl_Sync = 8, | |
| 226 | + gfs2fl_System = 9, | |
| 227 | + gfs2fl_TopLevel = 10, | |
| 228 | + gfs2fl_TruncInProg = 29, | |
| 229 | + gfs2fl_InheritDirectio = 30, | |
| 230 | + gfs2fl_InheritJdata = 31, | |
| 231 | +}; | |
| 232 | + | |
| 233 | +/* Dinode flags */ | |
| 234 | +#define GFS2_DIF_JDATA 0x00000001 | |
| 235 | +#define GFS2_DIF_EXHASH 0x00000002 | |
| 236 | +#define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */ | |
| 237 | +#define GFS2_DIF_EA_INDIRECT 0x00000008 | |
| 238 | +#define GFS2_DIF_DIRECTIO 0x00000010 | |
| 239 | +#define GFS2_DIF_IMMUTABLE 0x00000020 | |
| 240 | +#define GFS2_DIF_APPENDONLY 0x00000040 | |
| 241 | +#define GFS2_DIF_NOATIME 0x00000080 | |
| 242 | +#define GFS2_DIF_SYNC 0x00000100 | |
| 243 | +#define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */ | |
| 244 | +#define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */ | |
| 245 | +#define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */ | |
| 246 | +#define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */ | |
| 247 | +#define GFS2_DIF_INHERIT_JDATA 0x80000000 | |
| 248 | + | |
| 249 | +struct gfs2_dinode { | |
| 250 | + struct gfs2_meta_header di_header; | |
| 251 | + | |
| 252 | + struct gfs2_inum di_num; | |
| 253 | + | |
| 254 | + __be32 di_mode; /* mode of file */ | |
| 255 | + __be32 di_uid; /* owner's user id */ | |
| 256 | + __be32 di_gid; /* owner's group id */ | |
| 257 | + __be32 di_nlink; /* number of links to this file */ | |
| 258 | + __be64 di_size; /* number of bytes in file */ | |
| 259 | + __be64 di_blocks; /* number of blocks in file */ | |
| 260 | + __be64 di_atime; /* time last accessed */ | |
| 261 | + __be64 di_mtime; /* time last modified */ | |
| 262 | + __be64 di_ctime; /* time last changed */ | |
| 263 | + __be32 di_major; /* device major number */ | |
| 264 | + __be32 di_minor; /* device minor number */ | |
| 265 | + | |
| 266 | + /* This section varies from gfs1. Padding added to align with | |
| 267 | + * remainder of dinode | |
| 268 | + */ | |
| 269 | + __be64 di_goal_meta; /* rgrp to alloc from next */ | |
| 270 | + __be64 di_goal_data; /* data block goal */ | |
| 271 | + __be64 di_generation; /* generation number for NFS */ | |
| 272 | + | |
| 273 | + __be32 di_flags; /* GFS2_DIF_... */ | |
| 274 | + __be32 di_payload_format; /* GFS2_FORMAT_... */ | |
| 275 | + __u16 __pad1; /* Was ditype in gfs1 */ | |
| 276 | + __be16 di_height; /* height of metadata */ | |
| 277 | + __u32 __pad2; /* Unused incarnation number from gfs1 */ | |
| 278 | + | |
| 279 | + /* These only apply to directories */ | |
| 280 | + __u16 __pad3; /* Padding */ | |
| 281 | + __be16 di_depth; /* Number of bits in the table */ | |
| 282 | + __be32 di_entries; /* The number of entries in the directory */ | |
| 283 | + | |
| 284 | + struct gfs2_inum __pad4; /* Unused even in current gfs1 */ | |
| 285 | + | |
| 286 | + __be64 di_eattr; /* extended attribute block number */ | |
| 287 | + __be32 di_atime_nsec; /* nsec portion of atime */ | |
| 288 | + __be32 di_mtime_nsec; /* nsec portion of mtime */ | |
| 289 | + __be32 di_ctime_nsec; /* nsec portion of ctime */ | |
| 290 | + | |
| 291 | + __u8 di_reserved[44]; | |
| 292 | +}; | |
| 293 | + | |
| 294 | +/* | |
| 295 | + * directory structure - many of these per directory file | |
| 296 | + */ | |
| 297 | + | |
| 298 | +#define GFS2_FNAMESIZE 255 | |
| 299 | +#define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7) | |
| 300 | + | |
| 301 | +struct gfs2_dirent { | |
| 302 | + struct gfs2_inum de_inum; | |
| 303 | + __be32 de_hash; | |
| 304 | + __be16 de_rec_len; | |
| 305 | + __be16 de_name_len; | |
| 306 | + __be16 de_type; | |
| 307 | + __u8 __pad[14]; | |
| 308 | +}; | |
| 309 | + | |
| 310 | +/* | |
| 311 | + * Header of leaf directory nodes | |
| 312 | + */ | |
| 313 | + | |
| 314 | +struct gfs2_leaf { | |
| 315 | + struct gfs2_meta_header lf_header; | |
| 316 | + | |
| 317 | + __be16 lf_depth; /* Depth of leaf */ | |
| 318 | + __be16 lf_entries; /* Number of dirents in leaf */ | |
| 319 | + __be32 lf_dirent_format; /* Format of the dirents */ | |
| 320 | + __be64 lf_next; /* Next leaf, if overflow */ | |
| 321 | + | |
| 322 | + __u8 lf_reserved[64]; | |
| 323 | +}; | |
| 324 | + | |
| 325 | +/* | |
| 326 | + * Extended attribute header format | |
| 327 | + * | |
| 328 | + * This works in a similar way to dirents. There is a fixed size header | |
| 329 | + * followed by a variable length section made up of the name and the | |
| 330 | + * associated data. In the case of a "stuffed" entry, the value is | |
| 331 | + * inline directly after the name, the ea_num_ptrs entry will be | |
| 332 | + * zero in that case. For non-"stuffed" entries, there will be | |
| 333 | + * a set of pointers (aligned to 8 byte boundary) to the block(s) | |
| 334 | + * containing the value. | |
| 335 | + * | |
| 336 | + * The blocks containing the values and the blocks containing the | |
| 337 | + * extended attribute headers themselves all start with the common | |
| 338 | + * metadata header. Each inode, if it has extended attributes, will | |
| 339 | + * have either a single block containing the extended attribute headers | |
| 340 | + * or a single indirect block pointing to blocks containing the | |
| 341 | + * extended attribure headers. | |
| 342 | + * | |
| 343 | + * The maximim size of the data part of an extended attribute is 64k | |
| 344 | + * so the number of blocks required depends upon block size. Since the | |
| 345 | + * block size also determines the number of pointers in an indirect | |
| 346 | + * block, its a fairly complicated calculation to work out the maximum | |
| 347 | + * number of blocks that an inode may have relating to extended attributes. | |
| 348 | + * | |
| 349 | + */ | |
| 350 | + | |
| 351 | +#define GFS2_EA_MAX_NAME_LEN 255 | |
| 352 | +#define GFS2_EA_MAX_DATA_LEN 65536 | |
| 353 | + | |
| 354 | +#define GFS2_EATYPE_UNUSED 0 | |
| 355 | +#define GFS2_EATYPE_USR 1 | |
| 356 | +#define GFS2_EATYPE_SYS 2 | |
| 357 | +#define GFS2_EATYPE_SECURITY 3 | |
| 358 | + | |
| 359 | +#define GFS2_EATYPE_LAST 3 | |
| 360 | +#define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST) | |
| 361 | + | |
| 362 | +#define GFS2_EAFLAG_LAST 0x01 /* last ea in block */ | |
| 363 | + | |
| 364 | +struct gfs2_ea_header { | |
| 365 | + __be32 ea_rec_len; | |
| 366 | + __be32 ea_data_len; | |
| 367 | + __u8 ea_name_len; /* no NULL pointer after the string */ | |
| 368 | + __u8 ea_type; /* GFS2_EATYPE_... */ | |
| 369 | + __u8 ea_flags; /* GFS2_EAFLAG_... */ | |
| 370 | + __u8 ea_num_ptrs; | |
| 371 | + __u32 __pad; | |
| 372 | +}; | |
| 373 | + | |
| 374 | +/* | |
| 375 | + * Log header structure | |
| 376 | + */ | |
| 377 | + | |
| 378 | +#define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */ | |
| 379 | + | |
| 380 | +struct gfs2_log_header { | |
| 381 | + struct gfs2_meta_header lh_header; | |
| 382 | + | |
| 383 | + __be64 lh_sequence; /* Sequence number of this transaction */ | |
| 384 | + __be32 lh_flags; /* GFS2_LOG_HEAD_... */ | |
| 385 | + __be32 lh_tail; /* Block number of log tail */ | |
| 386 | + __be32 lh_blkno; | |
| 387 | + __be32 lh_hash; | |
| 388 | +}; | |
| 389 | + | |
| 390 | +/* | |
| 391 | + * Log type descriptor | |
| 392 | + */ | |
| 393 | + | |
| 394 | +#define GFS2_LOG_DESC_METADATA 300 | |
| 395 | +/* ld_data1 is the number of metadata blocks in the descriptor. | |
| 396 | + ld_data2 is unused. */ | |
| 397 | + | |
| 398 | +#define GFS2_LOG_DESC_REVOKE 301 | |
| 399 | +/* ld_data1 is the number of revoke blocks in the descriptor. | |
| 400 | + ld_data2 is unused. */ | |
| 401 | + | |
| 402 | +#define GFS2_LOG_DESC_JDATA 302 | |
| 403 | +/* ld_data1 is the number of data blocks in the descriptor. | |
| 404 | + ld_data2 is unused. */ | |
| 405 | + | |
| 406 | +struct gfs2_log_descriptor { | |
| 407 | + struct gfs2_meta_header ld_header; | |
| 408 | + | |
| 409 | + __be32 ld_type; /* GFS2_LOG_DESC_... */ | |
| 410 | + __be32 ld_length; /* Number of buffers in this chunk */ | |
| 411 | + __be32 ld_data1; /* descriptor-specific field */ | |
| 412 | + __be32 ld_data2; /* descriptor-specific field */ | |
| 413 | + | |
| 414 | + __u8 ld_reserved[32]; | |
| 415 | +}; | |
| 416 | + | |
| 417 | +/* | |
| 418 | + * Inum Range | |
| 419 | + * Describe a range of formal inode numbers allocated to | |
| 420 | + * one machine to assign to inodes. | |
| 421 | + */ | |
| 422 | + | |
| 423 | +#define GFS2_INUM_QUANTUM 1048576 | |
| 424 | + | |
| 425 | +struct gfs2_inum_range { | |
| 426 | + __be64 ir_start; | |
| 427 | + __be64 ir_length; | |
| 428 | +}; | |
| 429 | + | |
| 430 | +/* | |
| 431 | + * Statfs change | |
| 432 | + * Describes an change to the pool of free and allocated | |
| 433 | + * blocks. | |
| 434 | + */ | |
| 435 | + | |
| 436 | +struct gfs2_statfs_change { | |
| 437 | + __be64 sc_total; | |
| 438 | + __be64 sc_free; | |
| 439 | + __be64 sc_dinodes; | |
| 440 | +}; | |
| 441 | + | |
| 442 | +/* | |
| 443 | + * Quota change | |
| 444 | + * Describes an allocation change for a particular | |
| 445 | + * user or group. | |
| 446 | + */ | |
| 447 | + | |
| 448 | +#define GFS2_QCF_USER 0x00000001 | |
| 449 | + | |
| 450 | +struct gfs2_quota_change { | |
| 451 | + __be64 qc_change; | |
| 452 | + __be32 qc_flags; /* GFS2_QCF_... */ | |
| 453 | + __be32 qc_id; | |
| 454 | +}; | |
| 455 | + | |
| 456 | +struct gfs2_quota_lvb { | |
| 457 | + __be32 qb_magic; | |
| 458 | + __u32 __pad; | |
| 459 | + __be64 qb_limit; /* Hard limit of # blocks to alloc */ | |
| 460 | + __be64 qb_warn; /* Warn user when alloc is above this # */ | |
| 461 | + __be64 qb_value; /* Current # blocks allocated */ | |
| 462 | +}; | |
| 463 | + | |
| 464 | +#endif /* __GFS2_ONDISK_DOT_H__ */ | |
| @@ -0,0 +1,38 @@ | ||
| 1 | +/* | |
| 2 | + * interface to user space for the gigaset driver | |
| 3 | + * | |
| 4 | + * Copyright (c) 2004 by Hansjoerg Lipp <hjlipp@web.de> | |
| 5 | + * | |
| 6 | + * ===================================================================== | |
| 7 | + * This program is free software; you can redistribute it and/or | |
| 8 | + * modify it under the terms of the GNU General Public License as | |
| 9 | + * published by the Free Software Foundation; either version 2 of | |
| 10 | + * the License, or (at your option) any later version. | |
| 11 | + * ===================================================================== | |
| 12 | + */ | |
| 13 | + | |
| 14 | +#ifndef GIGASET_INTERFACE_H | |
| 15 | +#define GIGASET_INTERFACE_H | |
| 16 | + | |
| 17 | +#include <linux/ioctl.h> | |
| 18 | + | |
| 19 | +/* The magic IOCTL value for this interface. */ | |
| 20 | +#define GIGASET_IOCTL 0x47 | |
| 21 | + | |
| 22 | +/* enable/disable device control via character device (lock out ISDN subsys) */ | |
| 23 | +#define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int) | |
| 24 | + | |
| 25 | +/* enable adapter configuration mode (M10x only) */ | |
| 26 | +#define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int) | |
| 27 | + | |
| 28 | +/* set break characters (M105 only) */ | |
| 29 | +#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6]) | |
| 30 | + | |
| 31 | +/* get version information selected by arg[0] */ | |
| 32 | +#define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4]) | |
| 33 | +/* values for GIGASET_VERSION arg[0] */ | |
| 34 | +#define GIGVER_DRIVER 0 /* get driver version */ | |
| 35 | +#define GIGVER_COMPAT 1 /* get interface compatibility version */ | |
| 36 | +#define GIGVER_FWBASE 2 /* get base station firmware version */ | |
| 37 | + | |
| 38 | +#endif | |
| @@ -0,0 +1,23 @@ | ||
| 1 | +/* | |
| 2 | + * Generic HDLC support routines for Linux | |
| 3 | + * | |
| 4 | + * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl> | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or modify it | |
| 7 | + * under the terms of version 2 of the GNU General Public License | |
| 8 | + * as published by the Free Software Foundation. | |
| 9 | + */ | |
| 10 | + | |
| 11 | +#ifndef _UAPI__HDLC_H | |
| 12 | +#define _UAPI__HDLC_H | |
| 13 | + | |
| 14 | + | |
| 15 | +#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ | |
| 16 | +#if 0 | |
| 17 | +#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ | |
| 18 | +#else | |
| 19 | +#define HDLC_MAX_MRU 1600 /* as required for FR network */ | |
| 20 | +#endif | |
| 21 | + | |
| 22 | + | |
| 23 | +#endif /* _UAPI__HDLC_H */ | |
| @@ -0,0 +1,110 @@ | ||
| 1 | +/* | |
| 2 | + * hdlcdrv.h -- HDLC packet radio network driver. | |
| 3 | + * The Linux soundcard driver for 1200 baud and 9600 baud packet radio | |
| 4 | + * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA | |
| 5 | + */ | |
| 6 | + | |
| 7 | +#ifndef _UAPI_HDLCDRV_H | |
| 8 | +#define _UAPI_HDLCDRV_H | |
| 9 | + | |
| 10 | +/* -------------------------------------------------------------------- */ | |
| 11 | +/* | |
| 12 | + * structs for the IOCTL commands | |
| 13 | + */ | |
| 14 | + | |
| 15 | +struct hdlcdrv_params { | |
| 16 | + int iobase; | |
| 17 | + int irq; | |
| 18 | + int dma; | |
| 19 | + int dma2; | |
| 20 | + int seriobase; | |
| 21 | + int pariobase; | |
| 22 | + int midiiobase; | |
| 23 | +}; | |
| 24 | + | |
| 25 | +struct hdlcdrv_channel_params { | |
| 26 | + int tx_delay; /* the transmitter keyup delay in 10ms units */ | |
| 27 | + int tx_tail; /* the transmitter keyoff delay in 10ms units */ | |
| 28 | + int slottime; /* the slottime in 10ms; usually 10 = 100ms */ | |
| 29 | + int ppersist; /* the p-persistence 0..255 */ | |
| 30 | + int fulldup; /* some driver do not support full duplex, setting */ | |
| 31 | + /* this just makes them send even if DCD is on */ | |
| 32 | +}; | |
| 33 | + | |
| 34 | +struct hdlcdrv_old_channel_state { | |
| 35 | + int ptt; | |
| 36 | + int dcd; | |
| 37 | + int ptt_keyed; | |
| 38 | +}; | |
| 39 | + | |
| 40 | +struct hdlcdrv_channel_state { | |
| 41 | + int ptt; | |
| 42 | + int dcd; | |
| 43 | + int ptt_keyed; | |
| 44 | + unsigned long tx_packets; | |
| 45 | + unsigned long tx_errors; | |
| 46 | + unsigned long rx_packets; | |
| 47 | + unsigned long rx_errors; | |
| 48 | +}; | |
| 49 | + | |
| 50 | +struct hdlcdrv_ioctl { | |
| 51 | + int cmd; | |
| 52 | + union { | |
| 53 | + struct hdlcdrv_params mp; | |
| 54 | + struct hdlcdrv_channel_params cp; | |
| 55 | + struct hdlcdrv_channel_state cs; | |
| 56 | + struct hdlcdrv_old_channel_state ocs; | |
| 57 | + unsigned int calibrate; | |
| 58 | + unsigned char bits; | |
| 59 | + char modename[128]; | |
| 60 | + char drivername[32]; | |
| 61 | + } data; | |
| 62 | +}; | |
| 63 | + | |
| 64 | +/* -------------------------------------------------------------------- */ | |
| 65 | + | |
| 66 | +/* | |
| 67 | + * ioctl values | |
| 68 | + */ | |
| 69 | +#define HDLCDRVCTL_GETMODEMPAR 0 | |
| 70 | +#define HDLCDRVCTL_SETMODEMPAR 1 | |
| 71 | +#define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */ | |
| 72 | +#define HDLCDRVCTL_GETCHANNELPAR 10 | |
| 73 | +#define HDLCDRVCTL_SETCHANNELPAR 11 | |
| 74 | +#define HDLCDRVCTL_OLDGETSTAT 20 | |
| 75 | +#define HDLCDRVCTL_CALIBRATE 21 | |
| 76 | +#define HDLCDRVCTL_GETSTAT 22 | |
| 77 | + | |
| 78 | +/* | |
| 79 | + * these are mainly for debugging purposes | |
| 80 | + */ | |
| 81 | +#define HDLCDRVCTL_GETSAMPLES 30 | |
| 82 | +#define HDLCDRVCTL_GETBITS 31 | |
| 83 | + | |
| 84 | +/* | |
| 85 | + * not handled by hdlcdrv, but by its depending drivers | |
| 86 | + */ | |
| 87 | +#define HDLCDRVCTL_GETMODE 40 | |
| 88 | +#define HDLCDRVCTL_SETMODE 41 | |
| 89 | +#define HDLCDRVCTL_MODELIST 42 | |
| 90 | +#define HDLCDRVCTL_DRIVERNAME 43 | |
| 91 | + | |
| 92 | +/* | |
| 93 | + * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK | |
| 94 | + */ | |
| 95 | +#define HDLCDRV_PARMASK_IOBASE (1<<0) | |
| 96 | +#define HDLCDRV_PARMASK_IRQ (1<<1) | |
| 97 | +#define HDLCDRV_PARMASK_DMA (1<<2) | |
| 98 | +#define HDLCDRV_PARMASK_DMA2 (1<<3) | |
| 99 | +#define HDLCDRV_PARMASK_SERIOBASE (1<<4) | |
| 100 | +#define HDLCDRV_PARMASK_PARIOBASE (1<<5) | |
| 101 | +#define HDLCDRV_PARMASK_MIDIIOBASE (1<<6) | |
| 102 | + | |
| 103 | +/* -------------------------------------------------------------------- */ | |
| 104 | + | |
| 105 | + | |
| 106 | +/* -------------------------------------------------------------------- */ | |
| 107 | + | |
| 108 | +#endif /* _UAPI_HDLCDRV_H */ | |
| 109 | + | |
| 110 | +/* -------------------------------------------------------------------- */ | |
| @@ -0,0 +1,658 @@ | ||
| 1 | +#ifndef _LINUX_HDREG_H | |
| 2 | +#define _LINUX_HDREG_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | + | |
| 6 | +/* | |
| 7 | + * Command Header sizes for IOCTL commands | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8)) | |
| 11 | +#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) | |
| 12 | +#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) | |
| 13 | + | |
| 14 | +#define IDE_DRIVE_TASK_NO_DATA 0 | |
| 15 | +#ifndef __KERNEL__ | |
| 16 | +#define IDE_DRIVE_TASK_INVALID -1 | |
| 17 | +#define IDE_DRIVE_TASK_SET_XFER 1 | |
| 18 | +#define IDE_DRIVE_TASK_IN 2 | |
| 19 | +#define IDE_DRIVE_TASK_OUT 3 | |
| 20 | +#endif | |
| 21 | +#define IDE_DRIVE_TASK_RAW_WRITE 4 | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * Define standard taskfile in/out register | |
| 25 | + */ | |
| 26 | +#define IDE_TASKFILE_STD_IN_FLAGS 0xFE | |
| 27 | +#define IDE_HOB_STD_IN_FLAGS 0x3C | |
| 28 | +#ifndef __KERNEL__ | |
| 29 | +#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE | |
| 30 | +#define IDE_HOB_STD_OUT_FLAGS 0x3C | |
| 31 | + | |
| 32 | +typedef unsigned char task_ioreg_t; | |
| 33 | +typedef unsigned long sata_ioreg_t; | |
| 34 | +#endif | |
| 35 | + | |
| 36 | +typedef union ide_reg_valid_s { | |
| 37 | + unsigned all : 16; | |
| 38 | + struct { | |
| 39 | + unsigned data : 1; | |
| 40 | + unsigned error_feature : 1; | |
| 41 | + unsigned sector : 1; | |
| 42 | + unsigned nsector : 1; | |
| 43 | + unsigned lcyl : 1; | |
| 44 | + unsigned hcyl : 1; | |
| 45 | + unsigned select : 1; | |
| 46 | + unsigned status_command : 1; | |
| 47 | + | |
| 48 | + unsigned data_hob : 1; | |
| 49 | + unsigned error_feature_hob : 1; | |
| 50 | + unsigned sector_hob : 1; | |
| 51 | + unsigned nsector_hob : 1; | |
| 52 | + unsigned lcyl_hob : 1; | |
| 53 | + unsigned hcyl_hob : 1; | |
| 54 | + unsigned select_hob : 1; | |
| 55 | + unsigned control_hob : 1; | |
| 56 | + } b; | |
| 57 | +} ide_reg_valid_t; | |
| 58 | + | |
| 59 | +typedef struct ide_task_request_s { | |
| 60 | + __u8 io_ports[8]; | |
| 61 | + __u8 hob_ports[8]; /* bytes 6 and 7 are unused */ | |
| 62 | + ide_reg_valid_t out_flags; | |
| 63 | + ide_reg_valid_t in_flags; | |
| 64 | + int data_phase; | |
| 65 | + int req_cmd; | |
| 66 | + unsigned long out_size; | |
| 67 | + unsigned long in_size; | |
| 68 | +} ide_task_request_t; | |
| 69 | + | |
| 70 | +typedef struct ide_ioctl_request_s { | |
| 71 | + ide_task_request_t *task_request; | |
| 72 | + unsigned char *out_buffer; | |
| 73 | + unsigned char *in_buffer; | |
| 74 | +} ide_ioctl_request_t; | |
| 75 | + | |
| 76 | +struct hd_drive_cmd_hdr { | |
| 77 | + __u8 command; | |
| 78 | + __u8 sector_number; | |
| 79 | + __u8 feature; | |
| 80 | + __u8 sector_count; | |
| 81 | +}; | |
| 82 | + | |
| 83 | +#ifndef __KERNEL__ | |
| 84 | +typedef struct hd_drive_task_hdr { | |
| 85 | + __u8 data; | |
| 86 | + __u8 feature; | |
| 87 | + __u8 sector_count; | |
| 88 | + __u8 sector_number; | |
| 89 | + __u8 low_cylinder; | |
| 90 | + __u8 high_cylinder; | |
| 91 | + __u8 device_head; | |
| 92 | + __u8 command; | |
| 93 | +} task_struct_t; | |
| 94 | + | |
| 95 | +typedef struct hd_drive_hob_hdr { | |
| 96 | + __u8 data; | |
| 97 | + __u8 feature; | |
| 98 | + __u8 sector_count; | |
| 99 | + __u8 sector_number; | |
| 100 | + __u8 low_cylinder; | |
| 101 | + __u8 high_cylinder; | |
| 102 | + __u8 device_head; | |
| 103 | + __u8 control; | |
| 104 | +} hob_struct_t; | |
| 105 | +#endif | |
| 106 | + | |
| 107 | +#define TASKFILE_NO_DATA 0x0000 | |
| 108 | + | |
| 109 | +#define TASKFILE_IN 0x0001 | |
| 110 | +#define TASKFILE_MULTI_IN 0x0002 | |
| 111 | + | |
| 112 | +#define TASKFILE_OUT 0x0004 | |
| 113 | +#define TASKFILE_MULTI_OUT 0x0008 | |
| 114 | +#define TASKFILE_IN_OUT 0x0010 | |
| 115 | + | |
| 116 | +#define TASKFILE_IN_DMA 0x0020 | |
| 117 | +#define TASKFILE_OUT_DMA 0x0040 | |
| 118 | +#define TASKFILE_IN_DMAQ 0x0080 | |
| 119 | +#define TASKFILE_OUT_DMAQ 0x0100 | |
| 120 | + | |
| 121 | +#ifndef __KERNEL__ | |
| 122 | +#define TASKFILE_P_IN 0x0200 | |
| 123 | +#define TASKFILE_P_OUT 0x0400 | |
| 124 | +#define TASKFILE_P_IN_DMA 0x0800 | |
| 125 | +#define TASKFILE_P_OUT_DMA 0x1000 | |
| 126 | +#define TASKFILE_P_IN_DMAQ 0x2000 | |
| 127 | +#define TASKFILE_P_OUT_DMAQ 0x4000 | |
| 128 | +#define TASKFILE_48 0x8000 | |
| 129 | +#define TASKFILE_INVALID 0x7fff | |
| 130 | +#endif | |
| 131 | + | |
| 132 | +#ifndef __KERNEL__ | |
| 133 | +/* ATA/ATAPI Commands pre T13 Spec */ | |
| 134 | +#define WIN_NOP 0x00 | |
| 135 | +/* | |
| 136 | + * 0x01->0x02 Reserved | |
| 137 | + */ | |
| 138 | +#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ | |
| 139 | +/* | |
| 140 | + * 0x04->0x07 Reserved | |
| 141 | + */ | |
| 142 | +#define WIN_SRST 0x08 /* ATAPI soft reset command */ | |
| 143 | +#define WIN_DEVICE_RESET 0x08 | |
| 144 | +/* | |
| 145 | + * 0x09->0x0F Reserved | |
| 146 | + */ | |
| 147 | +#define WIN_RECAL 0x10 | |
| 148 | +#define WIN_RESTORE WIN_RECAL | |
| 149 | +/* | |
| 150 | + * 0x10->0x1F Reserved | |
| 151 | + */ | |
| 152 | +#define WIN_READ 0x20 /* 28-Bit */ | |
| 153 | +#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */ | |
| 154 | +#define WIN_READ_LONG 0x22 /* 28-Bit */ | |
| 155 | +#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */ | |
| 156 | +#define WIN_READ_EXT 0x24 /* 48-Bit */ | |
| 157 | +#define WIN_READDMA_EXT 0x25 /* 48-Bit */ | |
| 158 | +#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */ | |
| 159 | +#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ | |
| 160 | +/* | |
| 161 | + * 0x28 | |
| 162 | + */ | |
| 163 | +#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ | |
| 164 | +/* | |
| 165 | + * 0x2A->0x2F Reserved | |
| 166 | + */ | |
| 167 | +#define WIN_WRITE 0x30 /* 28-Bit */ | |
| 168 | +#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */ | |
| 169 | +#define WIN_WRITE_LONG 0x32 /* 28-Bit */ | |
| 170 | +#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */ | |
| 171 | +#define WIN_WRITE_EXT 0x34 /* 48-Bit */ | |
| 172 | +#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ | |
| 173 | +#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ | |
| 174 | +#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ | |
| 175 | +#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ | |
| 176 | +#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ | |
| 177 | +/* | |
| 178 | + * 0x3A->0x3B Reserved | |
| 179 | + */ | |
| 180 | +#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */ | |
| 181 | +/* | |
| 182 | + * 0x3D->0x3F Reserved | |
| 183 | + */ | |
| 184 | +#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ | |
| 185 | +#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */ | |
| 186 | +#define WIN_VERIFY_EXT 0x42 /* 48-Bit */ | |
| 187 | +/* | |
| 188 | + * 0x43->0x4F Reserved | |
| 189 | + */ | |
| 190 | +#define WIN_FORMAT 0x50 | |
| 191 | +/* | |
| 192 | + * 0x51->0x5F Reserved | |
| 193 | + */ | |
| 194 | +#define WIN_INIT 0x60 | |
| 195 | +/* | |
| 196 | + * 0x61->0x5F Reserved | |
| 197 | + */ | |
| 198 | +#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */ | |
| 199 | + | |
| 200 | +#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ | |
| 201 | +#define WIN_DIAGNOSE 0x90 | |
| 202 | +#define WIN_SPECIFY 0x91 /* set drive geometry translation */ | |
| 203 | +#define WIN_DOWNLOAD_MICROCODE 0x92 | |
| 204 | +#define WIN_STANDBYNOW2 0x94 | |
| 205 | +#define WIN_STANDBY2 0x96 | |
| 206 | +#define WIN_SETIDLE2 0x97 | |
| 207 | +#define WIN_CHECKPOWERMODE2 0x98 | |
| 208 | +#define WIN_SLEEPNOW2 0x99 | |
| 209 | +/* | |
| 210 | + * 0x9A VENDOR | |
| 211 | + */ | |
| 212 | +#define WIN_PACKETCMD 0xA0 /* Send a packet command. */ | |
| 213 | +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ | |
| 214 | +#define WIN_QUEUED_SERVICE 0xA2 | |
| 215 | +#define WIN_SMART 0xB0 /* self-monitoring and reporting */ | |
| 216 | +#define CFA_ERASE_SECTORS 0xC0 | |
| 217 | +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ | |
| 218 | +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ | |
| 219 | +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ | |
| 220 | +#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */ | |
| 221 | +#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ | |
| 222 | +#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */ | |
| 223 | +#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ | |
| 224 | +#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */ | |
| 225 | +#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */ | |
| 226 | +#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ | |
| 227 | +#define WIN_GETMEDIASTATUS 0xDA | |
| 228 | +#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */ | |
| 229 | +#define WIN_POSTBOOT 0xDC | |
| 230 | +#define WIN_PREBOOT 0xDD | |
| 231 | +#define WIN_DOORLOCK 0xDE /* lock door on removable drives */ | |
| 232 | +#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */ | |
| 233 | +#define WIN_STANDBYNOW1 0xE0 | |
| 234 | +#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ | |
| 235 | +#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ | |
| 236 | +#define WIN_SETIDLE1 0xE3 | |
| 237 | +#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ | |
| 238 | +#define WIN_CHECKPOWERMODE1 0xE5 | |
| 239 | +#define WIN_SLEEPNOW1 0xE6 | |
| 240 | +#define WIN_FLUSH_CACHE 0xE7 | |
| 241 | +#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ | |
| 242 | +#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */ | |
| 243 | + /* SET_FEATURES 0x22 or 0xDD */ | |
| 244 | +#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ | |
| 245 | +#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ | |
| 246 | +#define WIN_MEDIAEJECT 0xED | |
| 247 | +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ | |
| 248 | +#define WIN_SETFEATURES 0xEF /* set special drive features */ | |
| 249 | +#define EXABYTE_ENABLE_NEST 0xF0 | |
| 250 | +#define WIN_SECURITY_SET_PASS 0xF1 | |
| 251 | +#define WIN_SECURITY_UNLOCK 0xF2 | |
| 252 | +#define WIN_SECURITY_ERASE_PREPARE 0xF3 | |
| 253 | +#define WIN_SECURITY_ERASE_UNIT 0xF4 | |
| 254 | +#define WIN_SECURITY_FREEZE_LOCK 0xF5 | |
| 255 | +#define WIN_SECURITY_DISABLE 0xF6 | |
| 256 | +#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ | |
| 257 | +#define WIN_SET_MAX 0xF9 | |
| 258 | +#define DISABLE_SEAGATE 0xFB | |
| 259 | + | |
| 260 | +/* WIN_SMART sub-commands */ | |
| 261 | + | |
| 262 | +#define SMART_READ_VALUES 0xD0 | |
| 263 | +#define SMART_READ_THRESHOLDS 0xD1 | |
| 264 | +#define SMART_AUTOSAVE 0xD2 | |
| 265 | +#define SMART_SAVE 0xD3 | |
| 266 | +#define SMART_IMMEDIATE_OFFLINE 0xD4 | |
| 267 | +#define SMART_READ_LOG_SECTOR 0xD5 | |
| 268 | +#define SMART_WRITE_LOG_SECTOR 0xD6 | |
| 269 | +#define SMART_WRITE_THRESHOLDS 0xD7 | |
| 270 | +#define SMART_ENABLE 0xD8 | |
| 271 | +#define SMART_DISABLE 0xD9 | |
| 272 | +#define SMART_STATUS 0xDA | |
| 273 | +#define SMART_AUTO_OFFLINE 0xDB | |
| 274 | + | |
| 275 | +/* Password used in TF4 & TF5 executing SMART commands */ | |
| 276 | + | |
| 277 | +#define SMART_LCYL_PASS 0x4F | |
| 278 | +#define SMART_HCYL_PASS 0xC2 | |
| 279 | + | |
| 280 | +/* WIN_SETFEATURES sub-commands */ | |
| 281 | +#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ | |
| 282 | +#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ | |
| 283 | +#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ | |
| 284 | +#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ | |
| 285 | +#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ | |
| 286 | +#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */ | |
| 287 | +#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */ | |
| 288 | +#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */ | |
| 289 | +#define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */ | |
| 290 | +#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */ | |
| 291 | +#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */ | |
| 292 | +#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */ | |
| 293 | +#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */ | |
| 294 | +#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */ | |
| 295 | +#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */ | |
| 296 | +#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */ | |
| 297 | +#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */ | |
| 298 | +#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */ | |
| 299 | +#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */ | |
| 300 | +#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */ | |
| 301 | +#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */ | |
| 302 | +#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */ | |
| 303 | +#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ | |
| 304 | +#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ | |
| 305 | +#define SETFEATURES_EN_REST 0xAC /* ATA-1 */ | |
| 306 | +#define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */ | |
| 307 | +#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ | |
| 308 | +#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ | |
| 309 | +#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ | |
| 310 | +#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */ | |
| 311 | +#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */ | |
| 312 | + | |
| 313 | +/* WIN_SECURITY sub-commands */ | |
| 314 | + | |
| 315 | +#define SECURITY_SET_PASSWORD 0xBA | |
| 316 | +#define SECURITY_UNLOCK 0xBB | |
| 317 | +#define SECURITY_ERASE_PREPARE 0xBC | |
| 318 | +#define SECURITY_ERASE_UNIT 0xBD | |
| 319 | +#define SECURITY_FREEZE_LOCK 0xBE | |
| 320 | +#define SECURITY_DISABLE_PASSWORD 0xBF | |
| 321 | +#endif /* __KERNEL__ */ | |
| 322 | + | |
| 323 | +struct hd_geometry { | |
| 324 | + unsigned char heads; | |
| 325 | + unsigned char sectors; | |
| 326 | + unsigned short cylinders; | |
| 327 | + unsigned long start; | |
| 328 | +}; | |
| 329 | + | |
| 330 | +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ | |
| 331 | +#define HDIO_GETGEO 0x0301 /* get device geometry */ | |
| 332 | +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ | |
| 333 | +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ | |
| 334 | +#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */ | |
| 335 | + | |
| 336 | +#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */ | |
| 337 | + | |
| 338 | +#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */ | |
| 339 | +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ | |
| 340 | +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ | |
| 341 | +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ | |
| 342 | +#define HDIO_GET_DMA 0x030b /* get use-dma flag */ | |
| 343 | +#define HDIO_GET_NICE 0x030c /* get nice flags */ | |
| 344 | +#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ | |
| 345 | +#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */ | |
| 346 | +#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */ | |
| 347 | +#define HDIO_GET_ADDRESS 0x0310 /* */ | |
| 348 | + | |
| 349 | +#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */ | |
| 350 | +#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */ | |
| 351 | +#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */ | |
| 352 | +#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */ | |
| 353 | +#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */ | |
| 354 | +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ | |
| 355 | +#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK | |
| 356 | + | |
| 357 | +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ | |
| 358 | +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ | |
| 359 | +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ | |
| 360 | +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ | |
| 361 | +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ | |
| 362 | +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ | |
| 363 | +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ | |
| 364 | +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ | |
| 365 | +#ifndef __KERNEL__ | |
| 366 | +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ | |
| 367 | +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ | |
| 368 | +#endif | |
| 369 | +#define HDIO_SET_NICE 0x0329 /* set nice flags */ | |
| 370 | +#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ | |
| 371 | +#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ | |
| 372 | +#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ | |
| 373 | +#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */ | |
| 374 | +#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */ | |
| 375 | + | |
| 376 | +/* bus states */ | |
| 377 | +enum { | |
| 378 | + BUSSTATE_OFF = 0, | |
| 379 | + BUSSTATE_ON, | |
| 380 | + BUSSTATE_TRISTATE | |
| 381 | +}; | |
| 382 | + | |
| 383 | +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ | |
| 384 | +/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ | |
| 385 | +/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ | |
| 386 | +/* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ | |
| 387 | +/* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ | |
| 388 | + | |
| 389 | +#define __NEW_HD_DRIVE_ID | |
| 390 | + | |
| 391 | +#ifndef __KERNEL__ | |
| 392 | +/* | |
| 393 | + * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. | |
| 394 | + * | |
| 395 | + * If you change something here, please remember to update fix_driveid() in | |
| 396 | + * ide/probe.c. | |
| 397 | + */ | |
| 398 | +struct hd_driveid { | |
| 399 | + unsigned short config; /* lots of obsolete bit flags */ | |
| 400 | + unsigned short cyls; /* Obsolete, "physical" cyls */ | |
| 401 | + unsigned short reserved2; /* reserved (word 2) */ | |
| 402 | + unsigned short heads; /* Obsolete, "physical" heads */ | |
| 403 | + unsigned short track_bytes; /* unformatted bytes per track */ | |
| 404 | + unsigned short sector_bytes; /* unformatted bytes per sector */ | |
| 405 | + unsigned short sectors; /* Obsolete, "physical" sectors per track */ | |
| 406 | + unsigned short vendor0; /* vendor unique */ | |
| 407 | + unsigned short vendor1; /* vendor unique */ | |
| 408 | + unsigned short vendor2; /* Retired vendor unique */ | |
| 409 | + unsigned char serial_no[20]; /* 0 = not_specified */ | |
| 410 | + unsigned short buf_type; /* Retired */ | |
| 411 | + unsigned short buf_size; /* Retired, 512 byte increments | |
| 412 | + * 0 = not_specified | |
| 413 | + */ | |
| 414 | + unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */ | |
| 415 | + unsigned char fw_rev[8]; /* 0 = not_specified */ | |
| 416 | + unsigned char model[40]; /* 0 = not_specified */ | |
| 417 | + unsigned char max_multsect; /* 0=not_implemented */ | |
| 418 | + unsigned char vendor3; /* vendor unique */ | |
| 419 | + unsigned short dword_io; /* 0=not_implemented; 1=implemented */ | |
| 420 | + unsigned char vendor4; /* vendor unique */ | |
| 421 | + unsigned char capability; /* (upper byte of word 49) | |
| 422 | + * 3: IORDYsup | |
| 423 | + * 2: IORDYsw | |
| 424 | + * 1: LBA | |
| 425 | + * 0: DMA | |
| 426 | + */ | |
| 427 | + unsigned short reserved50; /* reserved (word 50) */ | |
| 428 | + unsigned char vendor5; /* Obsolete, vendor unique */ | |
| 429 | + unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */ | |
| 430 | + unsigned char vendor6; /* Obsolete, vendor unique */ | |
| 431 | + unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */ | |
| 432 | + unsigned short field_valid; /* (word 53) | |
| 433 | + * 2: ultra_ok word 88 | |
| 434 | + * 1: eide_ok words 64-70 | |
| 435 | + * 0: cur_ok words 54-58 | |
| 436 | + */ | |
| 437 | + unsigned short cur_cyls; /* Obsolete, logical cylinders */ | |
| 438 | + unsigned short cur_heads; /* Obsolete, l heads */ | |
| 439 | + unsigned short cur_sectors; /* Obsolete, l sectors per track */ | |
| 440 | + unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */ | |
| 441 | + unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */ | |
| 442 | + unsigned char multsect; /* current multiple sector count */ | |
| 443 | + unsigned char multsect_valid; /* when (bit0==1) multsect is ok */ | |
| 444 | + unsigned int lba_capacity; /* Obsolete, total number of sectors */ | |
| 445 | + unsigned short dma_1word; /* Obsolete, single-word dma info */ | |
| 446 | + unsigned short dma_mword; /* multiple-word dma info */ | |
| 447 | + unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */ | |
| 448 | + unsigned short eide_dma_min; /* min mword dma cycle time (ns) */ | |
| 449 | + unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ | |
| 450 | + unsigned short eide_pio; /* min cycle time (ns), no IORDY */ | |
| 451 | + unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ | |
| 452 | + unsigned short words69_70[2]; /* reserved words 69-70 | |
| 453 | + * future command overlap and queuing | |
| 454 | + */ | |
| 455 | + unsigned short words71_74[4]; /* reserved words 71-74 | |
| 456 | + * for IDENTIFY PACKET DEVICE command | |
| 457 | + */ | |
| 458 | + unsigned short queue_depth; /* (word 75) | |
| 459 | + * 15:5 reserved | |
| 460 | + * 4:0 Maximum queue depth -1 | |
| 461 | + */ | |
| 462 | + unsigned short words76_79[4]; /* reserved words 76-79 */ | |
| 463 | + unsigned short major_rev_num; /* (word 80) */ | |
| 464 | + unsigned short minor_rev_num; /* (word 81) */ | |
| 465 | + unsigned short command_set_1; /* (word 82) supported | |
| 466 | + * 15: Obsolete | |
| 467 | + * 14: NOP command | |
| 468 | + * 13: READ_BUFFER | |
| 469 | + * 12: WRITE_BUFFER | |
| 470 | + * 11: Obsolete | |
| 471 | + * 10: Host Protected Area | |
| 472 | + * 9: DEVICE Reset | |
| 473 | + * 8: SERVICE Interrupt | |
| 474 | + * 7: Release Interrupt | |
| 475 | + * 6: look-ahead | |
| 476 | + * 5: write cache | |
| 477 | + * 4: PACKET Command | |
| 478 | + * 3: Power Management Feature Set | |
| 479 | + * 2: Removable Feature Set | |
| 480 | + * 1: Security Feature Set | |
| 481 | + * 0: SMART Feature Set | |
| 482 | + */ | |
| 483 | + unsigned short command_set_2; /* (word 83) | |
| 484 | + * 15: Shall be ZERO | |
| 485 | + * 14: Shall be ONE | |
| 486 | + * 13: FLUSH CACHE EXT | |
| 487 | + * 12: FLUSH CACHE | |
| 488 | + * 11: Device Configuration Overlay | |
| 489 | + * 10: 48-bit Address Feature Set | |
| 490 | + * 9: Automatic Acoustic Management | |
| 491 | + * 8: SET MAX security | |
| 492 | + * 7: reserved 1407DT PARTIES | |
| 493 | + * 6: SetF sub-command Power-Up | |
| 494 | + * 5: Power-Up in Standby Feature Set | |
| 495 | + * 4: Removable Media Notification | |
| 496 | + * 3: APM Feature Set | |
| 497 | + * 2: CFA Feature Set | |
| 498 | + * 1: READ/WRITE DMA QUEUED | |
| 499 | + * 0: Download MicroCode | |
| 500 | + */ | |
| 501 | + unsigned short cfsse; /* (word 84) | |
| 502 | + * cmd set-feature supported extensions | |
| 503 | + * 15: Shall be ZERO | |
| 504 | + * 14: Shall be ONE | |
| 505 | + * 13:6 reserved | |
| 506 | + * 5: General Purpose Logging | |
| 507 | + * 4: Streaming Feature Set | |
| 508 | + * 3: Media Card Pass Through | |
| 509 | + * 2: Media Serial Number Valid | |
| 510 | + * 1: SMART selt-test supported | |
| 511 | + * 0: SMART error logging | |
| 512 | + */ | |
| 513 | + unsigned short cfs_enable_1; /* (word 85) | |
| 514 | + * command set-feature enabled | |
| 515 | + * 15: Obsolete | |
| 516 | + * 14: NOP command | |
| 517 | + * 13: READ_BUFFER | |
| 518 | + * 12: WRITE_BUFFER | |
| 519 | + * 11: Obsolete | |
| 520 | + * 10: Host Protected Area | |
| 521 | + * 9: DEVICE Reset | |
| 522 | + * 8: SERVICE Interrupt | |
| 523 | + * 7: Release Interrupt | |
| 524 | + * 6: look-ahead | |
| 525 | + * 5: write cache | |
| 526 | + * 4: PACKET Command | |
| 527 | + * 3: Power Management Feature Set | |
| 528 | + * 2: Removable Feature Set | |
| 529 | + * 1: Security Feature Set | |
| 530 | + * 0: SMART Feature Set | |
| 531 | + */ | |
| 532 | + unsigned short cfs_enable_2; /* (word 86) | |
| 533 | + * command set-feature enabled | |
| 534 | + * 15: Shall be ZERO | |
| 535 | + * 14: Shall be ONE | |
| 536 | + * 13: FLUSH CACHE EXT | |
| 537 | + * 12: FLUSH CACHE | |
| 538 | + * 11: Device Configuration Overlay | |
| 539 | + * 10: 48-bit Address Feature Set | |
| 540 | + * 9: Automatic Acoustic Management | |
| 541 | + * 8: SET MAX security | |
| 542 | + * 7: reserved 1407DT PARTIES | |
| 543 | + * 6: SetF sub-command Power-Up | |
| 544 | + * 5: Power-Up in Standby Feature Set | |
| 545 | + * 4: Removable Media Notification | |
| 546 | + * 3: APM Feature Set | |
| 547 | + * 2: CFA Feature Set | |
| 548 | + * 1: READ/WRITE DMA QUEUED | |
| 549 | + * 0: Download MicroCode | |
| 550 | + */ | |
| 551 | + unsigned short csf_default; /* (word 87) | |
| 552 | + * command set-feature default | |
| 553 | + * 15: Shall be ZERO | |
| 554 | + * 14: Shall be ONE | |
| 555 | + * 13:6 reserved | |
| 556 | + * 5: General Purpose Logging enabled | |
| 557 | + * 4: Valid CONFIGURE STREAM executed | |
| 558 | + * 3: Media Card Pass Through enabled | |
| 559 | + * 2: Media Serial Number Valid | |
| 560 | + * 1: SMART selt-test supported | |
| 561 | + * 0: SMART error logging | |
| 562 | + */ | |
| 563 | + unsigned short dma_ultra; /* (word 88) */ | |
| 564 | + unsigned short trseuc; /* time required for security erase */ | |
| 565 | + unsigned short trsEuc; /* time required for enhanced erase */ | |
| 566 | + unsigned short CurAPMvalues; /* current APM values */ | |
| 567 | + unsigned short mprc; /* master password revision code */ | |
| 568 | + unsigned short hw_config; /* hardware config (word 93) | |
| 569 | + * 15: Shall be ZERO | |
| 570 | + * 14: Shall be ONE | |
| 571 | + * 13: | |
| 572 | + * 12: | |
| 573 | + * 11: | |
| 574 | + * 10: | |
| 575 | + * 9: | |
| 576 | + * 8: | |
| 577 | + * 7: | |
| 578 | + * 6: | |
| 579 | + * 5: | |
| 580 | + * 4: | |
| 581 | + * 3: | |
| 582 | + * 2: | |
| 583 | + * 1: | |
| 584 | + * 0: Shall be ONE | |
| 585 | + */ | |
| 586 | + unsigned short acoustic; /* (word 94) | |
| 587 | + * 15:8 Vendor's recommended value | |
| 588 | + * 7:0 current value | |
| 589 | + */ | |
| 590 | + unsigned short msrqs; /* min stream request size */ | |
| 591 | + unsigned short sxfert; /* stream transfer time */ | |
| 592 | + unsigned short sal; /* stream access latency */ | |
| 593 | + unsigned int spg; /* stream performance granularity */ | |
| 594 | + unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ | |
| 595 | + unsigned short words104_125[22];/* reserved words 104-125 */ | |
| 596 | + unsigned short last_lun; /* (word 126) */ | |
| 597 | + unsigned short word127; /* (word 127) Feature Set | |
| 598 | + * Removable Media Notification | |
| 599 | + * 15:2 reserved | |
| 600 | + * 1:0 00 = not supported | |
| 601 | + * 01 = supported | |
| 602 | + * 10 = reserved | |
| 603 | + * 11 = reserved | |
| 604 | + */ | |
| 605 | + unsigned short dlf; /* (word 128) | |
| 606 | + * device lock function | |
| 607 | + * 15:9 reserved | |
| 608 | + * 8 security level 1:max 0:high | |
| 609 | + * 7:6 reserved | |
| 610 | + * 5 enhanced erase | |
| 611 | + * 4 expire | |
| 612 | + * 3 frozen | |
| 613 | + * 2 locked | |
| 614 | + * 1 en/disabled | |
| 615 | + * 0 capability | |
| 616 | + */ | |
| 617 | + unsigned short csfo; /* (word 129) | |
| 618 | + * current set features options | |
| 619 | + * 15:4 reserved | |
| 620 | + * 3: auto reassign | |
| 621 | + * 2: reverting | |
| 622 | + * 1: read-look-ahead | |
| 623 | + * 0: write cache | |
| 624 | + */ | |
| 625 | + unsigned short words130_155[26];/* reserved vendor words 130-155 */ | |
| 626 | + unsigned short word156; /* reserved vendor word 156 */ | |
| 627 | + unsigned short words157_159[3];/* reserved vendor words 157-159 */ | |
| 628 | + unsigned short cfa_power; /* (word 160) CFA Power Mode | |
| 629 | + * 15 word 160 supported | |
| 630 | + * 14 reserved | |
| 631 | + * 13 | |
| 632 | + * 12 | |
| 633 | + * 11:0 | |
| 634 | + */ | |
| 635 | + unsigned short words161_175[15];/* Reserved for CFA */ | |
| 636 | + unsigned short words176_205[30];/* Current Media Serial Number */ | |
| 637 | + unsigned short words206_254[49];/* reserved words 206-254 */ | |
| 638 | + unsigned short integrity_word; /* (word 255) | |
| 639 | + * 15:8 Checksum | |
| 640 | + * 7:0 Signature | |
| 641 | + */ | |
| 642 | +}; | |
| 643 | +#endif /* __KERNEL__ */ | |
| 644 | + | |
| 645 | +/* | |
| 646 | + * IDE "nice" flags. These are used on a per drive basis to determine | |
| 647 | + * when to be nice and give more bandwidth to the other devices which | |
| 648 | + * share the same IDE bus. | |
| 649 | + */ | |
| 650 | +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ | |
| 651 | +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ | |
| 652 | +#define IDE_NICE_1 (3) /* when probably won't affect us much */ | |
| 653 | +#ifndef __KERNEL__ | |
| 654 | +#define IDE_NICE_0 (2) /* when sure that it won't affect us */ | |
| 655 | +#define IDE_NICE_2 (4) /* when we know it's on our expense */ | |
| 656 | +#endif | |
| 657 | + | |
| 658 | +#endif /* _LINUX_HDREG_H */ | |
| @@ -0,0 +1,66 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1999 Andreas Gal | |
| 3 | + * Copyright (c) 2000-2001 Vojtech Pavlik | |
| 4 | + * Copyright (c) 2006-2007 Jiri Kosina | |
| 5 | + */ | |
| 6 | +/* | |
| 7 | + * This program is free software; you can redistribute it and/or modify | |
| 8 | + * it under the terms of the GNU General Public License as published by | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or | |
| 10 | + * (at your option) any later version. | |
| 11 | + * | |
| 12 | + * This program is distributed in the hope that it will be useful, | |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + * GNU General Public License for more details. | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License | |
| 18 | + * along with this program; if not, write to the Free Software | |
| 19 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 | + * | |
| 21 | + * Should you need to contact me, the author, you can do so either by | |
| 22 | + * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: | |
| 23 | + * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | |
| 24 | + */ | |
| 25 | +#ifndef _UAPI__HID_H | |
| 26 | +#define _UAPI__HID_H | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | +/* | |
| 31 | + * USB HID (Human Interface Device) interface class code | |
| 32 | + */ | |
| 33 | + | |
| 34 | +#define USB_INTERFACE_CLASS_HID 3 | |
| 35 | + | |
| 36 | +/* | |
| 37 | + * USB HID interface subclass and protocol codes | |
| 38 | + */ | |
| 39 | + | |
| 40 | +#define USB_INTERFACE_SUBCLASS_BOOT 1 | |
| 41 | +#define USB_INTERFACE_PROTOCOL_KEYBOARD 1 | |
| 42 | +#define USB_INTERFACE_PROTOCOL_MOUSE 2 | |
| 43 | + | |
| 44 | +/* | |
| 45 | + * HID class requests | |
| 46 | + */ | |
| 47 | + | |
| 48 | +#define HID_REQ_GET_REPORT 0x01 | |
| 49 | +#define HID_REQ_GET_IDLE 0x02 | |
| 50 | +#define HID_REQ_GET_PROTOCOL 0x03 | |
| 51 | +#define HID_REQ_SET_REPORT 0x09 | |
| 52 | +#define HID_REQ_SET_IDLE 0x0A | |
| 53 | +#define HID_REQ_SET_PROTOCOL 0x0B | |
| 54 | + | |
| 55 | +/* | |
| 56 | + * HID class descriptor types | |
| 57 | + */ | |
| 58 | + | |
| 59 | +#define HID_DT_HID (USB_TYPE_CLASS | 0x01) | |
| 60 | +#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) | |
| 61 | +#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) | |
| 62 | + | |
| 63 | +#define HID_MAX_DESCRIPTOR_SIZE 4096 | |
| 64 | + | |
| 65 | + | |
| 66 | +#endif /* _UAPI__HID_H */ | |
| @@ -0,0 +1,212 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 1999-2000 Vojtech Pavlik | |
| 3 | + * | |
| 4 | + * Sponsored by SuSE | |
| 5 | + */ | |
| 6 | +/* | |
| 7 | + * This program is free software; you can redistribute it and/or modify | |
| 8 | + * it under the terms of the GNU General Public License as published by | |
| 9 | + * the Free Software Foundation; either version 2 of the License, or | |
| 10 | + * (at your option) any later version. | |
| 11 | + * | |
| 12 | + * This program is distributed in the hope that it will be useful, | |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + * GNU General Public License for more details. | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License | |
| 18 | + * along with this program; if not, write to the Free Software | |
| 19 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 20 | + * | |
| 21 | + * Should you need to contact me, the author, you can do so either by | |
| 22 | + * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: | |
| 23 | + * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic | |
| 24 | + */ | |
| 25 | +#ifndef _UAPI_HIDDEV_H | |
| 26 | +#define _UAPI_HIDDEV_H | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | +#include <linux/types.h> | |
| 31 | + | |
| 32 | +/* | |
| 33 | + * The event structure itself | |
| 34 | + */ | |
| 35 | + | |
| 36 | +struct hiddev_event { | |
| 37 | + unsigned hid; | |
| 38 | + signed int value; | |
| 39 | +}; | |
| 40 | + | |
| 41 | +struct hiddev_devinfo { | |
| 42 | + __u32 bustype; | |
| 43 | + __u32 busnum; | |
| 44 | + __u32 devnum; | |
| 45 | + __u32 ifnum; | |
| 46 | + __s16 vendor; | |
| 47 | + __s16 product; | |
| 48 | + __s16 version; | |
| 49 | + __u32 num_applications; | |
| 50 | +}; | |
| 51 | + | |
| 52 | +struct hiddev_collection_info { | |
| 53 | + __u32 index; | |
| 54 | + __u32 type; | |
| 55 | + __u32 usage; | |
| 56 | + __u32 level; | |
| 57 | +}; | |
| 58 | + | |
| 59 | +#define HID_STRING_SIZE 256 | |
| 60 | +struct hiddev_string_descriptor { | |
| 61 | + __s32 index; | |
| 62 | + char value[HID_STRING_SIZE]; | |
| 63 | +}; | |
| 64 | + | |
| 65 | +struct hiddev_report_info { | |
| 66 | + __u32 report_type; | |
| 67 | + __u32 report_id; | |
| 68 | + __u32 num_fields; | |
| 69 | +}; | |
| 70 | + | |
| 71 | +/* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and | |
| 72 | + * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields | |
| 73 | + * are unknown. Otherwise use a usage_ref struct filled in from a previous | |
| 74 | + * successful GUSAGE call to save time. To actually send a value to the | |
| 75 | + * device, perform a SUSAGE first, followed by a SREPORT. An INITREPORT or a | |
| 76 | + * GREPORT isn't necessary for a GUSAGE to return valid data. | |
| 77 | + */ | |
| 78 | +#define HID_REPORT_ID_UNKNOWN 0xffffffff | |
| 79 | +#define HID_REPORT_ID_FIRST 0x00000100 | |
| 80 | +#define HID_REPORT_ID_NEXT 0x00000200 | |
| 81 | +#define HID_REPORT_ID_MASK 0x000000ff | |
| 82 | +#define HID_REPORT_ID_MAX 0x000000ff | |
| 83 | + | |
| 84 | +#define HID_REPORT_TYPE_INPUT 1 | |
| 85 | +#define HID_REPORT_TYPE_OUTPUT 2 | |
| 86 | +#define HID_REPORT_TYPE_FEATURE 3 | |
| 87 | +#define HID_REPORT_TYPE_MIN 1 | |
| 88 | +#define HID_REPORT_TYPE_MAX 3 | |
| 89 | + | |
| 90 | +struct hiddev_field_info { | |
| 91 | + __u32 report_type; | |
| 92 | + __u32 report_id; | |
| 93 | + __u32 field_index; | |
| 94 | + __u32 maxusage; | |
| 95 | + __u32 flags; | |
| 96 | + __u32 physical; /* physical usage for this field */ | |
| 97 | + __u32 logical; /* logical usage for this field */ | |
| 98 | + __u32 application; /* application usage for this field */ | |
| 99 | + __s32 logical_minimum; | |
| 100 | + __s32 logical_maximum; | |
| 101 | + __s32 physical_minimum; | |
| 102 | + __s32 physical_maximum; | |
| 103 | + __u32 unit_exponent; | |
| 104 | + __u32 unit; | |
| 105 | +}; | |
| 106 | + | |
| 107 | +/* Fill in report_type, report_id and field_index to get the information on a | |
| 108 | + * field. | |
| 109 | + */ | |
| 110 | +#define HID_FIELD_CONSTANT 0x001 | |
| 111 | +#define HID_FIELD_VARIABLE 0x002 | |
| 112 | +#define HID_FIELD_RELATIVE 0x004 | |
| 113 | +#define HID_FIELD_WRAP 0x008 | |
| 114 | +#define HID_FIELD_NONLINEAR 0x010 | |
| 115 | +#define HID_FIELD_NO_PREFERRED 0x020 | |
| 116 | +#define HID_FIELD_NULL_STATE 0x040 | |
| 117 | +#define HID_FIELD_VOLATILE 0x080 | |
| 118 | +#define HID_FIELD_BUFFERED_BYTE 0x100 | |
| 119 | + | |
| 120 | +struct hiddev_usage_ref { | |
| 121 | + __u32 report_type; | |
| 122 | + __u32 report_id; | |
| 123 | + __u32 field_index; | |
| 124 | + __u32 usage_index; | |
| 125 | + __u32 usage_code; | |
| 126 | + __s32 value; | |
| 127 | +}; | |
| 128 | + | |
| 129 | +/* hiddev_usage_ref_multi is used for sending multiple bytes to a control. | |
| 130 | + * It really manifests itself as setting the value of consecutive usages */ | |
| 131 | +#define HID_MAX_MULTI_USAGES 1024 | |
| 132 | +struct hiddev_usage_ref_multi { | |
| 133 | + struct hiddev_usage_ref uref; | |
| 134 | + __u32 num_values; | |
| 135 | + __s32 values[HID_MAX_MULTI_USAGES]; | |
| 136 | +}; | |
| 137 | + | |
| 138 | +/* FIELD_INDEX_NONE is returned in read() data from the kernel when flags | |
| 139 | + * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has | |
| 140 | + * been sent by the device | |
| 141 | + */ | |
| 142 | +#define HID_FIELD_INDEX_NONE 0xffffffff | |
| 143 | + | |
| 144 | +/* | |
| 145 | + * Protocol version. | |
| 146 | + */ | |
| 147 | + | |
| 148 | +#define HID_VERSION 0x010004 | |
| 149 | + | |
| 150 | +/* | |
| 151 | + * IOCTLs (0x00 - 0x7f) | |
| 152 | + */ | |
| 153 | + | |
| 154 | +#define HIDIOCGVERSION _IOR('H', 0x01, int) | |
| 155 | +#define HIDIOCAPPLICATION _IO('H', 0x02) | |
| 156 | +#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) | |
| 157 | +#define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor) | |
| 158 | +#define HIDIOCINITREPORT _IO('H', 0x05) | |
| 159 | +#define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len) | |
| 160 | +#define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info) | |
| 161 | +#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) | |
| 162 | +#define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info) | |
| 163 | +#define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info) | |
| 164 | +#define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref) | |
| 165 | +#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) | |
| 166 | +#define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref) | |
| 167 | +#define HIDIOCGFLAG _IOR('H', 0x0E, int) | |
| 168 | +#define HIDIOCSFLAG _IOW('H', 0x0F, int) | |
| 169 | +#define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref) | |
| 170 | +#define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info) | |
| 171 | +#define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len) | |
| 172 | + | |
| 173 | +/* For writing/reading to multiple/consecutive usages */ | |
| 174 | +#define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi) | |
| 175 | +#define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi) | |
| 176 | + | |
| 177 | +/* | |
| 178 | + * Flags to be used in HIDIOCSFLAG | |
| 179 | + */ | |
| 180 | +#define HIDDEV_FLAG_UREF 0x1 | |
| 181 | +#define HIDDEV_FLAG_REPORT 0x2 | |
| 182 | +#define HIDDEV_FLAGS 0x3 | |
| 183 | + | |
| 184 | +/* To traverse the input report descriptor info for a HID device, perform the | |
| 185 | + * following: | |
| 186 | + * | |
| 187 | + * rinfo.report_type = HID_REPORT_TYPE_INPUT; | |
| 188 | + * rinfo.report_id = HID_REPORT_ID_FIRST; | |
| 189 | + * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | |
| 190 | + * | |
| 191 | + * while (ret >= 0) { | |
| 192 | + * for (i = 0; i < rinfo.num_fields; i++) { | |
| 193 | + * finfo.report_type = rinfo.report_type; | |
| 194 | + * finfo.report_id = rinfo.report_id; | |
| 195 | + * finfo.field_index = i; | |
| 196 | + * ioctl(fd, HIDIOCGFIELDINFO, &finfo); | |
| 197 | + * for (j = 0; j < finfo.maxusage; j++) { | |
| 198 | + * uref.report_type = rinfo.report_type; | |
| 199 | + * uref.report_id = rinfo.report_id; | |
| 200 | + * uref.field_index = i; | |
| 201 | + * uref.usage_index = j; | |
| 202 | + * ioctl(fd, HIDIOCGUCODE, &uref); | |
| 203 | + * ioctl(fd, HIDIOCGUSAGE, &uref); | |
| 204 | + * } | |
| 205 | + * } | |
| 206 | + * rinfo.report_id |= HID_REPORT_ID_NEXT; | |
| 207 | + * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | |
| 208 | + * } | |
| 209 | + */ | |
| 210 | + | |
| 211 | + | |
| 212 | +#endif /* _UAPI_HIDDEV_H */ | |
| @@ -0,0 +1,50 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2007 Jiri Kosina | |
| 3 | + */ | |
| 4 | +/* | |
| 5 | + * This program is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms and conditions of the GNU General Public License, | |
| 7 | + * version 2, as published by the Free Software Foundation. | |
| 8 | + * | |
| 9 | + * You should have received a copy of the GNU General Public License along with | |
| 10 | + * this program; if not, write to the Free Software Foundation, Inc., | |
| 11 | + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
| 12 | + */ | |
| 13 | +#ifndef _UAPI_HIDRAW_H | |
| 14 | +#define _UAPI_HIDRAW_H | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | +#include <linux/hid.h> | |
| 19 | +#include <linux/types.h> | |
| 20 | + | |
| 21 | +struct hidraw_report_descriptor { | |
| 22 | + __u32 size; | |
| 23 | + __u8 value[HID_MAX_DESCRIPTOR_SIZE]; | |
| 24 | +}; | |
| 25 | + | |
| 26 | +struct hidraw_devinfo { | |
| 27 | + __u32 bustype; | |
| 28 | + __s16 vendor; | |
| 29 | + __s16 product; | |
| 30 | +}; | |
| 31 | + | |
| 32 | +/* ioctl interface */ | |
| 33 | +#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) | |
| 34 | +#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) | |
| 35 | +#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) | |
| 36 | +#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) | |
| 37 | +#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) | |
| 38 | +/* The first byte of SFEATURE and GFEATURE is the report number */ | |
| 39 | +#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) | |
| 40 | +#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) | |
| 41 | + | |
| 42 | +#define HIDRAW_FIRST_MINOR 0 | |
| 43 | +#define HIDRAW_MAX_DEVICES 64 | |
| 44 | +/* number of reports to buffer */ | |
| 45 | +#define HIDRAW_BUFFER_SIZE 64 | |
| 46 | + | |
| 47 | + | |
| 48 | +/* kernel-only API declarations */ | |
| 49 | + | |
| 50 | +#endif /* _UAPI_HIDRAW_H */ | |
| @@ -0,0 +1,25 @@ | ||
| 1 | +#ifndef _UAPI__HPET__ | |
| 2 | +#define _UAPI__HPET__ | |
| 3 | + | |
| 4 | +#include <linux/compiler.h> | |
| 5 | + | |
| 6 | + | |
| 7 | +struct hpet_info { | |
| 8 | + unsigned long hi_ireqfreq; /* Hz */ | |
| 9 | + unsigned long hi_flags; /* information */ | |
| 10 | + unsigned short hi_hpet; | |
| 11 | + unsigned short hi_timer; | |
| 12 | +}; | |
| 13 | + | |
| 14 | +#define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */ | |
| 15 | + | |
| 16 | +#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ | |
| 17 | +#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ | |
| 18 | +#define HPET_INFO _IOR('h', 0x03, struct hpet_info) | |
| 19 | +#define HPET_EPI _IO('h', 0x04) /* enable periodic */ | |
| 20 | +#define HPET_DPI _IO('h', 0x05) /* disable periodic */ | |
| 21 | +#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ | |
| 22 | + | |
| 23 | +#define MAX_HPET_TBS 8 /* maximum hpet timer blocks */ | |
| 24 | + | |
| 25 | +#endif /* _UAPI__HPET__ */ | |
| @@ -0,0 +1,33 @@ | ||
| 1 | +/* $Id: hysdn_if.h,v 1.1.8.3 2001/09/23 22:25:05 kai Exp $ | |
| 2 | + * | |
| 3 | + * Linux driver for HYSDN cards | |
| 4 | + * ioctl definitions shared by hynetmgr and driver. | |
| 5 | + * | |
| 6 | + * Author Werner Cornelius (werner@titro.de) for Hypercope GmbH | |
| 7 | + * Copyright 1999 by Werner Cornelius (werner@titro.de) | |
| 8 | + * | |
| 9 | + * This software may be used and distributed according to the terms | |
| 10 | + * of the GNU General Public License, incorporated herein by reference. | |
| 11 | + * | |
| 12 | + */ | |
| 13 | + | |
| 14 | +/****************/ | |
| 15 | +/* error values */ | |
| 16 | +/****************/ | |
| 17 | +#define ERR_NONE 0 /* no error occurred */ | |
| 18 | +#define ERR_ALREADY_BOOT 1000 /* we are already booting */ | |
| 19 | +#define EPOF_BAD_MAGIC 1001 /* bad magic in POF header */ | |
| 20 | +#define ERR_BOARD_DPRAM 1002 /* board DPRAM failed */ | |
| 21 | +#define EPOF_INTERNAL 1003 /* internal POF handler error */ | |
| 22 | +#define EPOF_BAD_IMG_SIZE 1004 /* POF boot image size invalid */ | |
| 23 | +#define ERR_BOOTIMG_FAIL 1005 /* 1. stage boot image did not start */ | |
| 24 | +#define ERR_BOOTSEQ_FAIL 1006 /* 2. stage boot seq handshake timeout */ | |
| 25 | +#define ERR_POF_TIMEOUT 1007 /* timeout waiting for card pof ready */ | |
| 26 | +#define ERR_NOT_BOOTED 1008 /* operation only allowed when booted */ | |
| 27 | +#define ERR_CONF_LONG 1009 /* conf line is too long */ | |
| 28 | +#define ERR_INV_CHAN 1010 /* invalid channel number */ | |
| 29 | +#define ERR_ASYNC_TIME 1011 /* timeout sending async data */ | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| @@ -0,0 +1,72 @@ | ||
| 1 | +/* | |
| 2 | + i2c-dev.h - i2c-bus driver, char device interface | |
| 3 | + | |
| 4 | + Copyright (C) 1995-97 Simon G. Vogl | |
| 5 | + Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> | |
| 6 | + | |
| 7 | + This program is free software; you can redistribute it and/or modify | |
| 8 | + it under the terms of the GNU General Public License as published by | |
| 9 | + the Free Software Foundation; either version 2 of the License, or | |
| 10 | + (at your option) any later version. | |
| 11 | + | |
| 12 | + This program is distributed in the hope that it will be useful, | |
| 13 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | + GNU General Public License for more details. | |
| 16 | + | |
| 17 | + You should have received a copy of the GNU General Public License | |
| 18 | + along with this program; if not, write to the Free Software | |
| 19 | + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 20 | + MA 02110-1301 USA. | |
| 21 | +*/ | |
| 22 | + | |
| 23 | +#ifndef _UAPI_LINUX_I2C_DEV_H | |
| 24 | +#define _UAPI_LINUX_I2C_DEV_H | |
| 25 | + | |
| 26 | +#include <linux/types.h> | |
| 27 | +#include <linux/compiler.h> | |
| 28 | + | |
| 29 | +/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an | |
| 30 | + * unsigned long, except for: | |
| 31 | + * - I2C_FUNCS, takes pointer to an unsigned long | |
| 32 | + * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data | |
| 33 | + * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data | |
| 34 | + */ | |
| 35 | +#define I2C_RETRIES 0x0701 /* number of times a device address should | |
| 36 | + be polled when not acknowledging */ | |
| 37 | +#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ | |
| 38 | + | |
| 39 | +/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses | |
| 40 | + * are NOT supported! (due to code brokenness) | |
| 41 | + */ | |
| 42 | +#define I2C_SLAVE 0x0703 /* Use this slave address */ | |
| 43 | +#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it | |
| 44 | + is already in use by a driver! */ | |
| 45 | +#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ | |
| 46 | + | |
| 47 | +#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ | |
| 48 | + | |
| 49 | +#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ | |
| 50 | + | |
| 51 | +#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ | |
| 52 | +#define I2C_SMBUS 0x0720 /* SMBus transfer */ | |
| 53 | + | |
| 54 | + | |
| 55 | +/* This is the structure as used in the I2C_SMBUS ioctl call */ | |
| 56 | +struct i2c_smbus_ioctl_data { | |
| 57 | + __u8 read_write; | |
| 58 | + __u8 command; | |
| 59 | + __u32 size; | |
| 60 | + union i2c_smbus_data __user *data; | |
| 61 | +}; | |
| 62 | + | |
| 63 | +/* This is the structure as used in the I2C_RDWR ioctl call */ | |
| 64 | +struct i2c_rdwr_ioctl_data { | |
| 65 | + struct i2c_msg __user *msgs; /* pointers to i2c_msgs */ | |
| 66 | + __u32 nmsgs; /* number of i2c_msgs */ | |
| 67 | +}; | |
| 68 | + | |
| 69 | +#define I2C_RDRW_IOCTL_MAX_MSGS 42 | |
| 70 | + | |
| 71 | + | |
| 72 | +#endif /* _UAPI_LINUX_I2C_DEV_H */ | |
| @@ -0,0 +1,151 @@ | ||
| 1 | +/* ------------------------------------------------------------------------- */ | |
| 2 | +/* */ | |
| 3 | +/* i2c.h - definitions for the i2c-bus interface */ | |
| 4 | +/* */ | |
| 5 | +/* ------------------------------------------------------------------------- */ | |
| 6 | +/* Copyright (C) 1995-2000 Simon G. Vogl | |
| 7 | + | |
| 8 | + This program is free software; you can redistribute it and/or modify | |
| 9 | + it under the terms of the GNU General Public License as published by | |
| 10 | + the Free Software Foundation; either version 2 of the License, or | |
| 11 | + (at your option) any later version. | |
| 12 | + | |
| 13 | + This program is distributed in the hope that it will be useful, | |
| 14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | + GNU General Public License for more details. | |
| 17 | + | |
| 18 | + You should have received a copy of the GNU General Public License | |
| 19 | + along with this program; if not, write to the Free Software | |
| 20 | + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 21 | + MA 02110-1301 USA. */ | |
| 22 | +/* ------------------------------------------------------------------------- */ | |
| 23 | + | |
| 24 | +/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and | |
| 25 | + Frodo Looijaard <frodol@dds.nl> */ | |
| 26 | + | |
| 27 | +#ifndef _UAPI_LINUX_I2C_H | |
| 28 | +#define _UAPI_LINUX_I2C_H | |
| 29 | + | |
| 30 | +#include <linux/types.h> | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * struct i2c_msg - an I2C transaction segment beginning with START | |
| 34 | + * @addr: Slave address, either seven or ten bits. When this is a ten | |
| 35 | + * bit address, I2C_M_TEN must be set in @flags and the adapter | |
| 36 | + * must support I2C_FUNC_10BIT_ADDR. | |
| 37 | + * @flags: I2C_M_RD is handled by all adapters. No other flags may be | |
| 38 | + * provided unless the adapter exported the relevant I2C_FUNC_* | |
| 39 | + * flags through i2c_check_functionality(). | |
| 40 | + * @len: Number of data bytes in @buf being read from or written to the | |
| 41 | + * I2C slave address. For read transactions where I2C_M_RECV_LEN | |
| 42 | + * is set, the caller guarantees that this buffer can hold up to | |
| 43 | + * 32 bytes in addition to the initial length byte sent by the | |
| 44 | + * slave (plus, if used, the SMBus PEC); and this value will be | |
| 45 | + * incremented by the number of block data bytes received. | |
| 46 | + * @buf: The buffer into which data is read, or from which it's written. | |
| 47 | + * | |
| 48 | + * An i2c_msg is the low level representation of one segment of an I2C | |
| 49 | + * transaction. It is visible to drivers in the @i2c_transfer() procedure, | |
| 50 | + * to userspace from i2c-dev, and to I2C adapter drivers through the | |
| 51 | + * @i2c_adapter.@master_xfer() method. | |
| 52 | + * | |
| 53 | + * Except when I2C "protocol mangling" is used, all I2C adapters implement | |
| 54 | + * the standard rules for I2C transactions. Each transaction begins with a | |
| 55 | + * START. That is followed by the slave address, and a bit encoding read | |
| 56 | + * versus write. Then follow all the data bytes, possibly including a byte | |
| 57 | + * with SMBus PEC. The transfer terminates with a NAK, or when all those | |
| 58 | + * bytes have been transferred and ACKed. If this is the last message in a | |
| 59 | + * group, it is followed by a STOP. Otherwise it is followed by the next | |
| 60 | + * @i2c_msg transaction segment, beginning with a (repeated) START. | |
| 61 | + * | |
| 62 | + * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then | |
| 63 | + * passing certain @flags may have changed those standard protocol behaviors. | |
| 64 | + * Those flags are only for use with broken/nonconforming slaves, and with | |
| 65 | + * adapters which are known to support the specific mangling options they | |
| 66 | + * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR). | |
| 67 | + */ | |
| 68 | +struct i2c_msg { | |
| 69 | + __u16 addr; /* slave address */ | |
| 70 | + __u16 flags; | |
| 71 | +#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ | |
| 72 | +#define I2C_M_RD 0x0001 /* read data, from slave to master */ | |
| 73 | +#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */ | |
| 74 | +#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */ | |
| 75 | +#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ | |
| 76 | +#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ | |
| 77 | +#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ | |
| 78 | +#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ | |
| 79 | + __u16 len; /* msg length */ | |
| 80 | + __u8 *buf; /* pointer to msg data */ | |
| 81 | +}; | |
| 82 | + | |
| 83 | +/* To determine what functionality is present */ | |
| 84 | + | |
| 85 | +#define I2C_FUNC_I2C 0x00000001 | |
| 86 | +#define I2C_FUNC_10BIT_ADDR 0x00000002 | |
| 87 | +#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */ | |
| 88 | +#define I2C_FUNC_SMBUS_PEC 0x00000008 | |
| 89 | +#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */ | |
| 90 | +#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ | |
| 91 | +#define I2C_FUNC_SMBUS_QUICK 0x00010000 | |
| 92 | +#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 | |
| 93 | +#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 | |
| 94 | +#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 | |
| 95 | +#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 | |
| 96 | +#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 | |
| 97 | +#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 | |
| 98 | +#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 | |
| 99 | +#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 | |
| 100 | +#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 | |
| 101 | +#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ | |
| 102 | +#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ | |
| 103 | + | |
| 104 | +#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ | |
| 105 | + I2C_FUNC_SMBUS_WRITE_BYTE) | |
| 106 | +#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ | |
| 107 | + I2C_FUNC_SMBUS_WRITE_BYTE_DATA) | |
| 108 | +#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ | |
| 109 | + I2C_FUNC_SMBUS_WRITE_WORD_DATA) | |
| 110 | +#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ | |
| 111 | + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) | |
| 112 | +#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ | |
| 113 | + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) | |
| 114 | + | |
| 115 | +#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ | |
| 116 | + I2C_FUNC_SMBUS_BYTE | \ | |
| 117 | + I2C_FUNC_SMBUS_BYTE_DATA | \ | |
| 118 | + I2C_FUNC_SMBUS_WORD_DATA | \ | |
| 119 | + I2C_FUNC_SMBUS_PROC_CALL | \ | |
| 120 | + I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ | |
| 121 | + I2C_FUNC_SMBUS_I2C_BLOCK | \ | |
| 122 | + I2C_FUNC_SMBUS_PEC) | |
| 123 | + | |
| 124 | +/* | |
| 125 | + * Data for SMBus Messages | |
| 126 | + */ | |
| 127 | +#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ | |
| 128 | +union i2c_smbus_data { | |
| 129 | + __u8 byte; | |
| 130 | + __u16 word; | |
| 131 | + __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ | |
| 132 | + /* and one more for user-space compatibility */ | |
| 133 | +}; | |
| 134 | + | |
| 135 | +/* i2c_smbus_xfer read or write markers */ | |
| 136 | +#define I2C_SMBUS_READ 1 | |
| 137 | +#define I2C_SMBUS_WRITE 0 | |
| 138 | + | |
| 139 | +/* SMBus transaction types (size parameter in the above functions) | |
| 140 | + Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ | |
| 141 | +#define I2C_SMBUS_QUICK 0 | |
| 142 | +#define I2C_SMBUS_BYTE 1 | |
| 143 | +#define I2C_SMBUS_BYTE_DATA 2 | |
| 144 | +#define I2C_SMBUS_WORD_DATA 3 | |
| 145 | +#define I2C_SMBUS_PROC_CALL 4 | |
| 146 | +#define I2C_SMBUS_BLOCK_DATA 5 | |
| 147 | +#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 | |
| 148 | +#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ | |
| 149 | +#define I2C_SMBUS_I2C_BLOCK_DATA 8 | |
| 150 | + | |
| 151 | +#endif /* _UAPI_LINUX_I2C_H */ | |
| @@ -0,0 +1,421 @@ | ||
| 1 | +/* | |
| 2 | + * I2O user space accessible structures/APIs | |
| 3 | + * | |
| 4 | + * (c) Copyright 1999, 2000 Red Hat Software | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or | |
| 7 | + * modify it under the terms of the GNU General Public License | |
| 8 | + * as published by the Free Software Foundation; either version | |
| 9 | + * 2 of the License, or (at your option) any later version. | |
| 10 | + * | |
| 11 | + ************************************************************************* | |
| 12 | + * | |
| 13 | + * This header file defines the I2O APIs that are available to both | |
| 14 | + * the kernel and user level applications. Kernel specific structures | |
| 15 | + * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which | |
| 16 | + * automatically includes this file. | |
| 17 | + * | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#ifndef _I2O_DEV_H | |
| 21 | +#define _I2O_DEV_H | |
| 22 | + | |
| 23 | +/* How many controllers are we allowing */ | |
| 24 | +#define MAX_I2O_CONTROLLERS 32 | |
| 25 | + | |
| 26 | +#include <linux/ioctl.h> | |
| 27 | +#include <linux/types.h> | |
| 28 | + | |
| 29 | +/* | |
| 30 | + * I2O Control IOCTLs and structures | |
| 31 | + */ | |
| 32 | +#define I2O_MAGIC_NUMBER 'i' | |
| 33 | +#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS]) | |
| 34 | +#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) | |
| 35 | +#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) | |
| 36 | +#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) | |
| 37 | +#define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) | |
| 38 | +#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) | |
| 39 | +#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) | |
| 40 | +#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) | |
| 41 | +#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32) | |
| 42 | +#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) | |
| 43 | +#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) | |
| 44 | +#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) | |
| 45 | +#define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru) | |
| 46 | +#define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32) | |
| 47 | + | |
| 48 | +struct i2o_cmd_passthru32 { | |
| 49 | + unsigned int iop; /* IOP unit number */ | |
| 50 | + __u32 msg; /* message */ | |
| 51 | +}; | |
| 52 | + | |
| 53 | +struct i2o_cmd_passthru { | |
| 54 | + unsigned int iop; /* IOP unit number */ | |
| 55 | + void __user *msg; /* message */ | |
| 56 | +}; | |
| 57 | + | |
| 58 | +struct i2o_cmd_hrtlct { | |
| 59 | + unsigned int iop; /* IOP unit number */ | |
| 60 | + void __user *resbuf; /* Buffer for result */ | |
| 61 | + unsigned int __user *reslen; /* Buffer length in bytes */ | |
| 62 | +}; | |
| 63 | + | |
| 64 | +struct i2o_cmd_psetget { | |
| 65 | + unsigned int iop; /* IOP unit number */ | |
| 66 | + unsigned int tid; /* Target device TID */ | |
| 67 | + void __user *opbuf; /* Operation List buffer */ | |
| 68 | + unsigned int oplen; /* Operation List buffer length in bytes */ | |
| 69 | + void __user *resbuf; /* Result List buffer */ | |
| 70 | + unsigned int __user *reslen; /* Result List buffer length in bytes */ | |
| 71 | +}; | |
| 72 | + | |
| 73 | +struct i2o_sw_xfer { | |
| 74 | + unsigned int iop; /* IOP unit number */ | |
| 75 | + unsigned char flags; /* Flags field */ | |
| 76 | + unsigned char sw_type; /* Software type */ | |
| 77 | + unsigned int sw_id; /* Software ID */ | |
| 78 | + void __user *buf; /* Pointer to software buffer */ | |
| 79 | + unsigned int __user *swlen; /* Length of software data */ | |
| 80 | + unsigned int __user *maxfrag; /* Maximum fragment count */ | |
| 81 | + unsigned int __user *curfrag; /* Current fragment count */ | |
| 82 | +}; | |
| 83 | + | |
| 84 | +struct i2o_html { | |
| 85 | + unsigned int iop; /* IOP unit number */ | |
| 86 | + unsigned int tid; /* Target device ID */ | |
| 87 | + unsigned int page; /* HTML page */ | |
| 88 | + void __user *resbuf; /* Buffer for reply HTML page */ | |
| 89 | + unsigned int __user *reslen; /* Length in bytes of reply buffer */ | |
| 90 | + void __user *qbuf; /* Pointer to HTTP query string */ | |
| 91 | + unsigned int qlen; /* Length in bytes of query string buffer */ | |
| 92 | +}; | |
| 93 | + | |
| 94 | +#define I2O_EVT_Q_LEN 32 | |
| 95 | + | |
| 96 | +struct i2o_evt_id { | |
| 97 | + unsigned int iop; | |
| 98 | + unsigned int tid; | |
| 99 | + unsigned int evt_mask; | |
| 100 | +}; | |
| 101 | + | |
| 102 | +/* Event data size = frame size - message header + evt indicator */ | |
| 103 | +#define I2O_EVT_DATA_SIZE 88 | |
| 104 | + | |
| 105 | +struct i2o_evt_info { | |
| 106 | + struct i2o_evt_id id; | |
| 107 | + unsigned char evt_data[I2O_EVT_DATA_SIZE]; | |
| 108 | + unsigned int data_size; | |
| 109 | +}; | |
| 110 | + | |
| 111 | +struct i2o_evt_get { | |
| 112 | + struct i2o_evt_info info; | |
| 113 | + int pending; | |
| 114 | + int lost; | |
| 115 | +}; | |
| 116 | + | |
| 117 | +typedef struct i2o_sg_io_hdr { | |
| 118 | + unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */ | |
| 119 | +} i2o_sg_io_hdr_t; | |
| 120 | + | |
| 121 | +/************************************************************************** | |
| 122 | + * HRT related constants and structures | |
| 123 | + **************************************************************************/ | |
| 124 | +#define I2O_BUS_LOCAL 0 | |
| 125 | +#define I2O_BUS_ISA 1 | |
| 126 | +#define I2O_BUS_EISA 2 | |
| 127 | +/* was I2O_BUS_MCA 3 */ | |
| 128 | +#define I2O_BUS_PCI 4 | |
| 129 | +#define I2O_BUS_PCMCIA 5 | |
| 130 | +#define I2O_BUS_NUBUS 6 | |
| 131 | +#define I2O_BUS_CARDBUS 7 | |
| 132 | +#define I2O_BUS_UNKNOWN 0x80 | |
| 133 | + | |
| 134 | +typedef struct _i2o_pci_bus { | |
| 135 | + __u8 PciFunctionNumber; | |
| 136 | + __u8 PciDeviceNumber; | |
| 137 | + __u8 PciBusNumber; | |
| 138 | + __u8 reserved; | |
| 139 | + __u16 PciVendorID; | |
| 140 | + __u16 PciDeviceID; | |
| 141 | +} i2o_pci_bus; | |
| 142 | + | |
| 143 | +typedef struct _i2o_local_bus { | |
| 144 | + __u16 LbBaseIOPort; | |
| 145 | + __u16 reserved; | |
| 146 | + __u32 LbBaseMemoryAddress; | |
| 147 | +} i2o_local_bus; | |
| 148 | + | |
| 149 | +typedef struct _i2o_isa_bus { | |
| 150 | + __u16 IsaBaseIOPort; | |
| 151 | + __u8 CSN; | |
| 152 | + __u8 reserved; | |
| 153 | + __u32 IsaBaseMemoryAddress; | |
| 154 | +} i2o_isa_bus; | |
| 155 | + | |
| 156 | +typedef struct _i2o_eisa_bus_info { | |
| 157 | + __u16 EisaBaseIOPort; | |
| 158 | + __u8 reserved; | |
| 159 | + __u8 EisaSlotNumber; | |
| 160 | + __u32 EisaBaseMemoryAddress; | |
| 161 | +} i2o_eisa_bus; | |
| 162 | + | |
| 163 | +typedef struct _i2o_mca_bus { | |
| 164 | + __u16 McaBaseIOPort; | |
| 165 | + __u8 reserved; | |
| 166 | + __u8 McaSlotNumber; | |
| 167 | + __u32 McaBaseMemoryAddress; | |
| 168 | +} i2o_mca_bus; | |
| 169 | + | |
| 170 | +typedef struct _i2o_other_bus { | |
| 171 | + __u16 BaseIOPort; | |
| 172 | + __u16 reserved; | |
| 173 | + __u32 BaseMemoryAddress; | |
| 174 | +} i2o_other_bus; | |
| 175 | + | |
| 176 | +typedef struct _i2o_hrt_entry { | |
| 177 | + __u32 adapter_id; | |
| 178 | + __u32 parent_tid:12; | |
| 179 | + __u32 state:4; | |
| 180 | + __u32 bus_num:8; | |
| 181 | + __u32 bus_type:8; | |
| 182 | + union { | |
| 183 | + i2o_pci_bus pci_bus; | |
| 184 | + i2o_local_bus local_bus; | |
| 185 | + i2o_isa_bus isa_bus; | |
| 186 | + i2o_eisa_bus eisa_bus; | |
| 187 | + i2o_mca_bus mca_bus; | |
| 188 | + i2o_other_bus other_bus; | |
| 189 | + } bus; | |
| 190 | +} i2o_hrt_entry; | |
| 191 | + | |
| 192 | +typedef struct _i2o_hrt { | |
| 193 | + __u16 num_entries; | |
| 194 | + __u8 entry_len; | |
| 195 | + __u8 hrt_version; | |
| 196 | + __u32 change_ind; | |
| 197 | + i2o_hrt_entry hrt_entry[1]; | |
| 198 | +} i2o_hrt; | |
| 199 | + | |
| 200 | +typedef struct _i2o_lct_entry { | |
| 201 | + __u32 entry_size:16; | |
| 202 | + __u32 tid:12; | |
| 203 | + __u32 reserved:4; | |
| 204 | + __u32 change_ind; | |
| 205 | + __u32 device_flags; | |
| 206 | + __u32 class_id:12; | |
| 207 | + __u32 version:4; | |
| 208 | + __u32 vendor_id:16; | |
| 209 | + __u32 sub_class; | |
| 210 | + __u32 user_tid:12; | |
| 211 | + __u32 parent_tid:12; | |
| 212 | + __u32 bios_info:8; | |
| 213 | + __u8 identity_tag[8]; | |
| 214 | + __u32 event_capabilities; | |
| 215 | +} i2o_lct_entry; | |
| 216 | + | |
| 217 | +typedef struct _i2o_lct { | |
| 218 | + __u32 table_size:16; | |
| 219 | + __u32 boot_tid:12; | |
| 220 | + __u32 lct_ver:4; | |
| 221 | + __u32 iop_flags; | |
| 222 | + __u32 change_ind; | |
| 223 | + i2o_lct_entry lct_entry[1]; | |
| 224 | +} i2o_lct; | |
| 225 | + | |
| 226 | +typedef struct _i2o_status_block { | |
| 227 | + __u16 org_id; | |
| 228 | + __u16 reserved; | |
| 229 | + __u16 iop_id:12; | |
| 230 | + __u16 reserved1:4; | |
| 231 | + __u16 host_unit_id; | |
| 232 | + __u16 segment_number:12; | |
| 233 | + __u16 i2o_version:4; | |
| 234 | + __u8 iop_state; | |
| 235 | + __u8 msg_type; | |
| 236 | + __u16 inbound_frame_size; | |
| 237 | + __u8 init_code; | |
| 238 | + __u8 reserved2; | |
| 239 | + __u32 max_inbound_frames; | |
| 240 | + __u32 cur_inbound_frames; | |
| 241 | + __u32 max_outbound_frames; | |
| 242 | + char product_id[24]; | |
| 243 | + __u32 expected_lct_size; | |
| 244 | + __u32 iop_capabilities; | |
| 245 | + __u32 desired_mem_size; | |
| 246 | + __u32 current_mem_size; | |
| 247 | + __u32 current_mem_base; | |
| 248 | + __u32 desired_io_size; | |
| 249 | + __u32 current_io_size; | |
| 250 | + __u32 current_io_base; | |
| 251 | + __u32 reserved3:24; | |
| 252 | + __u32 cmd_status:8; | |
| 253 | +} i2o_status_block; | |
| 254 | + | |
| 255 | +/* Event indicator mask flags */ | |
| 256 | +#define I2O_EVT_IND_STATE_CHANGE 0x80000000 | |
| 257 | +#define I2O_EVT_IND_GENERAL_WARNING 0x40000000 | |
| 258 | +#define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 | |
| 259 | +#define I2O_EVT_IND_LOCK_RELEASE 0x10000000 | |
| 260 | +#define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 | |
| 261 | +#define I2O_EVT_IND_DEVICE_RESET 0x04000000 | |
| 262 | +#define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 | |
| 263 | +#define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 | |
| 264 | +#define I2O_EVT_IND_VENDOR_EVT 0x00800000 | |
| 265 | +#define I2O_EVT_IND_DEVICE_STATE 0x00400000 | |
| 266 | + | |
| 267 | +/* Executive event indicitors */ | |
| 268 | +#define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001 | |
| 269 | +#define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002 | |
| 270 | +#define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004 | |
| 271 | +#define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008 | |
| 272 | +#define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010 | |
| 273 | +#define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020 | |
| 274 | +#define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040 | |
| 275 | +#define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080 | |
| 276 | +#define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100 | |
| 277 | +#define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200 | |
| 278 | +#define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400 | |
| 279 | + | |
| 280 | +/* Random Block Storage Event Indicators */ | |
| 281 | +#define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001 | |
| 282 | +#define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002 | |
| 283 | +#define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004 | |
| 284 | +#define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008 | |
| 285 | +#define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010 | |
| 286 | + | |
| 287 | +/* Event data for generic events */ | |
| 288 | +#define I2O_EVT_STATE_CHANGE_NORMAL 0x00 | |
| 289 | +#define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 | |
| 290 | +#define I2O_EVT_STATE_CHANGE_RESTART 0x02 | |
| 291 | +#define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 | |
| 292 | +#define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 | |
| 293 | +#define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 | |
| 294 | +#define I2O_EVT_STATE_CHANGE_FAILED 0x10 | |
| 295 | +#define I2O_EVT_STATE_CHANGE_FAULTED 0x11 | |
| 296 | + | |
| 297 | +#define I2O_EVT_GEN_WARNING_NORMAL 0x00 | |
| 298 | +#define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 | |
| 299 | +#define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 | |
| 300 | + | |
| 301 | +#define I2O_EVT_CAPABILITY_OTHER 0x01 | |
| 302 | +#define I2O_EVT_CAPABILITY_CHANGED 0x02 | |
| 303 | + | |
| 304 | +#define I2O_EVT_SENSOR_STATE_CHANGED 0x01 | |
| 305 | + | |
| 306 | +/* | |
| 307 | + * I2O classes / subclasses | |
| 308 | + */ | |
| 309 | + | |
| 310 | +/* Class ID and Code Assignments | |
| 311 | + * (LCT.ClassID.Version field) | |
| 312 | + */ | |
| 313 | +#define I2O_CLASS_VERSION_10 0x00 | |
| 314 | +#define I2O_CLASS_VERSION_11 0x01 | |
| 315 | + | |
| 316 | +/* Class code names | |
| 317 | + * (from v1.5 Table 6-1 Class Code Assignments.) | |
| 318 | + */ | |
| 319 | + | |
| 320 | +#define I2O_CLASS_EXECUTIVE 0x000 | |
| 321 | +#define I2O_CLASS_DDM 0x001 | |
| 322 | +#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 | |
| 323 | +#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 | |
| 324 | +#define I2O_CLASS_LAN 0x020 | |
| 325 | +#define I2O_CLASS_WAN 0x030 | |
| 326 | +#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 | |
| 327 | +#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 | |
| 328 | +#define I2O_CLASS_SCSI_PERIPHERAL 0x051 | |
| 329 | +#define I2O_CLASS_ATE_PORT 0x060 | |
| 330 | +#define I2O_CLASS_ATE_PERIPHERAL 0x061 | |
| 331 | +#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 | |
| 332 | +#define I2O_CLASS_FLOPPY_DEVICE 0x071 | |
| 333 | +#define I2O_CLASS_BUS_ADAPTER 0x080 | |
| 334 | +#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 | |
| 335 | +#define I2O_CLASS_PEER_TRANSPORT 0x091 | |
| 336 | +#define I2O_CLASS_END 0xfff | |
| 337 | + | |
| 338 | +/* | |
| 339 | + * Rest of 0x092 - 0x09f reserved for peer-to-peer classes | |
| 340 | + */ | |
| 341 | + | |
| 342 | +#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff | |
| 343 | + | |
| 344 | +/* | |
| 345 | + * Subclasses | |
| 346 | + */ | |
| 347 | + | |
| 348 | +#define I2O_SUBCLASS_i960 0x001 | |
| 349 | +#define I2O_SUBCLASS_HDM 0x020 | |
| 350 | +#define I2O_SUBCLASS_ISM 0x021 | |
| 351 | + | |
| 352 | +/* Operation functions */ | |
| 353 | + | |
| 354 | +#define I2O_PARAMS_FIELD_GET 0x0001 | |
| 355 | +#define I2O_PARAMS_LIST_GET 0x0002 | |
| 356 | +#define I2O_PARAMS_MORE_GET 0x0003 | |
| 357 | +#define I2O_PARAMS_SIZE_GET 0x0004 | |
| 358 | +#define I2O_PARAMS_TABLE_GET 0x0005 | |
| 359 | +#define I2O_PARAMS_FIELD_SET 0x0006 | |
| 360 | +#define I2O_PARAMS_LIST_SET 0x0007 | |
| 361 | +#define I2O_PARAMS_ROW_ADD 0x0008 | |
| 362 | +#define I2O_PARAMS_ROW_DELETE 0x0009 | |
| 363 | +#define I2O_PARAMS_TABLE_CLEAR 0x000A | |
| 364 | + | |
| 365 | +/* | |
| 366 | + * I2O serial number conventions / formats | |
| 367 | + * (circa v1.5) | |
| 368 | + */ | |
| 369 | + | |
| 370 | +#define I2O_SNFORMAT_UNKNOWN 0 | |
| 371 | +#define I2O_SNFORMAT_BINARY 1 | |
| 372 | +#define I2O_SNFORMAT_ASCII 2 | |
| 373 | +#define I2O_SNFORMAT_UNICODE 3 | |
| 374 | +#define I2O_SNFORMAT_LAN48_MAC 4 | |
| 375 | +#define I2O_SNFORMAT_WAN 5 | |
| 376 | + | |
| 377 | +/* | |
| 378 | + * Plus new in v2.0 (Yellowstone pdf doc) | |
| 379 | + */ | |
| 380 | + | |
| 381 | +#define I2O_SNFORMAT_LAN64_MAC 6 | |
| 382 | +#define I2O_SNFORMAT_DDM 7 | |
| 383 | +#define I2O_SNFORMAT_IEEE_REG64 8 | |
| 384 | +#define I2O_SNFORMAT_IEEE_REG128 9 | |
| 385 | +#define I2O_SNFORMAT_UNKNOWN2 0xff | |
| 386 | + | |
| 387 | +/* | |
| 388 | + * I2O Get Status State values | |
| 389 | + */ | |
| 390 | + | |
| 391 | +#define ADAPTER_STATE_INITIALIZING 0x01 | |
| 392 | +#define ADAPTER_STATE_RESET 0x02 | |
| 393 | +#define ADAPTER_STATE_HOLD 0x04 | |
| 394 | +#define ADAPTER_STATE_READY 0x05 | |
| 395 | +#define ADAPTER_STATE_OPERATIONAL 0x08 | |
| 396 | +#define ADAPTER_STATE_FAILED 0x10 | |
| 397 | +#define ADAPTER_STATE_FAULTED 0x11 | |
| 398 | + | |
| 399 | +/* | |
| 400 | + * Software module types | |
| 401 | + */ | |
| 402 | +#define I2O_SOFTWARE_MODULE_IRTOS 0x11 | |
| 403 | +#define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22 | |
| 404 | +#define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23 | |
| 405 | + | |
| 406 | +/* | |
| 407 | + * Vendors | |
| 408 | + */ | |
| 409 | +#define I2O_VENDOR_DPT 0x001b | |
| 410 | + | |
| 411 | +/* | |
| 412 | + * DPT / Adaptec specific values for i2o_sg_io_hdr flags. | |
| 413 | + */ | |
| 414 | +#define I2O_DPT_SG_FLAG_INTERPRET 0x00010000 | |
| 415 | +#define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000 | |
| 416 | + | |
| 417 | +#define I2O_DPT_FLASH_FRAG_SIZE 0x10000 | |
| 418 | +#define I2O_DPT_FLASH_READ 0x0101 | |
| 419 | +#define I2O_DPT_FLASH_WRITE 0x0102 | |
| 420 | + | |
| 421 | +#endif /* _I2O_DEV_H */ | |
| @@ -0,0 +1,46 @@ | ||
| 1 | +/* | |
| 2 | + * i8k.h -- Linux driver for accessing the SMM BIOS on Dell laptops | |
| 3 | + * | |
| 4 | + * Copyright (C) 2001 Massimo Dal Zotto <dz@debian.org> | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or modify it | |
| 7 | + * under the terms of the GNU General Public License as published by the | |
| 8 | + * Free Software Foundation; either version 2, or (at your option) any | |
| 9 | + * later version. | |
| 10 | + * | |
| 11 | + * This program is distributed in the hope that it will be useful, but | |
| 12 | + * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | + * General Public License for more details. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#ifndef _LINUX_I8K_H | |
| 18 | +#define _LINUX_I8K_H | |
| 19 | + | |
| 20 | +#define I8K_PROC "/proc/i8k" | |
| 21 | +#define I8K_PROC_FMT "1.0" | |
| 22 | + | |
| 23 | +#define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */ | |
| 24 | +#define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */ | |
| 25 | +#define I8K_POWER_STATUS _IOR ('i', 0x82, size_t) | |
| 26 | +#define I8K_FN_STATUS _IOR ('i', 0x83, size_t) | |
| 27 | +#define I8K_GET_TEMP _IOR ('i', 0x84, size_t) | |
| 28 | +#define I8K_GET_SPEED _IOWR('i', 0x85, size_t) | |
| 29 | +#define I8K_GET_FAN _IOWR('i', 0x86, size_t) | |
| 30 | +#define I8K_SET_FAN _IOWR('i', 0x87, size_t) | |
| 31 | + | |
| 32 | +#define I8K_FAN_LEFT 1 | |
| 33 | +#define I8K_FAN_RIGHT 0 | |
| 34 | +#define I8K_FAN_OFF 0 | |
| 35 | +#define I8K_FAN_LOW 1 | |
| 36 | +#define I8K_FAN_HIGH 2 | |
| 37 | +#define I8K_FAN_MAX I8K_FAN_HIGH | |
| 38 | + | |
| 39 | +#define I8K_VOL_UP 1 | |
| 40 | +#define I8K_VOL_DOWN 2 | |
| 41 | +#define I8K_VOL_MUTE 4 | |
| 42 | + | |
| 43 | +#define I8K_AC 1 | |
| 44 | +#define I8K_BATTERY 0 | |
| 45 | + | |
| 46 | +#endif | |
| @@ -0,0 +1,97 @@ | ||
| 1 | +/* | |
| 2 | + * INET An implementation of the TCP/IP protocol suite for the LINUX | |
| 3 | + * operating system. INET is implemented using the BSD Socket | |
| 4 | + * interface as the means of communication with the user level. | |
| 5 | + * | |
| 6 | + * Definitions for the ICMP protocol. | |
| 7 | + * | |
| 8 | + * Version: @(#)icmp.h 1.0.3 04/28/93 | |
| 9 | + * | |
| 10 | + * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | |
| 11 | + * | |
| 12 | + * This program is free software; you can redistribute it and/or | |
| 13 | + * modify it under the terms of the GNU General Public License | |
| 14 | + * as published by the Free Software Foundation; either version | |
| 15 | + * 2 of the License, or (at your option) any later version. | |
| 16 | + */ | |
| 17 | +#ifndef _UAPI_LINUX_ICMP_H | |
| 18 | +#define _UAPI_LINUX_ICMP_H | |
| 19 | + | |
| 20 | +#include <linux/types.h> | |
| 21 | + | |
| 22 | +#define ICMP_ECHOREPLY 0 /* Echo Reply */ | |
| 23 | +#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */ | |
| 24 | +#define ICMP_SOURCE_QUENCH 4 /* Source Quench */ | |
| 25 | +#define ICMP_REDIRECT 5 /* Redirect (change route) */ | |
| 26 | +#define ICMP_ECHO 8 /* Echo Request */ | |
| 27 | +#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */ | |
| 28 | +#define ICMP_PARAMETERPROB 12 /* Parameter Problem */ | |
| 29 | +#define ICMP_TIMESTAMP 13 /* Timestamp Request */ | |
| 30 | +#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */ | |
| 31 | +#define ICMP_INFO_REQUEST 15 /* Information Request */ | |
| 32 | +#define ICMP_INFO_REPLY 16 /* Information Reply */ | |
| 33 | +#define ICMP_ADDRESS 17 /* Address Mask Request */ | |
| 34 | +#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */ | |
| 35 | +#define NR_ICMP_TYPES 18 | |
| 36 | + | |
| 37 | + | |
| 38 | +/* Codes for UNREACH. */ | |
| 39 | +#define ICMP_NET_UNREACH 0 /* Network Unreachable */ | |
| 40 | +#define ICMP_HOST_UNREACH 1 /* Host Unreachable */ | |
| 41 | +#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */ | |
| 42 | +#define ICMP_PORT_UNREACH 3 /* Port Unreachable */ | |
| 43 | +#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */ | |
| 44 | +#define ICMP_SR_FAILED 5 /* Source Route failed */ | |
| 45 | +#define ICMP_NET_UNKNOWN 6 | |
| 46 | +#define ICMP_HOST_UNKNOWN 7 | |
| 47 | +#define ICMP_HOST_ISOLATED 8 | |
| 48 | +#define ICMP_NET_ANO 9 | |
| 49 | +#define ICMP_HOST_ANO 10 | |
| 50 | +#define ICMP_NET_UNR_TOS 11 | |
| 51 | +#define ICMP_HOST_UNR_TOS 12 | |
| 52 | +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ | |
| 53 | +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ | |
| 54 | +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ | |
| 55 | +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ | |
| 56 | + | |
| 57 | +/* Codes for REDIRECT. */ | |
| 58 | +#define ICMP_REDIR_NET 0 /* Redirect Net */ | |
| 59 | +#define ICMP_REDIR_HOST 1 /* Redirect Host */ | |
| 60 | +#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */ | |
| 61 | +#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */ | |
| 62 | + | |
| 63 | +/* Codes for TIME_EXCEEDED. */ | |
| 64 | +#define ICMP_EXC_TTL 0 /* TTL count exceeded */ | |
| 65 | +#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ | |
| 66 | + | |
| 67 | + | |
| 68 | +struct icmphdr { | |
| 69 | + __u8 type; | |
| 70 | + __u8 code; | |
| 71 | + __sum16 checksum; | |
| 72 | + union { | |
| 73 | + struct { | |
| 74 | + __be16 id; | |
| 75 | + __be16 sequence; | |
| 76 | + } echo; | |
| 77 | + __be32 gateway; | |
| 78 | + struct { | |
| 79 | + __be16 __unused; | |
| 80 | + __be16 mtu; | |
| 81 | + } frag; | |
| 82 | + } un; | |
| 83 | +}; | |
| 84 | + | |
| 85 | + | |
| 86 | +/* | |
| 87 | + * constants for (set|get)sockopt | |
| 88 | + */ | |
| 89 | + | |
| 90 | +#define ICMP_FILTER 1 | |
| 91 | + | |
| 92 | +struct icmp_filter { | |
| 93 | + __u32 data; | |
| 94 | +}; | |
| 95 | + | |
| 96 | + | |
| 97 | +#endif /* _UAPI_LINUX_ICMP_H */ | |
| @@ -0,0 +1,164 @@ | ||
| 1 | +#ifndef _UAPI_LINUX_ICMPV6_H | |
| 2 | +#define _UAPI_LINUX_ICMPV6_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <asm/byteorder.h> | |
| 6 | + | |
| 7 | +struct icmp6hdr { | |
| 8 | + | |
| 9 | + __u8 icmp6_type; | |
| 10 | + __u8 icmp6_code; | |
| 11 | + __sum16 icmp6_cksum; | |
| 12 | + | |
| 13 | + | |
| 14 | + union { | |
| 15 | + __be32 un_data32[1]; | |
| 16 | + __be16 un_data16[2]; | |
| 17 | + __u8 un_data8[4]; | |
| 18 | + | |
| 19 | + struct icmpv6_echo { | |
| 20 | + __be16 identifier; | |
| 21 | + __be16 sequence; | |
| 22 | + } u_echo; | |
| 23 | + | |
| 24 | + struct icmpv6_nd_advt { | |
| 25 | +#if defined(__LITTLE_ENDIAN_BITFIELD) | |
| 26 | + __u32 reserved:5, | |
| 27 | + override:1, | |
| 28 | + solicited:1, | |
| 29 | + router:1, | |
| 30 | + reserved2:24; | |
| 31 | +#elif defined(__BIG_ENDIAN_BITFIELD) | |
| 32 | + __u32 router:1, | |
| 33 | + solicited:1, | |
| 34 | + override:1, | |
| 35 | + reserved:29; | |
| 36 | +#else | |
| 37 | +#error "Please fix <asm/byteorder.h>" | |
| 38 | +#endif | |
| 39 | + } u_nd_advt; | |
| 40 | + | |
| 41 | + struct icmpv6_nd_ra { | |
| 42 | + __u8 hop_limit; | |
| 43 | +#if defined(__LITTLE_ENDIAN_BITFIELD) | |
| 44 | + __u8 reserved:3, | |
| 45 | + router_pref:2, | |
| 46 | + home_agent:1, | |
| 47 | + other:1, | |
| 48 | + managed:1; | |
| 49 | + | |
| 50 | +#elif defined(__BIG_ENDIAN_BITFIELD) | |
| 51 | + __u8 managed:1, | |
| 52 | + other:1, | |
| 53 | + home_agent:1, | |
| 54 | + router_pref:2, | |
| 55 | + reserved:3; | |
| 56 | +#else | |
| 57 | +#error "Please fix <asm/byteorder.h>" | |
| 58 | +#endif | |
| 59 | + __be16 rt_lifetime; | |
| 60 | + } u_nd_ra; | |
| 61 | + | |
| 62 | + } icmp6_dataun; | |
| 63 | + | |
| 64 | +#define icmp6_identifier icmp6_dataun.u_echo.identifier | |
| 65 | +#define icmp6_sequence icmp6_dataun.u_echo.sequence | |
| 66 | +#define icmp6_pointer icmp6_dataun.un_data32[0] | |
| 67 | +#define icmp6_mtu icmp6_dataun.un_data32[0] | |
| 68 | +#define icmp6_unused icmp6_dataun.un_data32[0] | |
| 69 | +#define icmp6_maxdelay icmp6_dataun.un_data16[0] | |
| 70 | +#define icmp6_router icmp6_dataun.u_nd_advt.router | |
| 71 | +#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited | |
| 72 | +#define icmp6_override icmp6_dataun.u_nd_advt.override | |
| 73 | +#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved | |
| 74 | +#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit | |
| 75 | +#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed | |
| 76 | +#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other | |
| 77 | +#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime | |
| 78 | +#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref | |
| 79 | +}; | |
| 80 | + | |
| 81 | + | |
| 82 | +#define ICMPV6_ROUTER_PREF_LOW 0x3 | |
| 83 | +#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 | |
| 84 | +#define ICMPV6_ROUTER_PREF_HIGH 0x1 | |
| 85 | +#define ICMPV6_ROUTER_PREF_INVALID 0x2 | |
| 86 | + | |
| 87 | +#define ICMPV6_DEST_UNREACH 1 | |
| 88 | +#define ICMPV6_PKT_TOOBIG 2 | |
| 89 | +#define ICMPV6_TIME_EXCEED 3 | |
| 90 | +#define ICMPV6_PARAMPROB 4 | |
| 91 | + | |
| 92 | +#define ICMPV6_INFOMSG_MASK 0x80 | |
| 93 | + | |
| 94 | +#define ICMPV6_ECHO_REQUEST 128 | |
| 95 | +#define ICMPV6_ECHO_REPLY 129 | |
| 96 | +#define ICMPV6_MGM_QUERY 130 | |
| 97 | +#define ICMPV6_MGM_REPORT 131 | |
| 98 | +#define ICMPV6_MGM_REDUCTION 132 | |
| 99 | + | |
| 100 | +#define ICMPV6_NI_QUERY 139 | |
| 101 | +#define ICMPV6_NI_REPLY 140 | |
| 102 | + | |
| 103 | +#define ICMPV6_MLD2_REPORT 143 | |
| 104 | + | |
| 105 | +#define ICMPV6_DHAAD_REQUEST 144 | |
| 106 | +#define ICMPV6_DHAAD_REPLY 145 | |
| 107 | +#define ICMPV6_MOBILE_PREFIX_SOL 146 | |
| 108 | +#define ICMPV6_MOBILE_PREFIX_ADV 147 | |
| 109 | + | |
| 110 | +/* | |
| 111 | + * Codes for Destination Unreachable | |
| 112 | + */ | |
| 113 | +#define ICMPV6_NOROUTE 0 | |
| 114 | +#define ICMPV6_ADM_PROHIBITED 1 | |
| 115 | +#define ICMPV6_NOT_NEIGHBOUR 2 | |
| 116 | +#define ICMPV6_ADDR_UNREACH 3 | |
| 117 | +#define ICMPV6_PORT_UNREACH 4 | |
| 118 | + | |
| 119 | +/* | |
| 120 | + * Codes for Time Exceeded | |
| 121 | + */ | |
| 122 | +#define ICMPV6_EXC_HOPLIMIT 0 | |
| 123 | +#define ICMPV6_EXC_FRAGTIME 1 | |
| 124 | + | |
| 125 | +/* | |
| 126 | + * Codes for Parameter Problem | |
| 127 | + */ | |
| 128 | +#define ICMPV6_HDR_FIELD 0 | |
| 129 | +#define ICMPV6_UNK_NEXTHDR 1 | |
| 130 | +#define ICMPV6_UNK_OPTION 2 | |
| 131 | + | |
| 132 | +/* | |
| 133 | + * constants for (set|get)sockopt | |
| 134 | + */ | |
| 135 | + | |
| 136 | +#define ICMPV6_FILTER 1 | |
| 137 | + | |
| 138 | +/* | |
| 139 | + * ICMPV6 filter | |
| 140 | + */ | |
| 141 | + | |
| 142 | +#define ICMPV6_FILTER_BLOCK 1 | |
| 143 | +#define ICMPV6_FILTER_PASS 2 | |
| 144 | +#define ICMPV6_FILTER_BLOCKOTHERS 3 | |
| 145 | +#define ICMPV6_FILTER_PASSONLY 4 | |
| 146 | + | |
| 147 | +struct icmp6_filter { | |
| 148 | + __u32 data[8]; | |
| 149 | +}; | |
| 150 | + | |
| 151 | +/* | |
| 152 | + * Definitions for MLDv2 | |
| 153 | + */ | |
| 154 | +#define MLD2_MODE_IS_INCLUDE 1 | |
| 155 | +#define MLD2_MODE_IS_EXCLUDE 2 | |
| 156 | +#define MLD2_CHANGE_TO_INCLUDE 3 | |
| 157 | +#define MLD2_CHANGE_TO_EXCLUDE 4 | |
| 158 | +#define MLD2_ALLOW_NEW_SOURCES 5 | |
| 159 | +#define MLD2_BLOCK_OLD_SOURCES 6 | |
| 160 | + | |
| 161 | +#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } | |
| 162 | + | |
| 163 | + | |
| 164 | +#endif /* _UAPI_LINUX_ICMPV6_H */ | |
| @@ -0,0 +1,235 @@ | ||
| 1 | +/* | |
| 2 | + * INET An implementation of the TCP/IP protocol suite for the LINUX | |
| 3 | + * operating system. INET is implemented using the BSD Socket | |
| 4 | + * interface as the means of communication with the user level. | |
| 5 | + * | |
| 6 | + * Global definitions for the INET interface module. | |
| 7 | + * | |
| 8 | + * Version: @(#)if.h 1.0.2 04/18/93 | |
| 9 | + * | |
| 10 | + * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 | |
| 11 | + * Ross Biro | |
| 12 | + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | |
| 13 | + * | |
| 14 | + * This program is free software; you can redistribute it and/or | |
| 15 | + * modify it under the terms of the GNU General Public License | |
| 16 | + * as published by the Free Software Foundation; either version | |
| 17 | + * 2 of the License, or (at your option) any later version. | |
| 18 | + */ | |
| 19 | +#ifndef _LINUX_IF_H | |
| 20 | +#define _LINUX_IF_H | |
| 21 | + | |
| 22 | +#include <linux/types.h> /* for "__kernel_caddr_t" et al */ | |
| 23 | +#include <linux/socket.h> /* for "struct sockaddr" et al */ | |
| 24 | +#include <linux/compiler.h> /* for "__user" et al */ | |
| 25 | + | |
| 26 | +#define IFNAMSIZ 16 | |
| 27 | +#define IFALIASZ 256 | |
| 28 | +#include <linux/hdlc/ioctl.h> | |
| 29 | + | |
| 30 | +/* Standard interface flags (netdevice->flags). */ | |
| 31 | +#define IFF_UP 0x1 /* interface is up */ | |
| 32 | +#define IFF_BROADCAST 0x2 /* broadcast address valid */ | |
| 33 | +#define IFF_DEBUG 0x4 /* turn on debugging */ | |
| 34 | +#define IFF_LOOPBACK 0x8 /* is a loopback net */ | |
| 35 | +#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ | |
| 36 | +#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ | |
| 37 | +#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */ | |
| 38 | +#define IFF_NOARP 0x80 /* no ARP protocol */ | |
| 39 | +#define IFF_PROMISC 0x100 /* receive all packets */ | |
| 40 | +#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ | |
| 41 | + | |
| 42 | +#define IFF_MASTER 0x400 /* master of a load balancer */ | |
| 43 | +#define IFF_SLAVE 0x800 /* slave of a load balancer */ | |
| 44 | + | |
| 45 | +#define IFF_MULTICAST 0x1000 /* Supports multicast */ | |
| 46 | + | |
| 47 | +#define IFF_PORTSEL 0x2000 /* can set media type */ | |
| 48 | +#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ | |
| 49 | +#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ | |
| 50 | + | |
| 51 | +#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ | |
| 52 | +#define IFF_DORMANT 0x20000 /* driver signals dormant */ | |
| 53 | + | |
| 54 | +#define IFF_ECHO 0x40000 /* echo sent packets */ | |
| 55 | + | |
| 56 | +#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ | |
| 57 | + IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) | |
| 58 | + | |
| 59 | +/* Private (from user) interface flags (netdevice->priv_flags). */ | |
| 60 | +#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */ | |
| 61 | +#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */ | |
| 62 | +#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ | |
| 63 | +#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ | |
| 64 | +#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ | |
| 65 | +#define IFF_BONDING 0x20 /* bonding master or slave */ | |
| 66 | +#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ | |
| 67 | +#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ | |
| 68 | +#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ | |
| 69 | +#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */ | |
| 70 | +#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to | |
| 71 | + * release skb->dst | |
| 72 | + */ | |
| 73 | +#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ | |
| 74 | +#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */ | |
| 75 | +#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */ | |
| 76 | +#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */ | |
| 77 | +#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch | |
| 78 | + * datapath port */ | |
| 79 | +#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing | |
| 80 | + * skbs on transmit */ | |
| 81 | +#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ | |
| 82 | +#define IFF_TEAM_PORT 0x40000 /* device used as team port */ | |
| 83 | +#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ | |
| 84 | +#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address | |
| 85 | + * change when it's running */ | |
| 86 | + | |
| 87 | + | |
| 88 | +#define IF_GET_IFACE 0x0001 /* for querying only */ | |
| 89 | +#define IF_GET_PROTO 0x0002 | |
| 90 | + | |
| 91 | +/* For definitions see hdlc.h */ | |
| 92 | +#define IF_IFACE_V35 0x1000 /* V.35 serial interface */ | |
| 93 | +#define IF_IFACE_V24 0x1001 /* V.24 serial interface */ | |
| 94 | +#define IF_IFACE_X21 0x1002 /* X.21 serial interface */ | |
| 95 | +#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ | |
| 96 | +#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ | |
| 97 | +#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ | |
| 98 | +#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ | |
| 99 | + | |
| 100 | +/* For definitions see hdlc.h */ | |
| 101 | +#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ | |
| 102 | +#define IF_PROTO_PPP 0x2001 /* PPP protocol */ | |
| 103 | +#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ | |
| 104 | +#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ | |
| 105 | +#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ | |
| 106 | +#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ | |
| 107 | +#define IF_PROTO_X25 0x2006 /* X.25 */ | |
| 108 | +#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ | |
| 109 | +#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ | |
| 110 | +#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ | |
| 111 | +#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ | |
| 112 | +#define IF_PROTO_FR_ETH_PVC 0x200B | |
| 113 | +#define IF_PROTO_RAW 0x200C /* RAW Socket */ | |
| 114 | + | |
| 115 | +/* RFC 2863 operational status */ | |
| 116 | +enum { | |
| 117 | + IF_OPER_UNKNOWN, | |
| 118 | + IF_OPER_NOTPRESENT, | |
| 119 | + IF_OPER_DOWN, | |
| 120 | + IF_OPER_LOWERLAYERDOWN, | |
| 121 | + IF_OPER_TESTING, | |
| 122 | + IF_OPER_DORMANT, | |
| 123 | + IF_OPER_UP, | |
| 124 | +}; | |
| 125 | + | |
| 126 | +/* link modes */ | |
| 127 | +enum { | |
| 128 | + IF_LINK_MODE_DEFAULT, | |
| 129 | + IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ | |
| 130 | +}; | |
| 131 | + | |
| 132 | +/* | |
| 133 | + * Device mapping structure. I'd just gone off and designed a | |
| 134 | + * beautiful scheme using only loadable modules with arguments | |
| 135 | + * for driver options and along come the PCMCIA people 8) | |
| 136 | + * | |
| 137 | + * Ah well. The get() side of this is good for WDSETUP, and it'll | |
| 138 | + * be handy for debugging things. The set side is fine for now and | |
| 139 | + * being very small might be worth keeping for clean configuration. | |
| 140 | + */ | |
| 141 | + | |
| 142 | +struct ifmap { | |
| 143 | + unsigned long mem_start; | |
| 144 | + unsigned long mem_end; | |
| 145 | + unsigned short base_addr; | |
| 146 | + unsigned char irq; | |
| 147 | + unsigned char dma; | |
| 148 | + unsigned char port; | |
| 149 | + /* 3 bytes spare */ | |
| 150 | +}; | |
| 151 | + | |
| 152 | +struct if_settings { | |
| 153 | + unsigned int type; /* Type of physical device or protocol */ | |
| 154 | + unsigned int size; /* Size of the data allocated by the caller */ | |
| 155 | + union { | |
| 156 | + /* {atm/eth/dsl}_settings anyone ? */ | |
| 157 | + raw_hdlc_proto __user *raw_hdlc; | |
| 158 | + cisco_proto __user *cisco; | |
| 159 | + fr_proto __user *fr; | |
| 160 | + fr_proto_pvc __user *fr_pvc; | |
| 161 | + fr_proto_pvc_info __user *fr_pvc_info; | |
| 162 | + | |
| 163 | + /* interface settings */ | |
| 164 | + sync_serial_settings __user *sync; | |
| 165 | + te1_settings __user *te1; | |
| 166 | + } ifs_ifsu; | |
| 167 | +}; | |
| 168 | + | |
| 169 | +/* | |
| 170 | + * Interface request structure used for socket | |
| 171 | + * ioctl's. All interface ioctl's must have parameter | |
| 172 | + * definitions which begin with ifr_name. The | |
| 173 | + * remainder may be interface specific. | |
| 174 | + */ | |
| 175 | + | |
| 176 | +struct ifreq { | |
| 177 | +#define IFHWADDRLEN 6 | |
| 178 | + union | |
| 179 | + { | |
| 180 | + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | |
| 181 | + } ifr_ifrn; | |
| 182 | + | |
| 183 | + union { | |
| 184 | + struct sockaddr ifru_addr; | |
| 185 | + struct sockaddr ifru_dstaddr; | |
| 186 | + struct sockaddr ifru_broadaddr; | |
| 187 | + struct sockaddr ifru_netmask; | |
| 188 | + struct sockaddr ifru_hwaddr; | |
| 189 | + short ifru_flags; | |
| 190 | + int ifru_ivalue; | |
| 191 | + int ifru_mtu; | |
| 192 | + struct ifmap ifru_map; | |
| 193 | + char ifru_slave[IFNAMSIZ]; /* Just fits the size */ | |
| 194 | + char ifru_newname[IFNAMSIZ]; | |
| 195 | + void __user * ifru_data; | |
| 196 | + struct if_settings ifru_settings; | |
| 197 | + } ifr_ifru; | |
| 198 | +}; | |
| 199 | + | |
| 200 | +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ | |
| 201 | +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ | |
| 202 | +#define ifr_addr ifr_ifru.ifru_addr /* address */ | |
| 203 | +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ | |
| 204 | +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ | |
| 205 | +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ | |
| 206 | +#define ifr_flags ifr_ifru.ifru_flags /* flags */ | |
| 207 | +#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ | |
| 208 | +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ | |
| 209 | +#define ifr_map ifr_ifru.ifru_map /* device map */ | |
| 210 | +#define ifr_slave ifr_ifru.ifru_slave /* slave device */ | |
| 211 | +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ | |
| 212 | +#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ | |
| 213 | +#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ | |
| 214 | +#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ | |
| 215 | +#define ifr_newname ifr_ifru.ifru_newname /* New name */ | |
| 216 | +#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ | |
| 217 | + | |
| 218 | +/* | |
| 219 | + * Structure used in SIOCGIFCONF request. | |
| 220 | + * Used to retrieve interface configuration | |
| 221 | + * for machine (useful for programs which | |
| 222 | + * must know all networks accessible). | |
| 223 | + */ | |
| 224 | + | |
| 225 | +struct ifconf { | |
| 226 | + int ifc_len; /* size of buffer */ | |
| 227 | + union { | |
| 228 | + char __user *ifcu_buf; | |
| 229 | + struct ifreq __user *ifcu_req; | |
| 230 | + } ifc_ifcu; | |
| 231 | +}; | |
| 232 | +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ | |
| 233 | +#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ | |
| 234 | + | |
| 235 | +#endif /* _LINUX_IF_H */ | |
| @@ -0,0 +1,61 @@ | ||
| 1 | +#ifndef __LINUX_IF_ADDR_H | |
| 2 | +#define __LINUX_IF_ADDR_H | |
| 3 | + | |
| 4 | +#include <linux/types.h> | |
| 5 | +#include <linux/netlink.h> | |
| 6 | + | |
| 7 | +struct ifaddrmsg { | |
| 8 | + __u8 ifa_family; | |
| 9 | + __u8 ifa_prefixlen; /* The prefix length */ | |
| 10 | + __u8 ifa_flags; /* Flags */ | |
| 11 | + __u8 ifa_scope; /* Address scope */ | |
| 12 | + __u32 ifa_index; /* Link index */ | |
| 13 | +}; | |
| 14 | + | |
| 15 | +/* | |
| 16 | + * Important comment: | |
| 17 | + * IFA_ADDRESS is prefix address, rather than local interface address. | |
| 18 | + * It makes no difference for normally configured broadcast interfaces, | |
| 19 | + * but for point-to-point IFA_ADDRESS is DESTINATION address, | |
| 20 | + * local address is supplied in IFA_LOCAL attribute. | |
| 21 | + */ | |
| 22 | +enum { | |
| 23 | + IFA_UNSPEC, | |
| 24 | + IFA_ADDRESS, | |
| 25 | + IFA_LOCAL, | |
| 26 | + IFA_LABEL, | |
| 27 | + IFA_BROADCAST, | |
| 28 | + IFA_ANYCAST, | |
| 29 | + IFA_CACHEINFO, | |
| 30 | + IFA_MULTICAST, | |
| 31 | + __IFA_MAX, | |
| 32 | +}; | |
| 33 | + | |
| 34 | +#define IFA_MAX (__IFA_MAX - 1) | |
| 35 | + | |
| 36 | +/* ifa_flags */ | |
| 37 | +#define IFA_F_SECONDARY 0x01 | |
| 38 | +#define IFA_F_TEMPORARY IFA_F_SECONDARY | |
| 39 | + | |
| 40 | +#define IFA_F_NODAD 0x02 | |
| 41 | +#define IFA_F_OPTIMISTIC 0x04 | |
| 42 | +#define IFA_F_DADFAILED 0x08 | |
| 43 | +#define IFA_F_HOMEADDRESS 0x10 | |
| 44 | +#define IFA_F_DEPRECATED 0x20 | |
| 45 | +#define IFA_F_TENTATIVE 0x40 | |
| 46 | +#define IFA_F_PERMANENT 0x80 | |
| 47 | + | |
| 48 | +struct ifa_cacheinfo { | |
| 49 | + __u32 ifa_prefered; | |
| 50 | + __u32 ifa_valid; | |
| 51 | + __u32 cstamp; /* created timestamp, hundredths of seconds */ | |
| 52 | + __u32 tstamp; /* updated timestamp, hundredths of seconds */ | |
| 53 | +}; | |
| 54 | + | |
| 55 | +/* backwards compatibility for userspace */ | |
| 56 | +#ifndef __KERNEL__ | |
| 57 | +#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) | |
| 58 | +#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) | |
| 59 | +#endif | |
| 60 | + | |
| 61 | +#endif | |
| @@ -0,0 +1,32 @@ | ||
| 1 | +/* | |
| 2 | + * if_addrlabel.h - netlink interface for address labels | |
| 3 | + * | |
| 4 | + * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. | |
| 5 | + * | |
| 6 | + * Authors: | |
| 7 | + * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org> | |
| 8 | + */ | |
| 9 | + | |
| 10 | +#ifndef __LINUX_IF_ADDRLABEL_H | |
| 11 | +#define __LINUX_IF_ADDRLABEL_H | |
| 12 | + | |
| 13 | +#include <linux/types.h> | |
| 14 | + | |
| 15 | +struct ifaddrlblmsg { | |
| 16 | + __u8 ifal_family; /* Address family */ | |
| 17 | + __u8 __ifal_reserved; /* Reserved */ | |
| 18 | + __u8 ifal_prefixlen; /* Prefix length */ | |
| 19 | + __u8 ifal_flags; /* Flags */ | |
| 20 | + __u32 ifal_index; /* Link index */ | |
| 21 | + __u32 ifal_seq; /* sequence number */ | |
| 22 | +}; | |
| 23 | + | |
| 24 | +enum { | |
| 25 | + IFAL_ADDRESS = 1, | |
| 26 | + IFAL_LABEL = 2, | |
| 27 | + __IFAL_MAX | |
| 28 | +}; | |
| 29 | + | |
| 30 | +#define IFAL_MAX (__IFAL_MAX - 1) | |
| 31 | + | |
| 32 | +#endif | |
| @@ -0,0 +1,40 @@ | ||
| 1 | +/* | |
| 2 | + * if_alg: User-space algorithm interface | |
| 3 | + * | |
| 4 | + * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au> | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or modify it | |
| 7 | + * under the terms of the GNU General Public License as published by the Free | |
| 8 | + * Software Foundation; either version 2 of the License, or (at your option) | |
| 9 | + * any later version. | |
| 10 | + * | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#ifndef _LINUX_IF_ALG_H | |
| 14 | +#define _LINUX_IF_ALG_H | |
| 15 | + | |
| 16 | +#include <linux/types.h> | |
| 17 | + | |
| 18 | +struct sockaddr_alg { | |
| 19 | + __u16 salg_family; | |
| 20 | + __u8 salg_type[14]; | |
| 21 | + __u32 salg_feat; | |
| 22 | + __u32 salg_mask; | |
| 23 | + __u8 salg_name[64]; | |
| 24 | +}; | |
| 25 | + | |
| 26 | +struct af_alg_iv { | |
| 27 | + __u32 ivlen; | |
| 28 | + __u8 iv[0]; | |
| 29 | +}; | |
| 30 | + | |
| 31 | +/* Socket options */ | |
| 32 | +#define ALG_SET_KEY 1 | |
| 33 | +#define ALG_SET_IV 2 | |
| 34 | +#define ALG_SET_OP 3 | |
| 35 | + | |
| 36 | +/* Operations */ | |
| 37 | +#define ALG_OP_DECRYPT 0 | |
| 38 | +#define ALG_OP_ENCRYPT 1 | |
| 39 | + | |
| 40 | +#endif /* _LINUX_IF_ALG_H */ | |
| @@ -0,0 +1,132 @@ | ||
| 1 | +/* | |
| 2 | + * INET An implementation of the TCP/IP protocol suite for the LINUX | |
| 3 | + * operating system. INET is implemented using the BSD Socket | |
| 4 | + * interface as the means of communication with the user level. | |
| 5 | + * | |
127 more lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 136 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 430 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 273 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 254 lines aren’t shown here.
This diff is large: its 280 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 1154 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 435 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 457 lines aren’t shown here.
This diff is large: its 122 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 165 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 252 lines aren’t shown here.
Empty file added.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 166 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 721 lines aren’t shown here.
This diff is large: its 224 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 444 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 976 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 181 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 178 lines aren’t shown here.
This diff is large: its 188 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 298 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 162 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 138 lines aren’t shown here.
This diff is large: its 168 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 202 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 198 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 179 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 3073 lines aren’t shown here.
This diff is large: its 245 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 647 lines aren’t shown here.
This diff is large: its 223 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 847 lines aren’t shown here.
This diff is large: its 616 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 371 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 186 lines aren’t shown here.
This diff is large: its 470 lines aren’t shown here.
This diff is large: its 739 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 120 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 132 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 286 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 613 lines aren’t shown here.
This diff is large: its 173 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 220 lines aren’t shown here.
This diff is large: its 372 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 285 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 149 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 1283 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 283 lines aren’t shown here.
This diff is large: its 301 lines aren’t shown here.
This diff is large: its 933 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 214 lines aren’t shown here.
This diff is large: its 226 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 263 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 167 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 210 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 138 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 181 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 804 lines aren’t shown here.
This diff is large: its 817 lines aren’t shown here.
This diff is large: its 120 lines aren’t shown here.
This diff is large: its 181 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 369 lines aren’t shown here.
This diff is large: its 131 lines aren’t shown here.
This diff is large: its 1999 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 131 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 170 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 453 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 240 lines aren’t shown here.
This diff is large: its 1129 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 507 lines aren’t shown here.