Use tabs in io.d, fix alignment issues, remove extraneous newlines

This commit is contained in:
Devin Teske 2018-02-12 23:53:38 +00:00
parent e958ad4cf3
commit 980b68eaa2
8 changed files with 107 additions and 112 deletions

View File

@ -29,47 +29,47 @@
#pragma D depends_on provider io #pragma D depends_on provider io
typedef struct devinfo { typedef struct devinfo {
int dev_major; /* major number */ int dev_major; /* major number */
int dev_minor; /* minor number */ int dev_minor; /* minor number */
int dev_instance; /* instance number */ int dev_instance; /* instance number */
string dev_name; /* name of device */ string dev_name; /* name of device */
string dev_statname; /* name of device + instance/minor */ string dev_statname; /* name of device + instance/minor */
string dev_pathname; /* pathname of device */ string dev_pathname; /* pathname of device */
} devinfo_t; } devinfo_t;
#pragma D binding "1.0" translator #pragma D binding "1.0" translator
translator devinfo_t < struct devstat *D > { translator devinfo_t < struct devstat *D > {
dev_major = D->device_number; dev_major = D->device_number;
dev_minor = D->unit_number; dev_minor = D->unit_number;
dev_instance = 0; dev_instance = 0;
dev_name = stringof(D->device_name); dev_name = stringof(D->device_name);
dev_statname = stringof(D->device_name); dev_statname = stringof(D->device_name);
dev_pathname = stringof(D->device_name); dev_pathname = stringof(D->device_name);
}; };
typedef struct bufinfo { typedef struct bufinfo {
int b_flags; /* flags */ int b_flags; /* flags */
long b_bcount; /* number of bytes */ long b_bcount; /* number of bytes */
caddr_t b_addr; /* buffer address */ caddr_t b_addr; /* buffer address */
uint64_t b_blkno; /* expanded block # on device */ uint64_t b_blkno; /* expanded block # on device */
uint64_t b_lblkno; /* block # on device */ uint64_t b_lblkno; /* block # on device */
size_t b_resid; /* # of bytes not transferred */ size_t b_resid; /* # of bytes not transferred */
size_t b_bufsize; /* size of allocated buffer */ size_t b_bufsize; /* size of allocated buffer */
/* caddr_t b_iodone; I/O completion routine */ /* caddr_t b_iodone; I/O completion routine */
int b_error; /* expanded error field */ int b_error; /* expanded error field */
/* dev_t b_edev; extended device */ /* dev_t b_edev; extended device */
} bufinfo_t; } bufinfo_t;
#pragma D binding "1.0" translator #pragma D binding "1.0" translator
translator bufinfo_t < struct bio *B > { translator bufinfo_t < struct bio *B > {
b_flags = B->bio_flags; b_flags = B->bio_flags;
b_bcount = B->bio_bcount; b_bcount = B->bio_bcount;
b_addr = B->bio_data; b_addr = B->bio_data;
b_blkno = 0; b_blkno = 0;
b_lblkno = 0; b_lblkno = 0;
b_resid = B->bio_resid; b_resid = B->bio_resid;
b_bufsize = 0; /* XXX gnn */ b_bufsize = 0; /* XXX gnn */
b_error = B->bio_error; b_error = B->bio_error;
}; };
/* /*
@ -105,5 +105,3 @@ inline int O_SYNC = 0x0080;
#pragma D binding "1.1" O_SYNC #pragma D binding "1.1" O_SYNC
inline int O_TRUNC = 0x0400; inline int O_TRUNC = 0x0400;
#pragma D binding "1.1" O_TRUNC #pragma D binding "1.1" O_TRUNC

View File

@ -215,10 +215,10 @@ translator csinfo_t < void *p > {
#pragma D binding "1.6.3" translator #pragma D binding "1.6.3" translator
translator csinfo_t < struct inpcb *p > { translator csinfo_t < struct inpcb *p > {
cs_addr = NULL; cs_addr = NULL;
cs_cid = (uint64_t)p; cs_cid = (uint64_t)p;
cs_pid = 0; /* XXX */ cs_pid = 0; /* XXX */
cs_zoneid = 0; cs_zoneid = 0;
}; };
#pragma D binding "1.5" translator #pragma D binding "1.5" translator

