; Valerie Caro COINS Research Computer Facility ; UNIVERSITY OF MASSACHUSETTS/ AMHERST, MA 01003 .title dquotasub - Subroutines for GQM.C ;+++++ ; MODULE DESCRIPTION ; ; This module contains subroutines that support the GROUP ; quota system. This system allows selected group members to ; jockey quotas within their group. ; ;+++++ $iodef $ssdef $rmsdef $fabdef $rabdef $tpadef .sbttl parse tables .psect parse_table,rd,wrt,noexe $INIT_STATE DQ_STATE,DQ_KEY ; top level $STATE TOP $TRAN 'USE',USE_BLK,,1,COMMAND $TRAN 'SHOW',SHOW_BLK,,2,COMMAND $TRAN 'MODIFY',MOD_BLK,,3,COMMAND $TRAN 'EXIT',TPA$_EXIT,,4,COMMAND $TRAN 'HELP',TPA$_EXIT,SAVE_STR,5,COMMAND $TRAN 'ADD',ADD_BLK,,6,COMMAND $TRAN 'REMOVE',SHOW_BLK,,7,COMMAND $TRAN 'LIST',LIST_BLK,,8,COMMAND $TRAN 'SET',SET_BLK,,9,COMMAND $TRAN 'RENAME',RENAM_BLK,,10,COMMAND $TRAN 'REBUILD',REBUILD_BLK,,11,COMMAND $TRAN 'MAXIMIZE',MAXIMIZE_BLK,,12,COMMAND $TRAN 'DISK',DISK_BLK,,13,COMMAND $TRAN TPA$_LAMBDA,TPA$_FAIL ; USE command $STATE USE_BLK $TRAN TPA$_LAMBDA, TPA$_EXIT,SAVE_STR ; DISK command $STATE DISK_BLK $TRAN 'BRIEF',DISK_BLK,,7,SUBCOMMAND $TRAN 'TOTAL',DISK_BLK,,8,SUBCOMMAND $TRAN TPA$_STRING,TPA$_EXIT,,,STRING $TRAN TPA$_LAMBDA, TPA$_FAIL ; SHOW command (Default is show user. Set subcommand to 3 first) $STATE SHOW_BLK $TRAN 'ACCOUNT',SHOW_NAME,,1,SUBCOMMAND $TRAN 'USER',SHOW_NAME,,3,SUBCOMMAND $TRAN 'UIC',SHOW_UIC,,4,SUBCOMMAND $TRAN 'QUOTAS',TPA$_EXIT,,2,SUBCOMMAND $TRAN 'IDENTIFIER',SHOW_NAME,,6,SUBCOMMAND $TRAN 'NULLS',NULL_BLK $TRAN '[',SHOW_GRP_UIC,,4,SUBCOMMAND $TRAN TPA$_SYMBOL,TPA$_EXIT,,,STRING ;default is show user $TRAN TPA$_LAMBDA, TPA$_FAIL ; Get name for SHOW ACCOUNT or SHOW USER $STATE SHOW_NAME $TRAN TPA$_SYMBOL,TPA$_EXIT,,,STRING $TRAN TPA$_LAMBDA, TPA$_FAIL ; Get uic for SHOW UIC $STATE SHOW_UIC $TRAN '[',SHOW_GRP_UIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE SHOW_GRP_UIC $TRAN TPA$_OCTAL,SHOW_COMMA,,,GRPUIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE SHOW_COMMA $TRAN COMMA,SHOW_MEM_UIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE SHOW_MEM_UIC $TRAN '*',SHOW_BRACKET,,-1,MEMUIC $TRAN TPA$_OCTAL,SHOW_BRACKET,,,MEMUIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE SHOW_BRACKET $TRAN ']',TPA$_EXIT $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE NULL_BLK $TRAN 'ACCOUNTS',TPA$_EXIT,,7,SUBCOMMAND $TRAN 'USERS',TPA$_EXIT,,8,SUBCOMMAND $TRAN TPA$_LAMBDA,TPA$_FAIL ; MOD command $STATE MOD_BLK $TRAN 'USER',MOD_NAME,,3,SUBCOMMAND $TRAN 'ACCOUNT',MOD_NAME,,1,SUBCOMMAND $TRAN 'UIC',MOD_UIC,,4,SUBCOMMAND $TRAN 'IDENTIFIER',MOD_NAME,,6,SUBCOMMAND $TRAN '[',MOD_GRP_UIC,,4,SUBCOMMAND $TRAN TPA$_SYMBOL,MOD_QUOTA,,,STRING ;default is mod user $TRAN TPA$_LAMBDA, TPA$_FAIL ; Get NAME for MOD USER or MOD ACCOUNT $STATE MOD_NAME $TRAN TPA$_SYMBOL,MOD_QUOTA,,,STRING $TRAN TPA$_LAMBDA, TPA$_FAIL ; Get UIC for MOD UIC $STATE MOD_UIC $TRAN '[',MOD_GRP_UIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE MOD_GRP_UIC $TRAN TPA$_OCTAL,MOD_COMMA,,,GRPUIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE MOD_COMMA $TRAN COMMA,MOD_MEM_UIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE MOD_MEM_UIC $TRAN '*',MOD_BRACKET,,-1,MEMUIC $TRAN TPA$_OCTAL,MOD_BRACKET,,,MEMUIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE MOD_BRACKET $TRAN ']',MOD_QUOTA $TRAN TPA$_LAMBDA,TPA$_FAIL ; Get quota value for MOD USER or MOD ACCOUNT $STATE MOD_QUOTA $TRAN '+',GET_NUMBER,,1,RELATIVE $TRAN '-',GET_NUMBER,,-1,RELATIVE $TRAN TPA$_LAMBDA,GET_NUMBER,,0,RELATIVE $STATE GET_NUMBER $TRAN TPA$_DECIMAL,TPA$_EXIT,,,QUOTA $TRAN TPA$_LAMBDA, TPA$_FAIL ; ADD command $STATE ADD_BLK $TRAN 'ACCOUNT',ADD_ACCOUNT,,1,SUBCOMMAND $TRAN 'USER',MOD_NAME,,3,SUBCOMMAND $TRAN 'UIC',ADD_UIC,,4,SUBCOMMAND $TRAN 'IDENTIFIER',MOD_NAME,,6,SUBCOMMAND $TRAN '[',ADD_GRP_UIC,,4,SUBCOMMAND $TRAN TPA$_SYMBOL,MOD_QUOTA,,,STRING ;default is ADD user $TRAN TPA$_LAMBDA,TPA$_FAIL ; Get group name and uic for ADD group $STATE ADD_ACCOUNT $TRAN TPA$_SYMBOL,MOD_QUOTA,,,STRING $TRAN TPA$_LAMBDA,TPA$_FAIL ; Get uic $STATE ADD_UIC $TRAN '[',ADD_GRP_UIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE ADD_GRP_UIC $TRAN TPA$_OCTAL,ADD_COMMA,,,GRPUIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE ADD_COMMA $TRAN COMMA,ADD_MEM_UIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE ADD_MEM_UIC $TRAN TPA$_OCTAL,ADD_BRACKET,,,MEMUIC $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE ADD_BRACKET $TRAN ']',MOD_QUOTA $TRAN TPA$_LAMBDA,TPA$_FAIL ; LIST command $STATE LIST_BLK $TRAN 'ACCOUNTS',TPA$_EXIT,,1,SUBCOMMAND $TRAN 'USERS',TPA$_EXIT,,3,SUBCOMMAND $TRAN 'VAGRANTS',TPA$_EXIT,,5,SUBCOMMAND $TRAN 'IDENTIFIERS',TPA$_EXIT,,6,SUBCOMMAND $TRAN TPA$_LAMBDA, TPA$_FAIL ; SET OUTPUT $STATE SET_BLK $TRAN 'OUTPUT',TPA$_EXIT,SAVE_STR,2,SUBCOMMAND $TRAN 'NOOUTPUT',TPA$_EXIT,,1,SUBCOMMAND $TRAN TPA$_LAMBDA,TPA$_FAIL ; RENAME ACCOUNT $STATE RENAM_BLK $TRAN 'ACCOUNT',TPA$_EXIT,SAVE_STR $TRAN TPA$_LAMBDA, TPA$_EXIT,SAVE_STR ; REBUILD ACCOUNT $STATE REBUILD_BLK $TRAN 'ACCOUNT',TPA$_EXIT,SAVE_STR,1,SUBCOMMAND $TRAN TPA$_SYMBOL,TPA$_EXIT,,,STRING $TRAN TPA$_LAMBDA,TPA$_EXIT,,2,SUBCOMMAND ; MAXIMIZE $STATE MAXIMIZE_BLK $TRAN 'ACCOUNTS',MAXIMIZE_ACC $TRAN 'USERS',TPA$_EXIT,,3,SUBCOMMAND $TRAN TPA$_SYMBOL,TPA$_EXIT,,,STRING $TRAN TPA$_LAMBDA,TPA$_FAIL $STATE MAXIMIZE_ACC $TRAN TPA$_SYMBOL,TPA$_EXIT,,,STRING $TRAN TPA$_LAMBDA,TPA$_EXIT,,2,SUBCOMMAND $END_STATE .sbttl Parse Action Routines ;+++++ ; FUNCTION ; ; This routine is called by TPARSE when a transition is taken ; for either the HELP command or the SET OUTPUT command. ; The result of this routine is to setup the remainder of the ; input string as STRING. ; ;+++ ; INPUT PARAMETERS ; ; tparse parameter block ; ;+++ ; OUTPUT PARAMETERS ; ; STRING is set to rest of input string ; ;+++++ .entry SAVE_STR,^M movl tpa$l_stringcnt(ap),r10 ;setup length movl tpa$l_stringptr(ap),r11 ;setup addr skpc #32,r10,(r11) ;skip leading spaces beql 10$ ;skip if only spaces movl r0,r10 ;set new length movl r1,r11 ;set new addr 10$: movl r10,string ;set global str len movl r11,string+4 ;set global str addr movl #1,r0 ;set ok ret .sbttl parse parameters .psect parse_data,rd,wrt,noexe tpa_block: .long TPA$K_COUNT0 .blkl TPA$K_LENGTH0-4 ; Local values command: .long 0 subcommand: .long 0 grpuic: .long 0 memuic: .long 0 string: .quad 0 relative: .long 0 quota: .long 0 .sbttl parse_command_line ;+++++ ; FUNCTION ; ; This routine takes a command line to GQM and parses it ; for syntax. Semantics of the various commands are checked elsewhere. ; LIB$TPARSE is used to implement the syntax analysis. ; ;+++ ; INPUT PARAMETERS ; ; parse_line the line to be parsed ; ;+++ ; OUTPUT PARAMETERS ; ; parse_line the line to be parsed is converted to upper case ; parse_cmd the command number to execute ; parse_sbcmd the subcommand to execute ; parse_uic uic for SET or SHOW ; parse_string either USERNAME or ACCOUNT name descriptor (SET cmd) ; parse_relative relative flag for quota value ; parse_quota value of quota to set ; parse_status status return value ; ;+++++ parse_line =4 parse_cmd =8 parse_sbcmd =12 parse_uic =16 parse_string =20 parse_relative =24 parse_quota =28 parse_status =32 comma =44 .psect parse_code,rd,nowrt,exe .entry parse_command_line,^M ; Translate input string to upper case in place pushl parse_line(ap) pushl parse_line(ap) calls #2,G^str$upcase ; Setup string in parse block movq @parse_line(ap),tpa$l_stringcnt+tpa_block ; Initialize Return Block clrl command ;clear command number clrl subcommand ;clear subcommand number clrl grpuic ;clear uic clrl memuic clrl relative ;clear relative flag clrl quota ;clear quota value ; Initialize Parameter Block movl #TPA$M_ABBREV,TPA$L_OPTIONS+tpa_block ; Do parse pushab DQ_KEY pushab DQ_STATE pushab TPA_BLOCK calls #3,G^lib$tparse ; Return the values movl r0,@parse_status(ap) ;set status movl command,@parse_cmd(ap) ;command number movl subcommand,@parse_sbcmd(ap) ;subcommand number movl parse_uic(ap),r5 ;get uic address movw memuic,(r5)+ ;set up uic movw grpuic,(r5) movl relative,@parse_relative(ap) ;relative quota flag movl quota,@parse_quota(ap) ;quota value ; Move string movq @parse_string(ap),r6 ;output descriptor movc5 string,@string+4,#32,r6,(r7) ;move it ret .sbttl grp - Extract group portion of uic ;+++++ ; FUNCTION ; ; GRP extracts the group portion of a SYSTEM UIC. ; ;+++ ; INPUT PARAMETERS ; ; grp_uic uic to extract group from ; ;+++ ; OUTPUT PARAMETERS ; ; none. ; ;+++++ grp_uic =4 .entry grp, ^M<> movl @grp_uic(ap),r0 ;setup UIC extzv #16,#16,r0,r0 ;keep high order ret .sbttl mem - Extract Member portion of UIC ;+++++ ; FUNCTION ; ; MEM is a function which extracts the MEMBER portion of a SYSTEM UIC. ; ;+++ ; INPUT PARAMETERS ; ; mem_uic UIC to extract member portion of ; ;+++ ; OUTPUT PARAMETERS ; ; none. ; ;+++++ mem_uic =4 .entry mem,^M<> movzwl @mem_uic(ap),r0 ret .end