type
stringclasses
5 values
content
stringlengths
9
163k
functions
void bgp_packet_delete (struct peer *peer) { stream_free (stream_fifo_pop (peer->obuf)); }
functions
void bgp_connect_check (struct peer *peer) { int status; socklen_t slen; int ret; /* Anyway I have to reset read and write thread. */ BGP_READ_OFF (peer->t_read); BGP_WRITE_OFF (peer->t_write); /* Check file descriptor. */ slen = sizeof (status); ret = getsockopt(peer->fd, SOL_SOCKET, SO_ERROR, (voi...
functions
void bgp_default_update_send (struct peer *peer, struct attr *attr, afi_t afi, safi_t safi, struct peer *from) { struct stream *s; struct stream *packet; struct prefix p; unsigned long pos; bgp_size_t total_attr_len; if (DISABLE_BGP_ANNOUNCE) return; if (afi == AFI_IP) str2prefix ("0.0.0.0/0...
functions
void bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi) { struct stream *s; struct stream *packet; struct prefix p; unsigned long attrlen_pos = 0; unsigned long cp; bgp_size_t unfeasible_len; bgp_size_t total_attr_len; size_t mp_start = 0; size_t mplen_pos = 0; if (DISABLE_BGP_AN...
functions
int bgp_write_proceed (struct peer *peer) { afi_t afi; safi_t safi; struct bgp_advertise *adv; if (stream_fifo_head (peer->obuf)) return 1; for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) if (FIFO_HEAD (&peer->sync[afi][safi]->withdraw)) return 1; ...
functions
int bgp_write (struct thread *thread) { struct peer *peer; u_char type; struct stream *s; int num; unsigned int count = 0; /* Yes first of all get peer pointer. */ peer = THREAD_ARG (thread); peer->t_write = NULL; /* For non-blocking IO check. */ if (peer->status == Connect) { bgp_conne...
functions
int bgp_write_notify (struct peer *peer) { int ret, val; u_char type; struct stream *s; /* There should be at least one packet. */ s = stream_fifo_head (peer->obuf); if (!s) return 0; assert (stream_get_endp (s) >= BGP_HEADER_SIZE); /* Stop collecting data within the socket */ sockopt_cork (pee...
functions
void bgp_keepalive_send (struct peer *peer) { struct stream *s; int length; s = stream_new (BGP_MAX_PACKET_SIZE); /* Make keepalive packet. */ bgp_packet_set_marker (s, BGP_MSG_KEEPALIVE); /* Set packet size. */ length = bgp_packet_set_size (s); /* Dump packet if debug option is set. */ /* bgp_pac...
functions
void bgp_open_send (struct peer *peer) { struct stream *s; int length; u_int16_t send_holdtime; as_t local_as; if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)) send_holdtime = peer->holdtime; else send_holdtime = peer->bgp->default_holdtime; /* local-as Change */ if (peer->change_local_as) ...
functions
void bgp_notify_send_with_data (struct peer *peer, u_char code, u_char sub_code, u_char *data, size_t datalen) { struct stream *s; int length; /* Allocate new stream. */ s = stream_new (BGP_MAX_PACKET_SIZE); /* Make nitify packet. */ bgp_packet_set_marker (s, BGP_MSG_NOTIFY); /* Set notify packet...
functions
else if (sub_code == BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN) { peer->last_reset = PEER_DOWN_USER_SHUTDOWN; zlog_info ("Notification sent to neighbor %s: shutdown", peer->host); }
functions
void bgp_notify_send (struct peer *peer, u_char code, u_char sub_code) { bgp_notify_send_with_data (peer, code, sub_code, NULL, 0); }
functions
void bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, u_char orf_type, u_char when_to_refresh, int remove) { struct stream *s; struct stream *packet; int length; struct bgp_filter *filter; int orf_refresh = 0; if (DISABLE_BGP_ANNOUNCE) return; filter = &peer->filter[afi][safi]; ...
functions
void bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi, int capability_code, int action) { struct stream *s; struct stream *packet; int length; /* Adjust safi code. */ if (safi == SAFI_MPLS_VPN) safi = SAFI_MPLS_LABELED_VPN; s = stream_new (BGP_MAX_PACKET_SIZE); /* Make BGP upda...
functions
int bgp_collision_detect (struct peer *new, struct in_addr remote_id) { struct peer *peer; struct listnode *node, *nnode; struct bgp *bgp; bgp = bgp_get_default (); if (! bgp) return 0; /* Upon receipt of an OPEN message, the local system must examine all of its connections that are in the Open...
functions
int bgp_open_receive (struct peer *peer, bgp_size_t size) { int ret; u_char version; u_char optlen; u_int16_t holdtime; u_int16_t send_holdtime; as_t remote_as; as_t as4 = 0; struct peer *realpeer; struct in_addr remote_id; int mp_capability; u_int8_t notify_data_remote_as[2]; u_int8_t notify_da...
functions
else if (ret == 0 && realpeer->status != Active && realpeer->status != OpenSent && realpeer->status != OpenConfirm && realpeer->status != Connect) { /* XXX: This is an awful problem.. * * According to the RFC we should just let this connection (of the * accepted 'peer') continue on...
functions
int bgp_update_receive (struct peer *peer, bgp_size_t size) { int ret; u_char *end; struct stream *s; struct attr attr; struct attr_extra extra; bgp_size_t attribute_len; bgp_size_t update_len; bgp_size_t withdraw_len; struct bgp_nlri update; struct bgp_nlri withdraw; struct bgp_nlri mp_update; ...
functions
void bgp_notify_receive (struct peer *peer, bgp_size_t size) { struct bgp_notify bgp_notify; if (peer->notify.data) { XFREE (MTYPE_TMP, peer->notify.data); peer->notify.data = NULL; peer->notify.length = 0; }
functions
void bgp_keepalive_receive (struct peer *peer, bgp_size_t size) { if (BGP_DEBUG (keepalive, KEEPALIVE)) zlog_debug ("%s KEEPALIVE rcvd", peer->host); BGP_EVENT_ADD (peer, Receive_KEEPALIVE_message); }
functions
void bgp_route_refresh_receive (struct peer *peer, bgp_size_t size) { afi_t afi; safi_t safi; struct stream *s; /* If peer does not have the capability, send notification. */ if (! CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_ADV)) { plog_err (peer->log, "%s [Error] BGP route refresh is not enabled", ...
functions
int bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length) { u_char *end; struct capability_mp_data mpc; struct capability_header *hdr; u_char action; afi_t afi; safi_t safi; end = pnt + length; while (pnt < end) { /* We need at least action, capability code and c...
functions
int bgp_capability_receive (struct peer *peer, bgp_size_t size) { u_char *pnt; /* Fetch pointer. */ pnt = stream_pnt (peer->ibuf); if (BGP_DEBUG (normal, NORMAL)) zlog_debug ("%s rcv CAPABILITY", peer->host); /* If peer does not have the capability, send notification. */ if (! CHECK_FLAG (peer->cap, ...
functions
int bgp_read_packet (struct peer *peer) { int nbytes; int readsize; readsize = peer->packet_size - stream_get_endp (peer->ibuf); /* If size is zero then return. */ if (! readsize) return 0; /* Read packet from fd. */ nbytes = stream_read_try (peer->ibuf, peer->fd, readsize); /* If read byte is s...
functions
int bgp_marker_all_one (struct stream *s, int length) { int i; for (i = 0; i < length; i++) if (s->data[i] != 0xff) return 0; return 1; }
functions
time_t bgp_recent_clock (void) { return recent_relative_time().tv_sec; }
functions
int bgp_read (struct thread *thread) { int ret; u_char type = 0; struct peer *peer; bgp_size_t size; char notify_data_length[2]; /* Yes first of all get peer pointer. */ peer = THREAD_ARG (thread); peer->t_read = NULL; /* For non-blocking IO check. */ if (peer->status == Connect) { bgp_c...
includes
#include <stdio.h>
includes
#include <windows.h>
includes
#include <termios.h>
defines
#define BRDV_O_FLAGS BDRV_O_CACHE_WB
defines
#define IO_BUF_SIZE 65536
defines
#define SNAPSHOT_LIST 1
defines
#define SNAPSHOT_CREATE 2
defines
#define SNAPSHOT_APPLY 3
defines
#define SNAPSHOT_DELETE 4
functions
QEMU_NORETURN error(const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "qemu-img: "); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); exit(1); va_end(ap); }
functions
void format_print(void *opaque, const char *name) { printf(" %s", name); }
functions
void help(void) { printf("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 Fabrice Bellard\n" "usage: qemu-img command [command options]\n" "QEMU disk image utility\n" "\n" "Command syntax:\n" " check [-f fmt] filename\n" " create [-e] [-...
functions
int read_password(char *buf, int buf_size) { int c, i; printf("Password: "); fflush(stdout); i = 0; for(;;) { c = getchar(); if (c == '\n') break; if (i < (buf_size - 1)) buf[i++] = c; }
functions
void term_exit(void) { tcsetattr (0, TCSANOW, &oldtty); }
functions
void term_init(void) { struct termios tty; tcgetattr (0, &tty); oldtty = tty; tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); tty.c_oflag |= OPOST; tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); tty.c_cflag &= ~(CSIZE|PARENB); tty.c_cflag ...
functions
int read_password(char *buf, int buf_size) { uint8_t ch; int i, ret; printf("password: "); fflush(stdout); term_init(); i = 0; for(;;) { ret = read(0, &ch, 1); if (ret == -1) { if (errno == EAGAIN || errno == EINTR) { continue; }
functions
else if (ret == 0) { ret = -1; break; }
functions
void add_old_style_options(const char *fmt, QEMUOptionParameter *list, int flags, const char *base_filename, const char *base_fmt) { if (flags & BLOCK_FLAG_ENCRYPT) { if (set_option_parameter(list, BLOCK_OPT_ENCRYPT, "on")) { error("Encryption not supported for file format '%s'", fmt); ...
functions
int img_create(int argc, char **argv) { int c, ret, flags; const char *fmt = "raw"; const char *base_fmt = NULL; const char *filename; const char *base_filename = NULL; BlockDriver *drv; QEMUOptionParameter *param = NULL; char *options = NULL; flags = 0; for(;;) { c = ge...
functions
else if (ret == -EFBIG) { error("The image size is too large for file format '%s'", fmt); }
functions
int img_check(int argc, char **argv) { int c, ret; const char *filename, *fmt; BlockDriver *drv; BlockDriverState *bs; fmt = NULL; for(;;) { c = getopt(argc, argv, "f:h"); if (c == -1) break; switch(c) { case 'h': help(); break...
functions
int img_commit(int argc, char **argv) { int c, ret; const char *filename, *fmt; BlockDriver *drv; BlockDriverState *bs; fmt = NULL; for(;;) { c = getopt(argc, argv, "f:h"); if (c == -1) break; switch(c) { case 'h': help(); brea...
functions
int is_not_zero(const uint8_t *sector, int len) { int i; len >>= 2; for(i = 0;i < len; i++) { if (((uint32_t *)sector)[i] != 0) return 1; }
functions
int is_allocated_sectors(const uint8_t *buf, int n, int *pnum) { int v, i; if (n <= 0) { *pnum = 0; return 0; }
functions
int img_convert(int argc, char **argv) { int c, ret, n, n1, bs_n, bs_i, flags, cluster_size, cluster_sectors; const char *fmt, *out_fmt, *out_baseimg, *out_filename; BlockDriver *drv; BlockDriverState **bs, *out_bs; int64_t total_sectors, nb_sectors, sector_num, bs_offset; uint64_t bs_sectors; ...
functions
else if (ret == -EFBIG) { error("The image size is too large for file format '%s'", out_fmt); }
functions
far for(;;) { nb_sectors = total_sectors - sector_num; if (nb_sectors <= 0) break; if (nb_sectors >= (IO_BUF_SIZE / 512)) n = (IO_BUF_SIZE / 512); else n = nb_sectors; while (sector_num - bs_offset >= bs...
functions
int64_t get_allocated_file_size(const char *filename) { typedef DWORD (WINAPI * get_compressed_t)(const char *filename, DWORD *high); get_compressed_t get_compressed; struct _stati64 st; /* WinNT support GetCompressedFileSize to determine allocate size */ get_compressed = (get_compressed_t) GetProc...
functions
int64_t get_allocated_file_size(const char *filename) { struct stat st; if (stat(filename, &st) < 0) return -1; return (int64_t)st.st_blocks * 512; }
functions
void dump_snapshots(BlockDriverState *bs) { QEMUSnapshotInfo *sn_tab, *sn; int nb_sns, i; char buf[256]; nb_sns = bdrv_snapshot_list(bs, &sn_tab); if (nb_sns <= 0) return; printf("Snapshot list:\n"); printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL)); for(i = 0; i < nb_s...
functions
int img_info(int argc, char **argv) { int c; const char *filename, *fmt; BlockDriver *drv; BlockDriverState *bs; char fmt_name[128], size_buf[128], dsize_buf[128]; uint64_t total_sectors; int64_t allocated_size; char backing_filename[1024]; char backing_filename2[1024]; BlockDriv...
functions
void img_snapshot(int argc, char **argv) { BlockDriverState *bs; QEMUSnapshotInfo sn; char *filename, *snapshot_name = NULL; int c, ret; int action = 0; qemu_timeval tv; /* Parse commandline parameters */ for(;;) { c = getopt(argc, argv, "la:c:d:h"); if (c == -1) ...
main
int main(int argc, char **argv) { const char *cmd; bdrv_init(); if (argc < 2) help(); cmd = argv[1]; argc--; argv++; if (!strcmp(cmd, "create")) { img_create(argc, argv); }
includes
#include <string.h>
structs
struct avr_unwind_cache { /* The previous frame's inner most stack address. Used as this frame ID's stack_addr. */ CORE_ADDR prev_sp; /* The frame's base, optionally used by the high-level debug info. */ CORE_ADDR base; int size; int prologue_type; /* Table indicating the location of each and ever...
structs
struct gdbarch_tdep { /* Number of bytes stored to the stack by call instructions. 2 bytes for avr1-5, 3 bytes for avr6. */ int call_length; /* Type for void. */ struct type *void_type; /* Type for a function returning void. */ struct type *func_void_type; /* Type for a pointer to a function. Us...
structs
struct stack_item { int len; struct stack_item *prev; void *data; };
functions
CORE_ADDR avr_make_iaddr (CORE_ADDR x) { return ((x) | AVR_IMEM_START); }
functions
CORE_ADDR avr_convert_iaddr_to_raw (CORE_ADDR x) { return ((x) & 0xffffffff); }
functions
CORE_ADDR avr_make_saddr (CORE_ADDR x) { /* Return 0 for NULL. */ if (x == 0) return 0; return ((x) | AVR_SMEM_START); }
functions
CORE_ADDR avr_convert_saddr_to_raw (CORE_ADDR x) { return ((x) & 0xffffffff); }
functions
void avr_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); /* Is it a code address? */ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_...
functions
CORE_ADDR avr_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); /* Is it a code address? */ if (TYPE_CODE (TYPE_TARGET_TYPE (t...
functions
CORE_ADDR avr_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf) { ULONGEST addr = unpack_long (type, buf); return avr_make_saddr (addr); }
functions
CORE_ADDR avr_read_pc (struct regcache *regcache) { ULONGEST pc; regcache_cooked_read_unsigned (regcache, AVR_PC_REGNUM, &pc); return avr_make_iaddr (pc); }
functions
void avr_write_pc (struct regcache *regcache, CORE_ADDR val) { regcache_cooked_write_unsigned (regcache, AVR_PC_REGNUM, avr_convert_iaddr_to_raw (val)); }
functions
register_status avr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buf) { ULONGEST val; enum register_status status; switch (regnum) { case AVR_PSEUDO_PC_REGNUM: status = regcache_raw_read_unsigned (regcache, AVR_PC_REGNUM, ...
functions
void avr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buf) { ULONGEST val; switch (regnum) { case AVR_PSEUDO_PC_REGNUM: val = extract_unsigned_integer (buf, 4, gdbarch_byte_order (gdbarch)); val <<= 1; re...
functions
CORE_ADDR avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, struct avr_unwind_cache *info) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int i; unsigned short insn; int scan_stage = 0; struct minimal_symbol *msymbol; unsigned char prologue[AVR_MAX_PROLOGUE_S...
functions
CORE_ADDR avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) { CORE_ADDR func_addr, func_end; CORE_ADDR post_prologue_pc; /* See what the symbol table says */ if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end)) return pc; post_prologue_pc = skip_prologue_using_sal (gdbarch, func_add...
functions
return_value_convention avr_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { int i; /* Single byte are returned in r24. Otherwise, the MSB of the return value is always in r25, calculate which ...
functions
CORE_ADDR avr_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { ULONGEST pc; pc = frame_unwind_register_unsigned (next_frame, AVR_PC_REGNUM); return avr_make_iaddr (pc); }
functions
CORE_ADDR avr_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { ULONGEST sp; sp = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM); return avr_make_saddr (sp); }
functions
void avr_frame_this_id (struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id) { struct avr_unwind_cache *info = avr_frame_unwind_cache (this_frame, this_prologue_cache); CORE_ADDR base; CORE_ADDR func; struct frame_id id; /* The FUNC is...
functions
CORE_ADDR avr_frame_base_address (struct frame_info *this_frame, void **this_cache) { struct avr_unwind_cache *info = avr_frame_unwind_cache (this_frame, this_cache); return info->base; }
functions
frame_id avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) { ULONGEST base; base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM); return frame_id_build (avr_make_saddr (base), get_frame_pc (this_frame)); }
functions
CORE_ADDR avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { enum bfd_endian byte_order = gdbarch_by...
functions
int avr_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) { if (reg >= 0 && reg < 32) return reg; if (reg == 32) return AVR_SP_REGNUM; warning (_("Unmapped DWARF Register #%d encountered."), reg); return -1; }
functions
void avr_io_reg_read_command (char *args, int from_tty) { LONGEST bufsiz = 0; gdb_byte *buf; const char *bufstr; char query[400]; const char *p; unsigned int nreg = 0; unsigned int val; int i, j, k, step; /* Find out how many io registers the target has. */ bufsiz = target_read_alloc (&current_tar...
functions
void _initialize_avr_tdep (void) { register_gdbarch_init (bfd_arch_avr, avr_gdbarch_init); /* Add a new command to allow the user to query the avr remote target for the values of the io space registers in a saner way than just using `x/NNNb ADDR`. */ /* FIXME: TRoth/2002-02-18: This should probably b...
includes
#include <avr/io.h>
includes
#include <avr/eeprom.h>
defines
#define uchar unsigned char
functions
void oscInit(void) { uchar calibrationValue; calibrationValue = eeprom_read_byte(0); if(calibrationValue != 0xff) OSCCAL = calibrationValue; else { #if USB_CFG_CLOCK_KHZ==12800 OSCCAL = 232; #else OSCCAL += 4; /* 8.00 -> 8.25MHz */ #endif }
functions
void calibrateOscillator(void) { int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); uchar optimumValue; #if USB_CFG_CLOCK_KHZ==12800 uchar step = 32; uchar trialValue = 192; #else uchar step = 64; uchar trialValue = 0; #endif uchar org; int err; or...
includes
#include <linux/init.h>
includes
#include <linux/export.h>
includes
#include <linux/slab.h>
includes
#include <linux/fs.h>
includes
#include <linux/namei.h>
includes
#include <linux/pagemap.h>
includes
#include <linux/fsnotify.h>
includes
#include <linux/personality.h>