View File

@ -4,7 +4,7 @@
* *
* This software was developed by Rui Paulo under sponsorship from the * This software was developed by Rui Paulo under sponsorship from the
* FreeBSD Foundation. * FreeBSD Foundation.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:

View File

@ -97,4 +97,3 @@ inline psinfo_t *curpsinfo = xlate <psinfo_t *> (curthread->td_proc);
inline lwpsinfo_t *curlwpsinfo = xlate <lwpsinfo_t *> (curthread); inline lwpsinfo_t *curlwpsinfo = xlate <lwpsinfo_t *> (curthread);
#pragma D attributes Stable/Stable/Common curlwpsinfo #pragma D attributes Stable/Stable/Common curlwpsinfo
#pragma D binding "1.0" curlwpsinfo #pragma D binding "1.0" curlwpsinfo

View File

@ -1,4 +1,4 @@
/* /*
* CDDL HEADER START * CDDL HEADER START
* *
* The contents of this file are subject to the terms of the * The contents of this file are subject to the terms of the
@ -116,4 +116,3 @@ inline int R_R14 = 18 + 1 + 1;
#pragma D binding "1.0" R_R14 #pragma D binding "1.0" R_R14
inline int R_R15 = 18 + 1 + 0; inline int R_R15 = 18 + 1 + 0;
#pragma D binding "1.0" R_R15 #pragma D binding "1.0" R_R15

View File

@ -81,4 +81,3 @@ inline chipid_t chip = curcpu->cpu_chip;
inline lgrp_id_t lgrp = curcpu->cpu_lgrp; inline lgrp_id_t lgrp = curcpu->cpu_lgrp;
#pragma D attributes Stable/Stable/Common lgrp #pragma D attributes Stable/Stable/Common lgrp
#pragma D binding "1.0" lgrp #pragma D binding "1.0" lgrp

View File

@ -118,18 +118,18 @@ typedef struct tcpsinfo {
int32_t tcps_rcv_ws; /* receive window scaling */ int32_t tcps_rcv_ws; /* receive window scaling */
u_long tcps_cwnd; /* congestion window */ u_long tcps_cwnd; /* congestion window */
u_long tcps_cwnd_ssthresh; /* threshold for congestion avoidance */ u_long tcps_cwnd_ssthresh; /* threshold for congestion avoidance */
uint32_t tcps_srecover; /* for use in NewReno Fast Recovery */ uint32_t tcps_srecover; /* for use in NewReno Fast Recovery */
uint32_t tcps_sack_fack; /* SACK sequence # we have acked */ uint32_t tcps_sack_fack; /* SACK sequence # we have acked */
uint32_t tcps_sack_snxt; /* next SACK seq # for retransmission */ uint32_t tcps_sack_snxt; /* next SACK seq # for retransmission */
uint32_t tcps_rto; /* round-trip timeout, msec */ uint32_t tcps_rto; /* round-trip timeout, msec */
uint32_t tcps_mss; /* max segment size */ uint32_t tcps_mss; /* max segment size */
int tcps_retransmit; /* retransmit send event, boolean */ int tcps_retransmit; /* retransmit send event, boolean */
int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
int tcps_debug; /* socket has SO_DEBUG set */ int tcps_debug; /* socket has SO_DEBUG set */
int tcps_cookie; /* expose the socket's SO_USER_COOKIE */ int tcps_cookie; /* expose the socket's SO_USER_COOKIE */
int32_t tcps_dupacks; /* consecutive dup acks received */ int32_t tcps_dupacks; /* consecutive dup acks received */
uint32_t tcps_rtttime; /* RTT measurement start time */ uint32_t tcps_rtttime; /* RTT measurement start time */
uint32_t tcps_rtseq; /* sequence # being timed */ uint32_t tcps_rtseq; /* sequence # being timed */
uint32_t tcps_ts_recent; /* timestamp echo data */ uint32_t tcps_ts_recent; /* timestamp echo data */
} tcpsinfo_t; } tcpsinfo_t;
@ -206,31 +206,31 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_snxt = p == NULL ? 0 : p->snd_nxt; tcps_snxt = p == NULL ? 0 : p->snd_nxt;
tcps_rack = p == NULL ? 0 : p->last_ack_sent; tcps_rack = p == NULL ? 0 : p->last_ack_sent;
tcps_rnxt = p == NULL ? 0 : p->rcv_nxt; tcps_rnxt = p == NULL ? 0 : p->rcv_nxt;
tcps_swnd = p == NULL ? -1 : p->snd_wnd; tcps_swnd = p == NULL ? -1 : p->snd_wnd;
tcps_snd_ws = p == NULL ? -1 : p->snd_scale; tcps_snd_ws = p == NULL ? -1 : p->snd_scale;
tcps_swl1 = p == NULL ? -1 : p->snd_wl1; tcps_swl1 = p == NULL ? -1 : p->snd_wl1;
tcps_swl2 = p == NULL ? -1 : p->snd_wl2; tcps_swl2 = p == NULL ? -1 : p->snd_wl2;
tcps_radv = p == NULL ? -1 : p->rcv_adv; tcps_radv = p == NULL ? -1 : p->rcv_adv;
tcps_rwnd = p == NULL ? -1 : p->rcv_wnd; tcps_rwnd = p == NULL ? -1 : p->rcv_wnd;
tcps_rup = p == NULL ? -1 : p->rcv_up; tcps_rup = p == NULL ? -1 : p->rcv_up;
tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale; tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale;
tcps_cwnd = p == NULL ? -1 : p->snd_cwnd; tcps_cwnd = p == NULL ? -1 : p->snd_cwnd;
tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh; tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh;
tcps_srecover = p == NULL ? -1 : p->snd_recover; tcps_srecover = p == NULL ? -1 : p->snd_recover;
tcps_sack_fack = p == NULL ? 0 : p->snd_fack; tcps_sack_fack = p == NULL ? 0 : p->snd_fack;
tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata; tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata;
tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz; tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz;
tcps_mss = p == NULL ? -1 : p->t_maxseg; tcps_mss = p == NULL ? -1 : p->t_maxseg;
tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */
tcps_debug = p == NULL ? 0 : tcps_debug = p == NULL ? 0 :
p->t_inpcb->inp_socket->so_options & 1; p->t_inpcb->inp_socket->so_options & 1;
tcps_cookie = p == NULL ? -1 : tcps_cookie = p == NULL ? -1 :
p->t_inpcb->inp_socket->so_user_cookie; p->t_inpcb->inp_socket->so_user_cookie;
tcps_dupacks = p == NULL ? -1 : p->t_dupacks; tcps_dupacks = p == NULL ? -1 : p->t_dupacks;
tcps_rtttime = p == NULL ? -1 : p->t_rtttime; tcps_rtttime = p == NULL ? -1 : p->t_rtttime;
tcps_rtseq = p == NULL ? -1 : p->t_rtseq; tcps_rtseq = p == NULL ? -1 : p->t_rtseq;
tcps_ts_recent = p == NULL ? -1 : p->ts_recent; tcps_ts_recent = p == NULL ? -1 : p->ts_recent;
}; };
#pragma D binding "1.6.3" translator #pragma D binding "1.6.3" translator
@ -319,74 +319,74 @@ inline int PRU_LISTEN = 3;
#pragma D binding "1.12.1" PRU_CONNECT #pragma D binding "1.12.1" PRU_CONNECT
inline int PRU_CONNECT = 4; inline int PRU_CONNECT = 4;
#pragma D binding "1.12.1" PRU_ACCEPT #pragma D binding "1.12.1" PRU_ACCEPT
inline int PRU_ACCEPT = 5 ; inline int PRU_ACCEPT = 5 ;
#pragma D binding "1.12.1" PRU_DISCONNECT #pragma D binding "1.12.1" PRU_DISCONNECT
inline int PRU_DISCONNECT= 6; inline int PRU_DISCONNECT = 6;
#pragma D binding "1.12.1" PRU_SHUTDOWN #pragma D binding "1.12.1" PRU_SHUTDOWN
inline int PRU_SHUTDOWN = 7; inline int PRU_SHUTDOWN = 7;
#pragma D binding "1.12.1" PRU_RCVD #pragma D binding "1.12.1" PRU_RCVD
inline int PRU_RCVD = 8; inline int PRU_RCVD = 8;
#pragma D binding "1.12.1" PRU_SEND #pragma D binding "1.12.1" PRU_SEND
inline int PRU_SEND = 9; inline int PRU_SEND = 9;
#pragma D binding "1.12.1" PRU_ABORT #pragma D binding "1.12.1" PRU_ABORT
inline int PRU_ABORT = 10; inline int PRU_ABORT = 10;
#pragma D binding "1.12.1" PRU_CONTROL #pragma D binding "1.12.1" PRU_CONTROL
inline int PRU_CONTROL = 11; inline int PRU_CONTROL = 11;
#pragma D binding "1.12.1" PRU_SENSE #pragma D binding "1.12.1" PRU_SENSE
inline int PRU_SENSE = 12; inline int PRU_SENSE = 12;
#pragma D binding "1.12.1" PRU_RCVOOB #pragma D binding "1.12.1" PRU_RCVOOB
inline int PRU_RCVOOB = 13; inline int PRU_RCVOOB = 13;
#pragma D binding "1.12.1" PRU_SENDOOB #pragma D binding "1.12.1" PRU_SENDOOB
inline int PRU_SENDOOB = 14; inline int PRU_SENDOOB = 14;
#pragma D binding "1.12.1" PRU_SOCKADDR #pragma D binding "1.12.1" PRU_SOCKADDR
inline int PRU_SOCKADDR = 15; inline int PRU_SOCKADDR = 15;
#pragma D binding "1.12.1" PRU_PEERADDR #pragma D binding "1.12.1" PRU_PEERADDR
inline int PRU_PEERADDR = 16; inline int PRU_PEERADDR = 16;
#pragma D binding "1.12.1" PRU_CONNECT2 #pragma D binding "1.12.1" PRU_CONNECT2
inline int PRU_CONNECT2 = 17; inline int PRU_CONNECT2 = 17;
#pragma D binding "1.12.1" PRU_FASTTIMO #pragma D binding "1.12.1" PRU_FASTTIMO
inline int PRU_FASTTIMO = 18; inline int PRU_FASTTIMO = 18;
#pragma D binding "1.12.1" PRU_SLOWTIMO #pragma D binding "1.12.1" PRU_SLOWTIMO
inline int PRU_SLOWTIMO = 19; inline int PRU_SLOWTIMO = 19;
#pragma D binding "1.12.1" PRU_PROTORCV #pragma D binding "1.12.1" PRU_PROTORCV
inline int PRU_PROTORCV = 20; inline int PRU_PROTORCV = 20;
#pragma D binding "1.12.1" PRU_PROTOSEND #pragma D binding "1.12.1" PRU_PROTOSEND
inline int PRU_PROTOSEND = 21; inline int PRU_PROTOSEND = 21;
#pragma D binding "1.12.1" PRU_SEND_EOF #pragma D binding "1.12.1" PRU_SEND_EOF
inline int PRU_SEND_EOF = 22; inline int PRU_SEND_EOF = 22;
#pragma D binding "1.12.1" PRU_SOSETLABEL #pragma D binding "1.12.1" PRU_SOSETLABEL
inline int PRU_SOSETLABEL = 23; inline int PRU_SOSETLABEL = 23;
#pragma D binding "1.12.1" PRU_CLOSE #pragma D binding "1.12.1" PRU_CLOSE
inline int PRU_CLOSE = 24; inline int PRU_CLOSE = 24;
#pragma D binding "1.12.1" PRU_FLUSH #pragma D binding "1.12.1" PRU_FLUSH
inline int PRU_FLUSH = 25; inline int PRU_FLUSH = 25;
#pragma D binding "1.12.1" prureq_string #pragma D binding "1.12.1" prureq_string
inline string prureq_string[uint8_t req] = inline string prureq_string[uint8_t req] =
req == PRU_ATTACH ? "ATTACH" : req == PRU_ATTACH ? "ATTACH" :
req == PRU_DETACH ? "DETACH" : req == PRU_DETACH ? "DETACH" :
req == PRU_BIND ? "BIND" : req == PRU_BIND ? "BIND" :
req == PRU_LISTEN ? "LISTEN" : req == PRU_LISTEN ? "LISTEN" :
req == PRU_CONNECT ? "CONNECT" : req == PRU_CONNECT ? "CONNECT" :
req == PRU_ACCEPT ? "ACCEPT" : req == PRU_ACCEPT ? "ACCEPT" :
req == PRU_DISCONNECT ? "DISCONNECT" : req == PRU_DISCONNECT ? "DISCONNECT" :
req == PRU_SHUTDOWN ? "SHUTDOWN" : req == PRU_SHUTDOWN ? "SHUTDOWN" :
req == PRU_RCVD ? "RCVD" : req == PRU_RCVD ? "RCVD" :
req == PRU_SEND ? "SEND" : req == PRU_SEND ? "SEND" :
req == PRU_ABORT ? "ABORT" : req == PRU_ABORT ? "ABORT" :
req == PRU_CONTROL ? "CONTROL" : req == PRU_CONTROL ? "CONTROL" :
req == PRU_SENSE ? "SENSE" : req == PRU_SENSE ? "SENSE" :
req == PRU_RCVOOB ? "RCVOOB" : req == PRU_RCVOOB ? "RCVOOB" :
req == PRU_SENDOOB ? "SENDOOB" : req == PRU_SENDOOB ? "SENDOOB" :
req == PRU_SOCKADDR ? "SOCKADDR" : req == PRU_SOCKADDR ? "SOCKADDR" :
req == PRU_PEERADDR ? "PEERADDR" : req == PRU_PEERADDR ? "PEERADDR" :
req == PRU_CONNECT2 ? "CONNECT2" : req == PRU_CONNECT2 ? "CONNECT2" :
req == PRU_FASTTIMO ? "FASTTIMO" : req == PRU_FASTTIMO ? "FASTTIMO" :
req == PRU_SLOWTIMO ? "SLOWTIMO" : req == PRU_SLOWTIMO ? "SLOWTIMO" :
req == PRU_PROTORCV ? "PROTORCV" : req == PRU_PROTORCV ? "PROTORCV" :
req == PRU_PROTOSEND ? "PROTOSEND" : req == PRU_PROTOSEND ? "PROTOSEND" :
req == PRU_SEND ? "SEND_EOF" : req == PRU_SEND ? "SEND_EOF" :
req == PRU_SOSETLABEL ? "SOSETLABEL" : req == PRU_SOSETLABEL ? "SOSETLABEL" :
req == PRU_CLOSE ? "CLOSE" : req == PRU_CLOSE ? "CLOSE" :
req == PRU_FLUSH ? "FLUSE" : req == PRU_FLUSH ? "FLUSE" :
"unknown" ; "unknown" ;

View File

@ -47,7 +47,7 @@ typedef struct udpinfo {
uint16_t udp_sport; /* source port */ uint16_t udp_sport; /* source port */
uint16_t udp_dport; /* destination port */ uint16_t udp_dport; /* destination port */
uint16_t udp_length; /* total length */ uint16_t udp_length; /* total length */
uint16_t udp_checksum; /* headers + data checksum */ uint16_t udp_checksum; /* headers + data checksum */
struct udphdr *udp_hdr; /* raw UDP header */ struct udphdr *udp_hdr; /* raw UDP header */
} udpinfo_t; } udpinfo_t;