int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset, int count, int *eof, void *data ) { struct super_block *sb; struct reiserfs_sb_info *sb_info; struct reiserfs_super_block *rs; int hash_code; int len = 0; sb = procinfo_prologue( ( kdev_t ) ( long ) data ); if( sb == NULL ) return -ENOENT; sb_info = &sb->u.reiserfs_sb; rs = sb_info -> s_rs; hash_code = DFL( s_hash_function_code ); len += sprintf( &buffer[ len ], "block_count: \t%i\n" "free_blocks: \t%i\n" "root_block: \t%i\n" "blocksize: \t%i\n" "oid_maxsize: \t%i\n" "oid_cursize: \t%i\n" "umount_state: \t%i\n" "magic: \t%10.10s\n" "fs_state: \t%i\n" "hash: \t%s\n" "tree_height: \t%i\n" "bmap_nr: \t%i\n" "version: \t%i\n" "reserved_for_journal: \t%i\n" "inode_generation: \t%i\n" "flags: \t%x[%s]\n", DFL( s_block_count ), DFL( s_free_blocks ), DFL( s_root_block ), DF( s_blocksize ), DF( s_oid_maxsize ), DF( s_oid_cursize ), DF( s_umount_state ), rs -> s_v1.s_magic, DF( s_fs_state ), hash_code == TEA_HASH ? "tea" : ( hash_code == YURA_HASH ) ? "rupasov" : ( hash_code == R5_HASH ) ? "r5" : ( hash_code == UNSET_HASH ) ? "unset" : "unknown", DF( s_tree_height ), DF( s_bmap_nr ), DF( s_version ), DF( s_reserved_for_journal ), DPL( s_inode_generation ), DPL( s_flags ), (DPL( s_flags ) & reiserfs_attrs_cleared ? "attrs_cleared" : "" )); procinfo_epilogue( sb ); return reiserfs_proc_tail( len, buffer, start, offset, count, eof ); }
int reiserfs_on_disk_super_in_proc( char *buffer, char **start, off_t offset, int count, int *eof, void *data ) { struct super_block *sb; struct reiserfs_sb_info *sb_info; struct reiserfs_super_block *rs; int hash_code; int len = 0; sb = procinfo_prologue( ( kdev_t ) ( int ) data ); if( sb == NULL ) return -ENOENT; sb_info = &sb->u.reiserfs_sb; rs = sb_info -> s_rs; hash_code = DFL( s_hash_function_code ); len += sprintf( &buffer[ len ], "block_count: \t%i\n" "free_blocks: \t%i\n" "root_block: \t%i\n" "blocksize: \t%i\n" "oid_maxsize: \t%i\n" "oid_cursize: \t%i\n" "state: \t%i\n" "magic: \t%12.12s\n" "hash: \t%s\n" "tree_height: \t%i\n" "bmap_nr: \t%i\n" "version: \t%i\n", DFL( s_block_count ), DFL( s_free_blocks ), DFL( s_root_block ), DF( s_blocksize ), DF( s_oid_maxsize ), DF( s_oid_cursize ), DF( s_state ), rs -> s_magic, hash_code == TEA_HASH ? "tea" : ( hash_code == YURA_HASH ) ? "rupasov" : ( hash_code == R5_HASH ) ? "r5" : ( hash_code == UNSET_HASH ) ? "unset" : "unknown", DF( s_tree_height ), DF( s_bmap_nr ), DF( s_version ) ); procinfo_epilogue( sb ); return reiserfs_proc_tail( len, buffer, start, offset, count, eof ); }
static int show_on_disk_super(struct seq_file *m, void *unused) { struct super_block *sb = m->private; struct reiserfs_sb_info *sb_info = REISERFS_SB(sb); struct reiserfs_super_block *rs = sb_info->s_rs; int hash_code = DFL(s_hash_function_code); __u32 flags = DJF(s_flags); seq_printf(m, "block_count: \t%i\n" "free_blocks: \t%i\n" "root_block: \t%i\n" "blocksize: \t%i\n" "oid_maxsize: \t%i\n" "oid_cursize: \t%i\n" "umount_state: \t%i\n" "magic: \t%10.10s\n" "fs_state: \t%i\n" "hash: \t%s\n" "tree_height: \t%i\n" "bmap_nr: \t%i\n" "version: \t%i\n" "flags: \t%x[%s]\n" "reserved_for_journal: \t%i\n", DFL(s_block_count), DFL(s_free_blocks), DFL(s_root_block), DF(s_blocksize), DF(s_oid_maxsize), DF(s_oid_cursize), DF(s_umount_state), rs->s_v1.s_magic, DF(s_fs_state), hash_code == TEA_HASH ? "tea" : (hash_code == YURA_HASH) ? "rupasov" : (hash_code == R5_HASH) ? "r5" : (hash_code == UNSET_HASH) ? "unset" : "unknown", DF(s_tree_height), DF(s_bmap_nr), DF(s_version), flags, (flags & reiserfs_attrs_cleared) ? "attrs_cleared" : "", DF(s_reserved_for_journal)); return 0; }
static int moveview( /* move our view */ int dx, int dy, int mov, int orb ) { VIEW nv; FVECT odir, v1; double d; int li; /* start with old view */ nv = odev.v; /* change view direction */ if (mov | orb) { if ((li = qtFindLeaf(dx, dy)) < 0) return(0); /* not on window */ VSUM(odir, qtL.wp[li], nv.vp, -1.); } else { if (viewray(nv.vp, nv.vdir, &odev.v, (dx+.5)/odev.hres, (dy+.5)/odev.vres) < -FTINY) return(0); /* outside view */ } if (orb && mov) { /* orbit left/right */ spinvector(odir, odir, nv.vup, d=MOVDEG*PI/180.*mov); VSUM(nv.vp, qtL.wp[li], odir, -1.); spinvector(nv.vdir, nv.vdir, nv.vup, d); } else if (orb) { /* orbit up/down */ if (geodesic(odir, odir, nv.vup, d=MOVDEG*PI/180.*orb, GEOD_RAD) == 0.0) return(0); VSUM(nv.vp, qtL.wp[li], odir, -1.); geodesic(nv.vdir, nv.vdir, nv.vup, d, GEOD_RAD); } else if (mov) { /* move forward/backward */ d = MOVPCT/100. * mov; VSUM(nv.vp, nv.vp, odir, d); } if (!mov ^ !orb && headlocked) { /* restore head height */ VSUM(v1, odev.v.vp, nv.vp, -1.); d = DOT(v1, odev.v.vup); VSUM(nv.vp, nv.vp, odev.v.vup, d); } if (setview(&nv) != NULL) return(0); /* illegal view */ dev_view(&nv); inpresflags |= DFL(DC_SETVIEW); return(1); }
static void resizewindow( /* resize window */ XConfigureEvent *ersz ) { glViewport(0, 0, ersz->width, ersz->height); if (ersz->width == odev.hres && ersz->height == odev.vres) return; odev.hres = ersz->width; odev.vres = ersz->height; odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres); odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres); inpresflags |= DFL(DC_SETVIEW); }
static void getmove( /* get view change */ XButtonPressedEvent *ebut ) { int movdir = MOVDIR(ebut->button); int movorb = MOVORB(ebut->state); int oldnodesiz = qtMinNodesiz; Window rootw, childw; int rootx, rooty, wx, wy; unsigned int statemask; qtMinNodesiz = 24; /* accelerate update rate */ XNoOp(ourdisplay); while (!XCheckMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent))) { if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw, &rootx, &rooty, &wx, &wy, &statemask)) break; /* on another screen */ if (!moveview(wx, odev.vres-1-wy, movdir, movorb)) { sleep(1); continue; } glClear(GL_COLOR_BUFFER_BIT); qtUpdate(); draw_grids(); glFlush(); } if (!(inpresflags & DFL(DC_SETVIEW))) { /* do final motion */ movdir = MOVDIR(levptr(XButtonReleasedEvent)->button); wx = levptr(XButtonReleasedEvent)->x; wy = levptr(XButtonReleasedEvent)->y; moveview(wx, odev.vres-1-wy, movdir, movorb); } dev_flush(); qtMinNodesiz = oldnodesiz; /* restore quadtree resolution */ }
static void getkey( /* get input key */ XKeyPressedEvent *ekey ) { int n; char buf[8]; n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL); if (n != 1) return; switch (buf[0]) { case 'h': /* turn on height motion lock */ headlocked = 1; return; case 'H': /* turn off height motion lock */ headlocked = 0; return; case 'l': /* retrieve last view */ inpresflags |= DFL(DC_LASTVIEW); return; case 'p': /* pause computation */ inpresflags |= DFL(DC_PAUSE); return; case 'v': /* spit out view */ inpresflags |= DFL(DC_GETVIEW); return; case '\n': case '\r': /* resume computation */ inpresflags |= DFL(DC_RESUME); return; case CTRL('R'): /* redraw screen */ if (nxtzmax > FTINY) { curzmax = nxtzmax; nxtzmax = 0.; } glClear(GL_DEPTH_BUFFER_BIT); qtRedraw(0, 0, odev.hres, odev.vres); return; case CTRL('L'): /* refresh from server */ if (inpresflags & DFL(DC_REDRAW)) return; if (nxtzmax > FTINY) { curzmax = nxtzmax; nxtzmax = 0.; } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); draw_grids(); glFlush(); qtCompost(100); /* get rid of old values */ inpresflags |= DFL(DC_REDRAW); /* resend values from server */ rayqleft = 0; /* hold off update */ return; case 'K': /* kill rtrace process(es) */ inpresflags |= DFL(DC_KILL); break; case 'R': /* restart rtrace */ inpresflags |= DFL(DC_RESTART); break; case 'C': /* clobber holodeck */ inpresflags |= DFL(DC_CLOBBER); break; case 'q': /* quit the program */ inpresflags |= DFL(DC_QUIT); return; default: XBell(ourdisplay, 0); return; } }
int main( int argc, char *argv[] ) { int rdy, inp, res = 0, pause = 0; progname = argv[0]; if (argc < 3) error(USER, "bad command line arguments"); /* open our device */ dev_open(argv[1]); /* open server process i/o */ sstdout = fdopen(atoi(argv[2]), "w"); if (argc < 4 || (inp = atoi(argv[3])) < 0) sstdin = NULL; else sstdin = fdopen(inp, "r"); /* set command error vector */ erract[COMMAND].pf = eputs; #ifdef DEBUG tmodesw = time(NULL); #endif /* enter main loop */ do { rdy = disp_wait(); if (rdy & RDY_SRV) { /* process server result */ res = serv_result(); if (pause && res != DS_SHUTDOWN) { serv_request(DR_ATTEN, 0, NULL); while ((res = serv_result()) != DS_ACKNOW && res != DS_SHUTDOWN) ; } } if (rdy & RDY_DEV) { /* user input from driver */ inp = dev_input(); if (inp & DFL(DC_SETVIEW)) new_view(&odev.v); else if (inp & DFL(DC_LASTVIEW)) new_view(NULL); if (inp & DFL(DC_REDRAW)) imm_mode = beam_sync(1) > 0; if (inp & DFL(DC_GETVIEW)) printview(); if (inp & DFL(DC_FOCUS)) set_focus(odev_args); if (inp & DFL(DC_KILL)) { serv_request(DR_KILL, 0, NULL); pause = 0; } if (inp & DFL(DC_CLOBBER)) serv_request(DR_CLOBBER, 0, NULL); if (inp & DFL(DC_RESTART)) { serv_request(DR_RESTART, 0, NULL); pause = 0; } if (inp & DFL(DC_RESUME)) { serv_request(DR_NOOP, 0, NULL); pause = 0; } if (inp & DFL(DC_PAUSE)) pause = 1; if (inp & DFL(DC_QUIT)) serv_request(DR_SHUTDOWN, 0, NULL); } if (rdy & RDY_SIN && !imm_mode) /* user input from sstdin */ switch (usr_input()) { case DC_PAUSE: pause = 1; break; case DC_RESUME: serv_request(DR_NOOP, 0, NULL); /* fall through */ case DC_KILL: case DC_RESTART: pause = 0; break; } } while (res != DS_SHUTDOWN); #ifdef DEBUG if (timm && nimmrays) fprintf(stderr, "%s: %.1f rays recalled/second (%ld rays total)\n", progname, (double)nimmrays/timm, nimmrays); if (tadd && naddrays) fprintf(stderr, "%s: %.1f rays calculated/second (%ld rays total)\n", progname, (double)naddrays/tadd, naddrays); #endif /* all done */ quit(0); return 0; /* pro forma return */ }