diff options
author | Hans Insulander <hin@cvs.openbsd.org> | 2002-06-07 04:14:39 +0000 |
---|---|---|
committer | Hans Insulander <hin@cvs.openbsd.org> | 2002-06-07 04:14:39 +0000 |
commit | 43680c6a634e0ffbd23ca82945660bb074a2e884 (patch) | |
tree | b06168186c6f722a97598afcbb2c0eba5f6fafd3 /usr.sbin | |
parent | f52745dfdea1f021c672870c78b14638502b9111 (diff) |
Import of arla-0.35.7
Diffstat (limited to 'usr.sbin')
68 files changed, 11201 insertions, 0 deletions
diff --git a/usr.sbin/afs/src/ChangeLog.2000 b/usr.sbin/afs/src/ChangeLog.2000 new file mode 100644 index 00000000000..cad3bcb1dde --- /dev/null +++ b/usr.sbin/afs/src/ChangeLog.2000 @@ -0,0 +1,2968 @@ +2000-12-31 Assar Westerlund <assar@sics.se> + + * configure.in: do not include <sys/vnode_if.h>, it gets included + by <vnode.h> and may not reside in <sys/> + +2000-12-30 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/linux/xfs_inodeops.c: Rewrote xfs_lookup to make use of the + 2.2.8 interface. Now xfs_lookup returns the dentry, which suits us + much better. + + * xfs/bsd/xfs_syscalls-common.c: Don't allow fhget/fhopen when + compiling for Darwin. fhget/fhopen leaks vnodes when used on + Darwin. + +2000-12-23 Love <lha@stacken.kth.se> + + * conf/CellServDB (zepa.net): added first cell w/o hosts + +2000-12-21 Love <lha@stacken.kth.se> + + * configure.in: check for res_init() + * lib/ko/kocell.c (cell_init): call res_init() to initialize the + resolver. + + * lib/ko/Makefile.in: change the way $(LIBS) is used + * include/Makefile.in: added @LIBS@ to program built locally + +2000-12-21 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_putpages): make it build on + NetBSD-current + * configure.in: test for putpages.sync to differentiate between + NetBSD and FreeBSD putpages + +2000-12-18 Assar Westerlund <assar@sics.se> + + * appl/vos/*.c: do not call inet_ntop when getnameinfo fails, just + set a constant string + + * tests/mmap-and-read.c (main): remove extra print to make it + consitent with all the other tests + +2000-12-15 Assar Westerlund <assar@sics.se> + + * appl/vos/vos_examine.c (printvolstat): only set `sin_len' if + there's such a field + * appl/vos/vos_syncsite.c (vos_syncsite): only set `sin_len' if + there's such a field + * appl/vos/vos_vldbexamine.c (printvolstat): only set `sin_len' if + there's such a field + +2000-12-12 Love <lha@stacken.kth.se> + + * appl/vos/*.c: fix getaddrinfo calls, print numeric address in + case we fail + +2000-12-11 Love <lha@stacken.kth.se> + + * xfs/linux/xfs/xfs_locl.h: added list_for_each + * doc/*: improvements + +2000-12-07 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs/xfs_locl.h: use nline instead of __inline for + consistency + +2000-12-04 Love <lha@stacken.kth.se> + + * arlad/arla-cli.c (print_dir_long): check it we followed a + mountpoint to ourself, in that case, bail out. + +2000-12-01 Love <lha@stacken.kth.se> + + * doc/*: improve text, add text, improve indices, spellcheck + +2000-11-29 Love <lha@stacken.kth.se> + + * arlad/inter.c (potential_update_dir): change to it take a child + entry and a parent to make sure we don't deadlock when trying to + lock the parent. + (cm_rename): when moving the child entry between directories, make + sure we update the child's parent. Pass down the child and the new + parent to potential_update_dir + +2000-11-28 Love <lha@stacken.kth.se> + + * arlad/arla-cli.c: rename the consistency checking function + * arlad/arla.c: rename the consistency checking function + * arlad/arla_local.h: rename the consistency checking function + * arlad/arlad.c: rename the consistency checking function + * arlad/cmcb.c: rename the consistency checking function + * arlad/fcache.c (*): rename the consistency checking function + (get_root_of_volume): if we are found ourself when following a + mountpoint, just return + * arlad/inter.c (*): rename the consistency checking function + (cm_symlink): check if the symlink points to ourself, then don' chase + it it since then we'll deadlock + * arlad/inter.h: rename the consistency checking function + +2000-11-27 Love <lha@stacken.kth.se> + + * appl/pts/pts.c (dump_cmd,dump_1): remove the need to give a host + +2000-11-26 Love <lha@stacken.kth.se> + + * arlad/fcache.c (fs_downp): replace with host_downp() + (*): replace a occurrences of fs_downp with host_downp(); instead of + checking the return value is RX_CALL_DEAD, use host_downp() to see + it the error is from a `dead' fileserver; also, replace all + RX_CALL_DEAD with ARLA_CALL_DEAD. + + * arlad/fs_errors.h: translate Rx errors to ARLA_ equivalent + + * arlad/conn.h (host_downp): new + * arlad/conn.c (host_downp): return True is the error means that + the host is down + + * rx/rx.h (RX_{MIN,MAX}_ERROR): minimum and maximum rx error + values + +2000-11-25 Love <lha@stacken.kth.se> + + * ydr/output.c: try to use some more int32_t as return values + + * rx/rx.c (rxi_SendCallAbort, rxi_SendConnectionAbort): don't send + a long, send a int32_t + +2000-11-25 Marcus Sundberg <mackan@stacken.kth.se> + + * xfs/linux/bin/Makefile.in: sed -e 'expr ; expr' doesn't work with + older GNU sed, do it the old fashioned way instead. + +2000-11-25 Love <lha@stacken.kth.se> + + * doc/*.texi: reorganized the text, added index, and detailed nodes + * doc/afs-basics.texi: some more text about fs and vldb relations + * doc/real-world.texi: some real world problems + + * arlad/fcache.c (cleaner): check if entry is locked before trying + to clean it out, lock node before unlinking it from the lru + + * xfs/linux/xfs_node.c (xfs_node_users): use xfs_dcount + * xfs/linux/xfs/xfs_locl.h (xfs_dcount): added + + * xfs/linux/xfs_load.c (init_module): make devfs_register work for + 2.4, patch from Chris Kuklewicz <chrisk@MIT.EDU> + +2000-11-23 Love <lha@stacken.kth.se> + + * arlad/dynroot.c (dynroot_get_node): use + fcache_mark_as_mountpoint() to mark the symlinks as mountpoints. + * arlad/fcache.c (fcache_mark_as_mountpoint): new function + (update_entry): use fcache_mark_as_mountpoint + * arlad/fcache.h (fcache_mark_as_mountpoint): prototype + + * lib/ko/kocell.c (readcellservdb): reset dbserver when creating a + new cell, otherwise new cell might get the previous cell's + hostinformation. + (readdb): set timeout to 0, since this is static information + +2000-11-16 Love <lha@stacken.kth.se> + + * xfs/linux/xfs_message.c (xfs_invalid_node): break out node + counting stuff to xfs_node_users + * xfs/linux/xfs_node.c (xfs_node_users): new function, return + number of users + + * xfs/bsd/xfs_vnodeops-common.c (xfs_inactive_common): is stale, + reclaim at once. + * xfs/bsd/xfs_message.c (xfs_message_invalidnode): is data is + used, make it as stale + * xfs/linux/xfs_node.c (free_all_xfs_nodes): call + xfs_force_invalid_xnode instead of xfs_invalid_xnode + * xfs/linux/xfs_inodeops.c: s,xfs_iread,xfs_icount, + * xfs/linux/xfs_message.c (xfs_force_invalid_xnode): break out + parts of xfs_invalid_xnode + (xfs_invalid_node): mark node as stale if there is users left + * xfs/linux/xfs_vfsops.c (xfs_notify_change): clear attributes + before rpc + (xfs_put_inode): if data is stale and this is the last user, flush data + * xfs/linux/xfs/xfs_locl.h (xfs_icount): rename xfs_iread + (xfs_iwritecount): add + * xfs/linux/xfs/xfs_fs.h (xfs_force_invalid_xnode): add new + function + +2000-11-15 Love <lha@stacken.kth.se> + + * xfs/linux/xfs_inodeops.c (xfs_setattr): clear attr token before + rpc, not after + + * appl/lib/arlalib.c (arlalib_try_next_db): try next db-server on + RX_CALL_DEAD + + * xfs/linux/xfs_inodeops.c (xfs_lookup): wrap errno in ERR_PTR + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_unlock): don't print internal + structure of v_interlock + + * util/log.c: make it pass the regression test + * util/util-tester.c: add :notime, renumber, add "all" target, and + print "all" and "-all" + +2000-11-14 Love <lha@stacken.kth.se> + + * arlad/fcache.c: revert 1.301->1.300 until I have a brain (it + should sleep now) to write this code more beatuify and at the same + time working. + +2000-11-07 Love <lha@stacken.kth.se> + + * arlad/fcache.c (read_data): remove bogus assert, data can have + changed inbetween fetchstatus and fetchdata + +2000-11-04 Love <lha@stacken.kth.se> + + * xfs/solaris/xfs_vnodeops.c: implement xfs_getpage, xfs_putpage, + xfs_delmap and xfs_addmap modify xfs_map to do the page handling + itself. + +2000-11-03 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c: make all loop-over-all-file-servers simpler and + more uniform + +2000-11-03 Love <lha@stacken.kth.se> + + * rxdef/common.h: CALLBACK_VERSION is the current version of the + callback + +2000-11-02 Love <lha@stacken.kth.se> + + * arlad/.gdbinit: add some volcache debugging stuff + +2000-11-02 Assar Westerlund <assar@sics.se> + + * configure.in: remove unused vfs* tests + * xfs/bsd/bin/mount_locl.h: remove unused MOUNT_XFS stuff + * xfs/bsd/bin/mount_xfs.c: always mount filesystem by name, except + on OSF. remove all code for auto-loading. + +2000-10-31 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_createvobject, + xfs_destroyvobject, xfs_getvobject): add new methods, needed for + FreeBSD-5-current + + * cf/bsd-func-suser.m4: add <sys/systm.h> + * xfs/bsd/xfs_dev-bsd.c (__FreeBSD__) xfs_dev: conditionalize + d_bmaj + * configure.in: test for cdevsw.d_bmaj + + * util/log.c (log_open_syslog): add LOG_NDELAY per default, + otherwise program that do chroot may fail to open the syslog + socket later + +2000-10-28 Love <lha@stacken.kth.se> + + * Release 0.34.6, see the branch for relevant patches + + * xfs/solaris/xfs_vnodeops.c (xfs_map): add debugging statement + that show is a program mmap:s of the end of a file. Add add gross + hack that flush all mmaped files to server if they are mmap R/W + XXX. + (*): indent + +2000-10-27 Love <lha@stacken.kth.se> + + * arlad/solaris-subr.c (write_dirent): use strcpy to copy name and + check size of reclen so it isn't larger then blocksize. + * arlad/inter.c (cm_lookup): if we are looking up . make sure we + don't set `res' to value of parent + +2000-10-26 Love <lha@stacken.kth.se> + + * xfs/solaris/xfs_message.c (xfs_message_installnode): avoid + holding node mutex when doing VN_RELE() since that might cause a + VOP_INACTIVE if the node happend to fall out of the dnlc + +2000-10-25 Love <lha@stacken.kth.se> + + * arlad/inter.c (cm_lookup): try avoid doing bulkstat when doing + lookup on . + + * xfs/solaris/xfs_message.c (xfs_message_installdata): HOLD the + vnode when doing a dnlc_purge_vp since it might not be used, and + that will result in a VOP_INACTIVE and recusive mutex enter panic + in xfs_inactive. + + * xfs/solaris/xfs_message.c (xfs_message_installdata): make the + lookup by path code work again, ident + + * arlad/solaris-subr.c: (write_dirent): DTRT re the size of the + name, don't do sizeof() when you mean strlen. + + * **/Makefile.in: make distclean target consistent + +2000-10-24 Magnus Ahltorp <ahltorp@nada.kth.se> + + * arlad/fcache.c: Assert return value from listadd* + +2000-10-24 Love <lha@stacken.kth.se> + + * appl/pts/pts.c (*): expand cellname + +2000-10-20 Assar Westerlund <assar@sics.se> + + * arlad/*.c: use AssertLockOwner and AssertNotLockOwner + + * lwp/lock.h (AssertLockOwner, AssertNotLockOwner): print the + current locker, and print file:line correctly, add trailing + newline + (AssertExclLocked, AssertNotExclLocked): add two new macros for + users to verify that a lock is (not) held + +2000-10-20 Love <lha@stacken.kth.se> + + * lwp/lock.c (Lock_Init): set thread_index + * lwp/lock.h (struct Lock): thread_index is the thread that have a + exclusive lock + (Obtain.*, Release.*): check owner of lock + * lwp/{plwp,lwp_asm}.h: define LWP_INVALIDTHREADID + +2000-10-19 Love <lha@stacken.kth.se> + + * xfs/solaris/xfs_vfsops.c (xfs_{,u}mount): initialize/delete the + mutex's in struct xfs + * xfs/solaris/xfs_dev.c: don't init the struct xfs since it + belongs to the filesystem + + * xfs/solaris/xfs_dev.c: indent + +2000-10-18 Assar Westerlund <assar@sics.se> + + * arlad/arla-cli.c (default_log_file): change to /dev/stderr, it's + much more useful for an interactive program to output errors and + warnings where they're immediately visible + +2000-10-18 Love <lha@stacken.kth.se> + + * Release 0.34.5, see the branch for relevant patches + + * configure.in: check for strlcpy + + * xfs/linux/xfs_inodeops.c (*): return error if filename is too + long + + * xfs/bsd/xfs_vnodeops-common.c (xfs_lookup_common): do copy of + label diffrently + (xfs_symlink_common): check length of symlink content + + * xfs/include/xfs/xfs_message.h (XFS_MAX_SYMLINK_CONTENT): define + for size largest symlink that can be passed in the rpc system. + * xfs/linux/xfs_dev.c (enqueue_message): fixed wrong debug printf + + * xfs/*/xfs_common.c: added strlcpy + * xfs/*/xfs_[iv]nodeops*.c: avoid overrun the filename in the + upcall packet + * xfs/*/xfs_message.c (xfs_message_installdata): terminate the + cache_name string + +2000-10-17 Love <lha@stacken.kth.se> + + * Release 0.34.4, see the branch for relevant patches + +2000-10-16 Love <lha@stacken.kth.se> + + * arlad/fcache.c (get_root_of_volume): finish un-finished comment + +2000-10-15 Assar Westerlund <assar@sics.se> + + * xfs/rhapsody: remove this (to the attic). it is probably not + useful for anybody, and the new MacOS X port of this code has been + integrated into xfs/bsd + * lwp/make-process.o.sh.in: remove (unsued) rhapsody case + + * lib/ko/kocell.c (cell_getcellbyhost): make it consistent as + related to memory allocation. now always returns non-malloced + memory. + + * tests/make-page.c: make it work without MMAP_ANON + * appl/lib/ka-procs.c: remove dupliate include files, add fallback + definitions for DES_ENCRYPT and fix types + * xfs/bsd/bin/Makefile.in (startarla): also substitute libexecdir + * xfs/bsd/bin/startarla.in (PATH): also include libexecdir to find + arlad + +2000-10-15 Love <lha@stacken.kth.se> + + * arlad/arlad.c (arla_start): don't send USR1 when not forking + + * arlad/messages.c (xfs_message_rmdir): msg0 is of type + xfs_message_installdata + + * arlad/inter.c (cm_getattr): if data isn't in kernel, make sure + to mask way the open-mask too + + * doc/debugging.texi: some more debugging help + +2000-10-14 Love <lha@stacken.kth.se> + + * xfs/linux/xfs_message.c (xfs_message_installdata): look at + XFS_ID_HANDLE_VALID flag and make sure we fall back on + path_init/path_wait/open_namei if its not there. + (xfs_message_installnode): print tokens + + * xfs/solaris/xfs_message.c (xfs_message_installdata): look at the + XFS_ID_HANDLE_VALID flag and panic if not set + +2000-10-14 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/bsd/xfs_message.c (xfs_message_installdata): Only use handle + if XFS_ID_HANDLE_VALID is set + + * arlad/*.c: Use fcache_cache_handle. Set XFS_ID_HANDLE_VALID. + + * arlad/{arlad.c,arla.c,arla-cli.c,arla_local.h}: Fork early and + wait for SIGUSR1 + + * xfs/include/xfs/xfs_message.h: Add XFS_ID_HANDLE_VALID + + * xfs/bsd/xfs_vfsops-macos.c: Dead vnodes should use nop locking + + * xfs/bsd/xfs_vfsops-bsd.c (xfs_fhlookup): check for NULL vnode + from VGET + +2000-10-14 Love <lha@stacken.kth.se> + + * xfs/linux/xfs_inodeops.c (xfs_read_file): 2.4: check if the data + is valid valid before calling generic_file_read. + + * tests/invalidate-file.c: use fs_invalidate, better errormessages + * tests/invalidate-file.c: invalidate files when they are used. + + * lwp/lwp_asm.c: clean up some, allocate some STACK_HEADROOM in + first call to savecontext(), unify some cases, remove unused stuff + * lwp/lwp_asm.h: define AFS_LWP_MINSTACKSIZE to (100 * 1024) in + all cases, make comment match + + * INSTALL: simplify the chardevice node text, 0.5 is a LONG time + ago. add text about kgcc and rh7.0; + + * lwp/process.ppc.S: document PowerPC Stack structure + * xfs/linux/xfs_inodeops.c (xfs_write_file): validate data before + writing to file + * tests/run-tests.in (ARLA_TESTS): run copy-file + * tests/copy-file: copy a file several times + + * configure.in (linux): allow overriding of KERNEL_CC + + * appl/kalog/kalog.c: improve the user-interface + * appl/lib/ka-procs.c: remove usused variable + +2000-10-12 Love <lha@stacken.kth.se> + + * xfs/linux/xfs_dev.c (struct xfs_channel, xfs_queue_inactive, + xfs_process_inactive_queue): protect inactive_list too + + * xfs/linux/xfs_dev.c (enqueue_message): common parts of + xfs_message_send, protect updating of sequence-number + (xfs_process_inactive_queue): use enqueue_message instead of xfs_message_send + (xfs_message_send): moved body to enqueue_message + (xfs_devread): process inactive queue + (xfs_message_send): process inactive queue + (xfs_message_rpc): process inactive queue, protect updating of sequence-number + (struct xfs_channel): document what channel_sem is protecting + + * tests/create-symlinks.c: verify contents + +2000-10-11 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_dev-common.c (xfs_message_rpc): do not send SIGABRT, + only useful when debugging + + * configure.in: call AC_KRB_IPV6 (we might end up getting some + library such as libinet6 that gives us getnameinfo et al) + +2000-10-11 Love <lha@stacken.kth.se> + + * lib/ko/gensysname.c: make it match sparc64 too + * tests/fhbench.c: include <sys/ioccom.h> if exist + * lib/roken: make getaddrinfo stuff work + * **/Makefile.in: wack everything until it seems to work + * arlad/solaris-subr.c: remove _KERNEL, solaris don't need it. + +2000-10-10 Love <lha@stacken.kth.se> + + * lib/roken: remove strmatch.c, inaddr2str.c, str2inaddr.c + + * configure.in: check for sin_len + * appl/*/*.[ch]: use getaddrinfo/getnameinfo + * lib/ko/gensysname.c (main): use fnmatch instead of strmatch + * arlad/afsdir_check.c: use arla_local.h + * arlad/arla_local.h: define O_BINARY is not defined. + * ydr/output.[ch]: break out eefile from libroken + * ydr/main.c: break out strange libroken functions + +2000-10-09 Love <lha@stacken.kth.se> + + * lib/ko/ports.c: initialize ports to random value to fool + darwin's ranlib + +2000-10-08 Assar Westerlund <assar@sics.se> + + * rx/rxdebug.c (*): check that the socket fd is not too large to + select on + * rx/rx_pkt.c (osi_NetSend): check that the socket fd is not too + large to select on + * lwp/testlwp.c (selectConsumer): check that the fd is not too + large to select on + * arlad/kernel.c (kernel_opendevice): check that the fd is not too + large to select on + * appl/afsutils/klog.c (do_timeout): check for the fd being too + large to be able to select on + * rx/rx_user.c: static-ize some variables and check that the + socket fd is not too large + * rx/rx_globs.h: remove some variables that are only used in + rx_user + +2000-10-08 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/bsd/xfs_vnodeops-bsd.c, xfs/bsd/xfs_vnodeops-common.c: Mac + OS X UBC fixes + + * configure.in: Check which library to include to get pthreads + support + +2000-10-08 Love <lha@stacken.kth.se> + + * lib/ko/kocell.c: improve dns handling + * appl/*/Makefile.in: Add depency on arlalib + + * appl/kalog/kalog.c: use new ka_ interface + * appl/lib/Makefile.in: add ka-procs.[ch], install headerfiles + * appl/lib/ka-procs.h: KA server interfaces. + * appl/lib/ka-procs.c: KA server interfaces. Currently implemented + is Authenticate and GetTicket. + +2000-10-07 Love <lha@stacken.kth.se> + + * rxdef/ka.xg: added GetTicket and random fixes + * arlad/services.h: added ka missing services + +2000-10-06 Love <lha@stacken.kth.se> + + * configure.in: added kalog + * appl/Makefile.in (SUBDIRS): added kalog + * appl/kalog/kalog.c: simple klog program need some cleaning + in the user-interface + * appl/kalog/Makefile.in: makefile for kalog + +2000-10-04 Love <lha@stacken.kth.se> + + * ydr/output.c: try to handle encoding strings + + * arlad/inter.c (cm_lookup): avoid deadlock when looking up .. in + a volume root + + * xfs/bsd/xfs/xfs_locl.h: don't include <vm/...> headers on a uvm + only system + * configure.in: check if we are a uvm only system + * cf/bsd-uvm-only.m4: add a uvm vs vm test + +2000-10-03 Love <lha@stacken.kth.se> + + * arlad/dynroot.c (dynroot_update_entry): set unitmodebits for + mountpoints + * lib/ko/kocell.c (celldebug_units): add a almost-all + * util/log.c (parse_word): fixet parsing and implement best_match + + * **/*.[chly]: Removed advertising clause. + +2000-10-02 Magnus Ahltorp <ahltorp@nada.kth.se> + + * include/afssysdefs.h, xfs/bsd/xfs/xfs_syscalls.h, + xfs/bsd/xfs_syscalls-wrap-bsd.c: Added afssysdefs.h + + * xfs/bsd/xfs_dev-bsd.c: xfs_is_xfs_dev should only be defined + once on Mac OS X + + * arlad/inter.c: Transarc doesn't check permissions on directory + FetchStatus + +2000-10-02 Harald Barth <haba@pdc.kth.se> + + * rx/rx_queue.h: If it will segfault, get it at early as possible. + * rx/rx.c: Asserts to find when the congestionQueue breaks + +2000-10-02 Magnus Ahltorp <ahltorp@nada.kth.se> + + * lib/ko/gensysname.c: Added ppc_macosx + +2000-10-02 Love <lha@stacken.kth.se> + + * arlad/bsd-subr.c: don't define _KERNEL since it not used + +2000-09-30 Assar Westerlund <assar@sics.se> + + * arlad/*-subr.c, arlad/arla_local.h: 'move the required magic for + getting DIRSIZ et al from dirent.h into the *-subr.c files, since + it is different on all OSes + + * util/log.c (syslog_opt_units): conditionalize the different + openlog flags + +2000-09-29 Assar Westerlund <assar@sics.se> + + * rx/rx_user.c (ADDRSPERSITE): bump to 256 to work-around a bug in + older FreeBSD + +2000-09-29 Love <lha@stacken.kth.se> + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_lookup): merge the EJUSTRETURN + and 0 cases + +2000-09-28 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/bsd/xfs/xfs_locl.h: include sys/ubc.h on darwin + + * xfs/bsd/xfs_vfsops-bsd.c, xfs/bsd/xfs_node-bsd.c, + xfs/bsd/xfs_vnodeops-bsd.c: darwin ubc handling fixed + + * xfs/bsd/xfs_syscalls-common.c, xfs/bsd/xfs_vfsops-common.c: + darwin copyinstr requires valid 4th argument + +2000-09-28 Love <lha@stacken.kth.se> + + * rx/rxperf.c: getopt'ify to make it possible to link agaist + transarc libs + * arlad/arlad.8: remove paths + +2000-09-27 Love <lha@stacken.kth.se> + + * xfs/bsd/bin/Makefile.in: move programs to sbin + + * arlad/inter.c: deal with followmountpoint change + * arlad/fcache.h: new signature of followmountpoint + * arlad/fcache.c (followmountpoint): add parameter to pass down + parent FCacheEntry + + * arlad/volcache.c: (get_info_byname): cast volname_len to int + when doing a .*s printf + + * arlad/Makefile.in: deal with arlad/arla-cli changes + * arlad/arla.c: break out daemon/test parts + * arlad/arla_local.h: export part of arla{,-cli,d}.c + * arlad/arlad.8: created from arlad.1 + * arlad/arla-cli.8: document, new file + * arlad/arlad.c: daemon parts of arla.c + * arlad/arla-cli.c: pull out command line specific parts of arla.c + * arlad/ThisCell.5: fix refenceses + +2000-09-25 Magnus Ahltorp <ahltorp@nada.kth.se> + + * arlad/arlad.1: Corrected referred filenames + +2000-09-25 Love <lha@stacken.kth.se> + + * lib/ko/kocell.c (readdb,readcellservdb): make less picky about + whitespace. + + * appl/fs/Makefile: include arladebu.o + * appl/lib/Makefile: don't include arladeb.o + + * arlad/Makefile.in (afsdir_check_OBJS): don't need arladeb.o + any more + * arlad/afsdir_check.c: don't need arla_loginit + + * arlad/arladeb.c: moved functions around + * arlad/arladeb2.c: removed: functions moved to arladebug.c + * arlad/arladebu.c: exported parts of arla debug interface + + * arlad/fcache.c (fcache_get): set pag to ARLA_NO_AUTH_CRED, not 0 + + * xfs/linux/xfs_dev.c (xfs_print_sleep_queue): use + HAVE_WAIT_QUEUE_TASK_LIST + * configure.in: check for linux/stddef.h and wait-queue->task_list + * cf/linux-type-wait-queue-task_list.m4: check for + wait-queue->task_list + +2000-09-25 Assar Westerlund <assar@sics.se> + + * config.sub: update to version 2000-09-11 (aka 1.181) from + subversions.gnu.org + + * config.guess: update to version 2000-09-05 (aka 1.156) from + subversions.gnu.org plus some minor tweaks + +2000-09-20 Love <lha@stacken.kth.se> + + * conf/arla.spec.in: make it (maybe) work with suse + * xfs/linux/bin/Makefile.in: look for init.d directories at some + more places + +2000-09-19 Love <lha@stacken.kth.se> + + * lwp/Makefile.in (clean): remove process.S, its a symlink created + by make-process.o.sh + +2000-09-18 Love <lha@stacken.kth.se> + + * conf/CellServDB (admin.kth.se): added malvolio.admin.kth.se + + * Release 0.34.3, see the branch for relevant patches + +2000-09-16 Love <lha@stacken.kth.se> + + * tests/fhbench.c: a fhopen bench program + +2000-09-15 Love <lha@stacken.kth.se> + + * arlad/fcache.c (truncate_file): remove assert that new + filelength shold be the length that we specified, since old + fileserver just seems to do wrong with it. + +2000-09-14 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_message.c (xfs_message_installnode): grab a + reference to the parent dentry while it's being used + +2000-09-13 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_dev.c (sigisactive, sigissignaled): handle both + old style `current->signal' and 2.4.0-test8 style + `current->pending.signal' + + * configure.in (linux): test for `struct task_struct.pending', + added in 2.4.0-test8 + +2000-09-12 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs/xfs_dev.h (xfs_channel): add `proc' to save who is + connection to this channel new prototypes + + * xfs/bsd/xfs_dev-common.c (xfs_devread, xfs_devwrite): save the + proc used in the channel + (xfs_message_rpc): check to avoid deadlocks caused by arlad + calling xfs that would cause rpcs sent to arlad + +2000-09-09 Love <lha@stacken.kth.se> + + * appl/vos/vos_status.c (printstatus): print volume name here, + indent + * appl/udebug/udebug.1: specify section + * arlad/arlad.1: clairify how to start arlad + * arlad/arla.conf.5: the return of the mandoc maffia + +2000-09-08 Love <lha@stacken.kth.se> + + * tests/run-tests.in: added fchmod and truncate + +2000-09-06 Love <lha@stacken.kth.se> + + * util/log.c (syslog_facility_units): add #ifdef junk for broken + OS that doesn't have LOG_foo + * appl/bos/Makefile.in: added mandir + * rx/Makefile.in: added mandir + +2000-09-05 Love <lha@stacken.kth.se> + + * appl/udebug/udebug.c (myctime): dont use %c to strftime + * util/log.c (log_vprint_file): don't use %c to strftime + (log_open_syslog): make shorter + +2000-09-04 Love <lha@stacken.kth.se> + + * appl/*/*.c: (main): log_open use :notime + + * util/log.c: added options + * lib/ko/ko_locl.h: include <log.h> + * lib/ko/ko.h: include <log.h> + * lib/ko/kocell.c: use log_log for debugging + * appl/udebug/udebug.c: try to clear up myctime warnings + +2000-09-02 Love <lha@stacken.kth.se> + + * ydr/output.c: differate variable declaration and function + (prototype) declaration make max sized string (string foo<10>) + have fixed size in variable declaration, and be a pointer in + function declarations + + * **/*.[ch]: fixed missing agetarg stuff + +2000-09-01 Love <lha@stacken.kth.se> + + * **/*.[ch]: use agetarg where approriate + * lib/ko/agetarg.[ch]: introduce wacked agetarg + * lib/roken/getarg.[ch]: change to heimdal 0.3a's libroken + * arlad/arlad.1: --dynroot + * arlad/CellServDB.5: more AFSDB religion + +2000-09-01 Magnus Ahltorp <ahltorp@nada.kth.se> + + * arlad/messages.c (try_again): Handle RXKADSEALEDINCON and + RXKADUNKNOWNKEY + * arlad/volcache.c (get_info_loop): Handle RXKADSEALEDINCON and + RXKADUNKNOWNKEY + +2000-08-31 Love <lha@stacken.kth.se> + + * arlad/messages.c: make more consistent, make all fcache_get_data + calls loop on try_again + * arlad/messages.c (xfs_message_getdata): don't pass NULL as fid + to try_again, since if the error is from VBUSY, it try to print + the fid, and since fid is NULL it will crash. + * rxdef/bos.xg: added missing ; + +2000-08-30 Love <lha@stacken.kth.se> + + * appl/bos/*.c: indent, make work, correct, refit to new bos.xg + * rxdef/bos.xg: try to make it more correct + +2000-08-29 Love <lha@stacken.kth.se> + + * appl/bos/Makefile.in: install manual pages + * appl/bos/bos.8: added initial manualpage + * doc/storage.texi: more about volume management + * doc/afs-basics.texi: corrent dns example + * lib/ko/kocell.c: always read suidcell when starting + +2000-08-28 Love <lha@stacken.kth.se> + + * xfs/solaris/xfs_node.c (new_xfs_node): pass in parentnode to + avoid deadlock when "." is entered. + (*): start doing locking on xnode + * xfs/solaris/xfs/xfs_node.h (struct xfs_node): add a mutex to + lock the struct, add a comment that struct vnode needs to be + first. + * xfs/solaris/xfs_node.c (free_xfs_node): if we are next_node, + point it on node after us + +2000-08-27 Love <lha@stacken.kth.se> + + * xfs/solaris/xfs_message.c (gc_vnode): lock vnode when looking at + v_count + * xfs/solaris/xfs_node.c (new_xfs_node): protect nodes list + (free_xfs_node): protect nodes list, make sure to update the + next_node pointer + (xfs_node_iter_start): start a iteration of the nodes list + (xfs_node_iter_next): get next node in iteration + (xfs_node_iter_stop): end iteration of the nodes list + (xfs_node_find): use new list iteration function + (free_all_xfs_nodes): use new list iteration function + * xfs/solaris/xfs_message.c (xfs_message_gc_nodes): use new + interation functions on nodelist + * xfs/solaris/xfs_dev.c (xfs_dev_attach): call xfs_init_xfs() to + init struct xfs + (xfs_dev_detach): call xfs_destroy-xfs to free usage of struct xfs + * xfs/solaris/xfs_wrap.c (_fini): disallow unloading of module + that still used + * xfs/solaris/xfs_vfsops.c (xfs_unloadable): return 0 is xfs is + unloaded + (xfs_init_xfs): init mutexed related to struct xfs + (xfs_destroy_xfs): destroy mutexes related to struct xfs + (xfs_uprintf_filsys): use literation functions + * xfs/solaris/xfs/xfs_fs.h (struct xfs): added mutex'es for list + protection add new prototypes + * xfs/solaris/xfs_syscalls.c (xfs_uninstall_setgroups): avoid + unload if never loaded + (xfs_setgroups): protect with p->p_crlock + +2000-08-26 Assar Westerlund <assar@sics.se> + + * xfs/solaris/xfs_dev.c: remove some old stuff make some macros + into functions + (xfs_message_rpc): add signals to blocked set + +2000-08-26 Love <lha@stacken.kth.se> + + * xfs/solaris/xfs_dev.c (xfs_message_rpc): mask SIGPOLL, SIGALRM, + and SIGVTALRM while doing the rpc + +2000-08-26 Love <lha@stacken.kth.se> + + * lib/ko/Makefile.in: change order of KRB4_LIB_FLAGS and libroken + + * xfs/solaris/xfs/xfs_locl.h: added <sys/signal.h> + * xfs/solaris/xfs_dev.c: allocate xfs_channel->message_buf at + attach/detach moment protect xfs_channel->message_buf with mutex + convert some printf to XFSDEB + * xfs/solaris/xfs_dev.c: lock messageq and sleepq, initial SMP + support use a macro to get ddi_get_soft_state() add some comments + + * tests/write-closed2.c: include more stuff to make it work on + solaris + +2000-08-25 Love <lha@stacken.kth.se> + + * lwp/process.m68k.S: make the `register % hack' depend on __ELF__ + +2000-08-25 Assar Westerlund <assar@sics.se> + + * arlad/volcache.c: replace some strncpy with strlcpy, and make a + too long volume name an error + * arlad/fcache.c: replace some strcpy with strlcpy + * arlad/arla.c (main): use the correct cell and not `0' + + * arlad/messages.c (try_again): get anonymous credentials in the + correct cell + (xfs_message_getroot, viocgettok)): use the correct cell and not `0' + (viocsetacl): only malloc the required space + +2000-08-24 Love <lha@stacken.kth.se> + + * arlad/arladeb{2,}.[ch]: new log_log + * util/util-tester.c: added new test for log + * util/log.[ch]: enable subsystem to log + * util/log_log.3: added manualpage + * util/Makefile.in (LIBS): change order of including libroken and + @LIBS@ + +2000-08-21 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/solaris/bin: Added startarla and modctl + +2000-08-20 Tomas Olsson <tol@stacken.kth.se> + + * rxdef/cb.xg: don't convert addr_in & subnetmask in struct + interfaceAddr + + * tests/write-closed.c (doit): cast MAP_FAILED to void * + + * tests/write-closed2.c: include atypes.h + (doit): cast MAP_FAILED to void * + +2000-08-20 Assar Westerlund <assar@sics.se> + + * ydr/output.c: inherit flags to the elements of of an + array/varray + + * tests/write-closed.c, write-closed2.c: new tests + +2000-08-19 Magnus Ahltorp <ahltorp@ahltorp.nada.kth.se> + + * Release 0.34.2, see the branch for relevant patches + +2000-08-19 Assar Westerlund <assar@sics.se> + + * configure.in: update smp-test on linux to newer kernels: more + header files are necessary when doing the cpp test and uppercase + characters when grepping /proc/ksyms + * cf/krb-bigendian.m4: re-write this so that it hopefully it works + correctly + +2000-08-17 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_vnodeops-common.c (xfs_fsync_common): give up and + throw away data when called from reclaim + (xfs_inactive_common): use printf so that user seems the failed + writing-back + + * xfs/bsd/xfs/xfs_locl.h: try including all vm-related files that + we find + + * configure.in: actually test if we found krb4 for deciding to + build rxkad, not just that we were looking for it + +2000-08-16 Love <lha@stacken.kth.se> + + * appl/lib/fs_lib.c (fs_get_sysname): fix strlcpy + (fs_getcells): fix strlcpy, argument i a len not a size + * appl/lib/arlalib.h (fs_getcells): fix prototype + +2000-08-15 Love <lha@stacken.kth.se> + + * arlad/messages.c (xfs_message_symlink): update usage of + cm_symlink + * arlad/inter.c (cm_symlink): convert to take a FCacheEntry + instead of a VenusFid + +2000-08-14 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_message.c (clear_all_children): make it invalidate + this dcache entry iff `parent'. fix all callers. + +2000-08-13 Love <lha@stacken.kth.se> + + * doc/arla.texi: add new files and nodes + * doc/afs-basics.texi: spelling + * doc/intro.texi: update platforms, and add arla-commit + * doc/oddities.texi: mountpoints + * doc/authors.texi: updata + * doc/Makefile.in: added new files + * doc/{storage,timeline}.texi: new random texts + * doc/history.txt: merged into info document + * doc/{partsofarla,,porting,servers,tools,ack,debugging}.texi: Id police + +2000-08-13 Love <lha@stacken.kth.se> + + * arlad/arla.c (recover): don't revover by default + +2000-08-13 Assar Westerlund <assar@sics.se> + + * configure.in: check for uvm/uvm_extern.h + + * xfs/bsd/xfs/xfs_locl.h: use uvm/uvm_extern.h instead of vm/vm*.h + if it exists + +2000-08-11 Love <lha@stacken.kth.se> + + * configure.in: enable to disable compiling xfs + +2000-08-10 Tomas Olsson <tol@stacken.kth.se> + + * lib/bufdir/fbuf.c (malloc_flush): reorder args to lseek() + +2000-08-09 Mattias Amnefelt <mattiasa@e.kth.se> + + * conf/CellServDB: Updated club.cc.cmu.edu + +2000-08-08 Love <lha@stacken.kth.se> + + * arlad/fcache.c (getroot): don't die when we cant find the root + volume, don't enter volccache_getbyname more then one time XXX the + later should be fixed in volcache + +2000-08-06 Love <lha@stacken.kth.se> + + * Release 0.34.1 relased, see the branch for relevant patches + +2000-08-06 Assar Westerlund <assar@sics.se> + + * xfs/solaris/xfs_syscalls.c (remote_pioctl): also interpret ENXIO + as the daemon not being there and therefore mapped into EINVAL + +2000-08-06 Love <lha@stacken.kth.se> + + * appl/afsutils/Makefile.in (MANPAGES): += klog.1 aklog.1 + * appl/afsutils/aklog.1: add manulpage + * appl/afsutils/*.1: mandoc'ify, and clean u + + * appl/afsutils/aklog.c: use "TheseCells" if there is no arguments + * lib/ko/kocell.c (cell_expand_cell): expand in the same order as + CellServDB + (readthesecells): read a "TheseCells" file and add them to the ofst of + TheseCells + (addthesecell): add a new cell to the thesecells list, permit no dups. + (cell_init): also parse the TheseCells files + + * appl/afsutils/aklog.c: Added aklog from Brandon S. Allbery + <allbery@ece.cmu.edu>, rewrote it a little bit. + * appl/afsutils/Makefile.in: added aklog + + * appl/lib/arlalib.c (arlalib_get_viceid_servers): return the + errorcode + + * cf/c-attribute.m4: check for old gcc that can't eat + __attribute__ ((unused)) bar (void) { return ; } + + * Release 0.34 + + * configure.in (CHECK_KERBEROS): need to check for both krb4 and + krb5 since libkafs might depend on both. + +2000-08-03 Love <lha@stacken.kth.se> + + * lib/cmd/cmd.c (parse_magic_options): don't abort(), break + +2000-08-04 Love <lha@stacken.kth.se> + + * cf/check-kafs.m4: check if libkafs needs to be linked against + libkrb5, libkrb4 or both + +2000-08-02 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (get_attr_bulk): try to not leak memory from + bulkstatus. handle any number of returned status + * arlad/fcache.c (get_attr_bulk): actually break out when + RXAFS_BulkStatus fails + + * arlad/arla.c: move chroot later + +2000-08-02 Harald Barth <haba@pdc.kth.se> + + * LIESMICH: Polish german. + * README: Small hint + +2000-08-02 Assar Westerlund <assar@sics.se> + + * arlad/arla.c (main): chroot to cache_dir to avoid influencing + anything + + * xfs/bsd/xfs_vnodeops-common.c (xfs_open_common): store the + `cred' in the xfs_node for later + (xfs_inactive_common): fsync the vnode (with the stored cred) + * xfs/bsd/xfs_vnodeops-osf.c (xfs_open): call xfs_open_common + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_open): call xfs_open_common + * xfs/bsd/xfs_node-bsd.c (xfs_getnewvnode): initialize `cred' + (free_xfs_node): free `cred' + * xfs/bsd/xfs/xfs_node.h (xfs_node): add `cred' + + * xfs/bsd/xfs_vfsops-common.c (xfs_mount_common): remove `length' + parameter when copying + + * rx/rxdebug.c: printf format correctness + +2000-07-30 Assar Westerlund <assar@sics.se> + + * lib/ko/kocell.c: complain once if we fail to open */ThisCell + don't complain about missing SuidCells + * lib/ko/kocell.c: do not write warnings about configuration files + found in /usr/vice instead of /usr/arla. read suid cell + information on demand. + +2000-07-28 Love <lha@stacken.kth.se> + + * lwp/make-process.o.sh.in (HOST_CPU): nbsd/pmax uses mipsl, catch + that one too. + +2000-07-24 Tomas Olsson <tol@stacken.kth.se> + + * appl/fs/fs.c (mkmount_cmd): simple support for cell as third arg + +2000-07-23 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_node-bsd.c (xfs_dnlc_lookup_int): always call + cache_lookup with LOCKPARENT | ISLASTCN to make sure the returned + parent node is locked. + (xfs_dnlc_lock): implement common function for doing the first half of + the required locking (the second half is done in xfs_lookup) after + fetching an entry from the cache. depending on the implementation + of cache_lookup, this has to be done always or only when + cache_lookup failed + + * xfs/bsd/xfs_dev-bsd.c: treat _LKM and KLD_MODULE the same way + * xfs/bsd/xfs_syscalls-common.c: treat _LKM and KLD_MODULE the + same way + (lookup_node): remove unused `done' + +2000-07-17 Love <lha@stacken.kth.se> + + * xfs/linux/*.c: dentry->d_child is atomic_t on linux 2.4-test3 + +2000-07-16 Love <lha@stacken.kth.se> + + * rx/rxperf.c: rx test perf program + * conf/CellServDB (cs.unc.edu): update + +2000-07-14 Simon Josefsson <jas@vic20.blipp.com> + + * cf/check-kerberos.m4 (AC_KRB4_INC_WHERE): Typo. + (AC_KRB5_LIB_WHERE1): Try -lresolv too. + +2000-07-12 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_message.c (xfs_message_invalidnode): try not to + throw away nodes that act as backing store for dirty vm objects + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_putpages): call underlying putpages + + * lwp/Makefile.in: always install lwp headerfile as lwp.h + + * xfs/include/xfs/xfs_message.h (XFS_FSYNC): add flag + * xfs/linux/xfs_inodeops.c (xfs_fsync): add flag + * xfs/*/xfs_vnodeops*.c (xfs_fsync): set fsync bit + * arlad/inter.c (cm_close): propagate fsync bit to fs + + * arlad/messages.c (viocwhereis): use volcache_volid2bit and only + return relevant file servers + * arlad/fcache.c (find_first_fs): use volcache_volid2bit + * arlad/volcache.h (volcache_volid2bit): add prototype + * arlad/volcache.c (volcache_volid2bit): new function + +2000-07-08 Love <lha@stacken.kth.se> + + * arlad/volcache.c (recycle_entry): assert the the entry isn't + used, free any parent + (get_free_entry): make sure the this node isn't a parent node before + recycling it + (volcache_getby{name,id}): if refcount == 0, + inc nactive_volcacheentries since the entry just started to + be used (after try_reuse or creation) + (add_entry_by{name,id}): move ++nactive_volcacheentries + resposibility to caller. + (try_reuse): relocate + +2000-07-06 Assar Westerlund <assar@sics.se> + + * rx/rx_pkt.c (rxi_EncodePacketHeader, rxi_DecodePacketHeader): + generalize the code to work where sizeof(u_int32_t) != 4 + +2000-07-03 Harald Barth <haba@pdc.kth.se> + + * tests/dir-tree: haba version, now without bash features + * tests/shallow-tree: with haba dir-tree + * tests/deep-tree: with haba dir-tree + +2000-07-02 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (update_entry): look at `fake_mp' + * arlad/arla_local.h (fake_mp): add + * arlad/arla.c: add `--fake-mp' + + * arlad/fcache.c (followmountpoint): set parent + * arlad/fcache.c: redo fake and real mountpoint stuff + + * arlad/messages.c (update_fid); try handling flags better + (xfs_message_getdata): translate errors in common case + + * tests/visit-volumes: new test + +2000-06-27 Love <lha@stacken.kth.se> + + * appl/bos/bos_status.c: indent and some cleaning + * appl/bos/bos.c (cmds): added apropos, help, quit + + +2000-07-02 Tomas Olsson <tol@stacken.kth.se> + + * lib/ko/koerror.c (koerr_gettext): make ret const + * lib/bufdir/fdir.c (fdir_creat): return EEXIST when appropriate + +2000-07-01 Assar Westerlund <assar@sics.se> + + * arlad/inter.c (cm_symlink): do not let the user choose 0644 bits + for a symlink, because then we could confuse it with a mount point + +2000-06-30 Assar Westerlund <assar@sics.se> + + * appl/vos/vos_examine.c: be more robust when the volume server + returns errors + +2000-06-26 Love <lha@stacken.kth.se> + + * arlad/messages.c (xfs_message_remove): it seems silly but remove + can cause a bulkstatus, pass the parent to fcache_verify_attr to + avoid a deadlock. + +2000-06-26 Tomas Olsson <tol@stacken.kth.se> + + * lib/ko/koerror.c (koerr_gettext): never return NULL + * tests/dir-tree: syntax + +2000-06-25 Tomas Olsson <tol@stacken.kth.se> + + * appl/vos/vos_createentry.c: check helpflag + +2000-06-25 Assar Westerlund <assar@sics.se> + + * appl/lib/arlalib.c (arlalib_get_viceid): update to + cell_dbservers_by_id + * arlad/volcache.c: adapt to new cell_dbservers_by_id + * arlad/arla.c (usage): print help correctly + * arlad/afsdir_check.c (usage): fix to print usage correctly + * arlad/messages.c: adapt to new cell_dbservers_by_id and + cell_new_dynamic + * lib/ko/Makefile.in: remove kodebug + * lib/ko/kocell.c: look up AFSDB records also for the case of an + existing cell that has no database servers. record cells + dynamically added in CellServDB + * lib/ko/ko_locl.h: remove kodebug.h + * lib/ko/ko.h: update to new prototypes from kocell.c + + * xfs/linux/xfs_vfsops.c (xfs_put_inode): change back the i_count + test to the comparison it was + (xfs_delete_inode): fix printf of i_count + * xfs/linux/xfs_inodeops.c (xfs_release_file): use xfs_iread for + accessing i_count + + * arlad/fcache.c (purge_volume): handle wildcard cells that can + result from volume callbacks from multi-homed file servers + * arlad/volcache.c (volcache_invalidate): handle wildcard cells + that can result from volume callbacks from multi-homed file + servers + + * lib/ko/kocell.c: make all cell name comparisons case-insensitive + +2000-06-24 Love <lha@stacken.kth.se> + + * rxdef/vldb.xg: add some more flag + +2000-06-24 Harald Barth <haba@pdc.kth.se> + + * tests/rm-rf.c: closedir() is good - do not die from too many + open files in big trees + * tests/deep-tree: Fast version does a not-so-deep-tree + * tests/create-files.c: Not only the first file should be of given + size + +2000-06-23 Assar Westerlund <assar@sics.se> + + * appl/afsutils/klog.c (main): use fgets for reading the password + +2000-06-23 Love <lha@s3.kth.se> + + * xfs/linux/xfs_message.c (gc_vnode): use xfs_iread + * xfs/linux/xfs_vfsops.c (xfs_read_super): set error = 0 when we + use path_init/path_tree + (xfs_put_inode,xfs_delete_inode): use xfs_iread + * xfs/linux/xfs/xfs_locl.h (xfs_iread): use for reading of i_count + (xfs_iref): change to use atomic_read + +2000-06-22 Assar Westerlund <assar@sics.se> + + * xfs/solaris/xfs/xfs_msg_locl.h (xfs_message_updatefid): add + prototype + * xfs/solaris/xfs_message.c (xfs_message_updatefid): add + * xfs/solaris/xfs_dev.c (xfs_message_receive): add updatefid + +2000-06-19 Assar Westerlund <assar@sics.se> + + * arlad/subr.c (dentry2ino): actually handle all the cases: + - . at the root of a volume + - .. at the root of a volume + - .. pointing to the root of the volume + - all other + + * arlad/fcache.c (fcache_realfid): try to return the right fid for + (*,1,1) + * arlad/fcache.c (invalidator): check that the heap has not + mutated while sleeping + + * appl/pts/pts.c (main): add an terminating element (NULL) in + myargv + +2000-06-18 Harald Barth <haba@pdc.kth.se> + + * LIESMICH: Follow README + +2000-06-17 Assar Westerlund <assar@sics.se> + + * configure.in (openbsd): set _LKM (should really come from + bsd.lkm.mk) + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_lookup): locking protocol is + more complex. if we're returning in *vpp the same node that we + got in dvp, we should not unlock it. + * xfs/bsd/xfs_vnodeops-common.c: add some extra (#if 0 code) + (xfs_readdir): fetch length from cache vnode with getattr + (xfs_reclaim_common): don't set v_data to NULL + +2000-06-16 Assar Westerlund <assar@sics.se> + + * configure.in: check for com_err.h and et/com_err.h + + * xfs/linux/bin/arla.init.in: do start and top in a somewhat more + debian-compatible way. based on a patch from Adrian Bridgett + <adrian.bridgett@iname.com> + + * ydr/lex.h (yylex): add prototype + + * arlad/fcache.c (fcache_fhopen, fcache_fhget): do not probe + + * configure.in: check for com_err.h and et/com_err.h + + * xfs/linux/bin/arla.init.in: do start and top in a somewhat more + debian-compatible way. based on a patch from Adrian Bridgett + <adrian.bridgett@iname.com> + +2000-06-15 Love <lha@s3.kth.se> + + * appl/afsutils/klog.c: backed out cmd changes + +2000-06-12 Love <lha@s3.kth.se> + + * cf/check-kerberos.m4: do the krb4 extra lib check the same way + as the krb5 case, there is no need to check for the include, since + if the user have choose a prefix explicity, they get + includedir=$prefix + +2000-06-12 Assar Westerlund <assar@sics.se> + + * arlad/messages.c (break_callback): reset attrusedp and + datausedp, otherwise we still think they are in use when we turn + on kernelp again. + +2000-06-12 Harald Barth <haba@pdc.kth.se> + + * doc/intro.texi: Be more precise about support status + * doc/arla.info: Follows intro.texi + * cf/check-kerberos.m4: run AC_KRB{4,5}_{LIB,INC}_WHERE even when + --with-krb{4,5}=/path is specified + +2000-06-10 Assar Westerlund <assar@sics.se> + + * lwp/process.sparc.S (sunos4): also define STACK_BIAS + + * tests/apwd.c: add verbosity. + (getcwd_classic): print the correct string in the verbose output + + * tests: allow overriding FS + + * appl/fs/fs_local.h (PRIMARY_CELL, SETUID_HONORED, + OBSOLETE_VERSION): redefine in terms of constants from kafs.h + * appl/fs/fs.c (afs_getcellstatus): use fs_getcellstatus + (lsmount_cmd, rmmount_cmd): only print error messages when it actually + failed + + * tests/apwd.c: clarify error messages + + * arlad/subr.c (dentry2ino): rewrite, hopefully simpler + + * arlad/xfs.h: update for new version handling + * arlad/kernel.c (version_thread): update to new version message + * arlad/xfs.c: update to new version message + * xfs: (invalidnode): do not print warnings when node not found. + (updatefid): add some implementations + (version): add some handlers + * xfs/include/xfs/xfs_message.h: make version number-based and not + capability based. change all modules. + (XFS_ID_AFSDIR): add new flag for installdata + (XFS_VERSION): set version + + * xfs/linux/xfs_inodeops.c (xfs_readdir): data is not valid when + trying to read from a bad fake mount point, so do not print + anything then + + * arlad/fcache.c (fcache_get_data): be more careful replacing a + fake mount-point + (find_volume): handle cases of missing types of volumes better + +2000-06-10 Love <lha@s3.kth.se> + + * rx/Makefile.in (rxdebug): added @LIBS@ + + * lib/cmd/testc.c (main): call set_progname + + * tests/rm-rf.c (main): do right with argc + + * arlad/xfs.c (*): try do to the right thing from kern_write() + + * xfs/linux/xfs_message.c (*): set return values to be negative + +2000-06-09 Love <lha@s3.kth.se> + + * tests/run-tests.in: use rm-rf instead of rm -rf when removing + the tree for paranoia resons. + + * tests/rm-rf.c (do_dir): if we have afs, try to do fs_rmmount on + each directory + (main): check for afs + + * appl/fs/fs.c (lsmount_cmd,rmmount_cmd): use fs_\1 + * appl/lib/fs_lib.c (fs_lsmount,fs_rmmount): added, moved from + fs.c + + * arlad/fcache.c (fcache_get_data): set TYPE_LINK when converting + to a mountpoint + + * arlad/messages.c (xfs_message_link): change if #if 1 to #if 0 + that I apprently changed with last commit, changed order of + free:ing dir_entry + (xfs_message_symlink): update to new + break_callback, free dir_entry later + (*): remove #if 0 code that tried to + break_callback instead of installing new data. + +2000-06-09 Harald Barth <haba@pdc.kth.se> + + * doc/authors.texi: spell + +2000-06-08 Love <lha@s3.kth.se> + + * arlad/fcache.c (invalidator): updated to new style + break_callback + * arlad/messages.c (break_callback): make it take a FCacheEntry + instead of a Fid, now it sets flags.kernelp = FALSE too. + (*): update all calls to break_callback and updated semantics + * arlad/messages.h (break_callback): update prototype + + * arlad/reconnect.c: fix compiler warnings + * rx/Makefile.in (include_HEADERS): added rxgencon.h + +2000-06-08 Assar Westerlund <assar@sics.se> + + * appl/vos/vos_status.c (vos_status): check for server and set + cell + + * appl/bos/bos_status.c (bos_status): check for server and set + cell + +2000-06-08 Love <lha@s3.kth.se> + + * doc/partsofarla.texi: expand pioctl stuff + * doc/servers.texi: point out again the importance of the + "comments" in the CellServDB file + * doc/afs-basics.texi: clearify CellServDB and AFSDB + +2000-06-08 Harald Barth <haba@pdc.kth.se> + + * doc/afs-basics.texi: Added verbs to sentences and other spelling + business. + * doc/servers.texi: This should be said somewhere. + +2000-06-07 Love <lha@s3.kth.se> + + * arlad/fcache.c (fcache_get_data): remove #if 1, that was for -t + protection + * arlad/arla.c (main): for -t call xfs_message_init() + * arlad/kernel.h (kernel_args): remove device_file + (kernel_device): added prototype + * arlad/arla.c (main): call kernel_opendevice() where apropriate + * arlad/kernel.c (kernel_opendevice): break out kern_open of + kernel_interface + (kern_interface): add the new "null" interface + (null_{open,read,write}): "null" interface + + * doc/authors.texi: mention rhapsody port and disco code + * doc/*.texi: spelling + +2000-06-05 Harald Barth <haba@pdc.kth.se> + + * xfs/linux/xfs_message.c: change XFS{,_ID}_INVALID_DNLC + * xfs/bsd/xfs_message.c: change XFS{,_ID}_INVALID_DNLC + * xfs/solaris/xfs_message.c: change XFS{,_ID}_INVALID_DNLC + * xfs/winnt/src/xfs_message.c: change XFS{,_ID}_INVALID_DNLC + +2000-06-05 Love <lha@s3.kth.se> + + * ydr/output.c (genin): make input only arguments const + + * rxkad/osi_alloc.c (osi_Alloc,osi_Free): add prototype to avoid + warning + * rxkad/compat.c: added prototype for initialize_rxk_error_table() + to avoid warning + + * doc/Makefile.in: remove some unused stuff + * Makefile.in (SUBDIRS): += doc. + +2000-06-05 Harald Barth <haba@pdc.kth.se> + + * xfs/include/xfs/xfs_message.h: name change: + XFS{,_ID}_INVALID_DNLC + + * lib/bufdir/fdir.h: add const to VenusFid decls + + * arlad/messages.c: My compiler didn't like the report_fid + declaration inside the do { } while when it is used in the while + expression. + + * INSTALL: Added some comments about ports (for all the firewall + owners) + +2000-06-05 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (fcache_get_data): bump in new data for resolved + mount point + + * arlad/fcache.h (FCACHE_VERSION): bump + + * arlad: merge in `fake-mp' code + +2000-06-04 Love <lha@s3.kth.se> + + * doc/afs-basics.texi: spelling, linked in into the tree. + * doc/arla.texi: added "Description of AFS infrastructure" + +2000-06-03 Love <lha@s3.kth.se> + + * arlad/cmcb.c (RXAFSCB_InitCallBackState{2,3}): update to new + definitions + +2000-06-02 Love <lha@s3.kth.se> + + * cf/krb-version.h: name the file ${PACKAGE}-version.h + * arlad/arla.c: use <arla-version.h> + + * cf/check-kerberos.m4: try to not pollute the cache + * ydr/output.c (encode_string): change order of %s left + pharentesis + +2000-06-02 Magnus Ahltorp <ahltorp@nada.kth.se> + + * rxdef/cb.xg: correct initcallbackstate confusion + + * rxdef/volumeserver.xg: added constants + +2000-06-01 Love <lha@s3.kth.se> + + * appl/afsutils/klog.c: cmd-ify + * appl/afsutils/klog.ctx: help text for mdoc page. + + * rx/Makefile.in: add and enable rxdebug, install/install rxdebug + * rx/rxdebug.c: clean up, made compile + + * lib/Makefile.in: add and enable cmd + * lib/cmd/cmd.c(print_usage): added CMD_MANDOC stuff + (cmd_PrintSyntaxManDoc): dont print argument twice with one + command commands + (*): s,params,parms, + + * lib/cmd/*: a cmd parser with mandoc support + +2000-05-25 Love <lha@s3.kth.se> + + * tests/mkdir: more paranoia + +2000-05-24 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_message.c (gc_vnode): use d_prune_aliases + (d_prune_aliases): define if !LINUX2_3 + + * arlad/arla.c (print_dir): do not assume that strftime handles %F + * cf/check-kerberos.m4: empty then-clause makes sh grumpy also add + some more random libraries when seeking krb5 + + * xfs/linux/xfs_inodeops.c (xfs_d_delete): make it always return + an `int'. the signature was changed in 2.3.99-pre9 and this + should be safer. removing the warning for older code would + require an autoconf test + * xfs/linux/xfs_syscalls.c (fhopen_call): declare `error' + +2000-05-23 Assar Westerlund <assar@sics.se> + + * cf/check-kerberos.m4: make no to everything actually be no + prepend -L to libraries + * cf/check-kerberos.m4: handle given and not-given arguments + better. fix library checking loops + +2000-05-23 Love <lha@s3.kth.se> + + * appl/lib/fs_lib.c (fs_invalidate): added + * appl/fs/fs.c: (invalidate_cmd): added + + * cf/check-kerberos.m4 (krb5 compat) added KRB4_LIB_DIR + (krb4) change order of extra libs and KRB4_LIB_DIR + + * xfs/linux/xfs_message.c (xfs_message_installnode): sync comment + with code + +2000-05-22 Assar Westerlund <assar@sics.se> + + * arlad/volcache.c (get_info_oop): conditionalize the use of + RXKADEXPIRED + * arlad/conn.c (conn_rxkad_level): conditionalize on KERBEROS + * tests/*.c: always call set_progname. make all tests buildable + even without KERBEROS + + * xfs/linux/xfs_vfsops.c (make_root): no need to set valid to + zero, since it's done in xfs_d_init + * xfs/linux/xfs_syscalls.c (fhopen_call): call get_write_access + * arlad/messages.c: make sure that all sub-functions of + xfs_message_pioctl either send a wakeup themselves or that they + get breaked from the switch and get handled at the end of + xfs_message_pioctl. + + * tests/rename-under-feet.c (child_chdir): print cwd to fd 4 + * tests/run-tests.in (ARLA_TESTS): add rename-under-feet + * tests/rename-under-feet.c (kill_child): do not be that brutal + * tests/rename-under-feet.c (child_chdir): remember to exit in + child + * tests/rename-under-feet.c (child_chdir): print cwd in child + * tests/rename-under-feet.c (child_chdir): invert fork-condition + * tests/rename-under-feet.c: new test + +2000-05-19 Assar Westerlund <assar@sics.se> + + * rxdef/Makefile.in (CLIENTSONBJS): add bos.cs.o + +2000-05-19 Love <lha@s3.kth.se> + + * arlad/arla.c (print_dir): verbose info + (arla_ls): ls -l + +2000-05-18 Love <lha@s3.kth.se> + + * xfs/linux/xfs_inodeops.c (xfs_d_delete): remove unused code + +2000-05-18 Assar Westerlund <assar@sics.se> + + * lib/ko/Makefile.in (LIBS): add all the known (and required libs) + +2000-05-16 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs/xfs_locl.h (xfs_root): replace with + xfs_replace_root + * xfs/linux/xfs_inodeops.c (xfs_d_validate): rename to + xfs_d_revalidate + (xfs_as_writepage, xfs_as_readpage): update to signatures as of + 2.3.99-pre8 + (try_replacing): new function that tries to do a root-swap when it + detects that we're using a fake root + (xfs_dead_lookup): use try_replacing + * xfs/linux/xfs_vfsops.c (make_root): install the new root before + replacing it + * xfs/linux/xfs_vfsops.c (xfs_replace_root): new function for + replacing the root with a new one. this just replaces the + `xfs_node' part of the root inode. + (make_root_vnode): new function for making a `fake' root node + * xfs/linux/xfs_node.c (clear_xfs_node): correct debug output to + print the correct function name + + * arlad/volcache.c (get_info_loop): make sure we re-try correctly + when we get back `token expired' + + * ydr/output.c: handle the case of OUT parameters of type STRING + <>. they need to be `char **' and not only `char *'. also fix + problem with not passing STRINGs correctly to server-side work + functions. + * ydr/types.h (enum argtype): make named + + * rxdef/bos.xg: correct error codes and opcodes + +2000-05-15 Love <lha@s3.kth.se> + + * Release 0.33.1 + + * appl/lib/arlalib.c (arlalib_get_token_id): new function + + * tests/run-tests.in (ARLA_TESTS): added kotest + * tests/kotest: added new test + * lib/ko/Makefile.in: added kotest target + * lib/ko/kocell.c (cell_expand_cell): add new function, inspired + by allbery <allbery@ECE.CMU.EDU> + + * cf/check-kerberos.m4 (AC_KRB4_LIB_WHERE1): break for-loop if + entry found + +2000-05-15 Assar Westerlund <assar@sics.se> + + * appl/afsutils/klog.c (afs_id): use arlalib_get_token_id_servers + * appl/lib/arlalib.c (arlalib_get_token_id_servers): add + (arlalib_get_token_id): fix + + * arlad/kernel.h (kern_read, kern_write): update prototypes + + * include/kafs.h (_PATH_ARLA_VICE): add + +2000-05-14 Assar Westerlund <assar@sics.se> + + * arlad/kernel.c (*_read, *_write): change signatures to those of + read and write + + * xfs/linux/Makefile.in (uninstall): remove SHARED_LIBS + * conf/Makefile.in (CONF_FILES): add SuidCells + * conf/SuidCells: add a default (empty) + + * tests/rm-rf.c, tests/kill-softly.c, tests/kill-softer.c: single + unix standard (and probably posix) says that unlink(directory) + should return EPERM and not EISDIR. accept both. + + * make-release, make-relase.el: new files + + * xfs/bsd/xfs_vfsops-common.c (xfs_mount_common): we always have + vfs_getnewfsid in all support OSes. same thing with struct + fstatfs.f_fstypename + + * xfs/bsd/xfs_vfsops-bsd.c (xfs_fhtovp): current should probably + be curproc. adding missing \n + + * xfs/*/xfs_syscalls*.c (remote_pioctl): convert ENODEV + into EINVAL, otherwise kafs does not think there's pioctl support + when arlad is not alive + +2000-05-12 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_syscalls.c (user_path2dentry): new function that's + basically namei, but implemented different on 2.3 and earlier. + (sys_afs_int): just map ENODEV to EINVAL (otherwise kafs is unhappy) + + * xfs/linux/xfs_message.c (xfs_message_installdata): use + path_init/path_walk on 2.3 (lookup_dentry is dead). + * xfs/linux/xfs_vfsops.c (xfs_read_super): use path_init/path_walk + on 2.3 (lookup_dentry is dead). + +2000-05-12 Love <lha@s3.kth.se> + + * xfs/winnt/bin/xfs-helper.c: added tcp-forwarder + * lwp/plwp.c: (LWP_INT_WAIT): change windows code + + * xfs/winnt/bin/makefile: add more tools + + * arlad/xfs.c: use kern_write + * arlad/kernel.[ch]: new kern interface + + * xfs/winnt/README: osr tools have moved + +2000-05-10 Love <lha@s3.kth.se> + + * appl/fs/fs.c (arladebug_cmd, xfsdebug_cmd): try to be nicer when + parseing commandline + +2000-05-09 Love <lha@s3.kth.se> + + * cf/check-kerberos.m4 (AC_KRB4_LIB_WHERE1): added fbsd security + compat (req com_err) + +2000-05-09 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_dev-common.c (xfs_message_rpc): separate device was + closed from we got signal so we do not have to lie to the user + + * xfs/bsd/xfs_wrap-bsd.c (SYSCALL_MODULE): set `xfs_sycall_num' so + all syscall installations work the same way + * arlad/fcache.c (real-extra_file_name): a new function that does + not do any checks and does the real work of fcache_extra_file_name + + * xfs/bsd/xfs/xfs_locl.h (osf): add forward declaration of struct + vop_generic_args + +2000-05-07 Love <lha@s3.kth.se> + + * xfs/bsd/xfs_dev-common.c (xfs_cursig): osf glue + (xfs_message_rpc, xfs_devread): use xfs_cursig + * xfs/bsd/xfs_message.c (xfs_message_invalidnode): osf compat for + v_writecount + * xfs/bsd/xfs_dev-common.c (xfs_message_rpc): osf compat with + P_WEXIT + * lwp/make-process.o.sh.in (HOST_CPU): use globing for alpha + * configure.in (osf): enable to use a specific build-tree + +2000-05-07 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (fcache_create_file): unlink the (potential) + extra directory + (fcache_recover_state): bump current_vnodes + + * xfs/bsd/xfs_dev-common.c (xfs_message_rpc): set catch correctly + + * xfs/linux/xfs_dev.c (xfs_devopen, xfs_devclose, xfs_devread, + xfs_devwrite, xfs_devpoll): do lock and unlock kernel. the new + world order requires us to do the locking here ourselves. this + should not be a problem with older kernels, since we should be + able to call lock_kernel with the kernel already locked. + +2000-05-06 Assar Westerlund <assar@sics.se> + + * appl/fs/fs.c (listcells_cmd): try to correct usage + (afs_listcells): cells begin with one, not zero + +2000-05-02 Love <lha@s3.kth.se> + + * xfs/winnt/src/xfs_deb.c (xfs_log): new version + * tests/ga-test.c: make things arg_mandatory so they can be + automagicly matched + +2000-05-02 Love <lha@s3.kth.se> + + * Release 0.33 + +2000-05-01 Harald Barth <haba@pdc.kth.se> + + * appl/lib/Makefile.in: ln -s gets upset if the (target) file + exists + + * lib/acl/Makefile.in: removed roken_rename.h rule. + +2000-05-01 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_message.c (xfs_message_installnode): if installing + on a positive dentry that already has the inode that we're + installing, set the dentry to valid. + + * xfs/bsd/xfs_vfsops-*bsd.c: use standard locking for dead vnodes + * xfs/bsd/xfs_wrap-bsd.c (xfs_mod): print assigned numbers + + * appl/amon/Makefile.in (AMON_LIBS): re-order X libraries + +2000-05-01 Love <lha@s3.kth.se> + + * configure.in: dectect netbsd1.4.2 and build everything static + * INSTALL: note on netbsd1.4.2 + +2000-04-30 Love <lha@s3.kth.se> + + * xfs/linux/xfs_dev.c (xfs_fops): use new style struct init + (*): break long lines + + * xfs/linux/xfs_inodeops.c (xfs_dentry_operations): + s,d_validate,d_revalidate, + +2000-04-30 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c: correct some debug print update to new StoreData + (add_to_invalidate): remove if already there + * rxdef/fs.xg (StoreData): does not actually return a callback + + * xfs/linux/xfs_inodeops.c (xfs_dentry_operations): use new-style + struct initialization + (xfs_readdir): print more errors + * xfs/linux/xfs_vfsops.c (xfs_sops): use new-style struct + initialization + + * arlad/messages.c (xfs_message_rename): install data for child + directory when needed + * arlad/inter.c (cm_rename): if we're moving a directory between + two directories, we need to fixup `..' + * lib/bufdir/fdir.c (fdir_changefid): remove unused argument + * tests/rename5.c: new test + +2000-04-29 Assar Westerlund <assar@sics.se> + + * cf/check-kerberos.m4: change include order when testing for krb5 + compat + + * configure.in: check for old libkafs + * appl/afsutils/klog.c (get_afs_token): optionally call + k_afslog_uid (old name for krb_afslog_uid) + + * xfs/linux/xfs/xfs_locl.h (I_BLOCKS_BITS): define + * xfs/linux/xfs_node.c (xfs_attr2inode): use >> instead of / to + calculate # of blocks to make old gcc happy + * xfs/linux/xfs_inodeops.c (update_from_cache_node): new function + to update inode when cached node has changed. call it. + +2000-04-28 Love <lha@s3.kth.se> + + * xfs/linux/bin/arla.init.in: Added support for SuSE && YaST, add + some documentation + + * xfs/winnt/inc/xfs_type.h: clearify what cpu we want (or not) + * xfs/winnt/src/sources (SOURCES): added xfs.rc + * xfs/winnt/src/xfs_vops.c: remove some warnings + * xfs/winnt/src/xfs_init.c: move around and make it work + +2000-04-28 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (add_to_invalidate): cancel the potential + sleeping beauty/beast (or invalidator) + + * xfs/linux/xfs_vfsops.c (xfs_read_super): use the LOOKUP_POSITIVE + constant instead of just `1' + * xfs/linux/xfs_syscalls.c (fhopen_call): use dentry_open for 2.3 + * xfs/linux/xfs_message.c (xfs_message_installdata): use + lookup_dentry for 2.3 now that it has been exported (in + 2.3.99pre6) + +2000-04-27 Love <lha@s3.kth.se> + + * xfs/bsd/xfs/xfs_syscalls.h: export xfs_syscall_num + * xfs/bsd/xfs_syscalls-wrap-freebsd.c (*): + s,syscall_offset,xfs_syscall_num, + * xfs/bsd/xfs_syscalls-wrap-bsd.c (*): + s,syscall_offset,xfs_syscall_num, + +2000-04-26 Magnus Ahltorp <ahltorp@nada.kth.se> + + * INSTALL: Added note about Mac OS X + + * xfs/bsd/bin/startarla.in: Added Mac OS X support + +2000-04-23 Assar Westerlund <assar@sics.se> + + * configure.in (freebsd): always add `-O' to make the xfs module + compile. See FreeBSD PR kern/17614 + +2000-04-22 Assar Westerlund <assar@sics.se> + + * configure.in (freebsd): add `-mno-fp-regs' on alpha + +2000-04-20 Assar Westerlund <assar@sics.se> + + * arlad/inter.c (cm_rename): use VenusFid_cmp when comparing old + and new parent fid so that we actually perform a full comparison + +2000-04-20 Love <lha@s3.kth.se> + + * tests/append-over-page.c: define MAP_FAILED for those whom lack + it + * configure.in: enable us to build lwp with windows threads, + pthread and asm threads on cygwin + * lwp/testlwp.c (main): do exit where approriate + * lwp/plwp.c: define and use lwp_timerclear instead of timerclear + * lwp/lock.h: clean up + * xfs/winnt/README: expand what ddk you'll need + + * xfs/winnt/README: expand what ddk you'll need + +2000-04-19 Assar Westerlund <assar@sics.se> + + * tests/mmap-shared-write.c: new test + +2000-04-19 Love <lha@s3.kth.se> + + * cf/check-kerberos.m4: changed order of exporting varibles of + krb5 and krb4 define kerberos in case we have krb5(only) too. + rewrite krb5 compat stuff, and tune to death + + * tests/mkm-rmm: use setacl and more paranoia + + * conf/CellServDB (rhic): updated + +2000-04-19 Assar Westerlund <assar@sics.se> + + * xfs/bsd/bin/startarla.in: call mknod for 128,0 if we're using an + KLD module, because that for now means FreeBSD. Since kern/9478 + has been laying waiting for over a year and since we always use + that number, we might anyways just do that. + + * tests/mmap-shared-write.c: new test + +2000-04-18 Love <lha@s3.kth.se> + + * cf/check-kerberos.m4: clean up, change order of krb5 and krb4 + test, make it work ? + +2000-04-16 Assar Westerlund <assar@sics.se> + + * lwp/make-process.o.sh.in: allow overriding of CC, GCC, CPP, and + AS + + * xfs/linux/xfs_syscalls.c (fhget_call, xfs_fh_to_dentry): change + to make up the file-handle of + (dev,inode,gen). + (fhopen_call): first cut at opening files in 2.3.99-pre5 + * xfs/linux/xfs_message.c (xfs_message_installdata): skip using + open_namei and instead do walk_init/walk_name for 2.3.99-pre5 + * xfs/linux/xfs_vfsops.c (xfs_read_super): lookup_dentry changed + in 2.3.99pre-n (for some value of n). + + * arlad/messages.c (xfs_message_remove): don't set the data token + when installing the limbo entry if data is not installed + +2000-04-14 Assar Westerlund <assar@sics.se> + + * tests/fs-sa-la: redirect output to avoid it without -verbose + * arlad/fcache.c (setacl): release the FCacheEntry if we fail + * arlad/messages.c (xfs_message_remove): don't return a bogus + error when it was actually succesful + +2000-04-13 Love <lha@s3.kth.se> + + * test/fs-sa-la: new test + + * xfs/linux/xfs_inodeops.c (xfs_follow_link): changed for + 2.3.99-pre4 + + * xfs/linux/xfs_message.c (xfs_message_installdata): changed + open_namei workings for 2.3.99-pre4 + +2000-04-12 Love <lha@s3.kth.se> + + * arlad/messages.c (xfs_message_remove): do installattr instead of + installnode now that we have disabled the warning message in + installattr. + +2000-04-03 Love <lha@s3.kth.se> + + * tests/mkm-rmm: mount-point tests + +2000-04-03 Assar Westerlund <assar@sics.se> + + * appl/pts/pts.c (*): use arlalib_try_next_db + * appl/lib/arlalib.h (arlalib_try_next_db): add prototype + * appl/lib/arlalib.c (arlalib_try_next_db): add + + * arlad/inter.c (cm_ftruncate): make sure we have the data before + truncating to non-zero length + + * arlad/fcache.c: revert the try_next_fs part of last commit + * arlad/fcache.c (stale): remove clearing of `datap', only done in + `throw_data' + (*): clarify find_first_fs - find_next_fs loop + * appl/lib/arlalib.c (arlalib_first_db): allow explicit `host' + (NULL means pick from cell-db) + + * appl/pts/pts.c: make remaining functions loop over db's. allow + all commands to use a specified db server. const-ize some. + * appl/pts/pts.c (pr_create, create_cmd): add `-owner' + * appl/pts/pts.c (*): make all arg_printusage print the + sub-command before the options + * appl/pts/pts.c (pr_create): write debug correctly + * appl/pts/pts.c (pr_create): make the handling of `id' more + obvious/correct/something + + * xfs/solaris/xfs_vnodeops.c (xfs_setattr): only send length and + mtime if we actually have data + * xfs/bsd/xfs_vnodeops-common.c (xfs_setattr_common): only send + length and mtime if we actually have data + + * xfs/linux/xfs_vfsops.c (xfs_notify_change): only send length and + mtime if we actually have data + * xfs/linux/xfs_inodeops.c (xfs_setattr): only send length and + mtime if we actually have data + + * xfs/linux/*.c: add (int) casts where required for + %.*s format strings + +2000-04-01 Assar Westerlund <assar@sics.se> + + * xfs/*/xfs_dev.c (xfs_devread): only return entire messages + + * xfs/bsd/xfs_dev-common.c: add come const-ness + (xfs_devread): print the signal that interrupted us + +2000-03-28 Assar Westerlund <assar@sics.se> + + * appl/lib/arlalib.h (db_server_context): remove synchost and + nconn + + * appl/lib/arlalib.c (arlalib_first_db, arlalib_next_db, + free_db_server_context): new functions for looping over all + database servers. From Harald Barth <haba@pdc.kth.se> + * appl/pts/pts.c (examine_cmd, pr_adduser): use arlalib_first_db, + arlalib_next_db to iterate over all db servers. + (pr_create_user): loop over db servers + * appl/lib/arlalib.h (db_server_context, arlalib_first_db, + arlalib_next_db, free_db_server_context): add + +2000-03-27 Love <lha@s3.kth.se> + + * xfs/linux/xfs/xfs_node.h (struct xfs_node): added coments + + * INSTALL: add --with-sys=dir and KERNEL_CFLAGS + +2000-03-25 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs/xfs_node.h (struct xfs_node): remove unused field + `i_ino' + + * xfs/linux/xfs_inodeops.c (xfs_readdir): ignore deleted entries + with fileno == 0 + * configure.in (solaris): add test for vfsops.vfs_freevfs + * xfs/solaris/xfs_vfsops.c (xfs_freevfs): add on solaris8 + * xfs/solaris/bin/mount_xfs.c: upgraded to be compatible with the + large changes in solaris 8 (in other words, do not print any + warnings if opening /etc/mnttab fails with ENOSYS) + + * xfs/linux/xfs_dev.c (xfs_message_rpc): print out the signal we + got interrupted by + + * tests/readdir-vs-lstat.c (verify_inodes): do not care if we're + not allowed to stat + * tests/kill-softly.c (kill_one): both possitive and negative + checks + * tests/kill-softer.c (kill_one): both possitive and negative + checks + + * configure.in: add freebsdelf* (new sysname invented by the new + version of config.guess). also add netbsdelf* + + * xfs/linux/xfs_vfsops.c (xfs_notify_change): set size for regular + files and always mtime. move down inode_setattr. + * xfs/bsd/xfs_vnodeops-common.c (xfs_setattr_common): set size on + regular files and always mtime. let `vap' have priority over + xn->attr + * xfs/solaris/xfs_vnodeops.c (xfs_setattr): always copy size and + mtime, they can be more current. only use seconds parts of mtime + time stamp. only set size on regular files. let `vap' have + priority over xn->attr + + * arlad/messages.c (xfs_message_remove): use `limbo_status' and + not the potentially bad limbo_entry->status + +2000-03-25 Love <lha@s3.kth.se> + + * xfs/linux/xfs_inodeops.c (xfs_write_file): make it work again + +2000-03-24 Marcus Sundberg <mackan@stacken.kth.se> + + * xfs/linux/xfs_dev.c: + Removed check for HAVE_STRUCT_FILE_OPERATIONS_FLUSH as it's not + defined anymore. + Changed xfs_devselect -> xfs_devpoll. + + * xfs/linux/xfs_inodeops.c: + Fix typo (generic_read_file -> generic_file_read). + Fixed warnings about unused declarations. + + * xfs/linux/xfs_load.c: + Need to unregister_filesystem() if we can't register xfs0 device. + +2000-03-24 Love <lha@s3.kth.se> + + * xfs/linux/xfs_inodeops.c: move functions around to make blocks + of !LINUX2_3 code, start to use generic_file_{read,write} for + linux 2.3, added more comment headers + + * configure.in: removed test for getattr and setattr for linux + +2000-03-24 Assar Westerlund <assar@sics.se> + + * tests/append-over-page.c: new test + + * xfs/bsd/bin/mount_locl.h: add "xfs" for Darwin/MacOS X, and do + #error if MOUNT_XFS is not defined + * xfs/bsd/Makefile.in (xfs_vopdefs.h): generate from vnode_if.h + instead of vnode_if.src + (which might not always be present) + + * xfs/bsd/xfs_vfsops-bsd.c (xfs_fhlookup): initialize the vm + object on Darwin/MacOS X + +2000-03-24 Magnus Ahltorp <ahltorp@nada.kth.se> + + * lwp/process.m68k.S: Remove bogus .globl Added _C_LABEL around + PRE_Block + +2000-03-24 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_node-bsd.c (xfs_cnp_init): handle the different hash + function used on Darwin/MacOS X + + * xfs/bsd/xfs_dev-bsd.c (xfs_install_device): create devfs nodes + for Darwin/MacOS X. also remove them in xfs_uninstall_device + +2000-03-22 Love <lha@s3.kth.se> + + * xfs/bsd/xfs_syscalls-wrap-bsd.c: + s,HAVE_SYS_LKMNOSYS,HAVE_KERNEL_SYS_LKMNOSYS, + +2000-03-21 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_dev-bsd.c (xfs_install_device): return error if + installing cdev fails + +2000-03-21 Love <lha@s3.kth.se> + + * xfs/bsd/xfs_dev-bsd.c (xfs_uninstall_device): cdevsw_remove + return the entry it operated on or -1. + +2000-03-18 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/bsd/*.c, xfs/bsd/xfs/*.h: More MacOS stuff + + * xfs/bsd/xfs/xfs_wrap.h, xfs/bsd/xfs_info.c, + xfs/bsd/xfs_vfsops-macos.c: Added file + +2000-03-20 Assar Westerlund <assar@sics.se> + + * appl/udebug/udebug.c: add `-long' mode. based on a patch from + Dr A V Le Blanc <LeBlanc@mcc.ac.uk> + + * tests/run-tests.in: replace date +%s with date + +%Y-%m-%d-%H-%M-%S + +2000-03-19 Love <lha@s3.kth.se> + + * xfs/linux/xfs_inodeops.c: major cleanup of operations struct's + + * tests/kill-softly.c: removed unused varible + + * xfs/linux/xfs/xfs_locl.h: implement DECLARE_FSTYPE for linux + pre-2.3 add XFS_RESET_I_MAPPING + + * xfs/linux/xfs_vfsops.c (xfs_{get,put}_super): + MOD_{INC,DEC}_USE_COUNT is done i vfs now + + * xfs/linux/xfs_load.c (xfs_fs_type): use DECLARE_FSTYPE + + * xfs/linux/xfs_message.c (xfs_message_installdata): use + __open_namei for 2.3.99, set i_mapping for the xfs-node, clean + printf's + (xfs_message_invalidnode): clean i_mapping when loosing node + + * xfs/linux/xfs_inodeops.c (xfs_readlink): implement with + page_readlink i 2.3 + (xfs_follow_link): implement with page_follow_link i 2.3 + (*): clean up + (xfs_readdir): implement readdir with buffer-cache in 2.3 + (xfs_as_*): Opps when called + + * tests/run-tests.in: added date to tmpdir + + * xfs/linux/xfs_vfsops.c (xfs_statfs): update header + +2000-03-18 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs/xfs_locl.h (xfs_set_vp_size): introduce a generic + macro for setting the size of a vnode. use it. + * xfs/bsd/xfs_message.c (xfs_message_installdata): call + uvm_vnp_setsize with UVM + * xfs/bsd/xfs_vnodeops-bsd.c (cleanup_cnp): add FREE_ZONE for + macosx. add xfs_pagein and xfs_pageout. add some more ifdefs and + debugs + * xfs/bsd/xfs_vfsops-bsd.c (xfs_dead_lock): add hopefully the + minimal amount of locking required for dead nodes + * xfs/bsd/xfs_dev-common.c (xfs_message_rpc): handle the special + case of the process cleaning up, in that case we cannot catch + signals while sleeping + * xfs/bsd/xfs_dev-bsd.c (xfs_uninstall_filesys): add debug print + * xfs/bsd/xfs_common-bsd.c (xfs_alloc, xfs_free): use MALLOC and + FREE, they exist everywhere + + * tests/mmap-vs-read.c, tests/mmap-vs-read2.c: new tests + * tests/exit-wo-close.c: new test + * tests/dd: avoid running test if there's no /dev/zero + +2000-03-18 Love <lha@s3.kth.se> + + * configure.in: Added test for vfsops.vfs_done + + * xfs/bsd/xfs_vfsops-netbsd.c (xfs_vfsops): added vfs_done field + (xfs_done): added + + * conf/CellServDB (postech.ac.kr): updated + +2000-03-18 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/bsd/*.c: Change all %p to %lx + +2000-03-17 Assar Westerlund <assar@sics.se> + + * rx/rx.h: use rxgencon.h. + * ydr/output.c (generate_server_switch): return RXGEN_OPCODE if an + unknown opcode is received. From David Sanderson + <david@transarc.ibm.com> + + * tests/apwd.c: new file + * tests/Makefile.in: add apwd + +2000-03-16 Assar Westerlund <assar@sics.se> + + * configure.in: call AC_BSD_HEADER_VNODE_IF_H and remove old code + for setting VNODE_IF_H + + * xfs/bsd/Makefile.in (MODULE_OBJS): use @VNODE_IF_H@ + * configure.in (VNODE_IF_H): set and subst + +2000-03-16 Love <lha@s3.kth.se> + + * appl/afsutils/klog.c (main): alway set KRBTKFILE + From Chris Wing + + * conf/CellServDB (src.uchicago.edu): updated + (rhic): updated + +2000-03-15 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_syscalls-wrap-freebsd.c + (install_first_free_syscall): try_install_syscall returns 0 on + success + (from xfs_syscalls-wrap-bsd.c:1.6) + + * arlad/solaris-subr.c (flushbuf): always use `struct dirent64' + +2000-03-13 Magnus Ahltorp <ahltorp@nada.kth.se> + + * configure.in: Set MODLOAD/MODUNLOAD in BSD. More MacOS + stuff. Include sys/time.h when including sys/proc.h. + + * xfs/bsd/Makefile.in: Use the autoconf variable MODLOAD + +2000-03-11 Love <lha@s3.kth.se> + + * appl/afsutils/*: Fixes by Chris Wing + + * lib/roken/getarg.[ch]: Chris Wing's arg_generic_string patch + + * xfs/include/xfs/xfs_messsage.h: cygwin glue + +2000-03-11 Magnus Ahltorp <ahltorp@nada.kth.se> + + * (install_first_free_syscall): try_install_syscall returns 0 on + success + +2000-03-10 Assar Westerlund <assar@sics.se> + + * Release 0.32 + +2000-03-10 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_vfsops.c (xfs_statfs): in 2.3.51, `struct statfs' + should not be copied to user-space, it's done by vfs_statfs + instead + + * arlad/fcache.c (getacl, setacl): store the retrieved status in + the fcache entry + + * arlad/messages.c (xfs_message_remove): work-around problems with + silly-flag + (xfs_message_rmdir, xfs_message_rename): try do dir_remove_name + + * arlad/solaris-subr.c (dir_remove_name): use an maximal d_reclen + of DIRBUF. + + * appl/fs/fs.c (internal_mp): always follow symlinks when calling + pioctl + + * arlad/solaris-subr.c (dir_remove_name): using a too large + d_reclen is bad because readdir() can't cope with it being larger + than the buffer size that's being used by opendir/readdir. so + let's take DIRBUF (defaulting to 1048) as a conservative estimate + + * xfs/solaris/xfs_dev.c (xfs_chpoll): always initialize return + values. print correct function name in debug output. + +2000-03-07 Assar Westerlund <assar@sics.se> + + * rxkad/compat.c: merge from krb4: fix incompatible protos + * xfs/linux/Makefile.in (SHARED_LIBS): set unconditionally to + libgetcwd.so. We assume that there's always a getcwd. based on a + bug report by Dave Morrison <dave@bnl.gov> + + * arlad/messages.c (xfs_message_remove): move up the setting of + the silly flag to before get_attr, otherwise that call might fail. + +2000-03-07 Love <lha@s3.kth.se> + + * util/log.c (log_open): when not finding the log, return NULL + * arlad/arladeb.c (arla_loginit): fail when there is no valid log + +2000-03-06 Love <lha@s3.kth.se> + + * xfs/linux/xfs_load.c (init_xfs_fs): no code after ret + +2000-03-04 Magnus Ahltorp <ahltorp@nada.kth.se> + + * configure.in, lib/roken/signal.c, xfs/rhapsody/Makefile.in, + xfs/rhapsody/xfs_wrap.c, xfs/rhapsody/xfs/kernelServer.h: Mac OS + support + +2000-03-04 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_vfsops.c (make_dead_vnode): set `i_fop' on 2.3.x + * xfs/linux/xfs_inodeops.c: fix up opreations vectors + * xfs/linux/xfs_node.c (xfs_iget): conditionalize setting of + `i_fop' + * xfs/linux/xfs_node.c (xfs_iget): set inode->i_fop + * xfs/linux/xfs_message.c (xfs_message_installdata): set mapping + of the node to be that of the cache node. + * xfs/linux/xfs_inodeops.c: adapt for 2.3.x (add address_space and + other stuff) + + * xfs/linux/xfs_inodeops.c (xfs_release_file): consider the vnode + as dirty if the cache node is + + * xfs/linux/xfs_inodeops.c (xfs_release_file): make debug prints + correct. don't invalidate pages on 2.3.x + + * xfs/linux/xfs_message.c (xfs_message_installnode): use + full_name_hash - always works now + * xfs/linux/xfs_inodeops.c: unifdef some + * xfs/linux/getcwd.c: unifdef -UHAVE_STRUCT_NEW_STAT + * configure.in (linux): remove unused tests + + * xfs/linux/bin/mount_xfs.c: new program + * xfs/linux/bin/Makefile.in: add mount_xfs. + (clean): remove arla and not arla.init + * xfs/linux/xfs_vfsops.c (xfs_read_super): make reading of minor + device number work correctly + * xfs/linux/xfs_vfsops.c (xfs_root): look at minor number + (xfs_read_super): make into three arguments. look at data if != NULL. + (xfs_put_super): look at minor number + * xfs/linux/xfs_dev.c (xfs_devread, xfs_devwrite, xfs_devselect): + look at the minor device + (xfs_print_sleep_queue): print sleep queues for all minor devices + + * xfs/linux/xfs_load.c (xfs_read_super): remove conditional + * configure.in (AC_LINUX_FUNC_READ_SUPER_FOUR_ARGS): remove. not + used any longer + +2000-03-04 Love <lha@s3.kth.se> + + * arlad/arla.c: add checkservers to testmode + +2000-03-02 Love <lha@s3.kth.se> + + * conf/CellServDB (ir.stadford.edu): renumber networks. + + * ydr/output.c (encode_string): make it alway not fail in the + DECODE_RX case + +2000-03-01 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_inodeops.c (xfs_getattr, xfs_setattr): implement + (xfs_write_file): set inode attributes even on 2.3 + + * configure.in: test for inode_operations.default_file_ops + * configure.in (linux): test for super_operations.notify_change + * configure.in (linux): test for 2.3x getattr and setattr + + * xfs/linux/xfs_vfsops.c (xfs_delete_inode): always clear the + inode + +2000-03-01 Love <lha@s3.kth.se> + + * xfs/linux/bin/Makefile.in (install): create @sysconfdir@ from + Tino Schwarze <tino.schwarze@informatik.tu-chemnitz.de> + +2000-02-29 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_node-bsd.c (xfs_cnp_init): let it make some sense + (xfs_dnlc_enter_name): use `xfs_cnp_init' + +2000-02-28 Assar Westerlund <assar@sics.se> + + * xfs/solaris/xfs_vnodeops.c (xfs_rename): ignore errors if we + fail to remove the `new' file + (xfs_rmdir): remove the directory from the dnlc + + * tests/rename3: new test + + * xfs/linux/xfs_syscalls.c (xfs_debug_print): print # of nodes + with XDEBNODE and no node + +2000-02-26 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (getvolstat): if RXAFS_GetVolumeStatus does not + actually return a volume name, get it from the vldb instead + +2000-02-26 Assar Westerlund <assar@sics.se> + + * Release 0.31 + +2000-02-26 Assar Westerlund <assar@sics.se> + + * xfs/solaris/xfs_node.c (xfs_dnlc_lookup): always return the node + holded + * xfs/solaris/xfs_syscalls.c: more debug prints + * xfs/solaris/xfs_vnodeops.c (xfs_lookup): don't hold, already + done by dnlc_lookup + (xfs_remove): remove dnlc entry for non-existant node + * xfs/solaris/xfs_message.c (xfs_message_installdata): always + clear dnlc if XFS_INVALID_DNLC + (gc_vnode): prune dnlc when count <= 1 -> hopefully it will relase + nodes + +2000-02-24 Assar Westerlund <assar@sics.se> + + * configure.in (openbsd): use the same make magic as netbsd + * xfs/bsd/xfs_vnodeops-common.c (xfs_inactive_common): don't send + any message to the daemon. recycle the node immediately if it's + not valid. + * xfs/bsd/xfs_message.c (xfs_message_invalidnode): only send + message on last close. only invalidate name cache for children. + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_eopnotsupp, xfs_returnzero): + print name of operation + + * xfs/linux/xfs_vfsops.c (xfs_delete_inode): always queue + inactivation + * xfs/linux/xfs_dev.c (xfs_queue_inactive): remove `chan' + * xfs/linux/xfs_dev.c (xfs_queue_inactive, + xfs_empty_inactive_queue): take `xfs_channel *' instead of `int' + * xfs/linux/xfs_dev.c (xfs_empty_invalid_queue): rename to + xfs_process_inactive_queue + (xfs_empty_invalid_queue): new function to throw away nodes + (xfs_devclose): call xfs_empty_invalid_queue + * xfs/linux/xfs/xfs_common.h (XFS_MEM_XFSCACHE): remove, not used + any longer + * xfs/linux/xfs_common.c (xfs_tell_alloc): use printk consistenly + * xfs/linux/xfs_inodeops.c (xfs_create, xfs_symlink, xfs_mkdir): + set the gid + * xfs/bsd/bin/startarla.in: add `-z' to arlad to be conservative + * configure.in: add testing for int16 and u_int16 + * xfs/bsd/xfs_wrap-bsd.c (xfs_mod): add prototype (warn-hunting) + * xfs/bsd/xfs_vnodeops-common.c (xfs_symlink_common): extra const + (more warning-hunting) + * xfs/bsd/xfs_vfsops-common.c (xfs_unmount_common): move out + doforce as part of warning hunt + +2000-02-20 Assar Westerlund <assar@sics.se> + + * xfs/bsd/xfs_vnodeops-osf.c (xfs_getpage): make it build on OSF5 + * xfs/bsd/xfs_vfsops-osf.c (xfs_fhtovp): try to handle both + U_FD_SET and u_set_fe + * xfs/bsd/xfs/xfs_fs.h: rename pag_t -> xfs_pag_t try to handle + OSF that has `struct mount.m_info' instead of `m_data' + * configure.in (osf): add test for ubc_lookup + * configure.in (bsd): check for `struct mount.m_info' + * configure.in: separate kernel_CFLAGS into kernel_CFLAGS and + kernel_CPPFLAGS + * configure.in: conditionalize <sys/cdefs.h> + * configure.in (osf): cpus.h does not exist in all versions of + OSF. try inet.h instead. + +2000-02-16 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs/xfs_node.h (xfs_node): add `invalid_list' + * xfs/linux/xfs_vfsops.c (xfs_delete_inode): if we fail to send an + inactive node message + (typically, because of out of memory), clear the node and add it to + the inactive list + * xfs/linux/xfs_node.c (new_xfs_node): initialize `invalid_list' + (clear_xfs_node): does all that free_xfs_node does except the actual + freeing + * xfs/linux/xfs_inodeops.c (xfs_d_init): check xfs_alloc for + failure. changed into returning error. change callers. + * xfs/linux/xfs_dev.c (xfs_channel): add `invalid_list' + (xfs_queue_invalid, xfs_empty_invalid_queue): new functions for adding + nodes to the list that should be invalidated and to iterate over + the list and invalidate + * xfs/linux/Makefile.in (unload): add target + + * lwp/iomgr.c (IOMGR): retry also when the error code from select + is ENOMEM (this can happen on linux) + +2000-02-16 Love <lha@s3.kth.se> + + * xfs/linux/xfs/xfs_common.h (xfs_alloc,xfs_free): new prototypes + + * xfs/linux/xfs_common.c (xfs_alloc,xfs_free): use constant for + xfs_{allocs,frees} + + * xfs/linux/bin/arla.init.in (start): don't fail when insmod + succeed, from "Krysak, Tony" <tony.krysak@lmco.com> + +2000-02-15 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (fs_downp): new function for figuring out if the + return code means that this fs should be mark as down + (find_next_fs): new parameter if the previous connection should be + disabled + * xfs/linux/Makefile.in (load): create a map file + +2000-02-14 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c: remove lots of bogus assert's remove trailing \n + from arla_log fix some leaking of fcache entries add some missing + post-conditions + (fcache_realfid): also do the mount-point thing for (1,1) + (get_root_of_volume): add parent reference to child volume + * arlad/volcache.c (getbyid, getbyname): new static functions + (*): set and use vol_refs + (volcache_recover_state): find and set parent pointers + (volcache_invalidate_ve): new function + (volcache_volref, volcache_volfree): new functions for manipulating + vol_refs remove trailing \n from arla_log + * arlad/volcache.h (volcacheentry): add `vol_refs' and `parent' + (VOLCACHE_VERSION): bump + add new prototypes + + * arlad/bsd-subr.c (dir_remove_name): make the loop-invariant more + correct. + +2000-02-12 Assar Westerlund <assar@sics.se> + + * arlad/subr.c (dentry2ino): fix typo in looking for root of a + volume + + * arlad/messages.c (xfs_message_remove): set silly flag after + fetching attributes + + * appl/asrvutil/Makefile.in: s/KRB_INC_FLAGS/KRB4_INC_FLAGS/ + * xfs/solaris/bin/Makefile.in: + s/KRB_{INC,LIB}_FLAGS/KRB4_{INC,LIB}_FLAGS/ add Makefile-rule + + * arlad/solaris-subr.c: start using the generic function in subr.c + * arlad/subr.h (write_dirent_args): use `off64_t' if it exists to + help solaris. We might be able to define and use the maximal int + type instead? + * configure.in (off64_t): test for + + * appl/lib/Makefile.in (arladeb.c): sprinkle srcdir to help + not-so-bright makes + + * cf/check-kafs.m4: add Id. remove duplicate -L + + * arlad/conn.c (re_probe): don't assert that `e' is dead. it + might have woken up + (print_conn, conn_status): remove trailing \n from arla_log + * arlad/fprio.c (fprio_status): remove trailing \n in arla_log + * arlad/cred.c (cred_status, print_cred): remove trailing \n from + arla_log + +2000-02-07 Love <lha@s3.kth.se> + + * conf/CellServDB (cs.wisc.edu): updated + +2000-02-05 Love <lha@s3.kth.se> + + * arlad/messages.c (xfs_message_rmdir): remove superflous + fcache_release (dir_entry); + (xfs_message_remove): same as above + +2000-02-04 Assar Westerlund <assar@sics.se> + + * rx/rx.c (rxi_FindConnection): remember to update the peer in + `connection' when we discover that the corresponding host has + moved + +2000-02-04 Love <lha@s3.kth.se> + + * xfs/linux/bin/arla.init.in (start): don't probe for xfs.o + +2000-02-03 Love <lha@s3.kth.se> + + * xfs/linux/bin/Makefile.in (install): do ; right + +2000-02-02 Love <lha@s3.kth.se> + + * xfs/linux/bin/Makefile.in (arla.init): don't write over local + changes + + * arlad/fcache.c (do_read_attr): move out silly test + (bulkstat_help_func): check also if the rights is cached for this pag + and if node is uptodatep(), don't save the names if we aren't + going to use them. + (get_attr_bulk): added locking protocol, make sure names are free:ed + when needeed, make sure fs_server_context is free:ed, break out + updating of in-core node updating of install to kernel loop. + (fcache_get_attr): make sure node is uptodate too, add check for + silly rename, make sure we do the right thing with ``parent'', + merge with get_entry + (get_entry): remove + +2000-01-30 Assar Westerlund <assar@sics.se> + + * xfs/linux/xfs_inodeops.c (xfs_write_file): move debug prints + inside the relevant ifdefs. remove commented-out and way old page + invalidation + + * lib/ko/gensysname.c (printsysname): add ko.h to get rid of a + warning + +2000-01-30 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/linux/xfs/xfs_locl.h, xfs/linux/xfs/xfs_common.h, + xfs/linux/xfs_inodeops.c, xfs/linux/xfs_dev.c, + xfs/linux/xfs_common.c: Drop Linux 2.0 support + +2000-01-29 Love <lha@s3.kth.se> + + * xfs/linux/xfs_cache.c: removed file + + * xfs/linux/Makefile.in (MODULE_SRCS): remove xfs_cache.c + + * xfs/linux/xfs_load.c: remove linux 2.0-ism + + * xfs/linux/xfs_syscalls.c: remove linux 2.0-ism + + * xfs/linux/xfs_vfsops.c: remove linux 2.0-ism + + * arlad/{arla.c,messages.c,conn.[ch]):use conn_rxkad_level instead + of rxkad_min_level + + * xfs/linux/xfs_inodeops.c: remove 2.0-ism + + * arlad/inter.c (*): changed to use new fcache_get_attr + + * arlad/messages.c (*): changed to use new fcache_get_attr + + * arlad/fcache.h (fcache_get_attr): new style + + * arlad/fcache.c (fcache_bulkstatus_num): number of nodes to + bulkstatus + (get_attr_bulk): rename function, don't insert into kernel default + (fcache_get_attr): change funtion to do bulkstatus if needed, do + dynroot stuff here too. + (bulkstat_help_func): check if the node is already cached + + * tests/compare-inum-mp: set the rights bits on the directory + before creating the mountpoint + +2000-01-26 Love <lha@s3.kth.se> + + * xfs/linux/xfs_inodeops.c (xfs_*lookup): removed 2.0-ism, at + least its the same om 2.3.40 and 2.3.12+ + + * arlad/messages.c (xfs_message_rmdir,unlink): be more carefull + when releasing dir_entry. (this was fixed in the 0.29 branch but + never pulled up) + + * xfs/linux/xfs_message.c (xfs_message_installattr): send a + inactive node if we failed + + * conf/arla.spec.in: believed to work spec file for rpm's + + * conf/Makefile.in: added spec file + + * tests/read-vs-mmap.c: test both all-zeros and random bytes + +2000-01-26 Marcus Sundberg <mackan@stacken.kth.se> + + * xfs/linux/xfs_inodeops.c: fix typos + +2000-01-25 Assar Westerlund <assar@sics.se> + + * cf/check-kernel-var.m4: try to actually use the variable tested + for so that this doesn't get optimized away by the compiler + +2000-01-25 Love <lha@s3.kth.se> + + * xfs/linux/Makefile.in (doclean): remove libgetcwd.so + + * configure.in (linux): test for bmap and smap + + * xfs/linux/xfs_inodeops.c: add some rough linux2.3 support, at + least it does crash now. remove 2.0 code need some better + autoconf test, assume 2.3.40 + + * xfs/linux/xfs_message.c: removed linux 2.0 code and fixed + printing of pointers + +2000-01-24 Love <lha@s3.kth.se> + + * conf/CellServDB: added ops.mit.edu + + * xfs/linux/bin/Makefile.in (install): added missing ; and \ and + removed osf/1-ism + +2000-01-23 Assar Westerlund <assar@sics.se> + + * configure.in: use AC_PROG_CC_FLAGS + +2000-01-23 Love <lha@s3.kth.se> + + * xfs/linux/{xfs_syscalls.c,xfs/xfs_locl.h}: setgroups32 patches + from Chris Wing <wingc@engin.umich.edu> + + * *{,*/*}{,/*}/Makefile.in: s,KRB_,KRB4_, + + * xfs/linux/Makefile.in (getarg.o): no -fPIC since it doesn't + work, _syscall2 uses bx. + + * xfs/linux/bin/arla.init.in: added linuxconf glue + + * xfs/linux/bin/Makefile.in (sysconfdir): added + + * configure.in: use new macron for finding kerberos and kafs + + * cf/check-kafs.m4: more generic way of finding kafs + + * cf/check-kerberos.m4: more generic way of finding kerberos + +2000-01-22 Love <lha@s3.kth.se> + + * xfs/linux/Makefile.in (getcwd.o): use -fPIC when compiling, its + supposted to be faster acording to Greg Stark <gsstark@mit.edu> + + * xfs/linux/bin/arla.init.in: try to use modprobe + + * arlad/inter.c (cm_getattr): make sure if we have attributes that + we have rights for the user too + + * xfs/bsd/bin/Makefile.in (install): fix typo, noticed by matt + <deberg@mit.edu> + +2000-01-21 Love <lha@s3.kth.se> + + * xfs/linux/xfs_inodeops.c (xfs_readdir): warning if cache file is NULL + (xfs_do_readlink): warning if cache file is NULL + +2000-01-20 Love <lha@s3.kth.se> + + * arlad/arla.c (main): check that we have a dbserver then running + in -t + +2000-01-19 Love <lha@s3.kth.se> + + * Release 0.30 + +2000-01-18 Love <lha@s3.kth.se> + + * ydr/parse.y (enumentries,enumbody): patch for automatic + numbering from idea of Derrick J Brashear <shadow@dementia.org> + +2000-01-17 Love <lha@s3.kth.se> + + * tests/test-parallel1.c,tests/parallel1: create/chmod/unlink a + file in 10 worker threads. + + * arlad/messages.c (xfs_message_remove): remember to set dir_entry + to NULL. + + * arlad/messages.c (xfs_message_remove): don't release dir_entry + when it's not used + (viocsetacl): remove unused label + + * appl/fs/fs.c (afs_setacl): don't try to follow pointers when + counter is 0 + + * arlad/messages.c (viocsetacl): install the attributes when + successful. + + * arlad/fcache.c (setacl): return the fcache entry when + successful, remove the break_callback (its up to the caller (like + rest of the code do it like this)) + + * arlad/messages.c (xfs_message_remove): fixa + remove-mountpoint-problem by doing operations in diffrent + order. The problem is that the node still was in the namecache, + and the we got a SoftAssert (on linux). + +2000-01-16 Assar Westerlund <assar@sics.se> + + * rxkad/rxk_crpt.c: more here endian-ness tests from acconfig.h + * acconfig.h: remove endian-ness defines. they cause troubles be + being here and are only used in rxkad anyways + + * xfs/bsd/xfs_vnodeops-bsd.c (xfs_readdir): unify much more + * xfs/bsd/xfs_node-bsd.c (xfs_dnlc_lookup): remove extra unused + variables + + * xfs/bsd/Makefile.in (vnode_if.h): handle vnode_if.h hiding in + ../sys/vnode_if.h + +2000-01-16 Love <lha@s3.kth.se> + + * lwp/Makefile.in: added dependency for rw.o (by Derrick J + Brashear <shadow+@andrew.cmu.edu>) + +2000-01-07 Assar Westerlund <assar@sics.se> + + * lwp/make-process.o.sh.in: add -DASSEMBLER when running cpp + * acconfig.h: don't look for endianess information in + <sys/param.h> when assembling + + * acconfig.h: new ifdef-code to handle KRB_C_BIGENDIAN + * configure.in: replace AC_C_BIGENDIAN with KRB_C_BIGENDIAN + * cf/krb-endian.m4: better endian-ness. stolen from Heimdal. + + * xfs/bsd/xfs_vfsops-bsd.c (xfs_fhtovp): should send `mode' and + not `flags' to VOP_ACCESS. Thanks to <tol@stacken.kth.se> for + debuggning help + + * arlad/messages.c (xfs_message_putdata): set correct error in + wakeup + + * rxkad/rxk_clnt.c (rxkad_NewClientSecurityObject): make sure bit + 31 is not set in the epoch. this bit is used by rx to mean that + we should only match on connection-id and that means we never get + any port number updates when using NAT. + + * rx/rx.c (rxi_HasActiveCalls, rxi_FindService, rxi_DestroyPeer, + rxi_FindConnection, rxi_CheckCall, rxi_DecongestionEvent, + rxs_Release): static-ize + (rxi_RemovePeer, rxi_InsertPeer, rxi_ChangePeer): new functions + + (rxi_FindConnection): only match based on host not port. change saved + port if it changes. This allows much smoother function when + behind a NAT. These devices from hell usually have a very short + timeout on UDP `sessions' and will assign you a new port without + you noticing. + +2000-01-07 Love <lha@s3.kth.se> + + * xfs/solaris/Makefile.in (load): don't remove the load tree since + savecore needs it. + +Fri Jan 7 11:36:25 2000 Magnus Ahltorp <ahltorp@nada.kth.se> + + * xfs/linux/{xfs_message.c,xfs_inodeops.c,/xfs/xfs_common.h}: + New installnode code + +2000-01-07 Love <lha@s3.kth.se> + + * xfs/solaris/xfs_dev.c (xfs_message_receive): add support for + XFS_MSG_{VERSION,GC_NODE} + + * xfs/solaris/xfs/xfs_msg_locl.h(xfs_message_{gc_nodes,version}): + add prototypes + + * xfs/solaris/xfs_message.c (xfs_message_{gc_nodes,version}): + implement + (gc_vnode): try to gc a node + + * xfs/solaris/Makefile.in (AFS,mount,unmount): where we should + mount afs + +2000-01-05 Assar Westerlund <assar@sics.se> + + * arlad/fcache.c (fcache_get): take care to (re-)initialize all + fields when re-using an entry + + * tests/generic-build: add an optional argument that specifies + what the directory will be called for tarbolls where it's not the + same as the file name without .tar.gz + + * lwp/lock.h: introduce a new cpp symbol LOCK_TRACE that keeps + track in the lock of where (file and line) it was locked. add + support to the locking macros. remove some unused (and notdef) + code. + +2000-01-02 Assar Westerlund <assar@sics.se> + + * configure.in (CFLAGS): more warnings + (freebsd3): test for vnode_if.pl and vnode_if.sh properly + + * xfs/bsd/Makefile.in (vnode_if.h): fix the tests for if the file + exists + + * lwp/make-process.o.sh.in: link the candidate assember file to + process.S before trying to assemble it + +2000-01-02 Love <lha@s3.kth.se> + + * lwp/Makefile.in(PROCESS_S): spelled .S + + * lwp/make-process.o.sh.in(PROCESS_S): spelled .S + + * (Makefile.in,make-process.o.sh.in,lwp_elf.h,process.aix22.S, + process.alpha.S,process.hpux.S,process.i386.S,process.ibm032.S, + process.m68k.S,process.mips.S,process.patch.S,process.ppc.S, + process.rios.S,process.sparc.S,process.vax.S): split (and remove) + process.S to diffrent arch-files, add ELF support for 68k + +For older ChangeLog entries see ChangeLog.1999 diff --git a/usr.sbin/afs/src/appl/bos/bos.8 b/usr.sbin/afs/src/appl/bos/bos.8 new file mode 100644 index 00000000000..d68bced95b3 --- /dev/null +++ b/usr.sbin/afs/src/appl/bos/bos.8 @@ -0,0 +1,327 @@ +.\" Copyright (c) 2000 Kungliga Tekniska Högskolan +.\" $KTH: bos.8,v 1.4 2000/08/30 06:27:00 lha Exp $ +.Dd Aug 29, 2000 +.Dt BOS 1 +.Os Arla +.Sh NAME +.Nm bos +.Nd is the client part of the Basic overseer daemon that manage AFS server processes. +.Sh SYNOPSIS +.Nm bos addhost +.Nm bos addkey +.Nm bos adduser +.Nm bos create +.Nm bos delete +.Nm bos exec +.Nm bos getdate +.Nm bos getlog +.Nm bos getrestart +.Nm bos install +.Nm bos listhosts +.Nm bos listkeys +.Nm bos listusers +.Nm bos prune +.Nm bos removehost +.Nm bos removekey +.Nm bos removeuser +.Nm bos restart +.Nm bos salvage +.Nm bos setauth +.Nm bos setcellname +.Nm bos setrestart +.Nm bos shutdown +.Nm bos start +.Nm bos stop +.Nm bos uninstall +.Sh DESCRIPTION +The +.Nm +utility is the client part of the Basic overseer daemon that manage +AFS server processes. +.Pp +.Pp +Most +.Nm +commands accept the following general arguments: +.Pp +.Bd -filled -offset indent -compact +.Op Fl cell Ar cellname +Specifies which AFS cell to use, if the default cell is not to be used. +.Pp +.Op Fl noauth +Specifies that +.Nm +should not try to authenticate the connection to the server. +This may be +useful with shell scripts, or if there is a problem with the AFS cell. +Note that the server will reject many commands if +.Fl noauth +is specified. +.Pp +.Op Fl localauth +Create a ticket using the AFS server key, that is, you don't need a token. +This will generally only work on AFS servers, and is very useful for +performing automatic tasks. +.Ed +.Pp +.Nm +have several subcommands: +.Pp +.Nm +.Ic addhost +.Fl server Ar "machine name" +.Fl host Ar "host name" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +add a new +.Ar host +to the CellServDB file that is managled by the +.Ar server. This make the database server consider +.Ar host +as a peer and will use when they synchronize their databases (the +database servers) need to be restarted. +.Ed +.Pp + +.Nm +.Ic addkey +.Fl server Ar "machine name" +.Op Fl key Ar key +.Op kvno Ar "key version number" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +add a new afs-key to the KeyFile. +Add the ticket specified in +.Ar key +with +.Ar "key version number" +to the +.Ar server . +.Ed +.Pp + +.Nm +.Ic adduser +.Fl server Ar "machine name" +.Fl user Ar "user name" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +add a new user the the SuperUser file on the fileserver, this gives +the user right to manage volumes and bosserver. +.Ed +.Pp + +.Nm +.Ic create +.Fl server Ar "machine name" +.Fl instance Ar "server process name" +.Fl type Ar "server type" +.Fl cmd Ar "command lines" +.Op Fl notifier Ar "notifier program" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +Create a new service +.Ar instance +at the +.Ar server +of +.Ar type. +The instance will depending on type run the +.Ar cmd +command. +.Ed +.Pp + +.Nm +.Ic delete +.Fl server Ar "machine name" +.Fl instance Ar "server process name" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +delete the +.Ar instance +from the +.Ar server . +.Ed +.Pp + +.Nm +.Ic exec +.Bd -filled -offset indent -compact +.Fl server Ar "machine name" +.Fl cmd Ar "command to execute" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +Will execute +.Ar cmd +on the server +.Ar server . +.Ed +.Pp + +.Nm +.Ic getdate +.Fl server Ar "machine name" +.Fl files Ar "files to check" +.Op Fl dir Ar "destination dir" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +get dates for +.Ar files +in server-root directory (that can be specified with +.Ar dir +if that is needed) on +.Ar server. +.Ed +.Pp + +.Nm +.Ic getlog +.Fl server Ar "machine name" +.Fl file Ar "log file to examine" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +List the content of +.Ar logfile +that resides on +.Ar server. +.Ed +.Pp + +.Nm +.Ic getrestart +.Fl server Ar "machine name" +.Op Fl dir Ar "destination dir" +.Op Fl cell Ar cellname +.Op Fl noauth +.Op Fl localauth +.Bd -filled -offset indent -compact +Thet the restart time from +.Ar server. +.Ed +.Pp + +.Nm +.Ic install +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic listhosts +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic listkeys +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic listusers +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic prune +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic removehost +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic removekey +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic removeuser +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic restart +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic salvage +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic setauth +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic setcellname +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic setrestart +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic shutdown +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic start +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic stop +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Nm +.Ic uninstall +.Bd -filled -offset indent -compact +.Ed +.Pp + +.Sh SEE ALSO +.Xr arlad 8 , +.Xr vos 8 , +.Xr pts 1 , +.Xr fs 1 +.Sh BUGS +Quite a lot of commands are not implemented yet. diff --git a/usr.sbin/afs/src/appl/kalog/Makefile.in b/usr.sbin/afs/src/appl/kalog/Makefile.in new file mode 100644 index 00000000000..972cfd905b0 --- /dev/null +++ b/usr.sbin/afs/src/appl/kalog/Makefile.in @@ -0,0 +1,135 @@ +# $KTH: Makefile.in,v 1.7.2.1 2001/05/28 11:32:13 mattiasa Exp $ + +srcdir = @srcdir@ +top_builddir = ../.. +VPATH = @srcdir@ + +CC = @CC@ +LN_S = @LN_S@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @top_srcdir@/mkinstalldirs + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +libexecdir = @libexecdir@ +bindir = @bindir@ +mandir = @mandir@ +transform = @program_transform_name@ +EXECSUFFIX = @EXECSUFFIX@ + +APPL_BIN = kalog +MANPAGES = kalog.1 + +DEFS = @DEFS@ + +SHELL = /bin/sh + +CFLAGS = @CFLAGS@ +X_CFLAGS = @X_CFLAGS@ + +ETAGS = etags +MAKEDEPEND = makedepend +RXKADINC = -I$(srcdir)/../../rxkad +INCLUDES = -I$(srcdir)/../.. \ + -I$(srcdir)/../../include \ + -I$(srcdir)/../lib \ + -I../../include \ + -I../../rxdef \ + -I. \ + $(KERNEL_INCLUDE) \ + -I$(srcdir)/../../xfs/include \ + -I$(srcdir)/../../arlad \ + @INC_roken@ \ + $(RXKADINC) + +DEFINES = +REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) \ + $(X_CFLAGS) @PLWP_INC_FLAGS@ +RXKAD_LIBS = @MILKO_RXKAD_LIBS@ +KERNEL_INCLUDE = @KERNEL_INCLUDE@ +READLINE_lib = @LIB_readline@ +KAFS_LIBS = @AIX_EXTRA_KAFS@ @KAFS_LIBS@ +LIB_tgetent = @LIB_tgetent@ +LIBS = -L../lib -larlalib \ + -L../../rxdef -lkaclient -lrxdefclient \ + -L../../rx -lrx \ + -L../../lwp -llwp @PLWP_LIB_FLAGS@ \ + -L../../lib/ko -lko -L../../util -lutil \ + @LIB_roken@ \ + $(RXKAD_LIBS) \ + $(KAFS_LIBS) \ + $(RXKAD_LIBS) @LIBS@ + +LIBDEPENDS = ../../rxdef/librxdefclient.a ../../rx/librx.a ../../lwp/liblwp.a \ + ../../util/libutil.a ../../lib/sl/libsl.a \ + ../../lib/ko/libko.a ../lib/libarlalib.a + +PROGS = kalog +kalog_SRCS = kalog.c +SRCS = $(fs_SRCS) +kalog_OBJS = kalog.o +HDRS = + +all: $(PROGS) + +.PHONY: all install uninstall depend tags clean + +.c.o: + $(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I. $(REALCFLAGS) $< + +install: all + $(MKINSTALLDIRS) $(DESTDIR)$(bindir) + PROG_BIN='$(APPL_BIN)'; for x in $$PROG_BIN; do \ + f=`echo $$x | sed '$(transform)'`; \ + $(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/$$f; \ + done ;\ + $(MKINSTALLDIRS) $(DESTDIR)$(mandir) ; \ + MANPAGES='$(MANPAGES)'; for x in $$MANPAGES; do \ + n=`echo $$x | sed 's/\(.*\)\.[1-9a-zA-Z]*$$/\1/'`; \ + e=`echo $$x | sed 's/.*\.\([1-9a-zA-Z]*\)$$/\1/'`; \ + f=`echo $$n | sed '$(transform)'`; \ + $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$$e ; \ + $(INSTALL_DATA) $(srcdir)/$$x \ + $(DESTDIR)$(mandir)/man$$e/$$f.$$e; \ + done + +uninstall: + PROG_BIN='$(APPL_BIN)'; for x in $$PROG_BIN; do \ + f=`echo $$x | sed '$(transform)'`; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done ; \ + MANPAGES='$(MANPAGES)'; for x in $$MANPAGES; do \ + n=`echo $$x | sed 's/\(.*\)\.[1-9a-zA-Z]*$$/\1/'`; \ + e=`echo $$x | sed 's/.*\.\([1-9a-zA-Z]*\)$$/\1/'`; \ + f=`echo $$n | sed '$(transform)'`; \ + rm -rf $(DESTDIR)$(mandir)/$$f.$$e; \ + done + +kalog: $(kalog_OBJS) $(LIBDEPENDS) + $(CC) $(LDFLAGS) -o $@ $(kalog_OBJS) $(LIBS) + +Makefile: Makefile.in ../../config.status + cd ../..; CONFIG_FILES=appl/kalog/Makefile CONFIG_HEADERS= $(SHELL) config.status + +depend: $(CFILES) + $(MAKEDEPEND) -- $(REALCFLAGS) -- $^ + +tags: TAGS + +TAGS: $(SRCS) $(HDRS) + $(ETAGS) -t $(SRCS) $(HDRS) + +clean : + rm -f $(PROGS) $(OBJS) *~ *.o core *.core + +mostlyclean: clean + +distclean: clean + rm -f Makefile + +realclean: distclean + rm -f TAGS diff --git a/usr.sbin/afs/src/appl/kalog/kalog.1 b/usr.sbin/afs/src/appl/kalog/kalog.1 new file mode 100644 index 00000000000..92938c694aa --- /dev/null +++ b/usr.sbin/afs/src/appl/kalog/kalog.1 @@ -0,0 +1,27 @@ +.\" Copyright (c) 2000 Kungliga Tekniska Högskolan +.\" $KTH: kalog.1,v 1.1 2000/11/15 08:55:26 lha Exp $ +.\" +.Dd Nov 15, 2000 +.Dt kalog 1 +.Os "The Arla Project" +.Sh NAME +.Nm kalog +.Nd +A program to get AFS tokens from a ka-server +.Sh SYNOPSIS +.Nm +.Op user@cell +.Sh DESCRIPTION +.Nm +fetches afs-tokens for the +.Ar user +in +.Ar cell . +.Pp +It uses the ka-protocol to fetch the tokens, not kerberos. +.Sh SEE ALSO +.Xr kinit 1 , +.Xr aklog 1 , +.Xr kf 1 , +.Xr unlog 1 , +.Xr tokens 1 diff --git a/usr.sbin/afs/src/appl/kalog/kalog.c b/usr.sbin/afs/src/appl/kalog/kalog.c new file mode 100644 index 00000000000..9679576e1a5 --- /dev/null +++ b/usr.sbin/afs/src/appl/kalog/kalog.c @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +RCSID("$KTH: kalog.c,v 1.4 2001/01/08 16:52:36 lha Exp $"); + +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> + +#include <assert.h> + +#include <ko.h> +#include <ports.h> +#include <log.h> + +#include <arlalib.h> + +#include <ka.cs.h> +#include <des.h> +#include <krb.h> + +#include <ka-procs.h> + +#include <roken.h> +#include <err.h> + + +static void +parse_user (char *argv1, const char **user, const char **cell) +{ + char *at = strchr(argv1, '@'); + char *tmp_cell; + + if(at) { + *at = '\0'; + + *user = argv1; + at++; + tmp_cell = at; + + if(*tmp_cell != '\0') + *cell = tmp_cell; + } else { + *user = argv1; + } + +} + +int +main (int argc, char **argv) +{ + int ret; + Log_method *method; + const char *cellname; + const char *user; + + set_progname (argv[0]); + + method = log_open (get_progname(), "/dev/stderr:notime"); + if (method == NULL) + errx (1, "log_open failed"); + cell_init(0, method); + ports_init(); + + cellname = cell_getthiscell(); + + if (argc == 1) + user = get_default_username(); + else if (argc == 2) + parse_user (argv[1], &user, &cellname); + else { + fprintf (stderr, "usage: %s [username[@cell]]\n", + get_progname()); + exit (1); + } + + printf ("Getting ticket for %s@%s\n", user, cellname); + ret = ka_authenticate (user, "", cellname, NULL, 8 * 3600, + KA_AUTH_TICKET|KA_AUTH_TOKEN); + if (ret) + errx (1, "ka_authenticate failed with %s (%d)", + koerr_gettext(ret), ret); + + return 0; +} diff --git a/usr.sbin/afs/src/appl/lib/ka-procs.c b/usr.sbin/afs/src/appl/lib/ka-procs.c new file mode 100644 index 00000000000..d8c8eb37ccd --- /dev/null +++ b/usr.sbin/afs/src/appl/lib/ka-procs.c @@ -0,0 +1,627 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This file implements wrapper functions around the interfaces + * (KAA,KAT,KAM) that is available from ka-server. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +RCSID("$KTH: ka-procs.c,v 1.4.2.2 2001/10/03 22:53:44 assar Exp $"); + +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> + +#include <assert.h> + +#include <des.h> +#include <krb.h> + +#include <ko.h> +#include <ports.h> +#include <log.h> + +#include <arlalib.h> + +#include <roken.h> +#include <err.h> + +#include <service.h> + +#include <rx/rx.h> +#include <ka.h> +#include <ka.cs.h> + +#include <ka-procs.h> + +#include <kafs.h> + +/* + * The ka preauth data-blob. Used in KAA_Authenticate. Encrypted with + * des_pcbc_encrypt() and the user's key. + */ + +struct ka_preauth { + int32_t time; + char label[KA_LABELSIZE]; +}; + +/* + * Used to communicate over start and endtime of a ticket in + * KAT_GetTicket(). Encrypted with des_ecb_encrypt (for some reson) + * and the session key. + */ + +struct ka_times { + int32_t start_time; + int32_t end_time; +}; + +/* + * + */ + +static void +decode_u_int32 (u_int32_t *number, unsigned char **buf, size_t *sz) +{ + memcpy (number, *buf, 4); + *number = ntohl(*number); + *sz -= 4; *buf += 4; +} + +/* + * + */ + +static void +decode_stringz (char *str, size_t str_sz, unsigned char **buf, size_t *sz) +{ + char *s = (char *)*buf; + size_t l = strlen (s) + 1; + if (l > str_sz) abort(); + strlcpy (str, s, l); + *sz -= l; *buf += l; +} + +/* + * Decode the getticket + * + * confounder int32_t + * challange int32_t + * sessionkey byte * 8 + * start time int32_t + * end time int32_t + * kvno int32_t + * ticket length int32_t + * client name stringz + * client instance stringz + * realm ? stringz + * server name stringz + * server instance stringz + * ticket byte * <ticket length> + * label (tgsT in tgt case) byte * 4 + * padding to make sure it's on a 8 byte bondery + * + * blam heimdal authors if it's wrong + */ + +static int +decode_answer (char *label, unsigned char *buf, size_t sz, + struct ka_Answer *answer) +{ + u_int32_t confounder, kvno_int32, ticket_sz; + + assert (sz % 8 == 0); + + if (sz < 32 + 1+1+1 + 1+1) + goto fail; + + decode_u_int32 (&confounder, &buf, &sz); + decode_u_int32 (&answer->challange, &buf, &sz); + memcpy (answer->sessionkey, buf, 8); + buf += 8; sz -= 8; + decode_u_int32 (&answer->start_time, &buf, &sz); + decode_u_int32 (&answer->end_time, &buf, &sz); + decode_u_int32 (&kvno_int32, &buf, &sz); + answer->kvno = (int)kvno_int32; + decode_u_int32 (&ticket_sz, &buf, &sz); + if (ticket_sz > MAX_KTXT_LEN) + goto fail; + +#define destrz(f) decode_stringz(answer->f,sizeof(answer->f), &buf, &sz) + destrz(user); + destrz(instance); + destrz(realm); + destrz(server_user); + destrz(server_instance); +#undef destrz + + if (sz < ticket_sz) + goto fail; + + answer->ticket.length = ticket_sz; + memcpy (&answer->ticket.dat, buf, ticket_sz); + answer->ticket.mbz = 0; + sz -= ticket_sz; + buf += ticket_sz; + + if (sz < 4) + goto fail; + memcpy (answer->label, buf, 4); + sz -= 4; + buf += 4; + + if (memcmp (answer->label, label, 4) != 0) + goto fail; + + assert (sz >= 0); + + return 0; + fail: + memset(answer->sessionkey, 0, sizeof(answer->sessionkey)); + return 1; +} + +/* + * Get the the password des-`key' for `realm' (and its make sure that + * the cell is lowercase) using `password'. If `password' is NULL, the + * user is queried. + */ + +static int +get_password (const char *realm, const char *password, des_cblock *key) +{ + int ret; + char buf[1024]; + char cell[1024]; + + if (password == NULL) { + ret = des_read_pw_string (buf, sizeof(buf), "Password: ", 0); + if (ret) + return ret; + password = buf; + } + strlcpy (cell, realm, sizeof(cell)); + strlwr (cell); + + afs_string_to_key (password, realm, key); + memset (buf, 0, sizeof(buf)); + + return 0; +} + +/* + * Make sure `answer' have a good realm, or set to it `realm' + */ + +static void +fixup_realm (struct ka_Answer *answer, const char *realm) +{ + if (strcmp (answer->realm, "") == 0) { + strlcpy(answer->realm, realm, + sizeof(answer->realm)); + strupr(answer->realm); + } +} + +/* + * Authenticate `user'.`instance'@`cell' with `password' and get + * `lifetime' second long tickets. If `password' is NULL, user is + * queried for password. `flags' is used to specify behavior of the + * function. + */ + +int +ka_authenticate (const char *user, const char *instance, const char *cell, + const char *password, u_int32_t lifetime, + ka_auth_flags_t flags) +{ + des_cblock key; + ka_auth_data_t adata; + ka_ticket_data_t tdata; + struct ka_cell_query cinfo; + char filename[MAXPATHLEN]; + int ret; + int save_ticket, do_afslog = 0; + + filename[0] = '\0'; + if (cell == NULL) + cell = cell_getthiscell(); + if (instance == NULL) + instance = ""; + + memset (&cinfo, 0, sizeof(cinfo)); + + save_ticket = (flags & KA_AUTH_TICKET) == KA_AUTH_TICKET; + do_afslog = (flags & KA_AUTH_TOKEN) == KA_AUTH_TOKEN; + + ret = get_password (cell, password, &key); + if (ret) + goto out; + + ret = ka_auth (user, instance, cell, &key, &adata, lifetime, + &cinfo); + if (ret) + goto out; + + if (save_ticket) { + strlcpy (filename, tkt_string(), sizeof(filename)); + } else if (do_afslog) { + snprintf (filename, sizeof(filename), "%sXXXXXXXX", tkt_string()); + ret = mkstemp (filename); + if (ret) { + ret = errno; + goto out; + } + } + + if (save_ticket || do_afslog) { + ret = ka_auth_create (filename, &adata); + if (ret) + goto out; + } + + if (do_afslog) { + ret = ka_getticket ("afs", "", cell, &adata, &tdata, &cinfo); + if (ret) + goto out; + + ret = ka_write_ticket (filename, &tdata); + if (ret) + goto out; + + if (k_hasafs()) { +#ifdef HAVE_KRB_AFSLOG_UID + ret = krb_afslog (cell, cell); +#else + ret = k_afsklog_uid (cell, cell); +#endif + if (ret) { + warnx ("failed inserting tokens for cell %s", cell); + } + ret = 0; + } + } + + if (!save_ticket) + dest_tkt(); + + out: + memset (&key, 0, sizeof (key)); + memset (&adata, 0, sizeof(adata)); + memset (&tdata, 0, sizeof(tdata)); + memset (&cinfo, 0, sizeof(cinfo)); + if (ret) { + if (filename[0] != '\0') + unlink(filename); + } + + return ret; +} + +#ifndef DES_ENCRYPT +#if defined(DESKRB_ENCRYPT) +#define DES_ENCRYPT DESKRB_ENCRYPT +#define DES_DECRYPT DESKRB_DECRYPT +#elif defined(ENCRYPT) +#define DES_ENCRYPT ENCRYPT +#define DES_DECRYPT DECRYPT +#else +#error DES_ENCRYPT not defined in des.h +#endif +#endif + +/* + * Authenticate `user'.`instance'@`cell' with `key' to get a tgt for + * with a lifetime `lifetime' seconds. Return ticket in + * `adata'. `cinfo' is used to specify how to query cell. + */ + +int +ka_auth (const char *user, const char *instance, const char *cell, + des_cblock *key, ka_auth_data_t *adata, + u_int32_t lifetime, struct ka_cell_query *cinfo) +{ + struct db_server_context conn_context; + struct rx_connection *conn; + struct ka_preauth f; + struct timeval tv; + char buf[8]; + char return_data[400]; + ka_CBS request; + ka_BBS answer; + int ret; + struct ka_Answer *auth_answer = (struct ka_Answer *)adata; + des_key_schedule schedule; + u_int32_t req_challange; + u_int32_t start_time; + u_int32_t end_time; + + /* + * Init the time-stamps + */ + + gettimeofday (&tv, NULL); + + start_time = tv.tv_sec; + end_time = start_time + lifetime; + + /* + * Reset stuff that is sent over the network + */ + + memset(buf, 0, sizeof(buf)); + memset(return_data, 0, sizeof(return_data)); + + /* + * Cook pre-auth + */ + + f.time = htonl(tv.tv_sec); + strncpy (f.label, "gTGS", 4); + req_challange = tv.tv_sec; + + des_set_key (key, schedule); + des_pcbc_encrypt ((unsigned char *)&f, + (unsigned char *)buf, + sizeof(f), + schedule, + key, + DES_ENCRYPT); + memset (schedule, 0, sizeof(schedule)); + + request.Seq.val = buf; + request.Seq.len = sizeof(buf); + + /* + * Setup query stuff + */ + + answer.MaxSeqLen = sizeof(buf); + answer.Seq.val = return_data; + answer.Seq.len = sizeof(return_data); + answer.MaxSeqLen = sizeof(return_data); + + /* + * Send the request + */ + + ret = ENETDOWN; + for (conn = arlalib_first_db(&conn_context, + cell, NULL, afskaport, + KA_AUTHENTICATION_SERVICE, + arlalib_getauthflag (1, 0, 0, 0)); + conn != NULL && arlalib_try_next_db(ret); + conn = arlalib_next_db(&conn_context)) { + + ret = KAA_Authenticate (conn, user, instance, start_time, end_time, + &request, &answer); + } + free_db_server_context(&conn_context); + if (ret) + return ret; + + /* + * Decrypt it + */ + + des_set_key (key, schedule); + des_pcbc_encrypt ((unsigned char *)answer.Seq.val, + (unsigned char *)answer.Seq.val, + answer.Seq.len, + schedule, + key, + DES_DECRYPT); + memset (schedule, 0, sizeof(schedule)); + memset (key, 0, sizeof(*key)); + + ret = decode_answer ("tgsT", answer.Seq.val, answer.Seq.len, + auth_answer); + memset (return_data, 0, sizeof (return_data)); + memset (answer.Seq.val, 0, answer.Seq.len); + free (answer.Seq.val); + if (ret) + return ret; + + + /* + * Consistency checks + */ + + if (strcmp(auth_answer->user, user) != 0 + || strcmp(auth_answer->instance, instance) != 0) { + printf ("server returned diffrent user the asked for\n"); + return 1; + } + + if (auth_answer->challange != req_challange + 1) { + printf ("server didn't respond with right challange\n"); + return 1; + } + + fixup_realm (auth_answer, cell); + + return ret; +} + +/* + * Get a ticket for `suser'.`sinstance'@`srealm' using `adata' to + * authenticate. The returning ticket is retrurned in `tdata'. `cinfo' + * is used for special cell handling. + */ + +int +ka_getticket (const char *suser, const char *sinstance, const char *srealm, + ka_auth_data_t *adata, ka_ticket_data_t *tdata, + struct ka_cell_query *cinfo) +{ + struct db_server_context conn_context; + struct rx_connection *conn; + int ret; + struct ka_times ktimes; + char times_buf[8]; + char return_data[400]; + ka_CBS times; + ka_CBS ka_ticket; + ka_BBS answer; + des_key_schedule schedule; + struct timeval tv; + u_int32_t start_time; + u_int32_t end_time; + + /* + * Cook time limit of ticket, use enddate of tgt + */ + + gettimeofday (&tv, NULL); + + start_time = tv.tv_sec; + end_time = adata->end_time; + + ktimes.start_time = htonl(start_time); + ktimes.end_time = htonl(end_time); + + des_set_key (&adata->sessionkey, schedule); + des_ecb_encrypt ((des_cblock *)&ktimes, + (des_cblock *)times_buf, + schedule, + DES_ENCRYPT); + + /* + * Set up request + */ + + times.Seq.len = sizeof(times_buf); + times.Seq.val = times_buf; + + ka_ticket.Seq.len = adata->ticket.length; + ka_ticket.Seq.val = adata->ticket.dat; + + answer.MaxSeqLen = sizeof(return_data); + answer.Seq.len = sizeof(return_data); + answer.Seq.val = return_data; + + ret = ENETDOWN; + for (conn = arlalib_first_db(&conn_context, + adata->realm, NULL, afskaport, + KA_TICKET_GRANTING_SERVICE, + arlalib_getauthflag (1, 0, 0, 0)); + conn != NULL && arlalib_try_next_db(ret); + conn = arlalib_next_db(&conn_context)) { + + ret = KAT_GetTicket(conn, adata->kvno, "", &ka_ticket, + suser, sinstance, ×, &answer); + } + free_db_server_context(&conn_context); + if (ret) + return ret; + + /* decrypt it */ + des_set_key (&adata->sessionkey, schedule); + des_pcbc_encrypt ((unsigned char *)answer.Seq.val, + (unsigned char *)answer.Seq.val, + answer.Seq.len, + schedule, + &adata->sessionkey, + DES_DECRYPT); + memset (schedule, 0, sizeof(schedule)); + + ret = decode_answer ("gtkt", answer.Seq.val, answer.Seq.len, tdata); + if (ret) + return ret; + + fixup_realm (tdata, adata->realm); + return 0; +} + +/* + * Create a new credential cache `filename' and add the TGT `data'. + */ + +int +ka_auth_create (char *filename, ka_auth_data_t *data) +{ + int ret; + + unlink (filename); + + ret = tf_create (filename); + if (ret) + return ret; + + if (tf_put_pname(data->user) != KSUCCESS || + tf_put_pinst(data->instance) != KSUCCESS) { + tf_close(); + return INTK_ERR; + } + + ret = tf_save_cred (data->server_user, + data->server_instance, + data->realm, + data->sessionkey, + data->end_time - data->start_time, + data->kvno, + &data->ticket, + data->start_time); + tf_close(); + return ret; +} + +/* + * Append new ticket `data' to the existing cred cache `filename' + */ + +int +ka_write_ticket (char *filename, ka_ticket_data_t *data) +{ + int ret; + + ret = tf_init(filename, W_TKT_FIL); + if (ret) + return ret; + + ret = tf_save_cred (data->server_user, + data->server_instance, + data->realm, + data->sessionkey, + data->end_time - data->start_time, + data->kvno, + &data->ticket, + data->start_time); + tf_close(); + return ret; +} diff --git a/usr.sbin/afs/src/appl/lib/ka-procs.h b/usr.sbin/afs/src/appl/lib/ka-procs.h new file mode 100644 index 00000000000..8483eec2c8c --- /dev/null +++ b/usr.sbin/afs/src/appl/lib/ka-procs.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * $KTH: ka-procs.h,v 1.2 2000/10/15 21:39:32 assar Exp $ + */ + +#ifndef _ARLA_KA_PROCS_H +#define _ARLA_KA_PROCS_H 1 + +#include <ka.h> + +struct ka_Answer { + u_int32_t challange; + des_cblock sessionkey; + u_int32_t start_time; + u_int32_t end_time; + int kvno; + char user[MAXKANAMELEN]; + char instance[MAXKANAMELEN]; + char realm[MAXKANAMELEN]; + char server_user[MAXKANAMELEN]; + char server_instance[MAXKANAMELEN]; + KTEXT_ST ticket; + char label[KA_LABELSIZE]; +}; + +typedef struct ka_Answer ka_auth_data_t; +typedef struct ka_Answer ka_ticket_data_t; + +/* + * `ka_cell_query' will be used to enable the interface to query + * diffrent servers then in the cell database. + */ + +struct ka_cell_query { + int foo; +}; + +/* + * + */ + +typedef enum { KA_AUTH_TICKET = 1, + KA_AUTH_TOKEN = 2 } ka_auth_flags_t; + +int +ka_authenticate (const char *user, const char *instance, const char *cell, + const char *password, u_int32_t lifetime, + ka_auth_flags_t flags); + +int +ka_auth (const char *user, const char *instance, const char *cell, + des_cblock *key, ka_auth_data_t *adata, + u_int32_t lifetime, struct ka_cell_query *cinfo); + +int +ka_getticket (const char *suser, const char *sinstance, const char *srealm, + ka_auth_data_t *adata, ka_ticket_data_t *tdata, + struct ka_cell_query *cinfo); + +/* + * store requests to disk in form of a kerberos v4 ticket. + */ + +int +ka_auth_create (char *filename, ka_auth_data_t *data); + +int +ka_write_ticket (char *filename, ka_ticket_data_t *data); + +#endif /* _ARLA_KA_PROCS_H */ diff --git a/usr.sbin/afs/src/appl/lib/tokens.c b/usr.sbin/afs/src/appl/lib/tokens.c new file mode 100644 index 00000000000..a154cabf883 --- /dev/null +++ b/usr.sbin/afs/src/appl/lib/tokens.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "appl_locl.h" + +RCSID("$KTH: tokens.c,v 1.1.2.2 2001/04/18 13:53:36 lha Exp $"); + +/* + * Iterate over all tokens and apply `func' on all of them, passing + * the user argument `arg' to func. If `cell' is used, only the token + * of cell is passed to func. + */ + +int +arlalib_token_iter (const char *cell, arlalib_token_iter_func func, void *arg) +{ + u_int32_t i; + unsigned char data[256]; + struct ViceIoctl parms; + char token_cell[128]; + unsigned char secret[128]; + size_t secret_sz; + struct ClearToken ct; + int ret; + + if (!k_hasafs()) + return ENOSYS; + + i = 0; + + while (1) { + u_int32_t sz; + unsigned char *t = data; + + parms.in = (void *)&i; + parms.in_size = sizeof(i); + parms.out = (void *)data; + parms.out_size = sizeof(data); + + if (k_pioctl(NULL, VIOCGETTOK, &parms, 0) != 0) + break; + + memcpy (&sz, t, sizeof(sz)); + t += sizeof(sz); + if (sz > sizeof(secret)) + goto next_token; + memcpy (secret, t, sz); + secret_sz = sz; + t += sz; + + memcpy (&sz, t, sizeof(sz)); + t += sizeof(sz); + if (sz != sizeof(ct)) + goto next_token; + memcpy (&ct, t, sz); + t += sz; + + memcpy (&sz, t, sizeof(sz)); /* primary cell */ + t += sizeof(sz); + + strlcpy(token_cell, t, sizeof(token_cell)); + + if (cell) { + if (strcasecmp(token_cell, cell) == 0) { + ret = (*func) (secret, secret_sz, &ct, cell, arg); + memset (data, 0, sizeof(data)); + return ret; + } + } else { + ret = (*func) (secret, secret_sz, &ct, token_cell, arg); + if (ret) { + memset (data, 0, sizeof(data)); + return ret; + } + } + + next_token: + i++; + } + memset (data, 0, sizeof(data)); + if (cell) + return ENOENT; + return 0; +} diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/Controller.h b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Controller.h new file mode 100644 index 00000000000..178f6aa300c --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Controller.h @@ -0,0 +1,48 @@ +#import <Cocoa/Cocoa.h> +#include <Security/Authorization.h> +#include <Security/AuthorizationTags.h> +#import "DataSource.h" + +@interface Controller : NSObject +{ + IBOutlet DataSource *dataSource; + IBOutlet NSTableView *tableView; + IBOutlet NSTabViewItem *cellSetupTab; + IBOutlet NSTabViewItem *generalTab; + IBOutlet NSTextField *authText; + IBOutlet NSControl *saveButton; + IBOutlet NSTextField *newCellName; + IBOutlet NSControl *addButton; + IBOutlet NSWindow *mainWindow; + IBOutlet NSButton *startButton; + IBOutlet NSControl *startText; + IBOutlet NSControl *statusText; + IBOutlet NSControl *startAtBoot; + IBOutlet NSControl *maxBytes; + IBOutlet NSControl *minBytes; + IBOutlet NSControl *maxFiles; + IBOutlet NSControl *minFiles; + IBOutlet NSControl *defaultButton; + IBOutlet NSControl *currentBytesText; + IBOutlet NSProgressIndicator *currentBytesMeter; + IBOutlet NSControl *maxBytesText; + IBOutlet NSControl *currentFilesText; + IBOutlet NSProgressIndicator *currentFilesMeter; + IBOutlet NSControl *maxFilesText; + IBOutlet NSButton *authButton; + AuthorizationRef gAuthorization; + Boolean gIsLocked; + Boolean authColChanged; + Boolean showColChanged; + Boolean confChanged; + int daemonState; +} +- (IBAction)addCell:(id)sender; +- (IBAction)auth:(id)sender; +- (IBAction)save:(id)sender; +- (IBAction)startButton:(id) sender; +- (IBAction)defaultButton:(id) sender; +- (IBAction)confChanged:(id) sender; +- (void) showChanged; +- (void) authChanged; +@end diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/Controller.m b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Controller.m new file mode 100644 index 00000000000..b0779de05ff --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Controller.m @@ -0,0 +1,394 @@ +#import "Controller.h" + +@implementation Controller + +- (IBAction)addCell:(id)sender +{ + const char *s; + + if ([[newCellName stringValue] length] == 0) + return; + s = [[newCellName stringValue] cString]; + if (strchr(s, ' ')) { + NSBeginAlertSheet(@"Error", @"OK", nil, nil, [tableView window], nil, nil, nil, NULL, + @"Cell cannot contain spaces"); + return; + } + [ dataSource addRowWithAuth: [[NSNumber alloc] initWithInt: NSOnState] + show: [[NSNumber alloc] initWithInt: NSOnState] + cell: [newCellName stringValue]]; + [ tableView reloadData ]; + [ tableView scrollRowToVisible: ([tableView numberOfRows] - 1)]; +} + +- (BOOL) isChanged { + if (authColChanged || showColChanged || confChanged) + return TRUE; + else + return FALSE; +} + +- (void) updateSaveButton { + if ([self isChanged] && + !gIsLocked) { + [saveButton setEnabled: TRUE]; + } else { + [saveButton setEnabled: FALSE]; + } +} + +- (void) showChanged { + showColChanged = TRUE; + [self updateSaveButton]; +} + +- (void) authChanged { + authColChanged = TRUE; + [self updateSaveButton]; +} + +- (void) confChanged { + confChanged = TRUE; + [self updateSaveButton]; +} + +- (void) setEnabled: (BOOL) status { + int i; + NSArray *cols; + + cols = [tableView tableColumns]; + for (i = 0; i < [cols count]; i++) { + [[[cols objectAtIndex: i] dataCell] setEnabled: status]; + } + [tableView setNeedsDisplay]; + [addButton setEnabled: status]; + [newCellName setEnabled: status]; + [maxBytes setEnabled: status]; + [minBytes setEnabled: status]; + [maxFiles setEnabled: status]; + [minFiles setEnabled: status]; + [defaultButton setEnabled: status]; + [startAtBoot setEnabled: status]; +} + +- (void) drawAuthState { + NSImage *lockImage; + NSBundle *mainBundle; + NSString *lockImageName; + + mainBundle = [NSBundle mainBundle]; + if (gIsLocked) + lockImageName = [mainBundle pathForResource: @"lock" ofType: @"tiff"]; + else + lockImageName = [mainBundle pathForResource: @"unlock" ofType: @"tiff"]; + + lockImage = [[NSImage alloc] initWithContentsOfFile: lockImageName]; + + if (gIsLocked) { + [authText setStringValue: @"Click the lock to make changes."]; + [self setEnabled: FALSE]; + } else { + [authText setStringValue: @"Click the lock to prevent further changes."]; + [self setEnabled: TRUE]; + } + [self updateSaveButton]; + [authButton setImage: lockImage]; +} + +- (void) drawDaemonState { + if (gIsLocked) { + [statusText setStringValue: @"Status unknown"]; + [startText setStringValue: @"You are unauthenticated"]; + [startButton setTitle: @"Start"]; + [startButton setEnabled: FALSE]; + return; + } + if (daemonState == 1) { + [statusText setStringValue: @"AFS Client On"]; + [startText setStringValue: @"Click Stop to turn off the Arla AFS Client"]; + [startButton setTitle: @"Stop"]; + [startButton setEnabled: TRUE]; + } else { + [statusText setStringValue: @"AFS Client Off"]; + [startText setStringValue: @"Click Start to turn on the Arla AFS Client"]; + [startButton setTitle: @"Start"]; + [startButton setEnabled: TRUE]; + } +} + +- (void) setAuthState: (AuthorizationFlags) flags { + AuthorizationItem rights[] = + { + { kAuthorizationRightExecute, 0, NULL, 0 } + }; + AuthorizationRights rightSet = { 1, rights }; + OSStatus status; + + status = AuthorizationCopyRights(gAuthorization, &rightSet, kAuthorizationEmptyEnvironment, flags, NULL); + if (status == errAuthorizationSuccess) + gIsLocked = false; + else + gIsLocked = true; + + [self drawAuthState]; +} + +- (void) destroyAuthState { + OSStatus status; + + status = AuthorizationFree(gAuthorization, kAuthorizationFlagDestroyRights); + status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &gAuthorization); + gIsLocked = true; + [self drawAuthState]; +} + +- (void) setBytesMeter: (int) current max: (int) max { + [currentBytesMeter setMaxValue: max]; + [currentBytesMeter setDoubleValue: current]; + [currentBytesText setStringValue: [NSString stringWithFormat: @"%d megabytes", current]]; + [maxBytesText setIntValue: max]; +} + +- (void) setFilesMeter: (int) current max: (int) max { + [currentFilesMeter setMaxValue: max]; + [currentFilesMeter setDoubleValue: current]; + [currentFilesText setStringValue: [NSString stringWithFormat: @"%d files", current]]; + [maxFilesText setIntValue: max]; +} + +- (void) initCacheValues { + int maxbytes, curbytes, maxfiles, curfiles, minbytes, minfiles; + + [dataSource getCache: gAuthorization + maxBytes: &maxbytes minBytes: &minbytes + maxFiles: &maxfiles minFiles: &minfiles + curBytes: &curbytes curFiles: &curfiles]; + + [self setBytesMeter: curbytes / (1024*1024) max: maxbytes / (1024*1024)]; + [self setFilesMeter: curfiles max: maxfiles]; + + if (!confChanged) { + [maxBytes setIntValue: maxbytes / (1024*1024)]; + [minBytes setIntValue: minbytes / (1024*1024)]; + [maxFiles setIntValue: maxfiles]; + [minFiles setIntValue: minfiles]; + } +} + +- (void) awakeFromNib { + AuthorizationFlags flags; + OSStatus status; + + flags = kAuthorizationFlagDefaults; + + status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, flags, &gAuthorization); + + if (status == errAuthorizationSuccess) { + [self setAuthState: flags]; + } else { + gIsLocked = true; + [self drawAuthState]; + } + authColChanged = FALSE; + showColChanged = FALSE; + confChanged = FALSE; + if (gIsLocked) { + daemonState = -1; + [self drawDaemonState]; + [startAtBoot setIntValue: 0]; + } else { + daemonState = [DataSource getDaemonStatus: gAuthorization]; + [self drawDaemonState]; + [startAtBoot setIntValue: [dataSource getStartAtBoot: gAuthorization]]; + [self initCacheValues]; + } +} + +- (IBAction)startButton: (id) sender { + BOOL newDaemonState; + + [self setAuthState: kAuthorizationFlagDefaults]; + + if (gIsLocked) + return; + + if (daemonState == 1) + [DataSource stopDaemon: gAuthorization]; + else { + [DataSource startDaemon: gAuthorization]; + [self initCacheValues]; + } + + newDaemonState = [DataSource getDaemonStatus: gAuthorization]; + if ((newDaemonState == daemonState) || (newDaemonState == -1)) { + if (daemonState) + NSBeginAlertSheet(@"Error", @"OK", nil, nil, mainWindow, nil, nil, nil, NULL, + @"Cannot stop Arla"); + else + NSBeginAlertSheet(@"Error", @"OK", nil, nil, mainWindow, nil, nil, nil, NULL, + @"Cannot start Arla"); + } + daemonState = newDaemonState; + [self drawDaemonState]; +} + +- (IBAction)auth:(id)sender { + AuthorizationFlags flags; + + flags = kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights; + + [self setAuthState: kAuthorizationFlagDefaults]; + + if (gIsLocked) { + [self setAuthState: flags]; + if (gIsLocked) + return; + daemonState = [DataSource getDaemonStatus: gAuthorization]; + [self drawDaemonState]; + [self initCacheValues]; + [startAtBoot setIntValue: [dataSource getStartAtBoot: gAuthorization]]; + } else { + [self destroyAuthState]; + daemonState = -1; + [self drawDaemonState]; + [self initCacheValues]; + [startAtBoot setIntValue: 0]; + } +} + + +- (IBAction)save:(id)sender { + OSStatus status; + + [self setAuthState: kAuthorizationFlagDefaults]; + + if (gIsLocked) + return; + + if (authColChanged) { + status = [dataSource saveAuthData: gAuthorization]; + if (status != noErr) { + return; + } + authColChanged = FALSE; + } + + if (showColChanged) { + status = [dataSource saveShowData: gAuthorization]; + if (status != noErr) { + return; + } + showColChanged = FALSE; + } + + if (confChanged) { + if ([maxBytes intValue] == 0) { + NSBeginAlertSheet(@"Error", @"OK", nil, nil, mainWindow, + nil, nil, nil, NULL, + @"Maximum bytes must be non-zero"); + return; + } + if ([minBytes intValue] == 0) { + NSBeginAlertSheet(@"Error", @"OK", nil, nil, mainWindow, + nil, nil, nil, NULL, + @"Minimum bytes must be non-zero"); + return; + } + if ([maxFiles intValue] == 0) { + NSBeginAlertSheet(@"Error", @"OK", nil, nil, mainWindow, + nil, nil, nil, NULL, + @"Maximum files must be non-zero"); + return; + } + if ([minFiles intValue] == 0) { + NSBeginAlertSheet(@"Error", @"OK", nil, nil, mainWindow, + nil, nil, nil, NULL, + @"Minimum files must be non-zero"); + return; + } + status = [dataSource saveConfData: gAuthorization + maxBytes: [maxBytes intValue] * 1024 * 1024 + minBytes: [minBytes intValue] * 1024 * 1024 + maxFiles: [maxFiles intValue] + minFiles: [minFiles intValue] + startAtBoot: [startAtBoot intValue] + ]; + if (status != noErr) { + return; + } + confChanged = FALSE; + [self initCacheValues]; + } + [self updateSaveButton]; +} + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { + return YES; +} + +- (void)windowWillClose:(NSNotification *)aNotification { + mainWindow = nil; +} + +- (void)willEndCloseSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + NSWindow *window = contextInfo; + + if (returnCode == NSAlertAlternateReturn) { /* "Don't Save" */ + [window close]; + [NSApp replyToApplicationShouldTerminate:YES]; + } +} + +- (void)didEndCloseSheet:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { + NSWindow *window = contextInfo; + + if (returnCode == NSAlertDefaultReturn) { /* "Save" */ + [self save: self]; + [window close]; + [NSApp replyToApplicationShouldTerminate:YES]; + } else if (returnCode == NSAlertOtherReturn) { /* "Cancel" */ + [NSApp replyToApplicationShouldTerminate:NO]; + } +} + +- (BOOL) windowShouldClose: (id) sender { + [self setAuthState: kAuthorizationFlagDefaults]; + + if ([self isChanged] && !gIsLocked) { + NSBeginAlertSheet(@"Close", @"Save", @"Don't save", @"Cancel", sender, self, + @selector(willEndCloseSheet:returnCode:contextInfo:), + @selector(didEndCloseSheet:returnCode:contextInfo:), + sender, + @"Do you want to save changes before closing?"); + return NO; + } else { + [NSApp replyToApplicationShouldTerminate:YES]; + return YES; + } +} + +- (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) app { + if (mainWindow != nil) { + [mainWindow performClose: self]; + return NSTerminateLater; + } else + return NSTerminateNow; +} + +- (IBAction)defaultButton:(id) sender { + [maxBytes abortEditing]; + [maxBytes setIntValue: 100]; + [minBytes abortEditing]; + [minBytes setIntValue: 90]; + [maxFiles abortEditing]; + [maxFiles setIntValue: 4000]; + [minFiles abortEditing]; + [minFiles setIntValue: 3000]; + [self confChanged]; +} + +- (IBAction)confChanged:(id) sender { + [self confChanged]; +} + +@end diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/DataSource.h b/usr.sbin/afs/src/appl/mac/Arla_Configuration/DataSource.h new file mode 100644 index 00000000000..c2472b2f191 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/DataSource.h @@ -0,0 +1,28 @@ +#import <Cocoa/Cocoa.h> +#include <Security/Authorization.h> +#include <Security/AuthorizationTags.h> + +@interface DataSource : NSObject +{ + IBOutlet id authColumn; + IBOutlet id cellNameColumn; + IBOutlet id showColumn; + IBOutlet id tableView; + IBOutlet id controller; +} +- (void)addRowWithAuth: (NSNumber*)auth show: (NSNumber*)show cell: (NSString*)cell; +- (OSStatus)saveShowData: (AuthorizationRef) gAuthorization; +- (OSStatus)saveAuthData: (AuthorizationRef) gAuthorization; +- (OSStatus)saveConfData: (AuthorizationRef) gAuthorization + maxBytes: (int) maxBytes minBytes: (int) minBytes + maxFiles: (int) maxFiles minFiles: (int) minFiles + startAtBoot: (int) startAtBoot; +- (int) getStartAtBoot: (AuthorizationRef) authorization; ++ (int) getDaemonStatus: (AuthorizationRef) gAuthorization; ++ (void) startDaemon: (AuthorizationRef) gAuthorization; ++ (void) stopDaemon: (AuthorizationRef) gAuthorization; +- (OSStatus)getCache: (AuthorizationRef) authorization +maxBytes: (int *) maxBytes minBytes: (int *) minBytes +maxFiles: (int *) maxFiles minFiles: (int *) minFiles +curBytes: (int *) curBytes curFiles: (int *) curFiles; +@end diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/DataSource.m b/usr.sbin/afs/src/appl/mac/Arla_Configuration/DataSource.m new file mode 100644 index 00000000000..bfa056cd9aa --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/DataSource.m @@ -0,0 +1,704 @@ +#import "DataSource.h" +#import "ReadCells.h" +#import "Controller.h" +#include <stdio.h> +#include <sys/ioctl.h> +#include <kafs.h> +#include "config.h" +#include <roken.h> +#include <parse_units.h> +#include <sys/wait.h> + +static struct units size_units[] = { + { "M", 1024 * 1024 }, + { "k", 1024 }, + { NULL, 0 } +}; + +static void +drainfile(FILE *f) +{ + char buffer[100]; + while(fread(buffer, 1, sizeof(buffer), f) != 0); +} + +static void +drainproc() +{ + pid_t pid; + int status; + do { + pid = wait(&status); + } while (pid != -1); +} + +static int +getdaemonpid(AuthorizationRef authorization, char *buffer, int len) +{ + char *argv[3]; + OSStatus status; + FILE *output; + int n; + + argv[0] = "/var/run/arlad.pid"; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/bin/cat", 0, argv, &output); + if (status == noErr) { + n = fread(buffer, 1, len - 1, output); + if (n == 0) { + fclose(output); + return -1; + } + buffer[n] = '\0'; + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +checkdaemonpid(AuthorizationRef authorization, char *pid) +{ + char *argv[4]; + OSStatus status; + FILE *output; + char buffer[1000]; + int n; + + argv[0] = "cocommand="; + argv[1] = "-p"; + argv[2] = pid; + argv[3] = NULL; + status = AuthorizationExecuteWithPrivileges(authorization, "/bin/ps", 0, argv, &output); + n = fread(buffer, 1, sizeof(buffer) - 1, output); + if (n == 0) { + fclose(output); + return -1; + } + buffer[n] = '\0'; + fclose(output); + drainproc(); + if (strcmp(buffer, "\narlad\n") == 0) + return 1; + return 0; +} + +static int +xfs_umount(AuthorizationRef authorization) +{ + char *argv[2]; + OSStatus status; + FILE *output; + + argv[0] = "/afs"; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/usr/arla/sbin/umount_xfs", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +xfs_mount(AuthorizationRef authorization) +{ + char *argv[3]; + OSStatus status; + FILE *output; + + argv[0] = "/dev/xfs0"; + argv[1] = "/afs"; + argv[2] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/usr/arla/sbin/mount_xfs", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +disktool_refresh(AuthorizationRef authorization) +{ + char *argv[2]; + OSStatus status; + FILE *output; + + argv[0] = "-r"; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/usr/sbin/disktool", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +stoparlad(AuthorizationRef authorization) +{ + char *argv[3]; + OSStatus status; + FILE *output; + char pid[100]; + int ret; + + ret = getdaemonpid(authorization, pid, sizeof(pid)); + if (ret == -1) + return -1; + + argv[0] = pid; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/bin/kill", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +startarlad(AuthorizationRef authorization) +{ + char *argv[3]; + OSStatus status; + FILE *output; + + argv[0] = "-D"; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/usr/arla/libexec/arlad", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +kmodunload(AuthorizationRef authorization) +{ + char *argv[3]; + OSStatus status; + FILE *output; + + argv[0] = "-n"; + argv[1] = "xfs"; + argv[2] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/sbin/kmodunload", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +kmodload(AuthorizationRef authorization) +{ + char *argv[3]; + OSStatus status; + FILE *output; + + argv[0] = "/usr/arla/bin/xfs_mod.o"; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/sbin/kmodload", 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +mkafsdir(AuthorizationRef authorization) +{ + char *argv[3]; + OSStatus status; + FILE *output; + + argv[0] = "/afs"; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/bin/mkdir", + 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } +} + +static int +getcache(int *max_bytes, int *used_bytes, int *max_vnodes, int *used_vnodes, + int *min_bytes, int *min_vnodes) +{ + u_int32_t parms[16]; + struct ViceIoctl a_params; + + a_params.in_size = 0; + a_params.out_size = sizeof(parms); + a_params.in = NULL; + a_params.out = (char *) parms; + + memset (parms, 0, sizeof(parms)); + + if (!k_hasafs()) + return ENOSYS; + + if (k_pioctl (NULL, VIOCGETCACHEPARAMS , &a_params, 0) == -1) + return errno; + + /* param[0] and param[1] send maxbytes and usedbytes in kbytes */ + + if (max_vnodes) + *max_vnodes = parms[2]; + if (used_vnodes) + *used_vnodes = parms[3]; + if (max_bytes) + *max_bytes = parms[4]; + if (used_bytes) + *used_bytes = parms[5]; + if (min_bytes) + *min_bytes = parms[6]; + if (min_vnodes) + *min_vnodes = parms[7]; + + return 0; +} + +static int +setcache(int max_bytes, int min_bytes, int max_vnodes, int min_vnodes, + AuthorizationRef authorization) +{ + char *argv[6]; + OSStatus status; + FILE *output; + + argv[0] = "setcachesize"; + argv[1] = malloc(100); + argv[2] = malloc(100); + argv[3] = malloc(100); + argv[4] = malloc(100); + argv[5] = NULL; + + snprintf(argv[1], 100, "%d", min_vnodes); + snprintf(argv[2], 100, "%d", max_vnodes); + snprintf(argv[3], 100, "%d", min_bytes); + snprintf(argv[4], 100, "%d", max_bytes); + + status = AuthorizationExecuteWithPrivileges(authorization, + "/usr/arla/bin/fs", + 0, argv, &output); + if (status == noErr) { + drainfile(output); + fclose(output); + drainproc(); + return 0; + } else { + return -1; + } + + return 0; +} + +@implementation DataSource + +NSMutableArray *authArray; +NSMutableArray *showArray; +NSMutableArray *cellArray; + +- (int) numberOfRowsInTableView:(NSTableView *) aTableView { + return [ authArray count ]; +} + +- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int) row { + if (tableColumn == authColumn) + return [ authArray objectAtIndex: row ]; + else if (tableColumn == showColumn) + return [ showArray objectAtIndex: row ]; + else if (tableColumn == cellNameColumn) + return [ cellArray objectAtIndex: row ]; + else + return nil; +} + +- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn +row:(int)row { + if (aTableColumn == authColumn) { + NSTableView *t = tableView; + NSNumber *value = anObject; + [ authArray replaceObjectAtIndex: row withObject: anObject ]; + [controller authChanged]; + if ([value intValue] == NSOnState) { + [ showArray replaceObjectAtIndex: row withObject: anObject ]; + [controller showChanged]; + } + [ t reloadData ]; + } + else if (aTableColumn == showColumn) { + [ showArray replaceObjectAtIndex: row withObject: anObject ]; + [controller showChanged]; + } + else if (aTableColumn == cellNameColumn) { + [ cellArray replaceObjectAtIndex: row withObject: anObject ]; + } +} + +- (void) awakeFromNib { + NSButtonCell *aCell = [ [NSButtonCell alloc] init ]; + NSTableView *t = tableView; + + [aCell setButtonType: NSSwitchButton ]; + [aCell setTitle: @""]; + + [authColumn setDataCell: aCell]; + [showColumn setDataCell: aCell]; + [aCell release]; + + authArray = [ [NSMutableArray alloc] init ]; + showArray = [ [NSMutableArray alloc] init ]; + cellArray = [ [NSMutableArray alloc] init ]; + + [ReadCells auth: authArray show: showArray cell: cellArray]; + [ t reloadData ]; +} + +- (void)addRowWithAuth: (NSNumber*)auth show: (NSNumber*)show cell: (NSString*)cell { + [ authArray addObject: auth ]; + [ showArray addObject: show ]; + [ cellArray addObject: cell ]; + [ controller authChanged]; + [ controller showChanged]; +} + +- (void)deleteRow:(unsigned)row { + [ authArray removeObjectAtIndex: row ]; + [ showArray removeObjectAtIndex: row ]; + [ cellArray removeObjectAtIndex: row ]; +} + +- (NSString *)getDataForArray: anArray { + NSNumber *aNumber; + NSString *resultString; + int i; + int count; + + count = [anArray count]; + + resultString = @""; + + for (i = 0; i < count; i++) { + aNumber = [anArray objectAtIndex: i]; + if ([aNumber intValue] == NSOnState) { + resultString = [resultString stringByAppendingString: [cellArray objectAtIndex: i]]; + resultString = [resultString stringByAppendingString: @"\n"]; + } + } + + return resultString; +} + +- (OSStatus) fetchData: (NSMutableString *) data file: (char *) file auth: (AuthorizationRef) authorization { + char *argv[2]; + OSStatus status; + FILE *output; + char buffer[1000]; + int n; + + argv[0] = file; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/bin/cat", 0, argv, &output); + if (status == noErr) { + n = fread(buffer, 1, sizeof(buffer) - 1, output); + if (n == 0) { + fclose(output); + return -1; + } + buffer[n] = '\0'; + fclose(output); + drainproc(); + [data appendString: [[NSString alloc] initWithCString: buffer]]; + return 0; + } else { + return -1; + } +} + +- (OSStatus) storeData: (NSString *) data file: (char *) file auth: (AuthorizationRef) authorization { + const char *s; + char *argv[2]; + OSStatus status; + FILE *output; + + argv[0] = file; + argv[1] = NULL; + + status = AuthorizationExecuteWithPrivileges(authorization, "/usr/bin/tee", 0, argv, &output); + if (status == noErr) { + s = [data cString]; + fwrite(s, [data length], 1, output); + fclose(output); + drainproc(); + return noErr; + } else { + return status; + } +} + +- (OSStatus)saveShowData: (AuthorizationRef) authorization { + NSString *data; + data = [self getDataForArray: showArray]; + return [self storeData: data file: "/usr/arla/etc/DynRootDB" auth: authorization]; +} + +- (OSStatus)saveAuthData: (AuthorizationRef) authorization { + NSString *data; + data = [self getDataForArray: authArray]; + return [self storeData: data file: "/usr/arla/etc/TheseCells" auth: authorization]; +} + +- (NSDictionary *) parseConfLine: (const char *) line { + char *save = NULL; + char *n; + char *v; + unsigned val; + char *endptr; + char *line1; + NSDictionary *dict; + + if (line[0] == '#') + return nil; + + line1 = strdup(line); + if (line1 == NULL) + return nil; + + n = strtok_r (line1, " \t", &save); + if (n == NULL) { + free(line1); + return nil; + } + + v = strtok_r (NULL, " \t", &save); + if (v == NULL) { + free(line1); + return nil; + } + + val = parse_units(v, size_units, NULL); + if(val == (unsigned)-1) { + val = strtol(v, &endptr, 0); + if (endptr == v) { + free(line1); + return nil; + } + } + + dict = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: val] + forKey: [NSString stringWithCString: n]]; + free(line1); + return dict; +} + +- (void)parseConf: (NSString *) data dict: (NSMutableDictionary *) dict { + NSRange curRange; + NSRange nextRange; + NSMutableCharacterSet *newLine; + NSDictionary *linedict; + + unsigned length = [data length]; + + newLine = [[NSMutableCharacterSet alloc] init]; + [newLine addCharactersInString: @"\n"]; + + curRange.location = 0; + while(1) { + curRange.length = length - curRange.location; + nextRange = [data rangeOfCharacterFromSet: newLine + options: NSLiteralSearch + range: curRange]; + if (nextRange.length == 0) + break; + curRange.length = nextRange.location - curRange.location; + linedict = [self parseConfLine: + [[data substringWithRange: curRange] cString]]; + if (dict) + [dict addEntriesFromDictionary: linedict]; + + curRange.location = nextRange.location + nextRange.length; + } +} + +- (void)writeConf: (NSMutableString *) data dict: (NSDictionary *) dict { + + NSEnumerator *enumerator = [dict keyEnumerator]; + NSString *key; + + while ((key = [enumerator nextObject])) { + [data appendString: [NSString stringWithFormat: @"%s %d\n", + [key cString], + [[dict objectForKey: key] intValue]]]; + } +} + +- (OSStatus)getCache: (AuthorizationRef) authorization + maxBytes: (int *) maxBytes minBytes: (int *) minBytes + maxFiles: (int *) maxFiles minFiles: (int *) minFiles + curBytes: (int *) curBytes curFiles: (int *) curFiles { + NSMutableString *data; + NSMutableDictionary *dict; + + if (getcache(maxBytes, curBytes, maxFiles, curFiles, + minBytes, minFiles) == 0) + return 0; + + data = [[[NSMutableString alloc] init] autorelease]; + dict = [[[NSMutableDictionary alloc] init] autorelease]; + + [self fetchData: data file: "/usr/arla/etc/arla.conf" auth: authorization]; + + [self parseConf: data dict: dict]; + + *maxBytes = [[dict objectForKey: @"high_bytes"] intValue]; + *minBytes = [[dict objectForKey: @"low_bytes"] intValue]; + *maxFiles = [[dict objectForKey: @"high_vnodes"] intValue]; + *minFiles = [[dict objectForKey: @"low_vnodes"] intValue]; + *curBytes = 0; + *curFiles = 0; + + return 0; +} + + +- (OSStatus)saveConfData: (AuthorizationRef) authorization + maxBytes: (int) maxBytes minBytes: (int) minBytes + maxFiles: (int) maxFiles minFiles: (int) minFiles + startAtBoot: (int) startAtBoot { + NSMutableString *data; + NSMutableDictionary *dict; + + data = [[NSMutableString alloc] init]; + dict = [[NSMutableDictionary alloc] init]; + + [self fetchData: data file: "/usr/arla/etc/arla.conf" auth: authorization]; + + [self parseConf: data dict: dict]; + + [data setString: @""]; + + [dict setObject: [NSNumber numberWithInt: maxBytes] + forKey: @"high_bytes"]; + [dict setObject: [NSNumber numberWithInt: minBytes] + forKey: @"low_bytes"]; + [dict setObject: [NSNumber numberWithInt: maxFiles] + forKey: @"high_vnodes"]; + [dict setObject: [NSNumber numberWithInt: minFiles] + forKey: @"low_vnodes"]; + + [self writeConf: data dict: dict]; + + [self storeData: data file: "/usr/arla/etc/arla.conf" auth: authorization]; + + setcache(maxBytes, minBytes, maxFiles, minFiles, authorization); + + if (startAtBoot) + [self storeData: @"yes" file: "/usr/arla/etc/startatboot" + auth: authorization]; + else + [self storeData: @"no" file: "/usr/arla/etc/startatboot" + auth: authorization]; + + return 0; +} + +- (int) getStartAtBoot: (AuthorizationRef) authorization { + NSMutableString *data; + OSStatus status; + + data = [[[NSMutableString alloc] init] autorelease]; + + status = [self fetchData: data + file: "/usr/arla/etc/startatboot" + auth: authorization]; + if (status) + return 0; + if (strcmp([data cString], "yes") == 0) + return 1; + return 0; +} + ++ (int) getDaemonStatus: (AuthorizationRef) authorization { + int ret; + char buffer[1000]; + + ret = getdaemonpid(authorization, buffer, sizeof(buffer)); + if (ret == -1) + return -1; + + ret = checkdaemonpid(authorization, buffer); + return ret; +} + ++ (void) startDaemon: (AuthorizationRef) authorization { + int i; + struct timeval t; + + mkafsdir(authorization); + kmodload(authorization); + startarlad(authorization); + for (i = 0; i < 40; i++) { + if ([self getDaemonStatus: authorization] == 1) + break; + t.tv_sec = 0; + t.tv_usec = 250000; + select(0, NULL, NULL, NULL, &t); + } + xfs_mount(authorization); + disktool_refresh(authorization); +} + ++ (void) stopDaemon: (AuthorizationRef) authorization { + xfs_umount(authorization); + disktool_refresh(authorization); + stoparlad(authorization); + kmodunload(authorization); +} + + +@end diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/Info.plist.in b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Info.plist.in new file mode 100644 index 00000000000..885af22a330 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Info.plist.in @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>arlaconf</string> + <key>CFBundleName</key> + <string>Arla Configuration</string> + <key>CFBundleIconFile</key> + <string>arla.icns</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>@VERSION@</string> + <key>NSMainNibFile</key> + <string>dialog</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/Makefile.in b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Makefile.in new file mode 100644 index 00000000000..be6790b7ef0 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/Makefile.in @@ -0,0 +1,116 @@ +# $KTH: Makefile.in,v 1.3.2.6 2002/02/01 20:15:50 ahltorp Exp $ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = ../../.. +VPATH = @srcdir@ + +CC = @CC@ +LN_S = @LN_S@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @top_srcdir@/mkinstalldirs + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +libexecdir = @libexecdir@ +bindir = @bindir@ +mandir = @mandir@ +transform = @program_transform_name@ +EXECSUFFIX = @EXECSUFFIX@ + +progdir = $(bindir)/ArlaConfiguration.app +contentsdir = $(progdir)/Contents +macosdir = $(contentsdir)/MacOS +resourcesdir = $(contentsdir)/Resources + +DEFS = @DEFS@ + +SHELL = /bin/sh + +CFLAGS = @CFLAGS@ + +ETAGS = etags +MAKEDEPEND = makedepend +INCLUDES = -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/appl/lib \ + -I$(top_builddir)/rxdef \ + -I$(top_builddir)/include \ + -I. \ + @INC_roken@ \ + +DEFINES = +REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(DEFINES) $(CFLAGS) +KERNEL_INCLUDE = @KERNEL_INCLUDE@ +KAFS_LIBS = @AIX_EXTRA_KAFS@ @KAFS_LIBS@ +LIBS = -L../../../lib/ko -lko -L../../../util -lutil \ + -framework Cocoa -framework Security \ + @LIB_roken@ \ + $(KAFS_LIBS) \ + @LIBS@ + +LIBDEPENDS = ../../../util/libutil.a ../../../lib/ko/libko.a + +PROGS = arlaconf + +ARLACONF_SRCS = Controller.m DataSource.m ReadCells.m main.m + +SRCS = $(ARLACONF_SRCS) +ARLACONF_OBJS = $(ARLACONF_SRCS:.m=.o) + +HDRS = Controller.h DataSource.h ReadCells.h + +all: $(PROGS) + +.PHONY: all install uninstall depend tags clean + +.m.o: + $(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I. $(REALCFLAGS) $< + +install: all + $(MKINSTALLDIRS) $(DESTDIR)$(progdir) + $(MKINSTALLDIRS) $(DESTDIR)$(contentsdir) + $(MKINSTALLDIRS) $(DESTDIR)$(macosdir) + $(MKINSTALLDIRS) $(DESTDIR)$(resourcesdir) + $(MKINSTALLDIRS) $(DESTDIR)$(resourcesdir)/dialog.nib + $(INSTALL_PROGRAM) arlaconf $(DESTDIR)$(macosdir) + $(INSTALL_DATA) Info.plist $(DESTDIR)$(contentsdir) + $(INSTALL_DATA) $(srcdir)/PkgInfo $(DESTDIR)$(contentsdir) + $(INSTALL_DATA) $(srcdir)/arla.icns $(DESTDIR)$(resourcesdir) + $(INSTALL_DATA) $(srcdir)/lock.tiff $(DESTDIR)$(resourcesdir) + $(INSTALL_DATA) $(srcdir)/unlock.tiff $(DESTDIR)$(resourcesdir) + $(INSTALL_DATA) $(srcdir)/dialog.nib/classes.nib $(DESTDIR)$(resourcesdir)/dialog.nib + $(INSTALL_DATA) $(srcdir)/dialog.nib/info.nib $(DESTDIR)$(resourcesdir)/dialog.nib + $(INSTALL_DATA) $(srcdir)/dialog.nib/objects.nib $(DESTDIR)$(resourcesdir)/dialog.nib + +uninstall: + rm -rf $(DESTDIR)$(progdir) + +arlaconf: $(ARLACONF_OBJS) $(LIBDEPENDS) + $(CC) $(LDFLAGS) -o $@ $(ARLACONF_OBJS) $(LIBS) + +Makefile: Makefile.in ../../../config.status + cd ../../..; CONFIG_FILES=appl/mac/Arla_Configuration/Makefile CONFIG_HEADERS= $(SHELL) config.status + +depend: $(CFILES) + $(MAKEDEPEND) -- $(REALCFLAGS) -- $^ + +tags: TAGS + +TAGS: $(SRCS) $(HDRS) + $(ETAGS) -t $(SRCS) $(HDRS) + +clean : + rm -f $(PROGS) $(OBJS) *~ *.o core + +mostlyclean: clean + +distclean: clean + rm -f Makefile + +realclean: distclean + rm -f TAGS diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/PkgInfo b/usr.sbin/afs/src/appl/mac/Arla_Configuration/PkgInfo new file mode 100644 index 00000000000..bd04210fb49 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/PkgInfo @@ -0,0 +1 @@ +APPL????
\ No newline at end of file diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/ReadCells.h b/usr.sbin/afs/src/appl/mac/Arla_Configuration/ReadCells.h new file mode 100644 index 00000000000..578bd34fa57 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/ReadCells.h @@ -0,0 +1,9 @@ +@interface ReadCells : NSObject + ++ (int) +auth: (NSMutableArray *) authArray +show: (NSMutableArray *) showArray +cell: (NSMutableArray *) cellArray; + + +@end diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/ReadCells.m b/usr.sbin/afs/src/appl/mac/Arla_Configuration/ReadCells.m new file mode 100644 index 00000000000..88d8330b804 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/ReadCells.m @@ -0,0 +1,88 @@ +#import <Cocoa/Cocoa.h> +#import "ReadCells.h" +#include <stdio.h> +#include <string.h> + +#define CELLSERVDB "/usr/arla/etc/CellServDB" +#define THESECELLS "/usr/arla/etc/TheseCells" +#define THISCELL "/usr/arla/etc/ThisCell" +#define DYNROOTDB "/usr/arla/etc/DynRootDB" + +static char * +getcell (char *line) +{ + int len; + + len = strcspn (line, " \t#"); + line[len] = '\0'; + return line; +} + +@implementation ReadCells + ++ (int) +auth: (NSMutableArray *) authArray +show: (NSMutableArray *) showArray +cell: (NSMutableArray *) cellArray { + FILE *f; + char line[256]; + int lineno = 0; + char *cell; + int arrayindex; + + f = fopen (CELLSERVDB, "r"); + if (f != NULL) { + while (fgets (line, sizeof (line), f)) { + ++lineno; + line[strlen(line) - 1] = '\0'; + if (line[0] == '#' || line[0] == '\0') + continue; + if (line[0] == '>') { + cell = getcell (&line[1]); + [ authArray addObject: [[NSNumber alloc] initWithInt: NSOffState] ]; + [ showArray addObject: [[NSNumber alloc] initWithInt: NSOffState] ]; + [ cellArray addObject: [[NSString alloc] initWithCString: cell] ]; + } + } + fclose (f); + } + + f = fopen(THESECELLS, "r"); + if (f != NULL) { + while (fgets (line, sizeof (line), f)) { + ++lineno; + line[strlen(line) - 1] = '\0'; + arrayindex = [cellArray indexOfObject: [[NSString alloc] initWithCString: line]]; + if (arrayindex == NSNotFound) { + [ authArray addObject: [[NSNumber alloc] initWithInt: NSOnState] ]; + [ showArray addObject: [[NSNumber alloc] initWithInt: NSOffState] ]; + [ cellArray addObject: [[NSString alloc] initWithCString: line] ]; + } else { + [ authArray replaceObjectAtIndex: arrayindex + withObject: [[NSNumber alloc] initWithInt: NSOnState]]; + } + } + fclose (f); + } + + f = fopen(DYNROOTDB, "r"); + if (f != NULL) { + while (fgets (line, sizeof (line), f)) { + ++lineno; + line[strlen(line) - 1] = '\0'; + arrayindex = [cellArray indexOfObject: [[NSString alloc] initWithCString: line]]; + if (arrayindex == NSNotFound) { + [ authArray addObject: [[NSNumber alloc] initWithInt: NSOffState] ]; + [ showArray addObject: [[NSNumber alloc] initWithInt: NSOnState] ]; + [ cellArray addObject: [[NSString alloc] initWithCString: line] ]; + } else { + [ showArray replaceObjectAtIndex: arrayindex + withObject: [[NSNumber alloc] initWithInt: NSOnState]]; + } + } + fclose (f); + } + + return 0; +} +@end diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/arla.icns b/usr.sbin/afs/src/appl/mac/Arla_Configuration/arla.icns Binary files differnew file mode 100644 index 00000000000..323aa9bbd03 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/arla.icns diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/classes.nib b/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/classes.nib new file mode 100644 index 00000000000..4b83499f89a --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/classes.nib @@ -0,0 +1,80 @@ +{ + IBClasses = ( + { + ACTIONS = { + addCell = id; + auth = id; + confChanged = id; + defaultButton = id; + save = id; + startButton = id; + }; + CLASS = Controller; + LANGUAGE = ObjC; + OUTLETS = { + addButton = id; + authButton = id; + authText = id; + cellSetupTab = id; + currentBytesMeter = id; + currentBytesText = id; + currentFilesMeter = id; + currentFilesText = id; + dataSource = id; + defaultButton = id; + generalTab = id; + mainWindow = id; + maxBytes = id; + maxBytesText = id; + maxFiles = id; + maxFilesText = id; + minBytes = id; + minFiles = id; + newCellName = id; + saveButton = id; + startAtBoot = id; + startButton = id; + startText = id; + statusText = id; + tableView = id; + }; + SUPERCLASS = NSObject; + }, + { + CLASS = DataSource; + LANGUAGE = ObjC; + OUTLETS = { + authColumn = id; + cellNameColumn = id; + controller = id; + showColumn = id; + tableView = id; + }; + SUPERCLASS = NSObject; + }, + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = MyMyTableColumn; LANGUAGE = ObjC; SUPERCLASS = MyTableColumn; }, + {CLASS = MyTableColumn; LANGUAGE = ObjC; SUPERCLASS = NSTableColumn; }, + {CLASS = NSActionCell; LANGUAGE = ObjC; SUPERCLASS = NSCell; }, + { + ACTIONS = {performClick = id; }; + CLASS = NSButtonCell; + LANGUAGE = ObjC; + SUPERCLASS = NSActionCell; + }, + { + ACTIONS = { + performClick = id; + takeDoubleValueFrom = id; + takeFloatValueFrom = id; + takeIntValueFrom = id; + takeObjectValueFrom = id; + takeStringValueFrom = id; + }; + CLASS = NSCell; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/info.nib b/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/info.nib new file mode 100644 index 00000000000..7ff55f73a15 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/info.nib @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>IBDocumentLocation</key> + <string>525 124 427 540 0 84 1024 662 </string> + <key>IBMainMenuLocation</key> + <string>36 497 336 44 0 84 1024 662 </string> + <key>IBUserGuides</key> + <dict> + <key>Arla Configuration</key> + <dict> + <key>guideLocations</key> + <array> + <string>Horizontal:80.000000</string> + <string>Vertical:20.000000</string> + <string>Horizontal:60.000000</string> + <string>Vertical:505.000000</string> + </array> + <key>guidesLocked</key> + <string>NO</string> + </dict> + <key>Window</key> + <dict> + <key>guideLocations</key> + <array/> + <key>guidesLocked</key> + <string>NO</string> + </dict> + </dict> +</dict> +</plist> diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/objects.nib b/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/objects.nib Binary files differnew file mode 100644 index 00000000000..6597ea540d2 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/dialog.nib/objects.nib diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/lock.tiff b/usr.sbin/afs/src/appl/mac/Arla_Configuration/lock.tiff Binary files differnew file mode 100644 index 00000000000..281696f5ef9 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/lock.tiff diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/main.m b/usr.sbin/afs/src/appl/mac/Arla_Configuration/main.m new file mode 100644 index 00000000000..b849d40786d --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/main.m @@ -0,0 +1,6 @@ +#import <Cocoa/Cocoa.h> + +int main(int argc, const char *argv[]) +{ + return NSApplicationMain(argc, argv); +} diff --git a/usr.sbin/afs/src/appl/mac/Arla_Configuration/unlock.tiff b/usr.sbin/afs/src/appl/mac/Arla_Configuration/unlock.tiff Binary files differnew file mode 100644 index 00000000000..e99e78b7736 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Arla_Configuration/unlock.tiff diff --git a/usr.sbin/afs/src/appl/mac/Makefile.in b/usr.sbin/afs/src/appl/mac/Makefile.in new file mode 100644 index 00000000000..71a30221007 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/Makefile.in @@ -0,0 +1,50 @@ +# $KTH: Makefile.in,v 1.1.2.1 2001/05/17 18:54:18 ahltorp Exp $ + +srcdir = @srcdir@ +top_builddir = .. +VPATH = @srcdir@ + +SHELL = /bin/sh + +SUBDIRS = Arla_Configuration + +all: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +clean: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +realclean: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +distclean: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +mostlyclean: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +install: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +uninstall: + SUBDIRS='$(SUBDIRS)'; \ + for i in $$SUBDIRS; \ + do (cd $$i && $(MAKE) $(MFLAGS) $@) || exit 1; done + +Makefile: Makefile.in ../../config.status + cd ../.. ; CONFIG_FILES=appl/mac/Makefile CONFIG_HEADERS= $(SHELL) config.status + + +.PHONY: all clean realclean distclean mostlyclean install uninstall diff --git a/usr.sbin/afs/src/appl/mac/make-mac-package.sh b/usr.sbin/afs/src/appl/mac/make-mac-package.sh new file mode 100644 index 00000000000..6873c387a06 --- /dev/null +++ b/usr.sbin/afs/src/appl/mac/make-mac-package.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +name=`basename $0` + +if [ $# = 0 ]; then + echo "$name version" + exit +fi + +DESTDIR=`pwd`/arlapackage + +mkdir $DESTDIR +mkdir $DESTDIR/usr +mkdir $DESTDIR/usr/arla +mkdir $DESTDIR/Applications +mkdir $DESTDIR/Applications/Arla +mkdir -p $DESTDIR/Library/StartupItems/Arla + +cp -Rp /usr/arla/bin $DESTDIR/usr/arla +cp -Rp /usr/arla/cache $DESTDIR/usr/arla +cp -Rp /usr/arla/etc $DESTDIR/usr/arla +cp -Rp /usr/arla/include $DESTDIR/usr/arla +cp -Rp /usr/arla/info $DESTDIR/usr/arla +cp -Rp /usr/arla/lib $DESTDIR/usr/arla +cp -Rp /usr/arla/libexec $DESTDIR/usr/arla +cp -Rp /usr/arla/man $DESTDIR/usr/arla +cp -Rp /usr/arla/sbin $DESTDIR/usr/arla +cp -Rp "/usr/arla/Arla Configuration.app" $DESTDIR/Applications/Arla + +cat > $DESTDIR/Library/StartupItems/Arla/Arla <<'EOF' +#!/bin/sh +if [ -f /usr/arla/etc/startatboot ]; then + if [ `cat /usr/arla/etc/startatboot` = "yes" ]; then + test -d /afs || mkdir /afs + /sbin/kmodload /usr/arla/bin/xfs_mod.o + /usr/arla/libexec/arlad -D + /usr/arla/sbin/mount_xfs /dev/xfs0 /afs + /usr/sbin/disktool -r + fi +fi +EOF +chmod +x $DESTDIR/Library/StartupItems/Arla/Arla + +cat > $DESTDIR/Library/StartupItems/Arla/StartupParameters.plist <<EOF +{ + Description = "Arla AFS Client"; + Provides = ("AFS"); + Requires = ("Network"); + OrderPreference = "None"; + Messages = + { + start = "Starting Arla AFS Client"; + stop = "Stopping Arla AFS Client"; + } +} +EOF + +cat > arla.info <<"EOF" +Title Arla +Version $1 +Description +DefaultLocation / +Diskname (null) +DeleteWarning +NeedsAuthorization YES +DisableStop NO +UseUserMask NO +Application NO +Relocatable NO +Required NO +InstallOnly NO +RequiresReboot NO +InstallFat NO +EOF + +/usr/bin/package $DESTDIR arla.info +tar cf arla-$1.pkg.tar arla.pkg +gzip arla-$1.pkg.tar diff --git a/usr.sbin/afs/src/appl/vos/vos_backup.c b/usr.sbin/afs/src/appl/vos/vos_backup.c new file mode 100644 index 00000000000..98c242bc5dc --- /dev/null +++ b/usr.sbin/afs/src/appl/vos/vos_backup.c @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "appl_locl.h" +#include <sl.h> +#include "vos_local.h" + +RCSID("$KTH: vos_backup.c,v 1.2.2.1 2001/09/17 23:54:20 mattiasa Exp $"); + +static char *vol; +static char *cell; +static int noauth; +static int localauth; +static int verbose; +static int helpflag; + +static void +backup_volume (const char *volume, + const char *cell, arlalib_authflags_t auth) +{ + struct rx_connection *conn_vldb = NULL; + struct rx_connection *conn_volser = NULL; + char *newname; + int32_t newVol; + int32_t dbhost; + int error; + int ret,backexists=TRUE; + nvldbentry the_vlentry; + int32_t trans_id_rw, trans_id_bk; + + if (cell == NULL) + cell = cell_getthiscell (); + + error = get_vlentry (cell, NULL, volume, auth, &the_vlentry); + + if (error) + goto out; + + conn_volser = arlalib_getconnbyaddr(cell, + htonl(the_vlentry.serverNumber[0]), + NULL, + afsvolport, + VOLSERVICE_ID, + auth); + + if (conn_volser == NULL) { + fprintf (stderr, "dump_volume: getconnbyaddr failed\n"); + goto out; + } + + error = VOLSER_AFSVolTransCreate(conn_volser, + the_vlentry.volumeId[BACKVOL], + the_vlentry.serverPartition[0], + ITReadOnly, + &trans_id_bk); + + if (error) { + backexists = FALSE; + } + if(trans_id_bk) + error = VOLSER_AFSVolEndTrans(conn_volser, trans_id_bk, &ret); + + newVol = the_vlentry.volumeId[BACKVOL]; + + error = VOLSER_AFSVolTransCreate(conn_volser, + the_vlentry.volumeId[0], /* XXX */ + the_vlentry.serverPartition[0], + ITReadOnly, + &trans_id_rw); + if (error) { + fprintf (stderr, "dump_volume: VolTransCreate failed: %s\n", + koerr_gettext(error)); + goto out; + } + + if (backexists) { + error = VOLSER_AFSVolReClone(conn_volser, trans_id_rw, newVol); + } else { + newname = malloc(strlen(the_vlentry.name)+8); + if(newname == NULL) { + fprintf (stderr, "backup volume: malloc failed: %s\n", + strerror(errno)); + goto out; + } + sprintf(newname, "%s.backup", the_vlentry.name); + + error = VOLSER_AFSVolClone(conn_volser, + trans_id_rw, + 0, + BACKVOL, + newname, + &newVol); + } + + if (error) { + fprintf (stderr, "backup volume: AFSVolClone failed: %s\n", + koerr_gettext(error)); + goto trans_out; + } + + error = arlalib_getsyncsite (cell, NULL, afsvldbport, + &dbhost, auth); + if (error) { + fprintf (stderr, "vos_createvolume: arla_getsyncsite: %s\n", + koerr_gettext(error)); + goto trans_out; + } + + conn_vldb = arlalib_getconnbyaddr(cell, dbhost, NULL, + afsvldbport, + VLDB_SERVICE_ID, + auth); + if (conn_vldb == NULL) { + fprintf (stderr, + "vos_createvolume: arlalib_getconnbyaddr: vldb-host: 0x%x\n", + dbhost); + goto trans_out; + } + + the_vlentry.volumeId[BACKVOL] = newVol; + the_vlentry.flags |= VLF_BACKEXISTS; + + error = VL_ReplaceEntryN(conn_vldb, + the_vlentry.volumeId[RWVOL], + RWVOL, + &the_vlentry, + LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP); + if (error) { + fprintf (stderr, "vos_createvolume: VL_UpdateEntry: %s\n", + koerr_gettext (error)); + } else if (verbose) + printf ("vos_createvolume: added entry to vldb\n"); + + + error = VOLSER_AFSVolTransCreate(conn_volser, + the_vlentry.volumeId[BACKVOL], /* XXX */ + the_vlentry.serverPartition[0], + ITOffline, + &trans_id_bk); + if (error) { + fprintf (stderr, "vos_createvolume: VOLSER_AFSVolTransCreate: %s\n", + koerr_gettext(error)); + goto trans_out; + } + + error = VOLSER_AFSVolSetFlags(conn_volser, trans_id_bk,0); + if (error) { + fprintf (stderr, "vos_createvolume: VOLSER_AFSVolSetFlags: %s\n", + koerr_gettext(error)); + goto trans_out_bk; + } + + +trans_out_bk: + ret = 0; + + error = VOLSER_AFSVolEndTrans(conn_volser, trans_id_bk, &ret); + if (error) + fprintf (stderr, "backup_Volume: VolEndTrans failed: %s\n", + koerr_gettext(error)); + +trans_out: + ret = 0; + + error = VOLSER_AFSVolEndTrans(conn_volser, trans_id_rw, &ret); + if (error) + fprintf (stderr, "dump_volume: VolEndTrans failed: %s\n", + koerr_gettext(error)); + +out: + if (conn_volser != NULL) + arlalib_destroyconn (conn_volser); + + if (conn_vldb != NULL) + arlalib_destroyconn (conn_vldb); + + +} + + +static struct agetargs backupargs[] = { + {"id", 0, aarg_string, &vol, "id of volume", "volume", + aarg_mandatory}, + {"cell", 0, aarg_string, &cell, "what cell to use", NULL}, + {"noauth", 0, aarg_flag, &noauth, "do not authenticate", NULL}, + {"localauth",0,aarg_flag, &localauth, "localauth", NULL}, + {"verbose", 0, aarg_flag, &verbose, "be verbose", NULL}, + {"help", 0, aarg_flag, &helpflag, NULL, NULL}, + {NULL, 0, aarg_end, NULL} +}; + +static void +backupusage(void) +{ + aarg_printusage(backupargs, "vos backup", "", AARG_AFSSTYLE); +} + + +int +vos_backup(int argc, char **argv) +{ + int optind = 0; + + noauth = localauth = verbose = 0; + cell = vol = NULL; + + if (agetarg (backupargs, argc, argv, &optind, AARG_AFSSTYLE)) { + backupusage (); + return 0; + } + + if (helpflag) { + backupusage (); + return 0; + } + + argc -= optind; + argv += optind; + + backup_volume (vol, cell, + arlalib_getauthflag (noauth, localauth, 0, 0)); + return 0; +} + +static int +backup_volume_wrap (void *data, struct vldbentry *e) +{ + if(e->volumeType == RWVOL) + backup_volume (e->name, cell, localauth); + + return 0; + +} + +static struct agetargs backupsysargs[] = { + {"cell", 0, aarg_string, &cell, "what cell to use", NULL}, + {"noauth", 0, aarg_flag, &noauth, "do not authenticate", NULL}, + {"localauth",0,aarg_flag, &localauth, "localauth", NULL}, + {"verbose", 0, aarg_flag, &verbose, "be verbose", NULL}, + {"help", 0, aarg_flag, &helpflag, NULL, NULL}, + {NULL, 0, aarg_end, NULL} +}; + +static void +backupsysusage(void) +{ + aarg_printusage(backupsysargs, "vos backupsys", "", AARG_AFSSTYLE); +} + +int +vos_backupsys(int argc, char **argv) +{ + int optind = 0; + + noauth = localauth = verbose = 0; + cell = vol = NULL; + + if (agetarg (backupsysargs, argc, argv, &optind, AARG_AFSSTYLE)) { + backupsysusage (); + return 0; + } + + if (helpflag) { + backupsysusage (); + return 0; + } + + argc -= optind; + argv += optind; + + return vos_listvldb_iter (NULL, cell, NULL, + NULL, NULL, + arlalib_getauthflag (noauth, localauth, 0, 0), + backup_volume_wrap, NULL); + return 0; + +} diff --git a/usr.sbin/afs/src/arlad/DynRootDB.5 b/usr.sbin/afs/src/arlad/DynRootDB.5 new file mode 100644 index 00000000000..d0d2649e702 --- /dev/null +++ b/usr.sbin/afs/src/arlad/DynRootDB.5 @@ -0,0 +1,41 @@ +.\" Copyright (c) 2001 Kungliga Tekniska Högskolan +.\" $KTH: DynRootDB.5,v 1.1.2.2 2001/06/10 21:13:14 lha Exp $ +.Dd April 30, 2001 +.Dt DynRootDB 5 +.Os +.Sh NAME +.Nm DynRootDB +.Nd AFS cells and database servers +.Sh DESCRIPTION +The file +.Nm +lists AFS cells that should appear in the afs root +.Pa ( /afs ) +when starting +.Nm arlad +or +.Nm arla-cli. +.Pp +Each line in the file should contain one cell. +.Bd -literal +stacken.kth.se +e.kth.se +nada.kth.se +it.kth.se +.Ed +.Pp +.Nm +is read when +.Nm arlad +is started, normally when the system boots. +.Pp +If there file +.Nm +doesn't exist, then all cells in the CellServDB and dynamically +found nodes appear in the afs root. +.Sh FILES +.Pa /usr/arla/etc/DynRootDB +.Sh SEE ALSO +.Xr CellServDB 5 , +.Xr arlad 8 + diff --git a/usr.sbin/afs/src/arlad/arla-cli.8 b/usr.sbin/afs/src/arlad/arla-cli.8 new file mode 100644 index 00000000000..2adf27de4f6 --- /dev/null +++ b/usr.sbin/afs/src/arlad/arla-cli.8 @@ -0,0 +1,47 @@ +.\" $KTH: arla-cli.8,v 1.2 2000/09/28 03:49:45 lha Exp $ +.Dd September 23, 2000 +.Dt arlatest 1 +.Os +.Sh NAME +.Nm arlatest +.Nd commandline AFS cache manager +.Sh SYNOPSIS +Have the same options as +.Xr arlad 8 +See that manual page for complete reference. +.Sh DESCRIPTION +.Nm +is a cache manager that have a commadline interface to access afs. +It's primary used for testing if arla works. +.Pp +It creates a cache directory named +.Pa .arlacache +in your home directory as the command tool is started in. +.Pp +Available commands are: +.Bl -tag -width 15 +.It chdir +.It ls +.It cat +.It cp +.It wc +.It checkservers +.It conn-status +.It vol-status +.It cred-status +.It rx-status +.It flushfid +.It sysname +.It quit +.It help +.El +.Sh SEE ALSO +.Xr arlad 8 , +.Xr mount_xfs 8 , +.Xr vos 8 , +.Xr fs 1 , +.Xr pts 1 , +.Xr CellServDB 5 , +.Xr ThisCell 5 , +.Xr SuidCells 5 , +.Xr arla.conf 5 diff --git a/usr.sbin/afs/src/arlad/arla-cli.c b/usr.sbin/afs/src/arlad/arla-cli.c new file mode 100644 index 00000000000..9fd212f31b8 --- /dev/null +++ b/usr.sbin/afs/src/arlad/arla-cli.c @@ -0,0 +1,716 @@ +/* + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <arla_local.h> +#include <sl.h> +#include <getarg.h> +#include <arla-version.h> + +RCSID("$KTH: arla-cli.c,v 1.7 2000/12/04 22:45:19 lha Exp $"); + +char *default_log_file = "/dev/stderr"; +char *default_arla_cachedir = ".arlacache"; +int client_port = 4712; + + +/* creds used for all the interactive usage */ + +static CredCacheEntry *ce; + +static VenusFid cwd; +static VenusFid rootcwd; + +static int arla_chdir(int, char **); +static int arla_ls(int, char **); +static int arla_cat(int, char **); +static int arla_cp(int, char **); +static int arla_wc(int, char **); +static int help(int, char **); +static int arla_quit(int, char **); +static int arla_checkserver(int, char **); +static int arla_conn_status(int, char **); +static int arla_vol_status(int, char **); +static int arla_cred_status(int, char **); +static int arla_fcache_status(int, char **); +static int arla_cell_status (int, char **); +static int arla_sysname(int, char**); +#ifdef RXDEBUG +static int arla_rx_status(int argc, char **argv); +#endif +static int arla_flushfid(int argc, char **argv); + +static SL_cmd cmds[] = { + {"chdir", arla_chdir, "chdir directory"}, + {"cd"}, + {"ls", arla_ls, "ls"}, + {"cat", arla_cat, "cat file"}, + {"cp", arla_cp, "copy file"}, + {"wc", arla_wc, "wc file"}, + {"help", help, "help"}, + {"?"}, + {"checkservers", arla_checkserver, "poll servers are down"}, + {"conn-status", arla_conn_status, "connection status"}, + {"vol-status", arla_vol_status, "volume cache status"}, + {"cred-status", arla_cred_status, "credentials status"}, + {"fcache-status", arla_fcache_status, "file cache status"}, + {"cell-status", arla_cell_status, "cell status"}, +#ifdef RXDEBUG + {"rx-status", arla_rx_status, "rx connection status"}, +#endif + {"flushfid", arla_flushfid, "flush a fid from the cache"}, + {"quit", arla_quit, "quit"}, + {"exit"}, + {"sysname", arla_sysname, "sysname"}, + { NULL } +}; + +/* An emulation of kernel lookup, convert (startdir, fname) into + * (startdir). Strips away leading /afs, removes duobles slashes, + * and resolves symlinks. + * Return 0 for success, otherwise -1. + */ + +static int +walk (VenusFid *startdir, char *fname) +{ + VenusFid cwd = *startdir; + char *base; + VenusFid file; + Result ret; + FCacheEntry *entry; + int error; + char symlink[MAXPATHLEN]; + char store_name[MAXPATHLEN]; + + strlcpy(store_name, fname, sizeof(store_name)); + fname = store_name; + + do { + /* set things up so that fname points to the remainder of the path, + * whereas base points to the whatever preceeds the first / + */ + base = fname; + fname = strchr(fname, '/'); + if (fname) { + /* deal with repeated adjacent / chars by eliminating the + * duplicates. + */ + while (*fname == '/') { + *fname = '\0'; + fname++; + } + } + + /* deal with absolute pathnames first. */ + if (*base == '\0') { + cwd = rootcwd; + if (fname) { + if (strncmp("afs",fname,3) == 0) { + fname += 3; + } + continue; + } else { + break; + } + } + ret = cm_lookup (&cwd, base, &file, &ce, TRUE); + if (ret.res) { + arla_warn (ADEBWARN, ret.error, "lookup(%s)", base); + return -1; + } + error = fcache_get_data (&entry, &file, &ce); + if (error) { + arla_warn (ADEBWARN, error, "fcache_get"); + return -1; + } + + /* handle symlinks here */ + if (entry->status.FileType == TYPE_LINK) { + int len; + int fd; + + fd = fcache_open_file (entry, O_RDONLY); + /* read the symlink and null-terminate it */ + if (fd < 0) { + fcache_release(entry); + arla_warn (ADEBWARN, errno, "fcache_open_file"); + return -1; + } + len = read (fd, symlink, sizeof(symlink)); + close (fd); + if (len <= 0) { + fcache_release(entry); + arla_warnx (ADEBWARN, "cannot read symlink"); + return -1; + } + symlink[len] = '\0'; + /* if we're not at the end (i.e. fname is not null), take + * the expansion of the symlink and append fname to it. + */ + if (fname != NULL) { + strcat (symlink, "/"); + strcat (symlink, fname); + } + strlcpy(store_name, symlink, sizeof(store_name)); + fname = store_name; + } else { + /* if not a symlink, just update cwd */ + cwd = file; + } + fcache_release(entry); + + /* the *fname condition below deals with a trailing / in a + * path-name */ + } while (fname != NULL && *fname); + *startdir = cwd; + return 0; +} + +static int +arla_quit (int argc, char **argv) +{ + printf("Thank you for using arla\n"); + return 1; +} + +static int +arla_flushfid(int argc, char **argv) +{ + AFSCallBack broken_callback = {0, 0, CBDROPPED}; + VenusFid fid; + + if (argc != 2) { + fprintf(stderr, "flushfid fid\n"); + return 0; + } + + if ((sscanf(argv[1], "%d.%d.%d.%d", &fid.Cell, &fid.fid.Volume, + &fid.fid.Vnode, &fid.fid.Unique)) == 4) { + ; + } else if ((sscanf(argv[1], "%d.%d.%d", &fid.fid.Volume, + &fid.fid.Vnode, &fid.fid.Unique)) == 3) { + fid.Cell = cwd.Cell; + } else { + fprintf(stderr, "flushfid fid\n"); + return 0; + } + + fcache_stale_entry(fid, broken_callback); + + return 0; +} + + +static int +arla_chdir (int argc, char **argv) +{ + if (argc != 2) { + printf ("usage: %s dir\n", argv[0]); + return 0; + } + + if(walk (&cwd, argv[1])) + printf ("walk %s failed\n", argv[1]); + return 0; +} + +static void +print_dir (VenusFid *fid, const char *name, void *v) +{ + printf("(%d, %d, %d, %d): %s\n", fid->Cell, + fid->fid.Volume, + fid->fid.Vnode, + fid->fid.Unique, name); +} + +struct ls_context { + VenusFid *dir_fid; + CredCacheEntry *ce; +}; + +static void +print_dir_long (VenusFid *fid, const char *name, void *v) +{ + Result res; + int ret; + AFSFetchStatus status; + VenusFid realfid; + AccessEntry *ae; + struct ls_context *context = (struct ls_context *)v; + char type; + CredCacheEntry *ce = context->ce; + VenusFid *dir_fid = context->dir_fid; + char timestr[20]; + struct tm *t; + time_t ti; + + if (VenusFid_cmp(fid, dir_fid) == 0) + return; + + ret = followmountpoint (fid, dir_fid, NULL, &ce); + if (ret) { + printf ("follow %s: %d\n", name, ret); + return; + } + + /* Have we follow a mountpoint to ourself ? */ + if (VenusFid_cmp(fid, dir_fid) == 0) + return; + + res = cm_getattr (*fid, &status, &realfid, context->ce, &ae); + if (res.res) { + printf ("%s: %d\n", name, res.res); + return; + } + + switch (status.FileType) { + case TYPE_FILE : + type = '-'; + break; + case TYPE_DIR : + type = 'd'; + break; + case TYPE_LINK : + type = 'l'; + break; + default : + abort (); + } + + printf("(%4d, %8d, %8d, %8d): ", + fid->Cell, + fid->fid.Volume, + fid->fid.Vnode, + fid->fid.Unique); + + ti = status.ClientModTime; + t = localtime (&ti); + strftime (timestr, sizeof(timestr), "%Y-%m-%d", t); + printf ("%c%c%c%c%c%c%c%c%c%c %2d %6d %6d %8d %s ", + type, + status.UnixModeBits & 0x100 ? 'w' : '-', + status.UnixModeBits & 0x080 ? 'r' : '-', + status.UnixModeBits & 0x040 ? 'x' : '-', + status.UnixModeBits & 0x020 ? 'w' : '-', + status.UnixModeBits & 0x010 ? 'r' : '-', + status.UnixModeBits & 0x008 ? 'x' : '-', + status.UnixModeBits & 0x004 ? 'w' : '-', + status.UnixModeBits & 0x002 ? 'r' : '-', + status.UnixModeBits & 0x001 ? 'x' : '-', + status.LinkCount, + status.Owner, + status.Group, + status.Length, + timestr); + + printf ("v %d ", status.DataVersion); + + printf ("%s\n", name); +} + +static int +arla_ls (int argc, char **argv) +{ + struct getargs args[] = { + {NULL, 'l', arg_flag, NULL}, + }; + int l_flag = 0; + int error; + int optind = 0; + struct ls_context context; + + args[0].value = &l_flag; + + if (getarg (args, sizeof(args)/sizeof(*args), argc, argv, &optind)) { + arg_printusage (args, sizeof(args)/sizeof(*args), "ls", NULL); + return 0; + } + context.dir_fid = &cwd; + context.ce = ce; + error = adir_readdir (&cwd, l_flag ? print_dir_long : print_dir, + &context, &ce); + if (error) + printf ("adir_readdir failed: %s\n", koerr_gettext(error)); + return 0; +} + +static int +arla_sysname (int argc, char **argv) +{ + switch (argc) { + case 1: + printf("sysname: %s\n", arlasysname); + break; + case 2: + strlcpy(arlasysname, argv[1], SYSNAMEMAXLEN); + printf("setting sysname to: %s\n", arlasysname); + break; + default: + printf("syntax: sysname <sysname>\n"); + break; + } + return 0; +} + + +static int +arla_cat_et_wc (int argc, char **argv, int do_cat, int out_fd) +{ + VenusFid fid; + int fd; + char buf[8192]; + int ret; + FCacheEntry *e; + size_t size = 0; + + if (argc != 2) { + printf ("usage: %s file\n", argv[0]); + return 0; + } + fid = cwd; + if(walk (&fid, argv[1]) == 0) { + + ret = fcache_get_data (&e, &fid, &ce); + if (ret) { + printf ("fcache_get_data failed: %d\n", ret); + return 0; + } + + fd = fcache_open_file (e, O_RDONLY); + + if (fd < 0) { + fcache_release(e); + printf ("fcache_open_file failed: %d\n", errno); + return 0; + } + while ((ret = read (fd, buf, sizeof(buf))) > 0) { + if(do_cat) + write (out_fd, buf, ret); + else + size += ret; + } + if(!do_cat) + printf("%lu %s\n", (unsigned long)size, argv[1]); + close (fd); + fcache_release(e); + } + return 0; +} + +static int +arla_cat (int argc, char **argv) +{ + return arla_cat_et_wc(argc, argv, 1, STDOUT_FILENO); +} + +static int +arla_cp (int argc, char **argv) +{ + char *nargv[3]; + int fd, ret; + + if (argc != 3) { + printf ("usage: %s from-file to-file\n", argv[0]); + return 0; + } + + fd = open (argv[2], O_CREAT|O_WRONLY|O_TRUNC, 0600); + if (fd < 0) { + warn ("open"); + return 0; + } + + nargv[0] = argv[0]; + nargv[1] = argv[1]; + nargv[2] = NULL; + + ret = arla_cat_et_wc(argc-1, nargv, 1, fd); + close (fd); + return ret; + +} + +static int +arla_wc (int argc, char **argv) +{ + return arla_cat_et_wc(argc, argv, 0, -1); +} + + +static int +help (int argc, char **argv) +{ + sl_help(cmds, argc, argv); + return 0; +} + +static int +arla_checkserver (int argc, char **argv) +{ + u_int32_t hosts[12]; + int num = sizeof(hosts)/sizeof(hosts[0]); + + conn_downhosts(cwd.Cell, hosts, &num, 0); + if (num < 0 || num > sizeof(hosts)/sizeof(hosts[0])) { + fprintf (stderr, "conn_downhosts returned bogus num: %d\n", num); + return 0; + } + if (num == 0) { + printf ("no servers down in %s\n", cell_num2name(cwd.Cell)); + } else { + while (num) { + struct in_addr in; + in.s_addr = hosts[num]; + printf ("down: %s\n", inet_ntoa(in)); + num--; + } + } + + return 0; +} + +static int +arla_conn_status (int argc, char **argv) +{ + conn_status (); + return 0; +} + +static int +arla_vol_status (int argc, char **argv) +{ + volcache_status (); + return 0; +} + +static int +arla_cred_status (int argc, char **argv) +{ + cred_status (); + return 0; +} + +static int +arla_fcache_status (int argc, char **argv) +{ + fcache_status (); + return 0; +} + +static int +arla_cell_status (int argc, char **argv) +{ + cell_entry *c; + + if (argc != 2) { + printf ("usage: %s <cell-name>\n", argv[0]); + return 0; + } + c = cell_get_by_name(argv[1]); + if (c == NULL) + printf ("no such cell\n"); + else + cell_print_cell (c, stdout); + return 0; +} + +#ifdef RXDEBUG +static int +arla_rx_status(int argc, char **argv) +{ + rx_PrintStats(stderr); + return 0; +} +#endif + + +#ifdef KERBEROS + +static int +get_cred(const char *princ, const char *inst, const char *krealm, + CREDENTIALS *c) +{ + KTEXT_ST foo; + int k_errno; + + k_errno = krb_get_cred((char*)princ, (char*)inst, (char*)krealm, c); + + if(k_errno != KSUCCESS) { + k_errno = krb_mk_req(&foo, (char*)princ, (char*)inst, (char*)krealm, 0); + if (k_errno == KSUCCESS) + k_errno = krb_get_cred((char*)princ, (char*)inst, (char*)krealm, c); + } + return k_errno; +} + +#endif /* KERBEROS */ + + +void +arla_start (char *device_file, const char *cache_dir) +{ + int error; +#ifdef KERBEROS + { + krbstruct krbdata; + int ret; + char *realm; + const char *this_cell = cell_getthiscell (); + const char *db_server = cell_findnamedbbyname (this_cell); + + if (db_server == NULL) + arla_errx (1, ADEBERROR, + "no db server for cell %s", this_cell); + realm = krb_realmofhost (db_server); + + ret = get_cred("afs", this_cell, realm, &krbdata.c); + if (ret) + ret = get_cred("afs", "", realm, &krbdata.c); + + if (ret) { + arla_warnx (ADEBWARN, + "getting ticket for %s: %s", + this_cell, + krb_get_err_text (ret)); + } else if (cred_add_krb4(getuid(), getuid(), &krbdata.c) == NULL) { + arla_warnx (ADEBWARN, "Could not insert tokens to arla"); + } + } +#endif + + ce = cred_get (cell_name2num(cell_getthiscell()), getuid(), CRED_ANY); + + xfs_message_init (); + kernel_opendevice ("null"); + + arla_warnx (ADEBINIT, "Getting root..."); + error = getroot (&rootcwd, ce); + if (error) + arla_err (1, ADEBERROR, error, "getroot"); + cwd = rootcwd; + arla_warnx(ADEBINIT, "arla loop started"); + sl_loop(cmds, "arla> "); + store_state(); +} + +char * +get_default_cache_dir (void) +{ + static char cache_path[MAXPATHLEN]; + char *home; + + home = getenv("HOME"); + if (home == NULL) + home = "/var/tmp"; + + snprintf (cache_path, sizeof(cache_path), "%s/.arla-cache", + home); + return cache_path; +} + +static struct getargs args[] = { + {"conffile", 'c', arg_string, &conf_file, + "path to configuration file", "file"}, + {"check-consistency", 'C', arg_flag, &cm_consistency, + "if we want extra paranoid consistency checks", NULL }, + {"log", 'l', arg_string, &log_file, + "where to write log (stderr (default), syslog, or path to file)", NULL}, + {"debug", 0, arg_string, &debug_levels, + "what to write in the log", NULL}, + {"connected-mode", 0, arg_string, &connected_mode_string, + "initial connected mode [conncted|fetch-only|disconnected]", NULL}, + {"dynroot", 'D', arg_flag, &dynroot_enable, + "if dynroot is enabled", NULL}, +#ifdef KERBEROS + {"rxkad-level", 'r', arg_string, &rxkad_level_string, + "the rxkad level to use (clear, auth or crypt)", NULL}, +#endif + {"sysname", 's', arg_string, &temp_sysname, + "set the sysname of this system", NULL}, + {"root-volume",0, arg_string, &root_volume}, + {"port", 0, arg_integer, &client_port, + "port number to use", "number"}, + {"recover", 'z', arg_negative_flag, &recover, + "don't recover state", NULL}, + {"cache-dir", 0, arg_string, &cache_dir, + "cache directory", "directory"}, + {"workers", 0, arg_integer, &num_workers, + "number of worker threads", NULL}, + {"fake-mp", 0, arg_flag, &fake_mp, + "enable fake mountpoints", NULL}, + {"version", 0, arg_flag, &version_flag, + NULL, NULL}, + {"help", 0, arg_flag, &help_flag, + NULL, NULL} +}; + +static void +usage (int ret) +{ + arg_printusage (args, sizeof(args)/sizeof(*args), NULL, "[device]"); + exit (ret); +} + +int +main (int argc, char **argv) +{ + int optind = 0; + int ret; + + set_progname (argv[0]); + + if (getarg (args, sizeof(args)/sizeof(*args), argc, argv, &optind)) + usage (1); + + argc -= optind; + argv += optind; + + if (help_flag) + usage (0); + + if (version_flag) + errx (1, "%s", arla_version); + + if (argc != 0) + usage (1); + + default_log_file = "/dev/stderr"; + + ret = arla_init(argc, argv); + if (ret) + return ret; + + arla_start (NULL, cache_dir); + + return 0; +} diff --git a/usr.sbin/afs/src/arlad/arla.conf.5 b/usr.sbin/afs/src/arlad/arla.conf.5 new file mode 100644 index 00000000000..87979fca24a --- /dev/null +++ b/usr.sbin/afs/src/arlad/arla.conf.5 @@ -0,0 +1,49 @@ +.\" Copyright (c) 2000 Kungliga Tekniska Högskolan +.\" $KTH: arla.conf.5,v 1.1 2000/09/09 14:24:38 lha Exp $ +.Dd Sep 09, 2000 +.Dt arla.conf 5 +.Os Arla +.Sh NAME +.Nm arla.conf +.Nd +configuration file for the arla afs implementation. +.Sh SYNOPSIS +The default configuration file works very well in most cases. +.Sh DESCRIPTION +Most flags can be overridden by command line arguments to +.Nm arlad . +.Pp +Supported flags: +.Bl -tag -width Ds +.It high_vnodes +The upper limit of +.Nm arlad's +vnodes (think files and directories). +.It low_vnodes +The number of used vnodes we try to keep in the cache. Any higher +number of used nodes will trigger the cleaner thread. +.It high_bytes +The high watermark for files used by arlad. +.It low_bytes +The number of bytes we try to keep in the cache. Any higher number of +bytes will trigger the cleaner thread. +.It numcreds +The number of credentials in arla, both unauthentic, and authentic +(like Kerberos V4 creds). +.It numconns +The maxium connections arla will have to all servers (fileserver and +vldb-server). +.It numvols +The number of volumes stored in cache. +.It fpriority +File priority, the describes how the cleaner process will clean out +files when set to a non-zero value. You might lose files that you fell +is important (and isn't marked with priority flag) when you are in +disconnected mode. You might not want to set this since then you'll +loose valuble diskspace for to `sticky' files. +.El +.Sh SEE ALSO +.Xr arlad 8 , +.Xr ThisCell 5 , +.Xr CellServDB 5 , +.Xr TheseCells 5 diff --git a/usr.sbin/afs/src/arlad/arlad.8 b/usr.sbin/afs/src/arlad/arlad.8 new file mode 100644 index 00000000000..3d3aac00ac5 --- /dev/null +++ b/usr.sbin/afs/src/arlad/arlad.8 @@ -0,0 +1,162 @@ +.\" $OpenBSD: arlad.8,v 1.1 2002/06/07 04:14:22 hin Exp $ +.\" $KTH: arlad.8,v 1.7.2.2 2001/05/06 22:49:03 ahltorp Exp $ +.Dd September 5, 1998 +.Dt ARLAD 1 +.Os +.Sh NAME +.Nm arlad +.Nd AFS cache manager for xfs +.Sh SYNOPSIS +.Nm +.Op Fl t | Fl -test +.Oo Fl c Ar string \*(Ba Xo +.Fl -conffile= Ns Ar string Oc +.Xc +.Oo Fl l Ar string \*(Ba Xo +.Fl -log= Ns Ar string Oc +.Xc +.Op Fl -debug= Ns Ar string +.Oo Fl d Ar string \*(Ba Xo +.Fl -device= Ns Ar string Oc +.Xc +.Op Fl -connected-mode= Ns Ar string +.Op Fl n | Fl -no-fork +.Oo Fl r Ar string \*(Ba Xo +.Fl -rxkad-level= Ns Ar string Oc +.Xc +.Oo Fl s Ar string \*(Ba Xo +.Fl -sysname= Ns Ar string Oc +.Xc +.Op Fl -root-volume= Ns Ar string +.Op Fl -port= Ns Ar number +.Op Fl z | Fl -recover +.Op Fl -cache-dir= Ns Ar string +.Op Fl D | -dynroot +.Op Fl -version +.Op Fl -help +.Op Ar device +.Sh DESCRIPTION +.Nm +runs on AFS client machines. +It is used to manage the file cache, fetch files +from AFS servers, handle callbacks and manage the authentication information +for users. +.Pp +In normal cases you will not need to run +.Nm +by yourself, a system startup script will start +.Nm +or you can use startarla. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Xo +.Fl t Ns , +.Fl -test +.Xc +Run in test mode. +.It Xo +.Fl c Ar string Ns , +.Fl -conffile= Ns Ar string +.Xc +Path to configuration file. +.It Xo +.Fl l Ar string Ns , +.Fl -log= Ns Ar string +.Xc +Where to write log [stderr|syslog|path] (default: stderr). +.It Xo +.Fl -debug= Ns Ar string +.Xc +What to write in the log (default: none). +.It Xo +.Fl d Ar string Ns , +.Fl -device= Ns Ar string +.Xc +The XFS device to use +.Po default: Pa /dev/xfs0 +.Pc . +.It Xo +.Fl -connected-mode= Ns Ar string +.Xc +Initial connected mode [conncted|fetch-only|disconnected]. +.It Xo +.Fl n Ns , +.Fl -no-fork +.Xc +Don't fork and daemonize. +.It Xo +.Fl r Ar string Ns , +.Fl -rxkad-level= Ns Ar string +.Xc +The rxkad level to use [clear|auth|crypt] (default: auth). +.It Xo +.Fl s Ar string Ns , +.Fl -sysname= Ns Ar string +.Xc +Set the sysname of this system. +.It Xo +.Fl -root-volume= Ns Ar string +.Xc +Name of the root volume. +.It Xo +.Fl -port= Ns Ar number +.Xc +Port number to use. +.It Xo +.Fl z Ns , +.Fl -recover +.Xc +Don't recover state. +.It Xo +.Fl -cache-dir= Ns Ar string +.Xc +Cache directory +.Po default: Pa /var/spool/afs +.Pc . +.It Xo +.Fl D Ns , +.Fl -dynroot +.Xc +Use dynamic root. +.It Xo +.Fl -version +.Xc +Print version information. +.It Xo +.Fl -help +.Xc +Print usage information. +.El +.Sh FILES +.Bl -tag -width CellServDB -compact +.It Pa arlad.conf +default configuration for arlad +.It Pa CellServDB +database with all known AFS servers +.It Pa ThisCell +our default cell (where we get the root directory) +.El +.Pp +It is highly recommended that the default cache directory be a separate +file system. +When enough memory is available this could be a mfs to +drastically improve performance. +.Sh SEE ALSO +.Xr arlad 1 , +.Xr mount_xfs 8 , +.Xr vos 8 , +.Xr fs 1 , +.Xr pts 1 , +.Xr CellServDB 5 , +.Xr DynRootDB 5 , +.Xr ThisCell 5 , +.Xr SuidCells 5 , +.Xr arla.conf 5 +.Sh BUGS +If +.Nm +happens to crash, it's recommended to restart it with the +.Fl z +flag. +Otherwise a corrupted cache can be reused. diff --git a/usr.sbin/afs/src/arlad/arlad.c b/usr.sbin/afs/src/arlad/arlad.c new file mode 100644 index 00000000000..c8630166e2d --- /dev/null +++ b/usr.sbin/afs/src/arlad/arlad.c @@ -0,0 +1,274 @@ +/* + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <arla_local.h> +#include <getarg.h> +#include <arla-version.h> +RCSID("$KTH: arlad.c,v 1.5.2.2 2001/07/26 02:05:26 assar Exp $"); + +#define KERNEL_STACKSIZE (16*1024) + +char *default_log_file = "syslog"; +int client_port = 4711; + +static char *pid_filename; + + +/* + * + */ + + +static void +write_pid_file (const char *progname) +{ + FILE *fp; + + asprintf (&pid_filename, "/var/run/%s.pid", progname); + if (pid_filename == NULL) + return; + fp = fopen (pid_filename, "w"); + if (fp == NULL) + return; + fprintf (fp, "%u", (unsigned)getpid()); + fclose (fp); +} + +static void +delete_pid_file (void) +{ + if (pid_filename != NULL) { + unlink (pid_filename); + free (pid_filename); + pid_filename = NULL; + } +} + +/* + * signal handlers... + */ + +static void +sigint (int foo) +{ + arla_warnx (ADEBMISC, "fatal signal received"); + store_state (); + delete_pid_file (); + exit (0); +} + +static void +sighup (int foo) +{ + store_state (); + delete_pid_file (); +} + +static void +sigusr1 (int foo) +{ + exit(0); +} + +static void +sigchild (int foo) +{ + exit(1); +} + +static void +daemonify (void) +{ + pid_t pid; + int fd; + + pid = fork (); + if (pid < 0) + arla_err (1, ADEBERROR, errno, "fork"); + else if (pid > 0) { + signal(SIGUSR1, sigusr1); + signal(SIGCHLD, sigchild); + while (1) pause(); + exit(0); + } + if (setsid() == -1) + arla_err (1, ADEBERROR, errno, "setsid"); + fd = open(_PATH_DEVNULL, O_RDWR, 0); + if (fd < 0) + arla_err (1, ADEBERROR, errno, "open " _PATH_DEVNULL); + dup2 (fd, STDIN_FILENO); + dup2 (fd, STDOUT_FILENO); + dup2 (fd, STDERR_FILENO); + if (fd > 2) + close (fd); +} + + +void +arla_start (char *device_file, const char *cache_dir) +{ + struct kernel_args kernel_args; + PROCESS kernelpid; + + signal (SIGINT, sigint); + signal (SIGTERM, sigint); + signal (SIGHUP, sighup); + umask (S_IRWXG|S_IRWXO); /* 077 */ + +#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_DUMPABLE) + prctl(PR_SET_DUMPABLE, 1); +#endif + + xfs_message_init (); + kernel_opendevice (device_file); + + kernel_args.num_workers = num_workers; + + if (LWP_CreateProcess (kernel_interface, KERNEL_STACKSIZE, 1, + (char *)&kernel_args, + "Kernel-interface", &kernelpid)) + arla_errx (1, ADEBERROR, + "Cannot create kernel-interface process"); + + write_pid_file ("arlad"); + + if (chroot (cache_dir) < 0) + arla_err (1, ADEBERROR, errno, "chroot %s", cache_dir); + + if (fork_flag) + kill(getppid(), SIGUSR1); + + LWP_WaitProcess ((char *)arla_start); + abort (); +} + +char * +get_default_cache_dir (void) +{ + return ARLACACHEDIR; +} + +char *device_file = "/dev/xfs0"; + +static struct getargs args[] = { + {"conffile", 'c', arg_string, &conf_file, + "path to configuration file", "file"}, + {"check-consistency", 'C', arg_flag, &cm_consistency, + "if we want extra paranoid consistency checks", NULL }, + {"log", 'l', arg_string, &log_file, + "where to write log (stderr (default), syslog, or path to file)", NULL}, + {"debug", 0, arg_string, &debug_levels, + "what to write in the log", NULL}, + {"device", 'd', arg_string, &device_file, + "the XFS device to use [/dev/xfs0]", "path"}, + {"connected-mode", 0, arg_string, &connected_mode_string, + "initial connected mode [conncted|fetch-only|disconnected]", NULL}, + {"dynroot", 'D', arg_flag, &dynroot_enable, + "if dynroot is enabled", NULL}, + {"fork", 'n', arg_negative_flag, &fork_flag, + "don't fork and demonize", NULL}, +#ifdef KERBEROS + {"rxkad-level", 'r', arg_string, &rxkad_level_string, + "the rxkad level to use (clear, auth or crypt)", NULL}, +#endif + {"sysname", 's', arg_string, &temp_sysname, + "set the sysname of this system", NULL}, + {"root-volume",0, arg_string, &root_volume}, + {"port", 0, arg_integer, &client_port, + "port number to use", "number"}, + {"recover", 'z', arg_negative_flag, &recover, + "don't recover state", NULL}, + {"cache-dir", 0, arg_string, &cache_dir, + "cache directory", "directory"}, + {"workers", 0, arg_integer, &num_workers, + "number of worker threads", NULL}, + {"fake-mp", 0, arg_flag, &fake_mp, + "enable fake mountpoints", NULL}, + {"cpu-usage", 0, arg_flag, &cpu_usage, + NULL, NULL}, + {"version", 0, arg_flag, &version_flag, + NULL, NULL}, + {"help", 0, arg_flag, &help_flag, + NULL, NULL} +}; + +static void +usage (int ret) +{ + arg_printusage (args, sizeof(args)/sizeof(*args), NULL, "[device]"); + exit (ret); +} + +int +main (int argc, char **argv) +{ + int optind = 0; + int ret; + + set_progname (argv[0]); + + if (getarg (args, sizeof(args)/sizeof(*args), argc, argv, &optind)) + usage (1); + + argc -= optind; + argv += optind; + + if (help_flag) + usage (0); + + if (version_flag) + errx (1, "%s", arla_version); + + if (argc > 0) { + device_file = *argv; + argc--; + argv++; + } + + if (argc != 0) + usage (1); + + if (!fork_flag) + default_log_file = "/dev/stderr"; + + if (fork_flag) + daemonify (); + + ret = arla_init(argc, argv); + if (ret) + return ret; + + arla_start (device_file, cache_dir); + + return 0; +} diff --git a/usr.sbin/afs/src/arlad/arladebu.c b/usr.sbin/afs/src/arlad/arladebu.c new file mode 100644 index 00000000000..336a6582dbb --- /dev/null +++ b/usr.sbin/afs/src/arlad/arladebu.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <roken.h> +#include <parse_units.h> +#include <fs.h> +#include "arladeb.h" + +RCSID("$KTH: arladebu.c,v 1.3 2000/10/02 22:30:38 lha Exp $"); + +#define all (ADEBERROR | ADEBWARN | ADEBDISCONN | ADEBFBUF | \ + ADEBMSG | ADEBKERNEL | ADEBCLEANER | ADEBCALLBACK | \ + ADEBCM | ADEBVOLCACHE | ADEBFCACHE | ADEBINIT | \ + ADEBCONN | ADEBMISC | ADEBVLOG) + +struct units arla_deb_units[] = { + { "all", all}, + { "almost-all", all & ~ADEBCLEANER}, + { "venuslog", ADEBVLOG }, + { "errors", ADEBERROR }, + { "warnings", ADEBWARN }, + { "disconn", ADEBDISCONN }, + { "fbuf", ADEBFBUF }, + { "messages", ADEBMSG }, + { "kernel", ADEBKERNEL }, + { "cleaner", ADEBCLEANER }, + { "callbacks", ADEBCALLBACK }, + { "cache-manager", ADEBCM }, + { "volume-cache", ADEBVOLCACHE }, + { "file-cache", ADEBFCACHE }, + { "initialization", ADEBINIT }, + { "connection", ADEBCONN }, + { "miscellaneous", ADEBMISC }, + { "default", ARLA_DEFAULT_LOG }, + { "none", 0 }, + { NULL } +}; + +void +arla_log_print_levels (FILE *f) +{ + print_flags_table (arla_deb_units, f); +} diff --git a/usr.sbin/afs/src/cf/bsd-func-selrecord.m4 b/usr.sbin/afs/src/cf/bsd-func-selrecord.m4 new file mode 100644 index 00000000000..c4d10e96f9f --- /dev/null +++ b/usr.sbin/afs/src/cf/bsd-func-selrecord.m4 @@ -0,0 +1,25 @@ +dnl +dnl $KTH: bsd-func-selrecord.m4,v 1.1.2.2 2001/09/03 23:13:59 ahltorp Exp $ +dnl + +AC_DEFUN(AC_BSD_FUNC_SELRECORD, [ +AC_CACHE_CHECK(if selrecord takes three arguments, +ac_cv_func_selrecord_three_args, +AC_TRY_COMPILE_KERNEL([ +#ifdef HAVE_SYS_CDEFS_H +#include <sys/cdefs.h> +#endif +#include <sys/types.h> +#include <sys/param.h> +#include <sys/time.h> +#include <sys/proc.h> +#include <sys/systm.h> +#include <sys/select.h> +], [selrecord(NULL, NULL, NULL)], +ac_cv_func_selrecord_three_args=yes, +ac_cv_func_selrecord_three_args=no)) +if test "$ac_cv_func_selrecord_three_args" = yes; then + AC_DEFINE(HAVE_THREE_ARGUMENT_SELRECORD, 1, + [define if selrecord takes three arguments]) +fi +]) diff --git a/usr.sbin/afs/src/cf/bsd-uvm-only.m4 b/usr.sbin/afs/src/cf/bsd-uvm-only.m4 new file mode 100644 index 00000000000..8f535daab18 --- /dev/null +++ b/usr.sbin/afs/src/cf/bsd-uvm-only.m4 @@ -0,0 +1,34 @@ +dnl +dnl $KTH: bsd-uvm-only.m4,v 1.2 2000/10/04 00:01:06 lha Exp $ +dnl + +AC_DEFUN(AC_CHECK_BSD_UVM_ONLY,[ +AC_CACHE_CHECK(if we can only include uvm headers, +ac_cv_kernel_uvm_only, +AC_TRY_COMPILE_KERNEL([ +#include <sys/types.h> +#include <sys/param.h> +#ifdef HAVE_VM_VM_H +#include <vm/vm.h> +#endif +#ifdef HAVE_VM_VM_EXTERN_H +#include <vm/vm_extern.h> +#endif +#ifdef HAVE_VM_VM_ZONE_H +#include <vm/vm_zone.h> +#endif +#ifdef HAVE_VM_VM_OBJECT_H +#include <vm/vm_object.h> +#endif +#ifdef HAVE_UVM_UVM_EXTERN_H +#include <uvm/uvm_extern.h> +#endif +], [int suvmtiuk = 1; +], +ac_cv_kernel_uvm_only=yes, +ac_cv_kernel_uvm_only=no))] +if test "$ac_cv_kernel_uvm_only" = no; then +AC_DEFINE(HAVE_KERNEL_UVM_ONLY, 1, +[define if we only can include uvm headers]) +fi +) diff --git a/usr.sbin/afs/src/cf/check-roken.m4 b/usr.sbin/afs/src/cf/check-roken.m4 new file mode 100644 index 00000000000..60fc62b45ac --- /dev/null +++ b/usr.sbin/afs/src/cf/check-roken.m4 @@ -0,0 +1,84 @@ +dnl +dnl $KTH: check-roken.m4,v 1.1.2.1 2002/02/01 14:18:23 ahltorp Exp $ +dnl + +AC_DEFUN(AC_CHECK_ROKEN,[ + +ROKEN_H=roken.h +DIR_roken=roken +LIB_roken='$(top_builddir)/lib/roken/libroken.a' +INC_roken='-I$(top_builddir)/include' + +AC_ARG_WITH(roken, +[ --with-roken=dir make with roken in dir], +[if test "$with_roken" != "no"; then + ROKEN_H= + DIR_roken= + if test "X$withval" != "X"; then + LIB_roken="$withval/lib/libroken.a" + INC_roken="-I$withval/include" + else + LIB_roken='-lroken' + INC_roken= + fi +fi]) + +AC_ARG_WITH(roken-include, +[ --roken-include=dir make with roken headers in dir], +[if test "$with_roken" != "no"; then + ROKEN_H= + DIR_roken= + if test "X$withval" != "X"; then + INC_roken="-I$withval" + else + INC_roken= + fi +fi]) + +AC_ARG_WITH(roken-lib, +[ --roken-lib=dir make with roken lib in dir], +[if test "$with_roken" != "no"; then + ROKEN_H= + DIR_roken= + if test "X$withval" != "X"; then + LIB_roken="$withval/libroken.a" + else + LIB_roken="-lroken" + fi +fi]) + +if test "X$ROKEN_H" = "X"; then + +AC_CACHE_CHECK([check what roken depends on ],[ac_cv_roken_deps],[ +ac_cv_roken_deps="error" +saved_LIBS="$LIBS" +for a in "" "-lcrypt" ; do + LIBS="$saved_LIBS $LIB_roken $a" + AC_TRY_LINK([],[getarg()],[ + if test "X$a" = "X"; then + ac_cv_roken_deps="nothing" + else + ac_cv_roken_deps="$a" + fi],[]) + LIBS="$saved_LIBS" + if test $ac_cv_roken_deps != "error"; then break; fi +done +LIBS="$saved_LIBS" +]) + +if test "$ac_cv_roken_deps" = "error"; then + AC_MSG_ERROR([failed to figure out libroken depencies]) +fi + +if test "$ac_cv_roken_deps" != "nothing"; then + LIB_roken="$LIB_roken $ac_cv_roken_deps" +fi + +fi + +AC_SUBST(INC_roken) +AC_SUBST(LIB_roken) +AC_SUBST(DIR_roken) +AC_SUBST(ROKEN_H) + +]) diff --git a/usr.sbin/afs/src/cf/func-krb-get-default-principal.m4 b/usr.sbin/afs/src/cf/func-krb-get-default-principal.m4 new file mode 100644 index 00000000000..e8e000d852d --- /dev/null +++ b/usr.sbin/afs/src/cf/func-krb-get-default-principal.m4 @@ -0,0 +1,30 @@ +dnl +dnl $KTH: func-krb-get-default-principal.m4,v 1.1.2.1 2001/02/02 01:26:07 assar Exp $ +dnl + +dnl +dnl Check for krb_get_default_principal +dnl + +AC_DEFUN(AC_FUNC_KRB_GET_DEFAULT_PRINCIPAL, [ + +AC_CACHE_CHECK(for krb_get_default_principal, ac_cv_func_krb_get_default_principal, [ +if test "$ac_cv_found_krb4" = "yes"; then +save_CPPFLAGS="${CPPFLAGS}" +save_LIBS="${LIBS}" +CPPFLAGS="${KRB4_INC_FLAGS} ${CPPFLAGS}" +LIBS="${KRB4_LIB_FLAGS} ${LIBS}" +AC_TRY_LINK([#include <krb.h>], +[krb_get_default_principal(0, 0, 0);], +ac_cv_func_krb_get_default_principal=yes, +ac_cv_func_krb_get_default_principal=no) +CPPFLAGS="${save_CPPFLAGS}" +LIBS="${save_LIBS}" +else +ac_cv_func_krb_get_default_principal=no +fi +]) +if test "$ac_cv_func_krb_get_default_principal" = "yes"; then + AC_DEFINE(HAVE_KRB_GET_DEFAULT_PRINCIPAL, 1, [define if you have krb_get_default_principal]) +fi +]) diff --git a/usr.sbin/afs/src/cf/kernel-need-proto.m4 b/usr.sbin/afs/src/cf/kernel-need-proto.m4 new file mode 100644 index 00000000000..965aa814f52 --- /dev/null +++ b/usr.sbin/afs/src/cf/kernel-need-proto.m4 @@ -0,0 +1,14 @@ +dnl $KTH: kernel-need-proto.m4,v 1.1.2.1 2001/02/14 12:55:08 lha Exp $ +dnl +dnl +dnl Check if we need the prototype for a function in kernel-space +dnl + +dnl AC_KERNEL_NEED_PROTO(includes, function) + +AC_DEFUN(AC_KERNEL_NEED_PROTO, [ +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $test_KERNEL_CFLAGS $KERNEL_CPPFLAGS" +AC_NEED_PROTO([$1],[$2]) +CFLAGS="$save_CFLAGS" +]) diff --git a/usr.sbin/afs/src/cf/krb-func-getlogin.m4 b/usr.sbin/afs/src/cf/krb-func-getlogin.m4 new file mode 100644 index 00000000000..44aad26a969 --- /dev/null +++ b/usr.sbin/afs/src/cf/krb-func-getlogin.m4 @@ -0,0 +1,23 @@ +dnl +dnl $KTH: krb-func-getlogin.m4,v 1.1 2000/10/14 00:11:05 lha Exp $ +dnl $Heimdal: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $ +dnl +dnl test for POSIX (broken) getlogin +dnl + + +AC_DEFUN(AC_FUNC_GETLOGIN, [ +AC_CHECK_FUNCS(getlogin setlogin) +if test "$ac_cv_func_getlogin" = yes; then +AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [ +if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then + ac_cv_func_getlogin_posix=no +else + ac_cv_func_getlogin_posix=yes +fi +]) +if test "$ac_cv_func_getlogin_posix" = yes; then + AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).]) +fi +fi +]) diff --git a/usr.sbin/afs/src/cf/linux-d_delete-void.m4 b/usr.sbin/afs/src/cf/linux-d_delete-void.m4 new file mode 100644 index 00000000000..c936d8bed01 --- /dev/null +++ b/usr.sbin/afs/src/cf/linux-d_delete-void.m4 @@ -0,0 +1,26 @@ +dnl +dnl $KTH: linux-d_delete-void.m4,v 1.1.2.1 2002/01/31 10:23:22 lha Exp $ +dnl + +AC_DEFUN(AC_LINUX_D_DELETE_VOID, [ +AC_CACHE_CHECK(if d_delete in struct dentry_operations returns void, +ac_cv_member_dentry_operations_d_delete_void, +AC_TRY_COMPILE_KERNEL([#include <asm/current.h> +#include <linux/fs.h> +#include <linux/dcache.h>], +[ +struct dentry_operations foo_operations; + +int hata_foo(void) +{ + return foo_operations.d_delete(0); +} +], +ac_cv_member_dentry_operations_d_delete_void=no, +ac_cv_member_dentry_operations_d_delete_void=yes)) + +if test "$ac_cv_member_dentry_operations_d_delete_void" = "yes"; then + AC_DEFINE(HAVE_D_DELETE_VOID, 1, + [define if d_delete in struct dentry_operations returns void]) +fi +]) diff --git a/usr.sbin/afs/src/cf/linux-filldir-dt-type.m4 b/usr.sbin/afs/src/cf/linux-filldir-dt-type.m4 new file mode 100644 index 00000000000..cb5d60578f0 --- /dev/null +++ b/usr.sbin/afs/src/cf/linux-filldir-dt-type.m4 @@ -0,0 +1,21 @@ +dnl +dnl $KTH: linux-filldir-dt-type.m4,v 1.1.4.1 2001/05/07 01:29:59 ahltorp Exp $ +dnl + +AC_DEFUN(AC_LINUX_FILLDIR_DT_TYPE, [ +AC_CACHE_CHECK([for whether filldir_t includes a dt_type], +ac_cv_type_filldir_dt_type, +AC_TRY_COMPILE_KERNEL([#include <asm/current.h> +#include <linux/fs.h>], +[ +filldir_t bar; + +bar(0, 0, 0, 0, 0, 0); +], +ac_cv_type_filldir_dt_type=yes, +ac_cv_type_filldir_dt_type=no)) + +if test "$ac_cv_type_filldir_dt_type" = "yes"; then + AC_DEFINE(HAVE_FILLDIR_T_DT_TYPE, 1, [define if filldir_t takes a dt_type argument]) +fi +]) diff --git a/usr.sbin/afs/src/cf/linux-func-dget-locked.m4 b/usr.sbin/afs/src/cf/linux-func-dget-locked.m4 new file mode 100644 index 00000000000..2460f69b6cd --- /dev/null +++ b/usr.sbin/afs/src/cf/linux-func-dget-locked.m4 @@ -0,0 +1,20 @@ +dnl +dnl $KTH: linux-func-dget-locked.m4,v 1.1 2000/09/14 07:19:31 assar Exp $ +dnl + +AC_DEFUN(AC_LINUX_FUNC_DGET_LOCKED, [ +AC_CACHE_CHECK([for dget_locked], +ac_cv_func_dget_locked, [ +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $test_KERNEL_CFLAGS $KERNEL_CPPFLAGS" +AC_EGREP_CPP([dget_locked], +[#include <linux/dcache.h>], +ac_cv_func_dget_locked=yes, +ac_cv_func_dget_locked=no)] +CPPFLAGS="$save_CPPFLAGS" +) +if test "$ac_cv_func_dget_locked" = "yes"; then + AC_DEFINE(HAVE_DGET_LOCKED, 1, + [define if you have a function dget_locked]) +fi +]) diff --git a/usr.sbin/afs/src/cf/linux-func-list-del-init.m4 b/usr.sbin/afs/src/cf/linux-func-list-del-init.m4 new file mode 100644 index 00000000000..f28f9480890 --- /dev/null +++ b/usr.sbin/afs/src/cf/linux-func-list-del-init.m4 @@ -0,0 +1,20 @@ +dnl +dnl $KTH: linux-func-list-del-init.m4,v 1.1.2.1 2002/01/31 13:03:16 lha Exp $ +dnl + +AC_DEFUN(AC_LINUX_FUNC_LIST_DEL_INIT, [ +AC_CACHE_CHECK([for list_del_init], +ac_cv_func_list_del_init, [ +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $test_KERNEL_CFLAGS $KERNEL_CPPFLAGS" +AC_EGREP_CPP([list_del_init], +[#include <linux/list.h>], +ac_cv_func_list_del_init=yes, +ac_cv_func_list_del_init=no)] +CPPFLAGS="$save_CPPFLAGS" +) +if test "$ac_cv_func_list_del_init" = "yes"; then + AC_DEFINE(HAVE_LIST_DEL_INIT, 1, + [define if you have a function list_del_init]) +fi +]) diff --git a/usr.sbin/afs/src/cf/linux-type-wait-queue-task-list.m4 b/usr.sbin/afs/src/cf/linux-type-wait-queue-task-list.m4 new file mode 100644 index 00000000000..99574a3edda --- /dev/null +++ b/usr.sbin/afs/src/cf/linux-type-wait-queue-task-list.m4 @@ -0,0 +1,19 @@ +dnl +dnl $KTH: linux-type-wait-queue-task-list.m4,v 1.1 2000/09/25 09:14:55 lha Exp $ +dnl + +AC_DEFUN(AC_LINUX_TYPE_WAIT_QUEUE_TASK_LIST, [ +AC_CACHE_CHECK([for wait_queue_task_list], +ac_cv_type_wait_queue_task_list,[ +AC_TRY_COMPILE_KERNEL([#include <linux/stddef.h> +#include <linux/wait.h>], +[wait_queue_head_t foo; +void *p; +p = &foo.task_list;], +ac_cv_type_wait_queue_task_list=yes, +ac_cv_type_wait_queue_task_list=no)]) +if test "$ac_cv_type_wait_queue_task_list" = "yes"; then + AC_DEFINE(HAVE_WAIT_QUEUE_TASK_LIST, 1, + [define if you have a wait_queue_task_list]) +fi +]) diff --git a/usr.sbin/afs/src/cf/osf-func-vfs-name-hash.m4 b/usr.sbin/afs/src/cf/osf-func-vfs-name-hash.m4 new file mode 100644 index 00000000000..300b1970971 --- /dev/null +++ b/usr.sbin/afs/src/cf/osf-func-vfs-name-hash.m4 @@ -0,0 +1,47 @@ +dnl +dnl $KTH: osf-func-vfs-name-hash.m4,v 1.1.2.1 2001/05/28 23:22:48 mattiasa Exp $ +dnl + +AC_DEFUN(AC_OSF_FUNC_VFS_NAME_HASH, [ + +AC_CACHE_CHECK(if vfs_name_hash takes four arguments, +ac_cv_func_vfs_name_hash_four_args, +AC_TRY_COMPILE_KERNEL([ +#if defined(__osf__) && defined(__GNUC__) +#define asm __foo_asm +#endif +#include <sys/types.h> +#include <sys/param.h> +#include <sys/proc.h> +#include <sys/lock.h> +#include <sys/vfs_proto.h> +#include <vm/vm_ubc.h> +], [vfs_name_hash(NULL, NULL, NULL, NULL)], +ac_cv_func_vfs_name_hash_four_args=yes, +ac_cv_func_vfs_name_hash_four_args=no)) +if test "$ac_cv_func_vfs_name_hash_four_args" = yes; then + AC_DEFINE(HAVE_FOUR_ARGUMENT_VFS_NAME_HASH, 1, + [define if vfs_name_hash takes four arguments]) +fi + +AC_CACHE_CHECK(if vfs_name_hash takes three arguments, +ac_cv_func_vfs_name_hash_three_args, +AC_TRY_COMPILE_KERNEL([ +#if defined(__osf__) && defined(__GNUC__) +#define asm __foo_asm +#endif +#include <sys/types.h> +#include <sys/param.h> +#include <sys/proc.h> +#include <sys/lock.h> +#include <sys/vfs_proto.h> +#include <vm/vm_ubc.h> +], [vfs_name_hash(NULL, NULL, NULL)], +ac_cv_func_vfs_name_hash_three_args=yes, +ac_cv_func_vfs_name_hash_three_args=no)) +if test "$ac_cv_func_vfs_name_hash_three_args" = yes; then + AC_DEFINE(HAVE_THREE_ARGUMENT_VFS_NAME_HASH, 1, + [define if vfs_name_hash takes three arguments]) +fi + +]) diff --git a/usr.sbin/afs/src/conf/check-cellservdb.pl b/usr.sbin/afs/src/conf/check-cellservdb.pl new file mode 100644 index 00000000000..49a4c5e465b --- /dev/null +++ b/usr.sbin/afs/src/conf/check-cellservdb.pl @@ -0,0 +1,190 @@ +#!/usr/pkg/bin/perl -w +# $KTH: check-cellservdb.pl,v 1.4 2000/08/30 21:26:13 lha Exp $ +# +# Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan +# (Royal Institute of Technology, Stockholm, Sweden). +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Institute nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# +# You can install Net::DNS with ``perl -MCPAN -e install Net::DNS;'' +# + +use strict; +use Net::DNS; +use Getopt::Long; + +my $cell; +my $found; +my %db; +my %comments; + +sub print_cell +{ + my $cell = shift; + my $comment = shift || ""; + + print ">$cell \#$comment\n"; +} + +sub query_local_cell +{ + my $cell = shift; + + print "local cellservdb\n"; + print_cell($cell,$comments{$cell}); + my $hostlist = $db{$cell}; + print foreach (@$hostlist); +} + +sub query_remote_cell +{ + my $cell = shift; + my $hostlist = $db{$cell}; + + print "query remote host\n"; + my $host; + foreach (@$hostlist) { + if (/^([^ \t\n]+)/) { + system "bos listhost -server $1 -db -comment \"$comments{$cell}\" -noauth"; + last if ($? == 0); + } + } +} + +sub query_afsdb +{ + my $cell = shift; + my $comment = $comments{$cell}; + my $res; + my $query; + my $rr; + my @hosts = (); + my $host; + + $res = new Net::DNS::Resolver; + $query = $res->search($cell, "AFSDB"); + + if ($query) { + foreach $rr ($query->answer) { + next unless $rr->type eq "AFSDB" and $rr->subtype == 1; + push @hosts, $rr->hostname; + } + } + if ($#hosts > 0) { + printf ("query dns\n"); + print_cell($cell, $comment); + } + foreach $host (@hosts) { + $query = $res->search($host, "A"); + if ($query) { + foreach $rr ($query->answer) { + next unless $rr->type eq "A"; + print $rr->address, " \#$host\n"; + } + } + } +} + +sub parse_cellservdb +{ + my $cellservdb = shift || "/usr/arla/etc/CellServDB"; + my @hosts; + my $FILE; + + open FILE, "<$cellservdb"; + + while (<FILE>) { + $found = 0; + if (/^>([^ \t]*)[\t ]*#(.*)/) { + $cell = $1; + $comments{$cell} = $2; + $found = 1; + } elsif (/^>([^ \t]*)/) { + $cell = $1; + $comments{$cell} = ""; + $found = 1; + } + if (!$found) { + push @hosts, $_; + my @hostcopy = @hosts; + $db{$cell} = \@hostcopy; + } else { + while (defined(pop @hosts)) {} + } + } + close FILE; +} + +sub usage +{ + print "check-cellservdb.pl"; + print "\t--help\n"; + print "\t--cell <cellname>\n"; + print "\t--CellServDB <file>\n"; + print "\t--nodns\n"; + print "\t--nolocal\n"; + print "\t--noremote\n"; + print "\t--all\n"; + exit 1; +} + +my $cell = 0; +my $all = 0; +my $nodns = 0; +my $noremote = 0; +my $nolocal = 0; +my $cellservdb; + +GetOptions("help" => \&usag, + "cell=s" => \$cell, + "CellServDB=s" => \$cellservdb, + "nodns" => \$nodns, + "noremote" => \$noremote, + "nolocal" => \$nolocal, + "all" => \$all); + + +parse_cellservdb($cellservdb); + +if ($all) { + my $query_cell; + foreach $query_cell (sort { reverse($a) cmp reverse($b) } keys %db) { + + query_local_cell($query_cell) if(!$nolocal); + query_remote_cell($query_cell) if(!$noremote); + query_afsdb($query_cell) if (!$nodns); + } +} elsif ($cell) { + query_local_cell($cell) if(!$nolocal); + query_remote_cell($cell) if(!$noremote); + query_afsdb($cell) if (!$nodns); +} else { + usage(); +} diff --git a/usr.sbin/afs/src/doc/arla-logo.eps b/usr.sbin/afs/src/doc/arla-logo.eps new file mode 100644 index 00000000000..09e519477b1 --- /dev/null +++ b/usr.sbin/afs/src/doc/arla-logo.eps @@ -0,0 +1 @@ +%!PS-Adobe-3.0
%%Creator: Adobe Illustrator(R) 8.0
%%AI8_CreatorVersion: 8
%%For: (- - -) (KTH/Nada)
%%CreationDate: (5/1/00) (8:41 PM)
%%BoundingBox: 112 349 500 552
%%HiResBoundingBox: 112.9502 349.9502 499.0498 552
%%DocumentProcessColors: Black
%%DocumentSuppliedResources: procset Adobe_level2_AI5 1.2 0
%%+ procset Adobe_ColorImage_AI6 1.3 0
%%+ procset Adobe_Illustrator_AI5 1.3 0
%%+ procset Adobe_cshow 2.0 8
%%+ procset Adobe_shading_AI8 1.0 0
%AI5_FileFormat 4.0
%AI3_ColorUsage: Black&White
%AI7_ImageSettings: 0
%%CMYKProcessColor: 1 1 1 1 ([Passm\212rke])
%%AI6_ColorSeparationSet: 1 1 (AI6 Default Color Separation Set)
%%+ Options: 1 16 0 1 0 1 1 1 0 1 1 1 1 8.504 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 2 3 4
%%+ PPD: 1 21 0 0 60 45 2 2 1 0 0 1 0 0 0 0 0 0 0 0 0 0 ()
%AI3_TemplateBox: 306 396 306 396
%AI3_TileBox: 25 -5 584 801
%AI3_DocumentPreview: None
%AI5_ArtSize: 595.2756 841.8898
%AI5_RulerUnits: 2
%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0
%AI5_TargetResolution: 800
%AI5_NumLayers: 2
%AI8_OpenToView: -325.5 991.5 0.6667 1040 762 18 1 1 0 22 0 0
%AI5_OpenViewLayers: 72
%%PageOrigin:25 -5
%%AI3_PaperRect:-17 822 577 -19
%%AI3_Margin:17 -16 -18 19
%AI7_GridSettings: 24 8 24 8 1 0 0.8 0.8 0.8 0.9 0.9 0.9
%%EndComments
%%BeginProlog
%%BeginResource: procset Adobe_level2_AI5 1.2 0
%%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation)
%%Version: 1.2 0
%%CreationDate: (04/10/93) ()
%%Copyright: ((C) 1987-1996 Adobe Systems Incorporated All Rights Reserved)
userdict /Adobe_level2_AI5 26 dict dup begin
put
/packedarray where not
{
userdict begin
/packedarray
{
array astore readonly
} bind def
/setpacking /pop load def
/currentpacking false def
end
0
} if
pop
userdict /defaultpacking currentpacking put true setpacking
/initialize
{
Adobe_level2_AI5 begin
} bind def
/terminate
{
currentdict Adobe_level2_AI5 eq
{
end
} if
} bind def
mark
/setcustomcolor where not
{
/findcmykcustomcolor
{
(AI8_CMYK_CustomColor)
6 packedarray
} bind def
/findrgbcustomcolor
{
(AI8_RGB_CustomColor)
5 packedarray
} bind def
/setcustomcolor
{
exch
aload pop dup
(AI8_CMYK_CustomColor) eq
{
pop pop
4
{
4 index mul
4 1 roll
} repeat
5 -1 roll pop
setcmykcolor
}
{
dup (AI8_RGB_CustomColor) eq
{
pop pop
3
{
1 exch sub
3 index mul
1 exch sub
3 1 roll
} repeat
4 -1 roll pop
setrgbcolor
}
{
pop
4
{
4 index mul 4 1 roll
} repeat
5 -1 roll pop
setcmykcolor
} ifelse
} ifelse
}
def
} if
/setAIseparationgray
{
false setoverprint
0 setgray
/setseparationgray where{
pop setseparationgray
}{
/setcolorspace where{
pop
[/Separation (All) /DeviceCMYK {dup dup dup}] setcolorspace
1 exch sub setcolor
}{
setgray
}ifelse
}ifelse
} def
/gt38? mark {version cvr cvx exec} stopped {cleartomark true} {38 gt exch pop} ifelse def
userdict /deviceDPI 72 0 matrix defaultmatrix dtransform dup mul exch dup mul add sqrt put
userdict /level2?
systemdict /languagelevel known dup
{
pop systemdict /languagelevel get 2 ge
} if
put
/level2ScreenFreq
{
begin
60
HalftoneType 1 eq
{
pop Frequency
} if
HalftoneType 2 eq
{
pop GrayFrequency
} if
HalftoneType 5 eq
{
pop Default level2ScreenFreq
} if
end
} bind def
userdict /currentScreenFreq
level2? {currenthalftone level2ScreenFreq} {currentscreen pop pop} ifelse put
level2? not
{
/setcmykcolor where not
{
/setcmykcolor
{
exch .11 mul add exch .59 mul add exch .3 mul add
1 exch sub setgray
} def
} if
/currentcmykcolor where not
{
/currentcmykcolor
{
0 0 0 1 currentgray sub
} def
} if
/setoverprint where not
{
/setoverprint /pop load def
} if
/selectfont where not
{
/selectfont
{
exch findfont exch
dup type /arraytype eq
{
makefont
}
{
scalefont
} ifelse
setfont
} bind def
} if
/cshow where not
{
/cshow
{
[
0 0 5 -1 roll aload pop
] cvx bind forall
} bind def
} if
} if
cleartomark
/anyColor?
{
add add add 0 ne
} bind def
/testColor
{
gsave
setcmykcolor currentcmykcolor
grestore
} bind def
/testCMYKColorThrough
{
testColor anyColor?
} bind def
userdict /composite?
1 0 0 0 testCMYKColorThrough
0 1 0 0 testCMYKColorThrough
0 0 1 0 testCMYKColorThrough
0 0 0 1 testCMYKColorThrough
and and and
put
composite? not
{
userdict begin
gsave
/cyan? 1 0 0 0 testCMYKColorThrough def
/magenta? 0 1 0 0 testCMYKColorThrough def
/yellow? 0 0 1 0 testCMYKColorThrough def
/black? 0 0 0 1 testCMYKColorThrough def
grestore
/isCMYKSep? cyan? magenta? yellow? black? or or or def
/customColor? isCMYKSep? not def
end
} if
end defaultpacking setpacking
%%EndResource
%%BeginProcSet: Adobe_ColorImage_AI6 1.3 0
userdict /Adobe_ColorImage_AI6 known not
{
userdict /Adobe_ColorImage_AI6 53 dict put
} if
userdict /Adobe_ColorImage_AI6 get begin
/initialize {
Adobe_ColorImage_AI6 begin
Adobe_ColorImage_AI6 {
dup type /arraytype eq {
dup xcheck {
bind
} if
} if
pop pop
} forall
} def
/terminate { end } def
currentdict /Adobe_ColorImage_AI6_Vars known not {
/Adobe_ColorImage_AI6_Vars 41 dict def
} if
Adobe_ColorImage_AI6_Vars begin
/plateindex -1 def
/_newproc null def
/_proc1 null def
/_proc2 null def
/sourcearray 4 array def
/_ptispace null def
/_ptiname null def
/_pti0 0 def
/_pti1 0 def
/_ptiproc null def
/_ptiscale 0 def
/_pticomps 0 def
/_ptibuf 0 string def
/_gtigray 0 def
/_cticmyk null def
/_rtirgb null def
/XIEnable true def
/XIType 0 def
/XIEncoding 0 def
/XICompression 0 def
/XIChannelCount 0 def
/XIBitsPerPixel 0 def
/XIImageHeight 0 def
/XIImageWidth 0 def
/XIImageMatrix null def
/XIRowBytes 0 def
/XIFile null def
/XIBuffer1 null def
/XIBuffer2 null def
/XIBuffer3 null def
/XIDataProc null def
/XIColorSpace /DeviceGray def
/XIColorValues 0 def
/XIPlateList false def
end
/ci6colorimage /colorimage where {/colorimage get}{null} ifelse def
/ci6image systemdict /image get def
/ci6curtransfer systemdict /currenttransfer get def
/ci6curoverprint /currentoverprint where {/currentoverprint get}{{_of}} ifelse def
/ci6foureq {
4 index ne {
pop pop pop false
}{
4 index ne {
pop pop false
}{
4 index ne {
pop false
}{
4 index eq
} ifelse
} ifelse
} ifelse
} def
/ci6testplate {
Adobe_ColorImage_AI6_Vars begin
/plateindex -1 def
/setcmykcolor where {
pop
gsave
1 0 0 0 setcmykcolor systemdict /currentgray get exec 1 exch sub
0 1 0 0 setcmykcolor systemdict /currentgray get exec 1 exch sub
0 0 1 0 setcmykcolor systemdict /currentgray get exec 1 exch sub
0 0 0 1 setcmykcolor systemdict /currentgray get exec 1 exch sub
grestore
1 0 0 0 ci6foureq {
/plateindex 0 def
}{
0 1 0 0 ci6foureq {
/plateindex 1 def
}{
0 0 1 0 ci6foureq {
/plateindex 2 def
}{
0 0 0 1 ci6foureq {
/plateindex 3 def
}{
0 0 0 0 ci6foureq {
/plateindex 5 def
} if
} ifelse
} ifelse
} ifelse
} ifelse
pop pop pop pop
} if
plateindex
end
} def
/ci6concatprocs {
/packedarray where {
pop dup type /packedarraytype eq 2 index type
/packedarraytype eq or
}{
false
} ifelse
{
/_proc2 exch cvlit def
/_proc1 exch cvlit def
_proc1 aload pop
_proc2 aload pop
_proc1 length
_proc2 length add
packedarray cvx
}{
/_proc2 exch cvlit def
/_proc1 exch cvlit def
/_newproc _proc1 length _proc2 length add array def
_newproc 0 _proc1 putinterval
_newproc _proc1 length _proc2 putinterval
_newproc cvx
} ifelse
} def
/ci6istint {
type /arraytype eq
} def
/ci6isspot {
dup type /arraytype eq {
dup length 1 sub get /Separation eq
}{
pop false
} ifelse
} def
/ci6spotname {
dup ci6isspot {dup length 2 sub get}{pop ()} ifelse
} def
/ci6altspace {
aload pop pop pop ci6colormake
} def
/ci6numcomps {
dup /DeviceGray eq {
pop 1
}{
dup /DeviceRGB eq {
pop 3
}{
/DeviceCMYK eq {
4
}{
1
} ifelse
} ifelse
} ifelse
} def
/ci6marksplate {
dup /DeviceGray eq {
pop plateindex 3 eq
}{
dup /DeviceRGB eq {
pop plateindex 5 ne
}{
dup /DeviceCMYK eq {
pop plateindex 5 ne
}{
dup ci6isspot {
/findcmykcustomcolor where {
pop
dup length 2 sub get
0.1 0.1 0.1 0.1 5 -1 roll
findcmykcustomcolor 1 setcustomcolor
systemdict /currentgray get exec
1 ne
}{
pop plateindex 5 ne
} ifelse
}{
pop plateindex 5 ne
} ifelse
} ifelse
} ifelse
} ifelse
} def
/ci6colormake {
dup ci6numcomps
exch 1 index 2 add 1 roll
dup 1 eq {pop}{array astore} ifelse
exch
} def
/ci6colorexpand {
dup ci6spotname exch
dup ci6istint {
ci6altspace
exch 4 1 roll
}{
1 3 1 roll
} ifelse
} def
/ci6colortint {
dup /DeviceGray eq {
3 1 roll 1 exch sub mul 1 exch sub exch
}{
dup /DeviceRGB eq {
3 1 roll {1 exch sub 1 index mul 1 exch sub exch} forall pop 3 array astore exch
}{
dup /DeviceCMYK eq {
3 1 roll {1 index mul exch} forall pop 4 array astore exch
}{
3 1 roll mul exch
} ifelse
} ifelse
} ifelse
} def
/ci6colortocmyk {
dup /DeviceGray eq {
pop 1 exch sub 0 0 0 4 -1 roll 4 array astore
}{
dup /DeviceRGB eq {
pop aload pop _rgbtocmyk 4 array astore
}{
dup /DeviceCMYK eq {
pop
}{
ci6altspace ci6colortint ci6colortocmyk
} ifelse
} ifelse
} ifelse
} def
/ci6makeimagedict {
7 dict begin
/ImageType 1 def
/Decode exch def
/DataSource exch def
/ImageMatrix exch def
/BitsPerComponent exch def
/Height exch def
/Width exch def
currentdict end
} def
/ci6stringinvert {
0 1 2 index length 1 sub {
dup 2 index exch get 255 exch sub 2 index 3 1 roll put
} for
} def
/ci6stringknockout {
0 1 2 index length 1 sub {
255 2 index 3 1 roll put
} for
} def
/ci6stringapply {
0 1 4 index length 1 sub {
dup
4 index exch get
3 index 3 1 roll
3 index exec
} for
pop exch pop
} def
/ci6walkrgbstring {
0 3 index
dup length 1 sub 0 3 3 -1 roll {
3 getinterval {} forall
5 index exec
3 index
} for
5 {pop} repeat
} def
/ci6walkcmykstring
{
0 3 index
dup length 1 sub 0 4 3 -1 roll {
4 getinterval {} forall
6 index exec
3 index
} for
5 { pop } repeat
} def
/ci6putrgbtograystr
{
.11 mul exch
.59 mul add exch
.3 mul add
cvi 3 copy put
pop 1 add
} def
/ci6putcmyktograystr
{
exch .11 mul add
exch .59 mul add
exch .3 mul add
dup 255 gt { pop 255 } if
255 exch sub cvi 3 copy put
pop 1 add
} def
/ci6rgbtograyproc {
Adobe_ColorImage_AI6_Vars begin
sourcearray 0 get exec
XIBuffer3
dup 3 1 roll
/ci6putrgbtograystr load exch
ci6walkrgbstring
end
} def
/ci6cmyktograyproc {
Adobe_ColorImage_AI6_Vars begin
sourcearray 0 get exec
XIBuffer3
dup 3 1 roll
/ci6putcmyktograystr load exch
ci6walkcmykstring
end
} def
/ci6separatecmykproc {
Adobe_ColorImage_AI6_Vars begin
sourcearray 0 get exec
XIBuffer3
0 2 index
plateindex 4 2 index length 1 sub {
get 255 exch sub
3 copy put pop 1 add
2 index
} for
pop pop exch pop
end
} def
/ci6compositeimage {
dup 1 eq {
pop pop image
}{
/ci6colorimage load null ne {
ci6colorimage
}{
3 1 roll pop
sourcearray 0 3 -1 roll put
3 eq {/ci6rgbtograyproc}{/ci6cmyktograyproc} ifelse load
image
} ifelse
} ifelse
} def
/ci6knockoutimage {
gsave
0 ci6curtransfer exec 1 ci6curtransfer exec
eq {
0 ci6curtransfer exec 0.5 lt
}{
0 ci6curtransfer exec 1 ci6curtransfer exec gt
} ifelse
{{pop 0}}{{pop 1}} ifelse
systemdict /settransfer get exec
ci6compositeimage
grestore
} def
/ci6drawimage {
ci6testplate -1 eq {
pop ci6compositeimage
}{
dup type /arraytype eq {
dup length plateindex gt {plateindex get}{pop false} ifelse
}{
{
true
}{
dup 1 eq {plateindex 3 eq}{plateindex 3 le} ifelse
} ifelse
} ifelse
{
dup 1 eq {
pop pop ci6image
}{
dup 3 eq {
ci6compositeimage
}{
pop pop
sourcearray 0 3 -1 roll put
/ci6separatecmykproc load
ci6image
} ifelse
} ifelse
}{
ci6curoverprint {
7 {pop} repeat
}{
ci6knockoutimage
} ifelse
} ifelse
} ifelse
} def
/ci6proctintimage {
/_ptispace exch store /_ptiname exch store /_pti1 exch store /_pti0 exch store /_ptiproc exch store
/_pticomps _ptispace ci6numcomps store
/_ptiscale _pti1 _pti0 sub store
level2? {
_ptiname length 0 gt version cvr 2012 ge and {
[/Separation _ptiname _ptispace {_ptiproc}] setcolorspace
[_pti0 _pti1] ci6makeimagedict ci6image
}{
[/Indexed _ptispace 255 {255 div _ptiscale mul _pti0 add _ptiproc}] setcolorspace
[0 255] ci6makeimagedict ci6image
} ifelse
}{
_pticomps 1 eq {
{
dup
{
255 div _ptiscale mul _pti0 add _ptiproc 255 mul cvi put
} ci6stringapply
} ci6concatprocs ci6image
}{
{
dup length _pticomps mul dup _ptibuf length ne {/_ptibuf exch string store}{pop} ifelse
_ptibuf {
exch _pticomps mul exch 255 div _ptiscale mul _pti0 add _ptiproc
_pticomps 2 add -2 roll
_pticomps 1 sub -1 0 {
1 index add 2 index exch
5 -1 roll
255 mul cvi put
} for
pop pop
} ci6stringapply
} ci6concatprocs false _pticomps
/ci6colorimage load null eq {7 {pop} repeat}{ci6colorimage} ifelse
} ifelse
} ifelse
} def
/ci6graytintimage {
/_gtigray 5 -1 roll store
{1 _gtigray sub mul 1 exch sub} 4 1 roll
/DeviceGray ci6proctintimage
} def
/ci6cmyktintimage {
/_cticmyk 5 -1 roll store
{_cticmyk {1 index mul exch} forall pop} 4 1 roll
/DeviceCMYK ci6proctintimage
} def
/ci6rgbtintimage {
/_rtirgb 5 -1 roll store
{_rtirgb {1 exch sub 1 index mul 1 exch sub exch} forall pop} 4 1 roll
/DeviceRGB ci6proctintimage
} def
/ci6tintimage {
ci6testplate -1 eq {
ci6colorexpand
3 -1 roll 5 -1 roll {0}{0 exch} ifelse 4 2 roll
dup /DeviceGray eq {
pop ci6graytintimage
}{
dup /DeviceRGB eq {
pop ci6rgbtintimage
}{
pop ci6cmyktintimage
} ifelse
} ifelse
}{
dup ci6marksplate {
plateindex 5 lt {
ci6colortocmyk plateindex get
dup 0 eq ci6curoverprint and {
7 {pop} repeat
}{
1 exch sub
exch {1 0}{0 1} ifelse () ci6graytintimage
} ifelse
}{
pop exch {0}{0 exch} ifelse 0 3 1 roll () ci6graytintimage
} ifelse
}{
ci6curoverprint {
8 {pop} repeat
}{
pop pop pop
{pop 1} 0 1 () /DeviceGray ci6proctintimage
} ifelse
} ifelse
} ifelse
} def
/XINullImage {
} def
/XIImageMask {
XIImageWidth XIImageHeight false
[XIImageWidth 0 0 XIImageHeight neg 0 0]
/XIDataProc load
imagemask
} def
/XIImageTint {
XIImageWidth XIImageHeight XIBitsPerPixel
[XIImageWidth 0 0 XIImageHeight neg 0 0]
/XIDataProc load
XIType 3 eq XIColorValues XIColorSpace ci6tintimage
} def
/XIImage {
XIImageWidth XIImageHeight XIBitsPerPixel
[XIImageWidth 0 0 XIImageHeight neg 0 0]
/XIDataProc load
false XIChannelCount XIPlateList ci6drawimage
} def
/XG {
pop pop
} def
/XF {
13 {pop} repeat
} def
/Xh {
Adobe_ColorImage_AI6_Vars begin
gsave
/XIType exch def
/XIImageHeight exch def
/XIImageWidth exch def
/XIImageMatrix exch def
0 0 moveto
XIImageMatrix concat
XIImageWidth XIImageHeight scale
/_lp /null ddef
_fc
/_lp /imagemask ddef
end
} def
/XH {
Adobe_ColorImage_AI6_Vars begin
grestore
end
} def
/XIEnable {
Adobe_ColorImage_AI6_Vars /XIEnable 3 -1 roll put
} def
/XC {
Adobe_ColorImage_AI6_Vars begin
ci6colormake
/XIColorSpace exch def
/XIColorValues exch def
end
} def
/XIPlates {
Adobe_ColorImage_AI6_Vars begin
/XIPlateList exch def
end
} def
/XI
{
Adobe_ColorImage_AI6_Vars begin
gsave
/XIType exch def
cvi dup
256 idiv /XICompression exch store
256 mod /XIEncoding exch store
pop pop
/XIChannelCount exch def
/XIBitsPerPixel exch def
/XIImageHeight exch def
/XIImageWidth exch def
pop pop pop pop
/XIImageMatrix exch def
XIBitsPerPixel 1 eq {
XIImageWidth 8 div ceiling cvi
}{
XIImageWidth XIChannelCount mul
} ifelse
/XIRowBytes exch def
XIEnable {
/XIBuffer3 XIImageWidth string def
XICompression 0 eq {
/XIBuffer1 XIRowBytes string def
XIEncoding 0 eq {
{currentfile XIBuffer1 readhexstring pop}
}{
{currentfile XIBuffer1 readstring pop}
} ifelse
}{
/XIBuffer1 256 string def
/XIBuffer2 XIRowBytes string def
{currentfile XIBuffer1 readline pop (%) anchorsearch {pop} if}
/ASCII85Decode filter /DCTDecode filter
/XIFile exch def
{XIFile XIBuffer2 readstring pop}
} ifelse
/XIDataProc exch def
XIType 1 ne {
0 setgray
} if
XIType 1 eq {
XIImageMask
}{
XIType 2 eq XIType 3 eq or {
XIImageTint
}{
XIImage
} ifelse
} ifelse
}{
XINullImage
} ifelse
/XIPlateList false def
grestore
end
} def
end
%%EndProcSet
%%BeginResource: procset Adobe_Illustrator_AI5 1.3 0
%%Title: (Adobe Illustrator (R) Version 8.0 Full Prolog)
%%Version: 1.3 0
%%CreationDate: (3/7/1994) ()
%%Copyright: ((C) 1987-1998 Adobe Systems Incorporated All Rights Reserved)
currentpacking true setpacking
userdict /Adobe_Illustrator_AI5_vars 112 dict dup begin
put
/_?cmyk false def
/_eo false def
/_lp /none def
/_pf
{
} def
/_ps
{
} def
/_psf
{
} def
/_pss
{
} def
/_pjsf
{
} def
/_pjss
{
} def
/_pola 0 def
/_doClip 0 def
/cf currentflat def
/_lineorientation 0 def
/_charorientation 0 def
/_yokoorientation 0 def
/_tm matrix def
/_renderStart
[
/e0 /r0 /a0 /o0 /e1 /r1 /a1 /i0
] def
/_renderEnd
[
null null null null /i1 /i1 /i1 /i1
] def
/_render -1 def
/_shift [0 0] def
/_ax 0 def
/_ay 0 def
/_cx 0 def
/_cy 0 def
/_leading
[
0 0
] def
/_ctm matrix def
/_mtx matrix def
/_sp 16#020 def
/_hyphen (-) def
/_fontSize 0 def
/_fontAscent 0 def
/_fontDescent 0 def
/_fontHeight 0 def
/_fontRotateAdjust 0 def
/Ss 256 string def
Ss 0 (fonts/) putinterval
/_cnt 0 def
/_scale [1 1] def
/_nativeEncoding 0 def
/_useNativeEncoding 0 def
/_tempEncode 0 def
/_pntr 0 def
/_tDict 2 dict def
/_hfname 100 string def
/_hffound false def
/Tx
{
} def
/Tj
{
} def
/CRender
{
} def
/_AI3_savepage
{
} def
/_gf null def
/_cf 4 array def
/_rgbf 3 array def
/_if null def
/_of false def
/_fc
{
} def
/_gs null def
/_cs 4 array def
/_rgbs 3 array def
/_is null def
/_os false def
/_sc
{
} def
/_pd 1 dict def
/_ed 15 dict def
/_pm matrix def
/_fm null def
/_fd null def
/_fdd null def
/_sm null def
/_sd null def
/_sdd null def
/_i null def
/_lobyte 0 def
/_hibyte 0 def
/_cproc null def
/_cscript 0 def
/_hvax 0 def
/_hvay 0 def
/_hvwb 0 def
/_hvcx 0 def
/_hvcy 0 def
/_bitfont null def
/_bitlobyte 0 def
/_bithibyte 0 def
/_bitkey null def
/_bitdata null def
/_bitindex 0 def
/discardSave null def
/buffer 256 string def
/beginString null def
/endString null def
/endStringLength null def
/layerCnt 1 def
/layerCount 1 def
/perCent (%) 0 get def
/perCentSeen? false def
/newBuff null def
/newBuffButFirst null def
/newBuffLast null def
/clipForward? false def
end
userdict /Adobe_Illustrator_AI5 known not {
userdict /Adobe_Illustrator_AI5 100 dict put
} if
userdict /Adobe_Illustrator_AI5 get begin
/initialize
{
Adobe_Illustrator_AI5 dup begin
Adobe_Illustrator_AI5_vars begin
/_aicmykps where {pop /_?cmyk _aicmykps def}if
discardDict
{
bind pop pop
} forall
dup /nc get begin
{
dup xcheck 1 index type /operatortype ne and
{
bind
} if
pop pop
} forall
end
newpath
} def
/terminate
{
end
end
} def
/_
null def
/ddef
{
Adobe_Illustrator_AI5_vars 3 1 roll put
} def
/xput
{
dup load dup length exch maxlength eq
{
dup dup load dup
length 2 mul dict copy def
} if
load begin
def
end
} def
/npop
{
{
pop
} repeat
} def
/hswj
{
dup stringwidth 3 2 roll
{
_hvwb eq { exch _hvcx add exch _hvcy add } if
exch _hvax add exch _hvay add
} cforall
} def
/vswj
{
0 0 3 -1 roll
{
dup 255 le
_charorientation 1 eq
and
{
dup cstring stringwidth 5 2 roll
_hvwb eq { exch _hvcy sub exch _hvcx sub } if
exch _hvay sub exch _hvax sub
4 -1 roll sub exch
3 -1 roll sub exch
}
{
_hvwb eq { exch _hvcy sub exch _hvcx sub } if
exch _hvay sub exch _hvax sub
_fontHeight sub
} ifelse
} cforall
} def
/swj
{
6 1 roll
/_hvay exch ddef
/_hvax exch ddef
/_hvwb exch ddef
/_hvcy exch ddef
/_hvcx exch ddef
_lineorientation 0 eq { hswj } { vswj } ifelse
} def
/sw
{
0 0 0 6 3 roll swj
} def
/vjss
{
4 1 roll
{
dup cstring
dup length 1 eq
_charorientation 1 eq
and
{
-90 rotate
currentpoint
_fontRotateAdjust add
moveto
gsave
false charpath currentpoint
5 index setmatrix stroke
grestore
_fontRotateAdjust sub
moveto
_sp eq
{
5 index 5 index rmoveto
} if
2 copy rmoveto
90 rotate
}
{
currentpoint
_fontHeight sub
5 index sub
3 index _sp eq
{
9 index sub
} if
currentpoint
exch 4 index stringwidth pop 2 div sub
exch _fontAscent sub
moveto
gsave
2 index false charpath
6 index setmatrix stroke
grestore
moveto pop pop
} ifelse
} cforall
6 npop
} def
/hjss
{
4 1 roll
{
dup cstring
gsave
false charpath currentpoint
5 index setmatrix stroke
grestore
moveto
_sp eq
{
5 index 5 index rmoveto
} if
2 copy rmoveto
} cforall
6 npop
} def
/jss
{
_lineorientation 0 eq { hjss } { vjss } ifelse
} def
/ss
{
0 0 0 7 3 roll jss
} def
/vjsp
{
4 1 roll
{
dup cstring
dup length 1 eq
_charorientation 1 eq
and
{
-90 rotate
currentpoint
_fontRotateAdjust add
moveto
false charpath
currentpoint
_fontRotateAdjust sub
moveto
_sp eq
{
5 index 5 index rmoveto
} if
2 copy rmoveto
90 rotate
}
{
currentpoint
_fontHeight sub
5 index sub
3 index _sp eq
{
9 index sub
} if
currentpoint
exch 4 index stringwidth pop 2 div sub
exch _fontAscent sub
moveto
2 index false charpath
moveto pop pop
} ifelse
} cforall
6 npop
} def
/hjsp
{
4 1 roll
{
dup cstring
false charpath
_sp eq
{
5 index 5 index rmoveto
} if
2 copy rmoveto
} cforall
6 npop
} def
/jsp
{
matrix currentmatrix
_lineorientation 0 eq {hjsp} {vjsp} ifelse
} def
/sp
{
matrix currentmatrix
0 0 0 7 3 roll
_lineorientation 0 eq {hjsp} {vjsp} ifelse
} def
/pl
{
transform
0.25 sub round 0.25 add exch
0.25 sub round 0.25 add exch
itransform
} def
/setstrokeadjust where
{
pop true setstrokeadjust
/c
{
curveto
} def
/C
/c load def
/v
{
currentpoint 6 2 roll curveto
} def
/V
/v load def
/y
{
2 copy curveto
} def
/Y
/y load def
/l
{
lineto
} def
/L
/l load def
/m
{
moveto
} def
}
{
/c
{
pl curveto
} def
/C
/c load def
/v
{
currentpoint 6 2 roll pl curveto
} def
/V
/v load def
/y
{
pl 2 copy curveto
} def
/Y
/y load def
/l
{
pl lineto
} def
/L
/l load def
/m
{
pl moveto
} def
} ifelse
/d
{
setdash
} def
/cf
{
} def
/i
{
dup 0 eq
{
pop cf
} if
setflat
} def
/j
{
setlinejoin
} def
/J
{
setlinecap
} def
/M
{
setmiterlimit
} def
/w
{
setlinewidth
} def
/XR
{
0 ne
/_eo exch ddef
} def
/H
{
} def
/h
{
closepath
} def
/N
{
_pola 0 eq
{
_doClip 1 eq
{
_eo {eoclip} {clip} ifelse /_doClip 0 ddef
} if
newpath
}
{
/CRender
{
N
} ddef
} ifelse
} def
/n
{
N
} def
/F
{
_pola 0 eq
{
_doClip 1 eq
{
gsave _pf grestore _eo {eoclip} {clip} ifelse newpath /_lp /none ddef _fc
/_doClip 0 ddef
}
{
_pf
} ifelse
}
{
/CRender
{
F
} ddef
} ifelse
} def
/f
{
closepath
F
} def
/S
{
_pola 0 eq
{
_doClip 1 eq
{
gsave _ps grestore _eo {eoclip} {clip} ifelse newpath /_lp /none ddef _sc
/_doClip 0 ddef
}
{
_ps
} ifelse
}
{
/CRender
{
S
} ddef
} ifelse
} def
/s
{
closepath
S
} def
/B
{
_pola 0 eq
{
_doClip 1 eq
gsave F grestore
{
gsave S grestore _eo {eoclip} {clip} ifelse newpath /_lp /none ddef _sc
/_doClip 0 ddef
}
{
S
} ifelse
}
{
/CRender
{
B
} ddef
} ifelse
} def
/b
{
closepath
B
} def
/W
{
/_doClip 1 ddef
} def
/*
{
count 0 ne
{
dup type /stringtype eq
{
pop
} if
} if
newpath
} def
/u
{
} def
/U
{
} def
/q
{
_pola 0 eq
{
gsave
} if
} def
/Q
{
_pola 0 eq
{
grestore
} if
} def
/*u
{
_pola 1 add /_pola exch ddef
} def
/*U
{
_pola 1 sub /_pola exch ddef
_pola 0 eq
{
CRender
} if
} def
/D
{
pop
} def
/*w
{
} def
/*W
{
} def
/`
{
/_i save ddef
clipForward?
{
nulldevice
} if
6 1 roll 4 npop
concat pop
userdict begin
/showpage
{
} def
0 setgray
0 setlinecap
1 setlinewidth
0 setlinejoin
10 setmiterlimit
[] 0 setdash
/setstrokeadjust where {pop false setstrokeadjust} if
newpath
0 setgray
false setoverprint
} def
/~
{
end
_i restore
} def
/_rgbtocmyk
{
3
{
1 exch sub 3 1 roll
} repeat
3 copy 1 4 1 roll
3
{
3 index 2 copy gt
{
exch
} if
pop 4 1 roll
} repeat
pop pop pop
4 1 roll
3
{
3 index sub
3 1 roll
} repeat
4 -1 roll
} def
/setrgbfill
{
_rgbf astore pop
/_fc
{
_lp /fill ne
{
_of setoverprint
_rgbf aload pop setrgbcolor
/_lp /fill ddef
} if
} ddef
/_pf
{
_fc
_eo {eofill} {fill} ifelse
} ddef
/_psf
{
_fc
hvashow
} ddef
/_pjsf
{
_fc
hvawidthshow
} ddef
/_lp /none ddef
} def
/setrgbstroke
{
_rgbs astore pop
/_sc
{
_lp /stroke ne
{
_os setoverprint
_rgbs aload pop setrgbcolor
/_lp /stroke ddef
} if
} ddef
/_ps
{
_sc
stroke
} ddef
/_pss
{
_sc
ss
} ddef
/_pjss
{
_sc
jss
} ddef
/_lp /none ddef
} def
/O
{
0 ne
/_of exch ddef
/_lp /none ddef
} def
/R
{
0 ne
/_os exch ddef
/_lp /none ddef
} def
/g
{
/_gf exch ddef
/_fc
{
_lp /fill ne
{
_of setoverprint
_gf setgray
/_lp /fill ddef
} if
} ddef
/_pf
{
_fc
_eo {eofill} {fill} ifelse
} ddef
/_psf
{
_fc
hvashow
} ddef
/_pjsf
{
_fc
hvawidthshow
} ddef
/_lp /none ddef
} def
/G
{
/_gs exch ddef
/_sc
{
_lp /stroke ne
{
_os setoverprint
_gs setgray
/_lp /stroke ddef
} if
} ddef
/_ps
{
_sc
stroke
} ddef
/_pss
{
_sc
ss
} ddef
/_pjss
{
_sc
jss
} ddef
/_lp /none ddef
} def
/k
{
_cf astore pop
/_fc
{
_lp /fill ne
{
_of setoverprint
_cf aload pop setcmykcolor
/_lp /fill ddef
} if
} ddef
/_pf
{
_fc
_eo {eofill} {fill} ifelse
} ddef
/_psf
{
_fc
hvashow
} ddef
/_pjsf
{
_fc
hvawidthshow
} ddef
/_lp /none ddef
} def
/K
{
_cs astore pop
/_sc
{
_lp /stroke ne
{
_os setoverprint
_cs aload pop setcmykcolor
/_lp /stroke ddef
} if
} ddef
/_ps
{
_sc
stroke
} ddef
/_pss
{
_sc
ss
} ddef
/_pjss
{
_sc
jss
} ddef
/_lp /none ddef
} def
/Xa
{
_?cmyk {
3 npop k
}{
setrgbfill 4 npop
} ifelse
} def
/XA
{
_?cmyk {
3 npop K
}{
setrgbstroke 4 npop
} ifelse
} def
/Xs
{
/_gf exch ddef
5 npop
/_fc
{
_lp /fill ne
{
_of setoverprint
_gf setAIseparationgray
/_lp /fill ddef
} if
} ddef
/_pf
{
_fc
_eo {eofill} {fill} ifelse
} ddef
/_psf
{
_fc
hvashow
} ddef
/_pjsf
{
_fc
hvawidthshow
} ddef
/_lp /none ddef
} def
/XS
{
/_gs exch ddef
5 npop
/_sc
{
_lp /stroke ne
{
_os setoverprint
_gs setAIseparationgray
/_lp /stroke ddef
} if
} ddef
/_ps
{
_sc
stroke
} ddef
/_pss
{
_sc
ss
} ddef
/_pjss
{
_sc
jss
} ddef
/_lp /none ddef
} def
/Xx
{
exch
/_gf exch ddef
0 eq {
findcmykcustomcolor
}{
_?cmyk {true}{/findrgbcustomcolor where{pop false}{true}ifelse}ifelse
{
4 1 roll 3 npop
findcmykcustomcolor
}{
8 -4 roll 4 npop
findrgbcustomcolor
} ifelse
} ifelse
/_if exch ddef
/_fc
{
_lp /fill ne
{
_of setoverprint
_if _gf 1 exch sub setcustomcolor
/_lp /fill ddef
} if
} ddef
/_pf
{
_fc
_eo {eofill} {fill} ifelse
} ddef
/_psf
{
_fc
hvashow
} ddef
/_pjsf
{
_fc
hvawidthshow
} ddef
/_lp /none ddef
} def
/XX
{
exch
/_gs exch ddef
0 eq {
findcmykcustomcolor
}{
_?cmyk {true}{/findrgbcustomcolor where{pop false}{true}ifelse}ifelse
{
4 1 roll 3 npop
findcmykcustomcolor
}{
8 -4 roll 4 npop
findrgbcustomcolor
} ifelse
} ifelse
/_is exch ddef
/_sc
{
_lp /stroke ne
{
_os setoverprint
_is _gs 1 exch sub setcustomcolor
/_lp /stroke ddef
} if
} ddef
/_ps
{
_sc
stroke
} ddef
/_pss
{
_sc
ss
} ddef
/_pjss
{
_sc
jss
} ddef
/_lp /none ddef
} def
/x
{
/_gf exch ddef
findcmykcustomcolor
/_if exch ddef
/_fc
{
_lp /fill ne
{
_of setoverprint
_if _gf 1 exch sub setcustomcolor
/_lp /fill ddef
} if
} ddef
/_pf
{
_fc
_eo {eofill} {fill} ifelse
} ddef
/_psf
{
_fc
hvashow
} ddef
/_pjsf
{
_fc
hvawidthshow
} ddef
/_lp /none ddef
} def
/X
{
/_gs exch ddef
findcmykcustomcolor
/_is exch ddef
/_sc
{
_lp /stroke ne
{
_os setoverprint
_is _gs 1 exch sub setcustomcolor
/_lp /stroke ddef
} if
} ddef
/_ps
{
_sc
stroke
} ddef
/_pss
{
_sc
ss
} ddef
/_pjss
{
_sc
jss
} ddef
/_lp /none ddef
} def
/XK
{
3 -1 roll pop
0 eq
{
1 exch sub
3 {dup 3 1 roll mul 5 1 roll} repeat
mul 4 1 roll
K
}
{
1 exch sub 4 1 roll
3 {1 exch sub 3 index mul 1 exch sub 3 1 roll} repeat
4 -1 roll pop
XA
} ifelse
} def
/Xk
{
3 -1 roll pop
0 eq
{
1 exch sub
3 {dup 3 1 roll mul 5 1 roll} repeat
mul 4 1 roll
k
}
{
1 exch sub 4 1 roll
3 {1 exch sub 3 index mul 1 exch sub 3 1 roll} repeat
4 -1 roll pop
Xa
} ifelse
} def
/A
{
pop
} def
/annotatepage
{
userdict /annotatepage 2 copy known {get exec} {pop pop} ifelse
} def
/XT {
pop pop
} def
/Xt {
pop
} def
/discard
{
save /discardSave exch store
discardDict begin
/endString exch store
gt38?
{
2 add
} if
load
stopped
pop
end
discardSave restore
} bind def
userdict /discardDict 7 dict dup begin
put
/pre38Initialize
{
/endStringLength endString length store
/newBuff buffer 0 endStringLength getinterval store
/newBuffButFirst newBuff 1 endStringLength 1 sub getinterval store
/newBuffLast newBuff endStringLength 1 sub 1 getinterval store
} def
/shiftBuffer
{
newBuff 0 newBuffButFirst putinterval
newBuffLast 0
currentfile read not
{
stop
} if
put
} def
0
{
pre38Initialize
mark
currentfile newBuff readstring exch pop
{
{
newBuff endString eq
{
cleartomark stop
} if
shiftBuffer
} loop
}
{
stop
} ifelse
} def
1
{
pre38Initialize
/beginString exch store
mark
currentfile newBuff readstring exch pop
{
{
newBuff beginString eq
{
/layerCount dup load 1 add store
}
{
newBuff endString eq
{
/layerCount dup load 1 sub store
layerCount 0 eq
{
cleartomark stop
} if
} if
} ifelse
shiftBuffer
} loop
} if
} def
2
{
mark
{
currentfile buffer {readline} stopped {
% assume error was due to overfilling the buffer
}{
not
{
stop
} if
endString eq {
cleartomark stop
} if
}ifelse
} loop
} def
3
{
/beginString exch store
/layerCnt 1 store
mark
{
currentfile buffer {readline} stopped {
% assume error was due to overfilling the buffer
}{
not
{
stop
} if
dup beginString eq
{
pop /layerCnt dup load 1 add store
}
{
endString eq
{
layerCnt 1 eq
{
cleartomark stop
}
{
/layerCnt dup load 1 sub store
} ifelse
} if
} ifelse
}ifelse
} loop
} def
end
userdict /clipRenderOff 15 dict dup begin
put
{
/n /N /s /S /f /F /b /B
}
{
{
_doClip 1 eq
{
/_doClip 0 ddef _eo {eoclip} {clip} ifelse
} if
newpath
} def
} forall
/Tr /pop load def
/Bb {} def
/BB /pop load def
/Bg {12 npop} def
/Bm {6 npop} def
/Bc /Bm load def
/Bh {4 npop} def
end
/Lb
{
6 npop
7 2 roll
5 npop
0 eq
{
0 eq
{
(%AI5_BeginLayer) 1 (%AI5_EndLayer--) discard
}
{
/clipForward? true def
/Tx /pop load def
/Tj /pop load def
currentdict end clipRenderOff begin begin
} ifelse
}
{
0 eq
{
save /discardSave exch store
} if
} ifelse
} bind def
/LB
{
discardSave dup null ne
{
restore
}
{
pop
clipForward?
{
currentdict
end
end
begin
/clipForward? false ddef
} if
} ifelse
} bind def
/Pb
{
pop pop
0 (%AI5_EndPalette) discard
} bind def
/Np
{
0 (%AI5_End_NonPrinting--) discard
} bind def
/Ln /pop load def
/Ap
/pop load def
/Ar
{
72 exch div
0 dtransform dup mul exch dup mul add sqrt
dup 1 lt
{
pop 1
} if
setflat
} def
/Mb
{
q
} def
/Md
{
} def
/MB
{
Q
} def
/nc 4 dict def
nc begin
/setgray
{
pop
} bind def
/setcmykcolor
{
4 npop
} bind def
/setrgbcolor
{
3 npop
} bind def
/setcustomcolor
{
2 npop
} bind def
currentdict readonly pop
end
/XP
{
4 npop
} bind def
/XD
{
pop
} bind def
end
setpacking
%%EndResource
%%BeginResource: procset Adobe_cshow 2.0 8
%%Title: (Writing System Operators)
%%Version: 2.0 8
%%CreationDate: (1/23/89) ()
%%Copyright: ((C) 1992-1996 Adobe Systems Incorporated All Rights Reserved)
currentpacking true setpacking
userdict /Adobe_cshow 14 dict dup begin put
/initialize
{
Adobe_cshow begin
Adobe_cshow
{
dup xcheck
{
bind
} if
pop pop
} forall
end
Adobe_cshow begin
} def
/terminate
{
currentdict Adobe_cshow eq
{
end
} if
} def
/cforall
{
/_lobyte 0 ddef
/_hibyte 0 ddef
/_cproc exch ddef
/_cscript currentfont /FontScript known { currentfont /FontScript get } { -1 } ifelse ddef
{
/_lobyte exch ddef
_hibyte 0 eq
_cscript 1 eq
_lobyte 129 ge _lobyte 159 le and
_lobyte 224 ge _lobyte 252 le and or and
_cscript 2 eq
_lobyte 161 ge _lobyte 254 le and and
_cscript 3 eq
_lobyte 161 ge _lobyte 254 le and and
_cscript 25 eq
_lobyte 161 ge _lobyte 254 le and and
_cscript -1 eq
or or or or and
{
/_hibyte _lobyte ddef
}
{
_hibyte 256 mul _lobyte add
_cproc
/_hibyte 0 ddef
} ifelse
} forall
} def
/cstring
{
dup 256 lt
{
(s) dup 0 4 3 roll put
}
{
dup 256 idiv exch 256 mod
(hl) dup dup 0 6 5 roll put 1 4 3 roll put
} ifelse
} def
/clength
{
0 exch
{ 256 lt { 1 } { 2 } ifelse add } cforall
} def
/hawidthshow
{
{
dup cstring
show
_hvax _hvay rmoveto
_hvwb eq { _hvcx _hvcy rmoveto } if
} cforall
} def
/vawidthshow
{
{
dup 255 le
_charorientation 1 eq
and
{
-90 rotate
0 _fontRotateAdjust rmoveto
cstring
_hvcx _hvcy _hvwb _hvax _hvay 6 -1 roll awidthshow
0 _fontRotateAdjust neg rmoveto
90 rotate
}
{
currentpoint
_fontHeight sub
exch _hvay sub exch _hvax sub
2 index _hvwb eq { exch _hvcy sub exch _hvcx sub } if
3 2 roll
cstring
dup stringwidth pop 2 div neg _fontAscent neg rmoveto
show
moveto
} ifelse
} cforall
} def
/hvawidthshow
{
6 1 roll
/_hvay exch ddef
/_hvax exch ddef
/_hvwb exch ddef
/_hvcy exch ddef
/_hvcx exch ddef
_lineorientation 0 eq { hawidthshow } { vawidthshow } ifelse
} def
/hvwidthshow
{
0 0 3 -1 roll hvawidthshow
} def
/hvashow
{
0 0 0 6 -3 roll hvawidthshow
} def
/hvshow
{
0 0 0 0 0 6 -1 roll hvawidthshow
} def
currentdict readonly pop end
setpacking
%%EndResource
%%BeginResource: procset Adobe_shading_AI8 1.0 0
%%Title: (Adobe Illustrator 8 Shading Procset)
%%Version: 1.0 0
%%CreationDate: (12/17/97) ()
%%Copyright: ((C) 1987-1997 Adobe Systems Incorporated All Rights Reserved)
userdict /defaultpacking currentpacking put true setpacking
userdict /Adobe_shading_AI8 10 dict dup begin put
/initialize {
Adobe_shading_AI8 begin
Adobe_shading_AI8 bdprocs
Mesh /initialize get exec
} def
/terminate {
currentdict Adobe_shading_AI8 eq {
end
} if
} def
/bdprocs {
{
dup xcheck 1 index type /arraytype eq and {
bind
} if
pop pop
} forall
} def
/X! {pop} def
/X# {pop pop} def
/Mesh 40 dict def
Mesh begin
/initialize {
Mesh bdprocs
Mesh begin
/emulate? /AI8MeshEmulation where {
pop AI8MeshEmulation
}{
systemdict /shfill known not
} ifelse def
end
} def
/bd {
shadingdict begin
} def
/paint {
emulate? {
end
}{
/_lp /none ddef _fc /_lp /none ddef
/AIColorSpace AIColorSpace tocolorspace store
/ColorSpace AIColorSpace topsspace store
version_ge_3010.106 not systemdict /setsmoothness known and {
0.0001 setsmoothness
} if
composite? {
/DataSource getdatasrc def
Matrix concat
currentdict end
shfill
}{
AIColorSpace makesmarks AIPlateList markingplate and not isoverprint and {
end
}{
/ColorSpace /DeviceGray store
/Decode [0 1 0 1 0 1] store
/DataSource getplatesrc def
Matrix concat
currentdict end
shfill
} ifelse
} ifelse
} ifelse
} def
/shadingdict 12 dict def
shadingdict begin
/ShadingType 6 def
/BitsPerCoordinate 16 def
/BitsPerComponent 8 def
/BitsPerFlag 8 def
end
/datafile null def
/databuf 256 string def
/dataptr 0 def
/srcspace null def
/srcchannels 0 def
/dstchannels 0 def
/dstplate 0 def
/srctodstcolor null def
/getplatesrc {
/srcspace AIColorSpace store
/srcchannels AIColorSpace getnchannels store
/dstchannels 1 store
/dstplate getplateindex store
/srctodstcolor srcspace makesmarks {
dstplate 4 eq {
{1 exch sub}
}{
{srcspace tocmyk 3 dstplate sub index 1 exch sub 5 1 roll 4 {pop} repeat}
} ifelse
}{
{srcchannels {pop} repeat 1}
} ifelse store
/datafile getdatasrc store
/rdpatch168 load DataLength () /SubFileDecode filter
} def
/getdatasrc {
/rdcmntline load /ASCII85Decode filter
} def
/rdpatch168 {
/dataptr 0 store
49 rdcount
4 {
dup {pop srcchannels getint8} if
dup {pop srctodstcolor dstchannels putint8 true} if
} repeat
{databuf 0 dataptr getinterval}{()} ifelse
} def
/rdpatch3216 {
/dataptr 0 store
97 rdcount
4 {
dup {pop srcchannels getint16} if
dup {pop srctodstcolor dstchannels putint16 true} if
} repeat
{databuf 0 dataptr getinterval}{()} ifelse
} def
/rdcount {
dup 0 gt {
datafile databuf dataptr 4 -1 roll getinterval readstring
exch length dataptr add /dataptr exch store
}{
true
} ifelse
} def
/getint8 {
mark true 3 -1 roll
{
dup {pop datafile read} if
dup {pop 255 div true} if
} repeat
{
counttomark 1 add -1 roll pop true
}{
cleartomark false
} ifelse
} def
/putint8 {
dup dataptr add /dataptr exch store
dataptr exch
{
1 sub exch
255 mul cvi
databuf 2 index
3 -1 roll put
} repeat
pop
} def
/getint16 {
mark true 3 -1 roll
{
dup {pop datafile read} if
dup {pop 256 mul datafile read} if
dup {pop add 65535 div true} if
} repeat
{
counttomark 1 add -1 roll pop true
}{
cleartomark false
} ifelse
} def
/putint16 {
dup 2 mul dataptr add /dataptr exch store
dataptr exch
{
2 sub exch
65535 mul cvi dup
256 idiv databuf 3 index 3 -1 roll put
256 mod databuf 2 index 1 add 3 -1 roll put
} repeat
pop
} def
/srcbuf 256 string def
/rdcmntline {
currentfile srcbuf readline pop
(%) anchorsearch {pop} if
} def
/getplateindex {
0 [cyan? magenta? yellow? black? customColor?] {{exit} if 1 add} forall
} def
/aicsarray 4 array def
/aicsaltvals 4 array def
/aicsaltcolr aicsaltvals def
/tocolorspace {
dup type /arraytype eq {
mark exch aload pop
aicsarray 0 3 -1 roll put
aicsarray 1 3 -1 roll put
dup aicsarray 2 3 -1 roll put
gettintxform aicsarray 3 3 -1 roll put
counttomark aicsaltvals 0 3 -1 roll getinterval /aicsaltcolr exch store
aicsaltcolr astore pop pop
aicsarray
} if
} def
/subtintxform {aicsaltcolr {1 index mul exch} forall pop} def
/addtintxform {aicsaltcolr {1 sub 1 index mul 1 add exch} forall pop} def
/gettintxform {
/DeviceRGB eq {/addtintxform}{/subtintxform} ifelse load
} def
/getnchannels {
dup type /arraytype eq {0 get} if
colorspacedict exch get begin Channels end
} def
/makesmarks {
composite? {
pop true
}{
dup dup type /arraytype eq {0 get} if
colorspacedict exch get begin MarksPlate end
} ifelse
} def
/markingplate {
composite? {
pop true
}{
dup type /arraytype eq {
dup length getplateindex gt {getplateindex get}{pop false} ifelse
} if
} ifelse
} def
/tocmyk {
dup dup type /arraytype eq {0 get} if
colorspacedict exch get begin ToCMYK end
} def
/topsspace {
dup dup type /arraytype eq {0 get} if
colorspacedict exch get begin ToPSSpace end
} def
/colorspacedict 5 dict dup begin
/DeviceGray 4 dict dup begin
/Channels 1 def
/MarksPlate {pop black?} def
/ToCMYK {pop 1 exch sub 0 0 0 4 -1 roll} def
/ToPSSpace {} def
end def
/DeviceRGB 4 dict dup begin
/Channels 3 def
/MarksPlate {pop isCMYKSep?} def
/ToCMYK {pop _rgbtocmyk} def
/ToPSSpace {} def
end def
/DeviceCMYK 4 dict dup begin
/Channels 4 def
/MarksPlate {pop isCMYKSep?} def
/ToCMYK {pop} def
/ToPSSpace {} def
end def
/Separation 4 dict dup begin
/Channels 1 def
/MarksPlate {
/findcmykcustomcolor where {
pop dup 1 exch ToCMYK 5 -1 roll 1 get
findcmykcustomcolor 1 setcustomcolor
systemdict /currentgray get exec
1 ne
}{
pop false
} ifelse
} def
/ToCMYK {
dup 2 get mark exch 4 2 roll
3 get exec
counttomark -1 roll tocmyk
5 -1 roll pop
} def
/ToPSSpace {} def
end def
/Process 4 dict dup begin
/Channels 1 def
/MarksPlate {
isCMYKSep? {
1 exch ToCMYK 4 array astore getplateindex get 0 ne
}{
pop false
} ifelse
} def
/ToCMYK {
dup 2 get mark exch 4 2 roll
3 get exec
counttomark -1 roll tocmyk
5 -1 roll pop
} def
/ToPSSpace {
4 array copy dup 0 /Separation put
} def
end def
end def
/isoverprint {
/currentoverprint where {pop currentoverprint}{_of} ifelse
} def
/version_ge_3010.106 {
version {cvr} stopped {
pop
false
}{
3010.106 ge
} ifelse
} def
end
end
defaultpacking setpacking
%%EndResource
%%EndProlog
%%BeginSetup
userdict /_useSmoothShade false put
userdict /_aicmykps false put
userdict /_forceToCMYK false put
Adobe_level2_AI5 /initialize get exec
Adobe_cshow /initialize get exec
Adobe_ColorImage_AI6 /initialize get exec
Adobe_shading_AI8 /initialize get exec
Adobe_Illustrator_AI5 /initialize get exec
%%EndSetup
%AI5_BeginLayer
0 1 0 1 0 0 0 0 79 128 255 0 50 Lb
(Lager 1) Ln
0 A
u
u
0 R
0 0 0 1 0 0 0 XA
300 Ar
0 J 0 j 8.1 w 10 M []0 d
%AI3_Note:
0 D
0 XR
116.6133 407.9141 m
116.6133 437.7227 140.8047 461.9146 170.6133 461.9146 c
200.4209 461.9146 224.6133 437.7227 224.6133 407.9141 c
S
/BBAccumRotation (4.712389) XT
116.6133 407.9141 m
116.6133 378.1074 140.8047 353.9141 170.6133 353.9141 c
200.4209 353.9141 224.6133 378.1074 224.6133 407.9141 c
S
/BBAccumRotation (4.712389) XT
386.6123 407.9141 m
386.6123 437.7227 410.8047 461.9146 440.6123 461.9146 c
470.4209 461.9146 494.6123 437.7227 494.6123 407.9141 c
S
/BBAccumRotation (4.712389) XT
386.6123 407.9141 m
386.6123 378.1074 410.8047 353.9141 440.6123 353.9141 c
470.4209 353.9141 494.6123 378.1074 494.6123 407.9141 c
S
/BBAccumRotation (4.712389) XT
395.6221 488.9229 m
404.9814 505.6011 422.6162 515.9263 441.7412 515.9263 c
470.9326 515.9263 494.625 492.2344 494.625 463.0425 c
494.625 462.6733 494.6211 462.3042 494.6133 461.9351 c
S
/BBAccumRotation (4.712389) XT
242.6123 461.9351 m
242.6045 462.3042 242.6006 462.6733 242.6006 463.0425 c
242.6006 492.2344 266.293 515.9263 295.4854 515.9263 c
314.6094 515.9263 332.2441 505.6011 341.6035 488.9229 c
S
/BBAccumRotation (4.712389) XT
125.6221 488.9229 m
134.9814 505.6011 152.6162 515.9263 171.7412 515.9263 c
200.9326 515.9263 224.625 492.2344 224.625 463.0425 c
224.625 462.6733 224.6211 462.3042 224.6133 461.9351 c
S
/BBAccumRotation (4.712389) XT
368.6123 551.9146 m
368.6123 353.9141 l
S
/BBAccumRotation (4.712389) XT
224.6133 461.9146 m
224.6133 353.9141 l
S
/BBAccumRotation (4.712389) XT
242.6133 353.9141 m
242.6133 461.9146 l
S
/BBAccumRotation (4.712389) XT
494.6123 461.9146 m
494.6123 353.9141 l
S
/BBAccumRotation (4.712389) XT
U
/BBAccumRotation (0.000000) XT
U
/BBAccumRotation (0.000000) XT
LB
%AI5_EndLayer--
%AI5_BeginLayer
1 1 1 1 0 0 1 1 255 79 79 0 50 Lb
(Lager 2) Ln
0 A
0 R
0 0 0 1 0 0 0 XA
800 Ar
0 J 0 j 8.1 w 10 M []0 d
%AI3_Note:
0 D
0 XR
125.5 489.1665 m
141.5 517.5 175.1665 520.1665 191.8335 512.1665 c
218.0479 499.584 225 482.6255 225 450 c
225 423 225 381.333 225 354 c
S
1 Ap
225 408 m
225 378.1768 200.8232 354 171 354 c
141.1768 354 117 378.1768 117 408 c
117 437.8232 141.1768 462 171 462 c
200.8232 462 225 437.8232 225 408 c
s
0 Ap
342.5 489.1665 m
326.5 517.5 292.834 520.1665 276.167 512.1665 c
249.9531 499.584 243 482.6255 243 450 c
243 423 243 381.333 243 354 c
S
369 552 m
369 528.0264 369 369 369 354 c
S
395.5 489.1665 m
411.5 517.5 445.166 520.1665 461.834 512.1665 c
488.0479 499.584 495 482.6255 495 450 c
495 423 495 381.333 495 354 c
S
1 Ap
495 408 m
495 378.1768 470.8232 354 441 354 c
411.1768 354 387 378.1768 387 408 c
387 437.8232 411.1768 462 441 462 c
470.8232 462 495 437.8232 495 408 c
s
LB
%AI5_EndLayer--
%%PageTrailer
gsave annotatepage grestore showpage
%%Trailer
Adobe_Illustrator_AI5 /terminate get exec
Adobe_shading_AI8 /terminate get exec
Adobe_ColorImage_AI6 /terminate get exec
Adobe_cshow /terminate get exec
Adobe_level2_AI5 /terminate get exec
%%EOF
\ No newline at end of file diff --git a/usr.sbin/afs/src/doc/caching-in-blocks b/usr.sbin/afs/src/doc/caching-in-blocks new file mode 100644 index 00000000000..aaa90221ae4 --- /dev/null +++ b/usr.sbin/afs/src/doc/caching-in-blocks @@ -0,0 +1,107 @@ +Caching in blocks +================= + +$KTH: caching-in-blocks,v 1.3 2000/12/10 23:08:29 lha Exp $ + +Why blockcache + + - There is just one reson that one should have blockcache. + You want to edit filer larger then you blockcache. Example below + is with a cache-size of 100M. + + : lha@nutcracker ; less kdc.3log + kdc.3log: No space left on device + : lha@nutcracker ; ls -l 'kdc.3log' + -rw-r--r-- 1 314 daemon 179922925 Sep 18 00:05 kdc.3log + + + - Speed is not really an issue since most files are accessed for + head of the file to tail of the file. Then you can use + incremental opening of the file. This would be less gross change. + +Prior work + adaptive buffercache, usenix99 + - this will apply to both reading and writing + +Double buffering problem +======================== + +One way that might work is that files that are accessed read-only are +done on the underlaying file (and in that vnode's page-cache). + +But as files that are write-ed too are dubblebuffered. If the file has +been accessed before the node's and the underlaying node's all pages +are flushed to make sure we are double buffering. + +Incremental open +================ + +This still doesn't solve the problem with large files, it only solve +the problem that its takes long time to read the first few bytes of a +large file. + +* Opening a file + + wait until there is a token that you want or wakeup returns an error + + >open + <installdata, installs token and fhandle + <wakeup open + + failure case + + >open + <wakeup with errno + +* Reading data (read and getpage) + check for readable data for this user +retry: + check if existing offset is more then wanted offset, + do the read from the cache file, return + check if wanted-offset over end of file, fail + >getdata(wanted-offset) + <installattr(filesize,existing-offset) + goto retry + +* Writing data (write and putpage) + + XXX rewrite this with respect to + + check for writeable data for this user +retry: + check if existing offset is more then writing offset, + do the write to the cache file, return + check if beginning-offset over end of file, fail + >getdata(beginning-offset) + <installattr(filesize,beginning-offset) + goto retry + +* When closing + + if data dirty, write back to the fileserver. + +Caching in blocks +================= + +Writing + - what triggers a write + + shortage of blocks + interesting case, necessary to detect random writing ? + + fsync/close + just flush all dirty blocks, or sync whole file + just flush what blocks are dirty to userlevel + one rpc-call with bitmask ? + - how to cluster writing (how to detect) + + with shortage of block in the hard one + +Reading + - how to read-ahead (how far, how to detect) + + prior work + +What to cache (in general terms) +============= + + - how long time does it take to open a fhandle_t (fhtovp) ? + benchmark ? (fhopen() abort 5 times faster then open()) + - how many no vnode can the layer hold up (related to above) + diff --git a/usr.sbin/afs/src/doc/index.texi b/usr.sbin/afs/src/doc/index.texi new file mode 100644 index 00000000000..b640895e11d --- /dev/null +++ b/usr.sbin/afs/src/doc/index.texi @@ -0,0 +1,11 @@ +@c Copyright (c) 2000 Kungliga Tekniska Högskolan +@c (Royal Institute of Technology, Stockholm, Sweden). +@c All rights reserved. + +@c $KTH: index.texi,v 1.1 2000/11/25 11:39:24 lha Exp $ + +@node Index, , Acknowledgments, Top +@comment node-name, next, previous, up +@appendix Index + +@printindex cp diff --git a/usr.sbin/afs/src/doc/real-world.texi b/usr.sbin/afs/src/doc/real-world.texi new file mode 100644 index 00000000000..d77173c0db2 --- /dev/null +++ b/usr.sbin/afs/src/doc/real-world.texi @@ -0,0 +1,88 @@ +@c Copyright (c) 2000 Kungliga Tekniska Högskolan +@c (Royal Institute of Technology, Stockholm, Sweden). +@c All rights reserved. + +@c $KTH: real-world.texi,v 1.3 2000/12/01 08:32:24 lha Exp $ + +@node AFS and the real world, Parts of Arla, Organization of data, Top +@comment node-name, next, previous, up + +@chapter AFS and the real world + +This chapter tries to describe problems that you see in the real (not +that perfect) world and show possible solutions to these problems. + +@menu +* NAT:: Really evil stuff. +* Samba:: Export AFS to Windows computers. +* Integration with Kerberos:: How to integrate Kerberos with AFS. +@end menu + +@node NAT, Samba, AFS and the real world, AFS and the real world +@comment node-name, next, previous, up +@section NAT + +@cindex NAT +@cindex Masquerading +@cindex PAT +@cindex ALG +There's something evil out there that's called NAT. For whatever +reasons, people are using it and will continue doing so. + +First of all, it seemed like AFS should work just fine through NAT, you +just appear to be coming from the NAT-address and some random port +instead. Looking closer at different NAT implementations it seems like +they have a rather short timeout: + +@table @samp +@item FreeBSD natd +60 seconds +@item Cisco IOS +300 seconds +@item NetBSD ipf (ipnat) +600 seconds +@item Linux Nat (masq) +300 seconds +@end table + +And if the client doesn't transmit any traffic to a particular host +for that amount of time, it will get mapped into a new address. And +then the server will just figure out it has a new client, right? + +Wrong, the rx-connection is cached on the connection id, not the +host/port pair. This is right, but the connection is never updated in +the original rx-code. This have the unfortunate effect that the server +keep talking to the old client. + +@node Samba, Integration with Kerberos, NAT, AFS and the real world +@comment node-name, next, previous, up +@section Samba + +@cindex Samba + +The major problem with getting AFS to exported read-write to SMB +(Windows fileshareing) using Samba is how to transfer the user token to +the smb-server. The simple may is to use clear-text password between the +samba-server and the client, and then get tokens for the user with this +password. This solution is clearly not acceptable for AFS administrators +that are security aware. + +Describe here how to make AFS work "securely" with samba. + +@node Integration with Kerberos, , Samba, AFS and the real world +@comment node-name, next, previous, up +@section Integration with Kerberos + +Kerberos 4 and 5 can be integrated quite well with AFS. This is many due +to that the security model used in AFS is in fact Keberos. The kaserver +is a Kerberos 4 server with pre-authentication. Kaserver also provides a +feature that you can only try a password N times, and after that you are +locked out for half-an-hour. This feature require that +pre-authentication is used, but since the ka-server provides a Kerberos +4 interface (that doesn't use pre-authentication) is mostly worthless. + +Many sites indeed uses a kerberosserver instead of a kaserver. One of +the resons are that they want to use Kerberos 5 (with for example +Windows 2000). + +More text here how to create KeyFile, and describe TheseCells. diff --git a/usr.sbin/afs/src/include/afssysdefs.h b/usr.sbin/afs/src/include/afssysdefs.h new file mode 100644 index 00000000000..925403508ba --- /dev/null +++ b/usr.sbin/afs/src/include/afssysdefs.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $KTH: afssysdefs.h,v 1.1.2.5 2001/03/04 05:09:46 lha Exp $ */ + +/* + * This section is for machines using single entry point AFS syscalls! + * and/or + * This section is for machines using multiple entry point AFS syscalls! + * + * SunOS 4 is an example of single entry point and sgi of multiple + * entry point syscalls. + */ + +#if SunOS == 40 +#define AFS_SYSCALL 31 +#endif + +#if SunOS >= 50 && SunOS < 57 +#define AFS_SYSCALL 105 +#endif + +#if SunOS >= 57 +#define AFS_SYSCALL 73 +#endif + +#if SunOS >= 58 +#define AFS_SYSCALL 65 +#endif + +#if defined(__hpux) +#define AFS_SYSCALL 50 +#define AFS_SYSCALL2 49 +#define AFS_SYSCALL3 48 +#endif + +#if defined(_AIX) +/* _AIX is too weird */ +#endif + +#if defined(__sgi) +#define AFS_PIOCTL (64+1000) +#define AFS_SETPAG (65+1000) +#endif + +#if defined(__osf__) +#define AFS_SYSCALL 232 +#define AFS_SYSCALL2 258 +#endif + +#if defined(__ultrix) +#define AFS_SYSCALL 31 +#endif + +#if defined(__NetBSD__) +#define AFS_SYSCALL 210 +#endif + +#if defined(__FreeBSD__) +#define AFS_SYSCALL 339 +#endif + +#if defined(__OpenBSD__) +#define AFS_SYSCALL 208 +#endif + +#ifdef __APPLE__ /* MacOS X */ +#define AFS_SYSCALL 230 +#endif + +#ifdef SYS_afs_syscall +#define AFS_SYSCALL3 SYS_afs_syscall +#endif diff --git a/usr.sbin/afs/src/include/kafs.h b/usr.sbin/afs/src/include/kafs.h new file mode 100644 index 00000000000..615a875503a --- /dev/null +++ b/usr.sbin/afs/src/include/kafs.h @@ -0,0 +1,474 @@ +/* + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $KTH: kafs.h,v 1.32.2.2 2001/10/02 16:13:12 jimmy Exp $ */ + +#ifndef __KAFS_H +#define __KAFS_H + +/* XXX must include krb5.h or krb.h */ + +/* sys/ioctl.h must be included manually before kafs.h */ + +/* + */ +#define AFSCALL_PIOCTL 20 +#define AFSCALL_SETPAG 21 + +#ifndef _VICEIOCTL +#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) +#endif /* _VICEIOCTL */ + +#ifndef _ARLAIOCTL +#define _ARLAIOCTL(id) ((unsigned int ) _IOW('A', id, struct ViceIoctl)) +#endif /* _ARLAIOCTL */ + +/* + * this is for operating systems that support a 32-bit API while being + * 64-bit (such as solaris 7 in 64 bit mode). The ioctls will get + * assigned different numbers in 32bits mode and we need to support + * both. + */ + +#ifdef NEED_VICEIOCTL32 + +#ifndef _VICEIOCTL32 +#define _VICEIOCTL32(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl32)) +#endif /* _VICEIOCTL32 */ + +#ifndef _ARLAIOCTL32 +#define _ARLAIOCTL32(id) ((unsigned int ) _IOW('A', id, struct ViceIoctl32)) +#endif /* _ARLAIOCTL32 */ + +#ifndef _VICEIOCTL64 +#define _VICEIOCTL64(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl64)) +#endif /* _VICEIOCTL64 */ + +#ifndef _ARLAIOCTL64 +#define _ARLAIOCTL64(id) ((unsigned int ) _IOW('A', id, struct ViceIoctl64)) +#endif /* _ARLAIOCTL64 */ + + +#endif /* NEED_VICEIOCTL32 */ + + +/* + * ioctls + */ + +#define VIOCCLOSEWAIT _VICEIOCTL(1) +#define VIOCABORT _VICEIOCTL(2) +#define VIOIGETCELL _VICEIOCTL(3) + +#define VIOCCLOSEWAIT_32 _VICEIOCTL32(1) +#define VIOCABORT_32 _VICEIOCTL32(2) +#define VIOIGETCELL_32 _VICEIOCTL32(3) + +/* + * pioctls + */ + +#define VIOCSETAL _VICEIOCTL(1) +#define VIOCGETAL _VICEIOCTL(2) +#define VIOCSETTOK _VICEIOCTL(3) +#define VIOCGETVOLSTAT _VICEIOCTL(4) +#define VIOCSETVOLSTAT _VICEIOCTL(5) +#define VIOCFLUSH _VICEIOCTL(6) +#define VIOCSTAT _VICEIOCTL(7) +#define VIOCGETTOK _VICEIOCTL(8) +#define VIOCUNLOG _VICEIOCTL(9) +#define VIOCCKSERV _VICEIOCTL(10) +#define VIOCCKBACK _VICEIOCTL(11) +#define VIOCCKCONN _VICEIOCTL(12) +#define VIOCGETTIME _VICEIOCTL(13) +#define VIOCWHEREIS _VICEIOCTL(14) +#define VIOCPREFETCH _VICEIOCTL(15) +#define VIOCNOP _VICEIOCTL(16) +#define VIOCENGROUP _VICEIOCTL(17) +#define VIOCDISGROUP _VICEIOCTL(18) +#define VIOCLISTGROUPS _VICEIOCTL(19) +#define VIOCACCESS _VICEIOCTL(20) +#define VIOCUNPAG _VICEIOCTL(21) +#define VIOCGETFID _VICEIOCTL(22) +#define VIOCWAITFOREVER _VICEIOCTL(23) +#define VIOCSETCACHESIZE _VICEIOCTL(24) +#define VIOCFLUSHCB _VICEIOCTL(25) +#define VIOCNEWCELL _VICEIOCTL(26) +#define VIOCGETCELL _VICEIOCTL(27) +#define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28) +#define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29) +#define VIOC_FILE_CELL_NAME _VICEIOCTL(30) +#define VIOC_GET_WS_CELL _VICEIOCTL(31) +#define VIOC_AFS_MARINER_HOST _VICEIOCTL(32) +#define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33) +#define VIOC_VENUSLOG _VICEIOCTL(34) +#define VIOC_GETCELLSTATUS _VICEIOCTL(35) +#define VIOC_SETCELLSTATUS _VICEIOCTL(36) +#define VIOC_FLUSHVOLUME _VICEIOCTL(37) +#define VIOC_AFS_SYSNAME _VICEIOCTL(38) +#define VIOC_EXPORTAFS _VICEIOCTL(39) +#define VIOCGETCACHEPARAMS _VICEIOCTL(40) +#define VIOCCONNECTMODE _VICEIOCTL(41) +#define VIOCGETVCXSTATUS _VICEIOCTL(41) +#define VIOC_SETSPREFS33 _VICEIOCTL(42) +#define VIOC_GETSPREFS _VICEIOCTL(43) +#define VIOC_GAG _VICEIOCTL(44) +#define VIOC_TWIDDLE _VICEIOCTL(45) +#define VIOC_SETSPREFS _VICEIOCTL(46) +#define VIOC_STORBEHIND _VICEIOCTL(47) +#define VIOC_GCPAGS _VICEIOCTL(48) + + +#define VIOC_GETRXKCRYPT _VICEIOCTL(55) /* 48 in some implementations */ +#define VIOC_SETRXKCRYPT _VICEIOCTL(56) /* with cryptosupport in afs */ + +/* arla specific */ + +#define VIOC_FPRIOSTATUS _VICEIOCTL(57) /* arla: set file prio */ +#define VIOC_FHGET _VICEIOCTL(58) /* arla: fallback getfh */ +#define VIOC_FHOPEN _VICEIOCTL(59) /* arla: fallback fhopen */ + +#define VIOC_XFSDEBUG _VICEIOCTL(60) /* arla: controls xfsdebug */ +#define VIOC_ARLADEBUG _VICEIOCTL(61) /* arla: controls arla debug */ + +#define VIOC_AVIATOR _VICEIOCTL(62) /* arla: debug interface */ + +#define VIOC_XFSDEBUG_PRINT _VICEIOCTL(63) /* arla: print xfs status */ + +#define VIOC_CALCULATE_CACHE _VICEIOCTL(64) /* arla: force cache check */ + +#define VIOC_BREAKCALLBACK _VICEIOCTL(65) /* arla: break callback */ + +#define AIOC_STATISTICS _ARLAIOCTL(1) /* arla: fetch statistics */ + +#ifdef NEED_VICEIOCTL32 + +/* and now for the 32-bit versions */ + +#define VIOCSETAL_32 _VICEIOCTL32(1) +#define VIOCGETAL_32 _VICEIOCTL32(2) +#define VIOCSETTOK_32 _VICEIOCTL32(3) +#define VIOCGETVOLSTAT_32 _VICEIOCTL32(4) +#define VIOCSETVOLSTAT_32 _VICEIOCTL32(5) +#define VIOCFLUSH_32 _VICEIOCTL32(6) +#define VIOCSTAT_32 _VICEIOCTL32(7) +#define VIOCGETTOK_32 _VICEIOCTL32(8) +#define VIOCUNLOG_32 _VICEIOCTL32(9) +#define VIOCCKSERV_32 _VICEIOCTL32(10) +#define VIOCCKBACK_32 _VICEIOCTL32(11) +#define VIOCCKCONN_32 _VICEIOCTL32(12) +#define VIOCGETTIME_32 _VICEIOCTL32(13) +#define VIOCWHEREIS_32 _VICEIOCTL32(14) +#define VIOCPREFETCH_32 _VICEIOCTL32(15) +#define VIOCNOP_32 _VICEIOCTL32(16) +#define VIOCENGROUP_32 _VICEIOCTL32(17) +#define VIOCDISGROUP_32 _VICEIOCTL32(18) +#define VIOCLISTGROUPS_32 _VICEIOCTL32(19) +#define VIOCACCESS_32 _VICEIOCTL32(20) +#define VIOCUNPAG_32 _VICEIOCTL32(21) +#define VIOCGETFID_32 _VICEIOCTL32(22) +#define VIOCWAITFOREVER_32 _VICEIOCTL32(23) +#define VIOCSETCACHESIZE_32 _VICEIOCTL32(24) +#define VIOCFLUSHCB_32 _VICEIOCTL32(25) +#define VIOCNEWCELL_32 _VICEIOCTL32(26) +#define VIOCGETCELL_32 _VICEIOCTL32(27) +#define VIOC_AFS_DELETE_MT_PT_32 _VICEIOCTL32(28) +#define VIOC_AFS_STAT_MT_PT_32 _VICEIOCTL32(29) +#define VIOC_FILE_CELL_NAME_32 _VICEIOCTL32(30) +#define VIOC_GET_WS_CELL_32 _VICEIOCTL32(31) +#define VIOC_AFS_MARINER_HOST_32 _VICEIOCTL32(32) +#define VIOC_GET_PRIMARY_CELL_32 _VICEIOCTL32(33) +#define VIOC_VENUSLOG_32 _VICEIOCTL32(34) +#define VIOC_GETCELLSTATUS_32 _VICEIOCTL32(35) +#define VIOC_SETCELLSTATUS_32 _VICEIOCTL32(36) +#define VIOC_FLUSHVOLUME_32 _VICEIOCTL32(37) +#define VIOC_AFS_SYSNAME_32 _VICEIOCTL32(38) +#define VIOC_EXPORTAFS_32 _VICEIOCTL32(39) +#define VIOCGETCACHEPARAMS_32 _VICEIOCTL32(40) +#define VIOCCONNECTMODE_32 _VICEIOCTL32(41) +#define VIOCGETVCXSTATUS_32 _VICEIOCTL32(41) +#define VIOC_SETSPREFS_3233 _VICEIOCTL32(42) +#define VIOC_GETSPREFS_32 _VICEIOCTL32(43) +#define VIOC_GAG_32 _VICEIOCTL32(44) +#define VIOC_TWIDDLE_32 _VICEIOCTL32(45) +#define VIOC_SETSPREFS_32 _VICEIOCTL32(46) +#define VIOC_STORBEHIND_32 _VICEIOCTL32(47) +#define VIOC_GCPAGS_32 _VICEIOCTL32(48) + +#define VIOC_GETRXKCRYPT_32 _VICEIOCTL32(55) /* 48 in some implementations */ +#define VIOC_SETRXKCRYPT_32 _VICEIOCTL32(56) /* with cryptosupport in afs */ +#define VIOC_FPRIOSTATUS_32 _VICEIOCTL32(57) + +#define VIOC_FHGET_32 _VICEIOCTL32(58) +#define VIOC_FHOPEN_32 _VICEIOCTL32(59) + +#define VIOC_XFSDEBUG_32 _VICEIOCTL32(60) +#define VIOC_ARLADEBUG_32 _VICEIOCTL32(61) + +#define VIOC_AVIATOR_32 _VICEIOCTL32(62) + +#define VIOC_XFSDEBUG_PRINT_32 _VICEIOCTL32(63) + +#define VIOC_CALCULATE_CACHE_32 _VICEIOCTL32(64) + +#define VIOC_BREAKCALLBACK_32 _VICEIOCTL32(65) + +/* and now for the 64-bit versions */ + +#define VIOCSETAL_64 _VICEIOCTL64(1) +#define VIOCGETAL_64 _VICEIOCTL64(2) +#define VIOCSETTOK_64 _VICEIOCTL64(3) +#define VIOCGETVOLSTAT_64 _VICEIOCTL64(4) +#define VIOCSETVOLSTAT_64 _VICEIOCTL64(5) +#define VIOCFLUSH_64 _VICEIOCTL64(6) +#define VIOCSTAT_64 _VICEIOCTL64(7) +#define VIOCGETTOK_64 _VICEIOCTL64(8) +#define VIOCUNLOG_64 _VICEIOCTL64(9) +#define VIOCCKSERV_64 _VICEIOCTL64(10) +#define VIOCCKBACK_64 _VICEIOCTL64(11) +#define VIOCCKCONN_64 _VICEIOCTL64(12) +#define VIOCGETTIME_64 _VICEIOCTL64(13) +#define VIOCWHEREIS_64 _VICEIOCTL64(14) +#define VIOCPREFETCH_64 _VICEIOCTL64(15) +#define VIOCNOP_64 _VICEIOCTL64(16) +#define VIOCENGROUP_64 _VICEIOCTL64(17) +#define VIOCDISGROUP_64 _VICEIOCTL64(18) +#define VIOCLISTGROUPS_64 _VICEIOCTL64(19) +#define VIOCACCESS_64 _VICEIOCTL64(20) +#define VIOCUNPAG_64 _VICEIOCTL64(21) +#define VIOCGETFID_64 _VICEIOCTL64(22) +#define VIOCWAITFOREVER_64 _VICEIOCTL64(23) +#define VIOCSETCACHESIZE_64 _VICEIOCTL64(24) +#define VIOCFLUSHCB_64 _VICEIOCTL64(25) +#define VIOCNEWCELL_64 _VICEIOCTL64(26) +#define VIOCGETCELL_64 _VICEIOCTL64(27) +#define VIOC_AFS_DELETE_MT_PT_64 _VICEIOCTL64(28) +#define VIOC_AFS_STAT_MT_PT_64 _VICEIOCTL64(29) +#define VIOC_FILE_CELL_NAME_64 _VICEIOCTL64(30) +#define VIOC_GET_WS_CELL_64 _VICEIOCTL64(31) +#define VIOC_AFS_MARINER_HOST_64 _VICEIOCTL64(32) +#define VIOC_GET_PRIMARY_CELL_64 _VICEIOCTL64(33) +#define VIOC_VENUSLOG_64 _VICEIOCTL64(34) +#define VIOC_GETCELLSTATUS_64 _VICEIOCTL64(35) +#define VIOC_SETCELLSTATUS_64 _VICEIOCTL64(36) +#define VIOC_FLUSHVOLUME_64 _VICEIOCTL64(37) +#define VIOC_AFS_SYSNAME_64 _VICEIOCTL64(38) +#define VIOC_EXPORTAFS_64 _VICEIOCTL64(39) +#define VIOCGETCACHEPARAMS_64 _VICEIOCTL64(40) +#define VIOCCONNECTMODE_64 _VICEIOCTL64(41) +#define VIOCGETVCXSTATUS_64 _VICEIOCTL64(41) +#define VIOC_SETSPREFS_6433 _VICEIOCTL64(42) +#define VIOC_GETSPREFS_64 _VICEIOCTL64(43) +#define VIOC_GAG_64 _VICEIOCTL64(44) +#define VIOC_TWIDDLE_64 _VICEIOCTL64(45) +#define VIOC_SETSPREFS_64 _VICEIOCTL64(46) +#define VIOC_STORBEHIND_64 _VICEIOCTL64(47) +#define VIOC_GCPAGS_64 _VICEIOCTL64(48) + + +#define VIOC_GETRXKCRYPT_64 _VICEIOCTL64(55) /* 48 in some implementations */ +#define VIOC_SETRXKCRYPT_64 _VICEIOCTL64(56) /* with cryptosupport in afs */ +#define VIOC_FPRIOSTATUS_64 _VICEIOCTL64(57) + +#define VIOC_FHGET_64 _VICEIOCTL64(58) +#define VIOC_FHOPEN_64 _VICEIOCTL64(59) + +#define VIOC_XFSDEBUG_64 _VICEIOCTL64(60) +#define VIOC_ARLADEBUG_64 _VICEIOCTL64(61) + +#define VIOC_AVIATOR_64 _VICEIOCTL64(62) + +#define VIOC_XFSDEBUG_PRINT_64 _VICEIOCTL64(63) + +#define VIOC_CALCULATE_CACHE_64 _VICEIOCTL64(64) + +#define VIOC_BREAKCALLBACK_64 _VICEIOCTL64(65) + +/* + * Arla implementationspecific IOCTL'S + */ + +#define AIOC_STATISTICS_32 _ARLAIOCTL32(1) /* arla: fetch statistics */ +#define AIOC_STATISTICS_64 _ARLAIOCTL64(1) /* arla: fetch statistics */ + +#endif /* NEED_VICEIOCTL32 */ + +/* + * GETCELLSTATUS flags + */ + +#define CELLSTATUS_PRIMARY 0x01 /* this is the `primary' cell */ +#define CELLSTATUS_SETUID 0x02 /* setuid honored for this cell */ +#define CELLSTATUS_OBSOLETE_VL 0x04 /* uses obsolete VL servers */ + +/* + * VIOCCONNECTMODE arguments + */ + +#define CONNMODE_PROBE 0 +#define CONNMODE_CONN 1 +#define CONNMODE_FETCH 2 +#define CONNMODE_DISCONN 3 +#define CONNMODE_PARCONNECTED 4 + +/* + * The struct for VIOC_FPRIOSTATUS + */ + +#define FPRIO_MAX 100 +#define FPRIO_MIN 0 +#define FPRIO_DEFAULT FPRIO_MAX + +#define FPRIO_GET 0 +#define FPRIO_SET 1 +#define FPRIO_GETMAX 2 +#define FPRIO_SETMAX 3 + +struct vioc_fprio { + int16_t cmd; + int16_t prio; + int32_t Cell; + int32_t Volume; + int32_t Vnode; + int32_t Unique; +}; + + +/* + * Flags for VIOCCKSERV + */ + +#define CKSERV_DONTPING 1 +#define CKSERV_FSONLY 2 + +#define CKSERV_MAXSERVERS 16 /* limitation of VIOCCKSERV number of + returned servers */ + +/* + * for AIOC_STATISTICS + */ + +#define STATISTICS_OPCODE_LIST 0 +#define STATISTICS_OPCODE_GETENTRY 1 + +#define STATISTICS_REQTYPE_FETCHSTATUS 1 +#define STATISTICS_REQTYPE_FETCHDATA 2 +#define STATISTICS_REQTYPE_BULKSTATUS 3 + + +#if !defined(HAVE_STRUCT_VICEIOCTL_IN) || !defined(__KERNEL__) +struct ViceIoctl { + caddr_t in, out; + short in_size; + short out_size; +}; +#endif + +struct ViceIoctl32 { + u_int32_t in, out; /* really caddr_t in 32 bits */ + short in_size; + short out_size; +}; + +#if NEED_VICEIOCTL32 +struct ViceIoctl64 { +#ifdef HAVE_U_INT64_T + u_int64_t in, out; /* really caddr_t in 64 bits */ +#else + caddr_t in, out; +#endif + short in_size; + short out_size; +}; +#endif /* NEED_VICEIOCTL32 */ + +struct ClearToken { + int32_t AuthHandle; + char HandShakeKey[8]; + int32_t ViceId; + int32_t BeginTimestamp; + int32_t EndTimestamp; +}; + +#ifndef __P +#define __P(x) x +#endif + +/* Use k_hasafs() to probe if the machine supports AFS syscalls. + The other functions will generate a SIGSYS if AFS is not supported */ + +int k_hasafs __P((void)); + +int krb_afslog __P((const char *cell, const char *realm)); +int krb_afslog_uid __P((const char *cell, const char *realm, uid_t uid)); + +int k_pioctl __P((char *a_path, + int o_opcode, + struct ViceIoctl *a_paramsP, + int a_followSymlinks)); +int k_unlog __P((void)); +int k_setpag __P((void)); +int k_afs_cell_of_file __P((const char *path, char *cell, int len)); + +/* XXX */ +#ifdef KFAILURE +#define KRB_H_INCLUDED +#endif + +#ifdef KRB5_RECVAUTH_IGNORE_VERSION +#define KRB5_H_INCLUDED +#endif + +#ifdef KRB_H_INCLUDED +int kafs_settoken __P((const char*, uid_t, CREDENTIALS*)); +#endif + +#ifdef KRB5_H_INCLUDED +krb5_error_code krb5_afslog_uid __P((krb5_context, krb5_ccache, + const char*, krb5_const_realm, uid_t)); +krb5_error_code krb5_afslog __P((krb5_context, krb5_ccache, + const char*, krb5_const_realm)); +#endif + + +#define _PATH_VICE "/usr/vice/etc/" +#define _PATH_THISCELL _PATH_VICE "ThisCell" +#define _PATH_CELLSERVDB _PATH_VICE "CellServDB" +#define _PATH_THESECELLS _PATH_VICE "TheseCells" + +#define _PATH_ARLA_VICE "/usr/arla/etc/" +#define _PATH_ARLA_THISCELL _PATH_ARLA_VICE "ThisCell" +#define _PATH_ARLA_CELLSERVDB _PATH_ARLA_VICE "CellServDB" +#define _PATH_ARLA_THESECELLS _PATH_ARLA_VICE "TheseCells" + +#endif /* __KAFS_H */ diff --git a/usr.sbin/afs/src/lib/ko/agetarg.c b/usr.sbin/afs/src/lib/ko/agetarg.c new file mode 100644 index 00000000000..55ba76cc990 --- /dev/null +++ b/usr.sbin/afs/src/lib/ko/agetarg.c @@ -0,0 +1,606 @@ +/* + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 4. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +RCSID("$KTH: agetarg.c,v 1.8.2.3 2001/05/17 07:38:30 lha Exp $"); +#endif + +#include <stdio.h> +#include <roken.h> +#include "agetarg.h" + +#define ISFLAG(X) ((X)->type == aarg_flag || (X)->type == aarg_negative_flag) + +static size_t +print_arg (FILE *stream, int mdoc, int longp, struct agetargs *arg, + int style) +{ + const char *s = NULL; + int len; + + if (ISFLAG(arg)) + return 0; + + if(mdoc){ + if(longp) + fprintf(stream, "= Ns"); + fprintf(stream, " Ar "); + }else + if (longp && !(style & AARG_TRANSLONG)) + putc ('=', stream); + else + putc (' ', stream); + + if (arg->arg_help) + s = arg->arg_help; + else if (arg->type == aarg_integer) + s = "number"; + else if (arg->type == aarg_string) + s = "string"; + else + s = "undefined"; + + if (style & AARG_TRANSLONG) { + fprintf (stream, "<%s>", s); + len = strlen(s) + 2; + } else { + fprintf (stream, "%s", s); + len = strlen(s); + } + return 1 + len; +} + +static void +mandoc_template(struct agetargs *args, + const char *extra_string, + int style) +{ + struct agetargs *arg; + char timestr[64], cmd[64]; + const char *p; + time_t t; + + printf(".\\\" Things to fix:\n"); + printf(".\\\" * correct section, and operating system\n"); + printf(".\\\" * remove Op from mandatory flags\n"); + printf(".\\\" * use better macros for arguments (like .Pa for files)\n"); + printf(".\\\"\n"); + t = time(NULL); + strftime(timestr, sizeof(timestr), "%b %d, %Y", localtime(&t)); + printf(".Dd %s\n", timestr); + p = strrchr(__progname, '/'); + if(p) p++; else p = __progname; + strncpy(cmd, p, sizeof(cmd)); + cmd[sizeof(cmd)-1] = '\0'; + strupr(cmd); + + printf(".Dt %s SECTION\n", cmd); + printf(".Os OPERATING_SYSTEM\n"); + printf(".Sh NAME\n"); + printf(".Nm %s\n", p); + printf(".Nd\n"); + printf("in search of a description\n"); + printf(".Sh SYNOPSIS\n"); + printf(".Nm\n"); + for(arg = args; arg->type; arg++) { + if(arg->short_name){ + printf(".Op Fl %c", arg->short_name); + print_arg(stdout, 1, 0, args, style); + printf("\n"); + } + if(arg->long_name){ + printf(".Op Fl %s%s", style & AARG_TRANSLONG ? "" : "-", arg->long_name); + print_arg(stdout, 1, 1, args, style); + printf("\n"); + } + /* + if(arg->type == aarg_strings) + fprintf (stderr, "..."); + */ + } + if (extra_string && *extra_string) + printf (".Ar %s\n", extra_string); + printf(".Sh DESCRIPTION\n"); + printf("Supported options:\n"); + printf(".Bl -tag -width Ds\n"); + for(arg = args; arg->type; arg++) { + if(arg->short_name){ + printf(".It Fl %c", arg->short_name); + print_arg(stdout, 1, 0, args, style); + printf("\n"); + } + if(arg->long_name){ + printf(".It Fl %s%s", style & AARG_TRANSLONG ? "" : "-", arg->long_name); + print_arg(stdout, 1, 1, args, style); + printf("\n"); + } + if(arg->help) + printf("%s\n", arg->help); + /* + if(arg->type == aarg_strings) + fprintf (stderr, "..."); + */ + } + printf(".El\n"); + printf(".\\\".Sh ENVIRONMENT\n"); + printf(".\\\".Sh FILES\n"); + printf(".\\\".Sh EXAMPLES\n"); + printf(".\\\".Sh DIAGNOSTICS\n"); + printf(".\\\".Sh SEE ALSO\n"); + printf(".\\\".Sh STANDARDS\n"); + printf(".\\\".Sh HISTORY\n"); + printf(".\\\".Sh AUTHORS\n"); + printf(".\\\".Sh BUGS\n"); +} + +void +aarg_printusage (struct agetargs *args, + const char *progname, + const char *extra_string, + int style) +{ + struct agetargs *arg; + size_t max_len = 0; + + if (progname == NULL) + progname = __progname; + + if(getenv("GETARGMANDOC")){ + mandoc_template(args, extra_string, style); + return; + } + fprintf (stderr, "Usage: %s", progname); + for (arg = args; arg->type; arg++) { + size_t len = 0; + + if (arg->long_name) { + if (style & AARG_TRANSLONG) { + switch (arg->mandatoryp) { + case aarg_mandatory: + fprintf (stderr, " -"); + break; + default: + fprintf (stderr, " [-"); + break; + } + } else + fprintf (stderr, " [--"); + + if (arg->type == aarg_negative_flag) { + fprintf (stderr, "no-"); + len += 3; + } + fprintf (stderr, "%s", arg->long_name); + len += 2 + strlen(arg->long_name); + len += print_arg (stderr, 0, 1, arg, style); + if(arg->type == aarg_strings) + fprintf (stderr, "..."); + if(!(style & AARG_TRANSLONG) || arg->mandatoryp != aarg_mandatory) + putc (']', stderr); + } + if (arg->short_name) { + len += 2; + fprintf (stderr, " [-%c", arg->short_name); + len += print_arg (stderr, 0, 0, arg, style); + putc (']', stderr); + if(arg->type == aarg_strings) + fprintf (stderr, "..."); + } + if (arg->long_name && arg->short_name) + len += 4; + max_len = max(max_len, len); + } + if (extra_string) + fprintf (stderr, " %s\n", extra_string); + else + fprintf (stderr, "\n"); + for (arg = args; arg->type; arg++) { + if (arg->help) { + size_t count = 0; + + if (arg->short_name) { + fprintf (stderr, "-%c", arg->short_name); + count += 2; + count += print_arg (stderr, 0, 0, arg, style); + } + if (arg->short_name && arg->long_name) { + fprintf (stderr, " or "); + count += 4; + } + if (arg->long_name) { + fprintf (stderr, "-%s", style & AARG_TRANSLONG ? "" : "-"); + if (arg->type == aarg_negative_flag) { + fprintf (stderr, "no-"); + count += 3; + } + fprintf (stderr, "%s", arg->long_name); + count += 2 + strlen(arg->long_name); + count += print_arg (stderr, 0, 1, arg, style); + } + while(count++ <= max_len) + putc (' ', stderr); + fprintf (stderr, "%s\n", arg->help); + } + } +} + +static void +add_string(agetarg_strings *s, char *value) +{ + s->strings = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings)); + s->strings[s->num_strings] = value; + s->num_strings++; +} + +static int +parse_option(struct agetargs *arg, int style, char *optarg, int argc, + char **argv, int *next, int negate) +{ + switch(arg->type){ + case aarg_integer: + { + int tmp; + if(sscanf(optarg, "%d", &tmp) != 1) + return AARG_ERR_BAD_ARG; + *(int*)arg->value = tmp; + return 0; + } + case aarg_string: + case aarg_generic_string: + { + *(char**)arg->value = optarg; + return 0; + } + case aarg_strings: + { + add_string ((agetarg_strings*)arg->value, optarg); + while ((style & AARG_TRANSLONG) + && argc > *next + 1 + && argv[*next + 1] + && argv[*next + 1][0] != '-') + { + add_string ((agetarg_strings*)arg->value, argv[*next + 1]); + (*next)++; + } + return 0; + } + case aarg_flag: + case aarg_negative_flag: + { + int *flag = arg->value; + if(*optarg == '\0' || + strcmp(optarg, "yes") == 0 || + strcmp(optarg, "true") == 0){ + *flag = !negate; + return 0; + } else if (*optarg && strcmp(optarg, "maybe") == 0) { + *flag = rand() & 1; + } else { + *flag = negate; + return 0; + } + return AARG_ERR_BAD_ARG; + } + default: + abort (); + } +} + + +static int +arg_match_long(struct agetargs *args, int argc, + char **argv, int style, int *next, int *num_arg) +{ + char *optarg = NULL; + int negate = 0; + int numarg = -1; + int partial_match = 0; + int do_generic=0; + struct agetargs *partial = NULL; + struct agetargs *generic_arg = NULL; + struct agetargs *current = NULL; + struct agetargs *arg; + int argv_len; + char *p, *q; + + if (style & AARG_LONGARG) { + q = *argv + 2; + *next = 0; + } else if (style & AARG_TRANSLONG) { + q = *argv + 1; + *next = 0; + } else { + *next = 0; + q = *argv; + } + + argv_len = strlen(q); + p = strchr (q, '='); + if (p != NULL) + argv_len = p - q; + + for (arg = args; arg->type ; arg++) { + /* parse a generic argument if it has not already been filled */ + if (!do_generic && arg->type == aarg_generic_string) { + char *hole = (char *)arg->value; + + if (hole && *hole == '\0') + do_generic = 1; + } + + if(do_generic) { + generic_arg = arg; + optarg = *(argv); + *next = 0; + } + + numarg++; + if(arg->long_name) { + int len = strlen(arg->long_name); + char *p = q; + int p_len = argv_len; + negate = 0; + + for (;;) { + if (strncmp (arg->long_name, p, len) == 0) { + current = arg; + if (style & AARG_TRANSLONG) { + if (ISFLAG(arg)) { + optarg = ""; + *next = 0; + } else if (*(argv +1)) { + optarg = *(argv + 1); + *next = 1; + } else + optarg = ""; + } else if(p[len] == '\0') + optarg = p + len; + else + optarg = p + len + 1; + } else if (strncmp (arg->long_name, + p, + p_len) == 0) { + if (!(style & AARG_USEFIRST) || !partial_match) { + ++partial_match; + partial = arg; + } + if (style & AARG_TRANSLONG) { + if (ISFLAG(arg)) { + optarg = ""; + *next = 0; + } else if (*(argv + 1)) { + optarg = *(argv + 1); + *next = 1; + } else + optarg = ""; + } else + optarg = p + p_len +1 ; + } else if (ISFLAG(arg) && strncmp (p, "no-", 3) == 0) { + negate = !negate; + p += 3; + p_len -= 3; + continue; + } + break; + } + if (current) + break; + } + } + if (current == NULL) { + /* Match a generic argument preferentially over a partial match */ + if (generic_arg && (!partial_match || (style & AARG_USEFIRST))) + current = generic_arg; + else if (partial_match == 1) + current = partial; + else + return AARG_ERR_NO_MATCH; + } + + if(*optarg == '\0' && !ISFLAG(current)) + return AARG_ERR_NO_MATCH; + + *num_arg = numarg; + return parse_option(current, style, optarg, argc, argv, next, negate); +} + +int +agetarg(struct agetargs *args, + int argc, char **argv, int *optind, int style) +{ + int i, j; + struct agetargs *arg; + int ret = 0; + int swcount = *optind; + int num_args = 0; + char *usedargs; + + for(i = 0 ; args[i].type != aarg_end; i++) + num_args++; + + usedargs = malloc (num_args * sizeof(char)); + if (usedargs == NULL) + return ENOMEM; + memset (usedargs, 0, num_args *sizeof(char)); + + srand (time(NULL)); + (*optind)++; + for(i = *optind; i < argc; i++) { + if(argv[i][0] != '-' + && swcount != -1 + && (args[swcount].mandatoryp == aarg_mandatory + || args[swcount].mandatoryp == aarg_optional_swless)) { + /* the mandatory junk up there is to prevent agetarg() from + automatically matching options even when not specified with + their flagged name + */ + if (!(style & AARG_SWITCHLESS)) + break; + j = 0; + ret = parse_option(&args[swcount], style, argv[i], + argc - i, &argv[i], &j, 0); + if (ret) { + *optind = i; + free (usedargs); + return ret; + } + usedargs[swcount] = 1; + i += j; + swcount++; + } else if(argv[i][0] == '-' && + (argv[i][1] == '-' || + ((style & AARG_TRANSLONG) && argv[i][1] != 0))) { + int k; + + if(argv[i][2] == 0 && !(style & AARG_TRANSLONG)){ + i++; + break; + } + swcount = -1; + ret = arg_match_long (args, argc - i, &argv[i], style, &j, &k); + if(ret) { + *optind = i; + free (usedargs); + return ret; + } + usedargs[k] = 1; + i += j; + }else if (style & AARG_SHORTARG && argv[i][0] == '-') { + for(j = 1; argv[i][j]; j++) { + int arg_num = -1; + for(arg = args; arg->type; arg++) { + char *optarg; + arg_num++; + if(arg->short_name == 0) + continue; + if(argv[i][j] == arg->short_name){ + if(arg->type == aarg_flag){ + *(int*)arg->value = 1; + usedargs[arg_num] = 1; + break; + } + if(arg->type == aarg_negative_flag){ + *(int*)arg->value = 0; + usedargs[arg_num] = 1; + break; + } + if(argv[i][j + 1]) + optarg = &argv[i][j + 1]; + else{ + i++; + optarg = argv[i]; + } + if(optarg == NULL) { + *optind = i - 1; + free (usedargs); + return AARG_ERR_NO_ARG; + } + if(arg->type == aarg_integer){ + int tmp; + if(sscanf(optarg, "%d", &tmp) != 1) { + *optind = i; + free (usedargs); + return AARG_ERR_BAD_ARG; + } + *(int*)arg->value = tmp; + usedargs[arg_num] = 1; + goto out; + }else if(arg->type == aarg_string){ + *(char**)arg->value = optarg; + usedargs[arg_num] = 1; + goto out; + }else if(arg->type == aarg_strings){ + add_string((agetarg_strings*)arg->value, optarg); + usedargs[arg_num] = 1; + goto out; + } + *optind = i; + free (usedargs); + return AARG_ERR_BAD_ARG; + } + + } + if (!arg->type) { + *optind = i; + free (usedargs); + return AARG_ERR_NO_MATCH; + } + } + out:; + } else + break; + } + *optind = i; + + for(i = 0 ; args[i].type != aarg_end; i++) { + if (args[i].mandatoryp == aarg_mandatory && usedargs[i] == 0) { + *optind = i; + free (usedargs); + return AARG_ERR_NO_ARG; + } + } + + free (usedargs); + return 0; +} + +#if TEST +int foo_flag = 2; +int flag1 = 0; +int flag2 = 0; +int bar_int; +char *baz_string; + +struct agetargs args[] = { + { NULL, '1', aarg_flag, &flag1, "one", NULL }, + { NULL, '2', aarg_flag, &flag2, "two", NULL }, + { "foo", 'f', aarg_negative_flag, &foo_flag, "foo", NULL }, + { "bar", 'b', aarg_integer, &bar_int, "bar", "seconds"}, + { "baz", 'x', aarg_string, &baz_string, "baz", "name" }, + { NULL, 0, aarg_end, NULL} +}; + +int main(int argc, char **argv) +{ + int optind = 0; + while(agetarg(args, 5, argc, argv, &optind)) + printf("Bad arg: %s\n", argv[optind]); + printf("flag1 = %d\n", flag1); + printf("flag2 = %d\n", flag2); + printf("foo_flag = %d\n", foo_flag); + printf("bar_int = %d\n", bar_int); + printf("baz_flag = %s\n", baz_string); + aarg_printusage (args, 5, argv[0], "nothing here"); +} +#endif diff --git a/usr.sbin/afs/src/lib/ko/agetarg.h b/usr.sbin/afs/src/lib/ko/agetarg.h new file mode 100644 index 00000000000..4913223f486 --- /dev/null +++ b/usr.sbin/afs/src/lib/ko/agetarg.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 4. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $KTH: agetarg.h,v 1.4.2.1 2001/03/04 04:30:56 lha Exp $ */ + +#ifndef __AGETARG_H__ +#define __AGETARG_H__ + +#include <stddef.h> + +#define AARG_DEFAULT 0x0 /* AARG_GNUSTYLE */ +#define AARG_LONGARG 0x1 /* --foo=bar */ +#define AARG_SHORTARG 0x2 /* -abc a, b and c are all three flags */ +#define AARG_TRANSLONG 0x4 /* Incompatible with {SHORT,LONG}ARG */ +#define AARG_SWITCHLESS 0x8 /* No switches */ +#define AARG_SUBOPTION 0xF /* For manpage generation */ +#define AARG_USEFIRST 0x10 /* Use first partial found instead of failing */ + +#define AARG_GNUSTYLE (AARG_LONGARG|AARG_SHORTARG) +#define AARG_AFSSTYLE (AARG_TRANSLONG|AARG_SWITCHLESS) + +struct agetargs{ + const char *long_name; + char short_name; + enum { aarg_end = 0, aarg_integer, aarg_string, + aarg_flag, aarg_negative_flag, aarg_strings, + aarg_generic_string } type; + void *value; + const char *help; + const char *arg_help; + enum { aarg_optional = 0, + aarg_mandatory, + aarg_optional_swless } mandatoryp; +}; + +enum { + AARG_ERR_NO_MATCH = 1, + AARG_ERR_BAD_ARG, + AARG_ERR_NO_ARG +}; + +typedef struct agetarg_strings { + int num_strings; + char **strings; +} agetarg_strings; + +int agetarg(struct agetargs *args, + int argc, char **argv, int *optind, int style); + +void aarg_printusage (struct agetargs *args, + const char *progname, + const char *extra_string, + int style); + +#endif /* __AGETARG_H__ */ diff --git a/usr.sbin/afs/src/lwp/LICENSE.s390 b/usr.sbin/afs/src/lwp/LICENSE.s390 new file mode 100644 index 00000000000..f0e1b1efcfc --- /dev/null +++ b/usr.sbin/afs/src/lwp/LICENSE.s390 @@ -0,0 +1,39 @@ +To: adam@fsf.net +From: Harald Barth <haba@pdc.kth.se> +Date: Tue, 20 Feb 2001 09:32:10 +0100 +Subject: s390 LWP Arla patch - license stuff + +Hi again, + +when we - the Arla folks - tried to include your LWP patch, we +stumbled about the IPL in there. Then we read the IPL text some times, +and without being lawyers discovered that we got a small clash here. +The IPL is talking about "Program" and "Contributions" to that +program. However, here the program (Arla) is not released under the +IPL. We really would not like to include a patch which has a license +text which may or may not conflict with the original license Arla is +released under. So do you have any problem to contribute under the +3-clause BSD license that Arla is released under? Sorry to bother, but +I don't like to feed a future population of lawyers. + +Regards, +Harald. + +To: Harald Barth <haba@pdc.kth.se> +From: Adam Thornton <adam@fsf.net> +Subject: Re: s390 LWP Arla patch - license stuff +Date: Tue, 20 Feb 2001 09:58:42 -0600 + +Let me confirm with Neale, but I think it's OK to release as BSD. + +Adam + +To: Harald Barth <haba@pdc.kth.se> +From: Adam Thornton <adam@fsf.net> +Subject: Re: s390 LWP Arla patch - license stuff +Date: Tue, 20 Feb 2001 10:59:58 -0600 + +I assume you got the earlier message--Neale confirms, it's OK to release +as BSD not IPL. + +Adam diff --git a/usr.sbin/afs/src/lwp/process.s390.S b/usr.sbin/afs/src/lwp/process.s390.S new file mode 100644 index 00000000000..d1580ba2dd4 --- /dev/null +++ b/usr.sbin/afs/src/lwp/process.s390.S @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Linux for S/390 (31 bit) + * + * Written by Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com> + * + * additional munging by Adam Thornton <adam@sinenomine.net> + */ + .file "process.s" + + .globl savecontext + .type savecontext,%function + /* + * savecontext(f, area1, newsp) + * int (*f)() ; struct savearea *area1; char *newsp; + * f - r2 + * area1 - r3 + * newsp - r4 + */ + + /* + * struct savearea { + * char *topstack; + * } + */ + +P_PRE: .long PRE_Block +P_ABORT: .long abort + +savecontext: + stm %r7,%r15,28(%r15) /* Save our registers */ + lr %r1,%r15 + ahi %r15,-96 + st %r1,0(%r15) + + /* larl %r5,P_PRE /* Get A((PRE_Block)) */ + bras %r5,.L0 /* Get A(A(PRE_Block)) */ + .long PRE_Block + .L0: + l %r5,0(%r5) /* Get A(PRE_Block) */ + mvi 0(%r5),1 /* Set it */ + st %r15,0(%r3) /* Save stack pointer */ + ltr %r4,%r4 /* If new sp is 0 */ + jz .L1 /* ... don't change sp */ + lr %r15,%r4 /* Set new stack pointer */ + .L1: + br %r2 /* Call the routine */ + + /* Can't get here....*/ + + /* larl %r5,P_ABORT */ + bras %r5,.L2 + .long abort + .L2: + l %r5,0(%r5) + basr %r14,%r5 + + .savecontext_end: + .size savecontext,.savecontext_end-savecontext + + /* + * returnto(area2) + * struct savearea *area2; + * + * area2 - r2 + */ + + .globl returnto + .type returnto,%function + +returnto: + l %r15,0(%r2) /* New frame, to get correct pointer + */ + /* larl %r5,P_PRE /* Get A((PRE_Block)) */ + bras %r5,.L3 /* Get A(A(PRE_Block)) */ + .long PRE_Block + .L3: + l %r5,0(%r5) /* Get A(PRE_Block) */ + mvi 0(%r5),0 /* Clear it */ + l %r15,0(%r15) /* Point to next stack frame */ + lm %r7,%r15,28(%r15) /* Restore registers */ + br %r14 /* Return */ + + /* Can't happen */ + + la %r2,1234 + /* larl %r9,P_ABORT */ + bras %r9,.L4 + .long abort + .L4: + l %r9,0(%r9) + basr %r14,%r9 + + .returnto_end: + .size returnto,.returnto_end-returnto + diff --git a/usr.sbin/afs/src/tests/copy-file b/usr.sbin/afs/src/tests/copy-file new file mode 100644 index 00000000000..b71a40bda75 --- /dev/null +++ b/usr.sbin/afs/src/tests/copy-file @@ -0,0 +1,26 @@ +#!/bin/sh +# $KTH: copy-file,v 1.1 2000/10/14 04:01:52 lha Exp $ +cat > foo <<EOF +hej love + +ska vi g|ra r{tt nu. +EOF + +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +cp foo foo2 || exit 1 +exit 0 diff --git a/usr.sbin/afs/src/tests/fchmod.c b/usr.sbin/afs/src/tests/fchmod.c new file mode 100644 index 00000000000..c112ab6ce95 --- /dev/null +++ b/usr.sbin/afs/src/tests/fchmod.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <err.h> +#include <roken.h> + +RCSID("$KTH: fchmod.c,v 1.2 2000/10/03 00:33:49 lha Exp $"); + +int +main(int argc, char **argv) +{ + int fd, ret; + struct stat sb; + + set_progname (argv[0]); + + fd = open ("deps", O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (fd < 0) + err (1, "open"); + ret = fstat (fd, &sb); + if (ret < 0) + err (1, "fstat"); + ret = write (fd, "# DO NOT DELETE\n", 16); + if (ret != 16) + err (1, "write"); + ret = fchmod (fd, 0100644); + if (ret < 0) + errx (1, "fchmod"); + ret = close (fd); + if (ret < 0) + errx (1, "close"); + + return 0; +} diff --git a/usr.sbin/afs/src/tests/fhbench.c b/usr.sbin/afs/src/tests/fhbench.c new file mode 100644 index 00000000000..7365a91b105 --- /dev/null +++ b/usr.sbin/afs/src/tests/fhbench.c @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <sys/types.h> +#include <sys/param.h> +#include <unistd.h> +#include <limits.h> +#include <sys/mount.h> + +#ifdef HAVE_SYS_IOCCOM_H +#include <sys/ioccom.h> +#endif + +#include <fcntl.h> + +#include <err.h> +#include <roken.h> +#include <agetarg.h> + +#include <atypes.h> +#include <roken.h> +#include <kafs.h> + +RCSID("$KTH: fhbench.c,v 1.6.2.1 2002/02/24 22:37:36 lha Exp $"); + +struct fhb_handle { + char data[512]; +}; + +static int help_flag; +static int num_files; +static int write_file = 0; +static int num_runs = 3; + +static struct agetargs args[] = { + {"num", 'n', aarg_integer, &num_files, "number of files"}, + {"write", 'w', aarg_integer, &write_file, "write num kb"}, + {"runs", 'r', aarg_integer, &num_runs, "number of runs"}, + {"help", 0, aarg_flag, &help_flag, NULL, NULL}, + {NULL, 0, aarg_end, NULL, NULL, NULL} +}; + + +static void +fhb_fhget (char *filename, struct fhb_handle *handle) +{ + int ret = 0; +#if defined(HAVE_GETFH) && defined(HAVE_FHOPEN) + { + fhandle_t fh; + + ret = getfh (filename, &fh); + if (ret) + err (1, "getfh"); + memcpy (handle, &fh, sizeof(fh)); + } +#endif +#ifdef KERBEROS + { + struct ViceIoctl vice_ioctl; + + vice_ioctl.in = NULL; + vice_ioctl.in_size = 0; + + vice_ioctl.out = (caddr_t)handle; + vice_ioctl.out_size = sizeof(*handle); + + ret = k_pioctl (filename, VIOC_FHGET, &vice_ioctl, 0); + if (ret) + errx (1, "k_pioctl"); + } +#endif +} + + +static int +fhb_fhopen (struct fhb_handle *handle, int flags) +{ + int ret; +#if defined(HAVE_GETFH) && defined(HAVE_FHOPEN) + { + fhandle_t fh; + + memcpy (&fh, handle, sizeof(fh)); + ret = fhopen (&fh, flags); + if (ret >= 0) + return ret; + } +#endif + +#ifdef KERBEROS /* really KAFS */ + { + struct ViceIoctl vice_ioctl; + + vice_ioctl.in = (caddr_t)handle; + vice_ioctl.in_size = sizeof(*handle); + + vice_ioctl.out = NULL; + vice_ioctl.out_size = 0; + + ret = k_pioctl (NULL, VIOC_FHOPEN, &vice_ioctl, flags); + if (ret >= 0) + return ret; + } +#endif + errx (1, "fhopen/k_pioctl"); +} + +static void +nop_call (void) +{ +#ifdef KERBEROS /* really KAFS */ + { + struct ViceIoctl vice_ioctl; + char c[8]; + int ret; + + vice_ioctl.in = (caddr_t)&c; + vice_ioctl.in_size = sizeof(c); + + vice_ioctl.out = NULL; + vice_ioctl.out_size = 0; + + ret = k_pioctl (NULL, VIOC_XFSDEBUG, &vice_ioctl, 0); + if (ret < 0) + err (1, "k_pioctl"); + } +#else + { + static first = 1; + if (first) { + warnx ("can't test this"); + first = 0; + } + } +#endif +} + +static void +create_file (int num, struct fhb_handle *handle) +{ + int fd; + char filename[1024]; + + snprintf (filename, sizeof(filename), "file-%d", num); + + fd = open (filename, O_CREAT|O_EXCL|O_RDWR, 0666); + if (fd < 0) + err (1, "open"); + + close (fd); + + fhb_fhget(filename, handle); +} + +char databuf[1024]; + +static void +write_to_file (int fd, int num) +{ + int ret; + while (num > 0) { + ret = write (fd, databuf, sizeof(databuf)); + if (ret != sizeof(databuf)) + err (1, "write"); + num--; + } +} + +static void +fhopen_file (int num, struct fhb_handle *handle) +{ + int fd; + + fd = fhb_fhopen(handle, O_RDWR); + if (fd < 0) + err (1, "open"); + + if (write_file) + write_to_file(fd, write_file); + close(fd); +} + +static void +open_file (int num) +{ + int fd; + char filename[1024]; + + snprintf (filename, sizeof(filename), "file-%d", num); + + fd = open (filename, O_RDWR, 0666); + if (fd < 0) + err (1, "open"); + + if (write_file) + write_to_file(fd, write_file); + + close (fd); +} + +static void +unlink_file (int num) +{ + int ret; + char filename[1024]; + + snprintf (filename, sizeof(filename), "file-%d", num); + + ret = unlink(filename); + if (ret < 0) + err (1, "unlink"); +} + +/* + * Make `t1' consistent. + */ + +static void +tvfix(struct timeval *t1) +{ + if (t1->tv_usec < 0) { + t1->tv_sec--; + t1->tv_usec += 1000000; + } + if (t1->tv_usec >= 1000000) { + t1->tv_sec++; + t1->tv_usec -= 1000000; + } +} + +/* + * t1 -= t2 + */ + +static void +tvsub(struct timeval *t1, const struct timeval *t2) +{ + t1->tv_sec -= t2->tv_sec; + t1->tv_usec -= t2->tv_usec; + tvfix(t1); +} + + +struct timeval time1, time2; + +static void +starttesting(char *msg) +{ + printf("testing %s...\n", msg); + fflush (stdout); + gettimeofday(&time1, NULL); +} + +static void +endtesting(void) +{ + gettimeofday(&time2, NULL); + tvsub(&time2, &time1); + printf("timing: %ld.%06ld\n", (long)time2.tv_sec, (long)time2.tv_usec); +} + +static void +usage (int exit_val) +{ + aarg_printusage (args, NULL, "number of files", AARG_GNUSTYLE); + exit (exit_val); +} + +static void +open_bench (int i, struct fhb_handle *handles) +{ + printf ("====== test run %d\n" + "==================\n", + i); + + starttesting ("fhopening files"); + for (i = 0; i < num_files; i++) + fhopen_file (i, &handles[i]); + endtesting (); + + starttesting ("opening files"); + for (i = 0; i < num_files; i++) + open_file (i); + endtesting (); +} + +int +main (int argc, char **argv) +{ + int optind = 0; + int i; + struct fhb_handle *handles; + + set_progname (argv[0]); + + if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE)) + usage (1); + + if (help_flag) + usage (0); + + if (num_files <= 0) + usage (1); + + if (write_file < 0) + usage (1); + + if (!k_hasafs()) + errx (1, "no afs kernel module"); + + handles = emalloc (num_files * sizeof(*handles)); + + starttesting ("creating files"); + for (i = 0; i < num_files; i++) + create_file (i, &handles[i]); + endtesting (); + + for (i = 0 ; i < num_runs; i++) + open_bench (i, handles); + + printf ( "==================\n"); + starttesting ("unlink files"); + for (i = 0; i < num_files; i++) + unlink_file (i); + endtesting (); + + printf ( "==================\n"); + starttesting ("nop call"); + for (i = 0; i < num_files; i++) + nop_call (); + endtesting (); + + return 0; +} diff --git a/usr.sbin/afs/src/tests/hardlink3 b/usr.sbin/afs/src/tests/hardlink3 new file mode 100644 index 00000000000..0edd553bf3e --- /dev/null +++ b/usr.sbin/afs/src/tests/hardlink3 @@ -0,0 +1,28 @@ +#!/bin/sh +# $KTH: hardlink3,v 1.1.2.2 2001/12/20 20:41:03 lha Exp $ + +if test "X$FAST" != "X" ; then echo "Not running $0" ; exit 0 ; fi + +FS=${FS:-${objdir}/../appl/fs/fs} + +touch file +for i in `awk 'BEGIN {for(i=0; i < 1000; ++i) printf "%d\n", i}' /dev/null`; do + ln file file$i +done + +# now trigger bulkstatus +for i in `awk 'BEGIN {for(i=0; i < 1000; ++i) printf "%d\n", i}' /dev/null`; do + ls -l file > /dev/null 2>&1 || exit 1 + ${FS} flush file +done + +# just stat them all +for i in `awk 'BEGIN {for(i=0; i < 1000; ++i) printf "%d\n", i}' /dev/null`; do + ls -l file$i > /dev/null 2>&1 || exit 1 +done + +#clean up +for i in `awk 'BEGIN {for(i=0; i < 1000; ++i) printf "%d\n", i}' /dev/null`; do + rm file$i > /dev/null 2>&1 || exit 1 +done +rm file
\ No newline at end of file diff --git a/usr.sbin/afs/src/tests/invalidate-file.c b/usr.sbin/afs/src/tests/invalidate-file.c new file mode 100644 index 00000000000..8312cb2bf20 --- /dev/null +++ b/usr.sbin/afs/src/tests/invalidate-file.c @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/stat.h> + +#include <unistd.h> +#include <fcntl.h> + +#include <atypes.h> + +#include <kafs.h> + +#include <fs.h> +#include <arlalib.h> + +#include <err.h> +#include <roken.h> + +RCSID("$KTH: invalidate-file.c,v 1.3 2000/10/16 22:01:08 assar Exp $"); + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +static void +create_write_file (char *filename) +{ + int ret; + int fd; + + fs_invalidate (filename); + + fd = open(filename, O_RDWR|O_CREAT, 0666); + if (fd < 0) + err (1, "open(rw): %s", filename); + + ret = write (fd, "foo", 3); + if (ret < 0) + err (1, "write"); + + fs_invalidate (filename); + + ret = write (fd, "foo", 3); + if (ret < 0) + err (1, "write2"); + + ret = close (fd); + if (ret < 0) + err (1, "close"); +} + +static void +read_file (char *filename) +{ + int ret; + int fd; + char buf[3]; + + fs_invalidate (filename); + + fd = open(filename, O_RDONLY, 0666); + if (fd < 0) + err (1, "open(ro)"); + + ret = read (fd, buf, sizeof(buf)); + if (ret < 0) + err (1, "read"); + + fs_invalidate (filename); + + ret = read (fd, buf, sizeof(buf)); + if (ret < 0) + err (1, "read"); + + ret = close (fd); + if (ret < 0) + err (1, "close"); +} + +static void +mmap_read_file (char *filename) +{ + int fd; + void *v; + char buf[6]; + + fs_invalidate (filename); + + fd = open(filename, O_RDONLY, 0666); + if (fd < 0) + err (1, "open(ro-mmap)"); + + v = mmap (NULL, 6, PROT_READ, MAP_SHARED, fd, 0); + if (v == (void *)MAP_FAILED) + err (1, "mmap(ro) %s", filename); + + memcpy (buf, v, 3); + fs_invalidate (filename); + memcpy (buf, v, 3); + + munmap (v, 6); +} + +static void +mmap_write_file (char *filename) +{ + int fd; + void *v; + + fs_invalidate (filename); + + fd = open (filename, O_RDWR, 0666); + if (fd < 0) + err (1, "open(rw-mmap)"); + + v = mmap (NULL, 6, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (v == (void *)MAP_FAILED) + err (1, "mmap(rw) %s", filename); + + memcpy (v, "foo", 3); + fs_invalidate (filename); + memcpy (v, "foo", 3); + + munmap (v, 6); + close (fd); +} + +int +main(int argc, char **argv) +{ + char *filename = "foo"; + + set_progname (argv[0]); + + if (!k_hasafs()) + exit (1); + + create_write_file (filename); + read_file (filename); + read_file (filename); + read_file (filename); + read_file (filename); + mmap_read_file (filename); + mmap_read_file (filename); + mmap_read_file (filename); + mmap_read_file (filename); + mmap_write_file (filename); + mmap_write_file (filename); + mmap_write_file (filename); + mmap_write_file (filename); + + return 0; +} diff --git a/usr.sbin/afs/src/tests/large-filename b/usr.sbin/afs/src/tests/large-filename new file mode 100644 index 00000000000..b680d0afa75 --- /dev/null +++ b/usr.sbin/afs/src/tests/large-filename @@ -0,0 +1,6 @@ +#!/bin/sh +# $KTH: large-filename,v 1.3 2000/10/19 06:15:58 lha Exp $ + +touch aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2>/dev/null >/dev/null || exit 0 + +exit 0 diff --git a/usr.sbin/afs/src/tests/make-page.c b/usr.sbin/afs/src/tests/make-page.c new file mode 100644 index 00000000000..6509e5b1ba6 --- /dev/null +++ b/usr.sbin/afs/src/tests/make-page.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/mman.h> +#include <unistd.h> + +#include <roken.h> + +#include <err.h> + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +RCSID("$KTH: make-page.c,v 1.2.2.1 2001/04/27 23:42:50 mattiasa Exp $"); + +int +main (int argc, char **argv) +{ + int mb = 10; + int ret; + size_t sz; + void *mmap_buf; + + srand(getpid() * time(NULL)); + + sz = mb * 1024 * 1024; + +#ifdef MAP_ANON + mmap_buf = mmap (NULL, sz, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0); +#else + { + int fd; + + fd = open ("/dev/zero", O_RDWR); + if (fd < 0) + err (1, "open /dev/zero"); + mmap_buf = mmap (NULL, sz, PROT_READ | PROT_WRITE, + MAP_PRIVATE, fd, 0); + close (fd); + } +#endif + if (mmap_buf == (void *)MAP_FAILED) + err (1, "mmap"); + + while (1) { + int *foo = (int *) ((unsigned char *) mmap_buf + (((rand() % (sz - 9)) + 7) & ~7)); + struct timeval tv = { 0, 1000} ; + *foo = 10; + select (0, NULL, NULL, NULL, &tv); + } + + ret = munmap (mmap_buf, sz); + if (ret) + err (1, "munmap"); +} diff --git a/usr.sbin/afs/src/tests/mmap-cat.c b/usr.sbin/afs/src/tests/mmap-cat.c new file mode 100644 index 00000000000..4d09804f9f2 --- /dev/null +++ b/usr.sbin/afs/src/tests/mmap-cat.c @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/mman.h> +#include <fcntl.h> +#include <unistd.h> + +#include <roken.h> +#include <agetarg.h> + +#include <err.h> + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +RCSID("$KTH: mmap-cat.c,v 1.1.2.1 2001/05/17 07:38:56 lha Exp $"); + +static void +doit_mmap(int fd, struct stat *sb) +{ + void *mmap_buf; + int ret; + + mmap_buf = mmap (NULL, sb->st_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (mmap_buf == (void *)MAP_FAILED) + err (1, "mmap"); + ret = write (STDOUT_FILENO, mmap_buf, sb->st_size); + if (ret != sb->st_size) + err(1, "write returned %d wanted to write %d", + ret, (int)sb->st_size); + munmap(mmap_buf, sb->st_size); +} + + +static void +doit_read(int fd, struct stat *sb) +{ + int ret; + void *read_buf; + + read_buf = malloc(sb->st_size); + if (read_buf == NULL) + err(1, "malloc(%d)", (int)sb->st_size); + ret = read(fd, read_buf, sb->st_size); + if (ret != sb->st_size) + err(1, "read returned %d wanted to write %d", + ret, (int)sb->st_size); + ret = write (STDOUT_FILENO, read_buf, sb->st_size); + if (ret != sb->st_size) + err(1, "write returned %d wanted to write %d", + ret, (int)sb->st_size); + free(read_buf); +} + +static void +doit (const char *filename, void (*func)(int, struct stat *)) +{ + struct stat sb; + int fd; + int ret; + + fd = open (filename, O_RDONLY); + if (fd < 0) + err(1, "open %s", filename); + ret = fstat (fd, &sb); + (*func)(fd, &sb); + if (ret < 0) + err (1, "stat %s", filename); + close (fd); +} + +static int read_flag; +static int mmap_flag; +static int help_flag; + +static struct agetargs args[] = { + {"read", 'r', aarg_flag, &read_flag, "read", NULL}, + {"mmap", 'm', aarg_flag, &mmap_flag, "mmap", NULL}, + {"help", 0, aarg_flag, &help_flag, NULL, NULL}, + {NULL, 0, aarg_end, NULL, NULL, NULL} +}; + +static void +usage (int exit_val) +{ + aarg_printusage (args, NULL, "filename", AARG_AFSSTYLE); + exit (exit_val); +} + +int +main(int argc, char **argv) +{ + int optind = 0; + + set_progname (argv[0]); + + if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) + usage (1); + + argc -= optind; + argv += optind; + + if (help_flag) + usage(0); + + if (argc != 1) + usage(1); + + if (read_flag && mmap_flag) + errx(1, "can't do both mmap and read"); + + if (read_flag) + doit(argv[0], doit_read); + if (mmap_flag) + doit(argv[0], doit_mmap); + + return 0; +} diff --git a/usr.sbin/afs/src/tests/still-there-p.c b/usr.sbin/afs/src/tests/still-there-p.c new file mode 100644 index 00000000000..be097c58ac8 --- /dev/null +++ b/usr.sbin/afs/src/tests/still-there-p.c @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2001 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <dirent.h> + +#include <roken.h> + +#include <err.h> + +RCSID("$KTH: still-there-p.c,v 1.1.2.1 2001/04/28 22:09:39 lha Exp $"); + +#define TEST_BUFFER_SZ (1024*8) + +int +main(int argc, char **argv) +{ + const char *file = "foo"; + char otherbuf[TEST_BUFFER_SZ]; + char buf[TEST_BUFFER_SZ]; + int fd; + + set_progname (argv[0]); + + fd = open (file, O_RDWR|O_TRUNC|O_CREAT, 0644); + if (fd < 0) + err(1, "open(%s)", file); + + if (write (fd, buf, sizeof(buf)) != sizeof(buf)) + errx(1, "write"); + + while (1) { + if (lseek(fd, 0, SEEK_SET) < 0) + err(1, "lseek"); + + if (read(fd, otherbuf, sizeof(otherbuf)) != sizeof(otherbuf)) { + struct stat sb; + + if (fstat(fd, &sb) < 0) + err(1, "fstat"); + printf("size: %d\n", (int)sb.st_size); + printf ("lseek(SEEK_CUR): %d\n", (int)lseek(fd, 0, SEEK_CUR)); + errx(1, "read"); + } + + if (memcmp(buf, otherbuf, sizeof(buf)) != 0) + errx (1, "buf != otherbuf"); + } + close(fd); + + return 0; +} diff --git a/usr.sbin/afs/src/tests/truncate.c b/usr.sbin/afs/src/tests/truncate.c new file mode 100644 index 00000000000..50653a158a5 --- /dev/null +++ b/usr.sbin/afs/src/tests/truncate.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <err.h> +#include <roken.h> + +RCSID("$KTH: truncate.c,v 1.2 2000/10/03 00:36:26 lha Exp $"); + +static void +create_and_write (char *name, const char *buf) +{ + int fd, ret; + int len = strlen(buf); + + fd = open (name, O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (fd < 0) + err (1, "open"); + ret = write (fd, buf, len); + if (ret != len) + err (1, "write"); + ret = close (fd); + if (ret < 0) + err (1, "close"); +} + +static void +check_size (char *name, int len) +{ + struct stat sb; + int ret; + + ret = stat(name, &sb); + if (ret < 0) + err (1, "stat"); + + if (len != sb.st_size) + errx (1, "len != sb.st_size"); +} + +int +main(int argc, char **argv) +{ + int ret; + + set_progname (argv[0]); + + create_and_write ("foo", "hej\n"); + + ret = truncate ("foo", 0); + if (ret < 0) + err (1, "truncate(0)"); + + check_size ("foo", 0); + + ret = unlink("foo"); + if (ret < 0) + errx (1, "unlink"); + + create_and_write ("bar", "hej\nhej\n"); + + ret = truncate ("bar", 16); + if (ret < 0) + err (1, "truncate(16)"); + + check_size ("bar", 16); + + ret = unlink("bar"); + if (ret < 0) + errx (1, "unlink"); + + return 0; +} diff --git a/usr.sbin/afs/src/tests/utime-file.c b/usr.sbin/afs/src/tests/utime-file.c new file mode 100644 index 00000000000..6956ffd8be5 --- /dev/null +++ b/usr.sbin/afs/src/tests/utime-file.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef RCSID +RCSID("$KTH: utime-file.c,v 1.2 2000/12/01 15:01:21 lha Exp $"); +#endif + +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <utime.h> +#include <sys/stat.h> +#include <sys/time.h> + +#include <roken.h> +#include <err.h> + +int +main (int argc, char ** argv) +{ + int len; + int ret; + int fd; + char *filename = "foo"; + char *buf; + struct stat sb; + struct utimbuf t; + + switch (argc) { + case 1: + len = 8 * 1024; break; + case 2: + len = atoi(argv[1]); + if (len == 0) + errx (1, "invalid len"); + default: + errx (1, "argv != [12]"); + } + + buf = malloc (len); + memset (buf, 'a', len); + + fd = open (filename, O_RDWR|O_CREAT|O_EXCL, 0744); + if (fd < 0) + errx (1, "open"); + ret = fstat (fd, &sb); + if (ret < 0) + errx (1, "open"); + + ret = ftruncate (fd, len); + fstat (fd, &sb); + lseek (fd, 0, SEEK_SET); + write (fd, buf, len); + fstat (fd, &sb); + + t.modtime = t.actime = time (NULL); + utime (filename, &t); + + close (fd); + free (buf); + + return 0; +} |