summaryrefslogtreecommitdiff
path: root/usr.sbin/afs
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2003-08-05 09:16:17 +0000
committerHans Insulander <hin@cvs.openbsd.org>2003-08-05 09:16:17 +0000
commit63e99a94c2bedf11cd2b5068ba73954f1f2140c7 (patch)
treeb39f774f705d1f96f0662178501f5deda5f948eb /usr.sbin/afs
parent5257d723bfe2effb2d10613847e00ff9f325cd8c (diff)
Merge
Diffstat (limited to 'usr.sbin/afs')
-rw-r--r--usr.sbin/afs/src/ChangeLog1523
-rw-r--r--usr.sbin/afs/src/HACKING29
-rw-r--r--usr.sbin/afs/src/INSTALL119
-rw-r--r--usr.sbin/afs/src/LIESMICH16
-rw-r--r--usr.sbin/afs/src/README51
-rw-r--r--usr.sbin/afs/src/THANKS6
-rw-r--r--usr.sbin/afs/src/conf/CellServDB43
-rw-r--r--usr.sbin/afs/src/conf/arla.spec.in28
-rw-r--r--usr.sbin/afs/src/conf/bos.conf2
-rw-r--r--usr.sbin/afs/src/doc/ack.texi20
-rw-r--r--usr.sbin/afs/src/doc/ack.texi.in2
-rw-r--r--usr.sbin/afs/src/doc/afs-basics.texi2
-rw-r--r--usr.sbin/afs/src/doc/arla.info1059
-rw-r--r--usr.sbin/afs/src/doc/arla.texi76
-rw-r--r--usr.sbin/afs/src/doc/authors.texi13
-rw-r--r--usr.sbin/afs/src/doc/debugging.texi60
-rw-r--r--usr.sbin/afs/src/doc/intro.texi6
-rw-r--r--usr.sbin/afs/src/doc/oddities.texi6
-rw-r--r--usr.sbin/afs/src/doc/partsofarla.texi81
-rw-r--r--usr.sbin/afs/src/doc/porting.texi23
-rw-r--r--usr.sbin/afs/src/doc/servers.texi2
-rw-r--r--usr.sbin/afs/src/doc/storage.texi108
-rw-r--r--usr.sbin/afs/src/doc/timeline.texi20
-rw-r--r--usr.sbin/afs/src/doc/tools.texi2
-rw-r--r--usr.sbin/afs/src/include/bits.c24
-rw-r--r--usr.sbin/afs/src/include/stds.h22
-rw-r--r--usr.sbin/afs/src/milko/ChangeLog363
-rw-r--r--usr.sbin/afs/src/milko/README6
-rw-r--r--usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in2
-rw-r--r--usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in2
-rw-r--r--usr.sbin/afs/src/milko/appl/sked/sked.c49
-rw-r--r--usr.sbin/afs/src/milko/bos/bos_locl.h4
-rw-r--r--usr.sbin/afs/src/milko/bos/bosprocs.c15
-rw-r--r--usr.sbin/afs/src/milko/bos/bosserver.c6
-rw-r--r--usr.sbin/afs/src/milko/bos/kconf.c8
-rw-r--r--usr.sbin/afs/src/milko/fs/connsec.c139
-rw-r--r--usr.sbin/afs/src/milko/fs/fileserver.c65
-rw-r--r--usr.sbin/afs/src/milko/fs/fs_def.h6
-rw-r--r--usr.sbin/afs/src/milko/fs/fsprocs.c1235
-rw-r--r--usr.sbin/afs/src/milko/fs/fsrv_locl.h12
-rw-r--r--usr.sbin/afs/src/milko/fs/volprocs.c772
-rw-r--r--usr.sbin/afs/src/milko/lib/dpart/dpart.c58
-rw-r--r--usr.sbin/afs/src/milko/lib/dpart/dpart.h9
-rw-r--r--usr.sbin/afs/src/milko/lib/mlog/mlog.c2
-rw-r--r--usr.sbin/afs/src/milko/lib/mlog/mlog.h2
-rw-r--r--usr.sbin/afs/src/milko/lib/msecurity/msecurity.c7
-rw-r--r--usr.sbin/afs/src/milko/lib/msecurity/msecurity.h2
-rw-r--r--usr.sbin/afs/src/milko/lib/msecurity/netinit.c10
-rw-r--r--usr.sbin/afs/src/milko/lib/msecurity/netinit.h2
-rw-r--r--usr.sbin/afs/src/milko/lib/ropa/README6
-rw-r--r--usr.sbin/afs/src/milko/lib/ropa/ropa.c100
-rw-r--r--usr.sbin/afs/src/milko/lib/ropa/ropa.h15
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/common.c2
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/fvol.c2
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/fvol.h2
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/glue.c2
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/mdir.c133
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/mdir.h17
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/mnode.c85
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/mnode.h7
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/salvage.c90
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/salvage.h2
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/svol.c2
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/vld.c827
-rw-r--r--usr.sbin/afs/src/milko/lib/vld/vld.h89
-rw-r--r--usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c141
-rw-r--r--usr.sbin/afs/src/milko/lib/voldb/vol.c10
-rw-r--r--usr.sbin/afs/src/milko/lib/voldb/voldb.c50
-rw-r--r--usr.sbin/afs/src/milko/lib/voldb/voldb.h111
-rw-r--r--usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h33
-rw-r--r--usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h2
-rw-r--r--usr.sbin/afs/src/milko/lib/vstatus/vstat.xg4
-rw-r--r--usr.sbin/afs/src/milko/lib/vstatus/vstatus.c2
-rw-r--r--usr.sbin/afs/src/milko/lib/vstatus/vstatus.h2
-rw-r--r--usr.sbin/afs/src/milko/pts/pr.c156
-rw-r--r--usr.sbin/afs/src/milko/pts/ptserver.c728
-rw-r--r--usr.sbin/afs/src/milko/pts/ptserver.h34
-rw-r--r--usr.sbin/afs/src/milko/vldb/ubikprocs.c2
-rw-r--r--usr.sbin/afs/src/milko/vldb/vl_db.c362
-rw-r--r--usr.sbin/afs/src/milko/vldb/vldb_locl.h55
-rw-r--r--usr.sbin/afs/src/milko/vldb/vldbserver.c501
-rw-r--r--usr.sbin/afs/src/milko/vldb/vled.c4
-rw-r--r--usr.sbin/afs/src/rxdef/bos.xg29
-rw-r--r--usr.sbin/afs/src/rxdef/cb.xg30
-rw-r--r--usr.sbin/afs/src/rxdef/common.h152
-rw-r--r--usr.sbin/afs/src/rxdef/fs.xg37
-rw-r--r--usr.sbin/afs/src/rxdef/ka.xg9
-rw-r--r--usr.sbin/afs/src/rxdef/pts.xg46
-rw-r--r--usr.sbin/afs/src/rxdef/ubik.xg8
-rw-r--r--usr.sbin/afs/src/rxdef/vldb.xg287
-rw-r--r--usr.sbin/afs/src/rxdef/volumeserver.xg18
-rw-r--r--usr.sbin/afs/src/rxkad/compat.c28
-rw-r--r--usr.sbin/afs/src/rxkad/osi_alloc.c12
-rw-r--r--usr.sbin/afs/src/rxkad/rxk_clnt.c22
-rw-r--r--usr.sbin/afs/src/rxkad/rxk_crpt.c158
-rw-r--r--usr.sbin/afs/src/rxkad/rxk_info.c10
-rw-r--r--usr.sbin/afs/src/rxkad/rxk_locl.c48
-rw-r--r--usr.sbin/afs/src/rxkad/rxk_serv.c42
-rw-r--r--usr.sbin/afs/src/rxkad/rxkad.h35
-rw-r--r--usr.sbin/afs/src/rxkad/rxkad_locl.h91
-rw-r--r--usr.sbin/afs/src/util/bool.h8
-rw-r--r--usr.sbin/afs/src/util/hash.c131
-rw-r--r--usr.sbin/afs/src/util/hash.h21
-rw-r--r--usr.sbin/afs/src/util/heap.c6
-rw-r--r--usr.sbin/afs/src/util/heap.h8
-rw-r--r--usr.sbin/afs/src/util/heaptest.c2
-rw-r--r--usr.sbin/afs/src/util/list.c15
-rw-r--r--usr.sbin/afs/src/util/list.h12
-rw-r--r--usr.sbin/afs/src/util/log.c72
-rw-r--r--usr.sbin/afs/src/util/log.h28
-rw-r--r--usr.sbin/afs/src/util/log_log.39
-rw-r--r--usr.sbin/afs/src/util/mmaptime.c398
-rw-r--r--usr.sbin/afs/src/util/mmaptime.h94
-rw-r--r--usr.sbin/afs/src/util/mmaptime_test.c15
-rw-r--r--usr.sbin/afs/src/util/util-tester.c31
-rw-r--r--usr.sbin/afs/src/ydr/lex.h2
-rw-r--r--usr.sbin/afs/src/ydr/lex.l22
-rw-r--r--usr.sbin/afs/src/ydr/main.c3
-rw-r--r--usr.sbin/afs/src/ydr/output.c1054
-rw-r--r--usr.sbin/afs/src/ydr/output.h9
-rw-r--r--usr.sbin/afs/src/ydr/parse.y91
-rw-r--r--usr.sbin/afs/src/ydr/sym.h6
-rw-r--r--usr.sbin/afs/src/ydr/symbol.c17
-rw-r--r--usr.sbin/afs/src/ydr/types.c71
-rw-r--r--usr.sbin/afs/src/ydr/types.h10
125 files changed, 8168 insertions, 4726 deletions
diff --git a/usr.sbin/afs/src/ChangeLog b/usr.sbin/afs/src/ChangeLog
index 80e69cf6fd4..8cf1dd96620 100644
--- a/usr.sbin/afs/src/ChangeLog
+++ b/usr.sbin/afs/src/ChangeLog
@@ -1,1026 +1,1075 @@
-2002-02-25 Love Hörnquist-Åstrand <lha@stevens.e.kth.se>
+2003-07-15 Love <lha@stacken.kth.se>
- * Release 0.35.7
+ * nnpfs/bsd/nnpfs_dev-common.c: freebsd5.x needs
+ nnpfs_block_sigset too
-2002-02-24 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs_dev-common.c: drop support for freebsd 5.0 and
+ only support freebsd 5.1
- * tests/fhbench.c: include timevalsub and rename it to tvsub
-
-2002-02-08 Love <lha@stacken.kth.se>
+2003-07-01 Tomas Olsson <tol@stacken.kth.se>
- * xfs/linux/xfs_inodeops.c: 1.174->1.175: (xfs_file_mmap): pass in
- the xfs-inode to data_valid instead of the cache-node
-
-2002-02-06 Love <lha@stacken.kth.se>
+ * nnpfs/winnt/src/nnpfs_init.c (nnpfs_initdevice): use nnpfs_fsd_*
+ wrappers
- * xfs/linux/xfs_dev.c: 1.87->1.88:
- (free_node): create yet another free function, this one does
- consistency checks and replaces xfs_free(xn, XFS_MEM_XNODE)
- (xfs_queue_inactive): if the channel is closed, just free the node
- (xfs_process_inactive_queue): use free_node()
- (xfs_empty_inactive_queue): use free_node()
+ * nnpfs/winnt/src/nnpfs_vops.c: defined wrappers (nnpfs_fsd_*) for
+ all fsd entry points.
+ (nnpfs_{handle_stale,data_valid}): some lock handling
- * xfs/linux/xfs_syscalls.c: 1.69->1.70: (xfs_fh_to_dentry):
- linux-2.4: after a get_super, we need to drop_super(), w/o this,
- the we will fail to unmount the super block of the
- cache-filesystem.
+ * nnpfs/winnt/src/nnpfs_node.c
+ (nnpfs_{vrele,node_gc_all,close_data_handle,open_file,open_fh}):
+ locking
-2002-02-05 Love <lha@stacken.kth.se>
+ * nnpfs/winnt/src/nnpfs_message.c
+ (nnpfs_message_{installdata,invalidnode}): lock MainResource
- * tests/copy-and-diff-gnu-mirror: 1.7->1.8: don't run unless use
- are running -large tests
+ * nnpfs/winnt/src/nnpfs_fastio.c (nnpfs_fastio_read): don't print
+ buffer contents, use FsRtlE{nter,xit}FileSystem
+ (nnpfs_createsec_acq): use FsRtlE{nter,xit}FileSystem
+ (nnpfs_lazywrite_{acq,rel}): use node->lazy_writer
- * tests/run-tests.in: 1.76->1.78: add option -large that avoids
- running tests that uses up large amount of diskspace (like
- copy-and-diff-gnu-mirror), add new option -fail that make test-run
- stop after the first failure
-
-2002-02-01 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * nnpfs/winnt/src/nnpfs_dnlc.c (*): more
+ FsRtlE{nter,xit}FileSystem usage
+ * nnpfs/winnt/src/nnpfs_dev.c (*): more FsRtlE{nter,xit}FileSystem
+ usage
- * appl/mac/Arla_Configuration/ReadCells.m: 1.2->1.3: Added static
- on local functions
- * appl/mac/Arla_Configuration/Makefile.in: 1.6->1.7: Use install
- instead of tar
- * appl/mac/Arla_Configuration/DataSource.m: 1.12->1.13: Added
- static on local functions 1.12->1.13: (checkdaemonpid): give -p to
- ps
+ * nnpfs/winnt/src/nnpfs_dev.c (nnpfs_devctl): renamed to
+ nnpfs_fsd_devctl sprinkle some FsRtlE{nter,xit}FileSystem()
-2002-02-01 Love <lha@stacken.kth.se>
+ * nnpfs/winnt/inc/nnpfs_proto.h: added DEFINE_IRP:s for wrappers
+ for fsd entry points
- * xfs/linux: dual license xfs for linux under bsd/gpl, update
- copyright years. See xfs/linux/license for more detailed
- information.
+ * nnpfs/winnt/inc/nnpfs_locl.h (nnpfs_node): store lazy writer
+ thread
- * xfs/linux/xfs_node.c: adding missing symbol xfs_null_aops
-
-2002-02-01 Magnus Ahltorp <ahltorp@nada.kth.se>
+2003-06-26 Tomas Olsson <tol@stacken.kth.se>
- * lwp/Makefile.in: Remove superfluous -lroken
+ * nnpfs/winnt/src/inc/nnpfs_locl.h
+ use FastMutex to protect zone allocation and nodelist
- * cf/check-roken.m4: Reference libroken directly instead of with -l
+ * nnpfs/winnt/src/nnpfs_{dev,dnlc,init,misc}.c
+ use FastMutex to protect zone allocation and nodelist
-2002-02-01 Love <lha@stacken.kth.se>
+ * nnpfs/winnt/src/nnpfs_node.c (*): use FastMutexes to protect
+ zone allocation and node list
+ (nnpfs_open_fh): added
- * conf/CellServDB: 1.62->1.63: (theory.cornell.edu): removed, from
- Ruth Mitchell <mitchell@tc.cornell.edu> on info-afs@transarc.com
-
- * Fix support for linux-2.4. This is only tested with 2.4.17,
- older version will probably not work.
+ * nnpfs/winnt/src/nnpfs_message.c (nnpfs_message_gc_node): set
+ STALE and call vgone() for unused nodes
- xfs_inodeops.c: 1.165->1.166
- xfs_message.c: 1.99->1.102
- xfs_node.c: 1.56->1.58
- xfs_vfsops.c: 1.75->1.77
- xfs/xfs_fs.h: 1.23->1.24
- xfs/xfs_locl.h: 1.51->1.52
+ * nnpfs/winnt/src/nnpfs_vops.c (nnpfs_get_dummynode): clear
+ wake_event
+ (nnpfs_readwrite): hold PagingIoResource when paging
-2002-01-31 Love <lha@stacken.kth.se>
+ * nnpfs/winnt/src/nnpfs_fastio.c (nnpfs_fastio_initmap): added
+ (*): updated lock handling, use nnpfs_fastio_initmap
- * configure.in: 1.526->1.527: check for list_del_init
- * cf/linux-func-init-mutex.m4: 1.6->1.7: make test work when
- init_MUTEX is a macro (late linux-2.2)
+2003-06-12 Love <lha@stacken.kth.se>
- * configure.in: 1.474->1.475: (linux): test for struct
- dcache_operations.d_delete returning void
+ * appl/lib/arlalib.c: add more v4 glue
- * cf/linux-d_delete-void.m4: 1.1: added from current
+ * rxkad/rxkad_locl.h: protect v4 stuff with #ifdef HAVE_KRB4
-2002-01-30 Love <lha@stacken.kth.se>
-
- * xfs/linux/xfs_dev.c: part of 1.82->1.83: use init_MUTEX
- * xfs/linux/xfs/xfs_locl.h: add from current, local define of
- init_MUTEX
-
-2002-01-28 Love <lha@stacken.kth.se>
-
- * xfs/include/xfs/xfs_message.h: 1.46->1.47: add symbol
- XFS_XDELETED
-
-2002-01-25 Magnus Ahltorp <ahltorp@nada.kth.se>
-
- * appl/mac/Arla_Configuration: Build appl/mac/Arla_Configuration
- with normal make
-
- * configure.in: 1.510->1.511: Build appl/mac/Arla_Configuration
- with normal make
-
-2002-01-25 Love <lha@stacken.kth.se>
+ * appl/lib/Makefile.in: add krb5 includes
+
+ * include/stds.h: s/HAVE_KERBEROS/KERBEROS/
+
+ * appl/lib/appl_locl.h: add <krb5.h>
+
+2003-06-11 Love <lha@stacken.kth.se>
- * configure.in: Disable (arlad/fbuf) mmap for darwin for now, we
- get 0 byte long files sometime.
+ * appl/lib/arlalib.c: add krb5 support, untested
-2002-01-22 Love <lha@stacken.kth.se>
+ * rxkad/rxk_serv.c: avoid warning
+
+ * rxkad/rxk_serv.c: make rxkad_NewServerSecurityObject match
+ prototype
- * xfs/bsd/xfs_message.c: 1.52->1.53: handle struct
- mount.mnt_nvnodelist (FreeBSD 4.5 and higher)
+ * appl/lib/arlalib.c: change enable to support krb5, now just fill
+ in the blanks
- * xfs/bsd/xfs_node-bsd.c: 1.59->1.60: handle struct
- mount.mnt_nvnodelist (FreeBSD 4.5 and higher)
+2003-06-10 Love <lha@stacken.kth.se>
- * configure.in (1.523->1.524): (FreeBSD): never set smp flags to
- "no"
- (FreeBSD): test for struct mount.mnt_nvnodelist (the new name for
- mnt_vnodelist in 4.5 and above)
+ * rxkad/Makefile.am: drop rxk_info.c its a server function
+
+ * rx/rx_misc.c: drop osi_{Alloc,Free}, we use macros
+
+ * lib/ko/koerror.c: wrap krb4 stuff with HAVE_KRB4
- * configure.in: unbreak the --enable-smp for both linux and
- freebsd, for freebsd is plainly didn't work, and for linux it
- didn't autoprobe
+ * lib/ko/kocell.c: wrap krb4 stuff with krb4
-2001-12-20 Love <lha@stacken.kth.se>
+ * configure.in: add AC_FUNC_KAFS_SETTOKEN_RXKAD
+
+ * lib/ko/auth.c: wrap krb4 stuff with krb4, use kafs_settoken_rxkad
+
+ * include/netbsd-lkm/Makefile: include <bsd.own.mk>
+
+ * include/stds.h: more kerberos4 defines
+
+ * appl/lib/arlalib.c: wrap krb4 stuff in HAVE_KRB4
+
+ * appl/lib/appl_locl.h: wrap krb4 stuff in HAVE_KRB4
+
+ * rxkad/Makefile.am: drop rxkad server end (to be build later as
+ rxkad_server)
- * tests/hardlink3: 1.2->1.3: hardlink3 is not fast
+ * configure.in: make include k5 stuff in rxkad lib
- * xfs/bsd/xfs_vfsops-netbsd.c: create a xfs_reinit
- * configure.in: 1.507->1.508: check for vfs_reinit
+ * arlad/arla_local.h: wrap krb4 stuff in HAVE_KRB4
- * configure.in: 1.521->1.522: (netbsd,openbsd): make sure we pass
- in -I$SYS to incl
- (KERNEL_CPPFLAGS) since the <bsd.lkm.mk> might not set it.
+ * arlad/arla.c: wrap krb4 stuff in HAVE_KRB4
+
+ * arlad/Makefile.in: use krb5 cflags too
+
+ * arlad/cred.h: use MAXKRB4TICKETLEN
+
+ * rxkad/rxkad.h: provide MAXKRB4TICKETLEN
+
+ * appl/perf/afsfsperf.c: wrap <krb.h> with HAVE_KRB4
+
+ * lib/ko/auth.h: put ifdef HAVE_KRB4 around <krb.h>
+
+ * arlad/{arla-cli.c,conn.c,cred.c,cred.h,messages.c}:
+ remove depency on CREDENTIALS (and thus krb4) for rxkad
-2001-12-20 Mattias Amnefelt <mattiasa@e.kth.se>
+2003-06-04 Hans Insulander <hin@stacken.kth.se>
- * arlad/fcache.c (try_next_fs): return true for RXKADUNKNOWNKEY
+ * appl/vos/vos_listvldb.c: Remove \n from warnx()
+ * appl/vos/vos.c: Missing \n on printout added
+ * appl/afsutils/aklog.1: Spellfix
+ * appl/afsutils/klog.c: Spellfix
-2001-11-24 Mattias Amnefelt <mattiasa@e.kth.se>
+2003-06-04 Tomas Olsson <tol@stacken.kth.se>
- * rx/rxdebug.c (1.11->1.12) print byte and packetcounters as
- unsigned
+ * appl/afsutils/aklog.1: speling
-2001-11-16 Mattias Amnefelt <mattiasa@e.kth.se>
+2003-06-02 Love <lha@stacken.kth.se>
- * appl/vos/vos_{un,}lock.c send request to syncsite
- * rx/rxdebug.c (1.10->1.11) servers do return statistics
- * appl/vos/vos_listvldb.c (1.12 -> 1.13) handle partitions > 'z'
+ * nnpfs/bsd: s/make_dead_vnode/nnpfs_make_dead_vnode/
-2001-10-24 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * nnpfs/bsd/nnpfs_message.c (nnpfs_message_installdata): use
+ nnpfs_dnlc_purge instead of cache_purge
- * lib/bufdir/fbuf.c: 1.15->1.16: msync doesn't take protection
- flags
+2003-05-21 Love <lha@stacken.kth.se>
- * appl/mac/make-mac-package.sh: Changed to /Library/StartupItems
+ * appl/fs/fs.1: retreived->retrieved, from pjanzen@openbsd via
+ jmc@openbsd
- * lib/bufdir/fbuf.c: 1.14->1.15: Added msync before munmap where
- necessary
+2003-05-06 Love <lha@stacken.kth.se>
- * lib/ko/Makefile.in: 1.35->1.36: Added LDFLAGS
+ * appl/fs/fs_la.c (afs_getacl): a couple of off-by-one string
+ bounds in sscanf, from Anil Madhavapeddy <avsm@cvs.openbsd.org>
+ via openbsd.
- * appl/vos/Makefile.in: 1.17->1.18: Added LDFLAGS
+2003-04-25 Love <lha@stacken.kth.se>
- * appl/udebug/Makefile.in: 1.14->1.15: Added LDFLAGS
+ * appl/afsutils/unlog.1: remove unused .Ed fixe typos
+ from jmc <jmc@prioris.mini.pw.edu.pl>
+
+ * appl/afsutils/tokens.1: fixed bad .Fl usage, remove unused .El
+ from jmc <jmc@prioris.mini.pw.edu.pl>
+
+2003-04-24 Love <lha@stacken.kth.se>
- * appl/fs/Makefile.in: 1.16->1.17: Added LDFLAGS
+ * appl/lib/arlalib.h: s/managment/management/, from jmc
+ <jmc@prioris.mini.pw.edu.pl>
+ * doc/storage.texi: s/managment/management/, from jmc
+ <jmc@prioris.mini.pw.edu.pl>
- * appl/pts/Makefile.in: 1.14->1.15: Added LDFLAGS
+2003-04-16 Love <lha@stacken.kth.se>
- * appl/bos/Makefile.in: 1.15->1.16: Added LDFLAGS
+ * ydr/output.c (cppfilesymbolname): new function, Convert filename
+ into a cpp symbol
+ (init_generate): use cppfilesymbolname
+ (close_generator): ditto
- * appl/afsutils/Makefile.in: 1.19->1.20: Added LDFLAGS
+2003-04-13 Love <lha@stacken.kth.se>
- * appl/Makefile.in: Only build kalog when we have tf_util
+ * appl/pts/pts.c (pr_name2id): don't free memory on error
+
+2003-04-10 Love <lha@stacken.kth.se>
- * cf/check-kerberos.m4: 1.39->1.40: Added support for Mac OS X
- built-in kerberos and kth-krb with openssl
+ * arlad/messages.c (try_again): treat RXKADBADTICKET, RXKADBADKEY
+ as key expired
- * configure.in: 1.520->1.521: Don't use libroken in tf_util test.
+ * arlad/volcache.c (get_info_loop): treat RXKADBADTICKET,
+ RXKADBADKEY as key expired
-2001-10-22 Love <lha@stacken.kth.se>
+2003-04-09 Love <lha@stacken.kth.se>
- * configure.in: freebsd[45]): when build with --enable-smp tag on
- APIC_IO since its needed (true for alpha too ?)
+ * lib/ko/gensysname.c: s/strcpy/strlcpy/
+ * tests/large-dir.c: s/strcpy/strlcpy/
+ * rxkad/rxk_crpt.c: s/strcpy/strlcpy/
+ * rx/rx_dumptrace.c: s/strcpy/strlcpy/
-2001-10-22 Magnus Ahltorp <ahltorp@nada.kth.se>
-
- * configure.in: 1.517->1.519: Added -flat_namespace on Mac OS X.
- Only compile kalog if there is a tf_init.
-
-2001-10-19 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * rx/rx_pkt.c: make osi_Msg sane
+ * rx/rx.c: make osi_Msg sane
+ * rx/rx_user.c: make osi_Msg sane add rx_vMsg
+ * rx/rx_user.h: make osi_Msg sane
+
+2003-04-08 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs_message.c: 1.70->1.72: (xfs_message_invalidnode):
- Don't treat node as used if only UBC uses it.
+ * arlad/arla_local.h: include <uae.h>
+
+ * arlad/arla.c: init uae
+
+ * rx/rxperf.c: replace sprint with snprintf
+
+ * appl/fs/fs_copyacl.c: replace sprint with snprintf
+
+ * appl/vos/vos_backup.c: replace sprint with asprintf
+
+2003-04-08 Mattias Amnefelt <mattiasa@e.kth.se>
- * xfs/bsd/xfs_vnodeops-common.c: 1.77->1.78:
- (xfs_inactive_common): Clear dirty flag when fsync fails
- 1.78->1.79: (xfs_read_common): Do not print out random memory
- 1.79->1.80: (xfs_open_valid): Call xfs_handle_stale 1.79->1.80:
- Added xfs_handle_stale
+ * arlad/conn.c (re_probe): only increase ntries until threshold
+ value. more readable logic for problelist removal
+ (pinger): always schedule re_probe
- * xfs/bsd/xfs/xfs_locl.h: 1.50->1.51: xfs_set_vp_size is called
- ubc_setsize on Darwin
+ * arlad/arla_local.h: added argument f to assert_not_flag
+ * arlad/conn.c (init_fs_context): Set rtt to half of its previous
+ value if fileserver unreachable
- * arlad/messages.c (xfs_message_getroot): Correct typo
+2003-04-08 Love <lha@stacken.kth.se>
-2001-10-16 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * arlad/arla_local.h: include <uae.h>
+
+ * arlad/arla.c: init uae
+
+ * rx/rxperf.c: replace sprint with snprintf
+
+ * appl/fs/fs_copyacl.c: replace sprint with snprintf
+
+ * appl/vos/vos_backup.c: replace sprint with asprintf
+
+2003-04-08 Mattias Amnefelt <mattiasa@e.kth.se>
- * arlad/messages.c: 1.263->1.264: (xfs_message_getroot): Set
- tokens in installroot message
+ * arlad/fcache.c (unlink_lru_entry): assert_not_flag() on kernelp
-2001-10-14 Love <lha@stacken.kth.se>
+2003-04-03 Love <lha@stacken.kth.se>
- * conf/CellServDB: mc.vanderbilt.edu removed, from David Krause
- <david.w.krause@vanderbilt.edu> on arla-drinkers
+ * include/afssysdefs.h: freebsd 4 uses 210 freebsd 5 uses 339
-2001-10-11 Magnus Ahltorp <ahltorp@fridge.nada.kth.se>
+ * configure.in: no longer change for chflags and lchflags, it was
+ themis that needed it
- * Release 0.35.6
+2003-04-01 Love <lha@stacken.kth.se>
-2001-10-09 Love <lha@stacken.kth.se>
+ * appl/afsutils/Makefile.in: avoid building klog when that we are
+ not install it
- * arlad/fcache.c: (get_attr_bulk): avoid updating entries that are
- locked, fixes tests/hardlink3
+ * rx/rxdebug.1: spelling, from jmc <jmc@prioris.mini.pw.edu.pl>
- * tests/hardlink3: added test that trigged bulkstatus bug
+ * appl/kalog/kalog.1: spelling, from jmc
+ <jmc@prioris.mini.pw.edu.pl>
-2001-10-08 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * appl/bos/bos.8: spelling, from jmc
+ <jmc@prioris.mini.pw.edu.pl>
- * INSTALL: Updated
- * README: Updated
+ * arlad/{DynRootDB,arla.conf,ThisCell}.5arla-cli.8: spelling, from
+ jmc <jmc@prioris.mini.pw.edu.pl>
-2001-10-04 Assar Westerlund <assar@sics.se>
+ * nnpfs/bsd/nnpfs_dev-bsd.c (nnpfs_dev): handle newer freebsd,
+ from Mattias Amnefelt <mattiasa@e.kth.se>
- * appl/lib/ka-procs.c (ka_authenticate): handle k_afsklog
- * appl/afsutils/klog.c (get_afs_token), appl/afsutils/aklog.c
- (krb_afslog_uid): k_afslog -> k_afsklog_uid
- (which always was the old name)
+ * configure.in: check for d_psize and d_kqfilter
+
+2003-03-17 Love <lha@stacken.kth.se>
-2001-10-02 Love <lha@stacken.kth.se>
+ * lib/ko/koerror.c: s/Invaild/Invalid/
+
+2003-03-13 Love <lha@stacken.kth.se>
- * cf/check-kerberos.m4: replace -lroken with $LIB_roken
+ * util/log.c: log in LOG_NOTICE since LOG_INFO might get lost
-2001-10-01 Mattias Amnefelt <mattiasa@e.kth.se>
+2003-03-10 Love <lha@stacken.kth.se>
- * arlad/fcache.c (1.349->1.350) (get_root_of_volume): always try
- to get the best credential
+ * appl/afstool/at_fs_flush_cps.c: fix usage usage info
+
+ * lib/ko/uae.h: remove dup
+
+ * nnpfs/linux/nnpfs_load.c (init_module): do devfs_register_chrdev
+ also when using a chardev, pointed out by Per Olofsson.
-2001-09-30 Magnus Ahltorp <ahltorp@nada.kth.se>
+2003-03-09 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs/xfs_dev.h: Support three argument selrecord
+ * configure.in: pull in arla_OPENSSL_COMPAT, add the -I to
+ netbsd-lkm dir after the system KERNEL_CPPFLAGS
+
+2003-03-08 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs_dev-bsd.c: Support three argument selrecord
+ * appl/vos/vos_status.c: fix bad lp64 broken typecasts, make
+ strftime buffer 128bytes
+ * lib/ko/kocell.c: make strftime buffer 128 bytes
+ * appl/afstool/at_fs_gettime.c: make strftime buffer 128 bytes
+ * appl/afstool/at_u_debug.c: make strftime buffer 128 bytes
+
+ * appl/vos/vos_examine.c: make strftime buffer 128 bytes
+ * appl/vos/vos_status.c (printstatus): fix formating
+
+2003-03-07 Love <lha@stacken.kth.se>
-2001-09-28 Mattias Amnefelt <mattiasa@e.kth.se>
+ * lib/ko/uae.c: add all missing errorcodes
+
+ * lib/ko/uae.h: add UAE_ERROR_base remove dup
+
+ * lib/ko/uae.h: add more error codes from derrick
+
+2003-03-06 Love <lha@stacken.kth.se>
- * arlad/conn.h: increase fuzz by a factor of 1000
+ * rxdef/common.h: add Capabilities
+
+ * HACKING: automake appl/udebug/Makefile
+
+ * include/Makefile.in: add uae.h
+
+ * appl/afstool/at_fs_getcap.c: print string name of caps
+
+ * appl/afstool: add support for RXAFS_GetCapabilities
-2001-09-26 Mattias Amnefelt <mattiasa@e.kth.se>
+ * rxdef/fs.xg: add GetCapabilities
+
+ * appl/udebug: replace udebug with a shellscript that call afstool
- * appl/vos/vos_listpart.c: null terminate agetarg list
+ * NEWS: UAE
+
+ * arlad/fs_errors.h: do uae translation
+
+ * arlad/cmcb.c (SRXAFSCB_TellMeAboutYourself): tell server we
+ support UAE
-2001-09-24 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * lib/ko/uae.c: comment how this should work
+
+ * appl/perf/Makefile.in: adapt for uae
+
+ * appl/afstool/Makefile.am: adapt for uae
+
+ * lib/ko: Add infrastructure for 'Unified AFS errnos' (uae)
- * configure.in: Removed building of mac applications
+2003-03-05 Love <lha@stacken.kth.se>
-2001-09-23 Assar Westerlund <assar@sics.se>
+ * appl/afstool: use getarg style --no-auth like the rest for the
+ arguments, fix auth
+
+ * appl/afstool: add ubik debug
- * arlad/messages.c (1.261->1.262): (try_again): do not invalidate
- the volcache entry on VNOVOL, it's done in fcache.c:try_next_fs
- now
- * arlad/fcache.c (merge 1.347->1.348): (try_next_fs): send in fid
- too. and mark volcache entry as invalid on VNOVOL and VMOVED.
- this way we actually mark volcache entries as invalid and refresh
- them even when there are other r/o clones that work
+ * appl/afstool/afstool.1: fs gettime
+
+ * appl/afstool/at_locl.h: add mini_cachemanager_init and
+ fs_gettime_cmd
-2001-09-21 Mattias Amnefelt <mattiasa@e.kth.se>
+ * appl/afstool/Makefile.am: add mini cm, gettime and link with
+ librxcbserver
- * rx/rxdebug.c (GetVersion) Check return codes
+ * appl/afstool/at_fileserver.c: plug in gettime
+
+ * appl/afstool/at_fs_gettime.c: fetch time from fileserver
+
+ * appl/afstool/at_mini_cm.c: add yet another mini cache-manager
+
+ * rx/rx_user.h (rxi_GetUDPSocket): return the portnumber we bound to
+ * rx/rx_user.c (rxi_GetUDPSocket): return the portnumber we bound to
-2001-09-19 Mattias Amnefelt <mattiasa@e.kth.se>
+ * rx/rx.c: find out the portnumber we bound too
+
+ * appl/afstool/afstool.c (main) call rx_Init(0)
+
+ * arlad/cmcb.c: prefix callback manager stubs with S
+
+ * ydr/output.c (generate_server_stub): prefix server stubs with S
+
+ * ydr/output.c: move the server parsing stubs into private
+ namespace and make them static
- * appl/vos/vos_examine.c: Print info from vldb even if we can't
- reach fileserver
- * appl/vos/vos_examine.c: (printvolstat) only print volumeid when
- clone exists
+ * appl/afstool/at_fs_flush_cps.c: remove stale comment
-2001-09-18 Mattias Amnefelt <mattiasa@e.kth.se>
+ * appl/afstool/at_cm_{localcell,whoareyou}.c: make use of for loop
+ to make it look like other code in same directory
- * appl/vos/vos_examine.c: use VLSF_DONTUSE information
- * appl/vos/vos.c: added vos backup and vos backupsys
- * appl/vos/vos_common.c (get_vlentry): try to find
- dbserver if it's not given
+ * appl/afstool/afstool.c: add aliases for fileserver (fs) and
+ cachemanager (cm)
-2001-09-17 Mattias Amnefelt <mattiasa@e.kth.se>
+ * appl/perf/afsfsperf.c: add dummy for GetCellByNum and
+ TellMeAboutYourself
- * rxdef/vldb.xg: use nvldbentry in ReleaseEntryN
- * appl/vos/vos_listvol.c: argument partition is aarg_optional_swless
- * appl/vos/vos_local.h: added backup, backupsys and volname
- * appl/vos/vos_backup.c: added
- * appl/vos/Makefile.in: added vos_backup.c
- * appl/vos/vos_listvldb.c: correct termination of listvldb
- * appl/vos/vos_listvldb.c: (listvldb_iter): use VL_ListAttributes
- interface, and allow to mask on
- * appl/vos/vos_listvldb.c: serverna me and partition take volume
- as argument, print volumeids
- * appl/vos/vos_backup.c (vos_backupsys): send volumename to
- vos_listvldb_iter
+ * arlad/cmcb.c: add dummy for GetCellByNum and implement
+ TellMeAboutYourself
+
+ * rxdef/cb.xg: add GetCellByNum and TellMeAboutYourself
+
+ * appl/afstool/Makefile.am: install manpage
+
+ * appl/afstool/at_cm_localcell.c: getarg-ify, make more sane
+ * appl/afstool/at_cm_whoareyou.c: getarg-ify, make more sane
+ * appl/afstool/afstool.1: getarg-ify, make more sane
-2001-09-17 Love <lha@stacken.kth.se>
+ * appl/afstool/afstool.1: mdoc fixes
+
+2003-03-04 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs_node-bsd.c (free_all_xfs_nodes): if we have a
- vfs_deallocate_syncvnode, use that to free the syncer-node, indent
- * configure.in: check for vfs_deallocate_syncvnode
+ * arlad/poller.c (poller_foreach): new function
+
+ * appl/afstool/afstool.1: manpage for afstool
-2001-09-15 Mattias Amnefelt <mattiasa@e.kth.se>
+ * configure.in: remove cbdebug
+
+ * appl/afstool: fold in cbdebug
- * lib/ko/gensysname.c: find better sysname for alpha osf
- * appl/fs/fs.c (fsversion_cmd): test for correct number of
- arguments
- * rx/rxdebug.c: Use agetarg instead of libcmd
- * rx/Makefile.in: link rxdebug with libko
- * Makefile.in: build rx after libko
+ * appl/cbdebug: remove cbdebug, move to afstool
+
+ * appl/afstool/at_locl.h: add some more headers
+
+ * appl/perf/Makefile.in: link agaist the new cb lib
+
+ * arlad/Makefile.in: link agaist the new cb lib
+
+ * rxdef/Makefile.in: split callback stubs to their own libs
+
+ * configure.in (AC_OUTPUT): add appl/afstool/Makefile
-2001-09-14 Love <lha@stacken.kth.se>
+ * HACKING: add appl/afstool/Makefile
+
+ * appl/afstool: afstool
- * arlad/messages.c: 1.257->1.258: (try_again): when fileserver
- busy or restarting, wait afs_BusyWaitPeriod seconds, this is the
- same timeout as transarc/openafs has.
- * arlad/arla.c: 1.137->1.138: set afs_BusyWaitPeriod to 15 (as
- transarc/openafs does)
- * arlad/arla_local.h: 1.66->1.67: export afs_BusyWaitPeriod
+ * arlad/fcache.c: improve logging when giving back callbacks
- * arlad/messages.c: 1.256->1.257: (vioc_new_cell): memset dbs,
- make sure we a static entry
- (timeout == 0)
+ * appl/fs/fs_connect.c: add callback-connected, connect and
+ refetch callback we had before
-2001-09-09 Mattias Amnefelt <mattiasa@e.kth.se>
+ * arlad/poller.c: add poller_foreach and poller_iter_func
+
+ * arlad/poller.h: add poller_foreach and poller_iter_func
+
+ * arlad/fcache.c (fcache_giveup_all_callbacks): first try poller +
+ giveup_all_callbacks
+ (giveup_all_callbacks): give up all callback with new rpc function
+ RXAFS_GiveUpAllCallBacks.
+ (throw_entry): conn can never be NULL, check for aliveness instead
+ (fcache_reobtain_callbacks): conn can never be NULL
- * rx/rxdebug.c (MakeCall): check return codes
+ * rxdef/fs.xg: add GiveUpAllCallBacks, and FlushCPS add commented
+ out versions of 64 bit fetch/store data
+
+2003-03-03 Love <lha@stacken.kth.se>
-2001-09-07 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * arlad/messages.c (nnpfs_message_getdata): make comptible with
+ open and set the DATA_W if requested.
+
+2003-02-28 Tomas Olsson <tol@stacken.kth.se>
- * config.guess, config.sub: update to newer versions
+ * nnpfs/linux/nnpfs_inodeops.c (nnpfs_file_mmap): don't iref
-2001-09-07 Love <lha@stacken.kth.se>
+2003-02-28 Love <lha@stacken.kth.se>
- * conf/CellServDB: 1.58->1.59: added dynarc.se
+ * tests/run-tests.in: add mmap-and-fork
+
+ * tests/mmap-and-fork.c: mmap and fork test
-2001-09-06 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * nnpfs/bsd/nnpfs_node-bsd.c (nnpfs_dnlc_enter): use
+ nnpfs_vfs_unlock instead of VOP_UNLOCK
- * xfs/solaris/xfs_node.c: 1.16->1.17: (new_xfs_node): Set tokens
- from message
+2003-02-26 Love <lha@stacken.kth.se>
-2001-09-05 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * nnpfs/bsd/nnpfs_node-bsd.c: OpenBSD 3.3 will have NetBSD 1.5
+ dnlc semantics
- * xfs/linux/xfs_node.c: 1.54->1.55: (new_xfs_node): Set tokens
- from message
- * xfs/bsd/xfs_node-bsd.c: 1.55->1.56: (new_xfs_node): Set tokens
- from message
+2003-02-24 Tomas Olsson <tol@stacken.kth.se>
-2001-09-04 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * nnpfs/linux/nnpfs_message.c (clear_all_children): don't throw
+ negative dentries, and it's the children we drop
- * configure.in: Added selrecord test
- * cf/bsd-func-selrecord.m4: Added selrecord test
+2003-02-24 Mattias Amnefelt <mattiasa@e.kth.se>
-2001-09-04 Love <lha@stacken.kth.se>
+ * nnpfs/linux/nnpfs_inodeops.c: nnpfs_d_revalidate: always return
+ true if root node
- * arlad/fcache.c: 1.342->1.343: (find_first_fs): don't use entries
- maked by the vldb server as VLSF_DONTUSE, there are volumes marked
- up my the vldb server as non released volumes.
-
-2001-09-04 Magnus Ahltorp <ahltorp@nada.kth.se>
+2003-02-22 Love <lha@stacken.kth.se>
- * arlad/conn.c: 1.64->1.65: (re_probe): If sleeping already,
- choose the earliest wakeup
+ * Add support for netbsd 1.6O
-2001-09-03 Love <lha@stacken.kth.se>
+ * configure.in: fix openbsd makefile probing
+
+2003-02-21 Tomas Olsson <tol@stacken.kth.se>
- * xfs/bsd/xfs_node-bsd.c: 1.54->1.55:
- (free_all_xfs_nodes/xfs_vflush): do magic with syncer-node on
- freebsd, this is since FreeBSD > 4.3 changed vflush api so we have
- to remove the mnt_syncer node first before calling vflush to avoid
- dying in a deadlock. break out vflush to a common function
- xfs_vflush().
+ * nnpfs/linux/nnpfs_message.c (clear_all_children): drop negative
+ dentries
-2001-08-31 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * arlad/messages.c (*): send messages to kernel before
+ fcache_release()
- * util/hash.c: 1.14->1.15: Added hashtabrelease
+2003-02-18 Tomas Olsson <tol@stacken.kth.se>
- * util/hash.c: 1.15->1.16: (hashtabcleantab): Free the correct
- pointer
-
- * util/hash.h: 1.6->1.7: Added hashtabrelease
+ * nnpfs/linux/nnpfs_message.c (nnpfs_d_remove): added
+ (nnpfs_message_installnode): handle new inode != existing better
+ (clear_all_children): use dcache_lock, don't use xdentry if null,
+ use nnpfs_d_remove()
+ (d_prune_aliases): use nnpfs_d_remove()
-2001-08-01 Love <lha@stacken.kth.se>
+2003-02-17 Love <lha@stacken.kth.se>
- * xfs/linux/xfs_syscalls.c: fix merge error
-
-2001-07-26 Love <lha@stacken.kth.se>
+ * configure.in: decrease world pain by setting AM_MAINTAINER_MODE,
+ now Makefile.in isn't rebuilt when Makefile.am have a newer
+ timestamp
- * appl/pts/pts.1: 1.1->1.2: remove .Pp before .Sh, from openbsd
-
- * xfs/bsd/xfs_vnodeops-bsd.c: 1.94->1.95, 1.96->1.97:
- (xfs_symlink): NetBSD 1.5X/OpenBSD current
- (aka version 200107) and above doesn't vput the created symlink
+2003-02-16 Tomas Olsson <tol@stacken.kth.se>
- * xfs/linux/xfs_syscalls.c: 1.66->1.67: (fhget_call): make
- `dentry' const and never dput it
- (user_path2dentry): define it differently for 2.3
- (sys_afs_int): move dput to the end of the function and call
- path_release in 2.3 1.65->1.66: (xfs_debug_print): call
- print_dentry
+ * nnpfs/linux/nnpfs_message.c: make it compile
-2001-07-26 Assar Westerlund <assar@stacken.kth.se>
+2003-02-16 Love <lha@stacken.kth.se>
- * xfs/linux/xfs_dev.c:1.80->1.81: (xfs_devwrite): do not set dumpable
- * arlad/arlad.c (arla_start): 1.9->1.10: set dumpable
- with prctl if possible
- * arlad/arla_local.h: 1.63->1.64: add sys/prctl.h
- * configure.in: 1.496->1.497: check for sys/prctl.h
+ * nnpfs/linux/nnpfs_message.c (clear_all_children): throw way
+ unused nodes more aggressively (that is, remove then, don't just
+ unhash them)
-2001-07-25 Magnus Ahltorp <ahltorp@nada.kth.se>
+2003-02-15 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs_vnodeops-bsd.c:1.95->1.96: (xfs_remove): call
- ubc_uncache after vput:ing (on osx/darwin)
+ * nnpfs/linux/nnpfs/nnpfs_locl.h: define I_DIRTY_DATASYNC to 0 if
+ it isn't there
-2001-07-16 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs_vnodeops-bsd.c: even more extensive casting to
+ print lk_lockholder
- * Release 0.35.5
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: include <sys/inttypes.h> try to
+ define nnpfs_uintptr_t
+
+ * configure.in: check for uintptr_t
+
+ * appl/lib/ka-procs.c: remove som more memsets
+
+ * tests/run-tests.in (ARLA_TESTS): add kill-mh
+
+ * tests/kill-mh: unpacking and removing the "right" files in the
+ test tar-ball that will trigger a bug in the directory removing
+ code if it doesn't that care and consider directory page
+ (DIRBLKSIZ) bounderies correctly, bug report and tarfile came from
+ Nickolai Zeldovich <kolya@MIT.EDU>
-2001-07-16 Love <lha@stacken.kth.se>
+ * arlad/bsd-subr.c (dir_remove_name): make sure the d_reclen is
+ too large so it will cross a page boundary, found by
+ kolya@mit.edu.
- * xfs/bsd/xfs_vnodeops-osf.c: 1.29->1.30: make *common functions
- not handle any vrele/vput. add the correct vrele's to the osf
- functions
- * xfs/bsd/xfs_vnodeops-common.c: 1.74->1.75: make *common
- functions not handle any vrele/vput
- * xfs/bsd/xfs_vnodeops-bsd.c: 1.93->1.94: make *common functions
- not handle any vrele/vput
+2003-02-14 Love <lha@stacken.kth.se>
-2001-07-15 Love <lha@stacken.kth.se>
+ * appl/lib/ka-procs.c: make compile with new openssl >= 0.9.7,
+ ignore type of key schedule
- * arlad/fcache.c: 1.337->1.338: (get_attr_bulk): make comparison
- simpler to understand
+ * nnpfs/bsd/nnpfs_vnodeops-bsd.c: freebsd current make
+ lk_lockholder to the thread (or so my spies say), so just cast to
+ long long and print with %llx
- * arlad/fcache.c: 1.337->1.337: (get_attr_bulk): when getting the
- fid to install the addr, use a fid will some !random value in it
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: malloc(9) waits by default,
+ freebsd post 5.0 choose to remove the flag, provide glue
+
+ * */*: add copyright notice
-2001-07-14 Love <lha@stacken.kth.se>
+2003-02-14 Tomas Olsson <tol@stacken.kth.se>
- * lib/cmd/Makefile.in: 1.5->1.6: link testc with @LIBS@
- * configure.in: 1.494->1.495: check for get_progname set_progname
- warnerr
+ * tests/asu.c (is_pag): getgroups() might not include egid in
+ groups list
-2001-07-11 Mattias Amnefelt <mattiasa@e.kth.se>
+ * tests/build-emacs-j: bsd make wants an arg after -j, use 4
- * xfs/bsd/bin/startarla.in: added support for dux
- * xfs/bsd/bin/Makefile.in: build startarla on dux
+ * nnpfs/linux/Makefile.in: don't build getcwd on ia64
-2001-07-09 Love <lha@stacken.kth.se>
+ * configure.in: added AM_CONDITIONAL for LINUX_IA64
- * lib/ko/kocell.c: 1.49->1.50: (host_sort): don't use E->name,
- since it might be NULL in case we did a ``fs newcell'', noted by
- Nickolai Zeldovich <kolya@mit.edu>
+2003-02-13 Fallsjo <fallsjo@stacken.kth.se>
-2001-07-06 Love <lha@stacken.kth.se>
+ * .cvsignore: Honor new name of autom4te cache
+
+2003-02-12 Love <lha@stacken.kth.se>
+
+ * arlad/arlad.8: rxkad-level, default is crypt
+ * arlad/arla.c (rxkad_level_string): default to crypt
+
+2003-02-11 Love <lha@stacken.kth.se>
- * appl/lib/arlalib.c: 1.41->1.42: (arlalib_try_next_db): Use
- ARLA_CALL_DEAD instead of RX_CALL_DEAD
+ * nnpfs/linux/nnpfs_vfsops.c (nnpfs_statfs): bump values some to
+ make it more pretty from Harald Barth <haba@pdc.kth.se>
- * appl/pts/pts.c: 1.52->1.53: membership: Move error handling to
- outside of the server trying loop. Handle non-existing users and
- groups.
-2001-07-06 Mattias Amnefelt <mattiasa@e.kth.se>
+ * arlad/cred.c (cred_add): use cred_delete instead of
+ recycle_entry, so when the entry is still in use we don't stomp
+ all over it
+
+ also, sprinkel asserts all over the place to make sure we don't
+ use root node or reuse nodes that still have refcount
- * conf/CellServDB changed vldb for it.kth.se according to
- <elu@it.kth.se>
+2003-02-11 Tomas Olsson <tol@stacken.kth.se>
-2001-07-06 Love <lha@stacken.kth.se>
+ * arlad/messages.c (nnpfs_message_getdata): set datausedp in entry
- * rx/rx_pkt.c: 1.15->1.16: (rxi_SendDebugPacket): truncate the iov
- to the size of the outgoing packet
-
-2001-06-27 Mattias Amnefelt <mattiasa@e.kth.se>
+ * appl/perf/Makefile.in: move up arlautil before roken in LIBS
- * xfs/bsd/xfs_node-osf.c: (free_all_xfs_nodes) 1.23 -> 1.24 :
- vflush the mountpoint after relasing the root vnode
+2003-02-10 Love <lha@stacken.kth.se>
-2001-06-11 Love <lha@stacken.kth.se>
+ * lib/ko/afs_uuid.c: when we use a randomized uuid, set the
+ multicast bit to make sure we don't collied witha a real
+ (allocated) address.
- * arlad/DynRootDB.5: clarify what happens if .Nm doesn't exist
-
-2001-06-06 Assar Westerlund <assar@sics.se>
+2003-02-10 Tomas Olsson <tol@stacken.kth.se>
- * xfs/solaris/bin: move startarla, mount_xfs from bin to sbin
+ * nnpfs/linux/nnpfs_syscalls.c: declare sys_call_table as its
+ actual type
-2001-06-06 Magnus Ahltorp <ahltorp@fridge.nada.kth.se>
+ * nnpfs/linux/nnpfs_syscalls-lossage.c: don't check for
+ sys_call_table
- * Release 0.35.4
+ * nnpfs/linux/nnpfs/nnpfs_syscalls.h: check for sys_call_table
-2001-06-05 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * appl/perf/Makefile.in: move up LIB_roken in LIBS
- * arlad/{inter.c,messages.c}: Disable attrusedp asserts
+ * lib/Makefile.am: build editline before sl
- * arlad/{adir.c,adir.h,inter.c,messages.c}: Renamed from
- adir_lookup_fcacheentry to adir_lookup. Removed old adir_lookup.
- Use new adir_lookup instead.
+2003-02-08 Love <lha@stacken.kth.se>
- * arlad/{discon_log.c,reconnect.c}: Disable nonworking functions.
+ * tests/run-tests.in: add read-past-eof
-2001-06-04 Mattias Amnefelt <mattiasa@e.kth.se>
-
- * xfs/bsd/xfs_vfsops-osf.c: test for vfs_swapvp and vfs_smoothsync
- * xfs/bsd/xfs_syscalls_common.c: don't use fhlookup on dux
- * configure.in: test for vfs_swapvp and vfs_smoothsync in struct
- vfsops (for dux)
+ * tests/Makefile.in: add read-past-eof
+
+ * tests/read-past-eof.c: test for read past end of file
+
+ * nnpfs/bsd/nnpfs_vnodeops-netbsd.c (nnpfs_netbsd_read): don't
+ premit reading past end of file (found with mozilla)
-2001-05-29 Mattias Amnefelt <mattiasa@e.kth.se>
+2003-02-07 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs_{vnodeops,node}-osf.c: general update of the osf/1
- code. Doesn't crash immidiately
- * lib/sl/lex.l,ydr/lex.l: build with lex on dux 4.0d
- * arlad/Makefile.in: use correct syntax
- * cf/osf-func-vfs-name-hash.m4: function to find out more about
- vfs_name_hash()
- * cf/try-compile-kernel.m4: use KERNEL_CC if it is defined
- * configure.in: find out more about vfs_name_hash on osf/1
- * appl/{afsutils,amon,asrvutil,bos,fs,kalog,pts,udebug,vos}/Makefile.in
- lib/ko/Makefile.in: build working makefile even if @LIBS@ is empty
+ * arlad/messages.c: replace assert_kernelp with assert_flag
+
+ * arlad/fcache.c: replace assert_kernelp with assert_flag
+
+ * arlad/arla_local.h: replace assert_kernelp with assert_flag
+
+ * nnpfs/linux/nnpfs_syscalls.c: use [] for now on sys_call_table
+
+2003-02-04 Love <lha@stacken.kth.se>
-2001-05-28 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * configure.in (netbsd,openbsd): we really want -f flags too when
+ building lkms
- * arlad/{dynroot.c,dynroot.h,fcache.c}: Make dynroot add
- CallerAccess to creds
+ * lib/bufdir/fdir.c: trust length of directory file more then the
+ data in the top of the file, this is slightly broken because what
+ really happen was that we just removed a entry, and then shrinked
+ the file because it was the last entry (and thus decremented the
+ page-count), refetched the length from the fileserver and then
+ expected the pagecount == size / AFSPAGESIZE
-2001-05-22 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * nnpfs/bsd/nnpfs_wrap-bsd.c (nnpfs_uninstall): detach malloc
+ types when we are all done not completly right, but better then
+ before
- * arlad/fcache.c: Allow setting of highvnodes.
+ * nnpfs/bsd/nnpfs_wrap-bsd.c: move malloc_type_detach from
+ nnpfs_stat to nnpfs_uninstall
-2001-05-17 Magnus Ahltorp <ahltorp@nada.kth.se>
+2003-02-03 Love <lha@stacken.kth.se>
- * configure.in: Arla configuration program for Mac OS X
+ * nnpfs/linux/nnpfs_syscalls.c:
+ s/sys_call_function/nnpfs_sys_call_function/g
- * appl/mac/Makefile.in: Added mac directory
+ * nnpfs/bsd/nnpfs_wrap-bsd.c: attach/detach malloc types when
+ loading module
- * appl/mac/Arla_Configuration/English.lproj/InfoPlist.strings:
- Arla configuration program for Mac OS X
-
- * appl/mac/Arla_Configuration/English.lproj/MainMenu.nib/{classes.nib,
- info.nib, objects.nib}: Arla configuration program for Mac OS X
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: type argument to malloc is
+ malloc_type in netbsd 1.6N
- * appl/mac/Arla_Configuration/Arla_Configuration.pbproj/
- project.pbxproj.in: Arla configuration program for Mac OS X
+2003-02-03 Tomas Olsson <tol@stacken.kth.se>
- * appl/mac/Arla_Configuration/{Controller.h, Controller.m,
- DataSource.h, DataSource.m, Makefile.in, ReadCells.h, ReadCells.m,
- arla.icns, main.m}: Arla configuration program for Mac OS X
+ * nnpfs/linux/nnpfs_syscalls-lossage.c: make it compile, ifdef,
+ define
- * arlad/messages.c (viocgetcacheparms): Return lowbytes and
- lowvnodes.
+ * nnpfs/linux/nnpfs_syscalls.c (install_afs_syscall): call
+ nnpfs_fixup_syscall_lossage()
- * arlad/fcache.[ch]: Added fcache_lowbytes and fcache_lowvnodes.
+ * nnpfs/linux/nnpfs/nnpfs_locl.h: added
+ nnpfs_fixup_syscall_lossage
-2001-05-17 Love <lha@stacken.kth.se>
+ * nnpfs/linux/Makefile.in: build nnpfs_syscalls-lossage.c
- * xfs/bsd/bin/startarla.in: remove symbol file before loading
- kernel module
- * xfs/bsd/bin/startarla.in: use /var/db so the data is kept after
- a crash
+2003-02-02 Love <lha@stacken.kth.se>
-2001-05-07 Love <lha@stacken.kth.se>
+ * nnpfs/linux/nnpfs_node.c (nnpfs_iget): use get_empty_inode for
+ linux22
- * xfs/bsd/xfs/xfs_locl.h: Fixed merge error, va_size_t differ
- between osf/1 other BSDs, this is correct in current
+ * nnpfs/linux/nnpfs_message.c (nnpfs_message_installdata): only
+ whine when there is a real failure to do a fh_to_dentry
- * xfs/bsd/bin/startarla.in: same for platforms (macosx) using
- kmodload
+ * nnpfs/linux/nnpfs_node.c (nnpfs_iget): use new_inode (and
+ unlock_new_inode in case we have I_NEW)
- * xfs/bsd/bin/startarla.in: Store the output file from modload and
- modstat in /var/run so it will be possible to debug the kernel
- core
+2003-02-01 Love <lha@stacken.kth.se>
-2001-05-07 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * doc/themis.texi: drop themis, live a life of its own now
+
+ * doc/oddities.texi: s/Themis/Arla timeline/
+
+ * doc/timeline.texi: s/Themis/Oddities/
+
+ * doc/arla.texi: drop @include themis.texi
+
+ * appl/lib/tokens.c: don't bail out if cell == NULL, then we want
+ all cells
- * arlad/inter.c (cm_open): assert attrusedp when setting datausedp
+ * rx/Makefile.in: help libtool find libko
+
+ * nnpfs/linux/nnpfs/nnpfs_locl.h: add typedef for
+ nnpfs_sys_call_function
- * arlad/fcache.c (stale): Don't clear attrusedp and datausedp
+ * nnpfs/linux/nnpfs_syscalls-lossage.c: for you to make compile
+ and work and start to use ok'ed to put in copyrighted to KTH by
+ Chaskiel when I asked him
- * arlad/messages.c: Assert or set attrusedp when setting datausedp
- (break_callback): Don't clear kernelp, attrusedp and datausedp
+2003-01-28 Love <lha@stacken.kth.se>
- * cf/linux-filldir-dt-type.m4: try actually calling a filldir_t
- function. just assigning a pointer is not a fatal error
+ * appl/fs/fs_listquota.c: more spaceing, 8 number for printing
+ used space it not enougth
- * arlad{DynRootDB.5,Makefile.in,arlad.8,dynroot.c}, lib/ko/{ko.h,
- kocell.c}: Add support for DynRootDB
+ * tests/write-and-stat: test that detects if dncl is there, or if
+ we just live on tbl (really detects another bug, but this is fine
+ for now)
-2001-04-30 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs_node-bsd.c (nnpfs_cnp_init): if we have a
+ namei_hash, use it
- * arlad/{arla.c,arla_local.h,arlad.c,arladeb.c,arladeb.h,arlad.8}:
- added option --cpu-usage
- * util/log.[ch]: added support for printing cpu usage on each line
- * configure.in: check for getrusage
+ * nnpfs/bsd/nnpfs_vnodeops-netbsd.c: fix printing of b_blkno
+
+2003-01-27 Love <lha@stacken.kth.se>
-2001-04-28 Love <lha@stacken.kth.se>
+ * appl/perf/afsfsperf.c: make the tests table drivern, now you can
+ write afsfsperf ... -tests get-time,bulk-status
- * README: 1.78->1.79: openbsd
+ * tests/check-sysname: remove set -x
-2001-04-28 Mattias Amnefelt <mattiasa@e.kth.se>
-
- * xfs/bsd/xfs_node-osf.c (xfs_dnlc_purge_mp) don't use
- cache_purgevfs() if not available
- * xfs/bsd/xfs_syscalls-wrap-osf.c: use sy_info in struct sysent on
- dux 5.1
- * xfs/bsd/xfs_vfsops-osf.c: added xfs_mountroot, xfs_swapvp,
- xfs_smoothsync from dux vfsops
- * configure.in: test for sys/vfs_proto.h sys/vnode.h and
- function cache_purgevfs()
- * xfs/bsd/xfs_node-osf.c:
- (xfs_dnlc_enter): set ni_makeentry when calling cache_lookup
- (xfs_cnp_init): compute cache correctly
- * xfs/bsd/xfs_vnodeops-osf.c: set name in ndp->cn_nameptr when
- symlinking
- * xfs/bsd/xfs_vnodeops-osf.c: xfs_{mkdir,create}: set
- ndp->cn_nameptr before calling lookup
- * xfs/bsd/xfs_vnodeops-osf.c (xfs_lookup): Need to set pointer to
- the parent directory.
- * xfs/bsd/xfs/xfs_locl.h, xfs/bsd/xfs_vnodeops-common.c: use
- va_size_t instead of u_quad_t
- * xfs/bsd/xfs_vfsops-common.c: Wrap vfs_getnewfsid in autoconf
- ifdef
- * xfs/bsd/xfs_node-osf.c: new function xfs_dnlc_lock, doing dnlc
- locking on osf
- * xfs/bsd/xfs_message.c: there is no vrecycle on osf
- * xfs/bsd/xfs_common.c, xfs/bsd/xfs_common-bsd.c: moved memcpy to
- xfs_common.c
- * configure.in: test for vfs_mountroot in vfsops and sy_info in
- sysent
+ * tests/run-tests.in: ARLA_TESTS: add check-sysname
+
+ * tests/check-sysname: check if sysname seems to work
+
+ * arlad/messages.c (nnpfs_message_getnode): replace #if 0 assert
+ with assert_kernelp()
-2001-04-22 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs_vnodeops-common.c (nnpfs_attr_valid): fix logic,
+ request node from userland when we don't have one of requested
+ token or don't have the pag in the pag cache.
+
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: help SCARG-less freebsd some more
+
+ * appl/perf/afsfsperf.c: add bulkstatus perf testing
+
+ * rxdef/Makefile.in: add depenecy on common.h where needed
+
+2003-01-25 Love <lha@stacken.kth.se>
- * lib/ko/ports.c: 1.10->1.11: (ports_init): make quiet since
- people can't right and add services into their services file (or
- equivalent)
+ * arlad/fcache.c (resolve_mp): use fcache_verify_data instead of
+ fcache_get_data
-2001-04-21 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs_message.c (nnpfs_message_updatefid): use new
+ function nnpfs_update_handle, now that there are a fid hash
+ instead of a list, we can't just update the handle in the
+ nnpfs_node.
- * arlad/cred.c: 1.34->1.36: remove cred from hashtab when its
- killed, update copyright
- * arlad/conn.c: 1.62->1.64: remove conn from hashtab when its
- killed.
+ * nnpfs/bsd/nnpfs_node.c: add nnpfs_update_handle
-2001-04-18 Love <lha@stacken.kth.se>
-
- * conf/CellServDB: 1.50->1.51: mit cells zone.mit.edu and
- ops.mit.edu have moved From Nickolai Zeldovich <kolya@MIT.EDU>
+ * nnpfs/bsd/nnpfs/nnpfs_node.h: add nnpfs_update_handle
- * appl/lib/tokens.c: 1.2->1.3: (arlalib_token_iter): return right
- thing, From Nickolai Zeldovich <kolya@MIT.EDU>
-
- * appl/bos/bos_listusers.c: 1.6->1.7: (printusers): only print
- user when we are are getting back good data, From Nickolai
- Zeldovich <kolya@MIT.EDU>
-
- * arlad/fcache.c: 1.325->1.326: (getacl): fix problem that opaque
- can be uninitialized when returning errors, when caller might do
- stupid things, found by Nickolai Zeldovich <kolya@MIT.EDU>
+ * arlad/messages.c (nnpfs_message_getdata): use entry->fid as fid
+ since it might have changed because of resolved mp's
-2001-04-17 Love <lha@stacken.kth.se>
+2003-01-24 Tomas Olsson <tol@stacken.kth.se>
- * cf: quote argument to undefine, patch by
- Hidvegi <hzoli@austin.ibm.com>
+ * tests/intr-read.c: wait on killed children
-2001-04-12 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * lwp/plwp.c (*): indent, clean up debugging
- * configure.in: Compile with -traditional-cpp on Mac OS X
+2003-01-24 Love <lha@stacken.kth.se>
-2001-04-05 Magnus Ahltorp <ahltorp@nada.kth.se>
+ * tests/intr-read.c: add comment why we kill children, "they smell
+ bad" :)
- * configure.in, cf/check-kernel.m4,
- xfs/bsd/xfs_syscalls-wrap-macos.c: Make it build on Mac OS X
- release
-
-2001-04-04 Love <lha@stacken.kth.se>
-
- * arlad/fcache.c: 1.324->1.325: (find_first_fs): memset context,
- in case we fail to update the volume, context will contains data
- that free_fs_server_context() will grok.
+ * tests/intr-read.c: kill children when parents is done
+
+ * appl/fs/fs_diskfree.c: from dup printf, from Nickolai Zeldovich
-2001-03-25 Love <lha@stacken.kth.se>
+2003-01-23 Tomas Olsson <tol@stacken.kth.se>
- * xfs/linux/xfs_dev.c: 1.78->1.79: (xfs_message_rpc): ignore
- SIGSTOP, this make ptrace() work
+ * lib/bufdir/fbuf.c (mmap_copyrx2fd): adjust mapped length to
+ pagesize
-2001-03-23 Love <lha@stacken.kth.se>
+2003-01-23 Love <lha@stacken.kth.se>
- * arlad/fcache.c (get_attr_bulk): if parent entry is missing data,
- bail out and force regular get_attr
- (getvolstat): remove unused code
+ * lib/bufdir/fbuf.c (mmap_copy{rx2fd,fd2rx}): make these handle
+ off/len that are not a multiple of the pagesize.
+
+2003-01-22 Love <lha@stacken.kth.se>
-2001-03-12 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs_dev-common.c (nnpfs_block_sigset): make the
+ three diffrent cases define a macro that later code can use, this
+ to make it easier to block new signals, and while I'm here, ignore
+ SIGINFO
- * Release 0.35.3
+2003-01-21 Mattias Amnefelt <mattiasa@e.kth.se>
- * util/heap.c (heap_new): don't fail if malloc(0) return NULL.
-
- * lib/ko/kocell.c: 1.47->1.78: handle cells with zero cells on
- computer with malloc returns NULL on malloc(0).
-
- * arlad/kernel.c: 1.27->1.29: handle case when running out of
- threads better
+ * appl/Makefile.in: don't build themis and mpp
+ * configure.in: don't build themis and mpp
+ * util/.cvsignore: ignore Makefile.in
+ * appl/themis appl/mpp: removed, they are now in their own repos
-2001-03-06 Tomas Olsson <tol@stacken.kth.se>
+2003-01-20 Love <lha@stacken.kth.se>
- * tests/run-tests.in: 1.70->1.71: don't run compare-inum-mp
+ * arlad/fcache.c (dynroot_update_entry): no more spare, change to
+ update fields
-2001-03-04 Love <lha@stacken.kth.se>
+ * arlad/dynroot.c (dynroot_update_entry): no more spare, change to
+ real version
- * xfs/linux/xfs_message.c: make got data w/o token more quiet
- * appl/lib/arlalib.h: 1.37->1.38: fs_checkvolumes
- * appl/lib/fs_lib.c: 1.31->1.32: fs_checkvolumes
+ * ydr/Makefile.am: ydr_SOURCES: add header files
- * include/afssysdefs.h: solaris 8 uses 65, openbsd uses 208,
- freebsd uses 339
+ * ydr/Makefile.am: CLEANFILES = lex.c parse.c parse.h
- * ydr/output.c: 1.73->1.74: remember to code INOUT argument too
- * rxdef/pts.xg: 1.14->1.15: (ListOwned): over in INOUT
+ * ydr/Makefile.am: YFLAGS= -d
- * xfs/bsd/xfs_syscalls-wrap-bsd.c: 1.11->1.12: xfs_syscallent,
- check for HAVE_STRUCT_SYSENT_SY_FLAGS
+ * rxdef/common.h: make the last for elements match the rest of the
+ code
- * appl/lib/tokens.c: 1.1->1.2: memset token
-
- * appl/fs/fs*: fs improvements
-
- * lib/ko/agetarg.c: 1.9->1.11 agetarg improvments
- * lib/ko/agetarg.h: 1.4->1.6
-
- * appl/vos/*.c: start to use get_servername()
- * arlad/volcache.c: 1.98->1.100: use volname_*, more gc issues
-
- * lib/ko/ko.h: 1.27->1.28: volname_specific, volname_canonicalize
- * lib/ko/vlmisc.c: 1.3->1.4: volname_specific,
- volname_canonicalize
+ * rxdef/common.h: drop all long/short/unsigned stuff and replace
+ all by c99 types
- * appl/vos/vos_examine.c: 1.17->1.21
- * appl/vos/vos.c: 1.16->1.17: call tzset
-
-2001-02-21 Love <lha@stacken.kth.se>
+ * rxdef/common.h (AFSFetchStatus): fill in the now no longer spare
+ bits of FetchStatus
- * THANKS: 1.44->1.45: added s/390 contributors
+ * lib/Makefile.am: add libvers
- * arlad/arlad.8: 1.7->1.8: mandoc fix
+ * rxdef/Makefile.in: add EXEEXT to ydr
- * lwp/{process.s390.S,make-process.o.sh.in,lwp_asm.c,LICENSE.s390}:
- pull up S/390 support from head, contributed by
- <Neale.Ferguson@SoftwareAG-usa.com> and <adam@sinenomine.net>
+ * ydr: automakeify
- * arlad/fcache.c: 1.318->1.319: (fcache_update_length): correct
- variable spelling
+ * ydr: 64 bits encodeing/decodeing support (require presence of
+ htole64/le64toh) verified same output with:
+ perl -pi -e 's/sizeof\(tmp\)/sizeof\(int32_t\)/g' *.[ch]
+ for a in *.[ch] ; do diff -uw $a old/$a ; done
-2001-02-18 Love <lha@stacken.kth.se>
+ * lib/ko/kocell.c (cell_getthiscell): if the cell is unconfigured,
+ return "unknown-cell-missing-configuration"
+
+2003-01-19 Love <lha@stacken.kth.se>
- * arlad/fcache.c: 1.317->1.318: (fcache_update_length): remove
- overly paranoid assertion
+ * nnpfs/bsd/nnpfs_syscalls-common.c (*): use syscall_d_thread_t,
+ syscall_thread_to_thread
-2001-02-14 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs/nnpfs_syscalls.h (*): use syscall_d_thread_t
+
+ * nnpfs/bsd/nnpfs_syscalls-wrap-bsd.c (sys_lkmnosys): use
+ syscall_d_thread_t
- * xfs/solaris/xfs_message.c: 1.27->1.28: xfs_message_installdata
- fix
- * xfs/solaris/bin/startarla.in: 1.3->1.4: only create /dev/xfs0
- symlink if it doesn't exist
- * xfs/solaris/xfs_vfsops.c: 1.18->1.19: turn printf into XFSDEB
- * xfs/solaris/xfs_node.c: 1.15->1.16: Corrected bad function call
- and declaration
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: add yet another glue type
+ syscall_d_thread_t, this is the process/thread argument that
+ syscall are called with, add a syscall_thread_to_thread macro that
+ converts from a syscall_d_thread_t to a d_thread_t
- * appl/lib/ka-procs.c: 1.4->1.5: (get_password): fix problem noted
- by John Callaghan <jpc@msu.edu>
+ * nnpfs/bsd/nnpfs_dev-common.c (nnpfs_cursig): in netbsd 1.6M
+ CURSIG takes a struct lwp disable this for now
-2001-02-13 Assar Westerlund <assar@sics.se>
+ * nnpfs/bsd/nnpfs_dev-bsd.c, nnpfs/bsd/nnpfs_dev-common.c
+ nnpfs/bsd/nnpfs_dev-osf.c, nnpfs/bsd/nnpfs/nnpfs_dev.h:
+ nnpfs_devopen_common dont need struct proc, remove it
- * arlad/fcache.c 1.316->1.317: (fcache_update_length): rewrite the
- assert:s in a more robust way
+ * appl/cbdebug/cbdebug.h: update to changed signature of cbgetconn()
+ * appl/cbdebug/localcell.c: ditto
+ * appl/cbdebug/whoareyou.c: ditto
-2001-02-11 Love <lha@stacken.kth.se>
+ * appl/cbdebug/cbdebug.c (cbgetconn): make it possible for
+ cbgetconn to return hostname if not passed in.
+ (*): change to use afscallbackport
- * arlad/messages.c: 1.235->1.236: remove key when we get a rxkad
- message invalidkey.
+ * rx/Makefile.in: fix rx_trace that I manage to break
+
+ * rx/rx.c: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx.h: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_misc.c: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_misc.h: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_globs.h: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_pkt.c: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_pkt.h: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_user.c: s/long/int32_t/;s/short/int16_t/ where apropriate
+ * rx/rx_rxdebug.c: s/long/int32_t/;s/short/int16_t/ where apropriate
-2001-02-11 Assar Westerlund <assar@sics.se>
+ * rx/rx_multi.h: remove register, s/long/int32_t/ where aproporate
+
+ * rx/rx_kern.h: remove register
+ * rx/rx_event.h: remove register
+ * rx/rx_event.c: remove register
+
+2003-01-18 Love <lha@stacken.kth.se>
- * arlad/arladeb.c 1.24->1.25 (arla_vwarnx_with_fid): adapt to new
- volcache_getname
- * arlad/fcache.c 1.315->1.316 (fcache_store_state): fix arla_warnx
- (getvolstat): use new volcache_getname
- * arlad/volcache.h 1.29->1.30 (volcacheentry): only store one name
- pointer
- (the canonical name)
- (volcache_getname): update prototype
- * arlad/volcache.c 1.96->1.97: re-structure so that we only keep the
- canonical name for a volume
- (volcache_getname): copy name out instead of returning it
+ * arlad/SuidCells.5: improve
+
+ * arlad/DynRootDB.5: improve
+
+2003-01-17 Love <lha@stacken.kth.se>
- * xfs/solaris/xfs_vnodeops.c 1.38->1.39 (xfs_inactive): check the
- v_count of the node since due to a race condition we can get nodes
- that shouldn't really be thrown away here
- (xfs_getpage, xfs_putpage): read the cache node from the xfs_node
- after calling xfs_data_valid
+ * appl/udebug/udebug.c: print version with print_version()
+ (and cleanup usage string)
- * arlad/volcache.c: 1.97->1.98: re-do some of the ref-counting
- logic and make it simpler
+ * appl/kalog/kalog.c: print version with print_version()
+
+ * appl/cbdebug/cbdebug.c: print version with print_version()
-2001-02-02 Assar Westerlund <assar@sics.se>
+ * appl/cbdebug/Makefile.in: add libvers
+
+ * appl/amon/amon.c: print version with print_version()
+
+ * appl/pts/pts.c: use arlalib_version_cmd for version
+
+ * appl/fs/fs.c: use arlalib_version_cmd for version
+
+ * appl/lib/arlalib.h: add arlalib_version_cmd
+
+ * appl/fs/Makefile.in: add libvers
- * appl/afsutils/aklog.c: 1.6->1.7: add fallback for
- krb_get_default_principal for krb libraries without it
+ * appl/fs/fs.c: print version with print_version()
+
+ * appl/lib/arlalib.h: drop fslib_version
+
+ * appl/lib/fs_lib.c: drop fslib_version
+
+ * arlad/arla-cli.c: print version with print_version()
+
+ * arlad/arlad.c: print version with print_version()
+
+ * appl/perf/afsfsperf.c: print version now and then
+
+ * configure.in: AC_OUTPUT: add lib/vers/Makefile
+
+ * lib/vers: add from heimdal/kth-krb
-2001-01-31 Love <lha@stacken.kth.se>
+2003-01-15 Love <lha@stacken.kth.se>
- * xfs/bsd/xfs_vnodeops-bsd.c: 1.88->1.89: (xfs_readdir): avoid
- looping when there is a (incorrect) entry with d_reclen==0.
- Patch from: Chris Csanady <ccsanady@iastate.edu>
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: add missing #endif
+
+ * lib/ko/Makefile.am: split CPPFLAGS to target_CFLAGS
+
+2003-01-14 Tomas Olsson <tol@stacken.kth.se>
-2001-01-30 Love <lha@stacken.kth.se>
+ * arlad/messages.c (nnpfs_message_getdata): OR new flags into
+ msg.flags
- * Release 0.35.2
-
- * xfs/linux/xfs_vfsops.c: 1.71->1.72: (xfs_replace_root): update
- xfsf_attr2inode usage
+2003-01-14 Love <lha@stacken.kth.se>
- * conf/CellServDB: 1.49->1.50: biocenter.helsinki.fi
-
- * Release 0.35.1
+ * arlad/fcache.c (read_data, write_data): be more careful how
+ updating of ->length and usedbytes is done to make sure its
+ correct
- * xfs/*/xfs/xfs_fs.h: (xfs_attr2inode): update signature
- * xfs/*/xfs_node.c: (new_xfs_node): clean node
- (xfs_attr2inode): only clean node if needed
- * xfs/*/xfs_message.c: (xfs_message_installdata): clear node
- (xfs_message_installattr): don't clear node
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: freebsd removed SCARG in 5.0RC3
+ and later
-2001-01-29 Love <lha@stacken.kth.se>
+ * lib/ko/Makefile.am: s/SYSCONFDIR/sysconfdir/
+
+2003-01-13 Love <lha@stacken.kth.se>
- * arlad/bsd-subr.c: 1.55->1.56: make XFS_DIRENT_BLOCKSIZE smaller
- since otherwise linux emulation code under freebsd will lose any
- entries that have it's end past 512 bytes.
+ * HACKING: spell
-2001-01-28 Love <lha@stacken.kth.se>
+2003-01-11 Love <lha@stacken.kth.se>
- * configure.in: 1.472->1.4.73: Fixed fatal typo in pthreads
- detection
+ * rxkad: change from old afs int32/u_int32 to iso c99 int32_t/uint32_t
- * xfs/linux/xfs_inodeops.c: 1.150->1.151: (xfs_lookup): fill in
- the whole getnode message inside the look, since xfs_message_rpc()
- might clobber it.
+ * includes/stds.h: drop compat glue for rxkad
-2001-01-25 Love <lha@stacken.kth.se>
+ * util: drop copy_dirname/copy_basename
- * Release 0.35
-
- * appl/fs/fs.c: 1.94->1.95: fs incompat command
- * appl/lib/fs_lib.c: 1.32->1.33: fs_incompat_renumber
- * appl/lib/arlalib.h: 1.38->1.39: fs_incompat_renumber
-
- * xfs/solaris/bin/startarla.in: 1.2->1.3: solaris 8 afs
- syscallnumber
+ * arlad/arla-cli.c: inline copy_dirname/copy_basename
- * xfs/linux/bin/Makefile.in: 1.21->1.22: s,XFS_BIN,XFS_SBIN,
-
- * arlad/conn.h: 1.24->1.25: new conn_clearcred signature
- * arlad/conn.c: 1.61->1.62: make conn_crearcred take mask
- * arlad/messages.c: 1.234->1.235: use new conn_clearcred
+ * appl/lib/arlalib.c: (arlalib_get_cred_krb): rewrite the code
+ that fetches the server key to be simpler
- * xfs/bsd/xfs/xfs_fs.h: 1.18->1.19: clean vattr fix
- * xfs/bsd/xfs_node-bsd.c: 1.47->1.48: clean vattr fix
- * xfs/bsd/xfs_message.c: 1.64->1.65: clean vattr fix
-
-2001-01-15 Love <lha@stacken.kth.se>
+ * HACKING: more automake
- * include/kafs.h: 1.32->1.34: include/kafs.h: update arla pioctl's
- that are assigned to assigned to arla, added comments for arla
- pioctls
-
- WARNING this break compability with older versions of arla !
+ * **/Makefile.in: use libtool library for libarlautil and libko
-2001-01-09 Love <lha@stacken.kth.se>
+ * lib/ko/gensysname.c: change to use getarg (instead of agetarg)
+ to drop circular dependcy for libtool
- * lib/ko/agetarg.c: 1.8->1.9: (print_arg): fix formating error in
- help text From Nickolai Zeldovich <kolya@MIT.EDU>
-
- * arlad/cred.c: 1.33->1.34: (cred_expire): dont try to get
- username since we are chroot()ed From Nickolai Zeldovich
- <kolya@MIT.ED>
+ * conf/Makefile.in: (arla.conf): depend on the right file
- * appl/vos/vos_partinfo.c: 1.7->1.8: end args with aarg_end, from
- Nickolai Zeldovich <kolya@MIT.EDU>
+ * appl/afsutils/klog.c: fix (stupid) warning with cast
-2001-01-08 Love <lha@stacken.kth.se>
+ * appl/aafs-perl/Makefile.in: fix building
- * appl/kalog/kalog.c (main): use koerr_gettext to print error from
- ka_authenticate
+ * util/heap.c: (heap_remove): compare dummy with the right thing
- * lib/ko/koerror.c: ka errors
-
- * xfs/bsd/bin/umount_xfs.8: simplistic manualpage
- * xfs/bsd/bin/mount_xfs.8: simplistic manualpage
- * xfs/bsd/bin/Makefile.in (MANPAGES): mount_ffs.8, umount_xfs.8
- (install,uninstall): manualpages
+ * lib/Makefile, lib/ko/Makefile: generate with automake
- * lib/ko/agetarg.c (agetarg): fixed broken short option mandatory
- handleing
+ * README: update to reality
-2001-01-07 Love <lha@stacken.kth.se>
+2003-01-10 Tomas Olsson <tol@stacken.kth.se>
- * arlad/fcache.c (purge_cred, fcache_get_data): update use of
- install_attr()
- * arlad/messages.c (install_attr): update take a flag field for
- fcacheentry2xfsnode()
- (fcacheentry2xfsnode): update to take a flag field and use it.
- (*): update to new signature of install_attr() and
- fcacheentry2xfsnode()
+ * arlad/arla.conf.5: spelling, clarify, explain fake_stat
- * arlad/messages.h (FCACHE2XFSNODE_{ATTR,RIGHT,ALL}): flags for
- fcacheentry2xfsnode()
- (fcacheentry2xfsnode): update to take a flag field
+ * arlad/{kernel,fcache,messages}.c: indent
- * rx/rx.c (rxi_CheckCall): return -2 is the call is freed.
- (rxi_ReapConnections): check if rxi_CheckCall returns -2, in that
- case the hash-bucket might have changed and we need to restart.
+2003-01-10 Love <lha@stacken.kth.se>
- * lib/ko/agetarg.c: make mandatory work for real
+ * HACKING: add util/Makefile as a automake file
- * util/log.c (log_open): pass on name to lower open, free name
+ * util/Makefile.am: automakeify
- * appl/lib/Makefile.in: add tokens.c
- * appl/lib/arlalib.c (arlalib_get_cred_afs): get token from kernel
- (arlalib_get_cred_krb): rename from arlalib_get_cred
- (arlalib_getsecurecontext): use arlalib_get_cred_afs()
- * appl/lib/tokens.c (arlalib_token_iter): new func to iterate all
- tokens.
+ * util/*.h: unify header protection and make it arlalib specific
- * xfs/bsd/xfs_dev-common.c (xfs_block_sigset): new function that
- remove signals we want to block from a sigset_t in some diffrent
- ways.
- (xfs_message_rpc): use xfs_block_sigset(); if there is a p_sigctx, use it.
-
- * xfs/solaris/xfs_vnodeops.c (xfs_map): remove the check that the
- mapping is off the end of the file, solaris vm works that way.
+ * arlad/fcache.h (FCacheEntry): remove datap
- * xfs/linux/xfs_message.c (xfs_invalid_xnode): don't mark
- directories as STALE
- * xfs/bsd/xfs_message.c (xfs_message_invalidnode): don't mark
- directories as STALE
+ * arlad/{fcache.c,inter.c,dynroot.c,unknown-subr.c}:
+ remove all references to datap, instead use '->length',
+ '->fetch_data', or just remove the paranoid assert.
- * rx/rx.c (rxi_FindPeer): init connQueue
+ the state log doesn't change (value still stored), its just
+ ignored when reading back the state
-2001-01-06 Love <lha@stacken.kth.se>
-
- * rx/rx.c (rxi_InsertPeer): change all connection that used the
- original peer that is about to die.
- (rx_NewConnection,rxi_FindConnection): attach this conn to the peer
- (rx_DestroyConnection): when the connection dies, deattach it
- from the peer.
-
- * rx/rx.h (rx_connection): add a queue_item that attaches this
- connection to its peer.
+ * arlad/poller.c: some poller log statments
-2001-01-06 Simon Josefsson <jas@nada.kth.se>
+2003-01-09 Love <lha@stacken.kth.se>
- * conf/CellServDB (extundo.com): add.
+ * nnpfs/bsd/nnpfs: (nnpfs_message_installdata): pass
+ NNPFS_LOCKLEAF to namei
-2001-01-06 Love <lha@stacken.kth.se>
+ * nnpfs/bsd/nnpfs/nnpfs_locl.h: provide glue for namei flag
+ LOCKLEAF
- * appl/fs/fs.c (newcell_cmd): mark cell as mandatory and remove
- check
+ * arlad/messages.c (nnpfs_message_{open,getdata}): set msg.flag
+ correctly
-2001-01-05 Love <lha@stacken.kth.se>
-
- * rx/rx.c (rxi_DecongestionEvent): decrement the refcount after we
- are done, so that the peer doesn't get reclaimed if we block in
- rxi_Start(). From Nickolai Zeldovich <kolya@mit.edu>.
-
- * appl/fs/fs.c (afs_listacl): just return if there a access
- failure. From Nickolai Zeldovich <kolya@mit.edu>
+ * includes/kafs.h: add AFSCOMMONIOC_GKK5SETTOK (in arla space for now)
- * arlad/fcache.c (getacl): reset the opaque data structure in case
- we fail, make sure we free data when we fail.
- From Nickolai Zeldovich <kolya@mit.edu>
+ * arlad/cred.h: add prototype for rxgk cred handling
- * arlad/fcache.c (get_attr_bulk): pull out the host from the rx
- connection in case we need it later, then we don't need to used
- freed memory. From Nickolai Zeldovich <kolya@mit.edu>.
+ * arlad/messages.c: add prototype for rxgk cred handling
+
+ * arlad/inter.h: new signature of cm_open
-2001-01-04 Love <lha@stacken.kth.se>
+ * arlad/inter.c (cm_open): simplify, let other do the hard work
+
+ * arlad/messages.c: Split message_getdata and message_open for
+ now. They are quite simular, but I want to see the diffrences
+ between them. Also, this fixes inc-open (again) since I broke it
+ before.
- * lib/ko/agetarg.c (agetarg): check that the mandatory arguments
- are filled in, from Nickolai Zeldovich <kolya@mit.edu>
+ * arlad/fcache.c (fcache_get_data): directories can fetch part of
+ the file, explain why we shold remove `update attr case' in this
+ function.
+ (fcache_update_length): set wanted_length to min of len we have and
+ length of file so we don't got off and fetch the whole thing.
+ (sum_node): don't look at datap/attrp, length will be 0 when there
+ isn't any data
- * appl/fs/fs.c (cmds): added "df" from Nickolai Zeldovich
- <kolya@mit.edu>
+2003-01-07 Love <lha@stacken.kth.se>
-2001-01-04 Mattias Amnefelt <mattiasa@e.kth.se>
+ * arlad/kernel.c: name the workers with their worker id
+
+2003-01-06 Love <lha@stacken.kth.se>
- * appl/pts/pts.c (member_cmd): set conn_context to null before
- using it.
+ * appl/lib/tokens.c (arlalib_token_iter): if there is unknown
+ error from k_pioctl, bail out
-2001-01-02 Love <lha@stacken.kth.se>
+2003-01-03 Tomas Olsson <tol@stacken.kth.se>
- * xfs/bsd/xfs_vnodeops-bsd.c (xfs_getpages): use VOP_GETPAGES()
- for BSDs that doesn't have vnode_pager_generic_getpages().
-
- * xfs/linux/bin/Makefile.in: install startarla in $prefix/sbin
-
-2001-01-01 Assar Westerlund <assar@sics.se>
+ * lwp/plwp.h: include windows.h after roken.h
+
+ * lwp/plwp.c (*): indent, cleanup, more debugging
- * xfs/bsd/xfs_syscalls-common.c (fhget_call): always vrelease `vp'
- (fhopen_call): check `vp' first
- (xfs_pioctl_call): handle the weird case of someone sending a filename
- to debug
+ * lwp/plwp.c (LWP_INT_SIGNAL): use SetEvent(), not PulseEvent()
+ (Create_Process_Part2): handle locks properly around LWP_INT_WAIT
-For older ChangeLog entries see ChangeLog.2000
+For older ChangeLog entries see ChangeLog.2002
diff --git a/usr.sbin/afs/src/HACKING b/usr.sbin/afs/src/HACKING
index 803503922e9..bdde6c14621 100644
--- a/usr.sbin/afs/src/HACKING
+++ b/usr.sbin/afs/src/HACKING
@@ -1,17 +1,32 @@
#!/bin/sh
-# $KTH: HACKING,v 1.2 1999/09/26 21:45:54 haba Exp $
+# $arla: HACKING,v 1.22 2003/06/10 19:24:18 lha Exp $
#
# * Configuration stuff
#
# Arla uses GNU autoconf for configuration. If you want to modify
-# configure.in (or acconfig.h) you'll need autoconf 2.13 and automake
-# 1.4 or later. To re-create the configuration files, run these
-# commands:
+# configure.in (or acconfig.h) you'll need autoconf 2.53 (or later),
+# automake 1.6 (or later), and libtool 1.4a (or later, depending on
+# your platform). To re-create the configuration files, run
+# these commands:
-aclocal -I cf
-autoheader
-autoconf
+libtoolize -c
+aclocal -I cf $ACLOCAL_EXTRA_ARGS
+autoheader || { echo autoheader broken; exit 1; }
+autoconf || { echo autoconf broken; exit 1; }
+automake -a -c \
+ util/Makefile \
+ ydr/Makefile \
+ rxkad/Makefile \
+ lib/Makefile \
+ lib/vers/Makefile \
+ lib/roken/Makefile \
+ lib/sl/Makefile \
+ lib/ko/Makefile \
+ appl/afstool/Makefile \
+ appl/udebug/Makefile
# aclocal creates a file `aclocal.m4' from all the tests in the `cf'
# directory. autoheader will create `include/config.h.in' and autoconf
# the `configure' script.
+
+exit 0
diff --git a/usr.sbin/afs/src/INSTALL b/usr.sbin/afs/src/INSTALL
index b9c54d38f6f..43b31f204ac 100644
--- a/usr.sbin/afs/src/INSTALL
+++ b/usr.sbin/afs/src/INSTALL
@@ -1,4 +1,4 @@
-$KTH: arla-0-35-7 $)
+Id: INSTALL,v 1.93 2002/09/07 10:41:43 lha Exp $arla: $)
* Building arla
@@ -26,18 +26,18 @@ There are also some arla-specific arguments to configure:
--with-krb4=dir use kerberos 4 in dir
--with-krb4-lib=dir use krb4-lib in dir
--with-krb4-include=dir use krb4-include in dir
- --with-krbafs=dir use cmu's krbafs lib (If you not are using kth-krb.
- This is not needed when using kth-krb since
- libkafs is included there.)
+ --with-krbafs=dir use krbafs lib. For non kth-krb users, see README
+ for more information about libkrbafs)
--with-krb5=dir use kerberos 4 compat from kerberos 5 in dir
+ --with-sl=dir use the sl in dir
+ --with-sl-lib=dir use the sl library in dir
+ --with-sl-include=dir use the sl includes in dir
--disable-mmap don't use mmap at all
- --enable-mmaptime use mmap:ed time from /dev/kmem
- (known to work on FreeBSD)
--disable-dynamic-afs don't use loaded AFS library with AIX
--enable-smp compile for SMP (currently only on Linux and FreeBSD)
--enable-knfs enable code to nfsmount AFS (*BSD only).
--enable-kld build KLD modules (for FreeBSD[34]-current)
- --disable-xfs do not build XFS
+ --disable-nnpfs do not build NNPFS
--without-x don't build X code
--with-pthreads=dir use the pthreads library in dir
--with-sys=dir The base directory of your kernel source
@@ -51,6 +51,13 @@ There are also some arla-specific arguments to configure:
--with-roken-include=dir that knowns what they do and want to use
--with-roken-lib=dir another roken the default. You will shot off
your feet using this option.
+ If you use a roken, you want to use it from
+ KTH-KRB1.2 or Heimdal 0.4e (or later)
+ --with-bsd-make=prog When using a bsd and cross compiling we need
+ to know your make, default /usr/bin/make
+ --without-lwp-redzone LWP creates a redzone page on top of all
+ thread stacks with mmap(), if this causes
+ you problem you can turn it of with this option.
By default configure will use gcc if it finds it. If you want to use
a specific compiler or some special options you can specify that when
@@ -72,7 +79,7 @@ configured.
Solaris 2.7, 2.8 (or Solaris 7, 8)
On Solaris 2.7, 2.8 the kernel itself can be either 32 bit or 64 bit.
-The xfs kernel module needs to be of the same type as the kernel. You
+The nnpfs kernel module needs to be of the same type as the kernel. You
can find out what type of kernel you have from `dmesg'. It should say
something like:
@@ -101,11 +108,13 @@ lwp/make-process.o.sh.in.
Mac OS X/Darwin
-The platforms we have tested are Mac OS X 10.0.4 (Darwin 1.3.7) and
-Mac OS X 10.1 (Darwin 1.4). You must install the Developer Tools CD
-before you can compile Arla. On Mac OS X 10.1, you must currently use
-the option --disable-mmap to the configure script, since mmap is
-broken in that version.
+The platforms we have tested are Mac OS X 10.2. You must install the
+Developer Tools CD before you can compile Arla.
+
+There is documentation to configure the native kerberos in Mac OS X provided by MIT here: <http://web.mit.edu/macdev/Development/MITKerberos/Common/Documentation/preferences.html>
+
+If you choose to use the native Kerberos stuff you'll need krbafs, see
+the README where to find it.
Linux
@@ -128,6 +137,10 @@ header files (like linux/version.h) need to have right datestamp to
please make. Another problem is that all symbol-rewrite #defines
doesn't exists.
+{Net,Free,Open}BSD
+
+You will need the kernel source installed in /usr/src/sys.
+
NetBSD
NetBSD 1.5 include kth-krb and heimdal and due to that arla and
@@ -220,19 +233,15 @@ Linux:
SunOS4:
- modload /usr/arla/bin/libxfs.o
+ modload /usr/arla/bin/libnnpfs.o
modstat
- mknod /dev/xfs0 c <C-major from modstat> 0
+ mknod /dev/nnpfs0 c <C-major from modstat> 0
mkdir /afs
- /usr/arla/bin/mount_xfs /afs /dev/xfs0
+ /usr/arla/bin/mount_nnpfs /afs /dev/nnpfs0
/usr/arla/libexec/arlad
{Net|Open}BSD:
- NetBSD 1.4.2 have a problem with syscall(2) and shared libs, it will
- simply not work. The configure script tries to detect that its 1.4.2
- and build everything static. Gross, but at least working.
-
You can not load kernel modules (the modload step) when your
securelevel is above zero. There are two ways to make sure that you
can load kernel modules:
@@ -247,15 +256,15 @@ SunOS4:
FreeBSD:
- Do like in {Net|Open} except that after the first time (when /dev/xfs0
+ Do like in {Net|Open} except that after the first time (when /dev/nnpfs0
exists) you can skip the modload since the module with automatically
- be loaded by mount_xfs assuming you have copied xfs_mod.o to /modules with
+ be loaded by mount_nnpfs assuming you have copied nnpfs_mod.o to /modules with
something like the following commands:
mkdir /modules
- cp /usr/arla/bin/xfs.ko /modules
+ cp /usr/arla/bin/nnpfs.ko /modules
- And mount_xfs will load the filesystem into the kernel.
+ And mount_nnpfs will load the filesystem into the kernel.
As with other BSDs, /usr/arla/bin/startarla should do everything for you.
@@ -266,7 +275,7 @@ Solaris:
Add a line to /etc/name_to_major with (138 should be any unused number)
- xfs 138
+ nnpfs 138
and another one to /etc/name_to_sysnum (105 is the preferred system
call number by Solaris < 7 and 73 for Solaris 7). If that's already
@@ -276,47 +285,47 @@ Solaris:
40, 42, 45, 49, 51 - 53, 64-78, 82, 83, 101, 102, 110, 111, 127, 140,
150, 151, 176 - 184, 226 - 229
- xfs 105
+ nnpfs 105
(or)
- xfs 73
+ nnpfs 73
You might have to reboot for these changes to take effect. Then, type:
- modload xfs
+ modload nnpfs
- You should probably add a file in /usr/kernel/drv/xfs.conf with:
+ You should probably add a file in /usr/kernel/drv/nnpfs.conf with:
- name="xfs" parent="pseudo" instance=0;
+ name="nnpfs" parent="pseudo" instance=0;
and then run:
- drvconfig -i xfs
+ drvconfig -i nnpfs
Create a /dev link and a directory:
- ln -s "/devices/pseudo/xfs@0:" /dev/xfs0
+ ln -s "/devices/pseudo/nnpfs@0:" /dev/nnpfs0
mkdir /afs
Now you can try mounting the file system and start the daemon:
- /usr/arla/bin/mount_xfs /dev/xfs0 /afs
+ /usr/arla/bin/mount_nnpfs /dev/nnpfs0 /afs
/usr/arla/libexec/arlad
Note that if you are using a syscall other than 105, you have to use a
- new kth-krb (with afssys.c 1.59 or newer) and set AFS_SYSCALL=xfs
+ new kth-krb (with afssys.c 1.59 or newer) and set AFS_SYSCALL=nnpfs
before starting arlad.
- If you want to, you can copy the xfs/solaris/xfs module to /kernel/fs
- and xfs/solaris/bin/mount_xfs to /lib/fs/xfs/mount which enables you to
- automatically load the xfs module when mounting the xfs file system.
+ If you want to, you can copy the nnpfs/solaris/nnpfs module to /kernel/fs
+ and nnpfs/solaris/bin/mount_nnpfs to /lib/fs/nnpfs/mount which enables you to
+ automatically load the nnpfs module when mounting the nnpfs file system.
AIX:
Create the device node:
- mknod /dev/xfs0 c 100 0
+ mknod /dev/nnpfs0 c 100 0
And add a line like the following to /etc/vfs:
@@ -324,41 +333,41 @@ AIX:
Now you can try mounting the file system and start the daemon:
- /usr/arla/bin/xfs_load /usr/arla/bin/xfs
- /usr/arla/bin/mount_xfs /dev/xfs0 /afs
+ /usr/arla/bin/nnpfs_load /usr/arla/bin/nnpfs
+ /usr/arla/bin/mount_nnpfs /dev/nnpfs0 /afs
/usr/arla/libexec/arlad
Tru64 Unix (aka Digital Unix (aka OSF/1)):
- Copy the xfs.mod to some of /subsys, /var/subsys, /sys/BINARY,
+ Copy the nnpfs.mod to some of /subsys, /var/subsys, /sys/BINARY,
or /subsystems. Depending on what your kloadsrv thinks is the
right thing<tm>.
- Load (configure) the module with sysconfig -c xfs
+ Load (configure) the module with sysconfig -c nnpfs
Query the module to see if it loaded ok and get the
character device and syscall number from it with:
- sysconfig -q xfs
+ sysconfig -q nnpfs
- Create the char-device "mknod /dev/xfs0 c <MAJOR> 0"
+ Create the char-device "mknod /dev/nnpfs0 c <MAJOR> 0"
where <MAJOR> is the number obtained above.
Create the afs directory: mkdir /afs
Mount the device and start the daemon:
- /usr/arla/bin/mount_xfs /dev/xfs0 /afs
+ /usr/arla/bin/mount_nnpfs /dev/nnpfs0 /afs
/usr/arla/libexec/arlad
It could look something like this:
- datan:~# sysconfig -c xfs
- datan:~# sysconfig -q xfs
+ datan:~# sysconfig -c nnpfs
+ datan:~# sysconfig -q nnpfs
syscall = 34
major = 68
debug = 255
- datan:~# mknod /dev/xfs0 c 68 0
+ datan:~# mknod /dev/nnpfs0 c 68 0
datan:~# mkdir /afs
- datan:~# /usr/arla/bin/mount_xfs /dev/xfs0 /afs
+ datan:~# /usr/arla/bin/mount_nnpfs /dev/nnpfs0 /afs
datan:~# /usr/arla/libexec/arlad
datan:~# ls /afs | head
.stacken.kth.se
@@ -399,14 +408,16 @@ If you have to use Arla thru a firewall, it is useful to review how
Arla communicates. Arla uses UDP in the following way:
arlad Server
-4711 <--> 7000,7003
+7001(*) <--> 7000,7003
+
+Tools(**) Server
+whatever(***) <--> 7002,7003,7005
-Tools(*) Server
-whatever(**) <--> 7002,7003,7005
+(*) arla older then 0.36 used 4711
-(*) vos/pts/bos
+(**) vos/pts/bos
-(**) dynamically assigned port numbers, depends on your OS
+(***) dynamically assigned port numbers, depends on your OS
If your server is on the other side of a firewall and the
configuration allows connections to be opened only one way, your
diff --git a/usr.sbin/afs/src/LIESMICH b/usr.sbin/afs/src/LIESMICH
index da88a51a139..b379489f132 100644
--- a/usr.sbin/afs/src/LIESMICH
+++ b/usr.sbin/afs/src/LIESMICH
@@ -1,5 +1,5 @@
-LIESMICH für arla-0.35.7 ($KTH: arla-0-35-7 $)
-$KTH: LIESMICH,v 1.7.2.8 2002/02/25 02:35:03 lha Exp $
+LIESMICH für arla-0.35 ($arla: $)
+$arla: LIESMICH,v 1.9 2002/09/07 10:41:44 lha Exp $
Für alle, die zuerst 'mal lieber auf Deutsch lesen. Die Lektüre von
README wird aber trotzdem empfohlen.
@@ -11,8 +11,8 @@ Arla ist eine freie Implementation des AFS Cacheverwalters.
2. Wo finde ich diese Datei?
Diese Datei ist enthalten in
-ftp://ftp.stacken.kth.se/pub/arla/arla-0.35.7.tar.gz
-(d.h. /afs/stacken.kth.se/ftp/pub/arla/arla-0.35.7.tar.gz).
+ftp://ftp.stacken.kth.se/pub/arla/arla-0.35.tar.gz
+(d.h. /afs/stacken.kth.se/ftp/pub/arla/arla-0.35.tar.gz).
3. Was ist AFS?
@@ -95,7 +95,7 @@ gelaufen sein könnte, versuchen Sie es noch einmal mit
`arlad -n -z --debug=almost-all' und legen sie den produzierten Text
dem Email bei. Sie können auch das Debugniveau eines laufenden arlad
(als root) mit `fs arladebug <debug-level>' ändern. Das gleiche gilt
-für den Kerneltreiber mit `fs xfsdebug <debug-level>'. Das Ergebnis
+für den Kerneltreiber mit `fs nnpfsdebug <debug-level>'. Das Ergebnis
landet in Ihrem syslog (/var/log/messages, /var/adm/messages oder so
ähnlich).
@@ -113,19 +113,19 @@ Ohne diese Information können wir Ihnen nicht helfen.
9. Wie kann ich die Menge der Debuginformation steuern?
-Sowohl arlad als auch xfs (der Kerneltreiber) haben Variabeln mit
+Sowohl arlad als auch nnpfs (der Kerneltreiber) haben Variabeln mit
denen die Art der Debuginformation (und damit die Menge) kontrolliert
werden kann.
Arlad anwendet `--debug' und nach dem Start `fs arladebug'. Für
-den Kerneltreiber wendet man `fs xfsdebug' an.
+den Kerneltreiber wendet man `fs nnpfsdebug' an.
10. Wie schwierig ist es Arla auf ein neues Betriebssystem zu
portieren?
Nicht sehr. Im user-level sind die Unterschiede gering zwischen
verschiedenen Betriebssystemen. Für den Kernel kann man mit einem
-anderen ähnlichen System (in xfs/SYSTEM) anfangen. Falls Sie sich für
+anderen ähnlichen System (in nnpfs/SYSTEM) anfangen. Falls Sie sich für
so etwas interessieren oder sogar Arla auf einem oben nicht genannten
Betriebssystem laufen haben, schicken Sie ein Email an
<arla-drinkers@stacken.kth.se>.
diff --git a/usr.sbin/afs/src/README b/usr.sbin/afs/src/README
index fcba77ee785..d81e29dd9b4 100644
--- a/usr.sbin/afs/src/README
+++ b/usr.sbin/afs/src/README
@@ -1,5 +1,5 @@
-README for arla-0.35.7 ($KTH: arla-0-35-7 $)
-$KTH: README,v 1.77.2.11 2002/02/25 02:35:01 lha Exp $
+README for arla-0.35 ($arla: $)
+$arla: README,v 1.87 2003/07/15 16:22:58 lha Exp $
1. What is arla?
@@ -8,8 +8,8 @@ Arla is a free AFS cache-manager implementation.
2. Where do I find this file?
This file is contained inside
-ftp://ftp.stacken.kth.se/pub/arla/arla-0.35.7.tar.gz
-(aka /afs/stacken.kth.se/ftp/pub/arla/arla-0.35.7.tar.gz).
+ftp://ftp.stacken.kth.se/pub/arla/arla-0.35.tar.gz
+(aka /afs/stacken.kth.se/ftp/pub/arla/arla-0.35.tar.gz).
3. What is AFS?
@@ -22,38 +22,36 @@ for more information.
There is kernel support (with different level of functionality) for
the following operating systems:
-- FreeBSD 3.x, 4.,x, and 5.x
-- OpenBSD 2.2-2.9
-- NetBSD 1.2, 1.3, 1.4, and 1.5
-- Linux 2.2.x, 2.3.x, 2.4.x
+- FreeBSD 4.5 (and later), and 5.1 and later
+- OpenBSD 3.1 - 3.2
+- NetBSD 1.5 and 1.6
+- Linux 2.2.x, 2.4.x
- SunOS 4
-- Solaris 2.5, 2.6, 7, and 8
+- Solaris 2.6, 7, and 8
- AIX 4.x
- IRIX 6.x
- Digital Unix 4.0, Compaq Tru64 5.0 (OSF/1)
-- Darwin 1.3 and 1.4, Mac OS X 10.0 and 10.1
-
-Userland only:
-- Ultrix 4.4
+- Mac OS X 10.0 and 10.2 (and Darwin)
A cache manager (arlad) that works both in user-level mode and with
the kernel module. The user-level mode is quite portable and has even
been working under Windows NT (with the cygwin32 libraries).
-Some simple programs (amon, fs, klog, tokens, vos, udebug, and pts).
+Some simple programs (amon, bos, fs, pts, tokens, vos, and udebug).
An experimental AFS server called milko.
5. What's the status of arla?
- Working stable client (currently cacheing whole files)
+ Arlad caches ranges of files, from the first byte to the last requested.
- Authentication (using kth-krb4 or any other krb4 implantation)
-- Used in production systems with OpenBSD, FreeBSD, NetBSD, Linux,
- Mac OS X, Compaq Tru64.
-- Some administration programs (fs, vos, pts and bos)
+- Used in production systems with OpenBSD, FreeBSD, NetBSD, Linux, and
+ Mac OS X
+- Some administration programs (bos, fs, vos, pts and bos)
- An experimental AFS server (milko)
- Graphical program, amon, for monitoring the state of the cache.
-- A graphical interface for managing ACLs
+- A graphical interface for managing ACLs (for MacOS X only)
- A configuration utility for Mac OS X
6. What do I need to run arla?
@@ -74,10 +72,11 @@ afslog. (can be found in /usr/src/kerberosIV/{kafs,afslog}) (versions
since 2.3 have AFS=yes on by default, except for m88k).
If you are using MIT-Kerberos or CNS Kerberos you can find a replacement
-for libkafs in http://andrew2.andrew.cmu.edu/dist/krbafs.html. Then you
+for libkafs in http://web.mit.edu/openafs/krbafs/. Then you
need to use the --with-krbafs=dir option when running configure.
-Thanks to Derrick J Brashear <shadow@dementia.org> for making this
-available for the american users.
+Thanks to Derrick J Brashear <shadow@dementia.org> and Alexandra
+Ellwood <lxs@mit.edu> for making this available for the MIT kerberos
+users.
If you don't have Kerberos, you should still be able to test that it
works, but there's not much point in running unauthenticated, and it's
@@ -95,8 +94,8 @@ Report it with as much detail as possible (including patches) to
If you find a bug, and do not have a clue what is wrong, please run
arlad with `arlad -n -z --debug=almost-all' and append the output the
the mail. You can also turn on debug on an already running arlad with
-`fs arladebug <debug-level>'. To enable debugging in the xfs kernel
-module, use `fs xfsdebug <debug-level>'. The output will end up in
+`fs arladebug <debug-level>'. To enable debugging in the nnpfs kernel
+module, use `fs nnpfsdebug <debug-level>'. The output will end up in
your syslog (like /var/log/messages or /var/adm/messages).
If arlad crashes, at least run gdb on the core dump and do a `bt'.
@@ -113,18 +112,18 @@ Without this info we are probably as lost as you are.
9. How do I adjust the amount of debug information?
-Both arlad and the xfs (the kernel module) have variables for
+Both arlad and the nnpfs (the kernel module) have variables for
controlling what type of debug messages should be printed.
They are controlled by the `--debug' option to arlad and then by
-running `fs arladebug' and `fs xfsdebug'.
+running `fs arladebug' and `fs nnpfsdebug'.
10. How hard is it to port arla to a new operating system?
It's not hard. The user-level code is quite portable and is not much
different between different operating systems. The kernel module is
system-specific but not that large and you can probably start with the
-one in `xfs/SYSTEM' that's most similar to your system. If you're
+one in `nnpfs/SYSTEM' that's most similar to your system. If you're
interested in doing the port or even run Arla on an OS not mentioned
above, send mail to
<arla-drinkers@stacken.kth.se>.
diff --git a/usr.sbin/afs/src/THANKS b/usr.sbin/afs/src/THANKS
index 4715adab1ba..e44d5499855 100644
--- a/usr.sbin/afs/src/THANKS
+++ b/usr.sbin/afs/src/THANKS
@@ -36,7 +36,7 @@ Hee-Seok Heo <hsheo@postech.ac.kr>
Paul Ewing Jr. <ewing@ima.umn.edu>
Niklas Hallqvist <niklas@appli.se>
Marko Asplund <aspa@hip.fi>
-Chris Wing <wingc@engin.umich.edu>
+Christopher Wing <wingc@engin.umich.edu>
Simon Josefsson <jas@pdc.kth.se>
Magnus Lindström <magnus.lindstrom@s3.kth.se>
Greg Stark <gsstark@mit.edu>
@@ -56,3 +56,7 @@ Nickolai Zeldovich <kolya@MIT.EDU>
Adam Thornton <adam@sinenomine.net>
Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
Hidvegi <hzoli@austin.ibm.com>
+Todd T. Fries <todd@fries.net>
+Andrea Campi <andrea@webcom.it>
+William Uther <will+@cs.cmu.edu>
+Richard Nyberg <rnyberg@it.su.se>
diff --git a/usr.sbin/afs/src/conf/CellServDB b/usr.sbin/afs/src/conf/CellServDB
index 41e8c88452d..725cbb4c0a2 100644
--- a/usr.sbin/afs/src/conf/CellServDB
+++ b/usr.sbin/afs/src/conf/CellServDB
@@ -236,14 +236,10 @@
128.2.62.3 #edison.me.cmu.edu
>haycorn.psy.cmu.edu #CMU Psy Test cell
128.2.248.86 #haycorn.psy.cmu.edu
->cs.cornell.edu #Cornell University Computer Science
-128.84.254.70 #kali.cs.cornell.edu
->graphics.cornell.edu # Cornell University Program of Computer Graphics
-132.236.95.45 #potato.graphics.cornell.edu
->msc.cornell.edu # Cornell University Materials Science Center
-128.84.231.196 #ransom.msc.cornell.edu
-128.84.241.33 #ept.msc.cornell.edu
-128.84.249.240 #locutus.msc.cornell.edu
+>msc.cornell.edu #Cornell University Materials Science Center
+128.84.231.242 #miranda.ccmr.cornell.edu
+128.84.241.35 #co.ccmr.cornell.edu
+128.84.249.78 #dax.ccmr.cornell.edu
>kiewit.dartmouth.edu # Dartmouth College, Kiewit
129.170.16.42 #northservc.dartmouth.edu
>northstar.dartmouth.edu #Dartmouth College, Project Northstar
@@ -257,9 +253,9 @@
>afs1.scri.fsu.edu # Supercomputer Computations Research Instit
144.174.128.60 #afs1.scri.fsu.edu
>iastate.edu # Iowa State University
-129.186.156.156 #afsdb-1.iastate.edu
-129.186.157.157 #afsdb-2.iastate.edu
-129.186.158.158 #afsdb-3.iastate.edu
+129.186.1.243 #afsdb-1.iastate.edu
+129.186.6.243 #afsdb-2.iastate.edu
+129.186.142.243 #afsdb-3.iastate.edu
>isi.edu # University of Southern California/ISI
128.9.208.78 #afs.isi.edu
>cc.lehigh.edu #lehigh
@@ -273,8 +269,8 @@
>threede.mit.edu #MIT/private 3DES AFS testing cell
18.177.0.130 #twode.mit.edu.
>athena.mit.edu #MIT/Athena cell
-18.70.0.6 #prill.mit.edu.
-18.145.0.25 #agamemnon.mit.edu.
+18.158.0.37 #prill.mit.edu.
+18.145.0.25 #agamemnon.mit.edu.
18.7.1.66 #paris.mit.edu
>dev.mit.edu #MIT/IS Development cell
18.7.1.70 #wham.mit.edu.
@@ -487,8 +483,10 @@
144.92.240.99 #afs3.cae.wisc.edu
>dapnia.saclay.cea.fr #Axlan-CEA
132.166.32.7 #dphrsg.saclay.cea.fr
->in2p3.fr # IN2P3 production cell
-134.158.232.1 #ccpnds00.in2p3.fr
+>in2p3.fr #IN2P3 production cell
+134.158.232.11 #ccafsdb1.in2p3.fr
+134.158.232.12 #ccafsdb2.in2p3.fr
+134.158.232.13 #ccafsdb3.in2p3.fr
>mcc.ac.gb #University of Manchester
130.88.203.11 #cfs1.mcc.ac.uk
130.88.203.12 #cfs2.mcc.ac.uk
@@ -623,8 +621,6 @@
192.88.210.123 #fs3.cert.org
>ciesin.org # CIESIN
160.39.8.90 #afsdb0.ciesin.org
->dementia.org # dementia
-128.2.35.149 # alycia.dementia.org
>research.ec.org # Esprit Research Network of Excellence
128.240.150.111 #albion.ncl.ac.uk
130.89.181.106 #cabernet.pegasus.esprit.ec.org
@@ -685,10 +681,6 @@
130.237.232.29 #crab.pdc.kth.se
130.237.232.112 #anna.pdc.kth.se
130.237.232.114 #hokkigai.pdc.kth.se
->blubb.pdc.kth.se # blubb
-193.10.159.47 #blubb.pdc.kth.se
->mr-afs.pdc.kth.se # PDC, MR-AFS
-130.237.232.70 #frog.pdc.kth.se
>stacken.kth.se # Stacken Computer Club, KTH, Sweden
130.237.234.3 #milko.stacken.kth.se
130.237.234.43 #hot.stacken.kth.se
@@ -697,13 +689,16 @@
130.237.77.7 #gandalf.telge.kth.se
>admin.kth.se # Royal Institute of Technology, Admin
130.237.32.19 #malvolio.admin.kth.se
+>hpc2n.umu.se # High Performance Computer Center North
>bcc.ac.uk # Bloomsbury Computing Consortium
128.40.101.3 #rs6-svr-3.cls-1.bcc.ac.uk
>athena.ox.ac.uk #Oxford cell
129.67.42.91 #neon.athena.ox.ac.uk
129.67.42.90 #krypton.athena.ox.ac.uk
>rl.ac.uk #Rutherford Appleton Lab, England
-130.246.12.31 #tinkerbel.cc.rl.ac.uk
+130.246.15.135 #tinkerbel.cc.rl.ac.uk
+130.246.12.45 #isabel.cc.rl.ac.uk
+130.246.183.164 #wallace.cc.rl.ac.uk
>ibm.uk # IBM UK, AIX Systems Support Centre
160.100.240.2 #affinity.aixssc.uk.ibm.com
>ualberta.ca # University of Alberta
@@ -723,7 +718,11 @@
130.225.51.74 #afsdb2.kom.auc.dk
>zepa.net #Kolya/zepa.net cell
>extundo.com # Simon Josefsson's cell
+>dementia.org #Dementia Unlimited
+>grand.central.org #GCO Public CellServDB 15 Feb 2002
>openafs.org #OpenAFS project
128.2.121.218 #virtue.openafs.org
>dynarc.se # Dynarc
62.65.1.17 #adder.dynarc.se
+>su.se # Stockholm University
+>lns.mit.edu #MIT/LNS Cell
diff --git a/usr.sbin/afs/src/conf/arla.spec.in b/usr.sbin/afs/src/conf/arla.spec.in
index 28bebbd7075..65f186e8cd3 100644
--- a/usr.sbin/afs/src/conf/arla.spec.in
+++ b/usr.sbin/afs/src/conf/arla.spec.in
@@ -1,5 +1,5 @@
#
-# $KTH: arla.spec.in,v 1.4 2000/10/08 06:03:14 lha Exp $
+# $arla: arla.spec.in,v 1.5 2002/09/07 10:43:39 lha Exp $
#
# A spec file for build a arla rpm
#
@@ -74,41 +74,41 @@ mkdir ${RPM_BUILD_ROOT}
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --sysconfdir=/etc/arla
make
-cd xfs/linux
+cd nnpfs/linux
make clean
CPPFLAGS="-D__BOOT_KERNEL_SMP=1 -D__BOOT_KERNEL_UP=0" make
-mv xfs.o xfs.smp.o.save
+mv nnpfs.o nnpfs.smp.o.save
make clean
CPPFLAGS="-D__BOOT_KERNEL_SMP=0 -D__BOOT_KERNEL_UP=1" make
-mv xfs.o xfs.up.o.save
+mv nnpfs.o nnpfs.up.o.save
-echo "dummy file, to be removed later" > xfs.o
+echo "dummy file, to be removed later" > nnpfs.o
-mv xfs.up.o.save xfs.up.o
-mv xfs.smp.o.save xfs.smp.o
+mv nnpfs.up.o.save nnpfs.up.o
+mv nnpfs.smp.o.save nnpfs.smp.o
%install
mkdir ${RPM_BUILD_ROOT}/etc
mkdir ${RPM_BUILD_ROOT}/sbin
make install DESTDIR=$RPM_BUILD_ROOT
-rm $RPM_BUILD_ROOT/%{prefix}/bin/xfs.o
+rm $RPM_BUILD_ROOT/%{prefix}/bin/nnpfs.o
KERNEL_VERSION=$(uname -r | sed 's/smp$//')
-cp xfs/linux/xfs.{smp,up}.o $RPM_BUILD_ROOT%{prefix}/bin
+cp nnpfs/linux/nnpfs.{smp,up}.o $RPM_BUILD_ROOT%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT/lib/modules/${KERNEL_VERSION}/fs
-cp xfs/linux/xfs.up.o \
- $RPM_BUILD_ROOT/lib/modules/${KERNEL_VERSION}/fs/xfs.o
+cp nnpfs/linux/nnpfs.up.o \
+ $RPM_BUILD_ROOT/lib/modules/${KERNEL_VERSION}/fs/nnpfs.o
mkdir -p $RPM_BUILD_ROOT/lib/modules/${KERNEL_VERSION}smp/fs
-cp xfs/linux/xfs.smp.o \
- $RPM_BUILD_ROOT/lib/modules/${KERNEL_VERSION}smp/fs/xfs.o
+cp nnpfs/linux/nnpfs.smp.o \
+ $RPM_BUILD_ROOT/lib/modules/${KERNEL_VERSION}smp/fs/nnpfs.o
-cp xfs/linux/libgetcwd.so $RPM_BUILD_ROOT%{prefix}/lib
+cp nnpfs/linux/libgetcwd.so $RPM_BUILD_ROOT%{prefix}/lib
chmod 555 $RPM_BUILD_ROOT%{prefix}/lib/libgetcwd.so
%post
diff --git a/usr.sbin/afs/src/conf/bos.conf b/usr.sbin/afs/src/conf/bos.conf
index 34f3011f97a..fd53c2f16cc 100644
--- a/usr.sbin/afs/src/conf/bos.conf
+++ b/usr.sbin/afs/src/conf/bos.conf
@@ -1,5 +1,5 @@
#
-# $KTH: bos.conf,v 1.3 2000/09/06 16:48:44 tol Exp $
+# $arla: bos.conf,v 1.3 2000/09/06 16:48:44 tol Exp $
#
# Syntax:
#
diff --git a/usr.sbin/afs/src/doc/ack.texi b/usr.sbin/afs/src/doc/ack.texi
index 8cc559e7663..96e6a74edd8 100644
--- a/usr.sbin/afs/src/doc/ack.texi
+++ b/usr.sbin/afs/src/doc/ack.texi
@@ -1,7 +1,7 @@
@c Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: ack.texi,v 1.17 2001/01/08 18:02:43 lha Exp $
+@c $arla: ack.texi,v 1.20 2002/05/26 14:49:33 lha Exp $
@node Acknowledgments, Index, Authors, Top
@comment node-name, next, previous, up
@@ -160,6 +160,24 @@ Bugfixes, documentation, encouragement, and code has been contributed by:
@item Nickolai Zeldovich
@tab @email{kolya@@MIT.EDU}
+@item Adam Thornton
+@tab @email{adam@@sinenomine.net}
+
+@item Neale Ferguson
+@tab @email{Neale.Ferguson@@SoftwareAG-usa.com}
+
+@item Hidvegi
+@tab @email{hzoli@@austin.ibm.com}
+
+@item Todd T. Fries
+@tab @email{todd@@fries.net}
+
+@item Andrea Campi
+@tab @email{andrea@@webcom.it}
+
+@item William Uther
+@tab @email{will+@@cs.cmu.edu}
+
@end multitable
diff --git a/usr.sbin/afs/src/doc/ack.texi.in b/usr.sbin/afs/src/doc/ack.texi.in
index c55c897d630..1b13017587e 100644
--- a/usr.sbin/afs/src/doc/ack.texi.in
+++ b/usr.sbin/afs/src/doc/ack.texi.in
@@ -1,7 +1,7 @@
@c Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: ack.texi.in,v 1.5 2000/12/01 08:30:45 lha Exp $
+@c $arla: ack.texi.in,v 1.5 2000/12/01 08:30:45 lha Exp $
@node Acknowledgments, Index, Authors, Top
@comment node-name, next, previous, up
diff --git a/usr.sbin/afs/src/doc/afs-basics.texi b/usr.sbin/afs/src/doc/afs-basics.texi
index 8445e842d7b..f433d32a4c8 100644
--- a/usr.sbin/afs/src/doc/afs-basics.texi
+++ b/usr.sbin/afs/src/doc/afs-basics.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: afs-basics.texi,v 1.17 2000/12/01 08:31:07 lha Exp $
+@c $arla: afs-basics.texi,v 1.17 2000/12/01 08:31:07 lha Exp $
@node AFS infrastructure, Organization of data, Introduction, Top
@comment node-name, next, previous, up
diff --git a/usr.sbin/afs/src/doc/arla.info b/usr.sbin/afs/src/doc/arla.info
index 2c807c441f5..c653598c91e 100644
--- a/usr.sbin/afs/src/doc/arla.info
+++ b/usr.sbin/afs/src/doc/arla.info
@@ -1,5 +1,4 @@
-This is Info file arla.info, produced by Makeinfo version 1.68 from the
-input file arla.texi.
+This is arla.info, produced by makeinfo version 4.0 from arla.texi.
INFO-DIR-SECTION Arla
START-INFO-DIR-ENTRY
@@ -21,19 +20,21 @@ Please send comments (and fixes) on this manual and the arla programs to
* Introduction:: Introduction to Arla.
* AFS infrastructure:: A description of the afs infrastructure.
-* Organization of data:: How diffrent data are organized in AFS.
+* Organization of data:: How different data is organized in AFS.
* AFS and the real world:: Common problems and their solutions.
-* Parts of Arla:: Description of diffrent parts of arla.
+* Parts of Arla:: Description of different parts of arla.
* Debugging:: How to debug arla when its not working.
* Porting:: That you need to know to port arla.
-* Authors:: The authors of arla.
-* Oddities:: Strange things that have happen to us.
+* Programming:: Programming documentation of arla.
+* Oddities:: Strange things that did happen to us.
+* Themis:: Tool to keep your files system up-to-date.
* Arla timeline:: Short timeline of arla.
+* Authors:: The authors of arla.
* Acknowledgments:: People that have helped us.
* Index:: Index.
- -- The Detailed Node Listing --
+ --- The Detailed Node Listing ---
* Introduction::
* AFS infrastructure::
@@ -50,22 +51,24 @@ How to cope with reality
* NAT::
* Samba::
+* Integration with Kerberos::
+* Kerberos tickets and AFS tokens::
The parts of arla
* How arla works::
-* The relation between Arlad and XFS::
+* The relation between Arlad and NNPFS::
* The life of a file::
* Tools and libs::
* The files in arlad/::
* pioctl and kafs::
-Yes, its doesn't work, lets debug.
+How to debug arla when its not working
* Arlad::
* Debugging LWP with GDB::
-* xfs::
-* xfs on linux::
+* nnpfs::
+* nnpfs on linux::
* Debugging techniques::
* Kernel debuggers::
* Darwin/MacOS X::
@@ -74,7 +77,13 @@ Porting arla
* Porting::
* Porting user-space::
-* Porting XFS::
+* Porting NNPFS::
+
+Programming
+
+* Programming::
+* Disco with arla::
+* afsUUID::
Odd stuff you find when looking around
@@ -176,7 +185,11 @@ There are two mailing lists with talk about Arla.
There is also commit list <arla-commit@stacken.kth.se>. Send a message
to <LIST-request@stacken.kth.se> to subscribe.
-The list are achived on `http://www.stacken.kth.se/lists/'.
+The list are achived on <http://www.stacken.kth.se/lists/>.
+
+Please note that the mailinglists have a policy of subscriber only
+posting. So if you want to mail a message to the list, subscribe to it
+first, otherwise it wont be posted on the list.

File: arla.info, Node: AFS infrastructure, Next: Organization of data, Prev: Introduction, Up: Top
@@ -430,9 +443,9 @@ File: arla.info, Node: Organization of data, Next: AFS and the real world, Pr
Organization of data
********************
-This chapter how data is stored and how AFS diffrent from, for example,
-NFS. It also describes how data kept consistent and what the
-requirements was and how that inpacted on the design.
+This chapter describes how data is stored and how AFS is different from,
+for example, NFS. It also describes how data is kept consistent and what
+the requirements were and how that inpacted on the design.
* Menu:
@@ -453,14 +466,11 @@ Requirements
It should be possible to use AFS with hundred-thousands of users
without problems.
- Writes that are done to diffrent parts of the filesystem should not
- affect each other. It should be possible to distribute out the
- reads and writes over many file-servers. So if you have a file
- that is accessed by many clients, it should be possible to
- distribute out the load.
-
- If there is multiple writes to the same file, are you sure that
- isn't a database.
+ Writes that are done to different parts of the filesystem should
+ not affect each other. It should be possible to distribute out the
+ reads and writes over many fileservers. If you have a file that is
+ accessed by many clients, it should be possible to distribute the
+ load.
* Transparent to users
@@ -475,7 +485,7 @@ Requirements
should also be possible to move the users data for a fileserver to
a less loaded one, or one with more diskspace available.
- Some benefits of using AFS is:
+ Some benefits of using AFS are:
* user-transparent data migration
@@ -499,8 +509,8 @@ Anti-requirements
* No databases
AFS isn't constructed for storing databases. It would be possible
- to use AFS for storing a database if a layer above provided
- locking and synchronizing of data.
+ to use AFS for storing a database if a layer above for locking and
+ synchronizing data would be provided.
One of the problems is that AFS doesn't include mandatory
byte-range locks. AFS uses advisory locking on whole files.
@@ -508,59 +518,61 @@ Anti-requirements
If you need a real database, use one, they are much more efficent
on solving a database problem. Don't use AFS.
+

File: arla.info, Node: Data organization, Next: Callbacks, Prev: Requirements, Up: Organization of data
Volume
======
-A volume is a unit that is smaller then a partition. Its usually (should
-be) a well defined area, like a user's home directory, a project work
-area, or a program distribution.
+A volume is a unit that is smaller than a partition. It is usually (or
+should be) a well defined area, like a user's home directory, a project
+work area, or a program distribution.
-Quota is controlled on volume-level. All day-to-day management are done
+Quota is controlled on volume-level. All day-to-day management is done
on volumes.
Partition
=========
In AFS a partition is what normally is named a partition. All partions
-that afs isusing is named a special way, `/vicepNN', where NN is ranged
-from a to z, continuing with aa to zz. The fileserver (and volser)
-automaticly picks upp all partition starting with `/vicep'
+that afs is using are named a special way, `/vicepNN', where NN is
+ranged from a to z, continuing with aa to zz. The fileserver (and
+volser) automaticly picks upp all partitions starting with `/vicep'
-Volumes are stored in a partition. Volumes can't overlap partitions.
-Partitions are added when the fileserver is created or when a new disk
-is added to a filesystem.
+Volumes are stored in a partition. Volumes can't span several
+partitions. Partitions are added when the fileserver is created or when
+a new disk is added to a filesystem.
Volume cloning and read-only clones
===================================
-A clone of volume is often needed for the volume operations. A clone is
+A clone of a volume is often needed for volume operations. A clone is a
copy-on-write copy of a volume, the clone is the read-only version.
-A two special versions of a clone is the read-only volume and the backup
+Two special versions of a clone are the read-only volume and the backup
volume. The read-only volume is a snapshot of a read-write volume (that
-is what a clone is) that can be replicated to several fileserver to
-distribute the load. Each fileserver plus partition where the read-only
-is located is called a replication-site.
+is what a clone is) that can be replicated to several fileservers to
+distribute the load. Each fileserver plus partition where a read-only
+clone is located is called a replication-site. It usually does not make
+sense to have more than one read-only clone on each fileserver.
The backup volume is a clone that typically is made (with `vos
-backupsys') each night to enable the user to retrieve yestoday's data
+backupsys') each night to enable the user to retrieve yesterday's data
when they happen to remove a file. This is a very useful feature, since
-it lessen the load on the system-administrators to restore files from
+it lessens the load on the system-administrators to restore files from
backup. The volume is usually mounted in the root user's home directory
under the name OldFiles. A special feature of the backup volume is that
-inside it you can't follow mountpoint.
+you can't follow mountpoints out of a backup volume.
Mountpoints
===========
-The volumes are independent of each other. To clue the together there is
-a `mountpoint's. Mountpoints are really symlink that is formated a
-special way that points out a volume (and a optional cell). A
-AFS-cache-manager will show a mountpoint as directory, in fact it will
-be the root directory of the target volume.
+Volumes are independent of each other. To glue together the file tree
+there are `mountpoint's. Mountpoints are really symlinks that are
+formated in a special way so that they point out a volume and an
+optional cell. An AFS-cache-manager will show a mountpoint as directory
+and in fact it will be the root directory of the target volume.

File: arla.info, Node: Callbacks, Next: Volume management, Prev: Data organization, Up: Organization of data
@@ -568,18 +580,19 @@ File: arla.info, Node: Callbacks, Next: Volume management, Prev: Data organiz
Callbacks
=========
-Callbacks are what enable the AFS-cache-manager to keep the files
-without asking the server if there is newer version of the file.
+Callbacks are messages that enable the AFS-cache-manager to keep the
+files without asking the server if there is newer version of the file.
A callback is a promise from the fileserver that it will notify the
client if the file (or directory) changes within the timelimit of the
callback.
-For read-only callbacks there is only callback given its called a volume
-callback and it will be broken when the read-only volume is updated.
+For contents of read-only volumes there is only one callback per volume
+called a volume callback and it will be broken when the read-only volume
+is updated.
-The time range of callbacks range from 1 hour to 5 minutes depending of
-how many user of the file exists.
+The time range of callbacks is from 5 to 60 minutes depending on how
+many users of the file exist.

File: arla.info, Node: Volume management, Next: Relationship between pts uid and unix uid, Prev: Callbacks, Up: Organization of data
@@ -587,9 +600,9 @@ File: arla.info, Node: Volume management, Next: Relationship between pts uid a
Volume management
=================
-All volume managment is done with the vos-command. To get a list of all
-commands `vos help' can be used. For help on a specific vos subcommand,
-`vos subcommand -h' can be used.
+All volume managment is done with the `vos' command. To get a list of
+all commands `vos help' can be used. For help on a specific vos
+subcommand, `vos subcommand -h' can be used.
* Create
@@ -604,19 +617,19 @@ commands `vos help' can be used. For help on a specific vos subcommand,
Read-only volumes can be replicated over several servers, they are
first added with `vos addsite', and the replicated with `vos
- release' out over the servers.
+ release' over the servers.
* Release
- When you want to distribute out the changes in the readwrite
- volume.
+ When you want to distribute the changes in the readwrite volume to
+ the read-only clones.
* Remove
Volumes can be removed
Note that you shouldn't remove the last readonly volume since this
- make clients misbehave. If you are moving the volume you should
+ makes clients misbehave. If you are moving the volume you should
rather add a new RO to the new server and then remove it from the
old server.
@@ -627,13 +640,23 @@ commands `vos help' can be used. For help on a specific vos subcommand,
To stream a volume out to a `file' or `stdout' you use `vos dump'.
The opposite command is named `vos restore'.
+

File: arla.info, Node: Relationship between pts uid and unix uid, Prev: Volume management, Up: Organization of data
Relationship between pts uid and unix uid
=========================================
-foo
+Files in AFS are created with the pts uid of the token that was valid at
+the time. The pts uid number is then by commands like `ls -l'
+interpreted as a unix uid and translated into a username. If the pts and
+the unix uids differ, this might confuse the user as it looks like as
+her files are owned by someone else. This is however not the case.
+Complications can occur if programs impose further access restrictions
+based on these wrongly interpreted uids instead of using the `access()'
+system call for that purpose. Graphical file browsers are typically
+prone to that problem with the effect that the users are not able to
+see their own files in these tools.

File: arla.info, Node: AFS and the real world, Next: Parts of Arla, Prev: Organization of data, Up: Top
@@ -646,9 +669,10 @@ that perfect) world and show possible solutions to these problems.
* Menu:
-* NAT:: Really evil stuff.
+* NAT:: Truly evil stuff.
* Samba:: Export AFS to Windows computers.
* Integration with Kerberos:: How to integrate Kerberos with AFS.
+* Kerberos tickets and AFS tokens:: History and tools

File: arla.info, Node: NAT, Next: Samba, Prev: AFS and the real world, Up: AFS and the real world
@@ -656,8 +680,9 @@ File: arla.info, Node: NAT, Next: Samba, Prev: AFS and the real world, Up: A
NAT
===
-There's something evil out there that's called NAT. For whatever
-reasons, people are using it and will continue doing so.
+There's something evil out there that's called NAT, which stands for
+Network Address Translation. 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
@@ -676,14 +701,29 @@ they have a rather short timeout:
`Linux Nat (masq)'
300 seconds
-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.
+If the client doesn't transmit any traffic to a particular host for that
+amount of time, it will get mapped to one of the IP address of the
+NAT-server (if you happen to run PAT, the port will be randomized too).
+
+The authors of Rx realized that keeping a Rx connection associated with
+(IP-address,port) pair was a bad idea. One example is that you get
+problems with multi-homed hosts. So Rx keeps its own connection id data
+in the packet. With this feature client and server should be able to
+detect address changes.
+
+Unfortunately, the use of the orignal Rx-code stops this from happening
+in Transarc/OpenAFS code. The code keeps track of incoming packets and
+keeps track of the right peer (client). But it never updates the
+IP-address,port pair in its data structure, so the answer packet will go
+to the old IP-address,port pair.
+
+If you can control your NAT machine you can have static mapping for your
+AFS hosts (Transarc/OpenAFS uses source port 7000 and Arla uses source
+port 4711). You can try to use Natkeep
+<http://mit.edu/fredette/www/natkeep/> if you run an old Arla or
+Transarc/OpenAFS client. From version 0.36 arla will have support for
+polling the servers at the right interval to prevent NAT from dropping
+information about your session.

File: arla.info, Node: Samba, Next: Integration with Kerberos, Prev: NAT, Up: AFS and the real world
@@ -691,34 +731,165 @@ File: arla.info, Node: Samba, Next: Integration with Kerberos, Prev: NAT, Up
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 major problem when exporting the AFS filespace read-write to SMB
+(Windows fileshareing) using Samba is the transfer of 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.
+Windows client and the samba-server, and then to get tokens for the user
+with this password. This solution is clearly not acceptable for security
+aware AFS administrators.
Describe here how to make AFS work "securely" with samba.
+On solution is to use `kimpersonate' + store afs key on fileserver
+(talk to Love).
+

-File: arla.info, Node: Integration with Kerberos, Prev: Samba, Up: AFS and the real world
+File: arla.info, Node: Integration with Kerberos, Next: Kerberos tickets and AFS tokens, Prev: Samba, Up: AFS and the real world
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
+Kerberos 4 and 5 can be integrated quite well with AFS. This is mainly
+due to the fact that the security model used in AFS is Kerberos. The
+kaserver is a Kerberos 4 server with pre-authentication. The kaserver
+also provides a feature that limits the number of password retries, and
+after that you are locked out for half an hour. This feature can only be
+used in the ka interface as it requires pre-authentication, but since
+the kaserver provides a Kerberos 4 interface (without pre-authentication
+and without this limitation) it is quite worthless.
+
+Many sites indeed use a kerberosserver instead of a kaserver. One of
+the reasons is that they want to use Kerberos 5 (which is required for
Windows 2000).
-More text here how to create KeyFile, and describe TheseCells.
+To use a kerberosserver, you have to put the same key into the AFS
+KeyFile and the principal named afs of your kerberos realm. If you have
+a cell which has another name than lowercase of your realmname, the
+instance is the cellname. As the cellname often contains dots, this can
+be quite confusing in Kerberos 4: afs.stacken.kth.se@STACKEN.KTH.SE. The
+first dot is the seperator between principal and instance, the other
+dots are part of the name. The simplest way to do create a KeyFile on
+your AFS server is to use heimdal's kadmin to generate and extract a
+KeyFile. It has an option designed to do so. Be aware that the serial
+number of the afs principal must match on all kerberos servers and all
+KeyFiles on all AFS servers.
+
+The default cellname to get a kerberos ticket for is contained in the
+configuration file `ThisCell'. If you got more than one cell, you want
+to list all cells to get tickets for in the `TheseCells' file.
+
+
+File: arla.info, Node: Kerberos tickets and AFS tokens, Prev: Integration with Kerberos, Up: AFS and the real world
+
+Kerberos tickets and AFS tokens
+===============================
+
+To further confuse the poor user, AFS and Kerberos programmers decided
+that they wanted to store their credentials at different places. In AFS,
+the kernel was a natural place to store the credentials (named token)
+since the CMU/Transarc AFS/OpenAFS implementation lives in the kernel.
+The Kerberos people on the other hand thought that storing the
+credentials (named ticket) in a file would be a good idea.
+
+So know you have to synchronize the credentials if you just want to
+enter your password once. There are several tools that can do that for
+you. The question is what tools to use for what problem.
+
+To add to the confusion not all tools talk to both Kerberos and
+kaservers. There is also a bogus user-id in the token that is supposed
+to be the same as your pts-user-id. Not that it makes any difference,
+but some people get confused when unknown numbers show up in the token.
+The easily confused people are often the ones that have more than one
+principal in the same realm/cell (read sysadmins).
+
+If you want to get your ticket from your Kerberos server, you use
+`kinit', and then use `afslog' or `aklog' to get AFS tokens and push
+them to the kernel (and AFS daemon). Some `kinit' (and `kauth') can do
+both for you, use `kinit --afslog' or simply `kauth'. Note that `kinit'
+and `kauth' don't get set your AFS-token user-id right, and thus can be
+confusing for people who think that this is important.
+
+The `klog' program that you get with Transarc/OpenAFS talks to the
+kaserver and behaves just-right in the sense that it talks to the pts
+server to get the AFS-token user-id right, but `klog' talks only to the
+kaserver which will not work for people with a Kerberos server. `Klog'
+in Arla was written by Chris Wing <wingc@engin.umich.edu> as a part of
+a packet called `afsutils', they did the right thing and talked to the
+pts-server to get the user-id. However, it uses Kerberos libs to talk
+to the server. These libraries require the files `/etc/krb.conf' and
+`/etc/krb.realms' to be setup correctly for their cell/realm. Not that
+easy.
+
+A long time ago Ken Hornstein <kenh@cmf.nrl.navy.mil> wrote the AFS
+Migration Kit that helped you to migrate from AFS to MIT Kerberos 5.
+It included a tool named aklog that could convert a Kerberos tickets to
+tokens. This tool was also rewritten in Arla by Brandon S. Allbery
+<allbery@ece.cmu.edu>. `aklog' can't get you new credentials, it just
+converts old ones to new ones.
+
+Then Transarc decided that they needed to fix a security hole in their
+kaserver, and while doing that, they managed to break a part in the
+kaserver so it ceased to work for kerberos requests.
+
+First the defect existed unnoticed for a long time, later Transarc has
+not managed to distribute a working version of the kaserver. Due to
+this, a lot of sites run a kaserver with this defect. Instead of
+installing working authentification servers from another sources,
+people started to whine again and Love <lha@stacken.kth.se> wrote the
+tool `kalog' that talked the ka-protocol (but didn't do the AFS user-id
+right) to work around that problem.
+
+All tools that use Kerberos 4 need a working `/etc/krb.conf' and
+`/etc/krb.realms'. Kerberos 5 programs need `/etc/krb5.conf'. AFS
+aware tools need `/usr/arla/etc/CellServDB' or
+`/usr/vice/etc/CellServDB'.
+
+Also the Kerberos implementations from KTH (kth-krb and Heimdal) include
+AFS support to make your life more pleasant. One thing is that you can
+have a file `$HOME/.TheseCells' that lists the cells you use and the
+Kerberos tools will try to get tickes and tokens for those cells.
+Heimdal contains support for converting a Kerberos 4 srvtab to an AFS
+KeyFile.
+
+Below is a table that describes what tools does what, what
+inheritance(s) they have, and what protocol(s) they speak. From the
+inheritance (also in a table below) it is possible to deduct what
+configuration files the tools use.
+
+Tool Inheritance Protocol Produces
+Transarc/OpenAFS klog afs authlib KA Ticket and tokens
+Arla klog Kerberos and Kerberos Ticket and tokens
+ libkafs
+AFS Migration kit's MIT Kerberos Kerberos Converts Kerberos
+aklog and Ken tickets to tokens
+ Hornstein's
+ afslib
+Arla's aklog Kerberos and Kerberos Converts Kerberos
+ libkafs tickets to tokens
+kth-krb's and Kerberos and Kerberos Converts Kerberos
+Heimdal's afslog libkafs tickets to tokens
+kalog arla and KA Get initial
+ libkafs ticket, store
+ tokens and tickets
+
+Inheritance table
+
+`afs authlib'
+ Reads `CellServDB' and `ThisCell' in `/usr/vice/etc'
+
+`Kerberos and libkafs'
+ Kerberos 4 uses `/etc/krb.conf' and `/etc/krb.realms'. Kerberos 5
+ uses `/etc/krb5.conf'.
+
+`arla'
+ Arla uses `CellServDB' and `ThisCell' in `/usr/vice/etc' and
+ `/usr/arla/etc'
+
+`libkafs'
+ Libkafs uses DNS and `CellServDB' in `/usr/vice/etc' and
+ `/usr/arla/etc' to figure out what ticket it should convert into
+ tables. The file `TheseCells' and `$HOME/.TheseCells' is used to
+ get extra tokens.

File: arla.info, Node: Parts of Arla, Next: Debugging, Prev: AFS and the real world, Up: Top
@@ -733,42 +904,42 @@ Parts of Arla
* Menu:
* How arla works::
-* The relation between Arlad and XFS::
+* The relation between Arlad and NNPFS::
* The life of a file::
* Tools and libs::
* The files in arlad/::
* pioctl and kafs::

-File: arla.info, Node: How arla works, Next: The relation between Arlad and XFS, Prev: Parts of Arla, Up: Parts of Arla
+File: arla.info, Node: How arla works, Next: The relation between Arlad and NNPFS, Prev: Parts of Arla, Up: Parts of Arla
How does arla work
==================
Arla consists of two parts, a userland process (arlad) and the
-kernel-module (xfs).
+kernel-module (nnpfs).
Arlad is written in user-space for simpler debugging (and less
rebooting). As a uset space program arlad does not have the same
limitations as if it would be written in the kernel. To avoid
-performance loss as much as possible, xfs is caching data.
+performance loss as much as possible, nnpfs is caching data.
-xfs and arlad communicate with each other via a char-device-driver.
+nnpfs and arlad communicate with each other via a char-device-driver.
There is a rpc-protocol currenly used specially written for this
(`arlad/message.c')
-xfs is written to be as simple as possible. Theoretically, xfs could be
+nnpfs is written to be as simple as possible. Theoretically, nnpfs could be
used by other user-space daemons to implement a file system. Some
parts, such as syscalls, are arla-specific. These parts are designed to
be as general as possible.
-For example, xfs does not recognize which pioctl the user-level program
+For example, nnpfs does not recognize which pioctl the user-level program
calls, it just passes this information on to arlad.

-File: arla.info, Node: The relation between Arlad and XFS, Next: The life of a file, Prev: How arla works, Up: Parts of Arla
+File: arla.info, Node: The relation between Arlad and NNPFS, Next: The life of a file, Prev: How arla works, Up: Parts of Arla
-The relation between Arlad and XFS
+The relation between Arlad and NNPFS
==================================
Userland
@@ -778,16 +949,16 @@ The relation between Arlad and XFS
| ---------
----|-----------------|[1]----
------- -------
- Kernel | VFS | <--[2]--> | XFS |
+ Kernel | VFS | <--[2]--> | NNPFS |
------- -------
-[1] A char device (/dev/xfs0)
+[1] A char device (/dev/nnpfs0)
[2] Xfs provides a filesystem for the vfs-layer in
the operating system.

-File: arla.info, Node: The life of a file, Next: Tools and libs, Prev: The relation between Arlad and XFS, Up: Parts of Arla
+File: arla.info, Node: The life of a file, Next: Tools and libs, Prev: The relation between Arlad and NNPFS, Up: Parts of Arla
The life of a file
==================
@@ -800,41 +971,41 @@ in most operating systems.
* open(2) syscall is issued.
- * The vfslayer sends a VOP_LOOKUP to xfs that is forwarded to arlad
+ * The vfslayer sends a VOP_LOOKUP to nnpfs that is forwarded to arlad
with a getnode() (seq-num 1).
* arlad tries to find the requested file and then, if found, sends an
- install_node to xfs by writing to the xfs character device.
+ install_node to nnpfs by writing to the nnpfs character device.
- * xfs inserts the node into the cache and returns from the device
+ * nnpfs inserts the node into the cache and returns from the device
write.
- * arlad sends a wakeup rpc message (seq-num 1) to xfs. If the
- return value is zero xfs tries to find the node in the cache, if
+ * arlad sends a wakeup rpc message (seq-num 1) to nnpfs. If the
+ return value is zero nnpfs tries to find the node in the cache, if
not found it might have been flushed out of the cache and the whole
thing is repeated.
* If a none-zero return value is returned, this value is sent as
reply to the user. This way arla can decide what error message is
- returned, without xfs having support for each error.
+ returned, without nnpfs having support for each error.
- * xfs now checks if it has the valid attributes. If the attributes
- are invalid, xfs will send a rpc message to arlad to refresh it.
+ * nnpfs now checks if it has the valid attributes. If the attributes
+ are invalid, nnpfs will send a rpc message to arlad to refresh it.
* Since the user wanted to open the file, a getdata rpc message is
- sent from xfs to arlad. Now arlad fetches the files from the afs
+ sent from nnpfs to arlad. Now arlad fetches the files from the afs
file server.
* Arlad stores the file in the file cache. All vnode operations will
- be done on this file. Now arlad sends a installdata to xfs.
+ be done on this file. Now arlad sends a installdata to nnpfs.
- * When xfs recives the installdata it looks up the node in the cache,
+ * When nnpfs recives the installdata it looks up the node in the cache,
and then it does a VOP_LOOKUP to find a vnode to the cachefile
(and store it to keep it for future use).
* The same thing is done when the file is a directory, except that
the directory is converted from the afs directory format to an
- operating system dependent format and stored in a file. xfs reads
+ operating system dependent format and stored in a file. nnpfs reads
this file instead.
* If the directory is modified locally, write operations are done on
@@ -845,12 +1016,13 @@ in most operating systems.
* read(2) system call is issued.
- * A VOP_READ is sent to the from the vfs-layer to xfs.
+ * A VOP_READ is sent to the from the vfs-layer to nnpfs.
- * xfs checks if it has valid attributes/and data (and updates if
+ * nnpfs checks if it has valid attributes/and data (and updates if
needed). Now VOP_READ is simply performed on the stored vnode of
the cachefile.
+

File: arla.info, Node: Tools and libs, Next: The files in arlad/, Prev: The life of a file, Up: Parts of Arla
@@ -864,10 +1036,10 @@ libutil: `util/libutil.a' - A library for the most often used
date-parsing, etc
rx: `rx/librx.a' - The library for the rx protocol
- (*note Rx protocol::.).
+ (*note Rx protocol::).
lwp: `lwp/liblwp.a' - The library for the lwp thread-package
- (*note LWP::.).
+ (*note LWP::).
ydr: `ydr/ydr' - A stub generator that replaces rxgen.
@@ -966,7 +1138,7 @@ The core of arlad
`kernel.c' - The interface between arlad and the char-device.
-`messages.c' - The rpc interface between arlad and xfs.
+`messages.c' - The rpc interface between arlad and nnpfs.
`volcache.c' - Cache for all volumes.
Operating system specific files
@@ -996,7 +1168,7 @@ File: arla.info, Node: pioctl and kafs, Prev: The files in arlad/, Up: Parts
pioctl and kafs
===============
-The pioctl interface is the only part of xfs that is afs related.
+The pioctl interface is the only part of nnpfs that is afs related.
pioctl is a ioctl but called with a path instead of a filedescriptor.
When you probe if there is a live afsclient you first run `k_hasafs()'
@@ -1010,16 +1182,16 @@ This is cleary invalid and kafs expects to find an `EINVAL' returned
from `syscall(2)'.
The pioctl is used more then just for `AFSCALL_PIOCTL', an other use is
-`AFSCALL_SETPAG' (setting pag). It has also been in use for setting xfs
+`AFSCALL_SETPAG' (setting pag). It has also been in use for setting nnpfs
debugging levels.
-When xfs discovers that a path is given in the `pioctl()' it does a
+When nnpfs discovers that a path is given in the `pioctl()' it does a
`VOP_LOOKUP' on the path and if the returned value is a vnode that
-resides in afs then it extracts the xfs-handle for that node (that just
+resides in afs then it extracts the nnpfs-handle for that node (that just
happens to be the VenusFid) and passes that on to arlad.
The only ugly thing about the current implentation is that the syscall
-code assumes that the arlad on "xfs-fd" is the arlad that should get
+code assumes that the arlad on "nnpfs-fd" is the arlad that should get
this syscall.
An example of using `pioctl()':
@@ -1064,7 +1236,7 @@ Debugging
This chapter of the manual includes tips that are useful when debugging
arla.
-Arla and xfs contains logging facilities that is quite useful when
+Arla and nnpfs contains logging facilities that is quite useful when
debugging when something goes wrong. This and some kernel debugging tips
are described.
@@ -1072,8 +1244,8 @@ are described.
* Arlad::
* Debugging LWP with GDB::
-* xfs::
-* xfs on linux::
+* nnpfs::
+* nnpfs on linux::
* Debugging techniques::
* Kernel debuggers::
* Darwin/MacOS X::
@@ -1114,13 +1286,13 @@ By default, arlad logs through syslog if running as a daemon and to
stderr when running in the foreground (with `--no-fork').

-File: arla.info, Node: Debugging LWP with GDB, Next: xfs, Prev: Arlad, Up: Debugging
+File: arla.info, Node: Debugging LWP with GDB, Next: nnpfs, Prev: Arlad, Up: Debugging
Debugging LWP with GDB
======================
For easy tracing of threads we have patch
-(`http://www.stacken.kth.se/projekt/arla/gdb-4.18-backfrom.diff') for
+(<http://www.stacken.kth.se/projekt/arla/gdb-4.18-backfrom.diff>) for
gdb 4.18 (a new command) and a gdb sequence (think script).
The sequence only works for i386, but its just matter of choosing
@@ -1165,31 +1337,31 @@ There also the possibility to run arla with pthreads (run configure with
-with-pthreads).

-File: arla.info, Node: xfs, Next: xfs on linux, Prev: Debugging LWP with GDB, Up: Debugging
+File: arla.info, Node: nnpfs, Next: nnpfs on linux, Prev: Debugging LWP with GDB, Up: Debugging
-xfs
+nnpfs
===
-XFS debugging does almost look the same on all platforms. They all
+NNPFS debugging does almost look the same on all platforms. They all
share same debugging flags, but not all are enabled on all platforms.
-Change the debugging with the `fs xfsdebug' command.
+Change the debugging with the `fs nnpfsdebug' command.
- datan:~# fs xfsdebug
- xfsdebug is: none
- datan:~# fs xfsdebug almost-all
+ datan:~# fs nnpfsdebug
+ nnpfsdebug is: none
+ datan:~# fs nnpfsdebug almost-all
datan:~#
If it crashes before you have an opportunity to set the debug level, you
-will have to edit `xfs/YOUR-OS/xfs_deb.c' and recompile.
+will have to edit `nnpfs/YOUR-OS/nnpfs_deb.c' and recompile.
-The logging of xfs ends up in your syslog. Syslog usully logs to
+The logging of nnpfs ends up in your syslog. Syslog usully logs to
/var/log or /var/adm (look in /etc/syslog.conf).

-File: arla.info, Node: xfs on linux, Next: Debugging techniques, Prev: xfs, Up: Debugging
+File: arla.info, Node: nnpfs on linux, Next: Debugging techniques, Prev: nnpfs, Up: Debugging
-xfs on linux
+nnpfs on linux
============
There is a problem with klogd, it's too slow. Cat the `/proc/kmsg' file
@@ -1198,7 +1370,7 @@ from the ring-bufer, and you will only get some of the message in your
cat.

-File: arla.info, Node: Debugging techniques, Next: Kernel debuggers, Prev: xfs on linux, Up: Debugging
+File: arla.info, Node: Debugging techniques, Next: Kernel debuggers, Prev: nnpfs on linux, Up: Debugging
Debugging techniques
====================
@@ -1232,7 +1404,7 @@ Kernel debuggers
================
Kernel debuggers are the most useful tool when you are trying to figure
-out what's wrong with xfs. Unfortunately they also seem to have their
+out what's wrong with nnpfs. Unfortunately they also seem to have their
own life and do not always behave as expected.
Using GDB
@@ -1246,14 +1418,14 @@ same. You get the idea from the NetBSD example below:
(gdb) symbol-file /sys/arch/i386/compile/NUTCRACKER/netbsd.gdb
This example loads the kernel symbols into gdb. But this doesn't show
-the xfs symbols, and that makes your life harder.
+the nnpfs symbols, and that makes your life harder.
Getting all symbols loaded at the same time
-------------------------------------------
-If you want to use the symbols of xfs, there is a gdb command called
+If you want to use the symbols of nnpfs, there is a gdb command called
`add-symbol-file' that is useful. The symbol file is obtained by
-loading the kernel module xfs with `kmodload -o /tmp/xfs-sym' (Darwin)
+loading the kernel module nnpfs with `kmodload -o /tmp/nnpfs-sym' (Darwin)
or `modload' (NetBSD and OpenBSD). FreeBSD has a linker in the kernel
that does the linking instead of relying on `ld'. The symbol address
where the module is loaded get be gotten from `modstat', `kldstat' or
@@ -1269,9 +1441,9 @@ You should also source the commands in /sys/gdbscripts (NetBSD), or
System/xnu/osfmk/.gdbinit (Darwin) to get commands like ps inside gdb.
datan:~# modstat Type Id Off Loadaddr Size Info Rev Module
- Name DEV 0 29 ce37f000 002c ce388fc0 1 xfs_mod [...]
+ Name DEV 0 29 ce37f000 002c ce388fc0 1 nnpfs_mod [...]
[...]
- (gdb) add-symbol-table xfs.sym ce37f000
+ (gdb) add-symbol-table nnpfs.sym ce37f000
Debugging processes, examine their stack, etc
---------------------------------------------
@@ -1293,10 +1465,10 @@ Debugging Linux
You can't get a crashdump for linux with patching the kernel. There are
two projects have support for this. Mission Critical Linux
-`http://www.missioncritiallinux.com' and SGI `http://oss.sgi.com/'.
+<http://www.missioncritiallinux.com> and SGI <http://oss.sgi.com/>.
Remember save the context of /proc/ksyms before you crash, since this is
-needed to figure out where the xfs symbols are located in the kernel.
+needed to figure out where the nnpfs symbols are located in the kernel.
But you can still use the debugger (or objdump) to figure out where in
the binary that you crashed.
@@ -1309,7 +1481,7 @@ Using adb
Adb is not a symbolic debugger, this means that you have to read the
disassembled object-code to figure out where it made the wrong turn and
died. You might be able to use GNU objdump to list the assembler and
-source-code intertwined (`objdump -S -d mod_xfs.o'). Remember that GNU
+source-code intertwined (`objdump -S -d mod_nnpfs.o'). Remember that GNU
binutils for sparc-v9 isn't that good yet.
You can find the script that use use for the adb command `$<' in
@@ -1347,7 +1519,7 @@ File: arla.info, Node: Darwin/MacOS X, Next: Porting, Prev: Kernel debuggers,
Darwin/MacOS X
==============
-You'll need two computers to debug arlad/xfs on darwin since the common
+You'll need two computers to debug arlad/nnpfs on darwin since the common
way to debug is to use a remote kernel-debugger over IP/UDP.
First you need to publish the arp-address of the computer that you are
@@ -1357,32 +1529,32 @@ We have not found any kernel symbols in MacOSX Public Beta, so you
should probably build your own kernel. Use Darwin xnu kernel source
with cvs-tag: Apple-103-0-1 (not xnu-103).
- gdb xfs.out
+ gdb nnpfs.out
target remote-kdp
add-symbol-table ...
attach <host>

-File: arla.info, Node: Porting, Next: Oddities, Prev: Darwin/MacOS X, Up: Top
+File: arla.info, Node: Porting, Next: Programming, Prev: Darwin/MacOS X, Up: Top
Porting
*******
The largest part of the work needed to port Arla to a new operating
-system is in porting xfs, as kernel programming always is harder, less
+system is in porting nnpfs, as kernel programming always is harder, less
portable and messier than user-space dito. Arla in test mode
(`arla-cli') should work without any porting on any system that's not
very far away from Unix and that provides berkeley sockets (including
-cygwin32). The hard part is porting the XFS kernel module, and we will
+cygwin32). The hard part is porting the NNPFS kernel module, and we will
spent most of this text on how to do that.
* Menu:
* Porting user-space::
-* Porting XFS::
+* Porting NNPFS::

-File: arla.info, Node: Porting user-space, Next: Porting XFS, Prev: Porting, Up: Porting
+File: arla.info, Node: Porting user-space, Next: Porting NNPFS, Prev: Porting, Up: Porting
user-space
==========
@@ -1419,9 +1591,9 @@ assembler, `savecontext' and `returnto' that save and restore the
processor context.

-File: arla.info, Node: Porting XFS, Prev: Porting user-space, Up: Porting
+File: arla.info, Node: Porting NNPFS, Prev: Porting user-space, Up: Porting
-XFS
+NNPFS
===
1. It helps to have source code for your operating system.
@@ -1440,7 +1612,7 @@ XFS
3. Be lazy
- Try to find out what other XFS port is most similar to your OS and
+ Try to find out what other NNPFS port is most similar to your OS and
start with that code.
4. Figure out how your kernel works.
@@ -1518,14 +1690,14 @@ XFS
2. Then add a device driver to the module which dummy functions
and verify that works.
- 3. Try to fit the device driver functions in `xfs_dev.c' into the
+ 3. Try to fit the device driver functions in `nnpfs_dev.c' into the
device driver.
4. Do a dummy module with a system call and verify that you can
call it.
5. Start trying to add enough of the vfs/vnode operations from
- `xfs_vfsops.c' and `xfs_vnodeops.c' so that you can build it.
+ `nnpfs_vfsops.c' and `nnpfs_vnodeops.c' so that you can build it.
6. Debug it.
@@ -1534,7 +1706,256 @@ XFS

-File: arla.info, Node: Oddities, Next: Arla timeline, Prev: Porting, Up: Top
+File: arla.info, Node: Programming, Next: Oddities, Prev: Porting, Up: Top
+
+Programming
+***********
+
+This chapter is programming documentation of arla's internal parts.
+
+This is just to cover the ideas of the implemation, but documentation
+of the actual code, please see commends in the source code for that.
+
+* Menu:
+
+* Arla pioctl's:: Documentation of arla pioctl's
+* Disco with arla:: Disconnected mode
+* afsUUID:: afs UUID
+
+
+File: arla.info, Node: Arla pioctl's, Next: Disco with arla, Prev: Programming, Up: Programming
+
+Arla pioctl's
+*************
+
+This chaper documents arla pioctl's. Arla's pioct are in the `A' range
+of the pioctls. OpenAFS uses `O' and orignal Transarc uses `V'.
+
+ `AIOC_STATISTICS'
+
+ XXX max constants
+
+ 1. `opcode STATISTICS_OPCODE_LIST'
+
+ Get a specific host/partition entry.
+
+ 2. `opcode STATISTICS_OPCODE_GETENTRY'
+
+ Get a specific entry. The 5 values that are passed in are:
+ opcode (STATISTICS_OPCODE_GETENTRY), ipv4-host-address,
+ partition, type-of-data, slot in the histogram.
+
+ Possible types of data are:
+
+ 1. `STATISTICS_REQTYPE_FETCHSTATUS'
+
+ 2. `STATISTICS_REQTYPE_FETCHDATA'
+
+ 3. `STATISTICS_REQTYPE_BULKSTATUS'
+
+ 4. `STATISTICS_REQTYPE_STOREDATA'
+
+ 5. `STATISTICS_REQTYPE_STORESTATUS'
+
+
+
+ `AIOC_PTSNAMETOID'
+
+ Return a pts name to id for a cell, the cell is referenced by the
+ file that is passed into the request, or by name.
+
+ XXX document format
+
+
+
+File: arla.info, Node: Disco with arla, Next: afsUUID, Prev: Arla pioctl's, Up: Programming
+
+Disco with arla
+***************
+
+Disconnected operation of arla.
+
+The Log
+=======
+
+The binary log is written to a file. All entries are of variable size.
+A entry is never removed from the log *note Log entry optimization::.
+
+One log entry
+-------------
+
+One log entry consists of a log header with magic cookie, opcode,
+checksum, and length. The entry is is always 4 byte aligned in the
+logfile. The checksum is a simple one, its just to verify that for
+data corruption hasn't occured and to make sure the entry is a valid
+one.
+
+Disconnected vs connected nodes
+-------------------------------
+
+A FCacheNode is either a "disconnected node" or a "connected node". The
+later means that the node was created when arla was in connected mode
+and thus (potentially) exist on the file server.
+
+A disconnected node on the other hand was created when is disconnected
+operation. A disconnected node always have one or more entries in the
+log.
+
+Log entry offset
+----------------
+
+The offset of the entry, a unsigned 32 bit number, is called
+"disco_id". Its stored in the FCacheNode so it can be updated when
+there is a operation on this node. All nodes for a FCacheEntry are
+single linked list (from the newest log entry to the oldest), the
+optimizer uses this to modify all previous entries from a FCacheNode.
+
+A FCacheNode with disco_id equal to 0 is a connected node that there
+have been no disconnected operation made on.
+
+The first entry in the log is a nop entry to make sure not a log-offset
+that is for a "real" entry.
+
+The limit of number of entries in the log are 2^32 / the size of the
+largest entry since the offset is a 32 bit number.
+
+Log entry optimization
+======================
+
+To try to preserve bandwith when reinterating there are dependencies
+between entries. First we try to avoid storing data to the fileserver
+that was never meant to got there. For example a file that was created
+and then removed in disconnected mode, ie `DISCO_HEADER_NOP' is set in
+the flags field in the header.
+
+Removal operations
+------------------
+
+When a node is removed and the node is a disconnected node, the all
+previous entries are optizmied away by setting a flags in their entry
+headers. This make this entry/nodes be ignored by the reintergration
+code and never commited to the fileserver.
+
+Moveing a disconnected node
+---------------------------
+
+If a disconnected node is moved, it will be created in the target
+directory instead of first being created and then moved.
+
+Storestatus and storedata
+-------------------------
+
+Also, all entries for one node storestate/storestatus are compressed to
+one createnode (and if needed storedata).
+
+data storage
+============
+
+common data types
+-----------------
+
+fid - VenusFid equivalent storestatus - AFSStoreStatus equivalent
+
+ 1. `nop'
+
+ needs to be smaller or equal in size then the rest
+
+ data storage: header flags fid
+
+ 2. `storedata'
+
+ (truncation is a storedata)
+
+ data storage: header fid storestatus size
+
+ 3. `storestatus'
+
+ data storage: header fid storestatus
+
+ 4. `createfile'
+
+ data storage: header parentfid fid storestatus
+ name[AFSNAMEMAX]
+
+ 5. `createsymlink'
+
+ data storage: header parentfid fid storestatus
+ name[AFSNAMEMAX] targetname[AFSNAMEMAX]
+
+ 6. `createlink'
+
+ data storage: header parentfid fid storestatus
+ name[AFSNAMEMAX] targetfid
+
+ 7. `unlink'
+
+ data storage: header parentfid fid /* dup info */
+ name[AFSNAMEMAX]
+
+ 8. `createdir'
+
+ data storage: header parentfid fid /* dup info */
+ storestatus name[AFSNAMEMAX]
+
+ 9. `removedir'
+
+ data storage: header parentfid fid /* dup info */
+ name[AFSNAMEMAX]
+
+
+reintegration
+=============
+
+Cook-book
+---------
+
+ 1. make sure first entry in the log is a nop entry
+
+ 2. if nop entry or `DISCO_HEADER_NOP' is set, continue to next
+
+ 3. the parent fid is transformed to a connected fid (if needed) it
+ this failes, we are unhappy and save this node for collision
+ recovery
+
+ 4. the fid is transformed to a connected fid (if needed) it this
+ failes, we are unhappy and save this node for collision recovery
+
+ 5. operation is performed
+
+ 6. if there is change on a fid
+
+ 1. update kernelhandle
+
+ 2. update fcachehandle
+
+ 3. update directory fid for this name (if needed)
+
+ 4. transformed fids are stored in the transformation table
+
+
+
+
+File: arla.info, Node: afsUUID, Prev: Disco with arla, Up: Programming
+
+afsUUID
+*******
+
+`AFS' uses a `DCE UUID' (Microsoft GUID is a another version of a DCE
+UUID) is identify file servers and callback managers. The callback
+manager regenerate its `uuid' every time it restarts.
+
+The fileserver stores its `uuid' on disk and uses it to identify it
+self when registering its addresses with the VLDB-server.
+
+The `afsUUID' is special in some implementations since it uses the
+ip-address as the node identifier instead of the mac-address (IEEE OUI
++ node address). Also the time in DCE is based on Unix epoch instead
+of DCE epoch. This will cause problems in about 287 years when the old
+generated afs UUID till start to collide with new genrated DCE UUIDs.
+Hopefully people have a solution to this problem then.
+
+
+File: arla.info, Node: Oddities, Next: Themis, Prev: Programming, Up: Top
Oddities
********
@@ -1551,6 +1972,7 @@ AFS
* Mountpoints have the mode-bits 0644, if they don't they are
symlinks (and have the mode-bits 0755).
+
Operating systems
=================
@@ -1564,17 +1986,104 @@ Operating systems
* Reclen (in struct dirent) shouldn't be too large. When its larger
then the buffer used in opendir/readdir/closedir, you loose.
+
+
+File: arla.info, Node: Themis, Next: Arla timeline, Prev: Oddities, Up: Top
+
+Themis
+******
+
+`Themis' is a tool for keeping local file systems up-to-date with a
+file system description.
+
+All lines in the input file consist of white-space separated fields. For
+all directives except the `exclude' directive consist of one uppercase
+letter, and flags can be added directly after the directive letter.
+Flags can be specified in any order, and consist of uppercase letters.
+
+If owner, group or mode is not specified, implicit values are used.
+The default implicit values are `root' for owner, `wheel' for group,
+`755' for directory mode bits and `644' for file mode bits.
+
+These are the directives:
+
+ * F<flags> <destination> <source> [<owner> <group>] [<mode>]
+
+ Indicates the presence of a file.
+
+ * D<flags> <destination> [<owner> <group>] [<mode>]
+
+ Indicates the presence of a directory.
+
+ * T<flags> <destination> <source> [<owner> <group>] [<mode>]
+
+ Indicates the presence of a directory tree.
+
+ * L<flags> <destination> <link data>
+
+ Indicates the presence of a symbolic link.
+
+ * N<flags> <destination>
+
+ Indicates that themis should ignore that file/directory. If the
+ file exists, it is left alone.
+
+ * X<flags> <destination>
+
+ Indicates that themis should remove the file/directory.
+
+ * M<flags> <destination> [<owner> <group>] [<mode>]
+
+ Modifies the flags, owner, group and mode of the (already
+ specified) destination.
+
+ * exclude <pattern>
+
+ In a tree traversal, excludes all files that match <pattern>.
+ Normal shell-style globbing can be used. Default exclution
+ patterns that are included are: `.' and `..'. Also, when running
+ with -macosx flag `._*' files are excluded.
+
+ Common pattern to start to exclude are `*~', `RCS', `.OldFiles',
+ `*,v', and `*.core'.
+
+
+These are the flags:
+
+ * `A' The source path is absolute. When this flag is not specified,
+ the destination path is appended to the source path.
+
+ * `I' The file should not be overwritten if it exists.
+
+ * `O' Rename existing files to .old, instead of overwriting them.
+
+ * `Q' Exit with error level 4 to indicate that the file has changed.
+ This can be used to check if a reboot is needed when certain
+ critical files change.
+
+ * `R' Only valid on directories (`D' and `T' directives). Specifies
+ that the directory should be cleaned of any files that are not in
+ the description file.
+
+ * `P' Replaces the implicit owner, group and mode bits with the
+ values from the source file.
+
+
+Normally, the input file should be pre-processed by mpp, m4, or some
+other pre-processor, to enable conditional processing and include files.
+

-File: arla.info, Node: Arla timeline, Next: Authors, Prev: Oddities, Up: Top
+File: arla.info, Node: Arla timeline, Next: Authors, Prev: Themis, Up: Top
Arla timeline
*************
Arla have existed for quite some years.
-Development started around XXX by Björn Grönvall <bg@nada.kth.se>,
-quick followers was Assar <assar@sics.se> (at that time
-<assar@pdc.kth.se>) and Johan Danielsson <joda@pdc.kth.se>. The
+Development started in fall 1993 by Björn Grönvall <bg@nada.kth.se>
+(with an rxkad implantation), he had a working read-only implementation
+in winter 1994. Quick followers was Assar <assar@sics.se> (at that time
+<assar@pdc.kth.se>>) and Johan Danielsson <<joda@pdc.kth.se>>. The
platform that was chosen was Sparc SunOS4 (the OS that NADA, KTH was
using).
@@ -1597,12 +2106,12 @@ the local computer club at KTH. Other free OS:es, as NetBSD, FreeBSD
and Linux(primarily sparc) were also in need of AFS clients.
In TokKOM, a local communications system using LysKOM
-(`http://www.lysator.liu.se/lyskom/'), Assar suggested to some club
+(<http://www.lysator.liu.se/lyskom/>), Assar suggested to some club
members that it would be a nice thing to resume the arla development.
Some people suggested that it would be less trouble having someone with
access to the Transarc AFS source code port the code to the relevent
-platforms. Assar then ported xfs to FreeBSD 2.2.x in notime (over the
+platforms. Assar then ported nnpfs to FreeBSD 2.2.x in notime (over the
night), just to show the high portability.
People started to understand that arla was a concept that would work,
@@ -1618,7 +2127,7 @@ concentrating on OpenBSD kernel stuff.
The first entry in ChangeLog is dated Fri Oct 24 17:20:40 1997. Around
this time arla was given a CVS tree, to ease development. Now you could
-also mount the xfs-device and get the root-directory out of it.
+also mount the nnpfs-device and get the root-directory out of it.
The Linux port was done in a few weeks in the beginning of 1998. Only
the Linux 2.0 kernel was supported at this time.
@@ -1665,17 +2174,17 @@ Assar Westerlund, Everything
Magnus Ahltorp, Everything
-Artur Grabowski, BSD xfs, OpenBSD maintainer
+Artur Grabowski, BSD nnpfs, OpenBSD maintainer
Love Hörnquist-Åstrand, Everything
-Robert Burgess, fs, Solaris xfs
+Robert Burgess, fs, Solaris nnpfs
-Johan Danielsson, OSF/1 xfs
+Johan Danielsson, OSF/1 nnpfs
Hans Insulander, pts, OpenBSD maintainer
-Mattias Amnefelt, vos, milko, OSF/1
+Mattias Amnefelt, vos, milko
Harald Barth, doc
@@ -1684,7 +2193,7 @@ Tomas Olsson, milko
Mikael Vidstedt (userland, some milko stuff)
Jimmy Engelbercht (bos)
-Rhapsody xfs port was contributed by Alexandra Ellwood <lxs@MIT.EDU>
+Rhapsody nnpfs port was contributed by Alexandra Ellwood <lxs@MIT.EDU>
Later, Rhapsody was renamed Darwin.
Disconnected code is written by:
@@ -1719,51 +2228,57 @@ The code for gluing these together were written by ourselves.
Bugfixes, documentation, encouragement, and code has been contributed
by:
-Aaron M. Ucko <amu@MIT.EDU>
-Alec Wolman <wolman@cs.washington.edu>
-Alexandra Ellwood <lxs@MIT.EDU>
-Brad Keryan <keryan@andrew.cmu.edu>
-Constantine Sapuntzakis <csapuntz@openbsd.org>
-Dan Winship <danw@MIT.EDU>
-Derrick J Brashear <shadow@dementia.org>
-Harald Barth <haba@pdc.kth.se>
-Jim Doyle <jrd@bu.edu>
-John Davison <davisoja@clarkson.edu>
-John Hawkinson <jhawk@MIT.EDU>
-Karl Ramm <kcr@MIT.EDU>
-Mark Eichin <eichin@kitten.gen.ma.us>
-Per Boussard T/ED <Per.Boussard@era-t.ericsson.se>
-Dima Ruban <dima@best.net>
-Max <davros@cyclone.Stanford.EDU>
-Andrzej Filinski <andrzej@daimi.aau.dk>
-Chuck Lever <chuckl@netscape.com>
-WUWEI SHEN <wwshen@engin.umich.edu>
-Cheng Jin <chengjin@eecs.umich.edu>
-Paul Callaway <pcallawa@umich.edu>
-Brandon S. Allbery <allbery@ece.cmu.edu>
-Ken Raeburn <raeburn@raeburn.org>
-Jeffrey Hutzelman <jhutz+@cmu.edu>
-Hee-Seok Heo <hsheo@postech.ac.kr>
-Paul Ewing Jr. <ewing@ima.umn.edu>
-Niklas Hallqvist <niklas@appli.se>
-Marko Asplund <aspa@hip.fi>
-Chris Wing <wingc@engin.umich.edu>
-Simon Josefsson <jas@pdc.kth.se>
-Magnus Lindström <magnus.lindstrom@s3.kth.se>
-Greg Stark <gsstark@mit.edu>
-Matt <deberg@mit.edu>
-Björn Grönvall <bg@sics.se>
+Aaron M. Ucko <amu@MIT.EDU>
+Alec Wolman <wolman@cs.washington.edu>
+Alexandra Ellwood <lxs@MIT.EDU>
+Brad Keryan <keryan@andrew.cmu.edu>
+Constantine Sapuntzakis <csapuntz@openbsd.org>
+Dan Winship <danw@MIT.EDU>
+Derrick J Brashear <shadow@dementia.org>
+Harald Barth <haba@pdc.kth.se>
+Jim Doyle <jrd@bu.edu>
+John Davison <davisoja@clarkson.edu>
+John Hawkinson <jhawk@MIT.EDU>
+Karl Ramm <kcr@MIT.EDU>
+Mark Eichin <eichin@kitten.gen.ma.us>
+Per Boussard T/ED <Per.Boussard@era-t.ericsson.se>
+Dima Ruban <dima@best.net>
+Max <davros@cyclone.Stanford.EDU>
+Andrzej Filinski <andrzej@daimi.aau.dk>
+Chuck Lever <chuckl@netscape.com>
+WUWEI SHEN <wwshen@engin.umich.edu>
+Cheng Jin <chengjin@eecs.umich.edu>
+Paul Callaway <pcallawa@umich.edu>
+Brandon S. Allbery <allbery@ece.cmu.edu>
+Ken Raeburn <raeburn@raeburn.org>
+Jeffrey Hutzelman <jhutz+@cmu.edu>
+Hee-Seok Heo <hsheo@postech.ac.kr>
+Paul Ewing Jr. <ewing@ima.umn.edu>
+Niklas Hallqvist <niklas@appli.se>
+Marko Asplund <aspa@hip.fi>
+Chris Wing <wingc@engin.umich.edu>
+Simon Josefsson <jas@pdc.kth.se>
+Magnus Lindström <magnus.lindstrom@s3.kth.se>
+Greg Stark <gsstark@mit.edu>
+Matt <deberg@mit.edu>
+Björn Grönvall <bg@sics.se>
Tino Schwarze <tino.schwarze@informatik.tu-chemnitz.de>
-David Sanderson <david@transarc.ibm.com>
+David Sanderson <david@transarc.ibm.com>
Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
Michael Sperber <sperber@informatik.uni-tuebingen.de>
-Dr. Lex Wennmacher <wennmach@geo.Uni-Koeln.DE>
-Janne Johansson <jj@dynarc.se>
-Dr A V Le Blanc <LeBlanc@mcc.ac.uk>
-Dave Morrison <dave@bnl.gov>
-Jochen Saile <saile@sfs.nphil.uni-tuebingen.de>
-Chris Kuklewicz <chrisk@MIT.EDU>
-Nickolai Zeldovich <kolya@MIT.EDU>
+Dr. Lex Wennmacher <wennmach@geo.Uni-Koeln.DE>
+Janne Johansson <jj@dynarc.se>
+Dr A V Le Blanc <LeBlanc@mcc.ac.uk>
+Dave Morrison <dave@bnl.gov>
+Jochen Saile <saile@sfs.nphil.uni-tuebingen.de>
+Chris Kuklewicz <chrisk@MIT.EDU>
+Nickolai Zeldovich <kolya@MIT.EDU>
+Adam Thornton <adam@sinenomine.net>
+Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
+Hidvegi <hzoli@austin.ibm.com>
+Todd T. Fries <todd@fries.net>
+Andrea Campi <andrea@webcom.it>
+William Uther <will+@cs.cmu.edu>
If you have done something and are not mentioned here, please send mail
to <arla-drinkers@stacken.kth.se>.
@@ -1782,6 +2297,9 @@ Index
* adb: Kernel debuggers.
* AFS Filespace: AFS infrastructure.
* AFSDB: AFS infrastructure.
+* afslog: Kerberos tickets and AFS tokens.
+* afsUUID: afsUUID.
+* aklog: Kerberos tickets and AFS tokens.
* ALG: NAT.
* Archives: Introduction.
* Arlad debugging: Arlad.
@@ -1792,17 +2310,26 @@ Index
* Cell: AFS infrastructure.
* CellServDB: AFS infrastructure.
* Comments: Introduction.
+* DCE UUID: afsUUID.
* Debugging: Debugging.
* Debugging arlad: Arlad.
* Debugging techniques: Debugging techniques.
-* Debugging XFS: xfs.
+* Debugging NNPFS: nnpfs.
+* Disconected operation: Disco with arla.
* DNS: AFS infrastructure.
* Fileserver: AFS infrastructure.
* Filespace: AFS infrastructure.
* Fsserver: AFS infrastructure.
* Gdb: Debugging LWP with GDB.
+* kalog: Kerberos tickets and AFS tokens.
+* kaserver: Integration with Kerberos.
+* kauth: Kerberos tickets and AFS tokens.
+* kerberosserver: Integration with Kerberos.
* Kernel debugging: Kernel debuggers.
* Kernel debuging on linux: Kernel debuggers.
+* KeyFile: Integration with Kerberos.
+* kinit: Kerberos tickets and AFS tokens.
+* klog: Kerberos tickets and AFS tokens.
* Ksymoops: Kernel debuggers.
* Linux kernel debugging: Kernel debuggers.
* Live kernel: Kernel debuggers.
@@ -1811,57 +2338,71 @@ Index
* Masquerading: NAT.
* NAT: NAT.
* PAT: NAT.
+* pts: Relationship between pts uid and unix uid.
* Ptserver: AFS infrastructure.
* Salvage: AFS infrastructure.
* Samba: Samba.
+* Themis: Themis.
+* TheseCells: Integration with Kerberos.
+* ThisCell: Integration with Kerberos.
+* Tickets: Kerberos tickets and AFS tokens.
+* Tokens: Kerberos tickets and AFS tokens.
* Ubik: AFS infrastructure.
+* uid: Relationship between pts uid and unix uid.
* Upserver: AFS infrastructure.
* Vldbserver: AFS infrastructure.
* Vlserver: AFS infrastructure.
* Volser: AFS infrastructure.
* Volumeserver: AFS infrastructure.
-* XFS debugging: xfs.
+* NNPFS debugging: nnpfs.

Tag Table:
-Node: Top217
-Node: Introduction1893
-Node: AFS infrastructure5142
-Node: Organization of data15560
-Node: Requirements16038
-Node: Data organization18097
-Node: Callbacks20286
-Node: Volume management20954
-Node: Relationship between pts uid and unix uid22277
-Node: AFS and the real world22489
-Node: NAT22937
-Node: Samba24001
-Node: Integration with Kerberos24562
-Node: Parts of Arla25417
-Node: How arla works25869
-Node: The relation between Arlad and XFS26888
-Node: The life of a file27547
-Node: Tools and libs30068
-Node: Rx protocol31285
-Node: LWP31562
-Node: The files in arlad/31974
-Node: pioctl and kafs34099
-Node: Debugging36198
-Node: Arlad36674
-Node: Debugging LWP with GDB37917
-Node: xfs39672
-Node: xfs on linux40319
-Node: Debugging techniques40664
-Node: Kernel debuggers41596
-Node: Darwin/MacOS X46009
-Node: Porting46626
-Node: Porting user-space47234
-Node: Porting XFS48997
-Node: Oddities53346
-Node: Arla timeline54253
-Node: Authors57835
-Node: Acknowledgments58662
-Node: Index62898
+Node: Top191
+Node: Introduction2110
+Node: AFS infrastructure5546
+Node: Organization of data15964
+Node: Requirements16460
+Node: Data organization18431
+Node: Callbacks20761
+Node: Volume management21446
+Node: Relationship between pts uid and unix uid22789
+Node: AFS and the real world23658
+Node: NAT24159
+Node: Samba26081
+Node: Integration with Kerberos26732
+Node: Kerberos tickets and AFS tokens28564
+Node: Parts of Arla34115
+Node: How arla works34567
+Node: The relation between Arlad and NNPFS35586
+Node: The life of a file36245
+Node: Tools and libs38767
+Node: Rx protocol39982
+Node: LWP40259
+Node: The files in arlad/40671
+Node: pioctl and kafs42796
+Node: Debugging44895
+Node: Arlad45371
+Node: Debugging LWP with GDB46614
+Node: nnpfs48369
+Node: nnpfs on linux49016
+Node: Debugging techniques49361
+Node: Kernel debuggers50293
+Node: Darwin/MacOS X54706
+Node: Porting55323
+Node: Porting user-space55934
+Node: Porting NNPFS57697
+Node: Programming62046
+Node: Arla pioctl's62481
+Node: Disco with arla63589
+Ref: Log entry optimization65373
+Node: afsUUID68205
+Node: Oddities69023
+Node: Themis69929
+Node: Arla timeline72653
+Node: Authors76325
+Node: Acknowledgments77145
+Node: Index81013

End Tag Table
diff --git a/usr.sbin/afs/src/doc/arla.texi b/usr.sbin/afs/src/doc/arla.texi
index 5fea248442b..e5abf561d7b 100644
--- a/usr.sbin/afs/src/doc/arla.texi
+++ b/usr.sbin/afs/src/doc/arla.texi
@@ -4,7 +4,7 @@
@c All rights reserved.
@c %**start of header
-@c $KTH: arla.texi,v 1.40.2.7 2001/07/16 15:39:43 lha Exp $
+@c $arla: arla.texi,v 1.53 2003/02/01 17:16:03 lha Exp $
@setfilename arla.info
@settitle ARLA
@iftex
@@ -37,13 +37,13 @@
@end ifnottex
@subtitle A Free AFS implementation from KTH
-@subtitle Edition 0.3, for Release 0.35.5
-@subtitle 1999 - 2001
+@subtitle Edition 0.3, for version 0.36
+@subtitle 1999 - 2002
@author Love Hörnquist-Åstrand
@author Assar Westerlund
@author Harald Barth
-@author last updated $KTH: 2001/07/16 15:39:43 $
+@author last updated $arla: 2003/02/01 17:16:03 $
@comment This text will show up in the output of texi2html
@def@fnotsupported{THIS TEXT MAY CONTAIN GARBLED OUTPUT BECAUSE THIS VIEW FORMAT DOES NOT SUPPORT TEXI FUNCTIONS}
@@ -56,7 +56,7 @@
@copyrightstart
@example
-Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
@@ -88,6 +88,43 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
@end example
+
+@copynext
+@example
+/*
+ * Copyright (c) 2002, Stockholms Universitet
+ * (Stockholm University, 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 university 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+ */
+@end example
+
@copynext
@example
@@ -241,14 +278,15 @@ Please send comments (and fixes) on this manual and the arla programs to
@menu
* Introduction:: Introduction to Arla.
* AFS infrastructure:: A description of the afs infrastructure.
-* Organization of data:: How diffrent data are organized in AFS.
+* Organization of data:: How different data is organized in AFS.
* AFS and the real world:: Common problems and their solutions.
-* Parts of Arla:: Description of diffrent parts of arla.
+* Parts of Arla:: Description of different parts of arla.
* Debugging:: How to debug arla when its not working.
* Porting:: That you need to know to port arla.
-* Authors:: The authors of arla.
-* Oddities:: Strange things that have happen to us.
+* Programming:: Programming documentation of arla.
+* Oddities:: Strange things that did happen to us.
* Arla timeline:: Short timeline of arla.
+* Authors:: The authors of arla.
* Acknowledgments:: People that have helped us.
* Index:: Index.
@c * Building and Installing::
@@ -273,22 +311,24 @@ How to cope with reality
* NAT::
* Samba::
+* Integration with Kerberos::
+* Kerberos tickets and AFS tokens::
The parts of arla
* How arla works::
-* The relation between Arlad and XFS::
+* The relation between Arlad and NNPFS::
* The life of a file::
* Tools and libs::
* The files in arlad/::
* pioctl and kafs::
-Yes, its doesn't work, lets debug.
+How to debug arla when its not working
* Arlad::
* Debugging LWP with GDB::
-* xfs::
-* xfs on linux::
+* nnpfs::
+* nnpfs on linux::
* Debugging techniques::
* Kernel debuggers::
* Darwin/MacOS X::
@@ -297,7 +337,14 @@ Porting arla
* Porting::
* Porting user-space::
-* Porting XFS::
+* Porting NNPFS::
+
+Programming
+
+* Programming::
+* Disco with arla::
+* afsUUID::
+@c * NNPFS interface::
Odd stuff you find when looking around
@@ -324,6 +371,7 @@ Miscellaneous
@include partsofarla.texi
@include debugging.texi
@include porting.texi
+@include prog.texi
@include oddities.texi
@include timeline.texi
@include authors.texi
diff --git a/usr.sbin/afs/src/doc/authors.texi b/usr.sbin/afs/src/doc/authors.texi
index 779a32e89c3..7762dcf7d8d 100644
--- a/usr.sbin/afs/src/doc/authors.texi
+++ b/usr.sbin/afs/src/doc/authors.texi
@@ -2,9 +2,10 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: authors.texi,v 1.13.2.1 2001/06/05 02:08:16 mattiasa Exp $
+@c $arla: authors.texi,v 1.15 2002/09/07 10:43:49 lha Exp $
@node Authors, Acknowledgments, Arla timeline, Top
+@comment node-name, next, previous, up
@chapter Authors
Currently writing on arla are
@@ -12,19 +13,19 @@ Currently writing on arla are
@table @asis
@item Assar Westerlund, Everything
@item Magnus Ahltorp, Everything
-@item Artur Grabowski, BSD xfs, OpenBSD maintainer
+@item Artur Grabowski, BSD nnpfs, OpenBSD maintainer
@item Love Hörnquist-Åstrand, Everything
-@item Robert Burgess, fs, Solaris xfs
-@item Johan Danielsson, OSF/1 xfs
+@item Robert Burgess, fs, Solaris nnpfs
+@item Johan Danielsson, OSF/1 nnpfs
@item Hans Insulander, pts, OpenBSD maintainer
-@item Mattias Amnefelt, vos, milko, OSF/1
+@item Mattias Amnefelt, vos, milko
@item Harald Barth, doc
@item Tomas Olsson, milko
@item Mikael Vidstedt (userland, some milko stuff)
@item Jimmy Engelbercht (bos)
@end table
-Rhapsody xfs port was contributed by Alexandra Ellwood <lxs@@MIT.EDU>
+Rhapsody nnpfs port was contributed by Alexandra Ellwood <lxs@@MIT.EDU>
Later, Rhapsody was renamed Darwin.
Disconnected code is written by:
diff --git a/usr.sbin/afs/src/doc/debugging.texi b/usr.sbin/afs/src/doc/debugging.texi
index effa91f61f1..0dd4a3d9ef6 100644
--- a/usr.sbin/afs/src/doc/debugging.texi
+++ b/usr.sbin/afs/src/doc/debugging.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: debugging.texi,v 1.26 2001/01/08 18:01:07 lha Exp $
+@c $arla: debugging.texi,v 1.28 2002/11/29 19:53:00 tol Exp $
@node Debugging, Arlad, Parts of Arla, Top
@chapter Debugging
@@ -12,15 +12,15 @@
This chapter of the manual includes tips that are useful when debugging
arla.
-Arla and xfs contains logging facilities that is quite useful when
+Arla and nnpfs contains logging facilities that is quite useful when
debugging when something goes wrong. This and some kernel debugging tips
are described.
@menu
* Arlad::
* Debugging LWP with GDB::
-* xfs::
-* xfs on linux::
+* nnpfs::
+* nnpfs on linux::
* Debugging techniques::
* Kernel debuggers::
* Darwin/MacOS X::
@@ -70,7 +70,7 @@ datan:~#
By default, arlad logs through syslog if running as a daemon and to
stderr when running in the foreground (with @kbd{--no-fork}).
-@node Debugging LWP with GDB, xfs, Arlad, Debugging
+@node Debugging LWP with GDB, nnpfs, Arlad, Debugging
@comment node-name, next, previous, up
@section Debugging LWP with GDB
@@ -123,35 +123,35 @@ Print backtrace of FRAMEPOINTER and PROGRAMCOUNTER.
There also the possibility to run arla with pthreads (run configure with
--with-pthreads).
-@node xfs, xfs on linux, Debugging LWP with GDB, Debugging
+@node nnpfs, nnpfs on linux, Debugging LWP with GDB, Debugging
@comment node-name, next, previous, up
-@section xfs
+@section nnpfs
-@cindex Debugging XFS
-@cindex XFS debugging
+@cindex Debugging NNPFS
+@cindex NNPFS debugging
-XFS debugging does almost look the same on all platforms. They
+NNPFS debugging does almost look the same on all platforms. They
all share same debugging flags, but not all are enabled on all
platforms.
-Change the debugging with the @kbd{fs xfsdebug} command.
+Change the debugging with the @kbd{fs nnpfsdebug} command.
@example
-datan:~# fs xfsdebug
-xfsdebug is: none
-datan:~# fs xfsdebug almost-all
+datan:~# fs nnpfsdebug
+nnpfsdebug is: none
+datan:~# fs nnpfsdebug almost-all
datan:~#
@end example
If it crashes before you have an opportunity to set the debug level, you
-will have to edit @file{xfs/@var{your-os}/xfs_deb.c} and recompile.
+will have to edit @file{nnpfs/@var{your-os}/nnpfs_deb.c} and recompile.
-The logging of xfs ends up in your syslog. Syslog usully logs to /var/log
+The logging of nnpfs ends up in your syslog. Syslog usully logs to /var/log
or /var/adm (look in /etc/syslog.conf).
-@node xfs on linux, Debugging techniques, xfs, Debugging
+@node nnpfs on linux, Debugging techniques, nnpfs, Debugging
@comment node-name, next, previous, up
-@section xfs on linux
+@section nnpfs on linux
There is a problem with klogd, it's too slow. Cat the @file{/proc/kmsg}
file instead. Remember to kill klogd, since the reader will delete the
@@ -159,7 +159,7 @@ text from the ring-bufer, and you will only get some of the message in
your cat.
-@node Debugging techniques, Kernel debuggers, xfs on linux, Debugging
+@node Debugging techniques, Kernel debuggers, nnpfs on linux, Debugging
@comment node-name, next, previous, up
@section Debugging techniques
@@ -193,7 +193,7 @@ Make sure bugs don't get reintroduced.
@cindex Kernel debugging
Kernel debuggers are the most useful tool when you are trying to figure
-out what's wrong with xfs. Unfortunately they also seem to have their
+out what's wrong with nnpfs. Unfortunately they also seem to have their
own life and do not always behave as expected.
@subsection Using GDB
@@ -208,13 +208,13 @@ same. You get the idea from the NetBSD example below:
@end example
This example loads the kernel symbols into gdb. But this doesn't show
-the xfs symbols, and that makes your life harder.
+the nnpfs symbols, and that makes your life harder.
@subsection Getting all symbols loaded at the same time
-If you want to use the symbols of xfs, there is a gdb command called
+If you want to use the symbols of nnpfs, there is a gdb command called
@samp{add-symbol-file} that is useful. The symbol file is obtained by
-loading the kernel module xfs with @samp{kmodload -o /tmp/xfs-sym}
+loading the kernel module nnpfs with @samp{kmodload -o /tmp/nnpfs-sym}
(Darwin) or @samp{modload} (NetBSD and OpenBSD). FreeBSD has a linker
in the kernel that does the linking instead of relying on @samp{ld}. The
symbol address where the module is loaded get be gotten from
@@ -223,7 +223,7 @@ symbol address where the module is loaded get be gotten from
If you forgot the to run modstat/kldstat/kmodstat, you can extract the
information from the kernel. In Darwin you look at the variable kmod
-(you might have to case it to a (kmod_info_t *). We have seen gdb loose
+(you might have to case it to a (kmod_info_t *). We have seen gdb lose
the debugging info). kmod is the start of a linked list. Other BSDs have
some variant of this.
@@ -232,9 +232,9 @@ System/xnu/osfmk/.gdbinit (Darwin) to get commands like ps inside gdb.
@example
datan:~# modstat Type Id Off Loadaddr Size Info Rev Module
- Name DEV 0 29 ce37f000 002c ce388fc0 1 xfs_mod [...]
+ Name DEV 0 29 ce37f000 002c ce388fc0 1 nnpfs_mod [...]
[...]
- (gdb) add-symbol-table xfs.sym ce37f000
+ (gdb) add-symbol-table nnpfs.sym ce37f000
@end example
@subsection Debugging processes, examine their stack, etc
@@ -262,7 +262,7 @@ two projects have support for this. Mission Critical Linux
@url{http://oss.sgi.com/}.
Remember save the context of /proc/ksyms before you crash, since this is
-needed to figure out where the xfs symbols are located in the kernel.
+needed to figure out where the nnpfs symbols are located in the kernel.
But you can still use the debugger (or objdump) to figure out where in
the binary that you crashed.
@@ -278,7 +278,7 @@ the binary that you crashed.
Adb is not a symbolic debugger, this means that you have to read the
disassembled object-code to figure out where it made the wrong turn and
died. You might be able to use GNU objdump to list the assembler and
-source-code intertwined (@samp{objdump -S -d mod_xfs.o}). Remember that
+source-code intertwined (@samp{objdump -S -d mod_nnpfs.o}). Remember that
GNU binutils for sparc-v9 isn't that good yet.
You can find the script that use use for the adb command @samp{$<} in
@@ -319,7 +319,7 @@ coredump to extract information on some system.
@comment node-name, next, previous, up
@section Darwin/MacOS X
-You'll need two computers to debug arlad/xfs on darwin since the common
+You'll need two computers to debug arlad/nnpfs on darwin since the common
way to debug is to use a remote kernel-debugger over IP/UDP.
First you need to publish the arp-address of the computer that you are
@@ -330,7 +330,7 @@ should probably build your own kernel. Use Darwin xnu kernel source
with cvs-tag: Apple-103-0-1 (not xnu-103).
@example
-gdb xfs.out
+gdb nnpfs.out
target remote-kdp
add-symbol-table ...
attach <host>
diff --git a/usr.sbin/afs/src/doc/intro.texi b/usr.sbin/afs/src/doc/intro.texi
index 6437b974d0f..8cecde5d907 100644
--- a/usr.sbin/afs/src/doc/intro.texi
+++ b/usr.sbin/afs/src/doc/intro.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: intro.texi,v 1.15 2000/12/01 08:32:09 lha Exp $
+@c $arla: intro.texi,v 1.16 2002/05/26 14:48:26 lha Exp $
@node Introduction, AFS infrastructure, Top, Top
@comment node-name, next, previous, up
@@ -104,3 +104,7 @@ There is also commit list
The list are achived on
@url{http://www.stacken.kth.se/lists/}.
+
+Please note that the mailinglists have a policy of subscriber only
+posting. So if you want to mail a message to the list, subscribe to it
+first, otherwise it wont be posted on the list.
diff --git a/usr.sbin/afs/src/doc/oddities.texi b/usr.sbin/afs/src/doc/oddities.texi
index 07ba804a28d..489f1abd9e1 100644
--- a/usr.sbin/afs/src/doc/oddities.texi
+++ b/usr.sbin/afs/src/doc/oddities.texi
@@ -2,9 +2,9 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: oddities.texi,v 1.7 2000/10/03 01:09:56 lha Exp $
+@c $arla: oddities.texi,v 1.11 2003/02/01 17:15:44 lha Exp $
-@node Oddities, Arla timeline, Porting, Top
+@node Oddities, Arla timeline, Programming, Top
@chapter Oddities
@c ----------------------------------------------------
@@ -37,7 +37,7 @@ programs (like make) "knows" that the two first entries are . and .. and
thus can be skiped.
@item Reclen (in struct dirent) shouldn't be too large. When its
-larger then the buffer used in opendir/readdir/closedir, you loose.
+larger then the buffer used in opendir/readdir/closedir, you lose.
@end itemize
diff --git a/usr.sbin/afs/src/doc/partsofarla.texi b/usr.sbin/afs/src/doc/partsofarla.texi
index 7e215855fef..42f2441e2f3 100644
--- a/usr.sbin/afs/src/doc/partsofarla.texi
+++ b/usr.sbin/afs/src/doc/partsofarla.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: partsofarla.texi,v 1.19 2000/11/25 11:24:06 lha Exp $
+@c $arla: partsofarla.texi,v 1.21 2003/01/11 00:29:05 lha Exp $
@node Parts of Arla, Debugging, AFS and the real world, Top
@comment node-name, next, previous, up
@@ -17,7 +17,7 @@ For real info read the code. If you have any questions, mail
@menu
* How arla works::
-* The relation between Arlad and XFS::
+* The relation between Arlad and NNPFS::
* The life of a file::
* Tools and libs::
* The files in arlad/::
@@ -25,34 +25,34 @@ For real info read the code. If you have any questions, mail
@end menu
@comment -----------------------------------------------------
-@node How arla works, The relation between Arlad and XFS, Parts of Arla, Parts of Arla
+@node How arla works, The relation between Arlad and NNPFS, Parts of Arla, Parts of Arla
@heading How does arla work
Arla consists of two parts, a userland process (arlad) and the
-kernel-module (xfs).
+kernel-module (nnpfs).
Arlad is written in user-space for simpler debugging (and less rebooting).
As a uset space program arlad does not have the same limitations as if it
would be written in the kernel. To avoid performance loss as much as possible,
-xfs is caching data.
+nnpfs is caching data.
@c XXX ptr to coda and arla-usenix paper
-xfs and arlad communicate with each other via a char-device-driver.
+nnpfs and arlad communicate with each other via a char-device-driver.
There is a rpc-protocol currenly used specially written for this
(@file{arlad/message.c})
-xfs is written to be as simple as possible. Theoretically, xfs could
+nnpfs is written to be as simple as possible. Theoretically, nnpfs could
be used by other user-space daemons to implement a file system. Some
parts, such as syscalls, are arla-specific. These parts are designed
to be as general as possible.
-For example, xfs does not recognize which pioctl the user-level
+For example, nnpfs does not recognize which pioctl the user-level
program calls, it just passes this information on to arlad.
@comment -----------------------------------------------------
-@node The relation between Arlad and XFS, The life of a file, How arla works, Parts of Arla
-@heading The relation between Arlad and XFS
+@node The relation between Arlad and NNPFS, The life of a file, How arla works, Parts of Arla
+@heading The relation between Arlad and NNPFS
@example
Userland
@@ -62,19 +62,19 @@ Userland
| ---------
----|-----------------|[1]----
------- -------
-Kernel | VFS | <--[2]--> | XFS |
+Kernel | VFS | <--[2]--> | NNPFS |
------- -------
@end example
@table @asis
-@item [1] A char device (/dev/xfs0)
+@item [1] A char device (/dev/nnpfs0)
@item [2] Xfs provides a filesystem for the vfs-layer in
the operating system.
@end table
@comment -----------------------------------------------------
-@node The life of a file, Tools and libs, The relation between Arlad and XFS, Parts of Arla
+@node The life of a file, Tools and libs, The relation between Arlad and NNPFS, Parts of Arla
@section The life of a file
@comment This a rough description of the life of a file.
@@ -89,40 +89,40 @@ in most operating systems.
@item open(2) syscall is issued.
-@item The vfslayer sends a VOP_LOOKUP to xfs that is forwarded
+@item The vfslayer sends a VOP_LOOKUP to nnpfs that is forwarded
to arlad with a getnode() (seq-num 1).
@item arlad tries to find the requested file and then, if found, sends an
-install_node to xfs by writing to the xfs character device.
+install_node to nnpfs by writing to the nnpfs character device.
-@item xfs inserts the node into the cache and returns from the device write.
+@item nnpfs inserts the node into the cache and returns from the device write.
-@item arlad sends a wakeup rpc message (seq-num 1) to xfs.
-If the return value is zero xfs tries to find the node in the cache, if
+@item arlad sends a wakeup rpc message (seq-num 1) to nnpfs.
+If the return value is zero nnpfs tries to find the node in the cache, if
not found it might have been flushed out of the cache and the whole
thing is repeated.
@item If a none-zero return value is returned, this value is sent
as reply to the user. This way arla can decide what error message
-is returned, without xfs having support for each error.
+is returned, without nnpfs having support for each error.
-@item xfs now checks if it has the valid attributes. If the attributes
-are invalid, xfs will send a rpc message to arlad to refresh it.
+@item nnpfs now checks if it has the valid attributes. If the attributes
+are invalid, nnpfs will send a rpc message to arlad to refresh it.
@item Since the user wanted to open the file, a getdata rpc message is
-sent from xfs to arlad. Now arlad fetches the files from the
+sent from nnpfs to arlad. Now arlad fetches the files from the
afs file server.
@item Arlad stores the file in the file cache. All vnode operations will
-be done on this file. Now arlad sends a installdata to xfs.
+be done on this file. Now arlad sends a installdata to nnpfs.
-@item When xfs recives the installdata it looks up the node in the cache,
+@item When nnpfs recives the installdata it looks up the node in the cache,
and then it does a VOP_LOOKUP to find a vnode to the cachefile (and store
it to keep it for future use).
@item The same thing is done when the file is a directory, except that
the directory is converted from the afs directory format to an operating
-system dependent format and stored in a file. xfs reads this file
+system dependent format and stored in a file. nnpfs reads this file
instead.
@item If the directory is modified locally, write operations are
@@ -133,9 +133,9 @@ changed file is converted and reinstalled.
@item read(2) system call is issued.
-@item A VOP_READ is sent to the from the vfs-layer to xfs.
+@item A VOP_READ is sent to the from the vfs-layer to nnpfs.
-@item xfs checks if it has valid attributes/and data (and updates if needed).
+@item nnpfs checks if it has valid attributes/and data (and updates if needed).
Now VOP_READ is simply performed on the stored vnode of the cachefile.
@end itemize
@@ -230,7 +230,7 @@ the items a VenusFid and you can access them this way.
@item @file{kernel.c} - The interface between arlad and the char-device.
-@item @file{messages.c} - The rpc interface between arlad and xfs.
+@item @file{messages.c} - The rpc interface between arlad and nnpfs.
@item @file{volcache.c} - Cache for all volumes.
@@ -258,7 +258,7 @@ Today it's just conv_dir().
@node pioctl and kafs, ,The files in arlad/, Parts of Arla
@heading pioctl and kafs
-The pioctl interface is the only part of xfs that is afs related.
+The pioctl interface is the only part of nnpfs that is afs related.
pioctl is a ioctl but called with a path instead of a filedescriptor.
When you probe if there is a live afsclient you first run
@@ -274,15 +274,15 @@ expects to find an @code{EINVAL} returned from @code{syscall(2)}.
The pioctl is used more then just for @code{AFSCALL_PIOCTL}, an other
use is @code{AFSCALL_SETPAG} (setting pag). It has also been in use for
-setting xfs debugging levels.
+setting nnpfs debugging levels.
-When xfs discovers that a path is given in the @code{pioctl()} it does a
+When nnpfs discovers that a path is given in the @code{pioctl()} it does a
@code{VOP_LOOKUP} on the path and if the returned value is a vnode that
-resides in afs then it extracts the xfs-handle for that node (that just
+resides in afs then it extracts the nnpfs-handle for that node (that just
happens to be the VenusFid) and passes that on to arlad.
The only ugly thing about the current implentation is that
-the syscall code assumes that the arlad on "xfs-fd" is the
+the syscall code assumes that the arlad on "nnpfs-fd" is the
arlad that should get this syscall.
An example of using @code{pioctl()}:
@@ -349,3 +349,18 @@ main (int argc, char **argv)
@c [ lha: Mark is only known to assar ]
@c [ assar: Mark == Mark Eichin ]
@c -----------------------------------------------------------
+
+@c From: Craig_Everhart@transarc.com
+@c Subject: Re: [OpenAFS] Silly question, Just interested
+@c To: <openafs-info@openafs.org>
+@c Date: Fri, 19 Jul 2002 10:00:19 -0400 (EDT)
+@c
+@c
+@c The other way around: Vice was the Vast Integrated Computing Environment
+@c on the server, and Venus was the client-side component but I don't know
+@c if it was an acronym.
+@c
+@c Craig
+@c
+
+
diff --git a/usr.sbin/afs/src/doc/porting.texi b/usr.sbin/afs/src/doc/porting.texi
index fd332c9f59d..f706839eff6 100644
--- a/usr.sbin/afs/src/doc/porting.texi
+++ b/usr.sbin/afs/src/doc/porting.texi
@@ -2,25 +2,26 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: porting.texi,v 1.11 2000/11/25 14:18:42 lha Exp $
+@c $arla: porting.texi,v 1.14 2002/09/07 10:43:55 lha Exp $
-@node Porting, Oddities, Darwin/MacOS X, Top
+@node Porting, Programming, Darwin/MacOS X, Top
+@comment node-name, next, previous, up
@chapter Porting
The largest part of the work needed to port Arla to a new operating
-system is in porting xfs, as kernel programming always is harder, less
+system is in porting nnpfs, as kernel programming always is harder, less
portable and messier than user-space dito. Arla in test mode
(@kbd{arla-cli}) should work without any porting on any system that's
not very far away from Unix and that provides berkeley sockets
-(including cygwin32). The hard part is porting the XFS kernel module,
+(including cygwin32). The hard part is porting the NNPFS kernel module,
and we will spent most of this text on how to do that.
@menu
* Porting user-space::
-* Porting XFS::
+* Porting NNPFS::
@end menu
-@node Porting user-space, Porting XFS, Porting, Porting
+@node Porting user-space, Porting NNPFS, Porting, Porting
@section user-space
The user-space parts should work on basically any system that is
@@ -53,8 +54,8 @@ have to figure out enough details on your CPU to write two functions in
assembler, @samp{savecontext} and @samp{returnto} that save and
restore the processor context.
-@node Porting XFS, , Porting user-space, Porting
-@section XFS
+@node Porting NNPFS, , Porting user-space, Porting
+@section NNPFS
@enumerate
@@ -76,7 +77,7 @@ kernel by reading the includes files in @file{<sys/*.h>}.
@item
Be lazy
-Try to find out what other XFS port is most similar to your OS and start
+Try to find out what other NNPFS port is most similar to your OS and start
with that code.
@item
@@ -166,7 +167,7 @@ Then add a device driver to the module which dummy functions and
verify that works.
@item
-Try to fit the device driver functions in @file{xfs_dev.c} into the
+Try to fit the device driver functions in @file{nnpfs_dev.c} into the
device driver.
@item
@@ -174,7 +175,7 @@ Do a dummy module with a system call and verify that you can call it.
@item
Start trying to add enough of the vfs/vnode operations from
-@file{xfs_vfsops.c} and @file{xfs_vnodeops.c} so that you can build it.
+@file{nnpfs_vfsops.c} and @file{nnpfs_vnodeops.c} so that you can build it.
@item
Debug it.
diff --git a/usr.sbin/afs/src/doc/servers.texi b/usr.sbin/afs/src/doc/servers.texi
index f5c4f3f4ab6..6588a9b5b7a 100644
--- a/usr.sbin/afs/src/doc/servers.texi
+++ b/usr.sbin/afs/src/doc/servers.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: servers.texi,v 1.10 2000/12/01 08:32:34 lha Exp $
+@c $arla: servers.texi,v 1.10 2000/12/01 08:32:34 lha Exp $
@c
@c This file contain random junk that should be ordered some day
diff --git a/usr.sbin/afs/src/doc/storage.texi b/usr.sbin/afs/src/doc/storage.texi
index 47de0a311fc..d2a34fce45d 100644
--- a/usr.sbin/afs/src/doc/storage.texi
+++ b/usr.sbin/afs/src/doc/storage.texi
@@ -1,17 +1,17 @@
-@c Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
+@c Copyright (c) 1998 - 2001 Kungliga Tekniska Högskolan
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: storage.texi,v 1.7 2000/11/25 11:23:56 lha Exp $
+@c $arla: storage.texi,v 1.9 2003/04/24 11:50:42 lha Exp $
@node Organization of data, AFS and the real world, AFS infrastructure, Top
@comment node-name, next, previous, up
@chapter Organization of data
-This chapter how data is stored and how AFS diffrent from, for example,
-NFS. It also describes how data kept consistent and what the
-requirements was and how that inpacted on the design.
+This chapter describes how data is stored and how AFS is different from,
+for example, NFS. It also describes how data is kept consistent and what
+the requirements were and how that inpacted on the design.
@menu
* Requirements::
@@ -31,13 +31,14 @@ requirements was and how that inpacted on the design.
It should be possible to use AFS with hundred-thousands of users without
problems.
-Writes that are done to diffrent parts of the filesystem should not
+Writes that are done to different parts of the filesystem should not
affect each other. It should be possible to distribute out the reads and
-writes over many file-servers. So if you have a file that is accessed by
-many clients, it should be possible to distribute out the load.
+writes over many fileservers. If you have a file that is accessed by
+many clients, it should be possible to distribute the load.
-If there is multiple writes to the same file, are you sure that isn't a
-database.
+@comment What has this to do with requirements?
+@comment If there is multiple writes to the same file, are you sure that isn't a
+@comment database.
@item Transparent to users
@@ -51,7 +52,7 @@ filesystem. For example to change quota for a user or project. It should
also be possible to move the users data for a fileserver to a less
loaded one, or one with more diskspace available.
-Some benefits of using AFS is:
+Some benefits of using AFS are:
@itemize @bullet
@item user-transparent data migration
@@ -71,8 +72,8 @@ critical data
@item No databases
AFS isn't constructed for storing databases. It would be possible to use
-AFS for storing a database if a layer above provided locking and
-synchronizing of data.
+AFS for storing a database if a layer above for locking and synchronizing
+data would be provided.
One of the problems is that AFS doesn't include mandatory byte-range
locks. AFS uses advisory locking on whole files.
@@ -86,75 +87,77 @@ solving a database problem. Don't use AFS.
@comment node-name, next, previous, up
@section Volume
-A volume is a unit that is smaller then a partition. Its usually (should
+A volume is a unit that is smaller than a partition. It is usually (or should
be) a well defined area, like a user's home directory, a project work
area, or a program distribution.
-Quota is controlled on volume-level. All day-to-day management are done
+Quota is controlled on volume-level. All day-to-day management is done
on volumes.
@section Partition
In AFS a partition is what normally is named a partition. All partions
-that afs isusing is named a special way, @file{/vicepNN}, where NN is
+that afs is using are named a special way, @file{/vicepNN}, where NN is
ranged from a to z, continuing with aa to zz. The fileserver (and
-volser) automaticly picks upp all partition starting with @file{/vicep}
+volser) automaticly picks upp all partitions starting with @file{/vicep}
-Volumes are stored in a partition. Volumes can't overlap
+Volumes are stored in a partition. Volumes can't span several
partitions. Partitions are added when the fileserver is created or when
a new disk is added to a filesystem.
@section Volume cloning and read-only clones
-A clone of volume is often needed for the volume operations. A clone is
-copy-on-write copy of a volume, the clone is the read-only version.
+A clone of a volume is often needed for volume operations. A clone is
+a copy-on-write copy of a volume, the clone is the read-only version.
-A two special versions of a clone is the read-only volume and the backup
+Two special versions of a clone are the read-only volume and the backup
volume. The read-only volume is a snapshot of a read-write volume (that
-is what a clone is) that can be replicated to several fileserver to
-distribute the load. Each fileserver plus partition where the read-only
-is located is called a replication-site.
+is what a clone is) that can be replicated to several fileservers to
+distribute the load. Each fileserver plus partition where a read-only
+clone is located is called a replication-site. It usually does not make
+sense to have more than one read-only clone on each fileserver.
The backup volume is a clone that typically is made (with @code{vos
-backupsys}) each night to enable the user to retrieve yestoday's data
+backupsys}) each night to enable the user to retrieve yesterday's data
when they happen to remove a file. This is a very useful feature, since
-it lessen the load on the system-administrators to restore files from
+it lessens the load on the system-administrators to restore files from
backup. The volume is usually mounted in the root user's home directory
under the name OldFiles. A special feature of the backup volume is that
-inside it you can't follow mountpoint.
+you can't follow mountpoints out of a backup volume.
@section Mountpoints
-The volumes are independent of each other. To clue the together there is
-a @samp{mountpoint}s. Mountpoints are really symlink that is formated a
-special way that points out a volume (and a optional cell). A
-AFS-cache-manager will show a mountpoint as directory, in fact it will
-be the root directory of the target volume.
+Volumes are independent of each other. To glue together the file tree
+there are @samp{mountpoint}s. Mountpoints are really symlinks that are
+formated in a special way so that they point out a volume and an
+optional cell. An AFS-cache-manager will show a mountpoint as directory
+and in fact it will be the root directory of the target volume.
@node Callbacks, Volume management, Data organization, Organization of data
@comment node-name, next, previous, up
@section Callbacks
-Callbacks are what enable the AFS-cache-manager to keep the files
-without asking the server if there is newer version of the file.
+Callbacks are messages that enable the AFS-cache-manager to keep the
+files without asking the server if there is newer version of the file.
A callback is a promise from the fileserver that it will notify the
client if the file (or directory) changes within the timelimit of the
callback.
-For read-only callbacks there is only callback given its called a volume
-callback and it will be broken when the read-only volume is updated.
+For contents of read-only volumes there is only one callback per volume
+called a volume callback and it will be broken when the read-only volume
+is updated.
-The time range of callbacks range from 1 hour to 5 minutes depending of
-how many user of the file exists.
+The time range of callbacks is from 5 to 60 minutes depending on
+how many users of the file exist.
@node Volume management, Relationship between pts uid and unix uid, Callbacks, Organization of data
@comment node-name, next, previous, up
@section Volume management
-All volume managment is done with the vos-command. To get a list of all
-commands `vos help' can be used. For help on a specific vos subcommand,
-`vos subcommand -h' can be used.
+All volume management is done with the @code{vos} command. To get a list
+of all commands @code{vos help} can be used. For help on a specific vos
+subcommand, @code{vos subcommand -h} can be used.
@itemize @bullet
@item Create
@@ -172,17 +175,18 @@ the volume.
Read-only volumes can be replicated over several servers, they are first
added with @code{vos addsite}, and the replicated with @code{vos
-release} out over the servers.
+release} over the servers.
@item Release
-When you want to distribute out the changes in the readwrite volume.
+When you want to distribute the changes in the readwrite volume to the
+read-only clones.
@item Remove
Volumes can be removed
-Note that you shouldn't remove the last readonly volume since this make
+Note that you shouldn't remove the last readonly volume since this makes
clients misbehave. If you are moving the volume you should rather add a
new RO to the new server and then remove it from the old server.
@@ -199,6 +203,16 @@ To stream a volume out to a @file{file} or @file{stdout} you use
@comment node-name, next, previous, up
@section Relationship between pts uid and unix uid
-foo
-
-
+@cindex pts
+@cindex uid
+
+Files in AFS are created with the pts uid of the token that was valid at
+the time. The pts uid number is then by commands like @code{ls -l}
+interpreted as a unix uid and translated into a username. If the pts and
+the unix uids differ, this might confuse the user as it looks like as
+her files are owned by someone else. This is however not the case.
+Complications can occur if programs impose further access restrictions
+based on these wrongly interpreted uids instead of using the
+@code{access()} system call for that purpose. Graphical file browsers
+are typically prone to that problem with the effect that the users are
+not able to see their own files in these tools.
diff --git a/usr.sbin/afs/src/doc/timeline.texi b/usr.sbin/afs/src/doc/timeline.texi
index b1dd29b7cce..080e266ef55 100644
--- a/usr.sbin/afs/src/doc/timeline.texi
+++ b/usr.sbin/afs/src/doc/timeline.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: timeline.texi,v 1.5 2000/12/10 23:06:32 lha Exp $
+@c $arla: timeline.texi,v 1.13 2003/02/01 17:15:00 lha Exp $
@node Arla timeline, Authors, Oddities, Top
@comment node-name, next, previous, up
@@ -10,11 +10,12 @@
Arla have existed for quite some years.
-Development started around XXX by Björn Grönvall
-@email{bg@@nada.kth.se}, quick followers was Assar
-@email{assar@@sics.se} (at that time @email{assar@@pdc.kth.se>) and
-Johan Danielsson <joda@@pdc.kth.se}. The platform that was chosen was
-Sparc SunOS4 (the OS that NADA, KTH was using).
+Development started in fall 1993 by Björn Grönvall
+@email{bg@@nada.kth.se} (with an rxkad implantation), he had a working
+read-only implementation in winter 1994. Quick followers was Assar
+@email{assar@@sics.se} (at that time @email{assar@@pdc.kth.se>}) and
+Johan Danielsson <@email{joda@@pdc.kth.se}>. The platform that was
+chosen was Sparc SunOS4 (the OS that NADA, KTH was using).
Some work was being done by Patrik Stymne @email{patriks@@e.kth.se} in
porting arla to Ultrix, but this work was never finished.
@@ -78,6 +79,9 @@ expected to.
We added support for `dynroot' and `fake-mp' to prepare for Windows and
Darwin/MacOSX support.
+Rhapsody xfs port was contributed by Alexandra Ellwood @email{lxs@@MIT.EDU}
+Later, Rhapsody was renamed Darwin.
+
In Mars 2000 preliminary support for MacOS X/Darwin 1.0 was merged in
by Magnus and Assar.
@@ -89,5 +93,9 @@ In June 2000 there was a presentation on MADE2000 in Gothenburg, Sweden.
In September 2000 MacOS X Beta was working.
+In March 2001 Incremental open code stable for some platforms
+
+In September 2001 xfs was renamed to nnpfs.
+
This just includes some milestones, for more information se
Changelog.* and NEWS files in the distribution.
diff --git a/usr.sbin/afs/src/doc/tools.texi b/usr.sbin/afs/src/doc/tools.texi
index 43b433b23ae..8f569dcfe90 100644
--- a/usr.sbin/afs/src/doc/tools.texi
+++ b/usr.sbin/afs/src/doc/tools.texi
@@ -2,7 +2,7 @@
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.
-@c $KTH: tools.texi,v 1.4 2000/10/03 01:10:33 lha Exp $
+@c $arla: tools.texi,v 1.4 2000/10/03 01:10:33 lha Exp $
@node Rx protocol, LWP, , Tools and libs
@section Rx protocol
diff --git a/usr.sbin/afs/src/include/bits.c b/usr.sbin/afs/src/include/bits.c
index 99a07418986..96a2f515317 100644
--- a/usr.sbin/afs/src/include/bits.c
+++ b/usr.sbin/afs/src/include/bits.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: bits.c,v 1.6 1998/12/20 15:55:29 assar Exp $");
+RCSID("$arla: bits.c,v 1.7 2002/02/07 17:59:15 lha Exp $");
#endif
#include <stdio.h>
#include <string.h>
@@ -60,7 +60,7 @@ strupr(char *s)
#define BITSIZE(TYPE) \
{ \
- int b = 0; TYPE x = 1, zero = 0; char *pre = "u_"; \
+ int b = 0; TYPE x = 1, zero = 0; char *pre = "u"; \
char tmp[128], tmp2[128]; \
while(x){ x <<= 1; b++; if(x < zero) pre=""; } \
if(b >= len){ \
@@ -140,15 +140,15 @@ int main(int argc, char **argv)
}
fprintf(f, "/* %s -- this file was generated for %s by\n", fn, HOST);
fprintf(f, " %*s %s */\n\n", strlen(fn), "",
- "$KTH: bits.c,v 1.6 1998/12/20 15:55:29 assar Exp $");
+ "$arla: bits.c,v 1.7 2002/02/07 17:59:15 lha Exp $");
fprintf(f, "#ifndef %s\n", hb);
fprintf(f, "#define %s\n", hb);
fprintf(f, "\n");
#ifdef HAVE_SYS_TYPES_H
fprintf(f, "#include <sys/types.h>\n");
#endif
-#ifdef HAVE_INTTYPES_H
- fprintf(f, "#include <inttypes.h>\n");
+#ifdef HAVE_STDINT_H
+ fprintf(f, "#include <stdint.h>\n");
#endif
#ifdef HAVE_SYS_BITYPES_H
fprintf(f, "#include <sys/bitypes.h>\n");
@@ -181,23 +181,23 @@ int main(int argc, char **argv)
#endif /* HAVE_INT64_T */
#endif
-#ifndef HAVE_U_INT8_T
+#ifndef HAVE_UINT8_T
flag = print_bt(f, flag);
try_unsigned (f, 8);
#endif /* HAVE_INT8_T */
-#ifndef HAVE_U_INT16_T
+#ifndef HAVE_UINT16_T
flag = print_bt(f, flag);
try_unsigned (f, 16);
-#endif /* HAVE_U_INT16_T */
-#ifndef HAVE_U_INT32_T
+#endif /* HAVE_UINT16_T */
+#ifndef HAVE_UINT32_T
flag = print_bt(f, flag);
try_unsigned (f, 32);
-#endif /* HAVE_U_INT32_T */
+#endif /* HAVE_UINT32_T */
#if 0
-#ifndef HAVE_U_INT64_T
+#ifndef HAVE_UINT64_T
flag = print_bt(f, flag);
try_unsigned (f, 64);
-#endif /* HAVE_U_INT64_T */
+#endif /* HAVE_UINT64_T */
#endif
if(flag){
diff --git a/usr.sbin/afs/src/include/stds.h b/usr.sbin/afs/src/include/stds.h
index bb087070fa1..4d4401e01ad 100644
--- a/usr.sbin/afs/src/include/stds.h
+++ b/usr.sbin/afs/src/include/stds.h
@@ -31,29 +31,25 @@
* SUCH DAMAGE.
*/
-/* $KTH: stds.h,v 1.6 2000/10/03 00:34:21 lha Exp $ */
+/* $arla: stds.h,v 1.10 2003/06/12 05:28:19 lha Exp $ */
#ifndef __STDS_H
#define __STDS_H 1
-#ifndef HAVE_INT32
-typedef int32_t int32;
-#endif
+/* for compat resons with other kerberos distributions */
-#ifndef HAVE_U_INT32
-typedef u_int32_t u_int32;
+#ifndef ANAME_SZ
+#define ANAME_SZ 40
#endif
-
-#ifndef HAVE_INT16
-typedef int16_t int16;
+#ifndef INST_SZ
+#define INST_SZ 40
#endif
-
-#ifndef HAVE_U_INT16
-typedef u_int16_t u_int16;
+#ifndef REALM_SZ
+#define REALM_SZ 40
#endif
-/* for compat resons with other kerberos distributions */
#if defined(KERBEROS) && !defined(HAVE_KRB_PRINCIPAL)
+
typedef struct krb_principal{
char name[ANAME_SZ];
char instance[INST_SZ];
diff --git a/usr.sbin/afs/src/milko/ChangeLog b/usr.sbin/afs/src/milko/ChangeLog
index 873bb103fce..3a3f6ff77c7 100644
--- a/usr.sbin/afs/src/milko/ChangeLog
+++ b/usr.sbin/afs/src/milko/ChangeLog
@@ -1,3 +1,366 @@
+2003-04-09 Love <lha@stacken.kth.se>
+
+ * pts/ptserver.c: s/strcpy/strlcpy/
+
+2003-04-08 Love <lha@stacken.kth.se>
+
+ * fs/fsprocs.c: s/RXAFS_/SRXAFS_/
+ * fs/fsprocs.c: replace sprint with snprintf
+
+2003-02-16 Love <lha@stacken.kth.se>
+
+ * lib/mdb/ndbm.c: build if we have HAVE_NEW_DB
+
+ * lib/mdb/ndbm.c (mdb_NDBM_create): instead of assert()ing, return
+ failure
+
+2003-02-15 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * vldb/Makefile.in: s/arlautil/libarlautil
+
+ * vldb/vldbserver.c: s/int32/int32_t
+
+ * fs/Makefile.in: Added libvers.la Removed libko.a, we alreday
+ have libko.la
+
+ * lib/vld/vld.c: spare1-4 in AFSFetchStatus are no more
+
+2002-11-29 Mattias Amnefelt <mattiasa@e.kth.se>
+
+ * lib/vld/vld.c (vld_modify_vnode): update ServerModTime in
+ correct union
+
+2002-10-31 Love <lha@stacken.kth.se>
+
+ * vldb/vldbserver.c: fix prototype for VL_GetAddrs
+
+2002-10-02 Love <lha@stacken.kth.se>
+
+ * bos/kconf.c: fix NUL termination of fgets string
+
+2002-09-08 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/volprocs.c (VOLSER_AFSVolForwardMultiple): change to new xdr
+ definition
+
+ * lib/dpart/Makefile.in: Added @MILKO_ROOT@
+
+2002-07-03 Love <lha@stacken.kth.se>
+
+ * milko/appl/perf: move to arla appl tree
+
+2002-06-02 Love <lha@stacken.kth.se>
+
+ * Make compile again
+
+2002-03-06 Tomas Olsson <tol@stacken.kth.se>
+
+ * lib/vld/mdir.[ch] use fdir_readdir the new way
+
+ * lib/vld/salvage.c use fdir_readdir the new way
+
+ * appl/sked/sked.c use fdir_readdir the new way
+
+ * appl/perf/Makefile.in depend on libarlautil
+
+ * appl/sked/Makefile.in depend on libarlautil
+
+2002-01-29 Love <lha@stacken.kth.se>
+
+ * fs/dump.c: remove __FUNCTION__, its not portable
+
+2002-01-29 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/volprocs.c (VOLSER_AFSVolDump): call generate_dump()
+
+ * fs/dump.h, fs/dump.c: Added dump functionality
+
+ * lib/vld/vld.h, lib/vld/vld.c: Added vld_foreach_dir and
+ vld_foreach_file
+
+2002-01-23 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/fsprocs.c: Pass volume type to ropa_getcallback
+ (check_ss_bits): check super user
+ (fs_init_req): don't allow writes to a read-only volume
+ (RXAFS_SetVolumeStatus): check super user
+
+ * fs/volprocs.c: Changed debugging output
+ (VOLSER_AFSVolEndTrans): break callback for volume
+
+ * fs/fs_def.h: Define MILKO_ROFS
+
+ * fs/dump.c: tag is unsigned char
+
+ * fs/connsec.c (fs_connsec_createconn): fill in superuser field
+
+ * lib/voldb/vdb_flat.c (vdbflat_rebuild): implement
+
+ * lib/vld/vld.c (vld_storestatus_to_dent): remove permission check
+ (vld_storestatus_to_dent): remove permission check
+ (vld_check_rights): use superuser flag in fs_security_context
+
+ * lib/vld/salvage.c: Update to new voldb nextptr behaviour
+ (read_nodes_dir): Rewrite permissions check
+ (read_nodes_file): Rewrite permissions check
+
+ * lib/vld/mnode.h: Added superuser field in struct
+ fs_security_context
+
+2002-01-11 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/volprocs.c: Call vld_rebuild
+
+ * lib/vld/vld.c: Added vld_rebuild
+
+ * lib/vld/vld.h: Added vld_rebuild
+
+ * lib/voldb/voldb.c: Added voldb_rebuild
+
+ * lib/voldb/vdb_flat.c: Added vdbflat_rebuild
+
+ * lib/voldb/voldb.h: Added voldb_rebuild
+
+ * lib/voldb/voldb_internal.h: Added voldb_rebuild
+
+ * lib/vld/vld.c (delete_all_nodes): nextptr is VOLDB_ENTRY_USED if
+ used
+ (restore_file): nextptr is VOLDB_ENTRY_USED if used
+ (restore_file): if a file exists at the same vnode, remove the old
+ file
+
+ * fs/fsrv_locl.h: Include roken.h
+
+ * fs/fsprocs.c (RXAFS_StoreACL): only get VOLOP_GETSTATUS and
+ VOLOP_ADMIN
+
+ * fs/dump.c (read_vnodeheader): restore_file changed acl argument
+ to int32_t *
+
+ * lib/vld/vld.h (restore_file): change acl argument to int32_t *
+
+ * lib/vld/vld.c (restore_file): restore ACL and update volsize
+
+ * fs/connsec.c (fs_connsec_createconn): Don't free db server
+ context before PR_GetCPS
+
+2002-01-05 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * lib/dpart/dpart.c: Use statvfs if present
+
+2001-11-17 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/connsec.c (fs_connsec_nametoid): Use arlalib
+ (fs_connsec_idtoname): Use arlalib
+ (fs_connsec_createconn): Use arlalib
+
+ * vldb/vldbserver.c: Flush database after writing
+ (VL_DeleteEntry): rewrite
+
+2001-11-07 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/volprocs.c (volser_fetch_vh): return better error messages
+ (VOLSER_AFSVolClone): log more
+ (VOLSER_AFSVolTransCreate): check for volume existence
+ (VOLSER_AFSVolPartitionInfo): fill in some bogus free value
+
+ * fs/Makefile.in: Use arlalib
+
+2001-11-06 Tomas Olsson <tol@stacken.kth.se>
+
+ * fs/fsprocs.c (removenode): more proper callback handling
+ (RXAFS_Rename): cover more cases, handle callbacks better
+
+ * lib/vld/mnode.c (mnode_{find,free,remove}): use flags.removedp
+ * lib/vld/mnode.h (struct mnode): added flags.removedp
+ * lib/vld/mdir.c (mdir_changefid): added
+ * lib/vld/mdir.h: added mdir_changefid()
+ * lib/vld/vld.c (vld_adjust_linkcount): always update fetchstatus
+ (vld_modify_vnode): update ServerModTime
+
+2001-11-02 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * appl/sked/sked.c (volshow_cmd): partdir is the 3rd argument
+
+ * vldb/vldb_locl.h vldb/vl_db.c: Added vldb_flush
+
+2001-11-02 Tomas Olsson <tol@stacken.kth.se>
+
+ * lib/voldb/vdb_flat.c: use VOLDB_ENTRY_USED
+ * lib/voldb/voldb.h: define VOLDB_ENTRY_USED
+ * pts/ptserver.c (read_header): no need to malloc()
+ * fs/fileserver.c (main): do usage() on --help
+
+2001-10-14 Love <lha@stacken.kth.se>
+
+ * appl/sked/sked.c: replace SL_BADCOMMAND with -1 to make it
+ compatible with older libsl
+
+2001-10-14 Tomas Olsson <tol@stacken.kth.se>
+
+ * fs/fsprocs.c (RXAFS_Rename): initialize new_n when same dir too
+
+ * lib/vld/mdir.h (mdir_lookup): new signature
+ (mdir_rename): added
+
+ * lib/vld/mdir.c (mdir_lookup): new signature
+ (mdir_rename): added
+
+ * lib/vld/vld.h (vld_remove_node): use mnode
+ (vld_[gs]et_volstats): added
+
+ * lib/vld/vld.c
+ (vld_{update_volsize,check_quota,{get,set}_volstats}): new functions
+ added quota handling, hard links, anonymous gets some rights
+
+ * fs/fsprocs.c: added quota handling, hard links
+
+ * pts/ptserver.c (read_header): free() buffer
+ (conv_name_to_id): free() buffer
+
+ * lib/vld/mnode.c (reset_node): close fd
+ (mnode_find): try harder when no free nodes
+
+ * lib/dpart/dpart.c (dp_getstats): added
+ * lib/dpart/dpart.h (dp_getstats): added
+
+2001-10-12 Tomas Olsson <tol@stacken.kth.se>
+
+ * fs/connsec.c (fs_connsec_createconn): lowercase realm for ptserver
+ * pts/{Makefile.in,pr.c,ptserver.[ch]} use mdb
+
+2001-10-03 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * lib/mdb/mdb.[ch], lib/mdb/ndbm.c: Added flush
+
+ * fs/fsprocs.c (RXAFS_FetchStatus): use exit label instead of
+ return
+ * fs/dump.[ch]: Make it work somewhat
+
+ * fs/volprocs.c (VOLSER_AFSVolRestore): Added transaction handling
+
+ * lib/vld/vld.h: Added restore_file
+ * lib/vld/vld.c: Added restore_file
+ (vld_check_rights): Added implicit read, lookup and administer
+ rights for system:administrators
+
+ * lib/voldb/vdb_flat.c: Added expand
+ * lib/voldb/voldb.c: Added expand
+ * lib/voldb/voldb.h: Added expand
+ * lib/voldb/voldb_internal.h: Added expand
+
+ * vldb/Makefile.in: Changed to namecentric database handling
+ * vldb/vl_db.c: Changed to namecentric database handling
+ * vldb/vldb_locl.h: Changed to namecentric database handling
+ * vldb/vldbserver.c: Changed to namecentric database handling
+ * vldb/vl_disk.c: Changed to namecentric database handling
+
+2001-10-02 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * lib/vld/vld.[ch]: Added vld_delete_volume
+
+ * fs/Makefile.in: Added dump.c
+
+ * fs/fsrv_locl.h: Added dump.h
+
+ * fs/volprocs.c: Implement DeleteVolume, Restore, GetStatus,
+ SetIdsTypes, SetDate
+
+ * fs/dump.[ch]: Added bogus dump functionality
+
+2001-09-28 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * fs/volprocs.c (VOLSER_AFSVolListVolumes): implement
+
+ * vldb/vldbserver.c: Use vital_vlheader instead of vlheader
+
+ * vldb/vl_db.c: Use vital_vlheader instead of vlheader
+
+ * lib/mdb/ndbm.c (NDBM_fetch): return ENOENT on error
+
+ * lib/vld/vld.[ch]: Added vld_list_volumes
+
+ * fs/volprocs.c: Added security checks and logging.
+
+2001-09-04 Tomas Olsson <tol@stacken.kth.se>
+
+ * appl/sked/sked.c (volcreate_cmd): avoid using null arg for
+ dpart_root
+
+ * vldb/vldb_locl.h: update prototypes, cleanup
+
+ * vldb/vl_db.c (vldb_{read_entry,id_to_name,write_name}):
+ error handling, fixup
+ (vldb_name_to_id): added new arg (name), some error handling, fixup
+ (vldb_{print_entry,close}): update signature
+
+ * vldb/vldbserver.c (VL_{Create,Delete}Entry, VL_GetEntryBy{Name,ID}):
+ some error handling & cleanup
+
+ * lib/mdb/mdb.c (mdb_delete): added
+ * lib/mdb/mdb.h: Added prototypes for mdb_delete() and mdb_close()
+ * lib/mdb/ndbm.c (NDBM_delete): added
+
+2001-08-30 Mattias Amnefelt <mattiasa@e.kth.se>
+
+ * vldb/Makefile.in: Link with libmdb. Don't build vled.
+ * vldb/{vl_bd.c,vldbserver.c,vldb_locl.h}: changed to use mdb
+ * lib/Makefile.in: added directory mdb
+ * lib/mdb: Database library for vl- and ptserver, added
+
+2001-08-26 Mattias Amnefelt <mattiasa@e.kth.se>
+
+ * pts/ptserver.c (main): move prserver_create after mlog_loginit
+ * vldb/vldbserver.c (main): call vldb_create after mlog_loginit
+
+2001-07-26 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * vldb/{vl_db.c,vldb_locl.h,vldbserver.c}: Use mlog. Restructure
+ program arguments
+
+ * pts/{pr.c,ptserver.c,ptserver.h}: Use mlog. Restructure program
+ arguments
+
+ * lib/vld/Makefile.in: Removed debug.c
+
+ * lib/mlog/Makefile.in: Added mdebug.c
+
+ * lib/vld/debug.c: Moved to lib/mlod/mdebug.c
+
+ * pts/Makefile.in, vldb/Makefile.in: Link with mlog
+
+ * include/mdebug.h: Moved to lib/mlog/mdebug.h
+
+ * fs/fileserver.c: Make salvage_options a passed variable
+ Restructure program arguments
+
+2001-07-07 Magnus Ahltorp <map@stacken.kth.se>
+
+ * vldb/vldbserver.c (VL_ReplaceEntryN): argument should be
+ nvldbentry
+
+ * bos/bosprocs.c (BOZO_SetStatus): Added status argument
+
+ * appl/sked/sked.c (volls_cmd): Cast printf arguments.
+ mdir_readdir changed argument from VenusFid pointer to VenusFid.
+
+ * lib/msecurity/msecurity.c: Include roken.h
+
+ * lib/vld/salvage.c (check_content_dir_func): fdir_readdir changed
+ argument from VenusFid pointer to VenusFid
+
+ * lib/vld/mdir.[ch] (mdir_readdir): change argument from VenusFid
+ pointer to VenusFid
+
+2001-02-12 Magnus Ahltorp <ahltorp@nada.kth.se>
+
+ * lib/dpart/dpart.c: Added parentheses
+
+2001-01-09 Love <lha@stacken.kth.se>
+
+ * fs/fileserver.c (arg): too arguments where using short option
+ 's' From Nickolai Zeldovich <kolya@MIT.EDU>
+
2001-01-01 Love <lha@stacken.kth.se>
* fs/fsprocs.c: (RXAFS_FetchACL): add dummy call to i2nlist() to
diff --git a/usr.sbin/afs/src/milko/README b/usr.sbin/afs/src/milko/README
index 98c2dfff35d..1e4364256ae 100644
--- a/usr.sbin/afs/src/milko/README
+++ b/usr.sbin/afs/src/milko/README
@@ -1,4 +1,4 @@
- Milko ($KTH: README,v 1.28 2000/08/16 22:17:48 tol Exp $)
+ Milko ($arla: README,v 1.29 2001/04/28 12:54:41 lha Exp $)
=====
Note:
@@ -166,8 +166,8 @@ Note:
There should be a notice in the top (after the copyright blub)
that will give you a general idea what the module (should) do.
- Each function should documented in the comment above the function.
- Where each argument is described. Any simple/complex/no-trivial
+ Each function should be documented in the comment above the function,
+ where each argument is described. Any simple/complex/no-trivial
locking event should be documented.
If you see any assert()s in the top of the function (just after
diff --git a/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in b/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in
index 231598330dd..1a0a9a01788 100644
--- a/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in
+++ b/usr.sbin/afs/src/milko/appl/bootstrap/anti-boot-strap.sh.in
@@ -5,7 +5,7 @@
# shell stuff
-version="$KTH: anti-boot-strap.sh.in,v 1.2 1999/11/03 05:57:53 lha Exp $"
+version="$arla: anti-boot-strap.sh.in,v 1.2 1999/11/03 05:57:53 lha Exp $"
usage="NOT USE IF YOU DONT KNOW _=*KNOW*=_ WHAT YOU ARE DOING"
PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
diff --git a/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in b/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in
index b1862ae612c..3b6be6cafdc 100644
--- a/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in
+++ b/usr.sbin/afs/src/milko/appl/bootstrap/boot-strap.sh.in
@@ -5,7 +5,7 @@
# shell stuff
-version="$KTH: boot-strap.sh.in,v 1.4 2000/02/19 07:13:02 lha Exp $"
+version="$arla: boot-strap.sh.in,v 1.4 2000/02/19 07:13:02 lha Exp $"
usage="Usage: $0 [-v] [-p /viceN ]"
#
diff --git a/usr.sbin/afs/src/milko/appl/sked/sked.c b/usr.sbin/afs/src/milko/appl/sked/sked.c
index 3a56605d316..00e3abb0338 100644
--- a/usr.sbin/afs/src/milko/appl/sked/sked.c
+++ b/usr.sbin/afs/src/milko/appl/sked/sked.c
@@ -34,7 +34,7 @@
#include <config.h>
#include "roken.h"
-RCSID("$KTH: sked.c,v 1.26 2000/12/29 20:21:30 tol Exp $");
+RCSID("$arla: sked.c,v 1.33 2002/04/26 16:11:41 lha Exp $");
#include <stdio.h>
#include <sys/types.h>
@@ -69,7 +69,7 @@ static int interactivep = 0;
#define INTER_RETURN(ret) if (interactivep) return 0; else exit (ret);
static int
-create_volume (u_int32_t part, u_int32_t num, char *name)
+create_volume (uint32_t part, uint32_t num, char *name)
{
int ret;
int32_t backstoretype = VLD_SVOL;
@@ -92,7 +92,7 @@ create_volume (u_int32_t part, u_int32_t num, char *name)
*/
static int
-show_volume (u_int32_t part, u_int32_t num)
+show_volume (uint32_t part, uint32_t num)
{
volume_handle *vh = NULL;
int ret;
@@ -188,7 +188,7 @@ showvols_cb (void *data, int fd)
*/
static int
-show_vols (u_int32_t part)
+show_vols (uint32_t part)
{
struct dp_part *p;
int ret;
@@ -216,7 +216,7 @@ show_vols (u_int32_t part)
static int
volcreate_cmd (int argc, char **argv)
{
- u_int32_t num, part;
+ uint32_t num, part;
int ret;
if (argc < 4 || argc > 5) {
@@ -224,7 +224,8 @@ volcreate_cmd (int argc, char **argv)
INTER_RETURN(1);
}
- dpart_root = argv[4];
+ if (argc == 5)
+ dpart_root = argv[4];
ret = dp_parse (argv[1], &part);
if (ret) {
@@ -256,7 +257,7 @@ volcreate_cmd (int argc, char **argv)
static int
volshow_cmd (int argc, char **argv)
{
- u_int32_t num, part;
+ uint32_t num, part;
int ret;
if (argc < 3 || argc > 4) {
@@ -272,7 +273,7 @@ volshow_cmd (int argc, char **argv)
INTER_RETURN(1);
}
- dpart_root = argv[4];
+ dpart_root = argv[3];
ret = show_volume (part, num);
if (ret) {
@@ -290,7 +291,7 @@ volshow_cmd (int argc, char **argv)
static int
vollist_cmd (int argc, char **argv)
{
- u_int32_t part;
+ uint32_t part;
int ret;
if (argc != 2) {
@@ -313,7 +314,7 @@ vollist_cmd (int argc, char **argv)
*
*/
-static void
+static int
volls_dir_cb (VenusFid *fid, const char *name, void *arg)
{
printf ("%-60s %d.%d.%d\n",
@@ -321,14 +322,15 @@ volls_dir_cb (VenusFid *fid, const char *name, void *arg)
fid->fid.Volume,
fid->fid.Vnode,
fid->fid.Unique);
+ return 0;
}
static int
volls_cmd (int argc, char **argv)
{
- u_int32_t part;
- u_int32_t vol;
- u_int32_t vnode;
+ uint32_t part;
+ uint32_t vol;
+ uint32_t vnode;
struct dp_part *dp;
int ret;
@@ -385,7 +387,8 @@ volls_cmd (int argc, char **argv)
#endif
printf ("mode=%o ino=%x dev=%x rdev=%x\n",
- n.sb.st_mode, n.sb.st_ino, n.sb.st_dev, n.sb.st_rdev);
+ n.sb.st_mode, (int) n.sb.st_ino,
+ (int) n.sb.st_dev, (int) n.sb.st_rdev);
printf ("size: %d\nparent fid: %d.%d\n",
n.fs.Length, n.fs.ParentVnode, n.fs.ParentUnique);
@@ -397,7 +400,7 @@ volls_cmd (int argc, char **argv)
fid.fid.Vnode = vnode;
fid.fid.Unique = 0;
- ret = mdir_readdir (&n, volls_dir_cb, NULL, &fid);
+ ret = mdir_readdir (&n, volls_dir_cb, NULL, fid);
if (ret)
errx (1, "volls: mdir_readdir failed with %d", ret);
@@ -420,9 +423,9 @@ volls_cmd (int argc, char **argv)
static int
volvnode_cmd (int argc, char **argv)
{
- u_int32_t part;
+ uint32_t part;
char *part_str = NULL;
- u_int32_t vol;
+ uint32_t vol;
char *vol_str = NULL;
struct dp_part *dp;
int do_list = 0;
@@ -463,7 +466,7 @@ volvnode_cmd (int argc, char **argv)
{
struct volume_handle *volh;
int i;
- u_int32_t num, flags;
+ uint32_t num, flags;
ret = vld_open_volume_by_num (dp, vol, &volh);
@@ -553,7 +556,7 @@ volvnode_cmd (int argc, char **argv)
static int
fvolcreate_cmd (int argc, char **argv)
{
- u_int32_t part;
+ uint32_t part;
char *part_str = NULL;
char *path_str = NULL;
int vol_int = 0;
@@ -609,8 +612,8 @@ static int
showvolname_cmd (int argc, char **argv)
{
int ret;
- u_int32_t num;
- u_int32_t part;
+ uint32_t num;
+ uint32_t part;
char name[MAXPATHLEN];
if (argc != 2 && argc != 3)
@@ -779,7 +782,7 @@ main (int argc, char **argv)
set_progname (argv[0]);
- method = log_open (get_progname(), log_file);
+ method = log_open (getprogname(), log_file);
if (method == NULL)
errx (1, "log_open failed");
@@ -800,7 +803,7 @@ main (int argc, char **argv)
sl_loop (cmds, "sked (cmd): ");
} else {
ret = sl_command(cmds, argc - 1, argv + 1);
- if (ret == SL_BADCOMMAND)
+ if (ret == -1)
printf ("%s: Unknown command\n", argv[1]);
}
diff --git a/usr.sbin/afs/src/milko/bos/bos_locl.h b/usr.sbin/afs/src/milko/bos/bos_locl.h
index 66b341b8caa..916d7be63b0 100644
--- a/usr.sbin/afs/src/milko/bos/bos_locl.h
+++ b/usr.sbin/afs/src/milko/bos/bos_locl.h
@@ -47,7 +47,11 @@
#include <ctype.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#endif
diff --git a/usr.sbin/afs/src/milko/bos/bosprocs.c b/usr.sbin/afs/src/milko/bos/bosprocs.c
index 4ea6b1968cb..3889227ca93 100644
--- a/usr.sbin/afs/src/milko/bos/bosprocs.c
+++ b/usr.sbin/afs/src/milko/bos/bosprocs.c
@@ -33,7 +33,7 @@
#include "bos_locl.h"
-RCSID("$KTH: bosprocs.c,v 1.4 2000/10/03 00:16:53 lha Exp $");
+RCSID("$arla: bosprocs.c,v 1.6 2002/06/02 21:12:15 lha Exp $");
/*
*
@@ -97,7 +97,8 @@ BOZO_GetStatus(struct rx_call *call,
int
BOZO_SetStatus(struct rx_call *call,
- const char *instance)
+ const char *instance,
+ const int32_t status)
{
bosdebug ("BOZO_SetStatus: %s\n", instance);
@@ -165,9 +166,11 @@ BOZO_AddSUser(struct rx_call *call, const char *name)
if (strchr(name, '@'))
n = strdup (name);
else
- asnprintf (&n, BOZO_BSSIZE, "%s@%s", name, cell_getthiscell());
+ asprintf (&n, "%s@%s", name, cell_getthiscell());
if (n == NULL)
return BZIO;
+ if (strlen(n) > BOZO_BSSIZE)
+ n[BOZO_BSSIZE - 1] = '\0';
ret = sec_add_superuser (n);
free (n);
if (ret)
@@ -187,11 +190,13 @@ BOZO_DeleteSUser(struct rx_call *call, const char *name)
int ret;
if (strchr(name, '@'))
- asnprintf (&n, BOZO_BSSIZE, "%s", name);
+ asprintf (&n, "%s", name);
else
- asnprintf (&n, BOZO_BSSIZE, "%s@%s", name, cell_getthiscell());
+ asprintf (&n, "%s@%s", name, cell_getthiscell());
if (n == NULL)
return BZIO;
+ if (strlen(n) > BOZO_BSSIZE)
+ n[BOZO_BSSIZE - 1] = '\0';
ret = sec_del_superuser (n);
free (n);
if (ret)
diff --git a/usr.sbin/afs/src/milko/bos/bosserver.c b/usr.sbin/afs/src/milko/bos/bosserver.c
index 3adc90ebcab..939ecacba7e 100644
--- a/usr.sbin/afs/src/milko/bos/bosserver.c
+++ b/usr.sbin/afs/src/milko/bos/bosserver.c
@@ -33,7 +33,7 @@
#include "bos_locl.h"
-RCSID("$KTH: bosserver.c,v 1.22 2000/10/03 00:16:58 lha Exp $");
+RCSID("$arla: bosserver.c,v 1.23 2002/04/26 16:11:42 lha Exp $");
static char *email = "root";
static char *serverfile = MILKO_SYSCONFDIR "/server-file";
@@ -611,7 +611,7 @@ main (int argc, char **argv)
int optind = 0;
int ret;
- set_progname(argv[0]);
+ setprogname(argv[0]);
if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) {
usage (1);
@@ -631,7 +631,7 @@ main (int argc, char **argv)
if (bosserverprefix == NULL)
bosserverprefix = MILKO_LIBEXECDIR;
- method = log_open (get_progname(), log_file);
+ method = log_open (getprogname(), log_file);
if (method == NULL)
errx (1, "log_open failed");
cell_init(0, method);
diff --git a/usr.sbin/afs/src/milko/bos/kconf.c b/usr.sbin/afs/src/milko/bos/kconf.c
index a3804fb61ef..95daa76abc3 100644
--- a/usr.sbin/afs/src/milko/bos/kconf.c
+++ b/usr.sbin/afs/src/milko/bos/kconf.c
@@ -49,7 +49,7 @@
/* $Heimdal: config_file.c,v 1.38 1999/12/02 17:05:08 joda Exp $ */
#ifdef RCSID
-RCSID("$KTH: kconf.c,v 1.3 2000/05/27 21:56:56 ahltorp Exp $");
+RCSID("$arla: kconf.c,v 1.5 2002/10/01 23:34:57 lha Exp $");
#endif
static int parse_section(char *p, kconf_config_section **s,
@@ -130,8 +130,7 @@ parse_list(FILE *f, unsigned *lineno, kconf_config_binding **parent,
char *p;
++*lineno;
- if (buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\n")] = '\0';
p = buf;
while(isspace((unsigned char)*p))
++p;
@@ -256,8 +255,7 @@ kconf_config_parse_file_debug (const char *fname,
char *p;
++*lineno;
- if(buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\n")] = '\0';
p = buf;
while(isspace((unsigned char)*p))
++p;
diff --git a/usr.sbin/afs/src/milko/fs/connsec.c b/usr.sbin/afs/src/milko/fs/connsec.c
index 32397b245ce..af3213b5e67 100644
--- a/usr.sbin/afs/src/milko/fs/connsec.c
+++ b/usr.sbin/afs/src/milko/fs/connsec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -35,55 +35,35 @@
#include "pts.cs.h"
-RCSID("$KTH: connsec.c,v 1.12 2000/10/03 00:17:03 lha Exp $");
+#include "arlalib.h"
-static struct rx_connection *
-get_conn(int32_t addr, int32_t port, int32_t servid)
-{
- struct rx_securityClass *sec;
- struct rx_connection *conn;
-
- sec = netinit_client_getcred();
- if (sec == NULL)
- return NULL;
-
- conn = rx_NewConnection (addr,
- htons (port),
- servid,
- sec,
- 2 /* secureindex */);
- if (conn == NULL)
- return NULL;
-
- return conn;
-}
-
-static struct rx_connection *out_conn = NULL;
+RCSID("$arla: connsec.c,v 1.18 2002/02/07 17:59:39 lha Exp $");
int
fs_connsec_nametoid(namelist *nlist, idlist *ilist)
{
- int error;
+ int error = ARLA_CALL_DEAD;
int first = 0;
+ struct db_server_context conn_context;
+ struct rx_connection *conn;
retry:
- if (out_conn == NULL)
- out_conn = get_conn(htonl(0x7f000001) /* XXX */,
- afsprport,
- PR_SERVICE_ID);
-
- if (out_conn == NULL)
- return ENETDOWN;
-
- error = PR_NameToID(out_conn, nlist, ilist);
+
+ for (conn = arlalib_first_db(&conn_context,
+ NULL, NULL, afsprport, PR_SERVICE_ID,
+ arlalib_getauthflag (0, 1, 0, 0));
+ conn != NULL && arlalib_try_next_db(error);
+ conn = arlalib_next_db(&conn_context)) {
+ error = PR_NameToID(conn, nlist, ilist);
+ }
+
+ free_db_server_context(&conn_context);
+
if (error == RXKADEXPIRED && first == 0) {
++first;
- rx_DestroyConnection (out_conn);
- out_conn = NULL;
goto retry;
}
-
if (error) {
fprintf(stderr, "PR_NameToID error: %s(%d)\n",
koerr_gettext(error), error);
@@ -96,18 +76,28 @@ retry:
int
fs_connsec_idtoname(idlist *ilist, namelist *nlist)
{
- int error;
+ int error = ARLA_CALL_DEAD;
+ int first = 0;
+ struct db_server_context conn_context;
+ struct rx_connection *conn;
- if (out_conn == NULL)
- out_conn = get_conn(htonl(0x7f000001) /* XXX */,
- afsprport,
- PR_SERVICE_ID);
+retry:
+
+ for (conn = arlalib_first_db(&conn_context,
+ NULL, NULL, afsprport, PR_SERVICE_ID,
+ arlalib_getauthflag (0, 1, 0, 0));
+ conn != NULL && arlalib_try_next_db(error);
+ conn = arlalib_next_db(&conn_context)) {
+ error = PR_IDToName(conn, ilist, nlist);
+ }
+
+ free_db_server_context(&conn_context);
+
+ if (error == RXKADEXPIRED && first == 0) {
+ ++first;
+ goto retry;
+ }
- if (out_conn == NULL)
- return ENETDOWN;
-
- error = PR_IDToName(out_conn, ilist, nlist);
-
if (error) {
if (koerr_gettext(error))
fprintf(stderr, "PR_IDToName error: %s(%d)\n",
@@ -125,7 +115,7 @@ fs_connsec_anonymous(struct fs_security_context *sec)
{
sec->uid = PR_ANONYMOUSID;
sec->cps->len = 2;
- sec->cps->val = malloc(2*sizeof(u_int32_t));
+ sec->cps->val = malloc(2*sizeof(uint32_t));
if (sec->cps->val == NULL) {
sec->cps->len = 0;
return; /* XXX */
@@ -141,11 +131,14 @@ fs_connsec_createconn(struct rx_connection *conn)
namelist nlist;
idlist ilist;
char rname[PR_MAXNAMELEN];
- int error;
+ int error = ARLA_CALL_DEAD;
char aname[ANAME_SZ];
char inst[INST_SZ];
char realm[REALM_SZ];
int32_t over;
+ struct db_server_context conn_context;
+ struct rx_connection *out_conn;
+ int i;
if (conn->rock)
return;
@@ -154,6 +147,7 @@ fs_connsec_createconn(struct rx_connection *conn)
if (sec == NULL)
return; /* XXX */
+ sec->superuser = 0;
sec->ref = 1;
sec->cps = malloc(sizeof(prlist));
if (sec->cps == NULL)
@@ -168,39 +162,40 @@ fs_connsec_createconn(struct rx_connection *conn)
}
/*
- * XXX This should retry with a new connection if the first one
- * fails. It should also try all ptservers.
- */
-
- if (out_conn == NULL)
- out_conn = get_conn(htonl(0x7f000001) /* XXX */,
- afsprport,
- PR_SERVICE_ID);
-
- if (out_conn == NULL) {
- fs_connsec_anonymous(sec);
- return;
- }
-
- /*
* XXX It is not a good thing to truncate, allows for spoofing?
* Perhaps we should just deny access if fullname is to long.
*/
- strlcpy(rname, krb_unparse_name_long(aname, inst, realm), sizeof(rname));
-
+ if (!strcasecmp(realm, netinit_getrealm()))
+ strlcpy(rname,
+ krb_unparse_name_long(aname, inst, NULL),
+ sizeof(rname));
+ else
+ strlcpy(rname,
+ krb_unparse_name_long(aname, inst, strlwr(realm)),
+ sizeof(rname));
+
nlist.len = 1;
nlist.val = &rname;
ilist.val = NULL;
- error = PR_NameToID(out_conn, &nlist, &ilist);
-
+ for (out_conn = arlalib_first_db(&conn_context,
+ NULL, NULL, afsprport, PR_SERVICE_ID,
+ arlalib_getauthflag (0, 1, 0, 0));
+ out_conn != NULL && arlalib_try_next_db(error);
+ out_conn = arlalib_next_db(&conn_context)) {
+ error = PR_NameToID(out_conn, &nlist, &ilist);
+ if (error == 0)
+ break;
+ }
+
if (error) {
fprintf(stderr, "PR_NameToID error: %s(%d)\n",
koerr_gettext(error), error);
free(ilist.val);
fs_connsec_anonymous(sec);
+ free_db_server_context(&conn_context);
return;
}
@@ -210,6 +205,8 @@ fs_connsec_createconn(struct rx_connection *conn)
error = PR_GetCPS(out_conn, sec->uid, sec->cps, &over);
+ free_db_server_context(&conn_context);
+
if (error) {
fprintf(stderr, "PR_GetCPS error: %s(%d)\n",
koerr_gettext(error), error);
@@ -217,6 +214,12 @@ fs_connsec_createconn(struct rx_connection *conn)
return;
}
+ for (i = 0; i < sec->cps->len; i++) {
+ if (sec->cps->val[i] == PR_SYSADMINID) {
+ sec->superuser = 1;
+ break;
+ }
+ }
}
void
diff --git a/usr.sbin/afs/src/milko/fs/fileserver.c b/usr.sbin/afs/src/milko/fs/fileserver.c
index fc720c41586..b5e41cb1f51 100644
--- a/usr.sbin/afs/src/milko/fs/fileserver.c
+++ b/usr.sbin/afs/src/milko/fs/fileserver.c
@@ -33,7 +33,7 @@
#include "fsrv_locl.h"
-RCSID("$KTH: fileserver.c,v 1.25 2000/12/29 20:03:30 tol Exp $");
+RCSID("$arla: fileserver.c,v 1.30 2002/04/26 16:11:42 lha Exp $");
typedef enum { NO_SALVAGE, NORMAL_SALVAGE, SALVAGE_ALL } salvage_options_e;
@@ -44,15 +44,6 @@ typedef enum { NO_SALVAGE, NORMAL_SALVAGE, SALVAGE_ALL } salvage_options_e;
static struct rx_service *fsservice;
static struct rx_service *volservice;
-static char *cell = NULL;
-static char *realm = NULL;
-static char *srvtab_file = NULL;
-static char *debug_levels = NULL;
-static char *log_file = "syslog";
-static int no_auth = 0;
-static int force_salvage = 0;
-static int salvage_options = NORMAL_SALVAGE;
-
/*
*
*/
@@ -100,8 +91,10 @@ do_salvage (volume_handle *vol)
static int
salvage_and_attach (volume_handle *vol, void *arg)
{
+ int salvage_options = *(int *)arg;
+
mlog_log (MDEBMISC, "salvaging and attatching to volume: %u",
- (u_int32_t)vol->vol);
+ (uint32_t)vol->vol);
switch (salvage_options) {
case NORMAL_SALVAGE:
@@ -126,10 +119,10 @@ salvage_and_attach (volume_handle *vol, void *arg)
*/
static void
-attach_volumes(void)
+attach_volumes(int salvage_options)
{
mlog_log (MDEBMISC, "fileserver starting to attach to volumes");
- vld_iter_vol (salvage_and_attach, NULL);
+ vld_iter_vol (salvage_and_attach, &salvage_options);
mlog_log (MDEBMISC, "fileserver done attaching to volumes");
}
@@ -137,23 +130,34 @@ attach_volumes(void)
* Main
*/
+static char *cell = NULL;
+static char *realm = NULL;
+static char *debug_levels = NULL;
+static char *log_file = "syslog";
+static char *srvtab_file = NULL;
+static int no_auth = 0;
+static int do_help = 0;
+static int force_salvage = 0;
+
static struct agetargs args[] = {
{"cell", 0, aarg_string, &cell, "what cell to use"},
{"realm", 0, aarg_string, &realm, "what realm to use"},
- {"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"},
- {"debug", 0, aarg_string, &debug_levels, "debug level"},
+ {"debug", 'd', aarg_string, &debug_levels, "debug level"},
{"log", 'l', aarg_string, &log_file,
- "where to write log (stderr (default), syslog, or path to file)"},
- {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"},
+ "where to write log (stderr, syslog (default), or path to file)"},
+ {"srvtab", 0, aarg_string, &srvtab_file, "what srvtab to use"},
+ {"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"},
+ {"help", 'h', aarg_flag, &do_help, "help"},
+ {"partdir", 0, aarg_string, &dpart_root, "where to find vicep*"},
{"salvage", 0, aarg_flag, &force_salvage, "Force a salvage for all vols"},
- {"partdir",'s', aarg_string, &dpart_root, "where to find vicep*"},
{ NULL, 0, aarg_end, NULL }
};
static void
-usage(void)
+usage(int exit_code)
{
- aarg_printusage(args, "fileserver", "", AARG_GNUSTYLE);
+ aarg_printusage (args, NULL, "", AARG_GNUSTYLE);
+ exit (exit_code);
}
int
@@ -163,12 +167,12 @@ main(int argc, char **argv)
int optind = 0;
PROCESS pid;
Log_method *method;
+ int salvage_options = NORMAL_SALVAGE;
set_progname (argv[0]);
if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE)) {
- usage ();
- return 1;
+ usage (1);
}
argc -= optind;
@@ -179,7 +183,10 @@ main(int argc, char **argv)
return 1;
}
- method = log_open (get_progname(), log_file);
+ if (do_help)
+ usage(0);
+
+ method = log_open (getprogname(), log_file);
if (method == NULL)
errx (1, "log_open failed");
cell_init(0, method);
@@ -193,17 +200,17 @@ main(int argc, char **argv)
if (debug_levels)
mlog_log_set_level (debug_levels);
- if (force_salvage)
- salvage_options = SALVAGE_ALL;
-
- ropa_init(30000, 100, 40000, 40000, 150, 50000);
-
if (no_auth)
sec_disable_superuser_check ();
if (cell)
cell_setthiscell (cell);
+ if (force_salvage)
+ salvage_options = SALVAGE_ALL;
+
+ ropa_init(30000, 100, 40000, 40000, 150, 50000);
+
network_kerberos_init (srvtab_file);
ret = network_init(htons(afsport), "fs", FS_SERVICE_ID,
@@ -225,7 +232,7 @@ main(int argc, char **argv)
vld_init();
mnode_init (4711); /* XXX */
- attach_volumes();
+ attach_volumes(salvage_options);
rx_SetMaxProcs(fsservice,5) ;
rx_SetMaxProcs(volservice,5) ;
diff --git a/usr.sbin/afs/src/milko/fs/fs_def.h b/usr.sbin/afs/src/milko/fs/fs_def.h
index 8be00849bec..b076094f62a 100644
--- a/usr.sbin/afs/src/milko/fs/fs_def.h
+++ b/usr.sbin/afs/src/milko/fs/fs_def.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999, 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -35,7 +35,7 @@
* Fileserver global defines
*/
-/* $KTH: fs_def.h,v 1.4 2000/10/03 00:17:19 lha Exp $ */
+/* $arla: fs_def.h,v 1.6 2002/01/29 03:54:54 lha Exp $ */
#ifndef __FILBUNKE__FS_DEF_H
#define __FILBUNKE__FS_DEF_H 1
@@ -49,4 +49,6 @@
#define MAX_TRANSACTIONS 100
+#define MILKO_ROFS EROFS
+
#endif /* __FILBUNKE__FS_DEF_H */
diff --git a/usr.sbin/afs/src/milko/fs/fsprocs.c b/usr.sbin/afs/src/milko/fs/fsprocs.c
index a58428b79d3..823bd3d274a 100644
--- a/usr.sbin/afs/src/milko/fs/fsprocs.c
+++ b/usr.sbin/afs/src/milko/fs/fsprocs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,11 +33,24 @@
#include "fsrv_locl.h"
-RCSID("$KTH: fsprocs.c,v 1.55 2001/01/01 20:50:23 lha Exp $");
+RCSID("$arla: fsprocs.c,v 1.68 2003/04/08 00:13:35 lha Exp $");
#define GETHOST(call) rx_HostOf(rx_PeerOf(rx_ConnectionOf((call))))
#define GETPORT(call) rx_PortOf(rx_PeerOf(rx_ConnectionOf((call))))
+int
+createentry(struct rx_call *call,
+ const struct AFSFid *DirFid,
+ const char *Name,
+ const char *Contents,
+ const struct AFSStoreStatus *InStatus,
+ const struct AFSFid *ExistingFid,
+ struct AFSFid *EntryFid,
+ struct AFSFetchStatus *OutFidStatus,
+ struct AFSFetchStatus *OutDirStatus,
+ struct AFSCallBack *CallBack,
+ struct AFSVolSync *VolSync);
+
/*
* Initlize all fields of `m' except `m->flags'.
*/
@@ -75,57 +88,67 @@ fs_update_fs (const struct mnode *n, const struct msec *m,
}
/*
+ * return a non zero value if the user is the superuser.
+ */
+
+static int
+super_user (const struct msec *m)
+{
+ return m->sec->superuser;
+}
+
+/*
* If check if the user have the rights to change `status' the way the
* user want to with the right `sec'. If the entry is about to be
* created, set owner if that isn't set.
*/
static int
-check_ss_bits (const struct msec *sec, const AFSStoreStatus *status,
+check_ss_bits (const struct msec *m, const AFSStoreStatus *status,
Bool createp)
{
/* check if member of system:administrators
- * set VOLOP_ADMIN (might do this a tad earlier too)
*/
if ((status->Mask & SS_OWNER) != 0) {
- if (status->Owner != sec->sec->uid
- && (sec->flags & VOLOP_ADMIN) != 0)
+ if (status->Owner != m->sec->uid && !super_user(m))
return EPERM;
} else if (createp) {
- ((AFSStoreStatus *)status)->Mask |= SS_OWNER; /* XXX */
- ((AFSStoreStatus *)status)->Owner = sec->sec->uid; /* XXX */
+ ((AFSStoreStatus *)status)->Mask |= SS_OWNER; /* XXX */
+ ((AFSStoreStatus *)status)->Owner = m->sec->uid; /* XXX */
}
if ((status->Mask & SS_MODEBITS) != 0) {
- if ((07000 & status->UnixModeBits) != 0
- && (sec->flags & VOLOP_ADMIN) != 0)
+ if ((07000 & status->UnixModeBits) != 0 && !super_user(m))
return EPERM;
}
return 0;
}
/*
- * Given `fid', `volh' and `m' open node `n'.
+ * Given `fid', `volh' and `m' open node `n', check rights.
*/
static int
fs_open_node (const AFSFid *fid, struct volume_handle *volh,
- struct msec *m, struct mnode **n)
+ struct msec *m, struct mnode **n)
{
int ret;
ret = mnode_find (fid, n);
if (ret)
- return ret;
+ return ret;
ret = vld_open_vnode (volh, *n, m);
+ if (ret == 0)
+ ret = vld_check_rights (volh, *n, m);
+
if (ret)
mnode_free (*n, FALSE);
+
return ret;
}
-
/*
* Given `fid' and `call', init `m', `volh' and `n'.
*
@@ -152,7 +175,7 @@ fs_init_req (const AFSFid *fid, struct msec *m, struct volume_handle **volh,
if (ret)
return ret;
- if ((*volh)->flags.offlinep == TRUE) {
+ if (n != NULL && (*volh)->flags.offlinep == TRUE) {
int ret;
if ((*volh)->flags.attacherr)
ret = VOFFLINE;
@@ -164,22 +187,34 @@ fs_init_req (const AFSFid *fid, struct msec *m, struct volume_handle **volh,
return ret;
}
- ret = vld_db_uptodate (*volh);
+#define VOLOP_MODIFY (VOLOP_ADMIN|VOLOP_DELETE|VOLOP_WRITE|\
+ VOLOP_INSERT|VOLOP_LOCK)
+
+ ret = vld_info_uptodatep (*volh);
if (ret) {
vld_free (*volh);
return ret;
}
- ret = fs_open_node (fid, *volh, m, n);
- if (ret) {
+ if ((*volh)->info.type != RWVOL &&
+ (m->flags & VOLOP_MODIFY))
+ {
vld_free (*volh);
- return ret;
+ return MILKO_ROFS;
}
- ret = vld_check_rights (*volh, *n, m);
+ ret = vld_db_uptodate (*volh);
if (ret) {
- mnode_free (*n, FALSE);
vld_free (*volh);
+ return ret;
+ }
+
+ if (n != NULL) {
+ ret = fs_open_node (fid, *volh, m, n);
+ if (ret) {
+ vld_free (*volh);
+ return ret;
+ }
}
return ret;
@@ -190,13 +225,13 @@ fs_init_req (const AFSFid *fid, struct msec *m, struct volume_handle **volh,
*/
int
-RXAFS_FetchData(struct rx_call *call,
- const struct AFSFid *a_fidToFetchP,
- const int32_t a_offset,
- const int32_t a_lenInBytes,
- struct AFSFetchStatus *a_fidStatP,
- struct AFSCallBack *a_callBackP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_FetchData(struct rx_call *call,
+ const struct AFSFid *a_fidToFetchP,
+ const int32_t a_offset,
+ const int32_t a_lenInBytes,
+ struct AFSFetchStatus *a_fidStatP,
+ struct AFSCallBack *a_callBackP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
@@ -245,11 +280,16 @@ RXAFS_FetchData(struct rx_call *call,
}
fs_update_fs (n, &m, a_fidStatP);
+
+ ret = vld_info_uptodatep (volh);
+ if (ret)
+ goto out;
+
ropa_getcallback (GETHOST(call), GETPORT(call),
- a_fidToFetchP, a_callBackP);
+ a_fidToFetchP, a_callBackP, volh->info.type);
vld_vld2volsync (volh, a_volSyncP);
-out:
+ out:
mnode_free (n, FALSE);
vld_free (volh);
@@ -266,8 +306,19 @@ out:
static int
i2nlist (idlist *ilist, namelist *nlist)
{
+ int i;
/* XXX convert the number is the ilist to name-as-numbers */
- return ENETDOWN;
+
+ nlist->val = malloc(sizeof(nlist->val[0]) * ilist->len);
+ if (nlist->val == NULL)
+ return ENOMEM;
+
+ for (i = 0; i < ilist->len; i++)
+ snprintf(nlist->val[i], sizeof(nlist->val[i]), "%d", ilist->val[i]);
+
+ nlist->len = ilist->len;
+
+ return 0;
}
@@ -276,17 +327,17 @@ i2nlist (idlist *ilist, namelist *nlist)
*/
int
-RXAFS_FetchACL(struct rx_call *call,
- const struct AFSFid *a_dirFidP,
- AFSOpaque *a_ACLP,
- struct AFSFetchStatus *a_dirNewStatP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_FetchACL(struct rx_call *call,
+ const struct AFSFid *a_dirFidP,
+ AFSOpaque *a_ACLP,
+ struct AFSFetchStatus *a_dirNewStatP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
struct mnode *n;
struct msec m;
int ret;
- int i;
+ int i, j;
char *tempacl, *tempacl_old;
int num_negacl, num_posacl;
namelist nlist;
@@ -312,17 +363,22 @@ RXAFS_FetchACL(struct rx_call *call,
return EPERM;
}
+ j = 0;
+ num_negacl = 0;
+ num_posacl = 0;
nlist.len = 0;
nlist.val = NULL;
- ilist.len = 2*FS_MAX_ACL;
ilist.val = malloc(2*FS_MAX_ACL*sizeof(int32_t));
- for (i = 0; i < FS_MAX_ACL; i++) {
- ilist.val[i] = n->e.u.dir.acl[i].owner;
- }
- for (i = 0; i < FS_MAX_ACL; i++) {
- ilist.val[i+FS_MAX_ACL] = n->e.u.dir.negacl[i].owner;
- }
+ for (i = 0; i < FS_MAX_ACL && n->e.u.dir.acl[i].owner != 0; i++, j++)
+ ilist.val[j] = n->e.u.dir.acl[i].owner;
+ num_posacl = j;
+
+ for (i = 0; i < FS_MAX_ACL && n->e.u.dir.negacl[i].owner != 0; i++, j++)
+ ilist.val[j] = n->e.u.dir.negacl[i].owner;
+ num_negacl = j - num_posacl;
+
+ ilist.len = j;
ret = fs_connsec_idtoname(&ilist, &nlist);
switch (ret) {
@@ -334,58 +390,53 @@ RXAFS_FetchACL(struct rx_call *call,
goto err_out;
break;
+ case 0:
+ break;
default:
goto err_out;
}
tempacl = NULL;
tempacl_old = strdup("");
- num_negacl = 0;
- num_posacl = 0;
/* Make string with all positive ACL:s */
- for (i = 0; i < FS_MAX_ACL; i++) {
- if (n->e.u.dir.acl[i].owner == 0)
- continue;
- if (asnprintf(&tempacl, AFSOPAQUEMAX, "%s%s %d\n",
- tempacl_old,
- nlist.val[i],
- n->e.u.dir.acl[i].flags) == -1) {
+ for (i = 0; i < num_posacl; i++) {
+ if (asprintf(&tempacl, "%s%s %d\n",
+ tempacl_old,
+ nlist.val[i],
+ n->e.u.dir.acl[i].flags) == -1) {
ret = EINVAL /* XXX what is the error code? */;
free(tempacl_old);
goto err_out;
}
- num_posacl++;
free(tempacl_old);
tempacl_old = tempacl;
tempacl = NULL;
}
/* Add negative ACL:s to string */
- for (i = 0; i < FS_MAX_ACL; i++) {
- if (n->e.u.dir.negacl[i].owner == 0)
- continue;
- if (asnprintf(&tempacl, AFSOPAQUEMAX, "%s%s %d\n",
- tempacl_old,
- nlist.val[i+FS_MAX_ACL],
- n->e.u.dir.negacl[i].flags) == -1) {
+ for (i = 0; i < num_negacl; i++) {
+ if (asprintf(&tempacl, "%s%s %d\n",
+ tempacl_old,
+ nlist.val[i+num_posacl],
+ n->e.u.dir.negacl[i].flags) == -1) {
ret = EINVAL /* XXX what is the error code? */;
free(tempacl_old);
goto err_out;
}
- num_negacl++;
free(tempacl_old);
tempacl_old = tempacl;
tempacl = NULL;
}
- asnprintf(&tempacl, AFSOPAQUEMAX, "%d\n%d\n%s",
- num_posacl, num_negacl, tempacl_old);
+ asprintf(&tempacl, "%d\n%d\n%s",
+ num_posacl, num_negacl, tempacl_old);
free(tempacl_old);
tempacl_old = NULL;
- a_ACLP->len = strlen(tempacl);
+ a_ACLP->len = max(strlen(tempacl), AFSOPAQUEMAX);
a_ACLP->val = tempacl;
+ tempacl[a_ACLP->len - 1] = '\0';
err_out:
free(ilist.val);
@@ -404,11 +455,11 @@ RXAFS_FetchACL(struct rx_call *call,
*/
int
-RXAFS_FetchStatus(struct rx_call *call,
- const struct AFSFid *a_fidToStatP,
- struct AFSFetchStatus *a_currStatP,
- struct AFSCallBack *a_callBackP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_FetchStatus(struct rx_call *call,
+ const struct AFSFid *a_fidToStatP,
+ struct AFSFetchStatus *a_currStatP,
+ struct AFSCallBack *a_callBackP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
struct mnode *n;
@@ -416,23 +467,31 @@ RXAFS_FetchStatus(struct rx_call *call,
int ret;
mlog_log (MDEBFS, "FetchStatus: fid: %u.%u.%u",
- (u_int32_t)a_fidToStatP->Volume, (u_int32_t)a_fidToStatP->Vnode,
- (u_int32_t)a_fidToStatP->Unique);
+ (uint32_t)a_fidToStatP->Volume, (uint32_t)a_fidToStatP->Vnode,
+ (uint32_t)a_fidToStatP->Unique);
m.flags = VOLOP_GETSTATUS;
ret = fs_init_req (a_fidToStatP, &m, &volh, call, &n);
if (ret)
- return ret;
+ goto out;
fs_update_fs (n, &m, a_currStatP);
+
+ ret = vld_info_uptodatep (volh);
+ if (ret)
+ goto out_free;
+
ropa_getcallback (GETHOST(call), GETPORT(call),
- a_fidToStatP, a_callBackP);
+ a_fidToStatP, a_callBackP, volh->info.type);
vld_vld2volsync (volh, a_volSyncP);
+
+ out_free:
mnode_free (n, FALSE);
vld_free (volh);
+ out:
mlog_log (MDEBFS, "FetchStatus: ret = %d (at end), calleraccess = %x\n",
ret, a_currStatP->CallerAccess);
@@ -444,14 +503,14 @@ RXAFS_FetchStatus(struct rx_call *call,
*/
int
-RXAFS_StoreData(struct rx_call *call,
- const struct AFSFid *a_fidToStoreP,
- const struct AFSStoreStatus *a_fidStatusP,
- const int32_t a_offset,
- const int32_t a_lenInBytes,
- const int32_t a_fileLenInBytes,
- struct AFSFetchStatus *a_fidStatP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_StoreData(struct rx_call *call,
+ const struct AFSFid *a_fidToStoreP,
+ const struct AFSStoreStatus *a_fidStatusP,
+ const int32_t a_offset,
+ const int32_t a_lenInBytes,
+ const int32_t a_fileLenInBytes,
+ struct AFSFetchStatus *a_fidStatP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
struct mnode *n;
@@ -541,11 +600,11 @@ skipline(char **curptr)
*/
int
-RXAFS_StoreACL(struct rx_call *call,
- const struct AFSFid *a_dirFidP,
- const AFSOpaque *a_ACLToStoreP,
- struct AFSFetchStatus *a_dirNewStatP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_StoreACL(struct rx_call *call,
+ const struct AFSFid *a_dirFidP,
+ const AFSOpaque *a_ACLToStoreP,
+ struct AFSFetchStatus *a_dirNewStatP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
struct mnode *n;
@@ -564,10 +623,7 @@ RXAFS_StoreACL(struct rx_call *call,
a_dirFidP->Volume, a_dirFidP->Vnode,
a_dirFidP->Unique);
- m.flags = VOLOP_WRITE | VOLOP_GETSTATUS | VOLOP_ADMIN;
-#if 1
- m.flags |= VOLOP_NOCHECK; /* XXX */
-#endif
+ m.flags = VOLOP_GETSTATUS | VOLOP_ADMIN;
ret = fs_init_req (a_dirFidP, &m, &volh, call, &n);
if (ret)
@@ -653,11 +709,11 @@ RXAFS_StoreACL(struct rx_call *call,
*/
int
-RXAFS_StoreStatus(struct rx_call *call,
- const struct AFSFid *a_fidP,
- const struct AFSStoreStatus *a_currStatusP,
- struct AFSFetchStatus *a_srStatusP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_StoreStatus(struct rx_call *call,
+ const struct AFSFid *a_fidP,
+ const struct AFSStoreStatus *a_currStatusP,
+ struct AFSFetchStatus *a_srStatusP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
struct mnode *n;
@@ -705,14 +761,15 @@ removenode (struct rx_call *call,
struct AFSVolSync *a_volSyncP,
int dirp)
{
- fbuf the_fbuf;
struct volume_handle *volh;
struct mnode *n;
- struct msec m;
- VenusFid parentFid, fid;
+ struct mnode *child_n;
+ struct msec m, pm;
+ AFSFid fid;
int ret;
int32_t new_len;
-
+ unsigned long child_linkcount;
+
m.flags = VOLOP_GETSTATUS|VOLOP_DELETE;
ret = fs_init_req (a_dirFidP, &m, &volh, call, &n);
@@ -727,91 +784,61 @@ removenode (struct rx_call *call,
return ENOTDIR;
}
- ret = fbuf_create (&the_fbuf, n->fd, n->fs.Length,
- FBUF_READ|FBUF_WRITE|FBUF_SHARED);
+ pm.flags = VOLOP_GETSTATUS|VOLOP_READ|VOLOP_NOCHECK;
+ fs_init_msec (call, &pm);
+ pm.loop = m.loop + 1;
+
+ ret = mdir_lookup(n, a_name, &fid);
if (ret) {
- mnode_free (n, FALSE);
- vld_free (volh);
- return ret;
+ mnode_free (n, FALSE);
+ vld_free (volh);
+ return ret;
}
- parentFid.Cell = 0;
- parentFid.fid = n->fid;
-
- ret = fdir_lookup (&the_fbuf, &parentFid, a_name, &fid);
- if (ret) {
- fbuf_end (&the_fbuf);
- mnode_free (n, FALSE);
- vld_free (volh);
- return ret;
+ if (afs_dir_p (fid.Vnode) != dirp) {
+ mnode_free (n, FALSE);
+ vld_free (volh);
+ return dirp ? ENOTDIR : EISDIR;
}
-
- if (afs_dir_p (fid.fid.Vnode) != dirp) {
- fbuf_end (&the_fbuf);
- mnode_free (n, FALSE);
- vld_free (volh);
- return dirp ? ENOTDIR : EISDIR;
+
+ ret = fs_open_node (&fid, volh, &pm, &child_n);
+ if (ret) {
+ mnode_free (n, FALSE);
+ vld_free (volh);
+ return ret;
}
if (dirp) {
- fbuf dirfbuf;
- struct msec pm;
- struct mnode *parent_n;
-
- pm.flags = VOLOP_GETSTATUS|VOLOP_READ|VOLOP_NOCHECK;
- fs_init_msec (call, &pm);
- pm.loop = m.loop + 1;
-
- ret = fs_open_node (&fid.fid, volh, &pm, &parent_n);
- if (ret) {
- fbuf_end (&the_fbuf);
- mnode_free (n, FALSE);
- vld_free (volh);
- return ret;
- }
-
- assert (parent_n->flags.fdp);
- assert (parent_n->flags.fsp);
-
- ret = fbuf_create (&dirfbuf, parent_n->fd, parent_n->fs.Length,
- FBUF_READ|FBUF_PRIVATE);
- if (ret) {
- fbuf_end (&the_fbuf);
- mnode_free (parent_n, FALSE);
- mnode_free (n, FALSE);
- vld_free (volh);
- return ret;
- }
-
- ret = fdir_emptyp (&dirfbuf);
- fbuf_end (&dirfbuf);
- mnode_free (parent_n, TRUE);
+ ret = mdir_emptyp (child_n);
if (!ret) {
- fbuf_end (&the_fbuf);
mnode_free (n, FALSE);
+ mnode_free (child_n, FALSE);
vld_free (volh);
- return ENOTEMPTY;
+ return EEXIST;
}
}
- ret = fdir_remove (&the_fbuf, a_name, &fid.fid);
-
- new_len = fbuf_len (&the_fbuf);
- fbuf_end (&the_fbuf);
-
+ ret = mdir_remove(n, a_name);
if (ret) {
mnode_free (n, FALSE);
+ mnode_free (child_n, FALSE);
vld_free (volh);
return ret;
}
- mnode_remove (&fid.fid);
- ret = vld_remove_node (volh, fid.fid.Vnode);
+ /* removes node if necessary */
+ ret = vld_adjust_linkcount (volh, child_n, dirp ? -2 : -1);
if (ret) {
mnode_free (n, FALSE);
+ mnode_free (child_n, FALSE);
vld_free (volh);
return ret;
}
+
+ child_linkcount = n->fs.LinkCount;
+
+ mnode_free (child_n, FALSE);
+
if (dirp) {
ret = vld_adjust_linkcount (volh, n, -1);
if (ret) {
@@ -820,15 +847,27 @@ removenode (struct rx_call *call,
return ret;
}
}
-
+
+ new_len = n->sb.st_size;
ret = vld_modify_vnode (volh, n, &m, NULL, &new_len);
fs_update_fs (n, &m, a_srvStatusP);
- fid.fid.Volume = a_dirFidP->Volume;
+ fid.Volume = a_dirFidP->Volume;
if (ret == 0) {
- ropa_break_callback (GETHOST(call), GETPORT(call), &fid.fid, TRUE);
+ if (child_linkcount)
+ ropa_break_callback (GETHOST(call), GETPORT(call), &fid, TRUE);
+ else {
+ AFSCBFids cbfids;
+ AFSCBs cbs;
+
+ cbfids.len = 1;
+ cbfids.val = &fid;
+ cbs.len = 0;
+
+ ropa_drop_callbacks(GETHOST(call), GETPORT(call), &cbfids, &cbs);
+ }
ropa_break_callback (GETHOST(call), GETPORT(call), a_dirFidP, FALSE);
}
@@ -844,11 +883,11 @@ removenode (struct rx_call *call,
*/
int
-RXAFS_RemoveFile(struct rx_call *call,
- const struct AFSFid *a_dirFidP,
- const char *a_name,
- struct AFSFetchStatus *a_srvStatusP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_RemoveFile(struct rx_call *call,
+ const struct AFSFid *a_dirFidP,
+ const char *a_name,
+ struct AFSFetchStatus *a_srvStatusP,
+ struct AFSVolSync *a_volSyncP)
{
mlog_log (MDEBFS, "RemoveFile: fid: %d.%d.%d name: %s",
a_dirFidP->Volume, a_dirFidP->Vnode,
@@ -863,15 +902,17 @@ RXAFS_RemoveFile(struct rx_call *call,
*/
int
-RXAFS_CreateFile(struct rx_call *call,
- const struct AFSFid *DirFid,
- const char *Name,
- const struct AFSStoreStatus *InStatus,
- struct AFSFid *OutFid,
- struct AFSFetchStatus *OutFidStatus,
- struct AFSFetchStatus *OutDirStatus,
- struct AFSCallBack *CallBack,
- struct AFSVolSync *a_volSyncP)
+createentry(struct rx_call *call,
+ const struct AFSFid *DirFid,
+ const char *Name,
+ const char *Contents,
+ const struct AFSStoreStatus *InStatus,
+ const struct AFSFid *ExistingFid,
+ struct AFSFid *EntryFid,
+ struct AFSFetchStatus *OutFidStatus,
+ struct AFSFetchStatus *OutDirStatus,
+ struct AFSCallBack *CallBack,
+ struct AFSVolSync *VolSync)
{
struct volume_handle *volh;
struct mnode *n;
@@ -879,11 +920,8 @@ RXAFS_CreateFile(struct rx_call *call,
struct msec m;
struct msec child_m;
AFSFid child;
+ int32_t len;
int ret;
-
- mlog_log (MDEBFS, "CreateFile: fid: %d.%d.%d name: %s",
- DirFid->Volume, DirFid->Vnode,
- DirFid->Unique, Name);
m.flags = VOLOP_GETSTATUS|VOLOP_INSERT;
@@ -896,6 +934,7 @@ RXAFS_CreateFile(struct rx_call *call,
if (n->fs.FileType != TYPE_DIR) {
mnode_free (n, FALSE);
+ vld_free (volh);
return EPERM;
}
@@ -906,55 +945,131 @@ RXAFS_CreateFile(struct rx_call *call,
child_m.caller_access = m.caller_access;
child_m.anonymous_access = m.anonymous_access;
- ret = check_ss_bits (&m, InStatus, TRUE);
- if (ret)
- goto out_parent;
+ if (InStatus) {
+ ret = check_ss_bits (&m, InStatus, TRUE);
+ if (ret == 0) {
+ AFSFid existing;
+ ret = mdir_lookup (n, Name, &existing);
+ if (ret == 0)
+ ret = EEXIST;
+ else if (ret == ENOENT)
+ ret = 0;
+ }
+
+ if (ret == 0)
+ ret = vld_create_entry (volh, n, &child,
+ Contents ? TYPE_LINK : TYPE_FILE,
+ InStatus, &child_n, &child_m);
+
+ if (ret)
+ goto out_parent;
+ } else {
+ ret = fs_open_node (ExistingFid, volh, &child_m, &child_n);
+ if (ret) {
+ mlog_log(MDEBFS,
+ "createentry: Failed to open existing fid, ret = %d", ret);
+ goto out_parent;
+ }
+
+ if (child_n->fs.ParentVnode != DirFid->Vnode
+ || child_n->fs.ParentUnique != DirFid->Unique) {
+ ret = EXDEV;
+ mlog_log (MDEBFS, "createentry: ret = %d (EXDEV)", EXDEV);
+ goto out_child;
+ }
+ ret = vld_adjust_linkcount (volh, child_n, 1);
+ if (ret)
+ goto out_child;
- ret = vld_create_entry (volh, n, &child, TYPE_FILE,
- InStatus, &child_n, &child_m);
- if (ret)
- goto out_parent;
+ child = *ExistingFid;
+ }
/* XXX check name ! */
ret = mdir_creat (n, Name, child);
if (ret == 0) {
- int32_t len = n->sb.st_size;
+ len = n->sb.st_size;
ret = vld_modify_vnode (volh, n, &m, NULL, &len);
}
+ if (Contents && ret == 0) {
+ assert (child_n->flags.fdp);
+
+ len = strlen (Contents);
+ ret = write (child_n->fd, Contents, len);
+ if (ret != len) {
+ ret = errno;
+ mlog_log (MDEBFS, "createentry: ret = %d (write)", ret);
+ } else {
+ ret = vld_modify_vnode (volh, child_n, &child_m, NULL, &len);
+ }
+ }
+
if (ret) {
+ mdir_remove (n, Name);
+ vld_adjust_linkcount (volh, child_n, -1);
mnode_free (n, TRUE);
mnode_free (child_n, TRUE);
vld_free (volh);
- mnode_remove (&child);
- vld_remove_node (volh, child.Vnode);
return ret;
}
+ if (EntryFid)
+ *EntryFid = child;
+
fs_update_fs (child_n, &child_m, OutFidStatus);
fs_update_fs (n, &m, OutDirStatus);
- if (ret == 0)
- *OutFid = child;
+ ret = vld_info_uptodatep (volh);
+ if (ret)
+ goto out_child;
- if (ret == 0) {
- ropa_getcallback (GETHOST(call), GETPORT(call),
- OutFid, CallBack);
- ropa_break_callback (GETHOST(call), GETPORT(call), DirFid, FALSE);
-
- }
+ if (CallBack)
+ ropa_getcallback (GETHOST(call), GETPORT(call), EntryFid, CallBack,
+ volh->info.type);
+ ropa_break_callback (GETHOST(call), GETPORT(call), DirFid, FALSE);
+ vld_vld2volsync (volh, VolSync);
+ out_child:
mnode_free (child_n, FALSE);
out_parent:
mnode_free (n, FALSE);
- vld_vld2volsync (volh, a_volSyncP);
vld_free (volh);
- mlog_log (MDEBFS, "CreateFile: created fid: %d.%d.%d calleraccess: %x",
- OutFid->Volume, OutFid->Vnode,
- OutFid->Unique, OutFidStatus->CallerAccess);
+ return ret;
+}
+
+/*
+ *
+ */
+
+int
+SRXAFS_CreateFile(struct rx_call *call,
+ const struct AFSFid *DirFid,
+ const char *Name,
+ const struct AFSStoreStatus *InStatus,
+ struct AFSFid *OutFid,
+ struct AFSFetchStatus *OutFidStatus,
+ struct AFSFetchStatus *OutDirStatus,
+ struct AFSCallBack *CallBack,
+ struct AFSVolSync *a_volSyncP)
+{
+ int ret;
+
+ mlog_log (MDEBFS, "CreateFile: fid: %d.%d.%d name: %s",
+ DirFid->Volume, DirFid->Vnode,
+ DirFid->Unique, Name);
+ ret = createentry(call, DirFid, Name, NULL, InStatus, NULL, OutFid,
+ OutFidStatus, OutDirStatus, CallBack, a_volSyncP);
+
+ if (ret)
+ mlog_log (MDEBFS, "CreateFile: failed with ret = %d", ret);
+ else
+ mlog_log (MDEBFS, "CreateFile: created fid: %d.%d.%d calleraccess: %x",
+ OutFid->Volume, OutFid->Vnode,
+ OutFid->Unique, OutFidStatus->CallerAccess);
+
return ret;
}
@@ -963,26 +1078,28 @@ RXAFS_CreateFile(struct rx_call *call,
*/
int
-RXAFS_Rename(struct rx_call *call,
- const struct AFSFid *a_origDirFidP,
- const char *a_origNameP,
- const struct AFSFid *a_newDirFidP,
- const char *a_newNameP,
- struct AFSFetchStatus *a_origDirStatusP,
- struct AFSFetchStatus *a_newDirStatusP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_Rename(struct rx_call *call,
+ const struct AFSFid *a_origDirFidP,
+ const char *a_origNameP,
+ const struct AFSFid *a_newDirFidP,
+ const char *a_newNameP,
+ struct AFSFetchStatus *a_origDirStatusP,
+ struct AFSFetchStatus *a_newDirStatusP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
- fbuf origfbuf;
- fbuf newfbuf;
- fbuf *newfbufP = &newfbuf;
- VenusFid child, origVFid;
- struct mnode *orig_n, *new_n;
- struct msec orig_m;
- struct msec new_m;
+ AFSFid victim, child;
+ struct mnode *orig_n, *new_n = NULL;
+ struct mnode *child_n = NULL, *victim_n = NULL;
+ struct msec m1, m2;
+ struct msec *orig_m = &m1, *new_m = &m2;
+ int32_t len1, len2;
int ret;
+ int dirp;
int same_dir = FALSE;
-
+ int delete_dest = FALSE;
+ int victim_deleted = FALSE;
+
mlog_log (MDEBFS, "Rename: orig_fid: %d.%d.%d orig_name: %s "
"new_fid: %d.%d.%d new_name: %s",
a_origDirFidP->Volume, a_origDirFidP->Vnode,
@@ -993,145 +1110,159 @@ RXAFS_Rename(struct rx_call *call,
if (a_origDirFidP->Volume != a_newDirFidP->Volume)
return EXDEV;
- orig_m.flags = VOLOP_GETSTATUS|VOLOP_DELETE;
- if (a_origDirFidP->Vnode == a_newDirFidP->Vnode
- && a_origDirFidP->Unique == a_newDirFidP->Unique)
- orig_m.flags |= VOLOP_INSERT;
+ if (!(afs_dir_p(a_origDirFidP->Vnode))
+ || !(afs_dir_p(a_newDirFidP->Vnode)))
+ return EPERM;
- ret = fs_init_req (a_origDirFidP, &orig_m, &volh, call, &orig_n);
+ if (a_origDirFidP->Vnode == a_newDirFidP->Vnode &&
+ a_origDirFidP->Unique == a_newDirFidP->Unique) {
+ same_dir = TRUE;
+ orig_m->flags = VOLOP_GETSTATUS|VOLOP_INSERT|VOLOP_DELETE;
+ } else {
+ orig_m->flags = VOLOP_GETSTATUS|VOLOP_DELETE;
+ }
+
+ ret = fs_init_req (a_origDirFidP, orig_m, &volh, call, &orig_n);
if (ret)
return ret;
assert (orig_n->flags.fdp);
assert (orig_n->flags.fsp);
- if (orig_n->fs.FileType != TYPE_DIR) {
- mnode_free (orig_n, FALSE);
- return EPERM;
- }
-
- origVFid.Cell = 0;
- origVFid.fid = *a_origDirFidP;
-
- ret = fbuf_create (&origfbuf, orig_n->fd, orig_n->sb.st_size,
- FBUF_READ|FBUF_WRITE|FBUF_SHARED);
+ ret = mdir_lookup(orig_n, a_origNameP, &child);
+ if (ret == 0)
+ ret = fs_open_node (&child, volh, orig_m, &child_n);
if (ret) {
mnode_free (orig_n, FALSE);
- vld_free (volh);
return ret;
}
- ret = fdir_lookup(&origfbuf, &origVFid, a_origNameP, &child);
- if (ret) {
- fbuf_end (&origfbuf);
- mnode_free (orig_n, FALSE);
- vld_free (volh);
- return ret;
- }
+ assert(child_n->flags.fsp);
- if (a_origDirFidP->Vnode == a_newDirFidP->Vnode &&
- a_origDirFidP->Unique == a_newDirFidP->Unique) {
+ dirp = afs_dir_p(child.Vnode);
+ if (same_dir == FALSE && child_n->fs.LinkCount != (dirp ? 2 : 1)) {
+ ret = EXDEV;
+ goto out1;
+ }
- newfbufP = &origfbuf;
- same_dir = TRUE;
+ if (same_dir == TRUE) {
+ new_n = orig_n;
+ new_m = orig_m;
} else {
- new_m.flags = VOLOP_GETSTATUS|VOLOP_INSERT;
-
+ new_m->flags = VOLOP_GETSTATUS|VOLOP_INSERT|VOLOP_DELETE;
+
/* XXX */
- ret = fs_init_req (a_newDirFidP, &new_m, &volh, call, &new_n);
+ ret = fs_init_msec(call, new_m);
+ ret = fs_open_node (a_newDirFidP, volh, new_m, &new_n);
if (ret) {
- fbuf_end (&origfbuf);
- mnode_free (orig_n, FALSE);
- vld_free (volh);
- return ret;
+ new_m->flags = VOLOP_GETSTATUS|VOLOP_INSERT;
+
+ /* XXX */
+ ret = fs_open_node (a_newDirFidP, volh, new_m, &new_n);
+ if (ret) {
+ mnode_free (orig_n, FALSE);
+ vld_free (volh);
+ return ret;
+ }
}
-
- if (new_n->fs.FileType != TYPE_DIR) {
- mnode_free (new_n, FALSE);
- fbuf_end (&origfbuf);
- mnode_free (orig_n, FALSE);
- vld_free (volh);
- return EPERM;
+ }
+
+ ret = mdir_lookup(new_n, a_newNameP, &victim);
+ if (!ret) {
+ if (!(new_m->flags & VOLOP_DELETE)
+ || afs_dir_p(victim.Vnode) != dirp) {
+ ret = EPERM;
+ goto out1;
}
+ delete_dest = TRUE;
+ ret = fs_open_node (&victim, volh, new_m, &victim_n);
+ if (ret)
+ goto out1;
+
+ assert(victim_n->flags.fsp);
+
+ if (child_n->fs.LinkCount != (dirp ? 2 : 1)) {
+ ret = EPERM;
+ mnode_free(victim_n, FALSE);
+ goto out1;
+ }
+ }
+
+ ret = mdir_rename(orig_n, a_origNameP, &len1,
+ new_n, a_newNameP, &len2);
- ret = fbuf_create (&newfbuf, new_n->fd,
- new_n->sb.st_size,
- FBUF_READ|FBUF_WRITE|FBUF_SHARED);
+ if (ret) {
+ if (delete_dest == TRUE)
+ mnode_free(victim_n, FALSE);
+ goto out1;
+ }
+
+ if (!ret && dirp) {
+ ret = mdir_changefid(child_n, "..", *a_newDirFidP);
if (ret) {
- mnode_free (new_n, FALSE);
- fbuf_end (&origfbuf);
- mnode_free (orig_n, FALSE);
- vld_free (volh);
- return ret;
+ /* XXX recover */
}
}
- {
- VenusFid sentenced_file;
- VenusFid dir;
-
- dir.fid = *a_newDirFidP;
- dir.Cell = 0;
+ if (delete_dest == TRUE) {
+ /* remove the node if necessary */
+ ret = vld_adjust_linkcount (volh, victim_n,
+ -(afs_dir_p(victim.Vnode) ? 2 : 1));
+ if (victim_n->fs.LinkCount == 0)
+ victim_deleted = TRUE;
- if(fdir_lookup(newfbufP, &dir, a_newNameP, &sentenced_file)) {
- ret = fdir_creat (newfbufP, a_newNameP, child.fid);
- if (ret)
- goto out1;
- } else {
- if (afs_dir_p (sentenced_file.fid.Vnode)) { /* XXX check properly */
- ret = EISDIR;
- goto out1;
- }
- mnode_remove (&sentenced_file.fid);
- ret = fdir_changefid(newfbufP, a_newNameP, &child);
- if (ret)
- goto out1;
- ret = vld_remove_node(volh, sentenced_file.fid.Vnode);
- if (ret) {
- /*
- * Remove failed, try to recover.
- * Do not check for error, things are bad anyway.
- * Maybe this should cause a shutdown + salvage?
- */
- fdir_changefid(newfbufP, a_newNameP, &sentenced_file);
- goto out1;
- }
+ mnode_free(victim_n, FALSE);
+ if (ret) {
+ /*
+ * XXX Remove failed, try to recover.
+ * Do not check for error, things are bad anyway.
+ * Maybe this should cause a shutdown + salvage?
+ */
+ goto out1;
}
}
- ret = fdir_remove (&origfbuf, a_origNameP, NULL);
- if (ret == 0) {
- int32_t len;
- len = fbuf_len (&origfbuf);
- vld_modify_vnode (volh, orig_n, &orig_m, NULL, &len);
- if (!same_dir) {
- len = fbuf_len (newfbufP);
- vld_modify_vnode (volh, new_n, &new_m, NULL, &len);
- }
+ /* Update linkcount on parents if directory move */
+ if (dirp && !same_dir) {
+ ret = vld_adjust_linkcount (volh, orig_n, -1);
+ ret = vld_adjust_linkcount (volh, new_n, 1);
}
- /* XXX Update linkcount on parents if directory move */
+ /* XXX update st_ctime and st_mtime of both parents */
- fs_update_fs (orig_n, &orig_m, a_origDirStatusP);
+ vld_modify_vnode (volh, orig_n, orig_m, NULL, &len1);
if (!same_dir)
- fs_update_fs (new_n, &new_m, a_newDirStatusP);
- else
- fs_update_fs (orig_n, &orig_m, a_newDirStatusP);
+ vld_modify_vnode (volh, new_n, new_m, NULL, &len2);
+
+ fs_update_fs (orig_n, orig_m, a_origDirStatusP);
+ fs_update_fs (new_n, new_m, a_newDirStatusP);
ropa_break_callback (GETHOST(call), GETPORT(call), a_origDirFidP, FALSE);
- if (!same_dir)
+ if (!same_dir) {
ropa_break_callback (GETHOST(call),GETPORT(call), a_newDirFidP, FALSE);
- /* Don't break child since data hasn't changed */
-
+ if (dirp)
+ ropa_break_callback (GETHOST(call), GETPORT(call), &child, FALSE);
+ }
+ if (victim_deleted == TRUE) {
+ AFSCBFids cbfids;
+ AFSCBs cbs;
+
+ cbfids.len = 1;
+ cbfids.val = &victim;
+ cbs.len = 0;
+
+ ropa_drop_callbacks(GETHOST(call), GETPORT(call), &cbfids, &cbs);
+ } else
+ ropa_break_callback(GETHOST(call), GETPORT(call), &victim, TRUE);
+
out1:
- fbuf_end (&origfbuf);
mnode_free (orig_n, FALSE);
- if (!same_dir) {
- fbuf_end (&newfbuf);
+ if (child_n)
+ mnode_free (child_n, FALSE);
+ if (!same_dir && new_n)
mnode_free (new_n, FALSE);
- }
if (ret == 0)
vld_vld2volsync (volh, a_volSyncP);
@@ -1146,136 +1277,32 @@ RXAFS_Rename(struct rx_call *call,
*/
int
-RXAFS_Symlink(struct rx_call *call,
- const struct AFSFid *a_dirFidP,
- const char *a_nameP,
- const char *a_linkContentsP,
- const struct AFSStoreStatus *a_origDirStatP,
- struct AFSFid *a_newFidP,
- struct AFSFetchStatus *a_newFidStatP,
- struct AFSFetchStatus *a_newDirStatP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_Symlink(struct rx_call *call,
+ const struct AFSFid *a_dirFidP,
+ const char *a_nameP,
+ const char *a_linkContentsP,
+ const struct AFSStoreStatus *a_origDirStatP,
+ struct AFSFid *a_newFidP,
+ struct AFSFetchStatus *a_newFidStatP,
+ struct AFSFetchStatus *a_newDirStatP,
+ struct AFSVolSync *a_volSyncP)
{
- struct volume_handle *volh;
- VenusFid a_vchild, a_vdirFid;
- AFSFid child;
- fbuf the_fbuf;
- struct mnode *n;
- struct msec m;
- struct mnode *child_n;
- struct msec child_m;
int ret;
- int len;
mlog_log (MDEBFS, "Symlink: fid: %d.%d.%d name: %s content: %s",
a_dirFidP->Volume, a_dirFidP->Vnode,
a_dirFidP->Unique, a_nameP, a_linkContentsP);
- m.flags = VOLOP_GETSTATUS|VOLOP_INSERT;
-
- ret = fs_init_req (a_dirFidP, &m, &volh, call, &n);
- if (ret) {
- mlog_log (MDEBFS, "Symlink: ret = %d (init_req)", ret);
- return ret;
- }
-
- assert (n->flags.fdp);
- assert (n->flags.fsp);
-
- if (n->fs.FileType != TYPE_DIR) {
- mnode_free (n, FALSE);
- mlog_log (MDEBFS, "Symlink: ret = %d (not DIR)", EPERM);
- return EPERM;
- }
+ ret = createentry(call, a_dirFidP, a_nameP, a_linkContentsP,
+ a_origDirStatP, NULL, a_newFidP, a_newFidStatP,
+ a_newDirStatP, NULL, a_volSyncP);
- ret = check_ss_bits (&m, a_origDirStatP, TRUE);
if (ret)
- goto out_parent;
-
- a_vdirFid.Cell = 0;
- a_vdirFid.fid = *a_dirFidP;
-
- ret = fbuf_create (&the_fbuf, n->fd, n->sb.st_size,
- FBUF_READ|FBUF_WRITE|FBUF_SHARED);
- if (ret) {
- mlog_log (MDEBFS, "Symlink: ret = %d (fbuf_create)", ret);
- goto out_parent;
- }
-
- ret = fdir_lookup (&the_fbuf, &a_vdirFid, a_nameP, &a_vchild);
- if (ret != ENOENT) {
- fbuf_end (&the_fbuf);
- mnode_free (n, FALSE);
- vld_free (volh);
- if (ret == 0) {
- mlog_log (MDEBFS, "Symlink: ret = %d (EEXIST)", EEXIST);
- return EEXIST;
- } else {
- mlog_log (MDEBFS, "Symlink: ret = %d (fdir_lookup)", ret);
- return ret;
- }
- }
-
- child.Volume = volh->vol;
-
- child_m.flags = VOLOP_GETSTATUS;
- fs_init_msec (call, &child_m);
-
- ret = vld_create_entry (volh, n, &child, TYPE_LINK,
- a_origDirStatP, &child_n, &child_m);
- if (ret) {
- fbuf_end (&the_fbuf); /* XXX error ? */
- mnode_free (n, FALSE);
- vld_free (volh);
- mlog_log (MDEBFS, "Symlink: ret = %d (vld_create_entry)", ret);
- return ret;
- }
- a_vchild.Cell = 0;
- a_vchild.fid = child;
-
- /* XXX check name ! */
- ret = fdir_creat (&the_fbuf, a_nameP, child);
- if (ret == 0) {
- int32_t len = fbuf_len (&the_fbuf);
- vld_modify_vnode (volh, n, &m, NULL, &len);
- }
-
- fbuf_end (&the_fbuf); /* XXX error ? */
-
- if (ret) {
- mnode_remove (&child);
- vld_remove_node (volh, child.Vnode);
- mnode_free (n, FALSE);
- vld_free (volh);
- mlog_log (MDEBFS, "Symlink: ret = %d (fdir_creat)", ret);
- return ret;
- }
-
- assert (child_n->flags.fdp);
-
- len = strlen (a_linkContentsP);
- ret = write (child_n->fd, a_linkContentsP, len);
- if (ret != len)
- ret = errno;
+ mlog_log (MDEBFS, "Symlink: failed with ret = %d", ret);
else
- ret = 0;
-
- if (ret == 0) {
- int32_t len32 = len;
- *a_newFidP = child;
- vld_modify_vnode (volh, child_n, &child_m, NULL, &len32);
- fs_update_fs (n, &m, a_newDirStatP);
- fs_update_fs (child_n, &child_m, a_newFidStatP);
- vld_vld2volsync (volh, a_volSyncP);
- ropa_break_callback (GETHOST(call), GETPORT(call), a_dirFidP, FALSE);
- } else {
- mlog_log (MDEBFS, "Symlink: ret = %d (write)", ret);
- }
-
- mnode_free (child_n, FALSE);
- out_parent:
- mnode_free (n, FALSE);
- vld_free (volh);
+ mlog_log (MDEBFS, "Symlink: created fid: %d.%d.%d calleraccess: %x",
+ a_newFidP->Volume, a_newFidP->Vnode,
+ a_newFidP->Unique, a_newFidStatP->CallerAccess);
return ret;
}
@@ -1285,127 +1312,33 @@ RXAFS_Symlink(struct rx_call *call,
*/
int
-RXAFS_Link(struct rx_call *call,
- const struct AFSFid *a_dirFidP,
- const char *a_nameP,
- const struct AFSFid *a_existingFidP,
- struct AFSFetchStatus *a_newFidStatP,
- struct AFSFetchStatus *a_newDirStatP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_Link(struct rx_call *call,
+ const struct AFSFid *a_dirFidP,
+ const char *a_nameP,
+ const struct AFSFid *a_existingFidP,
+ struct AFSFetchStatus *a_newFidStatP,
+ struct AFSFetchStatus *a_newDirStatP,
+ struct AFSVolSync *a_volSyncP)
{
-#if 0
- struct volume_handle *volh;
- VenusFid a_vchild, a_vdirFid;
- AFSFid child;
- fbuf the_fbuf;
- struct mnode *n;
- struct msec m;
- struct mnode *child_n;
- struct msec child_m;
int ret;
mlog_log (MDEBFS, "Link: fid: %d.%d.%d name: %s existing",
a_dirFidP->Volume, a_dirFidP->Vnode,
a_dirFidP->Unique, a_nameP);
-
- m.flags = VOLOP_GETSTATUS|VOLOP_INSERT;
-
- ret = fs_init_req (a_dirFidP, &m, &volh, call, &n);
- if (ret) {
- mlog_log (MDEBFS, "Link: ret = %d (init_req)", ret);
- return ret;
- }
-
- assert (n->flags.fdp);
- assert (n->flags.fsp);
-
- if (n->fs.FileType != TYPE_DIR) {
- mnode_free (n, FALSE);
- vld_free (volh);
- mlog_log (MDEBFS, "Link: ret = %d (not DIR)", EPERM);
- return EPERM;
- }
-
- child_m.flags = VOLOP_GETSTATUS;
- fs_init_msec (call, &child_m);
- ret = fs_open_node (a_dirFidP, volh, &child_m, &child_n);
- if (ret) {
- mlog_log(MDEBFS, "Link: Failed to open existing fid, ret = %d", ret);
- goto out_parent;
- }
+ if (afs_dir_p(a_existingFidP->Vnode))
+ return EISDIR;
- ret = vld_check_rights (volh, child_n, &child_m);
- if (ret) {
- mlog_log (MDEBFS, "Link: child right insufficient ret = %d", ret);
- goto out_parent;
- }
+ ret = createentry(call, a_dirFidP, a_nameP, NULL, NULL, a_existingFidP,
+ NULL, a_newFidStatP, a_newDirStatP, NULL, a_volSyncP);
- ret = (child_n->fs.ParentVnode == a_dirFidP->Vnode
- && child_n->fs.ParentUnique == a_dirFidP->Unique);
- if (ret != 0) {
- mnode_free (n, FALSE);
- mlog_log (MDEBFS, "Link: ret = %d (not same volume)", EPERM);
- ret = EPERM;
- goto out_child;
- }
-
- a_vdirFid.Cell = 0;
- a_vdirFid.fid = *a_dirFidP;
-
- ret = fbuf_create (&the_fbuf, n->fd, n->sb.st_size,
- FBUF_READ|FBUF_WRITE|FBUF_SHARED);
- if (ret) {
- mlog_log (MDEBFS, "Link: ret = %d (fbuf_create)", ret);
- goto out_child;
- }
-
- ret = fdir_lookup (&the_fbuf, &a_vdirFid, a_nameP, &a_vchild);
- if (ret != ENOENT) {
- fbuf_end (&the_fbuf);
- if (ret == 0) {
- mlog_log (MDEBFS, "Link: ret = %d (EEXIST)", EEXIST);
- ret = EEXIST;
- } else
- mlog_log (MDEBFS, "Link: ret = %d (fdir_lookup)", ret);
- goto out_child;
- }
-
- child = *a_existingFidP;
- child.Volume = volh->vol;
-
- /* XXX check name ! */
- ret = fdir_creat (&the_fbuf, a_nameP, child);
- if (ret == 0) {
- int32_t len = fbuf_len (&the_fbuf);
- vld_modify_vnode (volh, n, &m, NULL, &len);
- }
-
- fbuf_end (&the_fbuf); /* XXX error ? */
-
- if (ret) {
- mnode_remove (&child);
- mlog_log (MDEBFS, "Link: ret = %d (fdir_creat)", ret);
- goto out_child;
- }
-
- assert (child_n->flags.fdp);
-
- fs_update_fs (n, &m, a_newDirStatP);
- fs_update_fs (child_n, &child_m, a_newFidStatP);
- vld_vld2volsync (volh, a_volSyncP);
- ropa_break_callback (GETHOST(call), GETPORT(call), a_dirFidP, FALSE);
-
- out_child:
- mnode_free (child_n, FALSE);
- out_parent:
- mnode_free (n, FALSE);
- vld_free (volh);
+ if (ret)
+ mlog_log (MDEBFS, "Link: failed with ret = %d", ret);
+ else
+ mlog_log (MDEBFS, "Link: created name: %s calleraccess: %x",
+ a_nameP, a_newFidStatP->CallerAccess);
return ret;
-#else
- return EPERM;
-#endif
}
/*
@@ -1413,15 +1346,15 @@ RXAFS_Link(struct rx_call *call,
*/
int
-RXAFS_MakeDir(struct rx_call *call,
- const struct AFSFid *a_parentDirFidP,
- const char *a_newDirNameP,
- const struct AFSStoreStatus *a_currStatP,
- struct AFSFid *a_newDirFidP,
- struct AFSFetchStatus *a_dirFidStatP,
- struct AFSFetchStatus *a_parentDirStatP,
- struct AFSCallBack *a_newDirCallBackP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_MakeDir(struct rx_call *call,
+ const struct AFSFid *a_parentDirFidP,
+ const char *a_newDirNameP,
+ const struct AFSStoreStatus *a_currStatP,
+ struct AFSFid *a_newDirFidP,
+ struct AFSFetchStatus *a_dirFidStatP,
+ struct AFSFetchStatus *a_parentDirStatP,
+ struct AFSCallBack *a_newDirCallBackP,
+ struct AFSVolSync *a_volSyncP)
{
struct volume_handle *volh;
struct mnode *n;
@@ -1459,7 +1392,6 @@ RXAFS_MakeDir(struct rx_call *call,
if (ret)
goto out_parent;
-
ret = vld_adjust_linkcount (volh, n, 1);
if (ret) {
mnode_free (n, FALSE);
@@ -1471,22 +1403,15 @@ RXAFS_MakeDir(struct rx_call *call,
/* XXX check name ! */
ret = mdir_creat (n, a_newDirNameP, child);
- if (ret) {
- vld_adjust_linkcount (volh, n, -1);
- mnode_remove (&child);
- vld_remove_node (volh, child.Vnode);
- mnode_free (n, FALSE);
- mnode_free (child_n, TRUE);
- vld_free (volh);
- return ret;
+ if (ret == 0) {
+ int32_t len = n->sb.st_size;
+ ret = vld_modify_vnode (volh, n, &m, NULL, &len);
}
- ret = vld_modify_vnode (volh, n, &m, NULL, NULL);
if (ret) {
/* XXX adjust directory size? */
vld_adjust_linkcount (volh, n, -1);
- mnode_remove (&child);
- vld_remove_node (volh, child.Vnode);
+ vld_adjust_linkcount (volh, child_n, -1); /* removes node if necessary */
mnode_free (n, FALSE);
mnode_free (child_n, TRUE);
vld_free (volh);
@@ -1507,23 +1432,29 @@ RXAFS_MakeDir(struct rx_call *call,
if (ret) {
/* XXX adjust directory size? */
vld_adjust_linkcount (volh, n, -1);
- mnode_remove (&child);
- vld_remove_node (volh, child.Vnode);
+ vld_adjust_linkcount (volh, child_n, -1); /* removes node if necessary */
mnode_free (n, FALSE);
mnode_free (child_n, TRUE);
vld_free (volh);
return ret;
}
ropa_break_callback (GETHOST(call), GETPORT(call), a_parentDirFidP, FALSE);
- ropa_getcallback (GETHOST(call), GETPORT(call),
- a_newDirFidP, a_newDirCallBackP);
+ ret = vld_info_uptodatep (volh);
+ if (ret)
+ goto out_child;
+
+ ropa_getcallback (GETHOST(call), GETPORT(call),
+ a_newDirFidP, a_newDirCallBackP,
+ volh->info.type);
+
mlog_log (MDEBFS, "MakeDir: created child fid: %d.%d.%d",
a_newDirFidP->Volume, a_newDirFidP->Vnode,
a_newDirFidP->Unique);
+ out_child:
mnode_free (child_n, FALSE);
-out_parent:
+ out_parent:
mnode_free (n, FALSE);
vld_free (volh);
@@ -1535,11 +1466,11 @@ out_parent:
*/
int
-RXAFS_RemoveDir(struct rx_call *call,
- const struct AFSFid *a_parentDirP,
- const char *a_dirNameP,
- struct AFSFetchStatus *a_newParentDirStatP,
- struct AFSVolSync *a_volSyncP)
+SRXAFS_RemoveDir(struct rx_call *call,
+ const struct AFSFid *a_parentDirP,
+ const char *a_dirNameP,
+ struct AFSFetchStatus *a_newParentDirStatP,
+ struct AFSVolSync *a_volSyncP)
{
mlog_log (MDEBFS, "RemoveDir: fid: %d.%d.%d name: %s",
a_parentDirP->Volume, a_parentDirP->Vnode,
@@ -1554,16 +1485,16 @@ RXAFS_RemoveDir(struct rx_call *call,
*/
int
-RXAFS_GiveUpCallBacks(struct rx_call *call,
- const AFSCBFids *a_fidArrayP,
- const AFSCBs *a_callBackArrayP)
+SRXAFS_GiveUpCallBacks(struct rx_call *call,
+ const AFSCBFids *a_fidArrayP,
+ const AFSCBs *a_callBackArrayP)
{
int ret;
mlog_log (MDEBFS, "GiveUpCallBacks");
ret = ropa_drop_callbacks (GETHOST(call), GETPORT(call),
- a_fidArrayP, a_callBackArrayP);
+ a_fidArrayP, a_callBackArrayP);
if (ret)
mlog_log (MDEBFS, "GiveUpCallBacks: returning %d", ret);
@@ -1575,14 +1506,32 @@ RXAFS_GiveUpCallBacks(struct rx_call *call,
*/
int
-RXAFS_GetVolumeStatus(struct rx_call *call,
- const int32_t a_volIDP,
- struct AFSFetchVolumeStatus *a_volFetchStatP,
- char *a_volNameP,
- char *a_offLineMsgP,
- char *a_motdP)
+SRXAFS_GetVolumeStatus(struct rx_call *call,
+ const int32_t a_volIDP,
+ struct AFSFetchVolumeStatus *a_volFetchStatP,
+ char *a_volNameP,
+ char *a_offLineMsgP,
+ char *a_motdP)
{
- return EPERM;
+ struct volume_handle *volh;
+ AFSFid fid;
+ struct msec m;
+ int ret;
+
+ mlog_log (MDEBFS, "GetVolumeStats: vol: %d", a_volIDP);
+
+ m.flags = VOLOP_GETSTATUS;
+ fid.Volume = a_volIDP;
+
+ ret = fs_init_req (&fid, &m, &volh, call, NULL);
+ if (ret) {
+ mlog_log (MDEBFS, "GetVolumeStatus: fs_init_req returned %d", ret);
+ return ret;
+ }
+
+ ret = vld_get_volstats (volh, a_volFetchStatP, a_volNameP,
+ a_offLineMsgP, a_motdP);
+ return ret;
}
/*
@@ -1590,14 +1539,42 @@ RXAFS_GetVolumeStatus(struct rx_call *call,
*/
int
-RXAFS_SetVolumeStatus(struct rx_call *call,
- const int32_t a_volIDP,
- const struct AFSStoreVolumeStatus *a_volStoreStatP,
- const char *a_volNameP,
- const char *a_offLineMsgP,
- const char *a_motdP)
+SRXAFS_SetVolumeStatus(struct rx_call *call,
+ const int32_t a_volIDP,
+ const struct AFSStoreVolumeStatus *a_volStoreStatP,
+ const char *a_volNameP,
+ const char *a_offLineMsgP,
+ const char *a_motdP)
{
- return EPERM;
+ struct volume_handle *volh;
+ AFSFid fid;
+ struct msec m;
+ int ret;
+
+ mlog_log (MDEBFS, "SRXAFS_SetVolumeStatus: vol: %d", a_volIDP);
+
+ m.flags = 0;
+ fid.Volume = a_volIDP;
+ fid.Vnode = 1;
+ fid.Unique = 1;
+
+ ret = fs_init_req (&fid, &m, &volh, call, NULL);
+ if (ret) {
+ goto out;
+ }
+
+ if (!super_user(&m)) {
+ ret = EPERM;
+ goto out;
+ }
+
+ ret = vld_set_volstats (volh, a_volStoreStatP, a_volNameP,
+ a_offLineMsgP, a_motdP);
+
+ out:
+ vld_free (volh);
+ mlog_log (MDEBFS, "SRXAFS_SetVolumeStatus: fs_init_req returned %d", ret);
+ return ret;
}
/*
@@ -1605,8 +1582,8 @@ RXAFS_SetVolumeStatus(struct rx_call *call,
*/
int
-RXAFS_GetRootVolume(struct rx_call *call,
- char *a_rootVolNameP)
+SRXAFS_GetRootVolume(struct rx_call *call,
+ char *a_rootVolNameP)
{
mlog_log (MDEBFS, "GetRootVolume");
@@ -1620,9 +1597,9 @@ RXAFS_GetRootVolume(struct rx_call *call,
*/
int
-RXAFS_GetTime(struct rx_call *call,
- u_int32_t *a_secondsP,
- u_int32_t *a_uSecondsP)
+SRXAFS_GetTime(struct rx_call *call,
+ uint32_t *a_secondsP,
+ uint32_t *a_uSecondsP)
{
struct timeval tv;
@@ -1641,9 +1618,9 @@ RXAFS_GetTime(struct rx_call *call,
*/
int
-RXAFS_NGetVolumeInfo(struct rx_call *call,
- const char *VolumeName,
- struct AFSVolumeInfo *stuff)
+SRXAFS_NGetVolumeInfo(struct rx_call *call,
+ const char *VolumeName,
+ struct AFSVolumeInfo *stuff)
{
return EPERM;
}
@@ -1653,11 +1630,11 @@ RXAFS_NGetVolumeInfo(struct rx_call *call,
*/
int
-RXAFS_BulkStatus(struct rx_call *call,
- const AFSCBFids *FidsArray,
- AFSBulkStats *StatArray,
- AFSCBs *CBArray,
- struct AFSVolSync *Sync)
+SRXAFS_BulkStatus(struct rx_call *call,
+ const AFSCBFids *FidsArray,
+ AFSBulkStats *StatArray,
+ AFSCBs *CBArray,
+ struct AFSVolSync *Sync)
{
struct volume_handle *volh = NULL;
struct mnode *n;
@@ -1722,21 +1699,21 @@ RXAFS_BulkStatus(struct rx_call *call,
return ret;
}
- ret = vld_check_rights (volh, n, &m);
- if (ret) {
- mnode_free (n, FALSE);
- vld_free (volh);
- return ret;
- }
-
fs_update_fs (n, &m, &StatArray->val[i]);
mnode_free (n, FALSE);
n = NULL;
+ ret = vld_info_uptodatep (volh);
+ if (ret)
+ goto out;
+
ropa_getcallback (GETHOST(call), GETPORT(call),
- &FidsArray->val[i], &CBArray->val[i]);
+ &FidsArray->val[i], &CBArray->val[i],
+ volh->info.type);
}
+
+ out:
vld_free (volh);
return 0;
@@ -1747,10 +1724,10 @@ RXAFS_BulkStatus(struct rx_call *call,
*/
int
-RXAFS_SetLock(struct rx_call *call,
- const struct AFSFid *Fid,
- const ViceLockType Type,
- struct AFSVolSync *Sync)
+SRXAFS_SetLock(struct rx_call *call,
+ const struct AFSFid *Fid,
+ const ViceLockType Type,
+ struct AFSVolSync *Sync)
{
return EPERM;
}
@@ -1760,9 +1737,9 @@ RXAFS_SetLock(struct rx_call *call,
*/
int
-RXAFS_ExtendLock(struct rx_call *call,
- const struct AFSFid *Fid,
- struct AFSVolSync *Sync)
+SRXAFS_ExtendLock(struct rx_call *call,
+ const struct AFSFid *Fid,
+ struct AFSVolSync *Sync)
{
return EPERM;
}
@@ -1773,9 +1750,9 @@ RXAFS_ExtendLock(struct rx_call *call,
*/
int
-RXAFS_ReleaseLock(struct rx_call *call,
- const struct AFSFid *Fid,
- struct AFSVolSync *Sync)
+SRXAFS_ReleaseLock(struct rx_call *call,
+ const struct AFSFid *Fid,
+ struct AFSVolSync *Sync)
{
return EPERM;
}
diff --git a/usr.sbin/afs/src/milko/fs/fsrv_locl.h b/usr.sbin/afs/src/milko/fs/fsrv_locl.h
index e26fcfc4ade..012c759a643 100644
--- a/usr.sbin/afs/src/milko/fs/fsrv_locl.h
+++ b/usr.sbin/afs/src/milko/fs/fsrv_locl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -32,7 +32,7 @@
*/
/*
- * $KTH: fsrv_locl.h,v 1.11 2000/10/03 00:17:31 lha Exp $
+ * $arla: fsrv_locl.h,v 1.15 2002/04/20 15:57:17 lha Exp $
*/
@@ -41,6 +41,8 @@
#include <config.h>
+#include <roken.h>
+
#include <sys/types.h>
#include <unistd.h>
@@ -51,7 +53,11 @@
#include <rx/rx_null.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#endif
@@ -88,4 +94,6 @@
#include <salvage.h>
+#include <dump.h>
+
#endif /* __FILBUNKE_FSRV_H */
diff --git a/usr.sbin/afs/src/milko/fs/volprocs.c b/usr.sbin/afs/src/milko/fs/volprocs.c
index 6c1bf48bb6c..95ca210fb54 100644
--- a/usr.sbin/afs/src/milko/fs/volprocs.c
+++ b/usr.sbin/afs/src/milko/fs/volprocs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,13 @@
#include "fsrv_locl.h"
-RCSID("$KTH: volprocs.c,v 1.9 2000/10/03 00:17:36 lha Exp $");
+RCSID("$arla: volprocs.c,v 1.19 2002/09/08 04:56:15 ahltorp Exp $");
+
+/*
+ * exit debug logging
+ */
+
+#define VOLSER_EXIT mlog_log(MDEBVOLDB, __FUNCTION__ " error: %s(%d)", koerr_gettext(ret), ret)
/*
* Helper function
@@ -48,14 +54,16 @@ volser_fetch_vh (int32_t partition, int32_t volid,
ret = dp_create (partition, dp);
if (ret) {
fprintf (stderr, "volser_fetch_vh: dp_create: %d\n", ret);
- return VOLSERFAILEDOP; /* XXX */
+ return VOLSERILLEGAL_PARTITION;
}
ret = vld_open_volume_by_num (*dp, volid, vh);
if (ret) {
fprintf (stderr, "volser_fetch_vh: vld_open_volume_by_num: %d\n", ret);
dp_free (*dp);
- return VOLSERFAILEDOP; /* XXX */
+ if (ret == ENOENT)
+ return VNOVOL;
+ return ret;
}
ret = vld_info_uptodatep (*vh);
@@ -81,38 +89,46 @@ VOLSER_AFSVolCreateVolume(struct rx_call *call,
int32_t *volid,
int32_t *trans)
{
- int ret;
+ int ret = 0;
int32_t backstoretype = VLD_SVOL;
struct dp_part *dp;
- mlog_log(MDEBVOLDB, "VOLSER_AFSVolCreateVolume "
- "part %d name %s type %d parent %d volid %u",
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolCreateVolume"
+ " part %d name %s type %d parent %d volid %u",
partition, name, type, parent, *volid);
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
/* XXX parent should be used */
ret = vld_create_trans (partition, *volid, trans);
if (ret)
- return ret;
+ goto out;
- ret = vld_trans_set_iflags (*trans, ITOffline);
+ ret = vld_trans_set_iflags (*trans, ITCreate);
if (ret)
- return ret;
+ goto out;
ret = dp_create (partition, &dp);
if (ret) {
vld_end_trans (*trans, NULL);
- return ret;
+ goto out;
}
ret = vld_create_volume (dp, *volid, name, backstoretype, type, 0);
if (ret) {
vld_end_trans (*trans, NULL);
- return ret;
+ goto out;
}
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -121,15 +137,42 @@ VOLSER_AFSVolCreateVolume(struct rx_call *call,
int
VOLSER_AFSVolDeleteVolume(struct rx_call *call,
- const int32_t trans)
+ const int32_t transid)
{
- int ret;
+ int ret = 0;
+ int32_t backstoretype = VLD_SVOL;
+ struct trans *trans;
+ struct dp_part *dp;
- ret = vld_verify_trans(trans);
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolDeleteVolume");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = vld_verify_trans(transid);
if (ret)
- return ret;
+ goto out;
+
+ ret = vld_get_trans(transid, &trans);
+ if (ret)
+ goto out;
+
+ ret = dp_create (trans->partition, &dp);
+ if (ret) {
+ vld_put_trans (trans);
+ goto out;
+ }
+
+ ret = vld_delete_volume (dp, trans->volid, backstoretype, 0);
+
+ vld_put_trans(trans);
- return VOLSERFAILEDOP;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -141,7 +184,21 @@ VOLSER_AFSVolNukeVolume(struct rx_call *call,
const int32_t partID,
const int32_t volID)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolNukeVolume");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -153,38 +210,48 @@ VOLSER_AFSVolDump(struct rx_call *call,
const int32_t fromTrans,
const int32_t fromDate)
{
- int ret;
+ int ret = 0;
struct trans *trans;
struct dp_part *dp;
volume_handle *vh;
mlog_log (MDEBVOLDB,
- "VOLSER_AFSVolDump trans %d fromdate %d",
+ "VOLSER_AFSVolDump: trans %d fromdate %d",
fromTrans, fromDate);
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
ret = vld_verify_trans (fromTrans);
if (ret)
- return ret;
+ goto out;
ret = vld_get_trans (fromTrans, &trans);
if (ret)
- return ret;
+ goto out;
ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
if (ret) {
vld_put_trans(trans);
- return ret;
+ goto out;
}
if (fromDate != 0) {
vld_put_trans(trans);
- return VOLSERFAILEDOP;
+ ret = VOLSERFAILEDOP;
+ goto out;
}
-
+ ret = generate_dump(call, vh);
vld_put_trans (trans);
- return VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -198,7 +265,21 @@ VOLSER_AFSVolSignalRestore(struct rx_call *call,
const int32_t pid,
const int32_t cloneid)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolSignalRestore");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -207,11 +288,57 @@ VOLSER_AFSVolSignalRestore(struct rx_call *call,
int
VOLSER_AFSVolRestore(struct rx_call *call,
- const int32_t toTrans,
+ const int32_t transid,
const int32_t flags,
const struct restoreCookie *cookie)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+ struct trans *trans;
+ struct dp_part *dp;
+ volume_handle *vh;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolRestore");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = vld_verify_trans(transid);
+ if (ret)
+ goto out;
+
+ ret = vld_get_trans(transid, &trans);
+ if (ret)
+ goto out;
+
+ ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
+ if (ret) {
+ vld_put_trans(trans);
+ goto out;
+ }
+
+ ret = parse_dump(call, vh);
+ if (ret) {
+ vld_free (vh);
+ dp_free (dp);
+ vld_put_trans(trans);
+ goto out;
+ }
+
+ ret = vld_rebuild(vh);
+
+ vld_info_write(vh);
+
+ vld_free (vh);
+ dp_free (dp);
+
+ vld_put_trans(trans);
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -226,7 +353,21 @@ VOLSER_AFSVolForward(struct rx_call *call,
const int32_t destTrans,
const struct restoreCookie *cookie)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolForward");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -241,7 +382,23 @@ VOLSER_AFSVolClone(struct rx_call *call,
const char *newName,
int32_t *newVol)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolClone"
+ " trans %d purgevol %d newtype %d newname %d",
+ trans, purgeVol, newType, newName);
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -253,7 +410,21 @@ VOLSER_AFSVolReClone(struct rx_call *call,
const int32_t tid,
const int32_t cloneID)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolReClone");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -265,7 +436,21 @@ VOLSER_AFSVolSetForwarding(struct rx_call *call,
const int32_t tid,
const int32_t newsite)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetForwarding");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -279,19 +464,38 @@ VOLSER_AFSVolTransCreate(struct rx_call *call,
const int32_t flags,
int32_t *trans)
{
- int ret;
+ int ret = 0;
+ struct dp_part *dp;
+ volume_handle *vh;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolTransCreate");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = volser_fetch_vh (partition, volume, &dp, &vh);
+ if (ret)
+ goto out;
+
+ vld_free (vh);
+ dp_free (dp);
ret = vld_create_trans(partition, volume, trans);
if (ret)
- return ret;
+ goto out;
ret = vld_trans_set_iflags(*trans, flags);
if (ret) {
vld_end_trans (*trans, NULL);
- return ret;
+ goto out;
}
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -300,20 +504,39 @@ VOLSER_AFSVolTransCreate(struct rx_call *call,
int
VOLSER_AFSVolEndTrans(struct rx_call *call,
- const int32_t trans,
+ const int32_t transid,
int32_t *rcode)
{
- int ret;
+ struct trans *trans;
+ int ret = 0;
- ret = vld_verify_trans(trans);
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolEndTrans trans %d", transid);
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = vld_verify_trans(transid);
+ if (ret)
+ goto out;
+
+ ret = vld_get_trans(transid, &trans);
if (ret)
- return ret;
+ goto out;
+
+ ropa_break_volume_callback(trans->volid); /* XXX */
- ret = vld_end_trans(trans, rcode);
+ vld_put_trans(trans);
+
+ ret = vld_end_trans(transid, rcode);
if (ret)
- return ret;
+ goto out;
- return 0;
+ out:
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolEndTrans returns %d", ret);
+
+ return ret;
}
/*
@@ -325,17 +548,27 @@ VOLSER_AFSVolGetFlags(struct rx_call *call,
const int32_t trans,
int32_t *flags)
{
- int ret;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolGetFlags");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
ret = vld_verify_trans(trans);
if (ret)
- return ret;
+ goto out;
ret = vld_trans_get_vflags(trans, flags);
if (ret)
- return ret;
+ goto out;
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -347,26 +580,31 @@ VOLSER_AFSVolSetFlags(struct rx_call *call,
const int32_t transid,
const int32_t flags)
{
- int ret;
+ int ret = 0;
struct trans *trans;
struct dp_part *dp;
volume_handle *vh;
- mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetFlags "
- "trans %d flags %d", transid, flags);
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetFlags"
+ " trans %d flags %d", transid, flags);
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
ret = vld_verify_trans(transid);
if (ret)
- return ret;
+ goto out;
ret = vld_get_trans(transid, &trans);
if (ret)
- return ret;
+ goto out;
ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
if (ret) {
vld_put_trans(trans);
- return ret;
+ goto out;
}
if (flags & VTDeleteOnSalvage)
@@ -374,7 +612,9 @@ VOLSER_AFSVolSetFlags(struct rx_call *call,
else
vh->info.destroyMe = 0;
+#if 0
assert ((flags & VTOutOfService) == 0); /* XXX */
+#endif
vld_info_write(vh);
@@ -385,9 +625,12 @@ VOLSER_AFSVolSetFlags(struct rx_call *call,
ret = vld_trans_set_vflags(transid, flags);
if (ret)
- return ret;
+ goto out;
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -399,7 +642,21 @@ VOLSER_AFSVolGetName(struct rx_call *call,
const int32_t tid,
char tname[256])
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolGetName");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -408,10 +665,61 @@ VOLSER_AFSVolGetName(struct rx_call *call,
int
VOLSER_AFSVolGetStatus(struct rx_call *call,
- const int32_t tid,
+ const int32_t transid,
struct volser_status *status)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+ struct trans *trans;
+ struct dp_part *dp;
+ volume_handle *vh;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolGetStatus");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = vld_verify_trans(transid);
+ if (ret)
+ goto out;
+
+ ret = vld_get_trans(transid, &trans);
+ if (ret)
+ goto out;
+
+ ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
+ if (ret) {
+ vld_put_trans(trans);
+ goto out;
+ }
+
+ status->volID = vh->info.volid;
+ status->nextUnique = 0 /* XXX */;
+ status->type = vh->info.type;
+ status->parentID = vh->info.parentID;
+ status->cloneID = vh->info.cloneID;
+ status->backupID = vh->info.backupID;
+ status->restoredFromID = 0 /* XXX */;
+ status->maxQuota = vh->info.maxquota;
+ status->minQuota = 0 /* XXX */;
+ status->owner = 0 /* XXX */;
+ status->creationDate = vh->info.creationDate;
+ status->accessDate = vh->info.accessDate;
+ status->updateDate = vh->info.updateDate;
+ status->exprirationDate = 0 /* XXX */;
+ status->backupDate = vh->info.backupDate;
+ status->copyDate = 0 /* XXX */;
+
+ vld_free (vh);
+ dp_free (dp);
+
+ vld_put_trans(trans);
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -420,14 +728,57 @@ VOLSER_AFSVolGetStatus(struct rx_call *call,
int
VOLSER_AFSVolSetIdsTypes(struct rx_call *call,
- const int32_t tId,
+ const int32_t transid,
const char *name,
const int32_t type,
- const int32_t pId,
- const int32_t cloneId,
- const int32_t backupId)
+ const int32_t parentID,
+ const int32_t cloneID,
+ const int32_t backupID)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+ struct trans *trans;
+ struct dp_part *dp;
+ volume_handle *vh;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetIdsTypes: type %d parentID %d "
+ "cloneID %d backupID %d", type, parentID, cloneID, backupID);
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = vld_verify_trans(transid);
+ if (ret)
+ goto out;
+
+ ret = vld_get_trans(transid, &trans);
+ if (ret)
+ goto out;
+
+ ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
+ if (ret) {
+ vld_put_trans(trans);
+ goto out;
+ }
+
+ strlcpy(vh->info.name, name, VNAMESIZE);
+ vh->info.type = type;
+ vh->info.parentID = parentID;
+ vh->info.cloneID = cloneID;
+ vh->info.backupID = backupID;
+
+ vld_info_write(vh);
+
+ vld_free (vh);
+ dp_free (dp);
+
+ vld_put_trans(trans);
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -436,10 +787,48 @@ VOLSER_AFSVolSetIdsTypes(struct rx_call *call,
int
VOLSER_AFSVolSetDate(struct rx_call *call,
- const int32_t tid,
+ const int32_t transid,
const int32_t newDate)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+ struct trans *trans;
+ struct dp_part *dp;
+ volume_handle *vh;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetDate");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = vld_verify_trans(transid);
+ if (ret)
+ goto out;
+
+ ret = vld_get_trans(transid, &trans);
+ if (ret)
+ goto out;
+
+ ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
+ if (ret) {
+ vld_put_trans(trans);
+ goto out;
+ }
+
+ vh->info.creationDate = newDate;
+
+ vld_info_write(vh);
+
+ vld_free (vh);
+ dp_free (dp);
+
+ vld_put_trans(trans);
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -452,7 +841,9 @@ VOLSER_AFSVolListPartitions(struct rx_call *call,
{
int i;
struct dp_part *dp = NULL;
- int ret;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolListPartitions");
i = 0;
do {
@@ -460,7 +851,7 @@ VOLSER_AFSVolListPartitions(struct rx_call *call,
if (dp == NULL)
break;
if (ret)
- return ret;
+ goto out;
partIDs->partIds[i] = dp->num;
i++;
} while (i < 26);
@@ -468,7 +859,11 @@ VOLSER_AFSVolListPartitions(struct rx_call *call,
for (; i < 26; i++)
partIDs->partIds[i] = -1;
- return 0;
+ ret = 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -482,22 +877,60 @@ VOLSER_AFSVolPartitionInfo(struct rx_call *call,
{
int num;
struct dp_part *dp;
- int ret;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolPartitionInfo");
num = partition_name2num (name);
- if (num == -1)
- return 0; /* XXX */
+ if (num == -1) {
+ ret = VOLSERILLEGAL_PARTITION;
+ goto out;
+ }
ret = dp_create (num, &dp);
if (ret)
- return ret;
+ goto out;
memset(partition, 0, sizeof(*partition));
- strlcpy(partition->name, dp->part, 32);
+ strlcpy(partition->name, dp->part, 32);
+ partition->free = 1000;
dp_free(dp);
+
+ out:
+ VOLSER_EXIT;
- return 0;
+ return ret;
+}
+
+
+static void
+copy_volumeinfo(struct volintInfo *volinfo,
+ volume_handle *vh,
+ const int32_t partID)
+{
+ strlcpy(volinfo->name, vh->info.name, VNAMESIZE);
+ volinfo->volid = vh->info.volid;
+ volinfo->type = vh->info.type;
+ volinfo->backupID = vh->info.backupID;
+ volinfo->parentID = vh->info.parentID;
+ volinfo->cloneID = vh->info.cloneID;
+ if (vld_check_busy(volinfo->volid, partID))
+ volinfo->status = VBUSY;
+ else
+ volinfo->status = VOK;
+ volinfo->copyDate = vh->info.copyDate;
+ volinfo->inUse = vh->info.inUse;
+ volinfo->creationDate = vh->info.creationDate;
+ volinfo->accessDate = vh->info.accessDate;
+ volinfo->updateDate = vh->info.updateDate;
+ volinfo->backupDate = vh->info.backupDate;
+ volinfo->dayUse = vh->info.dayUse;
+ volinfo->filecount = vh->info.filecount;
+ volinfo->maxquota = vh->info.maxquota;
+ volinfo->size = vh->info.size;
+ volinfo->needsSalvaged = 0;
+ volinfo->destroyMe = 0;
}
/*
@@ -510,7 +943,56 @@ VOLSER_AFSVolListVolumes(struct rx_call *call,
const int32_t flags,
volEntries *resultEntries)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+ List *vollist;
+ Listitem *item;
+ volume_handle *vh;
+ struct dp_part *dp;
+ int numvol;
+ int i;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolListVolumes");
+
+ ret = dp_create (partID, &dp);
+ if (ret)
+ goto out;
+
+ ret = vld_list_volumes(dp, &vollist);
+ if (ret)
+ goto free_part;
+
+ numvol = 0;
+
+ item = listhead(vollist);
+ while (item) {
+ numvol++;
+ item = listnext(vollist, item);
+ }
+
+ resultEntries->len = numvol;
+
+ resultEntries->val = calloc(sizeof(struct volintInfo) * resultEntries->len, 1);
+
+ i = 0;
+ while (!listemptyp(vollist)) {
+ vh = (volume_handle *) listdelhead(vollist);
+ assert(vh);
+ ret = vld_info_uptodatep (vh);
+ assert(ret == 0);
+ copy_volumeinfo(&resultEntries->val[i], vh, partID);
+ vld_free (vh);
+ i++;
+ }
+
+ free(vollist);
+
+ free_part:
+ dp_free (dp);
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -524,50 +1006,30 @@ VOLSER_AFSVolListOneVolume(struct rx_call *call,
volEntries *resultEntries)
{
volume_handle *vh;
- int ret;
+ int ret = 0;
struct dp_part *dp;
struct volintInfo *volinfo;
- fprintf(stderr,
- "VOLSER_AFSVolListOneVolume partid: %d volid: %u\n",
- partID, volid);
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolListOneVolume partid: %d volid: %u\n",
+ partID, volid);
ret = volser_fetch_vh (partID, volid, &dp, &vh);
if (ret)
- return ret;
+ goto out;
resultEntries->len = 1;
volinfo = calloc(sizeof(struct volintInfo) * resultEntries->len, 1);
resultEntries->val = volinfo;
- strlcpy(volinfo->name, vh->info.name, VNAMESIZE);
- volinfo->volid = vh->info.volid;
- volinfo->type = vh->info.type;
- volinfo->backupID = vh->info.backupID;
- volinfo->parentID = vh->info.parentID;
- volinfo->cloneID = vh->info.cloneID;
- if (vld_check_busy(volid, partID))
- volinfo->status = VBUSY;
- else
- volinfo->status = VOK;
- volinfo->copyDate = vh->info.copyDate;
- volinfo->inUse = vh->info.inUse;
- volinfo->creationDate = vh->info.creationDate;
- volinfo->accessDate = vh->info.accessDate;
- volinfo->updateDate = vh->info.updateDate;
- volinfo->backupDate = vh->info.backupDate;
- volinfo->dayUse = vh->info.dayUse;
- volinfo->filecount = vh->info.filecount;
- volinfo->maxquota = vh->info.maxquota;
- volinfo->size = vh->info.size;
- volinfo->needsSalvaged = 0;
- volinfo->destroyMe = 0;
+ copy_volumeinfo(volinfo, vh, partID);
vld_free (vh);
dp_free (dp);
-
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -580,7 +1042,16 @@ VOLSER_AFSVolGetNthVolume(struct rx_call *call,
int32_t *volume,
int32_t *partition)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolGetNthVolume");
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -591,7 +1062,16 @@ int
VOLSER_AFSVolMonitor(struct rx_call *call,
transDebugEntries *result)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolMonitor");
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -604,7 +1084,16 @@ VOLSER_AFSVolXListVolumes(struct rx_call *call,
const int32_t flags,
xvolEntries *resultEntries)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolXListVolumes");
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -618,13 +1107,12 @@ VOLSER_AFSVolXListOneVolume(struct rx_call *call,
xvolEntries *resultEntries)
{
volume_handle *vh;
- int ret;
struct dp_part *dp;
struct xvolintInfo *volinfo;
+ int ret = 0;
- fprintf(stderr,
- "VOLSER_AFSVolXListOneVolume partid: %d volid: %u\n",
- partID, volid);
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolXListOneVolume partid: %d volid: %u\n",
+ partID, volid);
ret = volser_fetch_vh (partID, volid, &dp, &vh);
if (ret)
@@ -658,8 +1146,10 @@ VOLSER_AFSVolXListOneVolume(struct rx_call *call,
vld_free (vh);
dp_free (dp);
-
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -672,27 +1162,32 @@ VOLSER_AFSVolSetInfo(struct rx_call *call,
const struct volintInfo *volinfo)
{
volume_handle *vh;
- int ret;
+ int ret = 0;
struct dp_part *dp;
struct trans *trans;
- mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetInfo "
- "trans %d name %s type %d parent %d volid %d backup %d",
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetInfo"
+ " trans %d name %s type %d parent %d volid %d backup %d",
transid, volinfo->name, volinfo->type, volinfo->parentID,
volinfo->volid, volinfo->backupID);
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
ret = vld_verify_trans(transid);
if (ret)
- return ret;
+ goto out;
ret = vld_get_trans(transid, &trans);
if (ret)
- return ret;
+ goto out;
ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
if (ret) {
vld_put_trans(trans);
- return ret;
+ goto out;
}
if (volinfo->name[0])
@@ -733,7 +1228,10 @@ VOLSER_AFSVolSetInfo(struct rx_call *call,
dp_free (dp);
vld_put_trans(trans);
- return 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -746,7 +1244,7 @@ VOLSER_AFSVolXListPartitions(struct rx_call *call,
{
int i;
struct dp_part *dp = NULL;
- int ret;
+ int ret = 0;
int32_t partIDs[26]; /* XXX */
mlog_log(MDEBVOLDB, "VOLSER_AFSVolXListPartitions");
@@ -757,7 +1255,7 @@ VOLSER_AFSVolXListPartitions(struct rx_call *call,
if (dp == NULL)
break;
if (ret)
- return ret;
+ goto out;
partIDs[i] = dp->num;
i++;
} while (i < 26);
@@ -766,7 +1264,11 @@ VOLSER_AFSVolXListPartitions(struct rx_call *call,
ent->val = malloc(sizeof(int32_t) * ent->len);
memcpy(ent->val, partIDs, sizeof(int32_t) * ent->len);
- return 0;
+ ret = 0;
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
/*
@@ -777,12 +1279,26 @@ int
VOLSER_AFSVolForwardMultiple(struct rx_call *call,
const int32_t fromTrans,
const int32_t fromData,
- const replicas *destinations,
+ const manyDests *destinations,
const int32_t spare0,
const struct restoreCookie *cookie,
- const multi_results *results)
+ multi_results *results)
{
- return VOLSERFAILEDOP;
+ int ret = 0;
+
+ mlog_log(MDEBVOLDB, "VOLSER_AFSVolForwardMultiple");
+
+ if (!sec_is_superuser(call)) {
+ ret = VOLSERBAD_ACCESS;
+ goto out;
+ }
+
+ ret = VOLSERFAILEDOP;
+
+ out:
+ VOLSER_EXIT;
+
+ return ret;
}
diff --git a/usr.sbin/afs/src/milko/lib/dpart/dpart.c b/usr.sbin/afs/src/milko/lib/dpart/dpart.c
index e29b3a11128..f66ccdd1d42 100644
--- a/usr.sbin/afs/src/milko/lib/dpart/dpart.c
+++ b/usr.sbin/afs/src/milko/lib/dpart/dpart.c
@@ -33,10 +33,19 @@
#include <config.h>
+#include <roken.h>
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
+#ifdef HAVE_STATVFS
+#include <sys/statvfs.h>
+#endif
+#ifdef HAVE_STATFS_H
+#include <sys/statfs.h>
+#endif
+#include <sys/mount.h>
#include <dirent.h>
#include <stdlib.h>
#include <errno.h>
@@ -50,7 +59,7 @@
#include <dpart.h>
-RCSID("$KTH: dpart.c,v 1.6 2000/12/29 20:12:35 tol Exp $");
+RCSID("$arla: dpart.c,v 1.11 2002/06/02 21:12:16 lha Exp $");
#ifdef MILKO_ROOT
char *dpart_root = MILKO_ROOT;
@@ -64,7 +73,7 @@ char *dpart_root = "";
*/
int
-dp_create (u_int32_t num, struct dp_part **dp)
+dp_create (uint32_t num, struct dp_part **dp)
{
struct dp_part *d;
int ret;
@@ -74,7 +83,7 @@ dp_create (u_int32_t num, struct dp_part **dp)
*dp = NULL;
- if (num > ('z' - 'a' * 'z' - 'a'))
+ if (num > (('z' - 'a') * ('z' - 'a')))
return EINVAL;
d = malloc (sizeof (*d));
@@ -137,7 +146,7 @@ dp_free (struct dp_part *dp)
int
dp_find (struct dp_part **dp)
{
- u_int32_t num;
+ uint32_t num;
int found = 0, ret;
struct stat sb;
@@ -210,10 +219,10 @@ dp_findvol (struct dp_part *d, void (*cb)(void *, int), void *data)
*/
int
-dp_parse (const char *str, u_int32_t *num)
+dp_parse (const char *str, uint32_t *num)
{
int len;
- u_int32_t part = 0;
+ uint32_t part = 0;
assert (str && num);
@@ -250,7 +259,7 @@ dp_getpart (const char *str)
{
int ret;
struct dp_part *dp;
- u_int32_t part;
+ uint32_t part;
ret = dp_parse (str, &part);
if (ret)
@@ -262,3 +271,38 @@ dp_getpart (const char *str)
return dp;
}
+
+/*
+ * get available and total number of 1k blocks on partition
+ */
+
+int
+dp_getstats (struct dp_part *dp, long *availblocks, long *totalblocks)
+{
+#ifdef HAVE_STATVFS
+ struct statvfs sb;
+#else
+ struct statfs sb;
+#endif
+ int reservedblocks;
+ int ret;
+
+#ifdef HAVE_STATVFS
+ ret = statvfs (dp->part, &sb);
+#else
+ ret = statfs (dp->part, &sb);
+#endif
+ if (ret)
+ return errno;
+
+ reservedblocks = sb.f_bfree - sb.f_bavail;
+ if (sb.f_bsize <= 1024) {
+ *availblocks = sb.f_bavail * (1024/sb.f_bsize);
+ *totalblocks = (sb.f_blocks - reservedblocks) * (1024/sb.f_bsize);
+ } else {
+ *availblocks = sb.f_bavail / (sb.f_bsize/1024);
+ *totalblocks = (sb.f_blocks - reservedblocks) / (sb.f_bsize/1024);
+ }
+
+ return 0;
+}
diff --git a/usr.sbin/afs/src/milko/lib/dpart/dpart.h b/usr.sbin/afs/src/milko/lib/dpart/dpart.h
index d9980299411..5349e70d0e6 100644
--- a/usr.sbin/afs/src/milko/lib/dpart/dpart.h
+++ b/usr.sbin/afs/src/milko/lib/dpart/dpart.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: dpart.h,v 1.6 2000/12/29 20:12:36 tol Exp $ */
+/* $arla: dpart.h,v 1.8 2002/02/07 17:59:45 lha Exp $ */
#ifndef __FILBULKE_DPART_H
#define __FILBULKE_DPART_H 1
@@ -48,7 +48,7 @@ extern char *dpart_root;
#define DP_NAME(dp) ((dp)->part)
int
-dp_create (u_int32_t num, struct dp_part **dp);
+dp_create (uint32_t num, struct dp_part **dp);
void
dp_ref (struct dp_part *dp);
@@ -63,9 +63,12 @@ int
dp_findvol (struct dp_part *d, void (*cb)(void *, int), void *data);
int
-dp_parse (const char *str, u_int32_t *num);
+dp_parse (const char *str, uint32_t *num);
struct dp_part *
dp_getpart (const char *str);
+int
+dp_getstats (struct dp_part *dp, long *availblocks, long *totalblocks);
+
#endif /* __FILBULKE_DPART_H */
diff --git a/usr.sbin/afs/src/milko/lib/mlog/mlog.c b/usr.sbin/afs/src/milko/lib/mlog/mlog.c
index a14c0d2a8d9..fe939378127 100644
--- a/usr.sbin/afs/src/milko/lib/mlog/mlog.c
+++ b/usr.sbin/afs/src/milko/lib/mlog/mlog.c
@@ -44,7 +44,7 @@
#include "mlog.h"
-RCSID("$KTH: mlog.c,v 1.8 2000/10/03 00:17:58 lha Exp $");
+RCSID("$arla: mlog.c,v 1.8 2000/10/03 00:17:58 lha Exp $");
static Log_method* mlog_log_method = NULL;
static Log_unit* mlog_log_unit = NULL;
diff --git a/usr.sbin/afs/src/milko/lib/mlog/mlog.h b/usr.sbin/afs/src/milko/lib/mlog/mlog.h
index cdaff4e506d..0c188fd7d4d 100644
--- a/usr.sbin/afs/src/milko/lib/mlog/mlog.h
+++ b/usr.sbin/afs/src/milko/lib/mlog/mlog.h
@@ -32,7 +32,7 @@
*/
/*
- * $KTH: mlog.h,v 1.4 2000/10/03 00:18:03 lha Exp $
+ * $arla: mlog.h,v 1.4 2000/10/03 00:18:03 lha Exp $
*/
#ifndef _arladeb_h
diff --git a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c
index 6821736e6c6..3e9e8b413bd 100644
--- a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c
+++ b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.c
@@ -34,6 +34,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <roken.h>
#include <sys/types.h>
#include <rx/rx.h>
@@ -42,7 +43,11 @@
#include <assert.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#include <rxkad_locl.h>
@@ -67,7 +72,7 @@
#include "msecurity.h"
#include "acl.h"
-RCSID("$KTH: msecurity.c,v 1.9 2000/10/03 00:18:08 lha Exp $");
+RCSID("$arla: msecurity.c,v 1.11 2002/04/20 15:57:17 lha Exp $");
static char acl_file[] = MILKO_SYSCONFDIR "/superuserlist"; /* XXX */
diff --git a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h
index 3fc1d9fbc65..6b1cbb58b64 100644
--- a/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h
+++ b/usr.sbin/afs/src/milko/lib/msecurity/msecurity.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: msecurity.h,v 1.5 2000/10/03 00:18:14 lha Exp $ */
+/* $arla: msecurity.h,v 1.5 2000/10/03 00:18:14 lha Exp $ */
void
sec_disable_superuser_check (void);
diff --git a/usr.sbin/afs/src/milko/lib/msecurity/netinit.c b/usr.sbin/afs/src/milko/lib/msecurity/netinit.c
index b4d111019a2..434d9cac72e 100644
--- a/usr.sbin/afs/src/milko/lib/msecurity/netinit.c
+++ b/usr.sbin/afs/src/milko/lib/msecurity/netinit.c
@@ -38,13 +38,21 @@
#include <rx/rx_null.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#endif
#include <ko.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
#include <string.h>
#include <assert.h>
#include <err.h>
@@ -54,7 +62,7 @@
#include <unistd.h>
#endif
-RCSID("$KTH: netinit.c,v 1.14 2000/10/03 00:18:19 lha Exp $");
+RCSID("$arla: netinit.c,v 1.16 2002/06/02 21:12:17 lha Exp $");
/*
* Network functions
diff --git a/usr.sbin/afs/src/milko/lib/msecurity/netinit.h b/usr.sbin/afs/src/milko/lib/msecurity/netinit.h
index 16152e943b3..8e062480571 100644
--- a/usr.sbin/afs/src/milko/lib/msecurity/netinit.h
+++ b/usr.sbin/afs/src/milko/lib/msecurity/netinit.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: netinit.h,v 1.8 2000/10/03 00:18:24 lha Exp $ */
+/* $arla: netinit.h,v 1.8 2000/10/03 00:18:24 lha Exp $ */
void network_kerberos_init (char *srvtab);
diff --git a/usr.sbin/afs/src/milko/lib/ropa/README b/usr.sbin/afs/src/milko/lib/ropa/README
index 05eadce3412..de321c74673 100644
--- a/usr.sbin/afs/src/milko/lib/ropa/README
+++ b/usr.sbin/afs/src/milko/lib/ropa/README
@@ -3,7 +3,7 @@ Ropa - callbacks
Thoughts by Love <lha@stacken.kth.se>
-$KTH: README,v 1.1 1999/11/12 04:50:19 lha Exp $
+$arla: README,v 1.3 2002/05/16 22:09:45 hin Exp $
Design
======
@@ -63,8 +63,8 @@ Use UUID for all clients ? Cook and mark cooked for pre 3.5 clients.
This need to be storted on UUID so we can avoid sending cb
to the client.
-[3] Should callbacks be given all to the same time, or should diffrent
- clients have diffrent callbacks ? Will we get fetch-storms when
+[3] Should callbacks be given all to the same time, or should different
+ clients have different callbacks ? Will we get fetch-storms when
callbacks expire for wellused files (or RO volumes).
[4] We need to query the client when i contacts us the first time
diff --git a/usr.sbin/afs/src/milko/lib/ropa/ropa.c b/usr.sbin/afs/src/milko/lib/ropa/ropa.c
index 7c88a02c5be..ef13a8be359 100644
--- a/usr.sbin/afs/src/milko/lib/ropa/ropa.c
+++ b/usr.sbin/afs/src/milko/lib/ropa/ropa.c
@@ -61,6 +61,7 @@
#include <rx/rxgencon.h>
#include <cb.cs.h>
+#include <fs.ss.h>
#include <err.h>
@@ -69,7 +70,7 @@
#include <ropa.h>
-RCSID("$KTH: ropa.c,v 1.28 2000/12/04 19:34:30 lha Exp $");
+RCSID("$arla: ropa.c,v 1.30 2002/02/07 17:59:47 lha Exp $");
#ifdef DIAGNOSTIC
#define DIAGNOSTIC 1
@@ -104,8 +105,8 @@ struct ropa_addr {
int magic; /* magic */
#endif
struct ropa_client *c; /* pointer to head */
- u_int32_t addr_in; /* */
- u_int32_t subnetmask; /* */
+ uint32_t addr_in; /* */
+ uint32_t subnetmask; /* */
int mtu; /* */
};
@@ -131,7 +132,7 @@ struct ropa_client {
int numberOfInterfaces;
afsUUID uuid;
struct ropa_addr addr[AFS_MAX_INTERFACE_ADDR];
- u_int16_t port; /* port of client in network byte order */
+ uint16_t port; /* port of client in network byte order */
struct rx_connection *conn; /* connection to client */
time_t lastseen; /* last got a message */
List *callbacks; /* list of ccpairs */
@@ -521,8 +522,8 @@ clear_addr (struct ropa_addr *addr)
*/
static void
-client_update_interfaces (struct ropa_client *c, u_int32_t host,
- u_int16_t port, interfaceAddr *addr)
+client_update_interfaces (struct ropa_client *c, uint32_t host,
+ uint16_t port, interfaceAddr *addr)
{
int i;
int found_addr = 0;
@@ -568,7 +569,7 @@ client_update_interfaces (struct ropa_client *c, u_int32_t host,
*/
static void
-client_init (struct ropa_client *c, u_int32_t host, u_int16_t port,
+client_init (struct ropa_client *c, uint32_t host, uint16_t port,
afsUUID *uuid, interfaceAddr *addr)
{
c->port = port;
@@ -727,7 +728,7 @@ add_client (struct ropa_cb *cb, struct ropa_client *c)
*/
static void
-uuid_init_simple (afsUUID *uuid, u_int32_t host)
+uuid_init_simple (afsUUID *uuid, uint32_t host)
{
uuid->node[0] = 0xff & host;
uuid->node[1] = 0xff & (host >> 8);
@@ -742,7 +743,7 @@ uuid_init_simple (afsUUID *uuid, u_int32_t host)
*/
static struct ropa_client *
-client_query_notalkback (u_int32_t host, u_int16_t port)
+client_query_notalkback (uint32_t host, uint16_t port)
{
struct ropa_client ckey;
struct ropa_addr *addr;
@@ -785,7 +786,7 @@ obtain_client (void)
*/
static struct ropa_client *
-client_query (u_int32_t host, u_int16_t port)
+client_query (uint32_t host, uint16_t port)
{
struct ropa_client *c, *c_new;
int ret;
@@ -885,7 +886,7 @@ client_query (u_int32_t host, u_int16_t port)
#if 0
static struct ropa_client *
-uuid_query_simple (u_int32_t host)
+uuid_query_simple (uint32_t host)
{
struct ropa_client ckey;
uuid_init_simple (&ckey.uuid, host);
@@ -924,12 +925,13 @@ update_callback (struct ropa_ccpair *cc, AFSCallBack *callback, int32_t type)
*/
int
-ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid,
- AFSCallBack *callback)
+ropa_getcallback (uint32_t host, uint16_t port, const struct AFSFid *fid,
+ AFSCallBack *callback, int32_t voltype)
{
struct ropa_client *c;
struct ropa_cb cbkey, *cb;
struct ropa_ccpair *cc ;
+ struct AFSFid callback_fid;
debug_print_callbacks();
@@ -951,7 +953,15 @@ ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid,
break_outstanding_callbacks (c);
#endif
- cbkey.fid = *fid;
+ if (voltype == RWVOL) {
+ callback_fid = *fid;
+ } else {
+ callback_fid.Volume = fid->Volume;
+ callback_fid.Vnode = 0;
+ callback_fid.Unique = 0;
+ }
+
+ cbkey.fid = callback_fid;
cb = hashtabsearch (ht_callbacks, &cbkey);
if (cb == NULL) {
@@ -965,14 +975,16 @@ ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid,
callback_ref(cb);
cb->li = listaddhead (lru_callback, cb);
}
- cb->fid = *fid;
+ cb->fid = callback_fid;
hashtabadd (ht_callbacks, cb);
mlog_log (MDEBROPA, "ropa_getcallback: added callback %x.%x.%x:%x",
- fid->Volume, fid->Vnode, fid->Unique, host);
+ callback_fid.Volume, callback_fid.Vnode,
+ callback_fid.Unique, host);
} else {
mlog_log (MDEBROPA, "ropa_getcallback: found callback %x.%x.%x:%x",
- fid->Volume, fid->Vnode, fid->Unique, host);
+ callback_fid.Volume, callback_fid.Vnode,
+ callback_fid.Unique, host);
callback_ref(cb);
}
@@ -1006,7 +1018,7 @@ notify_client (struct ropa_client *c, AFSCBFids *fids, AFSCBs *cbs)
return ret;
}
for (i = 0; i < c->numberOfInterfaces ; i++) {
- u_int16_t port = c->port;
+ uint16_t port = c->port;
DIAGNOSTIC_CHECK_ADDR(&c->addr[i]);
c->conn = rx_NewConnection (c->addr[i].addr_in,
@@ -1113,10 +1125,9 @@ break_ccpairs (struct ropa_client *c, Bool notify_clientp)
cbs.val = NULL;
cbs.len = 0;
- update_callback (cc, &callback, CBDROPPED);
-
while ((cc = listdeltail (c->callbacks)) != NULL) {
DIAGNOSTIC_CHECK_CCPAIR(cc);
+ update_callback (cc, &callback, CBDROPPED);
add_to_cb (&cc->cb->fid, &callback, &fids, &cbs);
break_ccpair (cc, FALSE);
}
@@ -1168,16 +1179,33 @@ break_callback (struct ropa_cb *cb, struct ropa_client *caller, Bool break_own)
client_deref (caller);
}
+static int
+break_fid (const struct AFSFid *fid, struct ropa_client *c,
+ Bool break_own)
+{
+ struct ropa_cb cbkey, *cb;
+
+ cbkey.fid = *fid;
+
+ cb = hashtabsearch (ht_callbacks, &cbkey);
+ if (cb == NULL) {
+ return -1;
+ }
+
+ break_callback (cb, c, break_own);
+
+ return 0;
+}
+
/*
*
*/
void
-ropa_break_callback (u_int32_t addr, u_int16_t port,
+ropa_break_callback (uint32_t addr, uint16_t port,
const struct AFSFid *fid, Bool break_own)
{
struct ropa_client *c = NULL;
- struct ropa_cb cbkey, *cb;
debug_print_callbacks();
@@ -1185,30 +1213,36 @@ ropa_break_callback (u_int32_t addr, u_int16_t port,
if (c == NULL) {
mlog_log (MDEBROPA, "ropa_break_callback: didn't find client %x/%d",
addr, addr);
- return;
+ return; /* XXX */
}
- cbkey.fid = *fid;
-
- cb = hashtabsearch (ht_callbacks, &cbkey);
- if (cb == NULL) {
+ if (break_fid(fid, c, break_own)) {
mlog_log (MDEBROPA, "ropa_break_callback: "
"didn't find callback %x.%x.%x:%x/%d",
- fid->Volume, fid->Vnode, fid->Unique, addr, port);
- return;
+ fid->Volume, fid->Vnode, fid->Unique, addr, port);
}
- break_callback (cb, c, break_own);
-
debug_print_callbacks();
}
+void
+ropa_break_volume_callback(int32_t volume)
+{
+ struct AFSFid fid;
+
+ fid.Volume = volume;
+ fid.Vnode = 0;
+ fid.Unique = 0;
+
+ break_fid(&fid, NULL, FALSE);
+}
+
/*
* ropa_drop_callbacks
*/
int
-ropa_drop_callbacks (u_int32_t addr, u_int16_t port,
+ropa_drop_callbacks (uint32_t addr, uint16_t port,
const AFSCBFids *a_cbfids_p, const AFSCBs *a_cbs_p)
{
struct ropa_client *c;
@@ -1267,7 +1301,7 @@ break_client (struct ropa_client *c, Bool notify_clientp)
}
void
-ropa_break_client (u_int32_t host, u_int16_t port)
+ropa_break_client (uint32_t host, uint16_t port)
{
struct ropa_client *c;
diff --git a/usr.sbin/afs/src/milko/lib/ropa/ropa.h b/usr.sbin/afs/src/milko/lib/ropa/ropa.h
index 96771bfb276..d9adbe5070d 100644
--- a/usr.sbin/afs/src/milko/lib/ropa/ropa.h
+++ b/usr.sbin/afs/src/milko/lib/ropa/ropa.h
@@ -31,23 +31,26 @@
* SUCH DAMAGE.
*/
-/* $KTH: ropa.h,v 1.8 2000/10/03 00:18:35 lha Exp $ */
+/* $arla: ropa.h,v 1.10 2002/02/07 17:59:48 lha Exp $ */
int
ropa_init (unsigned num_cb, unsigned num_cli, unsigned num_cc,
unsigned hashsz_cb, unsigned hashsz_cli, unsigned hashsz_cc);
int
-ropa_getcallback (u_int32_t host, u_int16_t port, const struct AFSFid *fid,
- AFSCallBack *callback);
+ropa_getcallback (uint32_t host, uint16_t port, const struct AFSFid *fid,
+ AFSCallBack *callback, int32_t voltype);
int
-ropa_drop_callbacks (u_int32_t host, u_int16_t port,
+ropa_drop_callbacks (uint32_t host, uint16_t port,
const AFSCBFids *a_cbfids_p, const AFSCBs *a_cbs_p);
void
-ropa_break_callback (u_int32_t addr, u_int16_t port,
+ropa_break_callback (uint32_t addr, uint16_t port,
const struct AFSFid *fid, Bool break_own);
void
-ropa_break_client (u_int32_t addr, u_int16_t port);
+ropa_break_client (uint32_t addr, uint16_t port);
+
+void
+ropa_break_volume_callback(int32_t volume);
diff --git a/usr.sbin/afs/src/milko/lib/vld/common.c b/usr.sbin/afs/src/milko/lib/vld/common.c
index 18b0b7db9f5..8ba26a0b3d2 100644
--- a/usr.sbin/afs/src/milko/lib/vld/common.c
+++ b/usr.sbin/afs/src/milko/lib/vld/common.c
@@ -33,7 +33,7 @@
#include <sfvol_private.h>
-RCSID("$KTH: common.c,v 1.3 2000/10/03 00:18:41 lha Exp $");
+RCSID("$arla: common.c,v 1.3 2000/10/03 00:18:41 lha Exp $");
/*
* Translate the `opaque' to the `ino'.
diff --git a/usr.sbin/afs/src/milko/lib/vld/fvol.c b/usr.sbin/afs/src/milko/lib/vld/fvol.c
index 682825fb0f2..7809742d587 100644
--- a/usr.sbin/afs/src/milko/lib/vld/fvol.c
+++ b/usr.sbin/afs/src/milko/lib/vld/fvol.c
@@ -33,7 +33,7 @@
#include <sfvol_private.h>
-RCSID("$KTH: fvol.c,v 1.3 2000/10/03 00:18:51 lha Exp $");
+RCSID("$arla: fvol.c,v 1.3 2000/10/03 00:18:51 lha Exp $");
/*
* Description:
diff --git a/usr.sbin/afs/src/milko/lib/vld/fvol.h b/usr.sbin/afs/src/milko/lib/vld/fvol.h
index 54e8ab78cbd..0b7d5e63b5b 100644
--- a/usr.sbin/afs/src/milko/lib/vld/fvol.h
+++ b/usr.sbin/afs/src/milko/lib/vld/fvol.h
@@ -32,7 +32,7 @@
*/
/*
- * $KTH: fvol.h,v 1.3 2000/10/03 00:18:56 lha Exp $
+ * $arla: fvol.h,v 1.3 2000/10/03 00:18:56 lha Exp $
*/
#define FVOL_MAGIC1 0x1132
diff --git a/usr.sbin/afs/src/milko/lib/vld/glue.c b/usr.sbin/afs/src/milko/lib/vld/glue.c
index b0e116fab4d..c85f4334ac0 100644
--- a/usr.sbin/afs/src/milko/lib/vld/glue.c
+++ b/usr.sbin/afs/src/milko/lib/vld/glue.c
@@ -60,7 +60,7 @@
#include <err.h>
#include <errno.h>
-RCSID("$KTH: glue.c,v 1.4 2000/10/03 00:19:01 lha Exp $");
+RCSID("$arla: glue.c,v 1.4 2000/10/03 00:19:01 lha Exp $");
/*
*
diff --git a/usr.sbin/afs/src/milko/lib/vld/mdir.c b/usr.sbin/afs/src/milko/lib/vld/mdir.c
index 71cef732762..4f63c8c9c99 100644
--- a/usr.sbin/afs/src/milko/lib/vld/mdir.c
+++ b/usr.sbin/afs/src/milko/lib/vld/mdir.c
@@ -37,7 +37,7 @@
#include <config.h>
-RCSID("$KTH: mdir.c,v 1.10 2000/10/03 00:19:06 lha Exp $");
+RCSID("$arla: mdir.c,v 1.14 2002/03/06 22:43:01 tol Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@@ -54,25 +54,31 @@ RCSID("$KTH: mdir.c,v 1.10 2000/10/03 00:19:06 lha Exp $");
int
-mdir_lookup (struct mnode *node, VenusFid *dir, const char *name, VenusFid *file)
+mdir_lookup (struct mnode *node, const char *name, AFSFid *file)
{
fbuf the_fbuf;
+ VenusFid dir, fid;
int ret, saved_ret;
assert (node->flags.sbp);
assert (node->flags.fdp);
+ dir.Cell = 0;
+ dir.fid = node->fid;
+
ret = fbuf_create (&the_fbuf, node->fd, node->sb.st_size,
FBUF_READ|FBUF_PRIVATE);
if (ret)
return ret;
- saved_ret = fdir_lookup (&the_fbuf, dir, name, file);
+ saved_ret = fdir_lookup (&the_fbuf, &dir, name, &fid);
ret = fbuf_end (&the_fbuf);
if (ret)
return ret;
+ *file = fid.fid;
+
return saved_ret;
}
@@ -101,9 +107,9 @@ mdir_emptyp (struct mnode *node)
int
mdir_readdir (struct mnode *node,
- void (*func)(VenusFid *, const char *, void *),
+ int (*func)(VenusFid *, const char *, void *),
void *arg,
- VenusFid *dir)
+ VenusFid dir)
{
fbuf the_fbuf;
int ret, saved_ret;
@@ -116,7 +122,7 @@ mdir_readdir (struct mnode *node,
if (ret)
return ret;
- saved_ret = fdir_readdir (&the_fbuf, func, arg, dir);
+ saved_ret = fdir_readdir (&the_fbuf, func, arg, dir, NULL);
ret = fbuf_end (&the_fbuf);
if (ret)
@@ -219,4 +225,119 @@ mdir_mkdir (struct mnode *node,
return saved_ret;
}
+int
+mdir_rename(struct mnode *dir1, const char *name1, int32_t *len1,
+ struct mnode *dir2, const char *name2, int32_t *len2)
+{
+ fbuf origfbuf;
+ fbuf newfbuf;
+ fbuf *newfbufP = &newfbuf;
+ VenusFid child, origVFid;
+ int ret, dirp;
+ int same_dir = FALSE;
+
+ origVFid.Cell = 0;
+ origVFid.fid = dir1->fid;
+
+ ret = fbuf_create (&origfbuf, dir1->fd, dir1->sb.st_size,
+ FBUF_READ|FBUF_WRITE|FBUF_SHARED);
+ if (ret)
+ return ret;
+
+ ret = fdir_lookup(&origfbuf, &origVFid, name1, &child);
+ if (ret) {
+ fbuf_end (&origfbuf);
+ return ret;
+ }
+
+ dirp = afs_dir_p (child.fid.Vnode);
+
+ if (dir1 == dir2) {
+ newfbufP = &origfbuf;
+ same_dir = TRUE;
+ } else {
+ ret = fbuf_create (&newfbuf, dir2->fd,
+ dir2->sb.st_size,
+ FBUF_READ|FBUF_WRITE|FBUF_SHARED);
+ if (ret) {
+ fbuf_end (&origfbuf);
+ return ret;
+ }
+ }
+
+ {
+ VenusFid sentenced_file;
+ VenusFid dir;
+
+ dir.fid = dir2->fid;
+ dir.Cell = 0;
+
+ if (fdir_lookup(newfbufP, &dir, name2, &sentenced_file) == ENOENT) {
+ ret = fdir_creat (newfbufP, name2, child.fid);
+ if (ret)
+ goto out1;
+
+ } else {
+ if (afs_dir_p (sentenced_file.fid.Vnode) != dirp) { /* XXX check properly */
+ ret = EISDIR;
+ goto out1;
+ }
+
+ if (dirp && fdir_emptyp(newfbufP) != TRUE) {
+ ret = ENOTEMPTY;
+ goto out1;
+ }
+
+ ret = fdir_changefid(newfbufP, name2, &child);
+ if (ret)
+ goto out1;
+ }
+ }
+
+ ret = fdir_remove (&origfbuf, name1, NULL);
+ if (ret == 0) {
+ *len1 = fbuf_len (&origfbuf);
+ if (!same_dir)
+ *len2 = fbuf_len (newfbufP);
+ }
+
+ out1:
+ fbuf_end (&origfbuf);
+ if (!same_dir) {
+ fbuf_end (&newfbuf);
+ }
+
+ return ret;
+}
+int
+mdir_changefid(struct mnode *dir, const char *name, AFSFid fid) {
+ fbuf the_fbuf;
+ VenusFid vfid;
+ int ret, saved_ret;
+ int32_t len;
+
+ assert (dir->flags.sbp);
+ assert (dir->flags.fdp);
+
+ vfid.Cell = 0;
+ vfid.fid = fid;
+
+ ret = fbuf_create (&the_fbuf, dir->fd, dir->sb.st_size,
+ FBUF_READ|FBUF_WRITE|FBUF_SHARED);
+ if (ret)
+ return ret;
+
+ saved_ret = fdir_changefid (&the_fbuf, name, &vfid);
+
+ if (ret == 0) {
+ len = fbuf_len (&the_fbuf);
+ mnode_update_size (dir, &len);
+ }
+
+ ret = fbuf_end (&the_fbuf);
+ if (ret)
+ return ret;
+
+ return saved_ret;
+}
diff --git a/usr.sbin/afs/src/milko/lib/vld/mdir.h b/usr.sbin/afs/src/milko/lib/vld/mdir.h
index ca4031e1b8b..3f69f367430 100644
--- a/usr.sbin/afs/src/milko/lib/vld/mdir.h
+++ b/usr.sbin/afs/src/milko/lib/vld/mdir.h
@@ -31,13 +31,13 @@
* SUCH DAMAGE.
*/
-/* $KTH: mdir.h,v 1.4 2000/10/03 00:19:11 lha Exp $ */
+/* $arla: mdir.h,v 1.8 2002/03/06 22:43:02 tol Exp $ */
/*
* Interface to fdir directory handling routines
*/
-/* $KTH: mdir.h,v 1.4 2000/10/03 00:19:11 lha Exp $ */
+/* $arla: mdir.h,v 1.8 2002/03/06 22:43:02 tol Exp $ */
#ifndef _MDIR_H_
#define _MDIR_H_
@@ -46,16 +46,16 @@
#include <mnode.h>
int
-mdir_lookup (struct mnode *node, VenusFid *dir, const char *name, VenusFid *file);
+mdir_lookup (struct mnode *node, const char *name, AFSFid *file);
int
mdir_emptyp (struct mnode *node);
int
mdir_readdir (struct mnode *node,
- void (*func)(VenusFid *, const char *, void *),
+ int (*func)(VenusFid *, const char *, void *),
void *arg,
- VenusFid *dir);
+ VenusFid dir);
int
mdir_creat (struct mnode *node,
@@ -71,4 +71,11 @@ mdir_mkdir (struct mnode *node,
AFSFid dot,
AFSFid dot_dot);
+int
+mdir_rename(struct mnode *dir1, const char *name1, int32_t *len1,
+ struct mnode *dir2, const char *name2, int32_t *len2);
+
+int
+mdir_changefid(struct mnode *dir, const char *name, AFSFid fid);
+
#endif /* _MDIR_H_ */
diff --git a/usr.sbin/afs/src/milko/lib/vld/mnode.c b/usr.sbin/afs/src/milko/lib/vld/mnode.c
index 902fc48569a..f37761e02f8 100644
--- a/usr.sbin/afs/src/milko/lib/vld/mnode.c
+++ b/usr.sbin/afs/src/milko/lib/vld/mnode.c
@@ -42,7 +42,7 @@
#include <config.h>
#endif
-RCSID("$KTH: mnode.c,v 1.9 2000/10/03 00:19:17 lha Exp $");
+RCSID("$arla: mnode.c,v 1.11 2001/11/06 16:03:19 tol Exp $");
#include <sys/types.h>
#include <stdio.h>
@@ -57,6 +57,10 @@ RCSID("$KTH: mnode.c,v 1.9 2000/10/03 00:19:17 lha Exp $");
#include <mnode.h>
+#include <mdebug.h>
+#include <mlog.h>
+
+
List *mnode_lru; /* least recently used on tail, ref == 0 */
Hashtab *mnode_htab; /* hash of all valid nodes */
@@ -127,7 +131,11 @@ mnode_init (unsigned num)
static void
reset_node (struct mnode *n, const AFSFid *fid)
{
- assert (n->flags.fdp == FALSE);
+ assert (n->ref == 0);
+ if (n->flags.fdp) {
+ close (n->fd);
+ n->flags.fdp = FALSE;
+ }
memset (n, 0, sizeof (*n));
n->fid = *fid;
}
@@ -143,29 +151,50 @@ reset_node (struct mnode *n, const AFSFid *fid)
int
mnode_find (const AFSFid *fid, struct mnode **node)
{
- struct mnode ptr, *res;
+ struct mnode ptr, *res = NULL;
ptr.fid = *fid;
- res = hashtabsearch (mnode_htab, &ptr);
-
- if (res) {
- if (res->li)
- listdel (mnode_lru, res->li);
- if (res->ref == 0)
- mnode_numfree--;
- res->ref++;
- } else if (mnode_numfree != 0) {
- res = listdeltail (mnode_lru); assert (res);
- assert (res->ref == 0);
- hashtabdel (mnode_htab, res);
- reset_node (res, fid);
- hashtabadd (mnode_htab, res);
- res->ref++;
- } else {
- /* XXX */
- abort();
+ while (res == NULL) {
+ res = hashtabsearch (mnode_htab, &ptr);
+
+ if (res) {
+ if (res->flags.removedp == TRUE)
+ return ENOENT;
+
+ if (res->li)
+ listdel (mnode_lru, res->li);
+ if (res->ref == 0)
+ mnode_numfree--;
+ res->ref++;
+ } else if (mnode_numfree != 0) {
+ res = listdeltail (mnode_lru); assert (res);
+ assert (res->ref == 0);
+ hashtabdel (mnode_htab, res);
+ reset_node (res, fid);
+ hashtabadd (mnode_htab, res);
+ res->ref++;
+ } else {
+ /* XXX */
+ mlog_log (MDEBWARN,
+ "mnode_find: no free nodes, had to malloc()");
+
+ res = malloc(sizeof(struct mnode));
+ if (res == NULL) {
+ mlog_log (MDEBWARN,
+ "mnode_find: malloc() failed");
+ LWP_DispatchProcess(); /* Yield */
+ continue;
+ }
+
+ reset_node (res, fid);
+ hashtabadd (mnode_htab, res);
+ res->ref++;
+ }
}
+
+ assert(res->flags.removedp == FALSE);
+
*node = res;
res->li = listaddhead (mnode_lru, *node);
return 0;
@@ -196,10 +225,15 @@ mnode_free (struct mnode *node, Bool bad)
close (node->fd);
node->flags.fdp = FALSE;
}
- mnode_numfree++;
- }
- node->li = listaddhead (mnode_lru, node);
+ if (node->flags.removedp == TRUE) {
+ hashtabdel (mnode_htab, node);
+ node->flags.removedp = FALSE;
+ }
+ mnode_numfree++;
+ node->li = listaddtail (mnode_lru, node);
+ } else
+ node->li = listaddhead (mnode_lru, node);
}
/*
@@ -222,7 +256,7 @@ mnode_remove (const AFSFid *fid)
if (res->li)
listdel (mnode_lru, res->li);
res->li = listaddhead (mnode_lru, res);
- mnode_numfree++;
+ res->flags.removedp = TRUE;
}
}
@@ -267,3 +301,4 @@ mnode_update_size_cached (struct mnode *n)
n->fs.Length = n->sb.st_size;
return 0;
}
+
diff --git a/usr.sbin/afs/src/milko/lib/vld/mnode.h b/usr.sbin/afs/src/milko/lib/vld/mnode.h
index dde362c9d98..544a93646d9 100644
--- a/usr.sbin/afs/src/milko/lib/vld/mnode.h
+++ b/usr.sbin/afs/src/milko/lib/vld/mnode.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: mnode.h,v 1.7 2000/10/03 00:19:22 lha Exp $ */
+/* $arla: mnode.h,v 1.9 2002/01/23 00:50:08 d95_mah Exp $ */
#ifndef MILKO_MNODE_H
#define MILKO_MNODE_H 1
@@ -63,7 +63,8 @@ struct mnode {
AFSFid fid; /* only valid if on hashtable */
struct voldb_entry e; /* entry information */
struct {
- unsigned usedp:1; /* if node is used */
+ unsigned usedp:1; /* if node is used */
+ unsigned removedp:1; /* if node has been removed */
unsigned fdp:1; /* if fd is open */
unsigned sbp:1; /* if stat sb is valid */
unsigned fsp:1; /* if afsfetchstatus fs is valid */
@@ -83,6 +84,7 @@ struct msec {
struct fs_security_context {
prlist *cps; /* current proctection set */
int32_t uid; /* user id of caller */
+ int superuser; /* is super user */
int ref; /* reference counter */
};
@@ -105,3 +107,4 @@ int
mnode_update_size (struct mnode *, int32_t *len);
#endif /* MILKO_MNODE_H */
+
diff --git a/usr.sbin/afs/src/milko/lib/vld/salvage.c b/usr.sbin/afs/src/milko/lib/vld/salvage.c
index 7e4497ddef1..ce9bd5d2f7e 100644
--- a/usr.sbin/afs/src/milko/lib/vld/salvage.c
+++ b/usr.sbin/afs/src/milko/lib/vld/salvage.c
@@ -33,7 +33,7 @@
#include <config.h>
-RCSID("$KTH: salvage.c,v 1.11 2000/10/03 00:19:27 lha Exp $");
+RCSID("$arla: salvage.c,v 1.15 2002/03/06 22:43:02 tol Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@@ -93,7 +93,7 @@ struct vinfo {
static struct inodeinfo *
find_node (struct vinfo *info, int32_t inode)
{
- u_int32_t i;
+ uint32_t i;
assert (info);
for (i = 0; i < info->nnodes; i++) {
@@ -219,30 +219,32 @@ do { \
} \
} while (0)
-#define CHECK_VALUE_BITMASK(check_val,val,mask,string,modified) \
-do { \
- if (((~(mask) & (check_val)) & ~(val)) != 0) { \
- (check_val) &= (val) + (~(mask) & (check_val)); \
- (modified) = 1; \
- mlog_log (MDEBSALVAGE, "%s had a errorous value resetting", string); \
- } \
-} while (0)
+/*
+ *
+ */
-#define SET_VALUE_BITMASK(check_val,val,defval,string,modified) \
-do { \
- if (((check_val) & (val)) == 0) { \
- (check_val) |= (defval); \
- (modified) = 1; \
- mlog_log (MDEBSALVAGE, "%s had a missing value setting", string); \
- } \
-} while (0)
+static int
+check_value_bitmask(uint32_t *checkval, uint32_t val, uint32_t mask,
+ const char *string)
+{
+ int32_t newval;
+
+ if ((mask & (*checkval)) & ~val) {
+ newval = (*checkval) & (val | (~mask & (*checkval)));
+ mlog_log (MDEBSALVAGE, "%s had a errorous value 0%o resetting to 0%o",
+ string, *checkval, newval);
+ *checkval = newval;
+ return 1;
+ }
+ return 0;
+}
/*
*
*/
static int
-read_nodes_dir (u_int32_t num, struct voldb_entry *entry,
+read_nodes_dir (uint32_t num, struct voldb_entry *entry,
struct vinfo *info, struct inodeinfo **ret_node)
{
struct inodeinfo *node;
@@ -250,17 +252,17 @@ read_nodes_dir (u_int32_t num, struct voldb_entry *entry,
assert (entry->type == TYPE_DIR);
- if (entry->u.dir.FileType == 0 || entry->u.file.nextptr != 0) {
+ if (entry->u.dir.FileType == 0 ||
+ entry->u.file.nextptr != VOLDB_ENTRY_USED)
+ {
mlog_log (MDEBSALVAGE, "%d is a unused node (dir)", num);
return SALVAGE_RN_UNUSED;
}
CHECK_VALUE_EQ(entry->u.dir.InterfaceVersion,1, "InterfaceVersion",mod);
- CHECK_VALUE_BITMASK(entry->u.dir.UnixModeBits,047777, 0777777,
- "Unix rights",mod);
- SET_VALUE_BITMASK(entry->u.dir.UnixModeBits,040000,040000,
- "Directory bit",mod);
+ mod |= check_value_bitmask(&entry->u.dir.UnixModeBits, 04777, 07777,
+ "Unix dir rights");
CHECK_VALUE_EQ(entry->u.dir.FileType,TYPE_DIR,"FileType",mod);
@@ -268,7 +270,7 @@ read_nodes_dir (u_int32_t num, struct voldb_entry *entry,
node->inode_num = dir_local2afs (num);
node->parent_num = entry->u.dir.ParentVnode;
node->parent_unique = entry->u.dir.ParentUnique;
- if (entry->u.dir.nextptr)
+ if (entry->u.dir.nextptr != VOLDB_ENTRY_USED)
node->status = IUNUSED;
else
node->status = IFOUND;
@@ -286,36 +288,39 @@ read_nodes_dir (u_int32_t num, struct voldb_entry *entry,
*/
static int
-read_nodes_file (u_int32_t num, struct voldb_entry *entry,
+read_nodes_file (uint32_t num, struct voldb_entry *entry,
struct vinfo *info, struct inodeinfo **ret_node)
{
struct inodeinfo *node;
int mod = 0;
- if (entry->u.file.FileType == 0 || entry->u.file.nextptr != 0) {
+ if (entry->u.file.FileType == 0 ||
+ entry->u.file.nextptr != VOLDB_ENTRY_USED)
+ {
mlog_log (MDEBSALVAGE, "%d is a unused node (file)", num);
return 0; /* XXX ? */
}
CHECK_VALUE_EQ(entry->u.file.InterfaceVersion,1, "InterfaceVersion",mod);
- CHECK_VALUE_BITMASK(entry->u.file.UnixModeBits,047777, 0777777,
- "Unix rights",mod);
- SET_VALUE_BITMASK(entry->u.file.UnixModeBits,0120000,0100000,
- "Directory bit",mod);
-
+ /* Remove sgid and sticky bit */
+ mod |= check_value_bitmask(&entry->u.file.UnixModeBits, 04777, 07777,
+ "Unix file rights");
+
switch (entry->u.file.FileType) {
case TYPE_FILE:
case TYPE_LINK:
break;
default:
- CHECK_VALUE_EQ(entry->u.file.FileType,TYPE_FILE,"FileType",mod);
+ mlog_log (MDEBSALVAGE, "File type incorrect, resetting");
+ entry->u.file.FileType = TYPE_FILE;
+ mod |= 1;
}
node = allocate_node (info, file_local2afs(num), TYPE_FILE);
node->inode_num = file_local2afs(num);
node->parent_num = entry->u.file.ParentVnode;
node->parent_unique = entry->u.file.ParentUnique;
- if (entry->u.file.nextptr != 0)
+ if (entry->u.file.nextptr != VOLDB_ENTRY_USED)
node->status = IUNUSED;
else
node->status = IFOUND;
@@ -332,11 +337,11 @@ read_nodes_file (u_int32_t num, struct voldb_entry *entry,
static int
read_nodes (struct volume_handle *volh, struct voldb *db,
- u_int32_t size, struct vinfo *info,
- int (*func) (u_int32_t, struct voldb_entry *, struct vinfo *,
+ uint32_t size, struct vinfo *info,
+ int (*func) (uint32_t, struct voldb_entry *, struct vinfo *,
struct inodeinfo **))
{
- u_int32_t i;
+ uint32_t i;
int ret;
int changed = 0;
int check_data;
@@ -397,7 +402,7 @@ read_nodes (struct volume_handle *volh, struct voldb *db,
static int
remove_node (struct volume_handle *volh, struct inodeinfo *node)
{
- u_int32_t ino;
+ uint32_t ino;
struct voldb *db;
if (afs_dir_p (node->inode_num)) {
@@ -421,7 +426,7 @@ struct dir_func_s {
struct volume_handle *volh;
};
-static void
+static int
check_dir_func (VenusFid *fid, const char *name, void *arg)
{
struct dir_func_s *f = (struct dir_func_s *)arg;
@@ -475,6 +480,7 @@ check_dir_func (VenusFid *fid, const char *name, void *arg)
}
}
}
+ return 0;
}
/*
@@ -518,7 +524,7 @@ check_content_dir_func (volume_handle *vol,
ret = fbuf_create (&the_fbuf, fd, size,
FBUF_READ|FBUF_WRITE|FBUF_SHARED);
- ret = fdir_readdir (&the_fbuf, check_dir_func, &f, &fid);
+ ret = fdir_readdir (&the_fbuf, check_dir_func, &f, fid, NULL);
if (ret)
mlog_log (MDEBSALVAGE, "check_content_dir_func: fbuf_readdir failed");
@@ -692,8 +698,8 @@ find_list_tree_nodes (struct volume_handle *volh,
int
salvage_volume (struct volume_handle *volh)
{
- u_int32_t dsize, fsize;
- u_int32_t foundnodes;
+ uint32_t dsize, fsize;
+ uint32_t foundnodes;
int ret, i;
struct vinfo info;
struct inodeinfo *lfnodes;
diff --git a/usr.sbin/afs/src/milko/lib/vld/salvage.h b/usr.sbin/afs/src/milko/lib/vld/salvage.h
index e13b96ccf17..f894d2586d7 100644
--- a/usr.sbin/afs/src/milko/lib/vld/salvage.h
+++ b/usr.sbin/afs/src/milko/lib/vld/salvage.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: salvage.h,v 1.2 2000/10/03 00:19:33 lha Exp $ */
+/* $arla: salvage.h,v 1.2 2000/10/03 00:19:33 lha Exp $ */
#ifndef MILKO_SALVAGE_H
#define MILKO_SALVAGE_H 1
diff --git a/usr.sbin/afs/src/milko/lib/vld/svol.c b/usr.sbin/afs/src/milko/lib/vld/svol.c
index 879c6a3e558..38ec9862f18 100644
--- a/usr.sbin/afs/src/milko/lib/vld/svol.c
+++ b/usr.sbin/afs/src/milko/lib/vld/svol.c
@@ -33,7 +33,7 @@
#include <sfvol_private.h>
-RCSID("$KTH: svol.c,v 1.3 2000/10/03 00:19:44 lha Exp $");
+RCSID("$arla: svol.c,v 1.3 2000/10/03 00:19:44 lha Exp $");
/*
* Description:
diff --git a/usr.sbin/afs/src/milko/lib/vld/vld.c b/usr.sbin/afs/src/milko/lib/vld/vld.c
index e8ac96a9017..717e281526b 100644
--- a/usr.sbin/afs/src/milko/lib/vld/vld.c
+++ b/usr.sbin/afs/src/milko/lib/vld/vld.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: vld.c,v 1.49 2000/12/29 19:45:50 tol Exp $ */
+/* $arla: vld.c,v 1.63 2003/02/15 14:57:32 map Exp $ */
#include <sys/types.h>
#include <stdio.h>
@@ -74,8 +74,8 @@ static int vld_ent_to_fetchstatus (struct volume_handle *vol,
struct voldb_entry *e,
struct mnode *n);
static void vld_set_author(struct voldb_entry *e, struct msec *m);
-static int super_user (struct msec *m);
-
+static int vld_update_volsize (volume_handle *vol, int diff);
+static int vld_check_quota (volume_handle *vol, int diff);
/*
* Local variables
@@ -100,6 +100,9 @@ vol_op *backstoretypes[VLD_MAX_BACKSTORE_TYPES];
#define VLD_VALID_BACKSTORETYPE(backstoretype) (!(backstoretype >= 0 && backstoretype < VLD_MAX_BACKSTORE_TYPES && backstoretypes[backstoretype] != NULL))
+#define ENTRY_DISK_SIZE 1
+#define DIR_DISK_SIZE 2
+
static int
VLD_VALID_VOLNAME(const char *volname)
{
@@ -362,16 +365,18 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child,
onode_opaque dummy; /* used when removing when failed */
int ret;
struct mnode *n;
- u_int32_t real_mnode, unique;
+ uint32_t real_mnode, unique;
struct voldb *db;
int (*convert_local2afs)(int32_t);
node_type ntype;
+ int space_needed = ENTRY_DISK_SIZE;
switch (type) {
case TYPE_DIR:
db = VLD_VOLH_DIR(vol);
convert_local2afs = dir_local2afs;
ntype = NODE_DIR;
+ space_needed += DIR_DISK_SIZE;
break;
case TYPE_FILE:
case TYPE_LINK:
@@ -383,6 +388,10 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child,
abort();
}
+ ret = vld_check_quota (vol, space_needed);
+ if (ret)
+ return ret;
+
ret = voldb_new_entry (db, &real_mnode, &unique);
if (ret)
return ret;
@@ -464,21 +473,25 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child,
if (ret_n) {
+ if (n->flags.ep == FALSE) {
+ ret = voldb_get_entry (db, real_mnode, &n->e);
+ if (ret)
+ goto out_bad_put;
+ n->flags.ep = TRUE;
+ }
+
if (m && (m->flags & VOLOP_GETSTATUS) == VOLOP_GETSTATUS) {
assert(n->flags.fdp);
-
- if (n->flags.ep == FALSE) {
- ret = voldb_get_entry (db, real_mnode, &n->e);
- if (ret)
- goto out_bad_put;
- n->flags.ep = TRUE;
- }
-
+
ret = vld_ent_to_fetchstatus(vol, &e, n);
if (ret)
goto out_bad_put;
}
+ ret = vld_update_volsize (vol, ENTRY_DISK_SIZE + n->e.u.dir.Length/1024);
+ if (ret)
+ goto out_bad_put;
+
*ret_n = n;
} else
mnode_free (n, FALSE);
@@ -569,16 +582,22 @@ vld_adjust_linkcount (volume_handle *vol, struct mnode *n, int adjust)
}
*LinkCount += adjust;
-
- /* XXX is this necessary? */
- ret = voldb_put_entry (db, real_mnode, &n->e);
- if (ret)
- return ret;
-
n->fs.LinkCount += adjust;
- n->flags.ep = TRUE;
+
+ assert(*LinkCount >= 0);
- return 0;
+ if (*LinkCount == 0) {
+ ret = vld_remove_node(vol, n);
+ } else {
+ /* XXX is this necessary? */
+ ret = voldb_put_entry (db, real_mnode, &n->e);
+ if (ret)
+ return ret;
+
+ n->flags.ep = TRUE;
+ }
+
+ return ret;
}
static struct trans *transactions[MAX_TRANSACTIONS] = {NULL};
@@ -655,7 +674,7 @@ vld_verify_trans(int32_t trans)
if (transactions[i] && transactions[i]->tid == trans)
return 0;
}
- return VOLSERBAD_ACCESS;
+ return ENOENT;
}
int
@@ -962,6 +981,292 @@ vld_create_volume (struct dp_part *dp, int32_t volid,
return 0;
}
+static int
+delete_all_nodes (struct volume_handle *volh)
+{
+ uint32_t dsize, fsize;
+ int ret, i;
+
+ /* XXX check volintInfo */
+
+ ret = vld_db_uptodate (volh);
+ if (ret)
+ return ret;
+
+ ret = voldb_header_info(VLD_VOLH_FILE(volh), &fsize, NULL);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < fsize; i++) {
+ struct voldb_entry entry;
+ onode_opaque o;
+
+ ret = voldb_get_entry (VLD_VOLH_FILE(volh), i, &entry);
+ if (ret)
+ continue;
+
+ if (entry.u.file.FileType != 0 &&
+ entry.u.file.nextptr == VOLDB_ENTRY_USED) {
+ mlog_log (MDEBVLD, "removing file %d\n", i);
+ ret = voldb_del_entry(VLD_VOLH_FILE(volh), i, &o);
+ if (ret)
+ return ret;
+ VOLOP_IUNLINK(volh, &o);
+ }
+ }
+
+ ret = voldb_header_info(VLD_VOLH_DIR(volh), &dsize, NULL);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < dsize; i++) {
+ struct voldb_entry entry;
+ onode_opaque o;
+
+ ret = voldb_get_entry (VLD_VOLH_DIR(volh), i, &entry);
+ if (ret)
+ continue;
+
+ if (entry.u.file.FileType != 0 &&
+ entry.u.file.nextptr == VOLDB_ENTRY_USED) {
+ mlog_log (MDEBVLD, "removing dir %d\n", i);
+ ret = voldb_del_entry(VLD_VOLH_DIR(volh), i, &o);
+ if (ret)
+ return ret;
+ VOLOP_IUNLINK(volh, &o);
+ }
+ }
+
+ VOLOP_IUNLINK(volh, &volh->fino);
+ VOLOP_IUNLINK(volh, &volh->dino);
+ VOLOP_IUNLINK(volh, &volh->sino);
+ VOLOP_REMOVE (volh);
+
+ return 0;
+}
+
+int
+vld_foreach_dir (struct volume_handle *volh,
+ int (*func)(int fd,
+ uint32_t vnode,
+ uint32_t uniq,
+ uint32_t length,
+ uint32_t dataversion,
+ uint32_t author,
+ uint32_t owner,
+ uint32_t group,
+ uint32_t parent,
+ uint32_t client_date,
+ uint32_t server_date,
+ uint16_t nlinks,
+ uint16_t mode,
+ uint8_t type,
+ int32_t *acl,
+ void *arg),
+ void *arg)
+{
+ struct voldb_entry entry;
+ onode_opaque *o;
+ uint32_t size;
+ int ret, i;
+ int num;
+ int fd;
+ int32_t acl[48]; /* XXX */
+
+ ret = vld_db_uptodate (volh);
+ if (ret)
+ return ret;
+
+ ret = voldb_header_info(VLD_VOLH_DIR(volh), &size, NULL);
+ if (ret)
+ return ret;
+
+ for (num = 0; num < size; num++) {
+
+ ret = voldb_get_entry (VLD_VOLH_DIR(volh), num, &entry);
+ if (ret)
+ continue;
+
+ {
+ int32_t size;
+ int32_t version;
+ int32_t total;
+ int32_t positive;
+ int32_t negative;
+
+ memset(acl, 0, sizeof(acl));
+ for (i = 0; entry.u.dir.acl[i].owner; i++) {
+ acl[i*2+5] = htonl(entry.u.dir.acl[i].owner);
+ acl[i*2+6] = htonl(entry.u.dir.acl[i].flags);
+ }
+ positive = i;
+ for (i = 0; entry.u.dir.negacl[i].owner; i++) {
+ acl[(i+positive)*2+5] = htonl(entry.u.dir.negacl[i].owner);
+ acl[(i+positive)*2+6] = htonl(entry.u.dir.negacl[i].flags);
+ }
+ negative = i;
+ total = positive + negative;
+ version = 1;
+ size = sizeof(acl);
+ acl[0] = htonl(size);
+ acl[1] = htonl(version);
+ acl[2] = htonl(total);
+ acl[3] = htonl(positive);
+ acl[4] = htonl(negative);
+ }
+
+ o = &entry.u.dir.ino;
+
+ if (entry.u.dir.FileType != 0 &&
+ entry.u.dir.nextptr == VOLDB_ENTRY_USED) {
+ ret = VOLOP_IOPEN(volh, o, O_RDONLY, &fd);
+ if (ret)
+ return ret;
+
+ mlog_log(MDEBVOLDB, "vnode %i length %d",
+ dir_local2afs(num), entry.u.dir.Length);
+
+ ret = func(fd,
+ dir_local2afs(num),
+ entry.u.dir.unique,
+ entry.u.dir.Length,
+ entry.u.dir.DataVersion,
+ entry.u.dir.Author,
+ entry.u.dir.Owner,
+ entry.u.dir.Group,
+ entry.u.dir.ParentVnode,
+ entry.u.dir.ServerModTime, /* XXX */
+ entry.u.dir.ServerModTime,
+ entry.u.dir.LinkCount,
+ entry.u.dir.UnixModeBits,
+ entry.u.dir.FileType,
+ acl,
+ arg);
+ close(fd);
+ if (ret)
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+int
+vld_foreach_file (struct volume_handle *volh,
+ int (*func)(int fd,
+ uint32_t vnode,
+ uint32_t uniq,
+ uint32_t length,
+ uint32_t dataversion,
+ uint32_t author,
+ uint32_t owner,
+ uint32_t group,
+ uint32_t parent,
+ uint32_t client_date,
+ uint32_t server_date,
+ uint16_t nlinks,
+ uint16_t mode,
+ uint8_t type,
+ int32_t *acl,
+ void *arg),
+ void *arg)
+{
+ struct voldb_entry entry;
+ onode_opaque *o;
+ uint32_t size;
+ int ret;
+ int num;
+ int fd;
+
+ ret = vld_db_uptodate (volh);
+ if (ret)
+ return ret;
+
+ ret = voldb_header_info(VLD_VOLH_FILE(volh), &size, NULL);
+ if (ret)
+ return ret;
+
+ for (num = 0; num < size; num++) {
+
+ ret = voldb_get_entry (VLD_VOLH_FILE(volh), num, &entry);
+ if (ret)
+ continue;
+
+ o = &entry.u.dir.ino;
+
+ if (entry.u.dir.FileType != 0 &&
+ entry.u.dir.nextptr == VOLDB_ENTRY_USED) {
+ ret = VOLOP_IOPEN(volh, o, O_RDONLY, &fd);
+ if (ret)
+ return ret;
+
+ mlog_log(MDEBVOLDB, "vnode %i length %d",
+ file_local2afs(num), entry.u.file.Length);
+
+ ret = func(fd,
+ file_local2afs(num),
+ entry.u.file.unique,
+ entry.u.file.Length,
+ entry.u.file.DataVersion,
+ entry.u.file.Author,
+ entry.u.file.Owner,
+ entry.u.file.Group,
+ entry.u.file.ParentVnode,
+ entry.u.file.ServerModTime, /* XXX */
+ entry.u.file.ServerModTime,
+ entry.u.file.LinkCount,
+ entry.u.file.UnixModeBits,
+ entry.u.file.FileType,
+ NULL,
+ arg);
+ close(fd);
+ if (ret)
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+
+int
+vld_delete_volume (struct dp_part *dp, int32_t volid,
+ int32_t backstoretype,
+ int flags)
+{
+ int ret;
+ volume_handle *vol;
+ char path[MAXPATHLEN];
+
+ ret = vld_open_volume_by_num (dp, volid, &vol);
+ if (ret)
+ return ret;
+
+ ret = delete_all_nodes (vol);
+ if (ret) {
+ vld_free (vol);
+ return ret;
+ }
+
+ hashtabdel (volume_htab, vol);
+
+ ret = vol_getfullname (DP_NUMBER(dp), volid, path, sizeof(path));
+ if (ret) {
+ vld_free (vol);
+ return ret;
+ }
+
+ ret = unlink(path);
+ if (ret) {
+ vld_free (vol);
+ return ret;
+ }
+
+ vld_free (vol);
+
+ return 0;
+}
+
/*
* Register a new volume type
*/
@@ -1003,27 +1308,6 @@ vld_find_vol (const int32_t volid, struct volume_handle **vol)
}
/*
- * return a non zero value if the user is the superuser.
- */
-
-#define SUPER_USER 0
-
-static int
-super_user (struct msec *m)
-{
- int i;
- prlist *entries = m->sec->cps;
- int lim = min(PR_MAXLIST, entries->len);
- for (i = 0; i < lim; i++) {
- if (entries->val[i] == PR_SYSADMINID)
- return 1;
- }
-
- return 0;
-
-}
-
-/*
*
*/
@@ -1032,11 +1316,9 @@ vld_storestatus_to_dent (struct voldb_dir_entry *e,
const AFSStoreStatus *ss,
struct msec *m)
{
- if (ss->Mask & SS_OWNER) {
- if (ss->Owner == SUPER_USER && !super_user (m))
- return EPERM;
+ if (ss->Mask & SS_OWNER)
e->Owner = ss->Owner;
- }
+
if (ss->Mask & SS_MODTIME) {
e->ServerModTime = ss->ClientModTime; /* XXX should modify
ClientModTime */
@@ -1059,11 +1341,9 @@ vld_storestatus_to_fent (struct voldb_file_entry *e,
const AFSStoreStatus *ss,
struct msec *m)
{
- if (ss->Mask & SS_OWNER) {
- if (ss->Owner == SUPER_USER && !super_user (m))
- return EPERM;
+ if (ss->Mask & SS_OWNER)
e->Owner = ss->Owner;
- }
+
if (ss->Mask & SS_MODTIME) {
e->ServerModTime = ss->ClientModTime; /* XXX should modify
ClientModTime */
@@ -1127,10 +1407,10 @@ vld_dent_to_fetchstatus (struct volume_handle *vol,
fs->ClientModTime = e->ServerModTime;
fs->ServerModTime = e->ServerModTime;
fs->SyncCount = 0;
- fs->spare1 = vol->info.creationDate;
- fs->spare2 = 0;
- fs->spare3 = 0;
- fs->spare4 = 0;
+ fs->DataVersionHigh = vol->info.creationDate;
+ fs->LockCount = 0;
+ fs->LengthHigh = 0;
+ fs->ErrorCode = 0;
fs->Author = e->Author;
fs->Owner = e->Owner;
fs->Group = e->Group;
@@ -1176,10 +1456,10 @@ vld_fent_to_fetchstatus (struct volume_handle *vol,
fs->ClientModTime = e->ServerModTime;
fs->ServerModTime = e->ServerModTime;
fs->SyncCount = 0;
- fs->spare1 = vol->info.creationDate;
- fs->spare2 = 0;
- fs->spare3 = 0;
- fs->spare4 = 0;
+ fs->DataVersionHigh = vol->info.creationDate;
+ fs->LockCount = 0;
+ fs->LengthHigh = 0;
+ fs->ErrorCode = 0;
fs->Author = e->Author;
fs->Owner = e->Owner;
fs->Group = e->Group;
@@ -1297,7 +1577,7 @@ foo(void)
}
}
if (validop_p(*callers_rights, operation))
- return TRUE;
+ return TRUE;
return FALSE;
}
#endif
@@ -1344,15 +1624,8 @@ vld_check_rights (volume_handle *vol, struct mnode *n,
#if 0
if ((m->flags & VOLOP_NOCHECK) == VOLOP_NOCHECK)
return 0;
-#else
-/* m->caller_access = m->anonymous_access =
- PRSFS_READ | PRSFS_WRITE | PRSFS_INSERT |
- PRSFS_LOOKUP | PRSFS_DELETE |
- PRSFS_LOCK | PRSFS_ADMINISTER;
- return 0;*/
#endif
-
assert(m->sec);
if (m->sec->cps == NULL)
@@ -1387,14 +1660,24 @@ vld_check_rights (volume_handle *vol, struct mnode *n,
m->caller_access = m->anonymous_access = 0;
- for (i = 0; i < FS_MAX_ACL; i++)
+ for (i = 0; i < FS_MAX_ACL; i++) {
for (j = 0; j < m->sec->cps->len; j++)
if (parent_n->e.u.dir.acl[i].owner == m->sec->cps->val[j])
m->caller_access |= parent_n->e.u.dir.acl[i].flags;
- for (i = 0; i < FS_MAX_ACL; i++)
+ if (parent_n->e.u.dir.acl[i].owner == PR_ANYUSERID)
+ m->anonymous_access |= parent_n->e.u.dir.acl[i].flags;
+ }
+
+ for (i = 0; i < FS_MAX_ACL; i++) {
for (j = 0; j < m->sec->cps->len; j++)
if (parent_n->e.u.dir.negacl[i].owner == m->sec->cps->val[j])
m->caller_access &= ~parent_n->e.u.dir.negacl[i].flags;
+ if (parent_n->e.u.dir.negacl[i].owner == PR_ANYUSERID)
+ m->anonymous_access &= ~parent_n->e.u.dir.negacl[i].flags;
+ }
+
+ if (m->sec->superuser)
+ m->caller_access |= PRSFS_LOOKUP | PRSFS_ADMINISTER;
for (i = 0;
i < sizeof(check_flags)/sizeof(*check_flags)
@@ -1432,7 +1715,7 @@ vld_open_vnode (volume_handle *vol, struct mnode *n, struct msec *m)
* is everything cached ?
*/
- if ((m->flags & VOLOP_GETSTATUS) == 0
+ if ((m->flags & VOLOP_GETSTATUS) == 0 /* XXX why? */
&& n->flags.fsp == TRUE
&& n->flags.ep == TRUE)
return 0;
@@ -1501,23 +1784,44 @@ vld_modify_vnode (volume_handle *vol, struct mnode *n, struct msec *m,
}
if (len) {
- ret = ftruncate (n->fd, *len);
+ int diff;
+ uint32_t *Length;
+
+ assert (vol->flags.infop);
+
+ if (afs_dir_p (n->fid.Vnode))
+ Length = &n->e.u.dir.Length;
+ else
+ Length = &n->e.u.file.Length;
+
+ diff = *len / 1024 - *Length / 1024;
+
+ mlog_log (MDEBFS,
+ "vld_modify_vnode: olen=%d, nlen=%d, diff=%d", *Length, *len, diff);
+
+ ret = vld_update_volsize (vol, diff);
if (ret)
return ret;
- if (n->e.type == TYPE_DIR)
- n->e.u.dir.Length = *len;
- else
- n->e.u.file.Length = *len;
+ ret = ftruncate (n->fd, *len);
+ if (ret) {
+ vld_update_volsize (vol, -diff);
+ return ret;
+ }
+
+ *Length = *len;
n->sb.st_size = *len;
}
if (m->flags & (VOLOP_WRITE|VOLOP_INSERT|VOLOP_DELETE)) {
- if (n->e.type == TYPE_DIR)
+ if (n->e.type == TYPE_DIR) {
n->e.u.dir.DataVersion++;
- else
+ n->e.u.dir.ServerModTime = time(0);
+ } else {
n->e.u.file.DataVersion++;
+ n->e.u.file.ServerModTime = time(0);
+ }
}
ret = voldb_put_entry (db, real_mnode, &n->e);
@@ -1678,6 +1982,41 @@ vld_db_uptodate (volume_handle *vol)
return 0;
}
+static int
+vld_open_volume_by_handle (struct dp_part *dp, volume_handle *vol)
+{
+ int ret, fd;
+ char path[MAXPATHLEN];
+ vstatus vs;
+
+ vld_ref(vol);
+
+ ret = vol_getfullname (DP_NUMBER(dp), vol->vol, path, sizeof (path));
+ if (ret)
+ return ret;
+
+ fd = open (path, O_RDONLY, 0600);
+ if (fd < 0)
+ return errno;
+
+ ret = vstatus_read (fd, &vs);
+ if (ret) {
+ close (fd);
+ return ret;
+ }
+ close (fd);
+
+ ret = vstatus2volume_handle (&vs, dp, &vol);
+ if (ret)
+ return ret;
+
+ ret = VOLOP_OPEN(vol->type, vol->dp, vol->vol,
+ VOLOP_NOFLAGS, &vol->data);
+
+ return ret;
+}
+
+
/*
* Open volume on partition `dp' with volume id `volid'
* and return it ref:ed in `vol'.
@@ -1732,24 +2071,36 @@ vld_open_volume_by_num (struct dp_part *dp, int32_t volid,
}
int
-vld_remove_node (volume_handle *vol, int32_t node)
+vld_remove_node (volume_handle *vol, struct mnode *n)
{
int ret;
onode_opaque o;
+ int32_t node = n->fid.Vnode;
+ int diff;
+
+ assert (vol->flags.infop);
+
+ mnode_remove(&n->fid);
if (afs_dir_p (node)) {
- dir_afs2local(node);
ret = voldb_del_entry (VLD_VOLH_DIR(vol), dir_afs2local(node), &o);
if (ret)
return ret;
+ diff = n->e.u.dir.Length;
} else {
ret = voldb_del_entry (VLD_VOLH_FILE(vol), file_afs2local(node), &o);
if (ret)
return ret;
+ diff = n->e.u.file.Length;
}
+ mlog_log (MDEBFS,
+ "vld_remove_node: olen=%d, diff=%d", diff, -(ENTRY_DISK_SIZE + diff/1024));
+
+ vld_update_volsize (vol, -(ENTRY_DISK_SIZE + diff/1024));
+
return VOLOP_IUNLINK (vol, &o);
}
@@ -1840,6 +2191,127 @@ vld_info_write (volume_handle *vol)
}
/*
+ * check quota and update volume size
+ */
+
+int
+vld_update_volsize (volume_handle *vol, int diff) {
+ int ret = vld_info_uptodatep(vol);
+ if (ret)
+ return ret;
+
+ if (vol->info.maxquota < vol->info.size + diff)
+ return VOVERQUOTA;
+
+ vol->info.size += diff;
+
+ assert (vol->info.size >= 0);
+ ret = vld_info_write (vol);
+
+ return ret;
+}
+
+int
+vld_get_volstats (volume_handle *vol,
+ struct AFSFetchVolumeStatus *volstat,
+ char *volName,
+ char *offLineMsg,
+ char *motd)
+{
+ int ret;
+ long availblocks, totalblocks;
+
+ ret = vld_info_uptodatep(vol);
+ if (ret)
+ return ret;
+
+ ret = dp_getstats(vol->dp, &availblocks, &totalblocks);
+ if (ret)
+ return ret;
+
+ volstat->Vid = vol->vol;
+ volstat->ParentId = vol->info.parentID;
+ volstat->Online = !vol->flags.offlinep;
+ volstat->InService = vol->info.inUse;
+ volstat->Blessed = vol->info.inUse;
+ volstat->NeedsSalvage = vol->info.needsSalvaged;
+ volstat->Type = vol->type;
+ volstat->MinQuota = 0;
+ volstat->MaxQuota = vol->info.maxquota;
+ volstat->BlocksInUse = vol->info.size;
+ volstat->PartBlocksAvail = availblocks;
+ volstat->PartMaxBlocks = totalblocks;
+
+ strlcpy(volName, vol->info.name, VNAMESIZE);
+
+ *offLineMsg = '\0';
+ *motd = '\0';
+
+ return 0;
+}
+
+int
+vld_set_volstats (volume_handle *vol,
+ const struct AFSStoreVolumeStatus *volstat,
+ const char *volName,
+ const char *offLineMsg,
+ const char *motd)
+{
+ int ret;
+
+ ret = vld_info_uptodatep(vol);
+ if (ret)
+ return ret;
+
+ if ((volstat->Mask & AFS_SETMAXQUOTA)== AFS_SETMAXQUOTA)
+ vol->info.maxquota = volstat->MaxQuota;
+
+ /* XXX store minquota, volName, offLineMsg, motd */
+
+ return 0;
+}
+
+struct collect_volumes_args {
+ struct dp_part *dp;
+ List *vollist;
+};
+
+static Bool
+vld_collect_volumes (void *ptr, void *arg)
+{
+ volume_handle *vol = (volume_handle *) ptr;
+ struct collect_volumes_args *args = (struct collect_volumes_args *) arg;
+ List *vollist = args->vollist;
+ struct dp_part *dp = args->dp;
+
+ vld_open_volume_by_handle (dp, vol);
+
+ listaddtail(vollist, vol);
+
+ return 0;
+}
+
+int
+vld_list_volumes(struct dp_part *dp, List **retlist)
+{
+ struct collect_volumes_args args;
+ List *vollist;
+
+ vollist = listnew();
+
+ if (vollist == NULL)
+ return ENOMEM;
+
+ args.vollist = vollist;
+ args.dp = dp;
+
+ hashtabforeach(volume_htab, vld_collect_volumes, &args);
+ *retlist = vollist;
+
+ return 0;
+}
+
+/*
* Shutdown time
*/
@@ -1850,3 +2322,202 @@ vld_end (void)
return;
}
+
+int
+restore_file(struct rx_call *call,
+ uint32_t vnode,
+ uint32_t uniq,
+ uint32_t length,
+ uint32_t dataversion,
+ uint32_t author,
+ uint32_t owner,
+ uint32_t group,
+ uint32_t parent,
+ uint32_t client_date,
+ uint32_t server_date,
+ uint16_t nlinks,
+ uint16_t mode,
+ uint8_t type,
+ volume_handle *vol,
+ int32_t *acl)
+{
+ int ret;
+ struct voldb *db;
+ int (*convert_afs2local)(int32_t);
+ struct voldb_entry e;
+ AFSFid node;
+ onode_opaque ino;
+ node_type ntype;
+ struct mnode *n;
+ int i;
+ int exists;
+
+ switch (type) {
+ case TYPE_DIR:
+ db = VLD_VOLH_DIR(vol);
+ convert_afs2local = dir_afs2local;
+ ntype = NODE_DIR;
+ break;
+ case TYPE_FILE:
+ case TYPE_LINK:
+ db = VLD_VOLH_FILE(vol);
+ convert_afs2local = file_afs2local;
+ ntype = NODE_REG;
+ break;
+ default:
+ abort();
+ }
+
+ node.Volume = vol->vol;
+ node.Vnode = vnode;
+ node.Unique = uniq;
+
+#if 0
+ printf("create_file: %u %u %u %u %u %u %u %u %u %u %u %u %u\n",
+ vnode, uniq, length,
+ dataversion, author, owner, group, parent, client_date,
+ server_date, (uint32_t) nlinks, (uint32_t) mode,
+ (uint32_t) type);
+#endif
+
+ ret = voldb_expand(db, convert_afs2local(vnode));
+ if (ret)
+ return ret;
+
+ ret = voldb_get_entry(db, convert_afs2local(vnode), &e);
+ if (ret)
+ return ret;
+
+ if (type == TYPE_DIR)
+ exists = (e.u.dir.nextptr == VOLDB_ENTRY_USED);
+ else
+ exists = (e.u.file.nextptr == VOLDB_ENTRY_USED);
+
+ if (exists) {
+ onode_opaque o;
+
+ ret = voldb_del_entry(db, convert_afs2local(vnode), &o);
+ if (ret)
+ return ret;
+ VOLOP_IUNLINK(vol, &o);
+ }
+
+ e.type = type;
+
+ ret = mnode_find(&node, &n);
+ if (ret)
+ return ret;
+
+ ret = VOLOP_ICREATE(vol, &ino, ntype, n);
+ if (ret)
+ return ret;
+
+ if (type == TYPE_DIR) {
+ e.u.dir.nextptr = VOLDB_ENTRY_USED;
+ e.u.dir.ino = ino;
+ e.u.dir.FileType = type;
+ e.u.dir.LinkCount = nlinks;
+ e.u.dir.DataVersion = dataversion;
+ e.u.dir.Length = length;
+ e.u.dir.Author = author;
+ e.u.dir.Owner = owner;
+ e.u.dir.Group = group;
+ e.u.dir.ParentVnode = parent;
+ e.u.dir.ParentUnique = 0 /* XXX */;
+ e.u.dir.ServerModTime = server_date;
+ e.u.dir.UnixModeBits = 0x40000 | mode;
+ e.u.dir.InterfaceVersion = 1;
+ memset (e.u.dir.acl, 0,
+ sizeof (e.u.dir.acl));
+ memset (e.u.dir.negacl, 0,
+ sizeof (e.u.dir.negacl));
+ {
+#if 0
+ int32_t size = ntohl(acl[0]);
+ int32_t version = ntohl(acl[1]);
+ int32_t total = ntohl(acl[2]);
+#endif
+ int32_t positive = ntohl(acl[3]);
+ int32_t negative = ntohl(acl[4]);
+ if (positive <= FS_MAX_ACL && negative <= FS_MAX_ACL) {
+ for (i = 0; i < positive; i++) {
+ e.u.dir.acl[i].owner = ntohl(acl[i*2+5]);
+ e.u.dir.acl[i].flags = ntohl(acl[i*2+6]);
+ }
+ for (i = 0; i < negative; i++) {
+ e.u.dir.negacl[i].owner = ntohl(acl[(i+positive)*2+5]);
+ e.u.dir.negacl[i].flags = ntohl(acl[(i+positive)*2+6]);
+ }
+ }
+ }
+ ret = voldb_put_acl (db, convert_afs2local(vnode), &e.u.dir);
+ if (ret)
+ return ret;
+ } else {
+ e.u.file.nextptr = VOLDB_ENTRY_USED;
+ e.u.file.ino = ino;
+ e.u.file.FileType = type;
+ e.u.file.LinkCount = nlinks;
+ e.u.file.DataVersion = dataversion;
+ e.u.file.Length = length;
+ e.u.file.Author = author;
+ e.u.file.Owner = owner;
+ e.u.file.Group = group;
+ e.u.file.ParentVnode = parent;
+ e.u.file.ParentUnique = 0 /* XXX */;
+ e.u.file.ServerModTime = server_date;
+ e.u.file.UnixModeBits = mode;
+ e.u.dir.InterfaceVersion = 1;
+ }
+
+ ret = voldb_put_entry(db, convert_afs2local(vnode), &e);
+ if (ret)
+ return ret;
+
+ ret = vld_update_volsize (vol, ENTRY_DISK_SIZE + length/1024);
+ if (ret)
+ return ret;
+
+ ret = ftruncate(n->fd, length);
+ if (ret)
+ return errno;
+
+ ret = copyrx2fd (call, n->fd, 0, length);
+ if (ret)
+ return ret;
+
+ mnode_free (n, FALSE);
+
+ return 0;
+}
+
+int
+vld_rebuild (struct volume_handle *vol)
+{
+ int ret;
+
+ assert (vol->flags.voldbp);
+
+ ret = voldb_rebuild (VLD_VOLH_DIR(vol));
+
+ if (ret)
+ return ret;
+
+ ret = voldb_rebuild (VLD_VOLH_FILE(vol));
+
+ return ret;
+}
+
+static int vld_check_quota (volume_handle *vol, int diff)
+{
+ int ret;
+
+ ret = vld_info_uptodatep(vol);
+ if (ret)
+ return ret;
+
+ if (vol->info.maxquota < vol->info.size + diff)
+ return VOVERQUOTA;
+
+ return 0;
+}
diff --git a/usr.sbin/afs/src/milko/lib/vld/vld.h b/usr.sbin/afs/src/milko/lib/vld/vld.h
index 5f55fe90eb9..d68d8672a6b 100644
--- a/usr.sbin/afs/src/milko/lib/vld/vld.h
+++ b/usr.sbin/afs/src/milko/lib/vld/vld.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: vld.h,v 1.24 2000/10/03 00:19:57 lha Exp $ */
+/* $arla: vld.h,v 1.32 2002/02/07 17:59:52 lha Exp $ */
#ifndef MILKO_VLD_H
#define MILKO_VLD_H 1
@@ -66,7 +66,7 @@
typedef struct volume_handle {
int type; /* type of volume backstore */
int voldbtype; /* type of voldb structures */
- u_int32_t vol; /* volume number */
+ uint32_t vol; /* volume number */
int ref; /* refcount */
struct dp_part *dp; /* on what partition the volume resides */
void *data; /* data blob for volume type */
@@ -233,11 +233,19 @@ vld_create_entry (volume_handle *vol, struct mnode *parent, AFSFid *child,
struct msec *m);
int
-vld_remove_node (volume_handle *vol, int32_t node);
+vld_remove_node (volume_handle *vol, struct mnode *n);
int
vld_db_flush (volume_handle *vol);
+int
+vld_list_volumes(struct dp_part *dp, List **retlist);
+
+int
+vld_delete_volume (struct dp_part *dp, int32_t volid,
+ int32_t backstoretype,
+ int flags);
+
void
vld_end (void);
@@ -245,6 +253,81 @@ int
vld_fvol_create_volume_ondisk (struct dp_part *dp, int32_t volid,
const char *path);
+int
+vld_get_volstats (volume_handle *vol,
+ struct AFSFetchVolumeStatus *volstat,
+ char *volName,
+ char *offLineMsg,
+ char *motd);
+
+int
+vld_set_volstats (volume_handle *vol,
+ const struct AFSStoreVolumeStatus *volstat,
+ const char *volName,
+ const char *offLineMsg,
+ const char *motd);
+
+int
+restore_file(struct rx_call *call,
+ uint32_t vnode,
+ uint32_t uniq,
+ uint32_t length,
+ uint32_t dataversion,
+ uint32_t author,
+ uint32_t owner,
+ uint32_t group,
+ uint32_t parent,
+ uint32_t client_date,
+ uint32_t server_date,
+ uint16_t nlinks,
+ uint16_t mode,
+ uint8_t type,
+ volume_handle *vol,
+ int32_t *acl);
+
+int
+vld_rebuild (struct volume_handle *vol);
+
+int
+vld_foreach_dir (struct volume_handle *volh,
+ int (*func)(int fd,
+ uint32_t vnode,
+ uint32_t uniq,
+ uint32_t length,
+ uint32_t dataversion,
+ uint32_t author,
+ uint32_t owner,
+ uint32_t group,
+ uint32_t parent,
+ uint32_t client_date,
+ uint32_t server_date,
+ uint16_t nlinks,
+ uint16_t mode,
+ uint8_t type,
+ int32_t *acl,
+ void *arg),
+ void *arg);
+
+int
+vld_foreach_file (struct volume_handle *volh,
+ int (*func)(int fd,
+ uint32_t vnode,
+ uint32_t uniq,
+ uint32_t length,
+ uint32_t dataversion,
+ uint32_t author,
+ uint32_t owner,
+ uint32_t group,
+ uint32_t parent,
+ uint32_t client_date,
+ uint32_t server_date,
+ uint16_t nlinks,
+ uint16_t mode,
+ uint8_t type,
+ int32_t *acl,
+ void *arg),
+ void *arg);
+
/*
* This function is internal to vld and vol modules.
*
diff --git a/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c b/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c
index 8fc4fc416ff..d35d647c20a 100644
--- a/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c
+++ b/usr.sbin/afs/src/milko/lib/voldb/vdb_flat.c
@@ -39,26 +39,26 @@
#include "voldb_locl.h"
#include "voldb_internal.h"
-RCSID("$KTH: vdb_flat.c,v 1.14 2000/10/03 00:20:03 lha Exp $");
+RCSID("$arla: vdb_flat.c,v 1.19 2002/02/07 17:59:54 lha Exp $");
static int vdbflat_init (int fd, struct voldb *db, int createp);
static int vdbflat_close (struct voldb *db);
-static int vdbflat_get_dir (struct voldb *db, const u_int32_t num,
+static int vdbflat_get_dir (struct voldb *db, const uint32_t num,
struct voldb_dir_entry *e);
-static int vdbflat_put_dir (struct voldb *db, const u_int32_t num,
+static int vdbflat_put_dir (struct voldb *db, const uint32_t num,
struct voldb_dir_entry *e);
-static int vdbflat_put_acl (struct voldb *db, u_int32_t num,
+static int vdbflat_put_acl (struct voldb *db, uint32_t num,
struct voldb_dir_entry *e);
-static int vdbflat_get_file (struct voldb *db, const u_int32_t num,
+static int vdbflat_get_file (struct voldb *db, const uint32_t num,
struct voldb_file_entry *e);
-static int vdbflat_put_file (struct voldb *db, const u_int32_t num,
+static int vdbflat_put_file (struct voldb *db, const uint32_t num,
struct voldb_file_entry *e);
static int vdbflat_extend_db (struct voldb *db, unsigned int num);
static int vdbflat_flush (struct voldb *db);
-static int vdbflat_new_entry (struct voldb *db, u_int32_t *num,
- u_int32_t *unique);
-static int vdbflat_del_entry (struct voldb *db, const u_int32_t num,
+static int vdbflat_new_entry (struct voldb *db, uint32_t *num,
+ uint32_t *unique);
+static int vdbflat_del_entry (struct voldb *db, const uint32_t num,
onode_opaque *ino);
static int vdbflat_write_header (struct voldb *db, void *d, size_t sz);
@@ -109,7 +109,7 @@ static int
vdbflat_init (int fd, struct voldb *db, int createp)
{
vdbflat *vdb;
- u_int32_t i;
+ uint32_t i;
int size;
int ret;
unsigned char *data;
@@ -130,7 +130,7 @@ vdbflat_init (int fd, struct voldb *db, int createp)
/* If we are being created, there is no sane data on disk */
if (createp) {
- vdb->freeptr = 0;
+ vdb->freeptr = VOLDB_FREELIST_END;
} else {
/* Let the above layer parse the header */
voldb_parse_header (db, vdb->ptr, VOLDB_HEADER_HALF);
@@ -215,7 +215,7 @@ vdbflat_close (struct voldb *db)
static int
vdbflat_get_dir (struct voldb *db,
- const u_int32_t num,
+ const uint32_t num,
struct voldb_dir_entry *e)
{
vdbflat *vdb = (vdbflat *) db->ptr;
@@ -233,7 +233,7 @@ vdbflat_get_dir (struct voldb *db,
memcpy (e, &vdb->u.dir[num], sizeof (*e));
#else
{
- u_int32_t tmp;
+ uint32_t tmp;
int i;
unsigned char *ptr =
((unsigned char *)vdb->u.dir) +
@@ -324,7 +324,7 @@ vdbflat_get_dir (struct voldb *db,
int
vdbflat_put_dir (struct voldb *db,
- const u_int32_t num,
+ const uint32_t num,
struct voldb_dir_entry *e)
{
vdbflat *vdb = (vdbflat *) db->ptr;
@@ -341,7 +341,7 @@ vdbflat_put_dir (struct voldb *db,
memcpy (&vdb->u.dir[num], e, sizeof (*e));
#else
{
- u_int32_t tmp;
+ uint32_t tmp;
size_t len;
unsigned char *ptr =
((unsigned char *)vdb->u.dir) +
@@ -418,7 +418,7 @@ vdbflat_put_dir (struct voldb *db,
*/
static int
-vdbflat_put_acl (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e)
+vdbflat_put_acl (struct voldb *db, uint32_t num, struct voldb_dir_entry *e)
{
vdbflat *vdb = (vdbflat *) db->ptr;
@@ -435,7 +435,7 @@ vdbflat_put_acl (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e)
sizeof (*e->negacl) + sizeof (*e->acl));
#else
{
- u_int32_t tmp;
+ uint32_t tmp;
unsigned char *ptr =
((unsigned char *)vdb->u.dir) +
VOLDB_DIR_SIZE * num;
@@ -467,7 +467,7 @@ vdbflat_put_acl (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e)
*/
static int
-vdbflat_get_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
+vdbflat_get_file (struct voldb *db, uint32_t num, struct voldb_file_entry *e)
{
vdbflat *vdb = (vdbflat *) db->ptr;
@@ -483,7 +483,7 @@ vdbflat_get_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
memcpy (e, &vdb->u.file[num], sizeof (*e));
#else
{
- u_int32_t tmp;
+ uint32_t tmp;
size_t len;
unsigned char *ptr =
((unsigned char *)vdb->u.file) +
@@ -560,7 +560,7 @@ vdbflat_get_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
*/
int
-vdbflat_put_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
+vdbflat_put_file (struct voldb *db, uint32_t num, struct voldb_file_entry *e)
{
vdbflat *vdb = (vdbflat *) db->ptr;
@@ -576,7 +576,7 @@ vdbflat_put_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
memcpy (&vdb->u.file[num], e, sizeof (*e));
#else
{
- u_int32_t tmp;
+ uint32_t tmp;
size_t len;
unsigned char *ptr =
((unsigned char *)vdb->u.file) +
@@ -656,7 +656,7 @@ vdbflat_extend_db (struct voldb *db, unsigned int num)
{
int dirp = 0, ret;
size_t newsize;
- u_int32_t oldnum = db->hdr.num;
+ uint32_t oldnum = db->hdr.num;
vdbflat *vdb = db->ptr;
if (db->hdr.magic != VOLDB_MAGIC_HEADER)
@@ -689,7 +689,7 @@ vdbflat_extend_db (struct voldb *db, unsigned int num)
set_volhdr_union_ptr (db);
if (dirp) {
- u_int32_t i = oldnum;
+ uint32_t i = oldnum;
struct voldb_dir_entry e;
memset (&e, 0, sizeof (e));
@@ -708,7 +708,7 @@ vdbflat_extend_db (struct voldb *db, unsigned int num)
}
}
} else {
- u_int32_t i = oldnum;
+ uint32_t i = oldnum;
struct voldb_file_entry e;
memset (&e, 0, sizeof (e));
@@ -738,13 +738,13 @@ vdbflat_extend_db (struct voldb *db, unsigned int num)
}
int
-vdbflat_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique)
+vdbflat_new_entry (struct voldb *db, uint32_t *num, uint32_t *unique)
{
- u_int32_t oldfreeptr, newfreeptr, newunique;
+ uint32_t oldfreeptr, newfreeptr, newunique;
vdbflat *vdb = db->ptr;
int ret;
- if (vdb->freeptr == 0) {
+ if (vdb->freeptr == VOLDB_FREELIST_END) {
ret = vdbflat_extend_db (db, VOLDB_ENTEND_NUM);
if (ret)
return ret;
@@ -759,9 +759,10 @@ vdbflat_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique)
if (ret)
return ret;
+ assert(e.nextptr != VOLDB_ENTRY_USED);
newfreeptr = e.nextptr;
newunique = ++e.unique;
- e.nextptr = 0;
+ e.nextptr = VOLDB_ENTRY_USED;
e.FileType = TYPE_DIR;
ret = voldb_put_dir (db, oldfreeptr, &e);
@@ -775,9 +776,10 @@ vdbflat_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique)
if (ret)
return ret;
+ assert(e.nextptr != VOLDB_ENTRY_USED);
newfreeptr = e.nextptr;
newunique = ++e.unique;
- e.nextptr = 0;
+ e.nextptr = VOLDB_ENTRY_USED;
e.FileType = TYPE_FILE;
ret = voldb_put_file (db, oldfreeptr, &e);
@@ -806,7 +808,7 @@ vdbflat_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique)
static int
vdbflat_del_entry (struct voldb *db,
- const u_int32_t num,
+ const uint32_t num,
onode_opaque *ino)
{
vdbflat *vdb = db->ptr;
@@ -822,7 +824,7 @@ vdbflat_del_entry (struct voldb *db,
e.FileType = 0;
e.ParentVnode = e.ParentUnique = 0;
e.LinkCount = 0;
- assert (e.nextptr == 0);
+ assert (e.nextptr == VOLDB_ENTRY_USED);
e.nextptr = vdb->freeptr;
if (ino)
memcpy (ino, &e.ino, sizeof (e.ino));
@@ -842,7 +844,7 @@ vdbflat_del_entry (struct voldb *db,
e.FileType = 0;
e.ParentVnode = e.ParentUnique = 0;
e.LinkCount = 0;
- assert (e.nextptr == 0);
+ assert (e.nextptr == VOLDB_ENTRY_USED);
e.nextptr = vdb->freeptr;
if (ino)
memcpy (ino, &e.ino, sizeof (e.ino));
@@ -889,7 +891,7 @@ vdbflat_write_header (struct voldb *db,
vdbflat *vdb = (vdbflat *) db->ptr;
unsigned char *data = d;
size_t size = sz;
- u_int32_t i;
+ uint32_t i;
int ret;
assert (sz == VOLDB_HEADER_SIZE);
@@ -904,7 +906,7 @@ vdbflat_write_header (struct voldb *db,
assert (size >= sizeof (i));
if (vdb == NULL) {
- i = htonl (0);
+ i = htonl (VOLDB_FREELIST_END);
} else {
i = htonl(vdb->freeptr);
}
@@ -920,6 +922,73 @@ vdbflat_write_header (struct voldb *db,
return 0;
}
+static int
+vdbflat_expand (struct voldb *db,
+ uint32_t num)
+{
+ int entriesneeded;
+ int ret = 0;
+
+ entriesneeded = num - db->hdr.num + 1;
+ if (entriesneeded > 0)
+ ret = vdbflat_extend_db(db, entriesneeded + VOLDB_ENTEND_NUM);
+
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static int
+vdbflat_rebuild (struct voldb *db)
+{
+ uint32_t freeptr;
+ vdbflat *vdb = db->ptr;
+ int ret;
+ int i;
+
+ freeptr = VOLDB_FREELIST_END;
+
+ for (i = db->hdr.num - 1; i >= 0; i--) {
+ if ((db->hdr.flags & VOLDB_DIR) == VOLDB_DIR) {
+ struct voldb_dir_entry e;
+
+ ret = voldb_get_dir(db, i, &e);
+ if (ret)
+ return ret;
+
+ if (e.nextptr == VOLDB_ENTRY_USED) {
+ assert (e.FileType == TYPE_DIR);
+ } else {
+ e.nextptr = VOLDB_FREELIST_END;
+ freeptr = i;
+ ret = voldb_put_dir(db, i, &e);
+ if (ret)
+ return ret;
+ }
+ } else {
+ struct voldb_file_entry e;
+
+ ret = voldb_get_file(db, i, &e);
+ if (ret)
+ return ret;
+
+ if (e.nextptr == VOLDB_ENTRY_USED) {
+ assert (e.FileType == TYPE_FILE);
+ } else {
+ e.nextptr = VOLDB_FREELIST_END;
+ freeptr = i;
+ ret = voldb_put_file(db, i, &e);
+ if (ret)
+ return ret;
+ }
+ }
+ }
+
+ vdb->freeptr = freeptr;
+ return 0;
+}
+
/*
*
*/
@@ -935,5 +1004,7 @@ struct voldb_type vdb_flat = {
vdbflat_flush,
vdbflat_new_entry,
vdbflat_del_entry,
- vdbflat_write_header
+ vdbflat_write_header,
+ vdbflat_expand,
+ vdbflat_rebuild,
};
diff --git a/usr.sbin/afs/src/milko/lib/voldb/vol.c b/usr.sbin/afs/src/milko/lib/voldb/vol.c
index ba420b48bf5..acb51ad96fc 100644
--- a/usr.sbin/afs/src/milko/lib/voldb/vol.c
+++ b/usr.sbin/afs/src/milko/lib/voldb/vol.c
@@ -37,7 +37,7 @@
#include "voldb_locl.h"
-RCSID("$KTH: vol.c,v 1.6 2000/12/29 20:16:01 tol Exp $");
+RCSID("$arla: vol.c,v 1.7 2002/02/07 17:59:55 lha Exp $");
/*
* get the partial name of the volume
@@ -46,7 +46,7 @@ RCSID("$KTH: vol.c,v 1.6 2000/12/29 20:16:01 tol Exp $");
*/
int
-vol_getname (u_int32_t num, char *str, size_t sz)
+vol_getname (uint32_t num, char *str, size_t sz)
{
int i;
i = snprintf (str, sz, "vol%08u", num);
@@ -61,7 +61,7 @@ vol_getname (u_int32_t num, char *str, size_t sz)
*/
int
-vol_getfullname (u_int32_t part, u_int32_t num, char *str, size_t sz)
+vol_getfullname (uint32_t part, uint32_t num, char *str, size_t sz)
{
int ret;
char volname[VOLSER_MAXVOLNAME];
@@ -181,8 +181,8 @@ vol_write_header (int fd, volintInfo *info)
*/
int
-vol_create (int fd, u_int32_t num, const char *name,
- u_int32_t type, u_int32_t parent)
+vol_create (int fd, uint32_t num, const char *name,
+ uint32_t type, uint32_t parent)
{
int ret;
struct timeval tv;
diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb.c b/usr.sbin/afs/src/milko/lib/voldb/voldb.c
index c68050a77f9..6980e996ae9 100644
--- a/usr.sbin/afs/src/milko/lib/voldb/voldb.c
+++ b/usr.sbin/afs/src/milko/lib/voldb/voldb.c
@@ -39,7 +39,7 @@
#include "voldb_locl.h"
#include "voldb_internal.h"
-RCSID("$KTH: voldb.c,v 1.21 2000/10/03 00:20:13 lha Exp $");
+RCSID("$arla: voldb.c,v 1.24 2002/02/07 17:59:56 lha Exp $");
struct voldb_type *voltypes[] = {
&vdb_flat,
@@ -92,22 +92,22 @@ file_local2afs (int32_t vno)
int
voldb_parse_header (struct voldb *db, void *d, size_t sz)
{
- u_int32_t i;
+ uint32_t i;
unsigned char *data = d;
assert (sz >= VOLDB_HEADER_HALF);
memcpy (&i, data, sizeof (i));
db->hdr.magic = ntohl (i);
- data += sizeof (u_int32_t);
+ data += sizeof (uint32_t);
memcpy (&i, data, sizeof (i));
db->hdr.num = ntohl (i);
- data += sizeof (u_int32_t);
+ data += sizeof (uint32_t);
memcpy (&i, data, sizeof (i));
db->hdr.flags = ntohl (i);
- data += sizeof (u_int32_t);
+ data += sizeof (uint32_t);
return 0;
}
@@ -185,7 +185,7 @@ voldb_close (struct voldb *db)
*/
int
-voldb_put_acl (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e)
+voldb_put_acl (struct voldb *db, uint32_t num, struct voldb_dir_entry *e)
{
assert (db && e);
assert ((db->hdr.flags & VOLDB_DIR) == VOLDB_DIR);
@@ -258,6 +258,26 @@ voldb_get_entry (struct voldb *db, int32_t num, struct voldb_entry *e)
abort();
}
+/* Expand the table to num size */
+
+int
+voldb_expand (struct voldb *db, int32_t num)
+{
+ assert (db);
+
+ return VOLDB_FUNC(db, expand)(db, num);
+}
+
+/* Rebuild the table */
+
+int
+voldb_rebuild (struct voldb *db)
+{
+ assert (db);
+
+ return VOLDB_FUNC(db, rebuild)(db);
+}
+
/*
* Fill out the data we need to have stored and the
* let the lower layer store it.
@@ -267,22 +287,22 @@ int
voldb_write_hdr (int fd, struct voldb *db)
{
int ret;
- u_int32_t i;
+ uint32_t i;
unsigned char data[VOLDB_HEADER_SIZE], *ptr;
ptr = data;
i = htonl (db->hdr.magic);
memcpy (ptr, &i, sizeof (i));
- ptr += sizeof (u_int32_t);
+ ptr += sizeof (uint32_t);
i = htonl (db->hdr.num);
memcpy (ptr, &i, sizeof (i));
- ptr += sizeof (u_int32_t);
+ ptr += sizeof (uint32_t);
i = htonl (db->hdr.flags);
memcpy (ptr, &i, sizeof (i));
- ptr += sizeof (u_int32_t);
+ ptr += sizeof (uint32_t);
/* Here is space for yet other 2 int32_t */
@@ -349,7 +369,7 @@ voldb_flush (struct voldb *db)
int
-voldb_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique)
+voldb_new_entry (struct voldb *db, uint32_t *num, uint32_t *unique)
{
assert (db && unique);
@@ -365,7 +385,7 @@ voldb_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique)
*/
int
-voldb_del_entry (struct voldb *db, u_int32_t num, onode_opaque *ino)
+voldb_del_entry (struct voldb *db, uint32_t num, onode_opaque *ino)
{
assert (db);
@@ -379,8 +399,8 @@ voldb_del_entry (struct voldb *db, u_int32_t num, onode_opaque *ino)
int
voldb_header_info (struct voldb *db,
- u_int32_t *num,
- u_int32_t *flags)
+ uint32_t *num,
+ uint32_t *flags)
{
if (num)
*num = db->hdr.num;
@@ -394,7 +414,7 @@ voldb_header_info (struct voldb *db,
*
*/
-u_int32_t
+uint32_t
voldb_get_volume (struct voldb *db)
{
return db->volume;
diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb.h b/usr.sbin/afs/src/milko/lib/voldb/voldb.h
index 3ad35e8ed33..5719e557679 100644
--- a/usr.sbin/afs/src/milko/lib/voldb/voldb.h
+++ b/usr.sbin/afs/src/milko/lib/voldb/voldb.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: voldb.h,v 1.17 2000/10/03 00:20:19 lha Exp $ */
+/* $arla: voldb.h,v 1.21 2002/02/07 17:59:58 lha Exp $ */
#ifndef FILBUNKE_VOLDB_H
#define FILBUNKE_VOLDB_H 1
@@ -53,26 +53,26 @@
*/
struct voldb_file_entry {
- u_int32_t nextptr;
- u_int32_t unique;
+ uint32_t nextptr;
+ uint32_t unique;
onode_opaque ino;
- u_int32_t spare2; /* Must be zero */
- u_int32_t InterfaceVersion;
- u_int32_t FileType;
- u_int32_t LinkCount;
- u_int32_t Length;
- u_int32_t spare3; /* Must be zero */
- u_int32_t DataVersion;
- u_int32_t Author;
- u_int32_t Owner;
- u_int32_t UnixModeBits;
- u_int32_t ParentVnode;
- u_int32_t ParentUnique;
- u_int32_t SegSize;
- u_int32_t ServerModTime;
- u_int32_t spare4; /* Must be zero */
- u_int32_t Group;
- u_int32_t spare5; /* Must be zero */
+ uint32_t spare2; /* Must be zero */
+ uint32_t InterfaceVersion;
+ uint32_t FileType;
+ uint32_t LinkCount;
+ uint32_t Length;
+ uint32_t spare3; /* Must be zero */
+ uint32_t DataVersion;
+ uint32_t Author;
+ uint32_t Owner;
+ uint32_t UnixModeBits;
+ uint32_t ParentVnode;
+ uint32_t ParentUnique;
+ uint32_t SegSize;
+ uint32_t ServerModTime;
+ uint32_t spare4; /* Must be zero */
+ uint32_t Group;
+ uint32_t spare5; /* Must be zero */
};
/*
@@ -80,8 +80,8 @@ struct voldb_file_entry {
*/
struct acl_entry {
- u_int32_t owner;
- u_int32_t flags;
+ uint32_t owner;
+ uint32_t flags;
};
/*
@@ -89,26 +89,26 @@ struct acl_entry {
*/
struct voldb_dir_entry {
- u_int32_t nextptr;
- u_int32_t unique;
+ uint32_t nextptr;
+ uint32_t unique;
onode_opaque ino;
- u_int32_t spare2; /* Must be zero */
- u_int32_t InterfaceVersion;
- u_int32_t FileType;
- u_int32_t LinkCount;
- u_int32_t Length;
- u_int32_t spare3; /* Must be zero */
- u_int32_t DataVersion;
- u_int32_t Author;
- u_int32_t Owner;
- u_int32_t UnixModeBits;
- u_int32_t ParentVnode;
- u_int32_t ParentUnique;
- u_int32_t SegSize;
- u_int32_t ServerModTime;
- u_int32_t spare4; /* Must be zero */
- u_int32_t Group;
- u_int32_t spare5; /* Must be zero */
+ uint32_t spare2; /* Must be zero */
+ uint32_t InterfaceVersion;
+ uint32_t FileType;
+ uint32_t LinkCount;
+ uint32_t Length;
+ uint32_t spare3; /* Must be zero */
+ uint32_t DataVersion;
+ uint32_t Author;
+ uint32_t Owner;
+ uint32_t UnixModeBits;
+ uint32_t ParentVnode;
+ uint32_t ParentUnique;
+ uint32_t SegSize;
+ uint32_t ServerModTime;
+ uint32_t spare4; /* Must be zero */
+ uint32_t Group;
+ uint32_t spare5; /* Must be zero */
struct acl_entry negacl[FS_MAX_ACL];
struct acl_entry acl[FS_MAX_ACL];
};
@@ -128,6 +128,9 @@ struct voldb_entry {
#define VOLDB_DEFAULT_TYPE 0
+#define VOLDB_FREELIST_END 0xffffffff
+#define VOLDB_ENTRY_USED 0xfffffffe
+
/* forward declarations */
struct voldb;
@@ -150,7 +153,7 @@ int
voldb_get_entry (struct voldb *db, int32_t num, struct voldb_entry *e);
int
-voldb_put_acl (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e);
+voldb_put_acl (struct voldb *db, uint32_t num, struct voldb_dir_entry *e);
int
voldb_pretty_print_file (struct voldb_file_entry *e);
@@ -168,17 +171,17 @@ int
voldb_flush (struct voldb *db);
int
-voldb_new_entry (struct voldb *db, u_int32_t *num, u_int32_t *unique);
+voldb_new_entry (struct voldb *db, uint32_t *num, uint32_t *unique);
int
-voldb_del_entry (struct voldb *db, u_int32_t num, onode_opaque *ino);
+voldb_del_entry (struct voldb *db, uint32_t num, onode_opaque *ino);
int
voldb_header_info (struct voldb *db,
- u_int32_t *num,
- u_int32_t *flags);
+ uint32_t *num,
+ uint32_t *flags);
-u_int32_t
+uint32_t
voldb_get_volume (struct voldb *db);
int
@@ -190,10 +193,10 @@ voldb_update_time(struct voldb_entry *e, time_t t);
/* vol.c */
int
-vol_getname (u_int32_t num, char *str, size_t sz);
+vol_getname (uint32_t num, char *str, size_t sz);
int
-vol_getfullname (u_int32_t part, u_int32_t num, char *str, size_t sz);
+vol_getfullname (uint32_t part, uint32_t num, char *str, size_t sz);
int
vol_read_header (int fd, volintInfo *info);
@@ -202,12 +205,18 @@ int
vol_write_header (int fd, volintInfo *info);
int
-vol_create (int fd, u_int32_t num, const char *name,
- u_int32_t type, u_int32_t parent);
+vol_create (int fd, uint32_t num, const char *name,
+ uint32_t type, uint32_t parent);
void
vol_pretty_print_info (FILE *out, volintInfo *info);
+int
+voldb_expand (struct voldb *db, int32_t num);
+
+int
+voldb_rebuild (struct voldb *db);
+
enum voldb_newnum_sizes { VOLDB_ENTEND_NUM = 10 } ;
const char *
diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h b/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h
index 9b59459b5dd..85c3a5429bf 100644
--- a/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h
+++ b/usr.sbin/afs/src/milko/lib/voldb/voldb_internal.h
@@ -40,10 +40,10 @@
*/
struct voldb_header {
- u_int32_t magic; /* network order */
+ uint32_t magic; /* network order */
#define VOLDB_MAGIC_HEADER 0x47111147
- u_int32_t num; /* Number of entries in the db */
- u_int32_t flags; /* flags */
+ uint32_t num; /* Number of entries in the db */
+ uint32_t flags; /* flags */
};
struct voldb {
@@ -59,30 +59,33 @@ struct voldb_type {
int (*init) (int fd, struct voldb *db, int createp);
int (*close) (struct voldb *db);
int (*get_dir) (struct voldb *db,
- const u_int32_t num,
+ const uint32_t num,
struct voldb_dir_entry *e);
int (*put_dir) (struct voldb *db,
- const u_int32_t num,
+ const uint32_t num,
struct voldb_dir_entry *e);
int (*put_acl) (struct voldb *db,
- u_int32_t num,
+ uint32_t num,
struct voldb_dir_entry *e);
int (*get_file) (struct voldb *db,
- u_int32_t num,
+ uint32_t num,
struct voldb_file_entry *e);
int (*put_file) (struct voldb *db,
- u_int32_t num,
+ uint32_t num,
struct voldb_file_entry *e);
int (*flush) (struct voldb *db);
int (*new_entry) (struct voldb *db,
- u_int32_t *num,
- u_int32_t *unique);
+ uint32_t *num,
+ uint32_t *unique);
int (*del_entry) (struct voldb *db,
- const u_int32_t num,
+ const uint32_t num,
onode_opaque *ino);
int (*write_header) (struct voldb *db,
void *data,
size_t sz);
+ int (*expand) (struct voldb *db,
+ uint32_t num);
+ int (*rebuild) (struct voldb *db);
};
@@ -91,25 +94,25 @@ struct voldb_type {
extern struct voldb_type *voltypes[];
static inline int __attribute__ ((unused))
-voldb_get_dir (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e)
+voldb_get_dir (struct voldb *db, uint32_t num, struct voldb_dir_entry *e)
{
return VOLDB_FUNC(db,get_dir)(db, num, e);
}
static inline int __attribute__ ((unused))
-voldb_get_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
+voldb_get_file (struct voldb *db, uint32_t num, struct voldb_file_entry *e)
{
return VOLDB_FUNC(db,get_file)(db, num, e);
}
static inline int __attribute__ ((unused))
-voldb_put_dir (struct voldb *db, u_int32_t num, struct voldb_dir_entry *e)
+voldb_put_dir (struct voldb *db, uint32_t num, struct voldb_dir_entry *e)
{
return VOLDB_FUNC(db,put_dir)(db, num, e);
}
static inline int __attribute__ ((unused))
-voldb_put_file (struct voldb *db, u_int32_t num, struct voldb_file_entry *e)
+voldb_put_file (struct voldb *db, uint32_t num, struct voldb_file_entry *e)
{
return VOLDB_FUNC(db,put_file)(db, num, e);
}
diff --git a/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h b/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h
index 989642850ad..ae7839bade4 100644
--- a/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h
+++ b/usr.sbin/afs/src/milko/lib/voldb/voldb_locl.h
@@ -32,7 +32,7 @@
*/
/*
- * $KTH: voldb_locl.h,v 1.4 2000/12/29 20:16:01 tol Exp $
+ * $arla: voldb_locl.h,v 1.4 2000/12/29 20:16:01 tol Exp $
*/
#include <config.h>
diff --git a/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg b/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg
index 22a492c2fa0..7acdb30082c 100644
--- a/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg
+++ b/usr.sbin/afs/src/milko/lib/vstatus/vstat.xg
@@ -50,8 +50,8 @@ const VSTATUS_MAGIC = 0xCAFE4711;
const VSTATUS_VERSION = 4;
struct vstatus {
- u_int32_t version; /* version */
- u_int32_t magic; /* must be VSTATUS_MAGIC */
+ uint32_t version; /* version */
+ uint32_t magic; /* must be VSTATUS_MAGIC */
int32_t volid; /* The AFS-volume id */
int32_t type; /* Type of volume */
int32_t bstype; /* Type of backstore */
diff --git a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c
index d1a0ca5def0..6f04ca777d2 100644
--- a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c
+++ b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.c
@@ -39,7 +39,7 @@
#include <config.h>
-RCSID("$KTH: vstatus.c,v 1.5 2000/10/03 00:20:35 lha Exp $");
+RCSID("$arla: vstatus.c,v 1.6 2002/07/16 20:38:57 lha Exp $");
#include <sys/types.h>
#include <sys/uio.h>
diff --git a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h
index 8599cb8da4f..f3f5aa4142f 100644
--- a/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h
+++ b/usr.sbin/afs/src/milko/lib/vstatus/vstatus.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: vstatus.h,v 1.3 2000/10/03 00:20:40 lha Exp $ */
+/* $arla: vstatus.h,v 1.3 2000/10/03 00:20:40 lha Exp $ */
#ifndef __FILBUNKE_VSTATUS_H
#define __FILBUNKE_VSTATUS_H 1
diff --git a/usr.sbin/afs/src/milko/pts/pr.c b/usr.sbin/afs/src/milko/pts/pr.c
index 7a81c70ce34..29f3c2d1a9d 100644
--- a/usr.sbin/afs/src/milko/pts/pr.c
+++ b/usr.sbin/afs/src/milko/pts/pr.c
@@ -43,10 +43,15 @@
#include <rx/rx_null.h>
#include <ports.h>
+#include <ko.h>
#include <bool.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#include "rxkad_locl.h"
@@ -67,7 +72,10 @@
#include "msecurity.h"
-RCSID("$KTH: pr.c,v 1.21 2001/01/04 12:06:17 mattiasa Exp $");
+#include <mlog.h>
+#include <mdebug.h>
+
+RCSID("$arla: pr.c,v 1.24 2002/04/20 15:57:17 lha Exp $");
/*
*
@@ -78,18 +86,17 @@ PR_NameToID(struct rx_call *call, const namelist *nlist, idlist *ilist)
{
int i;
int status;
- char *localname;
- pt_debug (PRDB_RPC, "PR_NameToID: securityIndex: %d ilen: %d",
+ mlog_log (MDEBPR, "PR_NameToID: securityIndex: %d ilen: %d",
call->conn->securityIndex, nlist->len);
#ifdef KERBEROS
if (call->conn->securityIndex == 2) {
serv_con_data *cdat = call->conn->securityData;
- pt_debug (PRDB_RPC," user: %s.%s@%s",
- cdat->user->name,
- cdat->user->instance,
- cdat->user->realm);
+ mlog_log (MDEBPR, " user: %s.%s@%s",
+ cdat->user->name,
+ cdat->user->instance,
+ cdat->user->realm);
}
#endif
@@ -99,11 +106,9 @@ PR_NameToID(struct rx_call *call, const namelist *nlist, idlist *ilist)
return PRDBBAD;
for (i = 0; i < nlist->len; i++) {
- pt_debug (PRDB_RPC," name: %s", nlist->val[i]);
+ mlog_log (MDEBPR, " name: %s", nlist->val[i]);
- localname = localize_name(nlist->val[i]);
-
- status = conv_name_to_id(localname, &ilist->val[i]);
+ status = conv_name_to_id(nlist->val[i], &ilist->val[i]);
if (status == PRNOENT)
ilist->val[i] = PR_ANONYMOUSID;
else if (status)
@@ -122,7 +127,7 @@ PR_IDToName(struct rx_call *call, const idlist *ilist, namelist *nlist)
int i;
int status;
- pt_debug (PRDB_RPC, "PR_IDToName: securityIndex: %d ilen %d",
+ mlog_log (MDEBPR, "PR_IDToName: securityIndex: %d ilen %d",
call->conn->securityIndex, ilist->len);
@@ -141,7 +146,7 @@ PR_IDToName(struct rx_call *call, const idlist *ilist, namelist *nlist)
return PRDBBAD;
for (i = 0; i < ilist->len; i++) {
- pt_debug (PRDB_RPC," id: %d", ilist->val[i]);
+ mlog_log (MDEBPR, " id: %d", ilist->val[i]);
status = conv_id_to_name(ilist->val[i], nlist->val[i]);
if (status == PRNOENT)
snprintf (nlist->val[i], PR_MAXNAMELEN, "%d", ilist->val[i]);
@@ -160,31 +165,34 @@ PR_NewEntry(struct rx_call *call, const char *name,
const int32_t flag, const int32_t oid, int32_t *id)
{
int error;
+ int32_t owner;
char *localname;
+ Bool localp;
- pt_debug (PRDB_RPC, "PR_NewEntry: securityIndex: %d name: %s oid: %d",
+ mlog_log (MDEBPR, "PR_NewEntry: securityIndex: %d name: %s oid: %d",
call->conn->securityIndex, name, oid);
-/* XXX should be authuser? */
+ /* XXX should be authuser? */
if (!sec_is_superuser(call))
return PRPERM;
- localname = localize_name(name);
+ localname = localize_name(name, &localp);
+
+ /* XXX do it properly! */
+ if (localp == FALSE)
+ owner = PR_SYSADMINID;
+ else
+ owner = oid;
+
if ((flag & PRTYPE) == PRUSER) {
- error = conv_name_to_id(localname, id);
- if (error == PRNOENT) {
- *id = next_free_user_id();
- error = create_user(localname, *id, oid, PR_SYSADMINID); /* XXX */
- } else
- error = PREXIST;
+ error = next_free_user_id(id);
+ if (!error)
+ error = create_user(localname, *id, owner, PR_SYSADMINID); /* XXX */
} else if ((flag & PRTYPE) == PRGRP) {
- error = conv_name_to_id(localname, id);
- if (error == PRNOENT) {
- *id = next_free_group_id();
- error = create_group(localname, *id, oid, PR_SYSADMINID); /* XXX */
- } else
- error = PREXIST;
+ error = next_free_group_id(id);
+ if (!error)
+ error = create_group(localname, *id, owner, PR_SYSADMINID); /* XXX */
} else {
error = PRPERM;
}
@@ -201,31 +209,30 @@ PR_INewEntry(struct rx_call *call, const char *name,
const int32_t id, const int32_t oid)
{
int error;
- int tempid;
char *localname;
-
+ Bool localp;
+ int32_t owner = PR_SYSADMINID;
+ int32_t creator = PR_SYSADMINID;
+
+ /* XXX should be authuser? */
if (!sec_is_superuser(call))
return PRPERM;
- pt_debug (PRDB_RPC, "PR_INewEntry securityIndex: %d name: %s oid: %d",
+ mlog_log (MDEBPR, "PR_INewEntry securityIndex: %d name: %s oid: %d",
call->conn->securityIndex, name, oid);
- localname = localize_name(name);
- if (id > 0) {
- error = conv_name_to_id(localname, &tempid);
- if (error == PRNOENT) {
- error = create_user(localname, id, oid, PR_SYSADMINID); /* XXX */
- } else
- error = PREXIST;
- } else if (id < 0) {
- error = conv_name_to_id(localname, &tempid);
- if (error == PRNOENT) {
- error = create_group(localname, id, oid, PR_SYSADMINID); /* XXX */
- } else
- error = PREXIST;
- } else {
+ localname = localize_name(name, &localp);
+
+ /* XXX do it properly! */
+ if (localp == TRUE)
+ owner = oid;
+
+ if (id > 0)
+ error = create_user(localname, id, owner, creator); /* XXX */
+ else if (id < 0)
+ error = create_group(localname, id, owner, creator); /* XXX */
+ else
error = PRPERM;
- }
return error;
}
@@ -241,12 +248,12 @@ PR_ListEntry(struct rx_call *call, const int32_t id,
prentry pr_entry;
int status;
- pt_debug (PRDB_RPC, "PR_ListEntry securityIndex: %d id: %d",
+ mlog_log (MDEBPR, "PR_ListEntry securityIndex: %d id: %d",
call->conn->securityIndex, id);
#ifdef KERBEROS
if (call->conn->securityIndex == 2) {
serv_con_data *cdat = call->conn->securityData;
- pt_debug (PRDB_RPC, "PR_ListEntry user: %s.%s@%s",
+ mlog_log (MDEBPR, "PR_ListEntry user: %s.%s@%s",
cdat->user->name,
cdat->user->instance,
cdat->user->realm);
@@ -254,7 +261,7 @@ PR_ListEntry(struct rx_call *call, const int32_t id,
#endif
memset(&pr_entry, 0, sizeof(pr_entry));
- status = get_pr_entry_by_id(id, &pr_entry);
+ status = read_prentry(id, &pr_entry);
if (status)
return status;
entry->flags = pr_entry.flags;
@@ -278,7 +285,7 @@ int
PR_DumpEntry(struct rx_call *call, const int32_t pos,
struct prdebugentry *entry)
{
- pt_debug (PRDB_RPC, "PR_DumpEntry");
+ mlog_log (MDEBPR, "PR_DumpEntry");
return -1;
}
@@ -290,7 +297,7 @@ int
PR_ChangeEntry(struct rx_call *call, const int32_t id, const char *name,
const int32_t oid, const int32_t newid)
{
- pt_debug (PRDB_RPC, "PR_ChangeEntry");
+ mlog_log (MDEBPR, "PR_ChangeEntry");
return -1;
}
@@ -305,7 +312,7 @@ PR_SetFieldsEntry(struct rx_call *call, const int32_t id, const int32_t mask,
const int32_t nusers,
const int32_t spare1, const int32_t spare2)
{
- pt_debug (PRDB_RPC, "PR_SetFieldsEntry");
+ mlog_log (MDEBPR, "PR_SetFieldsEntry");
return -1;
}
@@ -317,7 +324,11 @@ PR_SetFieldsEntry(struct rx_call *call, const int32_t id, const int32_t mask,
int
PR_Delete(struct rx_call *call, const int32_t id)
{
- pt_debug (PRDB_RPC, "PR_Delete");
+ mlog_log (MDEBPR, "PR_Delete");
+
+ if (!sec_is_superuser(call))
+ return PRPERM;
+
return -1;
}
@@ -329,7 +340,7 @@ PR_Delete(struct rx_call *call, const int32_t id)
int
PR_WhereIsIt(struct rx_call *call, const int32_t id, int32_t *ps)
{
- pt_debug (PRDB_RPC, "PR_WhereIsIt");
+ mlog_log (MDEBPR, "PR_WhereIsIt");
return -1;
}
@@ -341,7 +352,7 @@ PR_WhereIsIt(struct rx_call *call, const int32_t id, int32_t *ps)
int
PR_AddToGroup(struct rx_call *call, const int32_t uid, const int32_t gid)
{
- pt_debug (PRDB_RPC, "PR_AddToGroup");
+ mlog_log (MDEBPR, "PR_AddToGroup");
if (!sec_is_superuser(call))
return PRPERM;
@@ -357,7 +368,7 @@ PR_AddToGroup(struct rx_call *call, const int32_t uid, const int32_t gid)
int
PR_RemoveFromGroup(struct rx_call *call, const int32_t id, const int32_t gid)
{
- pt_debug (PRDB_RPC, "PR_RemoveFromGroup");
+ mlog_log (MDEBPR, "PR_RemoveFromGroup");
if (!sec_is_superuser(call))
return PRPERM;
@@ -373,7 +384,7 @@ PR_RemoveFromGroup(struct rx_call *call, const int32_t id, const int32_t gid)
int
PR_ListMax(struct rx_call *call, int32_t *uid, int32_t *gid)
{
- pt_debug (PRDB_RPC, "PR_ListMax");
+ mlog_log (MDEBPR, "PR_ListMax");
*uid = pr_header.maxID;
*gid = pr_header.maxGroup;
return 0;
@@ -387,13 +398,14 @@ PR_ListMax(struct rx_call *call, int32_t *uid, int32_t *gid)
int
PR_SetMax(struct rx_call *call, const int32_t uid, const int32_t gflag)
{
- pt_debug (PRDB_RPC, "PR_SetMax");
+ mlog_log (MDEBPR, "PR_SetMax");
if(gflag) {
- pr_header.maxGroup = uid;
+ pr_header.maxGroup = uid;
} else {
- pr_header.maxID = uid;
+ pr_header.maxID = uid;
}
+
return 0;
}
@@ -406,7 +418,7 @@ int
PR_ListElements(struct rx_call *call, const int32_t id,
prlist *elist, int32_t *over)
{
- pt_debug (PRDB_RPC, "PR_ListElements");
+ mlog_log (MDEBPR, "PR_ListElements");
return listelements(id, elist, FALSE);
}
@@ -420,7 +432,7 @@ int
PR_GetCPS(struct rx_call *call, const int32_t id,
prlist *elist, int32_t *over)
{
- pt_debug (PRDB_RPC, "PR_GetCPS");
+ mlog_log (MDEBPR, "PR_GetCPS");
return listelements(id, elist, TRUE);
}
@@ -434,7 +446,7 @@ int
PR_ListOwned(struct rx_call *call, const int32_t id,
prlist *elist, int32_t *over)
{
- pt_debug (PRDB_RPC, "PR_ListOwned");
+ mlog_log (MDEBPR, "PR_ListOwned");
return -1;
}
@@ -454,21 +466,21 @@ PR_IsAMemberOf(struct rx_call *call, const int32_t uid, const int32_t gid,
int ret=0;
int i=0;
- pt_debug (PRDB_RPC, "PR_IsAMemberOf");
+ mlog_log (MDEBPR, "PR_IsAMemberOf");
if((ret = listelements(uid, &elist, TRUE)) !=0) {
- free(elist.val);
- return ret;
+ free(elist.val);
+ return ret;
}
for(i=0; i < elist.len ; i++) {
- if(elist.val[i] == gid) {
- *flag=1;
- free(elist.val);
- return 0;
- }
+ if(elist.val[i] == gid) {
+ *flag=1;
+ free(elist.val);
+ return 0;
+ }
}
-
+
free(elist.val);
return 0;
}
diff --git a/usr.sbin/afs/src/milko/pts/ptserver.c b/usr.sbin/afs/src/milko/pts/ptserver.c
index 6a532afe8d4..5132f1aa95b 100644
--- a/usr.sbin/afs/src/milko/pts/ptserver.c
+++ b/usr.sbin/afs/src/milko/pts/ptserver.c
@@ -45,7 +45,11 @@
#include <msecurity.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#endif
@@ -61,110 +65,81 @@
#include <service.h>
+#include <mlog.h>
+#include <mdebug.h>
+#include <mdb.h>
+
#include "pts.h"
#include "pts.ss.h"
#include "ptserver.h"
#include "pts.ss.h"
-RCSID("$KTH: ptserver.c,v 1.36 2000/12/29 19:55:21 tol Exp $");
+RCSID("$arla: ptserver.c,v 1.46 2003/04/09 02:41:28 lha Exp $");
static struct rx_service *prservice;
-static int pr_database = -1;
-static off_t file_length;
-prheader pr_header;
+prheader_disk pr_header;
-static Log_unit *pr_log_unit;
-static Log_method *pr_method;
+#define HEADERID PR_BADID
+#define ILLEGAL_ID 0x40000000
+#define ILLEGAL_GROUP 0x40000000
-char pr_header_ydr[PRHEADER_SIZE];
+#define PRENTRY_DISK_SIZE (sizeof(prentry_disk) + PR_MAXGROUPS * sizeof(int32_t) + 16)
+#define PRHEADER_DISK_SIZE (sizeof(prheader_disk) + 4 * PR_MAXGROUPS * sizeof(int32_t) + 16)
-#define all (PRDB_ERROR|PRDB_WARN|PRDB_RPC|PRDB_DB)
+static void open_db (char *databaseprefix, int flags);
+void prserver_close(void);
-struct units pr_deb_units[] = {
- { "all", all },
- { "errors", PRDB_ERROR },
-#undef all
- { "warnings", PRDB_WARN },
- { "rpc", PRDB_RPC },
- { "db", PRDB_DB },
- { NULL}
-};
+MDB *nametoid, *idtodata;
-void
-pt_setdebug (char *debug_level)
-{
- log_set_mask_str (pr_method, pr_log_unit, debug_level);
-}
/*
*
*/
void
-pt_debug (unsigned int level, char *fmt, ...)
+write_header(void)
{
- va_list args;
+ int length = PRHEADER_DISK_SIZE;
+ struct mdb_datum key, value;
+ char pr_header_ydr[PRHEADER_DISK_SIZE];
+ int code;
- va_start (args, fmt);
- log_vlog (pr_log_unit, level, fmt, args);
- va_end(args);
-}
+ char headerid = htonl(HEADERID);
-/*
- *
- */
+ if (ydr_encode_prheader_disk(&pr_header, pr_header_ydr, &length) == NULL)
+ err(1, "write_header");
-static void
-write_header(void)
-{
- off_t pos;
- int length = PRHEADER_SIZE;
-
- if (ydr_encode_prheader(&pr_header, pr_header_ydr, &length) == NULL)
- err(1, "write_header");
+ key.data = &headerid;
+ key.length = sizeof(headerid);
- pos = lseek(pr_database, 0, SEEK_SET);
- assert(pos == 0);
+ value.data = pr_header_ydr;
+ value.length = PRHEADER_DISK_SIZE - length;
- length = write(pr_database, pr_header_ydr, PRHEADER_SIZE);
- assert (length == PRHEADER_SIZE);
+ code = mdb_store(idtodata, &key, &value);
+ assert(code == 0);
}
/*
*
*/
-static void
+void
read_header(void)
{
- char pr_header_ydr[PRHEADER_SIZE];
- int length = PRHEADER_SIZE;
+ int length = PRHEADER_DISK_SIZE;
+ struct mdb_datum key, value;
+ char headerid = htonl(HEADERID);
+ int code;
- if (lseek(pr_database, 0, SEEK_SET) == -1)
- err(1, "lseek");
+ key.data = &headerid;
+ key.length = sizeof(headerid);
- length = read(pr_database, pr_header_ydr, PRHEADER_SIZE);
- if (length == -1)
- err(1, "read");
- if (length != PRHEADER_SIZE)
- errx(1, "read_header read failed");
+ code = mdb_fetch(idtodata, &key, &value);
+ assert(code == 0);
- if (ydr_decode_prheader(&pr_header, pr_header_ydr, &length) == NULL)
- err(1, "read_header");
-}
-
-/*
- *
- */
-
-static void
-get_file_length(void)
-{
- file_length = lseek(pr_database, 0, SEEK_END);
- if (file_length == -1) {
- err(1, "lseek");
- }
+ if (ydr_decode_prheader_disk(&pr_header, value.data, &length) == NULL)
+ err(1, "read_header");
}
/*
@@ -172,18 +147,22 @@ get_file_length(void)
*/
char *
-localize_name(const char *name)
+localize_name(const char *name, Bool *localp)
{
static prname localname;
char *tmp;
+ *localp = FALSE;
+
strlcpy(localname, name, sizeof(localname));
strlwr(localname);
tmp = strchr(localname, '@');
if (tmp)
- if (!strcasecmp(tmp + 1, netinit_getrealm()))
+ if (!strcasecmp(tmp + 1, netinit_getrealm())) {
*tmp = '\0';
+ *localp = TRUE;
+ }
return localname;
}
@@ -196,163 +175,108 @@ static void
create_database(void)
{
pr_header.version = 0;
- pr_header.headerSize = PRHEADER_SIZE;
- pr_header.freePtr = 0;
- pr_header.eofPtr = PRHEADER_SIZE;
+ pr_header.headerSize = PRHEADER_DISK_SIZE;
pr_header.maxGroup = -210; /* XXX */
pr_header.maxID = 0;
- pr_header.maxForeign = 65536; /* XXX */
- pr_header.maxInst = 0;
- pr_header.orphan = 0;
+/*XXX pr_header.orphan = 0;*/
pr_header.usercount = 0;
pr_header.groupcount = 0;
- pr_header.foreigncount = 0;
- pr_header.instcount = 0;
- memset(pr_header.reserved, 0, 5 * sizeof(int32_t));
- memset(pr_header.nameHash, 0, 8191 * sizeof(int32_t));
- memset(pr_header.idHash, 0, 8191 * sizeof(int32_t));
write_header();
- get_file_length();
}
/*
- *
+ * read_prentry(): Fetch data from db, return a classic pr_entry
*/
-static int
-read_entry(off_t offset, prentry *pr_entry)
+int
+read_prentry(int id, prentry *pr_entry)
{
- off_t pos;
- char pr_entry_disk_ydr[PRENTRY_DISK_SIZE];
- int length = PRENTRY_DISK_SIZE;
+ prentry_disk disk_entry;
+ int status, i;
- pos = lseek(pr_database, offset, SEEK_SET);
- assert(pos == offset);
+ status = get_disk_entry(id, &disk_entry);
+ if (status)
+ return status;
- length = read(pr_database, pr_entry_disk_ydr, PRENTRY_DISK_SIZE);
- assert (length == PRENTRY_DISK_SIZE);
+ memset(pr_entry, 0, sizeof(prentry));
- if (ydr_decode_prentry_disk((prentry_disk *) pr_entry, pr_entry_disk_ydr, &length) == NULL)
- err(1, "write_entry");
+ pr_entry->flags = disk_entry.flags;
+ pr_entry->id = disk_entry.id;
+ pr_entry->cellid = disk_entry.cellid;
+ pr_entry->owner = disk_entry.owner;
+ pr_entry->creator = disk_entry.creator;
+ pr_entry->ngroups = disk_entry.ngroups;
+ strlcpy(pr_entry->name, disk_entry.name, sizeof(pr_entry->name));
- return 0;
-}
+ if (disk_entry.owned.len > 0)
+ pr_entry->owned = disk_entry.owned.val[0];
+
+ for (i = 0; i < PRSIZE && i < disk_entry.entries.len; i++)
+ pr_entry->entries[i] = disk_entry.entries.val[i];
-/*
- *
- */
+ mlog_log (MDEBPRDB, "read_prentry id: %d owner: %d creator: %d name: %s",
+ pr_entry->id, pr_entry->owner,
+ pr_entry->creator, pr_entry->name);
-static off_t
-find_first_free(void)
-{
- prentry pr_entry;
- off_t pos;
-
- if (pr_header.freePtr == 0) { /* if there are no free entries */
- pos = lseek(pr_database, 0, SEEK_END);
- if (pos == -1)
- err(1, "lseek");
- if (ftruncate(pr_database, pos + PRENTRY_DISK_SIZE) == -1)
- err(1, "ftruncate");
- return pos;
- } else { /* there are free entries */
- /* XXX if the caller discards this entry it will become orphaned */
- pos = pr_header.freePtr;
- read_entry(pos, &pr_entry);
- pr_header.freePtr = pr_entry.next;
- write_header();
- return pos;
- }
return 0;
}
-/*
- *
+/*
+ * store_disk_entry(): marshal prentry_disk and store in db
*/
-static int
-write_entry(off_t offset, prentry *pr_entry)
+int
+store_disk_entry(prentry_disk *entry)
{
- off_t pos;
char pr_entry_disk_ydr[PRENTRY_DISK_SIZE];
int length = PRENTRY_DISK_SIZE;
+ struct mdb_datum key, value;
+ int id;
- if (ydr_encode_prentry_disk((prentry_disk *) pr_entry, pr_entry_disk_ydr, &length) == NULL)
- err(1, "write_entry");
-
- pos = lseek(pr_database, offset, SEEK_SET);
- assert(pos == offset);
+ mlog_log (MDEBPRDB, "store_disk_entry id: %d owner: %d creator: %d name: %s",
+ entry->id, entry->owner,
+ entry->creator, entry->name);
- length = write(pr_database, pr_entry_disk_ydr, PRENTRY_DISK_SIZE);
- assert (length == PRENTRY_DISK_SIZE);
+ if (ydr_encode_prentry_disk((prentry_disk *) entry, pr_entry_disk_ydr, &length) == NULL)
+ err(1, "store_disk_entry");
- return 0;
-}
+ id = htonl(entry->id);
+ key.data = &id;
+ key.length = sizeof(id);
-/*
- *
- */
+ value.data = pr_entry_disk_ydr;
+ value.length = PRENTRY_DISK_SIZE - length;
-static unsigned long
-get_id_hash(long id)
-{
- return ((unsigned long) id) % HASHSIZE;
+ return mdb_store(idtodata, &key, &value);
}
/*
- *
+ * write_prentry(): update db with classic prentry
*/
-static unsigned long
-get_name_hash(const char *name)
+int
+write_prentry(prentry *pr_entry)
{
+ prentry_disk disk_entry;
int i;
- unsigned long hash = 0x47114711;
-
- for (i = 0; name[i] && i < 32; i++)
- hash *= name[i];
-
- return hash % HASHSIZE;
-}
-
-/*
- *
- */
-
-static int
-get_first_id_entry(unsigned long hash_id, prentry *pr_entry)
-{
- off_t offset = pr_header.idHash[hash_id];
- int status;
-
- pt_debug (PRDB_DB, "get_first_id_entry hash_id: %lu offset: %ld",
- hash_id, (long)offset);
- if (offset == 0)
- return PRNOENT;
-
- status = read_entry(offset, pr_entry);
-
- return status;
-}
-/*
- *
- */
-
-static int
-get_first_name_entry(unsigned long hash_name, prentry *pr_entry)
-{
- off_t offset = pr_header.nameHash[hash_name];
- int status;
-
- pt_debug (PRDB_DB, "get_first_name_entry hash_name: %lu offset: %ld",
- hash_name, (long)offset);
- if (offset == 0)
- return PRNOENT;
-
- status = read_entry(offset, pr_entry);
+ memset(&disk_entry, 0, sizeof(prentry_disk));
+
+ disk_entry.flags = pr_entry->flags;
+ disk_entry.id = pr_entry->id;
+ disk_entry.cellid = pr_entry->cellid;
+ disk_entry.owner = pr_entry->owner;
+ disk_entry.creator = pr_entry->creator;
+ disk_entry.ngroups = pr_entry->ngroups;
+/* disk_entry.owned = pr_entry->owned; XXX */
+ strlcpy(disk_entry.name, pr_entry->name, sizeof(disk_entry.name));
+
+ for (i = 0; i < PRSIZE && i < pr_entry->count; i++)
+ disk_entry.entries.val[i] = pr_entry->entries[i];
+
+ disk_entry.entries.len = i;
- return status;
+ return store_disk_entry(&disk_entry);
}
/*
@@ -360,31 +284,18 @@ get_first_name_entry(unsigned long hash_name, prentry *pr_entry)
*/
static int
-update_entry(prentry *pr_entry)
+write_name(prentry *pr_entry)
{
- off_t offset;
- int status;
- unsigned long hash_id;
- prentry old_pr_entry;
-
- pt_debug (PRDB_DB, "update_entry");
-
- hash_id = get_id_hash(pr_entry->id);
+ struct mdb_datum key, value;
+ int32_t id = htonl(pr_entry->id);
- offset = pr_header.idHash[hash_id];
-
- status = get_first_id_entry(hash_id, &old_pr_entry);
- if (status)
- return PRNOENT;
+ key.data = pr_entry->name;
+ key.length = strlen(pr_entry->name);
- while (old_pr_entry.id != pr_entry->id) {
- if (old_pr_entry.nextID == 0)
- return PRNOENT;
- offset=old_pr_entry.nextID;
- status = read_entry(offset, &old_pr_entry);
- }
+ value.data = &id;
+ value.length = sizeof(id);
- return write_entry(offset, pr_entry);
+ return mdb_store(nametoid, &key, &value);
}
/*
@@ -394,37 +305,33 @@ update_entry(prentry *pr_entry)
static int
insert_entry(prentry *pr_entry)
{
- off_t offset;
+ char *pr_entry_disk_ydr;
int status;
- unsigned long hash_id, hash_name;
- prentry first_id_entry;
- prentry first_name_entry;
-
- /* Allokera plats i filen */
- offset = find_first_free();
-
- /* Hitta plats i hashtabell */
- hash_id = get_id_hash(pr_entry->id);
- hash_name = get_name_hash(pr_entry->name);
+ int id;
- status = get_first_id_entry(hash_id, &first_id_entry);
- pr_entry->nextID = status ? 0 : first_id_entry.nextID;
+ char *name = pr_entry->name;
- status = get_first_name_entry(hash_name, &first_name_entry);
- pr_entry->nextName = status ? 0 : first_name_entry.nextName;
+ status = get_ydr_disk_entry(pr_entry->id, &pr_entry_disk_ydr);
+ if (status == 0)
+ return PREXIST;
+ if (status != PRNOENT)
+ return status;
- /* XXX: uppdatera owned och nextOwned */
+ status = conv_name_to_id(name, &id);
+ if (status == 0)
+ return PREXIST;
+ if (status != PRNOENT)
+ return status;
- /* Lägg in entryt i filen */
- status = write_entry(offset, pr_entry);
+ status = write_name(pr_entry);
if (status)
return status;
-
- /* Uppdatera hashtabell */
- pr_header.idHash[hash_id] = offset;
- pr_header.nameHash[hash_name] = offset;
- write_header();
- return 0;
+
+ return write_prentry(pr_entry);
+
+ /* XXX: update owned and nextOwned */
+ /* XXX update header */
+ /* write_header(); */
}
/*
@@ -488,66 +395,57 @@ create_user(const char *name,
int
addtogroup (int32_t uid, int32_t gid)
{
- prentry uid_entry;
- prentry gid_entry;
- int error, i;
+ prentry_disk uid_entry;
+ prentry_disk gid_entry;
+ int error, i, tmp1, tmp2;
- pt_debug (PRDB_DB, "addtogroup");
+ mlog_log (MDEBPRDB, "addtogroup");
- error = get_pr_entry_by_id(uid, &uid_entry);
+ error = get_disk_entry(uid, &uid_entry);
if (error)
return error;
- error = get_pr_entry_by_id(gid, &gid_entry);
+ error = get_disk_entry(gid, &gid_entry);
if (error)
return error;
- /* XXX should allocate contentry block */
-
- if (uid_entry.count >= PRSIZE || gid_entry.count >= PRSIZE)
+ if (uid_entry.entries.len >= (PR_MAXGROUPS - 1)
+ || gid_entry.entries.len >= (PR_MAXLIST - 1))
return PRNOENT;
- assert (uid_entry.entries[uid_entry.count] == 0);
-
- for (i = 0; i < uid_entry.count; i++)
- if (uid_entry.entries[i] == gid)
- break;
+ i = 0;
+ while (uid_entry.entries.val[i] < gid && i < uid_entry.entries.len)
+ i++;
- if (i == uid_entry.count) {
- if (uid_entry.count < PRSIZE - 1) {
- uid_entry.entries[uid_entry.count] = gid;
- uid_entry.count++;
- } else
- return PRNOENT;
+ tmp1 = gid;
+ for (; i < uid_entry.entries.len; i++) {
+ tmp2 = uid_entry.entries.val[i];
+ uid_entry.entries.val[i] = tmp1;
+ tmp1 = tmp2;
}
-
- assert (gid_entry.entries[gid_entry.count] == 0);
-
- for (i = 0; i < gid_entry.count; i++)
- if (gid_entry.entries[i] == uid)
- break;
-
- if (i == gid_entry.count) {
- if (gid_entry.count < PRSIZE - 1) {
- gid_entry.entries[gid_entry.count] = uid;
- gid_entry.count++;
- } else {
- if (uid_entry.entries[uid_entry.count - 1] == gid) {
- uid_entry.entries[uid_entry.count - 1] = 0;
- uid_entry.count--;
- }
- return PRNOENT;
- }
+ uid_entry.entries.val[uid_entry.entries.len] = tmp1;
+ uid_entry.entries.len++;
+
+ i = 0;
+ while (gid_entry.entries.val[i] < uid && i < gid_entry.entries.len)
+ i++;
+
+ tmp1 = uid;
+ for (; i < gid_entry.entries.len; i++) {
+ tmp2 = gid_entry.entries.val[i];
+ gid_entry.entries.val[i] = tmp1;
+ tmp1 = tmp2;
}
+ gid_entry.entries.val[gid_entry.entries.len] = tmp1;
+ gid_entry.entries.len++;
- if ((error = update_entry(&uid_entry)) != 0)
+ if ((error = store_disk_entry(&uid_entry)) != 0)
return error;
- if ((error = update_entry(&gid_entry)) != 0)
+ if ((error = store_disk_entry(&gid_entry)) != 0)
return error;
return 0;
-
}
/*
@@ -557,54 +455,51 @@ addtogroup (int32_t uid, int32_t gid)
int
removefromgroup (int32_t uid, int32_t gid)
{
- prentry uid_entry;
- prentry gid_entry;
+ prentry_disk uid_entry;
+ prentry_disk gid_entry;
int error, i;
- pt_debug (PRDB_DB, "removefromgroup");
+ mlog_log (MDEBPRDB, "removefromgroup");
- error = get_pr_entry_by_id(uid, &uid_entry);
+ error = get_disk_entry(uid, &uid_entry);
if (error)
return error;
- error = get_pr_entry_by_id(gid, &gid_entry);
+ error = get_disk_entry(gid, &gid_entry);
if (error)
return error;
- /* XXX No check for full list */
- /* XXX should the list be sorted? */
+ i = 0;
+ while (uid_entry.entries.val[i] < gid && i < uid_entry.entries.len)
+ i++;
- error = PRNOENT; /* XXX */
- for (i = 0; i < PRSIZE; i++)
- if (uid_entry.entries[i] == gid) {
- uid_entry.count--;
- uid_entry.entries[i] = uid_entry.entries[uid_entry.count];
- uid_entry.entries[uid_entry.count] = 0;
- error = 0;
- }
- if (error)
- return error;
+ if (uid_entry.entries.val[i] != gid)
+ return PRNOENT;
+ for (i++; i < uid_entry.entries.len; i++)
+ uid_entry.entries.val[i - 1] = uid_entry.entries.val[i];
- error = PRNOENT; /* XXX */
- for (i = 0; i < PRSIZE; i++)
- if (gid_entry.entries[i] == uid) {
- gid_entry.count--;
- gid_entry.entries[i] = gid_entry.entries[gid_entry.count];
- gid_entry.entries[gid_entry.count] = 0;
- error = 0;
- }
- if (error)
- return error;
+ uid_entry.entries.len--;
+
+ i = 0;
+ while (gid_entry.entries.val[i] < uid && i < gid_entry.entries.len)
+ i++;
+
+ if (gid_entry.entries.val[i] != uid)
+ return PRNOENT;
+
+ for (i++; i < gid_entry.entries.len; i++)
+ gid_entry.entries.val[i - 1] = gid_entry.entries.val[i];
+ gid_entry.entries.len--;
/* XXX may leave database inconsistent ?? */
- if ((error = update_entry(&uid_entry)) != 0)
+ if ((error = store_disk_entry(&uid_entry)) != 0)
return error;
- if ((error = update_entry(&gid_entry)) != 0)
+ if ((error = store_disk_entry(&gid_entry)) != 0)
return error;
return 0;
@@ -618,35 +513,32 @@ removefromgroup (int32_t uid, int32_t gid)
int
listelements (int32_t id, prlist *elist, Bool default_id_p)
{
- prentry pr_entry;
+ prentry_disk disk_entry;
int i = 0, error;
- error = get_pr_entry_by_id (id, &pr_entry);
+ error = get_disk_entry(id, &disk_entry);
if (error)
return error;
- if(default_id_p)
- elist->len = pr_entry.count + 3;
+ if (default_id_p)
+ elist->len = disk_entry.entries.len + 3;
else
- elist->len = pr_entry.count;
+ elist->len = disk_entry.entries.len;
- elist->val = malloc(sizeof(*elist->val)
- * (pr_entry.count + elist->len));
+ elist->val = malloc(sizeof(*elist->val) * elist->len);
if (elist->val == NULL)
return ENOMEM; /* XXX */
- /* XXX contentry blocks... */
/* XXX should be sorted */
- for (i = 0; i < pr_entry.count; i++)
- elist->val[i] = pr_entry.entries[i];
+ for (i = 0; i < disk_entry.entries.len; i++)
+ elist->val[i] = disk_entry.entries.val[i];
if (default_id_p) {
elist->val[i] = id;
elist->val[++i] = PR_ANYUSERID;
elist->val[++i] = PR_AUTHUSERID;
- elist->len = pr_entry.count + 3;
}
return 0;
@@ -657,30 +549,23 @@ listelements (int32_t id, prlist *elist, Bool default_id_p)
*/
int
-get_pr_entry_by_id(int id, prentry *pr_entry)
+get_ydr_disk_entry(int id, char **buf)
{
- unsigned long hash_id = get_id_hash(id);
+ struct mdb_datum key, value;
int status;
+
+ id = htonl(id);
- pt_debug (PRDB_DB, "get_pr_entry_by_id id:%d hash_id: %ld",
- id, hash_id);
+ key.data = &id;
+ key.length = sizeof(id);
- status = get_first_id_entry(hash_id, pr_entry);
- pt_debug (PRDB_DB, "get_pr_entry_by_id status:%d", status);
- if (status)
+ status = mdb_fetch(idtodata, &key, &value);
+ if (status == ENOENT)
return PRNOENT;
- while (pr_entry->id != id) {
- if (pr_entry->nextID == 0)
- return PRNOENT;
- status = read_entry(pr_entry->nextID, pr_entry);
- }
-
- pt_debug (PRDB_DB, "entry_by_name id: %d owner: %d creator: %d name: %s",
- pr_entry->id, pr_entry->owner,
- pr_entry->creator, pr_entry->name);
+ *buf = value.data;
- return 0;
+ return status;
}
/*
@@ -688,26 +573,20 @@ get_pr_entry_by_id(int id, prentry *pr_entry)
*/
int
-get_pr_entry_by_name(const char *name, prentry *pr_entry)
+get_disk_entry(int id, prentry_disk *entry)
{
- int hash_name = get_name_hash(name);
+ char *pr_entry_disk_ydr;
+ int length = PRENTRY_DISK_SIZE; /* XXX maxsize in mdb??? */
int status;
- status = get_first_name_entry(hash_name, pr_entry);
+ status = get_ydr_disk_entry(id, &pr_entry_disk_ydr);
if (status)
- return PRNOENT;
-
- while (strcmp(pr_entry->name, name)) {
- if (pr_entry->nextName == 0)
- return PRNOENT;
- status = read_entry(pr_entry->nextName, pr_entry);
- }
+ return status;
- pt_debug (PRDB_DB, "entry_by_name id: %d owner: %d creator: %d name: %s",
- pr_entry->id, pr_entry->owner,
- pr_entry->creator, pr_entry->name);
+ if (ydr_decode_prentry_disk(entry, pr_entry_disk_ydr, &length) == NULL)
+ err(1, "get_disk_entry");
- return 0;
+ return status;
}
/*
@@ -717,14 +596,21 @@ get_pr_entry_by_name(const char *name, prentry *pr_entry)
int
conv_name_to_id(const char *name, int *id)
{
- prentry pr_entry;
+ struct mdb_datum key, value;
int status;
- status = get_pr_entry_by_name(name, &pr_entry);
- if (status)
- return status;
- *id = pr_entry.id;
- return 0;
+ key.data = strdup(name); /*XXX*/
+ key.length = strlen(name);
+
+ status = mdb_fetch(nametoid, &key, &value);
+ if (status == ENOENT)
+ status = PRNOENT;
+ else
+ *id = ntohl(*((int *)value.data));
+
+ free(key.data);
+
+ return status;
}
/*
@@ -737,7 +623,7 @@ conv_id_to_name(int id, char *name)
prentry pr_entry;
int status;
- status = get_pr_entry_by_id(id, &pr_entry);
+ status = read_prentry(id, &pr_entry);
if (status)
return status;
strlcpy(name, pr_entry.name, PR_MAXNAMELEN);
@@ -749,11 +635,18 @@ conv_id_to_name(int id, char *name)
*/
int
-next_free_group_id(void)
+next_free_group_id(int *id)
{
pr_header.maxGroup--; /* XXX */
+ if (pr_header.maxGroup == ILLEGAL_GROUP) {
+ pr_header.maxGroup++;
+ return -1;
+ }
+
write_header();
- return pr_header.maxGroup;
+
+ *id = pr_header.maxGroup;
+ return 0;
}
/*
@@ -761,53 +654,75 @@ next_free_group_id(void)
*/
int
-next_free_user_id()
+next_free_user_id(int *id)
{
pr_header.maxID++; /* XXX */
+ if (pr_header.maxID == ILLEGAL_ID) {
+ pr_header.maxID--;
+ return -1;
+ }
+
write_header();
- return pr_header.maxID;
+
+ *id = pr_header.maxID;
+ return 0;
}
/*
- * Open the pr database that lives in ``databaseprefix''
- * with open(2) ``flags''. Returns 0 or errno.
+ *
*/
-static int
-open_db(char *databaseprefix, int flags)
+static void
+open_db (char *databaseprefix, int flags)
{
char database[MAXPATHLEN];
- assert (pr_database == -1);
-
if (databaseprefix == NULL)
databaseprefix = MILKO_SYSCONFDIR;
- snprintf (database, sizeof(database), "%s/pr_database",
+ snprintf (database, sizeof(database), "%s/pr_idtodata",
databaseprefix);
- pr_database = open(database, flags, S_IRWXU);
- if (pr_database < 0)
- return errno;
- return 0;
+ mlog_log (MDEBPR, "Loading db from file %s\n", database);
+
+ idtodata = mdb_open(database, flags, 0600);
+ if (idtodata == NULL)
+ err(1, "failed open (%s)", database);
+
+
+ snprintf (database, sizeof(database), "%s/pr_nametoid",
+ databaseprefix);
+
+ mlog_log (MDEBPR, "Loading db from file %s\n", database);
+
+ nametoid = mdb_open(database, flags, 0600);
+ if (nametoid == NULL)
+ err(1, "failed open (%s)", database);
+}
+
+void
+prserver_close(void)
+{
+ mdb_close(idtodata);
+ mdb_close(nametoid);
}
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
/*
*
*/
static int
-prserver_create(char *databaseprefix)
+prserver_create (char *databaseprefix)
{
int status;
- printf ("Creating a new pr-database.\n");
-
- status = open_db(databaseprefix, O_RDWR|O_CREAT|O_BINARY|O_EXCL);
- if (status)
- errx (1, "failed open_db with error: %s (%d)",
- strerror(status), status);
+ open_db (databaseprefix, O_RDWR|O_CREAT|O_EXCL|O_BINARY);
+ printf ("Creating a new pr-database.\n");
create_database();
#define M(N,I,O,G) \
@@ -825,6 +740,8 @@ prserver_create(char *databaseprefix)
#undef M
+ prserver_close();
+
return 0;
}
@@ -835,15 +752,8 @@ prserver_create(char *databaseprefix)
static int
prserver_init(char *databaseprefix)
{
- int status;
-
- status = open_db(databaseprefix, O_RDWR|O_BINARY);
- if (status)
- errx (1, "failed open_db with error: %s (%d)",
- strerror(status), status);
-
+ open_db(databaseprefix, O_RDWR|O_BINARY);
read_header();
- get_file_length();
return 0;
}
@@ -854,24 +764,25 @@ prserver_init(char *databaseprefix)
static char *cell = NULL;
static char *realm = NULL;
-static char *databasedir = NULL;
static char *srvtab_file = NULL;
static char *log_file = "syslog";
-static char *debug_level = NULL;
+static char *debug_levels = NULL;
static int no_auth = 0;
static int do_help = 0;
+static char *databasedir = NULL;
static int do_create = 0;
static struct agetargs args[] = {
- {"create", 0, aarg_flag, &do_create, "create new databas"},
{"cell", 0, aarg_string, &cell, "what cell to use"},
{"realm", 0, aarg_string, &realm, "what realm to use"},
- {"prefix",'p', aarg_string, &databasedir, "what dir to store the db"},
+ {"debug", 'd', aarg_string, &debug_levels, "debug level"},
+ {"log", 'l', aarg_string, &log_file,
+ "where to write log (stderr, syslog (default), or path to file)"},
+ {"srvtab", 0, aarg_string, &srvtab_file, "what srvtab to use"},
{"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"},
- {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"},
- {"debug", 'd',aarg_string, &debug_level, "enable debug messages"},
- {"log", 'l', aarg_string, &log_file, "log file"},
{"help", 'h', aarg_flag, &do_help, "help"},
+ {"dbdir", 0, aarg_string, &databasedir, "where to store the db"},
+ {"create", 0, aarg_flag, &do_create, "create new database"},
{ NULL, 0, aarg_end, NULL }
};
@@ -882,7 +793,7 @@ static struct agetargs args[] = {
static void
usage(int exit_code)
{
- aarg_printusage(args, NULL, "", AARG_AFSSTYLE);
+ aarg_printusage (args, NULL, "", AARG_GNUSTYLE);
exit (exit_code);
}
@@ -895,10 +806,11 @@ main(int argc, char **argv)
{
int optind = 0;
int ret;
+ Log_method *method;
set_progname (argv[0]);
- if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) {
+ if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE)) {
usage (1);
}
@@ -913,36 +825,32 @@ main(int argc, char **argv)
if (do_help)
usage(0);
- pr_method = log_open (get_progname(), log_file);
- if (pr_method == NULL)
- errx (1, "log_open failed");
-
- pr_log_unit = log_unit_init (pr_method, "arla", pr_deb_units,
- PR_DEFAULT_LOG);
- if (pr_log_unit == NULL)
- errx (1, "log_unit_init failed");
-
- if (debug_level)
- pt_setdebug (debug_level);
-
- if (do_create) {
- prserver_create (databasedir);
- return 0;
- }
-
if (no_auth)
sec_disable_superuser_check ();
- cell_init(0, pr_method);
+ method = log_open (getprogname(), log_file);
+ if (method == NULL)
+ errx (1, "log_open failed");
+ cell_init(0, method);
ports_init();
printf ("ptserver booting");
+ mlog_loginit (method, milko_deb_units, MDEFAULT_LOG);
+
+ if (debug_levels)
+ mlog_log_set_level (debug_levels);
+
if (cell)
cell_setthiscell (cell);
network_kerberos_init (srvtab_file);
+ if (do_create) {
+ prserver_create (databasedir);
+ return 0;
+ }
+
ret = prserver_init(databasedir);
if (ret)
errx (1, "prserver_init: error %d", ret);
@@ -952,7 +860,7 @@ main(int argc, char **argv)
if (ret)
errx (1, "network_init returned %d", ret);
- pt_debug (PRDB_WARN, "started");
+ mlog_log (MDEBWARN, "started");
rx_SetMaxProcs(prservice,5) ;
rx_StartServer(1) ;
diff --git a/usr.sbin/afs/src/milko/pts/ptserver.h b/usr.sbin/afs/src/milko/pts/ptserver.h
index ba06fa53699..c77965c0eb1 100644
--- a/usr.sbin/afs/src/milko/pts/ptserver.h
+++ b/usr.sbin/afs/src/milko/pts/ptserver.h
@@ -31,26 +31,28 @@
* SUCH DAMAGE.
*/
-/* $KTH: ptserver.h,v 1.8 2000/10/03 00:20:56 lha Exp $ */
-
-#define PRDB_DB 0x0200000
-#define PRDB_RPC 0x0400000
-#define PRDB_WARN 0x0800000
-#define PRDB_ERROR 0x1000000
-
-#define PR_DEFAULT_LOG (PRDB_WARN|PRDB_ERROR)
+/* $arla: ptserver.h,v 1.10 2001/10/12 15:25:50 tol Exp $ */
void
-pt_setdebug (char *debug_level);
+write_header(void);
void
-pt_debug (unsigned int level, char *fmt, ...);
+read_header(void);
+
+int
+read_prentry(int id, prentry *pr_entry);
+
+int
+write_prentry(prentry *pr_entry);
+
+int
+store_disk_entry(prentry_disk *entry);
int
-get_pr_entry_by_id(int id, prentry *pr_entry);
+get_disk_entry(int id, prentry_disk *disk_entry);
int
-get_pr_entry_by_name(const char *name, prentry *pr_entry);
+get_ydr_disk_entry(int id, char **buf);
int
conv_name_to_id(const char *name, int *id);
@@ -59,10 +61,10 @@ int
conv_id_to_name(int id, char *name);
int
-next_free_group_id(void);
+next_free_group_id(int *id);
int
-next_free_user_id(void);
+next_free_user_id(int *id);
int
create_user(const char *name, int32_t id, int32_t owner, int32_t creator);
@@ -79,8 +81,8 @@ int
listelements(int32_t id, prlist *elist, Bool default_id_p);
char *
-localize_name(const char *name);
+localize_name(const char *name, Bool *localp);
-extern prheader pr_header;
+extern prheader_disk pr_header;
diff --git a/usr.sbin/afs/src/milko/vldb/ubikprocs.c b/usr.sbin/afs/src/milko/vldb/ubikprocs.c
index c604a4ed64c..d4491e83e80 100644
--- a/usr.sbin/afs/src/milko/vldb/ubikprocs.c
+++ b/usr.sbin/afs/src/milko/vldb/ubikprocs.c
@@ -39,7 +39,7 @@
#include <krb.h>
#endif
-RCSID("$KTH: ubikprocs.c,v 1.3 2000/10/03 00:21:02 lha Exp $");
+RCSID("$arla: ubikprocs.c,v 1.3 2000/10/03 00:21:02 lha Exp $");
int Ubik_Beacon(struct rx_call *call,
const int32_t state,
diff --git a/usr.sbin/afs/src/milko/vldb/vl_db.c b/usr.sbin/afs/src/milko/vldb/vl_db.c
index 9156d676e5f..685e207c52a 100644
--- a/usr.sbin/afs/src/milko/vldb/vl_db.c
+++ b/usr.sbin/afs/src/milko/vldb/vl_db.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,241 +33,231 @@
#include "vldb_locl.h"
-RCSID("$KTH: vl_db.c,v 1.3 2000/10/03 00:21:07 lha Exp $");
+RCSID("$arla: vl_db.c,v 1.10 2002/06/02 21:12:20 lha Exp $");
+
+#define DISK_VLENTRY_MAX 10000
static void open_db (char *databaseprefix, int flags);
int vl_database;
-vlheader vl_header;
-off_t file_length;
+vital_vlheader vl_header;
-static char vl_header_ydr[VLHEADER_SIZE];
+MDB *idtoname, *nametodata;
void
vldb_write_header(void)
{
- off_t pos;
- int length = VLHEADER_SIZE;
+ int length = VITAL_VLHEADER_SIZE;
+ struct mdb_datum key, value;
+ char vl_header_ydr[VITAL_VLHEADER_SIZE];
+ int code;
+ char headerid[] = "\0\0\0\0";
- if (ydr_encode_vlheader(&vl_header, vl_header_ydr, &length) == NULL)
+ if (ydr_encode_vital_vlheader(&vl_header, vl_header_ydr, &length) == NULL)
err(1, "write_header");
- pos = lseek(vl_database, 0, SEEK_SET);
- assert(pos == 0);
+ assert (length == 0);
+
+ key.data = headerid;
+ key.length = sizeof(headerid);
+
+ value.data = vl_header_ydr;
+ value.length = VITAL_VLHEADER_SIZE;
+
+ code = mdb_store(nametodata, &key, &value);
+ assert(code == 0);
- length = write(vl_database, vl_header_ydr, VLHEADER_SIZE);
- assert (length == VLHEADER_SIZE);
}
void
vldb_read_header(void)
{
- char vl_header_ydr[VLHEADER_SIZE];
- int length = VLHEADER_SIZE;
+ int length = VITAL_VLHEADER_SIZE;
+ struct mdb_datum key, value;
+ char headerid[] = "\0\0\0\0";
+ int ret;
- if (lseek(vl_database, 0, SEEK_SET) == -1)
- err(1, "lseek");
+ key.data = headerid;
+ key.length = sizeof(headerid);
- length = read(vl_database, vl_header_ydr, VLHEADER_SIZE);
- if (length == -1)
- err(1, "read");
- if (length != VLHEADER_SIZE)
- errx(1, "read_header read failed");
+ value.data = malloc(length);
+ value.length = length;
- if (ydr_decode_vlheader(&vl_header, vl_header_ydr, &length) == NULL)
- err(1, "read_header");
-}
+ ret = mdb_fetch(nametodata, &key, &value);
-void
-vldb_get_file_length(void)
-{
- file_length = lseek(vl_database, 0, SEEK_END);
- if (file_length == -1) {
- err(1, "lseek");
+ if (ret) {
+ errx(1, "read_header: mdb_fetch failed");
}
+
+ assert(value.length == VITAL_VLHEADER_SIZE);
+
+ if (ydr_decode_vital_vlheader(&vl_header, value.data, &length) == NULL)
+ err(1, "read_header");
}
-off_t
-vldb_find_first_free(void)
+static void
+create_database(void)
{
- off_t pos;
-
- if (vl_header.vital_header.freePtr == 0) {
- /* if there are no free entries */
- pos = lseek(vl_database, 0, SEEK_END);
- if (pos == -1)
- err(1, "lseek");
- if (ftruncate(vl_database, pos + DISK_VLENTRY_SIZE) == -1)
- err(1, "ftruncate");
- return pos;
- } else { /* there are free entries */
- /* Not implemented yet */
- assert(0);
- }
- return 0;
+ int i;
+
+ vl_header.vldbversion = 0;
+ vl_header.headersize = VITAL_VLHEADER_SIZE;
+ vl_header.freePtr = 0;
+ vl_header.eofPtr = VITAL_VLHEADER_SIZE;
+ vl_header.allocs = 0;
+ vl_header.frees = 0;
+ vl_header.MaxVolumeId = 0x20000000;
+ for (i = 0; i < MAXTYPES; i++)
+ vl_header.totalEntries[i] = 0;
+
+ vldb_write_header();
}
int
-vldb_write_entry(off_t offset, disk_vlentry *vl_entry)
+vldb_write_entry(const disk_vlentry *vldb_entry)
{
- off_t pos;
- char vl_entry_ydr[DISK_VLENTRY_SIZE];
- int length = DISK_VLENTRY_SIZE;
+ struct mdb_datum datum;
+ struct mdb_datum key;
+ char *disk_vlentry_ydr;
+ int length = DISK_VLENTRY_MAX;
+ int ret;
- if (ydr_encode_disk_vlentry(vl_entry, vl_entry_ydr, &length) == NULL)
- err(1, "write_entry");
+ disk_vlentry_ydr = malloc(length);
- pos = lseek(vl_database, offset, SEEK_SET);
- assert(pos == offset);
+ if (ydr_encode_disk_vlentry(vldb_entry, disk_vlentry_ydr, &length) == NULL)
+ err(1, "write_entry");
- length = write(vl_database, vl_entry_ydr, DISK_VLENTRY_SIZE);
- assert (length == DISK_VLENTRY_SIZE);
+ datum.data = disk_vlentry_ydr;
+ datum.length = DISK_VLENTRY_MAX - length;
- return 0;
+ length = datum.length;
+
+ key.data = (char *) vldb_entry->name;
+ key.length = strlen(vldb_entry->name);
+
+ ret = mdb_store(nametodata, &key, &datum);
+ free(disk_vlentry_ydr);
+ return ret;
}
int
-vldb_read_entry(off_t offset, disk_vlentry *vl_entry)
+vldb_read_entry(const char *name, disk_vlentry *entry)
{
- off_t pos;
- char vl_entry_ydr[DISK_VLENTRY_SIZE];
- int length = DISK_VLENTRY_SIZE;
+ struct mdb_datum key, value;
+ int length;
+ int ret;
+
+ key.data = (char *) name;
+ key.length = strlen(name);
+
+ ret = mdb_fetch(nametodata, &key, &value);
- pos = lseek(vl_database, offset, SEEK_SET);
- assert(pos == offset);
+ if (ret)
+ return ret;
- length = read(vl_database, vl_entry_ydr, DISK_VLENTRY_SIZE);
- assert (length == DISK_VLENTRY_SIZE);
+ length = value.length;
- if (ydr_decode_disk_vlentry((disk_vlentry *) vl_entry,
- vl_entry_ydr, &length) == NULL)
- err(1, "write_entry");
+ if (ydr_decode_disk_vlentry(entry, value.data, &length) == NULL)
+ err(1, "read_entry");
return 0;
}
-static void
-create_database(void)
+int
+vldb_delete_entry(const char *name)
{
- int i;
+ struct mdb_datum key;
+ int ret;
- vl_header.vital_header.vldbversion = 0;
- vl_header.vital_header.headersize = VLHEADER_SIZE;
- vl_header.vital_header.freePtr = 0;
- vl_header.vital_header.eofPtr = VLHEADER_SIZE;
- vl_header.vital_header.allocs = 0;
- vl_header.vital_header.frees = 0;
- vl_header.vital_header.MaxVolumeId = 0xA0000000 - 1;
- for (i = 0; i < MAXTYPES; i++)
- vl_header.vital_header.totalEntries[i] = 0;
+ key.data = (char *) name;
+ key.length = strlen(name);
- for (i = 0; i < MAXSERVERID+1; i++)
- vl_header.IpMappedAddr[i] = 0;
+ ret = mdb_delete(nametodata, &key);
- memset(vl_header.VolnameHash, 0, HASHSIZE * sizeof(int32_t));
- memset(vl_header.VolidHash, 0, HASHSIZE * MAXTYPES * sizeof(int32_t));
- vldb_write_header();
- vldb_get_file_length();
-}
+ if (ret)
+ return ret;
-unsigned long
-vldb_get_id_hash(long id)
-{
- return ((unsigned long) id) % HASHSIZE;
+ return 0;
}
-unsigned long
-vldb_get_name_hash(const char *name)
+int
+vldb_id_to_name(const int32_t volid, char **name)
{
- int i;
- unsigned long hash = 0x47114711;
+ struct mdb_datum key, value;
+ int ret;
- for (i = 0; name[i] && i < 32; i++)
- hash *= name[i];
+ key.data = (char *)&volid;
+ key.length = sizeof(volid);
- return hash % HASHSIZE;
-}
+ ret = mdb_fetch(idtoname, &key, &value);
-int
-vldb_get_first_id_entry(unsigned long hash_id, long type,
- disk_vlentry *vl_entry)
-{
- off_t offset = vl_header.VolidHash[type][hash_id];
- int status;
+ if (ret)
+ return ret;
- vldb_debug (" get_first_id_entry hash_id: %lu type: %ld offset: %d\n",
- hash_id, type, (int) offset);
+ *name = malloc(value.length+1);
- if (offset == 0)
- return VL_NOENT;
+ if (*name == 0)
+ return ENOMEM;
- status = vldb_read_entry(offset, vl_entry);
+ memcpy(*name, value.data, value.length);
+ (*name)[value.length] = '\0';
- return status;
+ return 0;
}
int
-vldb_get_first_name_entry(unsigned long hash_name, disk_vlentry *vl_entry)
+vldb_write_id (const char *name, const uint32_t volid)
{
- off_t offset = vl_header.VolnameHash[hash_name];
- int status;
+ struct mdb_datum datum, key;
+ char *name_copy;
+ uint32_t volid_copy = volid;
+
+ if (volid == 0)
+ return 0;
+
+ name_copy = strdup(name);
- vldb_debug (" get_first_name_entry hash_name: %lu offset: %d\n",
- hash_name, (int) offset);
- if (offset == 0)
- return VL_NOENT;
+ datum.data = name_copy;
+ datum.length = strlen(name_copy);
- status = vldb_read_entry(offset, vl_entry);
+ key.data=&volid_copy;
+ key.length = sizeof(volid);
- return status;
+ mdb_store(idtoname, &key, &datum);
+
+ free(name_copy);
+ return 0;
}
int
-vldb_insert_entry(disk_vlentry *vl_entry)
+vldb_delete_id (const char *name, const uint32_t volid)
{
- off_t offset;
- int status;
- unsigned long hash_id, hash_name;
- disk_vlentry first_id_entry;
- disk_vlentry first_name_entry;
-
- /* Allokera plats i filen */
- offset = vldb_find_first_free();
-
- /* Allocate new volume id? */
- /*id = vl_header.vital_header.MaxVolumeId++;*/
+ struct mdb_datum named, vold;
+ char *name_copy;
+ uint32_t volid_copy = volid;
+ int ret;
- /* Hitta plats i hashtabellerna */
- /* XXX At present, only RW is handled */
- hash_id = vldb_get_id_hash(vl_entry->volumeId[RWVOL]);
- hash_name = vldb_get_name_hash(vl_entry->name);
-
- status = vldb_get_first_id_entry(hash_id, vl_entry->volumeType,
- &first_id_entry);
+ if (volid == 0)
+ return 0;
-/* XXX vl_entry->nextIDHash[vldb_entry->type] = status ? 0 : first_id_entry.nextID;*/
- vl_entry->nextIdHash[vl_entry->volumeType] = status ? 0 : vl_header.VolidHash[vl_entry->volumeType][hash_id];
+ name_copy = strdup(name);
- status = vldb_get_first_name_entry(hash_name, &first_name_entry);
-/* XXX pr_entry->nextName = status ? 0 : first_name_entry.nextName;*/
- vl_entry->nextNameHash = status ? 0 : vl_header.VolnameHash[hash_name];
+ named.data = name_copy;
+ named.length = strlen(name_copy);
- /* XXX: uppdatera owned och nextOwned */
+ vold.data=&volid_copy;
+ vold.length = sizeof(volid);
- /* Lägg in entryt i filen */
- status = vldb_write_entry(offset, vl_entry);
- if (status)
- return status;
+ ret = mdb_delete(idtoname, &vold);
+ if (ret)
+ return ret;
- /* Uppdatera hashtabell */
- vl_header.VolidHash[vl_entry->volumeType][hash_id] = offset;
- vl_header.VolnameHash[hash_name] = offset;
- vldb_write_header();
+ free(name_copy);
return 0;
}
int
-vldb_print_entry (struct disk_vlentry *entry, int long_print)
+vldb_print_entry (vldbentry *entry, int long_print)
{
int i;
printf ("name: %s\n"
@@ -293,43 +283,43 @@ vldb_print_entry (struct disk_vlentry *entry, int long_print)
entry->serverFlags[i] & VLSF_NEWREPSITE ? "New site" : "");
}
-#if 0
- u_long volumeId[MAXTYPES];
- long flags;
- long LockAfsId;
- long LockTimestamp;
- long cloneId;
- long AssociatedChain;
- long nextIdHash[MAXTYPES];
- long nextNameHash;
- long spares1[2];
- char name[VLDB_MAXNAMELEN];
- u_char volumeType;
- u_char RefCount;
- char spares2[1];
-#endif
return 0;
}
static void
open_db (char *databaseprefix, int flags)
{
+
char database[MAXPATHLEN];
if (databaseprefix == NULL)
databaseprefix = MILKO_SYSCONFDIR;
- snprintf (database, sizeof(database), "%s/vl_database",
+ snprintf (database, sizeof(database), "%s/vl_idtoname",
+ databaseprefix);
+
+ mlog_log (MDEBVL, "Loading db from file %s\n", database);
+
+ idtoname = mdb_open(database, flags, 0600);
+
+ if (idtoname == NULL)
+ err(1, "failed open (%s)", database);
+
+ snprintf (database, sizeof(database), "%s/vl_nametodata",
databaseprefix);
- vldb_debug ("Loading db from file %s\n", database);
+ mlog_log (MDEBVL, "Loading db from file %s\n", database);
- vl_database = open(database, flags, S_IRWXU);
+ nametodata = mdb_open(database, flags, 0600);
- if (vl_database == -1)
+ if (nametodata == NULL)
err(1, "failed open (%s)", database);
}
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
void
vldb_create (char *databaseprefix)
{
@@ -344,28 +334,18 @@ vldb_init(char *databaseprefix)
{
open_db (databaseprefix, O_RDWR|O_BINARY);
vldb_read_header();
- vldb_get_file_length();
}
-static int vldbdebug = 0;
-
-int
-vldb_setdebug (int debug)
+void
+vldb_close(void)
{
- int odebug = vldbdebug;
- vldbdebug = debug;
- return odebug;
+ mdb_close(nametodata);
+ mdb_close(idtoname);
}
void
-vldb_debug (char *fmt, ...)
+vldb_flush(void)
{
- va_list args;
- if (!vldbdebug)
- return ;
-
- va_start (args, fmt);
- vfprintf (stderr, fmt, args);
- va_end(args);
+ mdb_flush(nametodata);
+ mdb_flush(idtoname);
}
-
diff --git a/usr.sbin/afs/src/milko/vldb/vldb_locl.h b/usr.sbin/afs/src/milko/vldb/vldb_locl.h
index 913606914a2..233f37b408d 100644
--- a/usr.sbin/afs/src/milko/vldb/vldb_locl.h
+++ b/usr.sbin/afs/src/milko/vldb/vldb_locl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -47,7 +47,11 @@
#include <ko.h>
#ifdef KERBEROS
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
#include <krb.h>
#include <rxkad.h>
#endif
@@ -66,6 +70,10 @@
#include <agetarg.h>
+#include <mlog.h>
+#include <mdebug.h>
+#include <mdb.h>
+
#include "rx/rxgencon.h"
#include "vldb.h"
#include "vldb.ss.h"
@@ -73,32 +81,33 @@
extern int vl_database;
-extern vlheader vl_header;
-extern off_t file_length;
-
-void
-vlservdebug (char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
-
+extern vital_vlheader vl_header;
void vldb_write_header (void);
void vldb_read_header (void);
-void vldb_get_file_length (void);
-off_t vldb_find_first_free (void);
-int vldb_write_entry (off_t offset, disk_vlentry *vl_entry);
-int vldb_read_entry (off_t offset, disk_vlentry *vl_entry);
+int vldb_write_entry(const disk_vlentry *vldb_entry);
+int vldb_read_entry (const char *name, disk_vlentry *entry);
+int vldb_delete_entry (const char *name);
+int vldb_id_to_name (const int32_t volid, char **name);
+int vldb_write_id (const char *name, const uint32_t volid);
+int vldb_delete_id (const char *name, const uint32_t volid);
+void vldb_close(void);
+void vldb_flush(void);
+
+
unsigned long vldb_get_id_hash (long id);
unsigned long vldb_get_name_hash (const char *name);
-int vldb_get_first_id_entry (unsigned long hash_id, long type,
- disk_vlentry *vl_entry);
-int vldb_get_first_name_entry (unsigned long hash_name,
- disk_vlentry *vl_entry);
-int vldb_insert_entry (disk_vlentry *vl_entry);
-
void vldb_create (char *databaseprefix);
void vldb_init (char *databaseprefix);
-int vldb_print_entry (struct disk_vlentry *entry, int long_print);
-int vldb_setdebug (int debug);
-void vldb_debug (char *fmt, ...);
-
-
+int vldb_print_entry (vldbentry *entry, int long_print);
+
+void vldb_entry_to_disk(const struct vldbentry *newentry,
+ struct disk_vlentry *diskentry);
+void vldb_nentry_to_disk(const struct nvldbentry *entry,
+ struct disk_vlentry *diskentry);
+void vldb_disk_to_entry(const struct disk_vlentry *diskentry,
+ struct vldbentry *entry);
+void vldb_disk_to_nentry(const struct disk_vlentry *diskentry,
+ struct nvldbentry *entry);
+
+void vldb_free_diskentry(struct disk_vlentry *diskentry);
diff --git a/usr.sbin/afs/src/milko/vldb/vldbserver.c b/usr.sbin/afs/src/milko/vldb/vldbserver.c
index ea5c20b5df8..40b58e93c91 100644
--- a/usr.sbin/afs/src/milko/vldb/vldbserver.c
+++ b/usr.sbin/afs/src/milko/vldb/vldbserver.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,32 +33,7 @@
#include "vldb_locl.h"
-RCSID("$KTH: vldbserver.c,v 1.33 2001/01/01 20:42:58 lha Exp $");
-
-static void make_vldb_from_vl(struct vldbentry *vldb_entry,
- struct disk_vlentry *vl_entry);
-
-static void
-make_vldb_from_vl(struct vldbentry *vldb_entry, struct disk_vlentry *vl_entry)
-{
- int i;
-
- strlcpy(vldb_entry->name, vl_entry->name, VLDB_MAXNAMELEN);
- vldb_entry->volumeType = vl_entry->volumeType;
- vldb_entry->nServers = 1; /* XXX What is this supposed to be? */
-
- for (i = 0; i < MAXNSERVERS; i++) {
- vldb_entry->serverNumber[i] = vl_entry->serverNumber[i];
- vldb_entry->serverPartition[i] = vl_entry->serverPartition[i];
- vldb_entry->serverFlags[i] = vl_entry->serverFlags[i];
- }
-
- for (i = 0; i < MAXTYPES; i++)
- vldb_entry->volumeId[i] = vl_entry->volumeId[i];
-
- vldb_entry->cloneId = vl_entry->cloneId;
- vldb_entry->flags = vl_entry->flags;
-}
+RCSID("$arla: vldbserver.c,v 1.46 2003/02/15 16:03:35 map Exp $");
/*
* The rpc - calls
@@ -68,42 +43,55 @@ int
VL_CreateEntry(struct rx_call *call,
const vldbentry *newentry)
{
- struct disk_vlentry vl_entry;
- int32_t nServers;
- int i;
+ char *name;
+ disk_vlentry diskentry;
+ disk_vlentry tempentry;
+
+ mlog_log (MDEBVL, "VL_CreateEntry (name=%s, ids=%d,%d,%d flags=%d)\n",
+ newentry->name,
+ newentry->volumeId[RWVOL],
+ newentry->volumeId[ROVOL],
+ newentry->volumeId[BACKVOL],
+ newentry->flags);
+
if (!sec_is_superuser(call))
return VL_PERM;
- memset (&vl_entry, 0, sizeof(vl_entry));
+ if ((vldb_id_to_name(newentry->volumeId[RWVOL], &name) == 0) ||
+ (vldb_id_to_name(newentry->volumeId[ROVOL], &name) == 0) ||
+ (vldb_id_to_name(newentry->volumeId[BACKVOL], &name) == 0)) {
+ free(name);
+ mlog_log (MDEBVL, "VL_CreateEntry: id exists\n");
+ return VL_NAMEEXIST;
+ }
+
+ if (vldb_read_entry(newentry->name, &tempentry) == 0) {
+ mlog_log (MDEBVL, "VL_CreateEntry: name exists\n");
+ return VL_NAMEEXIST;
+ }
- vldb_debug ("VL_CreateEntry (name=%s, type=%d, ids=%d,%d,%d flags=%d)\n",
- newentry->name, newentry->volumeType,
- newentry->volumeId[RWVOL],
- newentry->volumeId[ROVOL],
- newentry->volumeId[BACKVOL],
- newentry->flags);
+ vldb_entry_to_disk(newentry, &diskentry);
- strlcpy(vl_entry.name, newentry->name, VLDB_MAXNAMELEN);
- vl_entry.volumeType = newentry->volumeType;
+ if (vldb_write_entry(&diskentry) != 0)
+ return VL_IO;
- /* XXX All fields mustn't be set */
- nServers = newentry->nServers;
- if (nServers > MAXNSERVERS)
- nServers = MAXNSERVERS;
- for (i = nServers - 1 ; i >= 0 ; i--) {
- vl_entry.serverNumber[i] = newentry->serverNumber[i];
- vl_entry.serverPartition[i] = newentry->serverPartition[i];
- vl_entry.serverFlags[i] = newentry->serverFlags[i];
- }
+ if (vldb_write_id(newentry->name,
+ newentry->volumeId[RWVOL]) != 0)
+ return VL_IO; /* XXX rollback */
- for (i = 0; i < MAXTYPES; i++)
- vl_entry.volumeId[i] = newentry->volumeId[i];
+ if (vldb_write_id(newentry->name,
+ newentry->volumeId[ROVOL]) != 0)
+ return VL_IO; /* XXX rollback */
- vl_entry.cloneId = newentry->cloneId;
- vl_entry.flags = newentry->flags;
+ if (vldb_write_id(newentry->name,
+ newentry->volumeId[BACKVOL]) != 0)
+ return VL_IO; /* XXX rollback */
+
+ vldb_flush();
+
+ vldb_free_diskentry(&diskentry);
- vldb_insert_entry(&vl_entry);
return 0;
}
@@ -112,12 +100,74 @@ VL_DeleteEntry(struct rx_call *call,
const int32_t Volid,
const int32_t voltype)
{
- vldb_debug ("VL_DeleteEntry\n") ;
+ disk_vlentry entry;
+ char *name;
+ int ret;
- if (!sec_is_superuser(call))
- return VL_PERM;
+ mlog_log (MDEBVL, "VL_DeleteEntry (Volid=%d,Voltype=%d)\n",
+ Volid, voltype);
- return VL_PERM ;
+ if (!sec_is_superuser(call)) {
+ ret = VL_PERM;
+ goto out;
+ }
+
+ if (voltype != RWVOL &&
+ voltype != ROVOL &&
+ voltype != BACKVOL) {
+ ret = VL_BADVOLTYPE;
+ goto out;
+ }
+
+ if (vldb_id_to_name(Volid, &name)) {
+ ret = VL_NOENT;
+ goto out;
+ }
+
+ if (vldb_read_entry(name, &entry) != 0) {
+ ret = VL_NOENT;
+ goto out;
+ }
+
+ if (entry.volumeId[voltype] != Volid) {
+ ret = VL_NOENT;
+ goto out;
+ }
+
+ if (vldb_delete_id(name, entry.volumeId[RWVOL])) {
+ mlog_log (MDEBVL, "VL_DeleteEntry failed to remove RW id %d\n",
+ entry.volumeId[RWVOL]);
+ ret = VL_IO;
+ goto out;
+ }
+ if (vldb_delete_id(name, entry.volumeId[ROVOL])) {
+ mlog_log (MDEBVL, "VL_DeleteEntry failed to remove RO id %d\n",
+ entry.volumeId[ROVOL]);
+ ret = VL_IO;
+ goto out;
+ }
+ if (vldb_delete_id(name, entry.volumeId[BACKVOL])) {
+ mlog_log (MDEBVL, "VL_DeleteEntry failed to remove BK id %d\n",
+ entry.volumeId[BACKVOL]);
+ ret = VL_IO;
+ goto out;
+ }
+ if (vldb_delete_entry(name)) {
+ mlog_log (MDEBVL, "VL_DeleteEntry failed to remove data\n");
+ ret = VL_IO;
+ goto out;
+ }
+
+ free(name);
+
+ vldb_flush();
+
+ ret = 0;
+
+ out:
+ mlog_log (MDEBVL, "VL_DeleteEntry returns %d\n", ret);
+
+ return ret;
}
/*
@@ -130,28 +180,22 @@ VL_GetEntryByID(struct rx_call *call,
const int32_t voltype,
vldbentry *entry)
{
- struct disk_vlentry vl_entry;
-
- vldb_debug ("VL_GetEntryByID (Volid=%d,Voltype=%d)\n",
+ disk_vlentry diskentry;
+ char *name;
+ mlog_log (MDEBVL, "VL_GetEntryByID (Volid=%d,Voltype=%d)\n",
Volid, voltype);
-
- if (vldb_get_first_id_entry(vldb_get_id_hash(Volid),
- voltype, &vl_entry) != 0)
+
+ if (vldb_id_to_name(Volid, &name))
return VL_NOENT;
- while (1) {
- /* Return entry if match found */
- if (vl_entry.volumeId[voltype] == Volid) {
- make_vldb_from_vl(entry, &vl_entry);
- return 0;
- }
-
- if (vl_entry.nextIdHash[voltype] == 0)
- break;
-
- vldb_read_entry(vl_entry.nextIdHash[voltype], &vl_entry);
- }
- return VL_NOENT;
+ if (vldb_read_entry(name, &diskentry) != 0)
+ return VL_NOENT;
+
+ vldb_disk_to_entry(&diskentry, entry);
+
+ free(name);
+
+ return 0;
}
/*
@@ -163,31 +207,21 @@ VL_GetEntryByName(struct rx_call *call,
const char *volumename,
vldbentry *entry)
{
- struct disk_vlentry vl_entry;
+ disk_vlentry diskentry;
- vldb_debug ("VL_GetEntryByName %s\n", volumename) ;
+ mlog_log (MDEBVL, "VL_GetEntryByName (volumename = %s)\n",
+ volumename);
if (isdigit(volumename[0])) {
return VL_GetEntryByID(call, atol(volumename), 0 /* XXX */, entry);
}
- if (vldb_get_first_name_entry(vldb_get_name_hash(volumename),
- &vl_entry) == 0) {
- while (1) {
- /* Return entry if match found */
- if (strcmp(vl_entry.name, volumename) == 0) {
- make_vldb_from_vl(entry, &vl_entry);
- return 0;
- }
-
- if (vl_entry.nextNameHash == 0)
- break;
-
- vldb_read_entry(vl_entry.nextNameHash, &vl_entry);
- }
- }
+ if (vldb_read_entry(volumename, &diskentry) != 0)
+ return VL_NOENT;
- return VL_NOENT;
+ vldb_disk_to_entry(&diskentry, entry);
+
+ return 0;
}
/*
@@ -199,16 +233,18 @@ VL_GetNewVolumeId (struct rx_call *call,
const int32_t bumpcount,
int32_t *newvolumid)
{
- vldb_debug ("VL_GetNewVolumeId(bumpcount=%d)\n", bumpcount) ;
+ mlog_log (MDEBVL, "VL_GetNewVolumeId(bumpcount=%d)\n", bumpcount) ;
if (!sec_is_superuser(call))
return VL_PERM;
- *newvolumid = vl_header.vital_header.MaxVolumeId;
- vldb_debug (" returning low volume id = %d\n", *newvolumid);
- vl_header.vital_header.MaxVolumeId += bumpcount;
+ *newvolumid = vl_header.MaxVolumeId;
+ mlog_log (MDEBVL, " returning low volume id = %d\n", *newvolumid);
+ vl_header.MaxVolumeId += bumpcount;
vldb_write_header();
+ vldb_flush();
+
return 0;
}
@@ -223,7 +259,7 @@ VL_ReplaceEntry (struct rx_call *call,
const vldbentry *newentry,
const int32_t ReleaseType)
{
- vldb_debug ("VL_ReplaceEntry\n") ;
+ mlog_log (MDEBVL, "VL_ReplaceEntry\n") ;
if (!sec_is_superuser(call))
return VL_PERM;
@@ -242,7 +278,7 @@ VL_UpdateEntry (struct rx_call *call,
const VldbUpdateEntry *UpdateEntry,
const int32_t ReleaseType)
{
- vldb_debug ("VL_UpdateEntry\n") ;
+ mlog_log (MDEBVL, "VL_UpdateEntry\n") ;
if (!sec_is_superuser(call))
return VL_PERM;
@@ -260,7 +296,7 @@ VL_SetLock (struct rx_call *call,
const int32_t voltype,
const int32_t voloper)
{
- vldb_debug ("VL_SetLock\n") ;
+ mlog_log (MDEBVL, "VL_SetLock\n") ;
if (!sec_is_superuser(call))
return VL_PERM;
@@ -278,7 +314,7 @@ VL_ReleaseLock (struct rx_call *call,
const int32_t voltype,
const int32_t ReleaseType)
{
- vldb_debug ("VL_ReleaseLock\n") ;
+ mlog_log (MDEBVL, "VL_ReleaseLock\n") ;
if (!sec_is_superuser(call))
return VL_PERM;
@@ -298,7 +334,7 @@ VL_ListEntry (struct rx_call *call,
int32_t *next_index,
vldbentry *entry)
{
- vldb_debug ("VL_ListEntry\n") ;
+ mlog_log (MDEBVL, "VL_ListEntry\n") ;
return VL_PERM ;
}
@@ -312,7 +348,7 @@ VL_ListAttributes (struct rx_call *call,
int32_t *nentries,
bulkentries *blkentries)
{
- vldb_debug ("VL_ListAttributes\n") ;
+ mlog_log (MDEBVL, "VL_ListAttributes\n") ;
return VL_PERM ;
}
@@ -325,7 +361,7 @@ VL_GetStats (struct rx_call *call,
vldstats *stats,
vital_vlheader *vital_header)
{
- vldb_debug ("VL_GetStats") ;
+ mlog_log (MDEBVL, "VL_GetStats") ;
return VL_PERM ;
}
@@ -336,7 +372,7 @@ VL_GetStats (struct rx_call *call,
int
VL_Probe(struct rx_call *call)
{
- vldb_debug ("VL_Probe\n") ;
+ mlog_log (MDEBVL, "VL_Probe\n") ;
return 0;
}
@@ -348,33 +384,56 @@ int
VL_CreateEntryN(struct rx_call *call,
const nvldbentry *entry)
{
- int i;
- struct vldbentry vldb_entry;
+ char *name;
+ disk_vlentry diskentry;
+ disk_vlentry tempentry;
- vldb_debug ("VL_CreateEntryN\n") ;
+ mlog_log (MDEBVL, "VL_CreateEntryN (name=%s, ids=%d,%d,%d flags=%d)\n",
+ entry->name,
+ entry->volumeId[RWVOL],
+ entry->volumeId[ROVOL],
+ entry->volumeId[BACKVOL],
+ entry->flags);
if (!sec_is_superuser(call))
return VL_PERM;
- memset (&vldb_entry, 0, sizeof (vldb_entry));
- strncpy(vldb_entry.name, entry->name, VLDB_MAXNAMELEN);
- vldb_entry.volumeType = RWVOL;
- vldb_entry.nServers = entry->nServers;
+ if ((vldb_id_to_name(entry->volumeId[RWVOL], &name) == 0) ||
+ (vldb_id_to_name(entry->volumeId[ROVOL], &name) == 0) ||
+ (vldb_id_to_name(entry->volumeId[BACKVOL], &name) == 0)) {
+ free(name);
+ mlog_log (MDEBVL, "VL_CreateEntryN: id exists\n");
+ return VL_NAMEEXIST;
+ }
- for (i = 0; i < MAXNSERVERS; i++) {
- vldb_entry.serverNumber[i] = entry->serverNumber[i];
- vldb_entry.serverPartition[i] = entry->serverPartition[i];
- vldb_entry.serverFlags[i] = entry->serverFlags[i];
+ if (vldb_read_entry(entry->name, &tempentry) == 0) {
+ mlog_log (MDEBVL, "VL_CreateEntryN: name exists\n");
+ return VL_NAMEEXIST;
}
- for (i = 0; i < MAXTYPES; i++)
- vldb_entry.volumeId[i] = entry->volumeId[i];
+ vldb_nentry_to_disk(entry, &diskentry);
+
+ if (vldb_write_entry(&diskentry) != 0)
+ return VL_IO;
+
+ if (vldb_write_id(entry->name,
+ entry->volumeId[RWVOL]) != 0)
+ return VL_IO; /* XXX rollback */
+
+ if (vldb_write_id(entry->name,
+ entry->volumeId[ROVOL]) != 0)
+ return VL_IO; /* XXX rollback */
+
+ if (vldb_write_id(entry->name,
+ entry->volumeId[BACKVOL]) != 0)
+ return VL_IO; /* XXX rollback */
+
+ vldb_free_diskentry(&diskentry);
- vldb_entry.cloneId = entry->cloneId;
- vldb_entry.flags = entry->flags;
+ vldb_flush();
- return VL_CreateEntry(call, &vldb_entry);
+ return 0;
}
/*
@@ -387,35 +446,20 @@ VL_GetEntryByIDN(struct rx_call *call,
const int32_t voltype,
nvldbentry *entry)
{
- struct vldbentry vldb_entry;
- int status, i;
- int32_t type = voltype;
-
- vldb_debug ("VL_GetEntryByIDN (Volid=%d,Voltype=%d)\n", Volid, type);
-
- memset (&vldb_entry, 0, sizeof(vldb_entry));
+ disk_vlentry diskentry;
+ char *name;
+ mlog_log (MDEBVL, "VL_GetEntryByIDN (Volid=%d,Voltype=%d)\n",
+ Volid, voltype);
- if (type == -1)
- type = RWVOL;
-
- status = VL_GetEntryByID(call, Volid, type, &vldb_entry);
-
- if (status)
- return status;
+ if (vldb_id_to_name(Volid, &name))
+ return VL_NOENT;
- strlcpy(entry->name, vldb_entry.name, VLDB_MAXNAMELEN);
- entry->nServers = vldb_entry.nServers;
- for (i = 0; i < MAXNSERVERS; i++) {
- entry->serverNumber[i] = vldb_entry.serverNumber[i];
- entry->serverPartition[i] = vldb_entry.serverPartition[i];
- entry->serverFlags[i] = vldb_entry.serverFlags[i];
- }
+ if (vldb_read_entry(name, &diskentry) != 0)
+ return VL_NOENT;
- for (i = 0; i < MAXTYPES; i++)
- entry->volumeId[i] = vldb_entry.volumeId[i];
+ vldb_disk_to_nentry(&diskentry, entry);
- entry->cloneId = vldb_entry.cloneId;
- entry->flags = vldb_entry.flags;
+ free(name);
return 0;
}
@@ -429,35 +473,24 @@ VL_GetEntryByNameN(struct rx_call *call,
const char *volumename,
nvldbentry *entry)
{
- struct vldbentry vldb_entry;
- int status, i;
-
- memset (&vldb_entry, 0, sizeof(vldb_entry));
+ disk_vlentry diskentry;
- vldb_debug ("VL_GetEntryByNameN(volumename=%s)\n", volumename) ;
- status = VL_GetEntryByName(call, volumename, &vldb_entry);
+ mlog_log (MDEBVL, "VL_GetEntryByNameN (volumename = %s)\n",
+ volumename);
- if (status)
- return status;
-
- memset (entry, 0, sizeof(*entry));
- strlcpy(entry->name, vldb_entry.name, VLDB_MAXNAMELEN);
- entry->nServers = vldb_entry.nServers;
- for (i = 0; i < MAXNSERVERS; i++) {
- entry->serverNumber[i] = vldb_entry.serverNumber[i];
- entry->serverPartition[i] = vldb_entry.serverPartition[i];
- entry->serverFlags[i] = vldb_entry.serverFlags[i];
+ if (isdigit(volumename[0])) {
+ return VL_GetEntryByIDN(call, atol(volumename), 0 /* XXX */, entry);
}
- for (i = 0; i < MAXTYPES; i++)
- entry->volumeId[i] = vldb_entry.volumeId[i];
-
- entry->cloneId = vldb_entry.cloneId;
- entry->flags = vldb_entry.flags;
+ if (vldb_read_entry(volumename, &diskentry) != 0)
+ return VL_NOENT;
+ vldb_disk_to_nentry(&diskentry, entry);
+
return 0;
}
+#ifdef notyet
/*
*
*/
@@ -467,11 +500,12 @@ VL_GetEntryByNameU(struct rx_call *call,
const char *volumename,
uvldbentry *entry)
{
- vldb_debug ("VL_GetEntryByNameU %s\n", volumename);
+ mlog_log (MDEBVL, "VL_GetEntryByNameU %s\n", volumename);
memset(entry, 0, sizeof(*entry));
return RXGEN_OPCODE;
}
+#endif
/*
*
@@ -483,21 +517,19 @@ VL_ListAttributesN (struct rx_call *call,
int32_t *nentries,
nbulkentries *blkentries)
{
- vldb_debug ("VL_ListAttributesN\n");
- vldb_debug (" attributes: Mask=(%d=", attributes->Mask);
+ mlog_log (MDEBVL, "VL_ListAttributesN\n");
+ mlog_log (MDEBVL, " attributes: Mask=(%d=", attributes->Mask);
if (attributes->Mask & VLLIST_SERVER)
- vldb_debug ("SERVER ");
+ mlog_log (MDEBVL, "SERVER ");
if (attributes->Mask & VLLIST_PARTITION)
- vldb_debug ("PARTITION ");
- if (attributes->Mask & VLLIST_VOLUMETYPE)
- vldb_debug ("VOLUMETYPE ");
+ mlog_log (MDEBVL, "PARTITION ");
if (attributes->Mask & VLLIST_VOLUMEID)
- vldb_debug ("VOLUMEID ");
+ mlog_log (MDEBVL, "VOLUMEID ");
if (attributes->Mask & VLLIST_FLAG)
- vldb_debug ("FLAG");
+ mlog_log (MDEBVL, "FLAG");
- vldb_debug (") server=%d partition=%d volumetype=%d volumeid=%d flag=%d\n",
+ mlog_log (MDEBVL, ") server=%d partition=%d volumetype=%d volumeid=%d flag=%d\n",
attributes->server,
attributes->partition,
attributes->volumetype,
@@ -512,6 +544,7 @@ VL_ListAttributesN (struct rx_call *call,
return VL_PERM;
}
+#ifdef notyet
/*
*
*/
@@ -522,12 +555,13 @@ VL_ListAttributesU(struct rx_call *call,
int32_t *nentries,
ubulkentries *blkentries)
{
- vldb_debug ("VL_ListAttributesU\n") ;
+ mlog_log (MDEBVL, "VL_ListAttributesU\n") ;
*nentries = 0;
blkentries->len = 0;
blkentries->val = NULL;
return 0;
}
+#endif
/*
*
@@ -539,7 +573,7 @@ VL_UpdateEntryByName(struct rx_call *call,
const struct VldbUpdateEntry *UpdateEntry,
const int32_t ReleaseType)
{
- vldb_debug ("VL_UpdateEntryByName (not implemented)\n");
+ mlog_log (MDEBVL, "VL_UpdateEntryByName (not implemented)\n");
if (!sec_is_superuser(call))
return VL_PERM;
@@ -559,8 +593,8 @@ VL_GetAddrsU(struct rx_call *call,
int32_t *nentries,
bulkaddrs *addrs)
{
- vldb_debug ("VL_GetAddrsU (not implemented)\n");
- return VL_PERM;
+ mlog_log (MDEBVL, "VL_GetAddrsU (not implemented)\n");
+ return RXGEN_OPCODE;
}
/*
@@ -573,7 +607,7 @@ VL_RegisterAddrs(struct rx_call *call,
const int32_t spare,
const bulkaddrs *addrs)
{
- vldb_debug ("VL_RegistersAddrs (not implemented)\n");
+ mlog_log (MDEBVL, "VL_RegistersAddrs (not implemented)\n");
if (!sec_is_superuser(call))
return VL_PERM;
@@ -581,6 +615,7 @@ VL_RegisterAddrs(struct rx_call *call,
return 0;
}
+#ifdef notyet
/*
*
*/
@@ -589,14 +624,16 @@ int
VL_CreateEntryU(struct rx_call *call,
const struct uvldbentry *newentry)
{
- vldb_debug ("VL_CreateEntryU (not implemented)\n");
+ mlog_log (MDEBVL, "VL_CreateEntryU (not implemented)\n");
if (!sec_is_superuser(call))
return VL_PERM;
return VL_PERM;
}
+#endif
+#ifdef notyet
/*
*
*/
@@ -604,13 +641,14 @@ VL_CreateEntryU(struct rx_call *call,
int
VL_ReplaceEntryU(struct rx_call *call)
{
- vldb_debug ("VL_ReplaceEntryU (not implemented)\n");
+ mlog_log (MDEBVL, "VL_ReplaceEntryU (not implemented)\n");
if (!sec_is_superuser(call))
return VL_PERM;
return VL_PERM;
}
+#endif
/*
*
@@ -620,10 +658,10 @@ int
VL_ReplaceEntryN(struct rx_call *call,
const int32_t Volid,
const int32_t voltype,
- const struct vldbentry *newentry,
+ const struct nvldbentry *newentry,
const int32_t ReleaseType)
{
- vldb_debug ("VL_ReplaceEntryN (not implemented)\n");
+ mlog_log (MDEBVL, "VL_ReplaceEntryN (not implemented)\n");
if (!sec_is_superuser(call))
return VL_PERM;
@@ -640,7 +678,7 @@ VL_ChangeAddrs(struct rx_call *call,
const int32_t old_ip,
const int32_t new_ip)
{
- vldb_debug ("VL_ChangeAddrs (not implemented)\n");
+ mlog_log (MDEBVL, "VL_ChangeAddrs (not implemented)\n");
if (!sec_is_superuser(call))
return VL_PERM;
@@ -648,6 +686,7 @@ VL_ChangeAddrs(struct rx_call *call,
return VL_PERM;
}
+#ifdef notyet
/*
*
*/
@@ -655,21 +694,27 @@ VL_ChangeAddrs(struct rx_call *call,
int
VL_GetEntryByIDU(struct rx_call *call)
{
- vldb_debug ("VL_GetEntryByIDU (not implemented)\n");
+ mlog_log (MDEBVL, "VL_GetEntryByIDU (not implemented)\n");
return VL_PERM;
}
+#endif
/*
*
*/
int
-VL_ListEntryN(struct rx_call *call)
+VL_ListEntryN(struct rx_call *call,
+ int32_t previous_index,
+ int32_t *count,
+ int32_t *next_index,
+ nvldbentry *entry)
{
- vldb_debug ("VL_ListEntryN (not implemented)\n");
+ mlog_log (MDEBVL, "VL_ListEntryN (not implemented)\n");
return VL_PERM;
}
+#ifdef notyet
/*
*
*/
@@ -677,9 +722,10 @@ VL_ListEntryN(struct rx_call *call)
int
VL_ListEntryU(struct rx_call *call)
{
- vldb_debug ("VL_ListEntryU (not implemented)\n");
+ mlog_log (MDEBVL, "VL_ListEntryU (not implemented)\n");
return VL_PERM;
}
+#endif
/*
*
@@ -690,13 +736,14 @@ VL_GetAddrs(struct rx_call *call,
const int32_t handle,
const int32_t spare,
struct VL_Callback *spare3,
- const int32_t *nentries,
+ int32_t *nentries,
bulkaddrs *blkaddr)
{
- vldb_debug ("VL_GetAddrs (not implemented)\n");
+ mlog_log (MDEBVL, "VL_GetAddrs (not implemented)\n");
return VL_PERM;
}
+#ifdef notyet
/*
*
*/
@@ -704,7 +751,7 @@ VL_GetAddrs(struct rx_call *call,
int
VL_LinkedListN(struct rx_call *call)
{
- vldb_debug ("VL_LinkedListN (not implemented)\n");
+ mlog_log (MDEBVL, "VL_LinkedListN (not implemented)\n");
return VL_PERM;
}
@@ -715,11 +762,23 @@ VL_LinkedListN(struct rx_call *call)
int
VL_LinkedListU(struct rx_call *call)
{
- vldb_debug ("VL_LinkedListU (not implemented)\n");
+ mlog_log (MDEBVL, "VL_LinkedListU (not implemented)\n");
return VL_PERM;
}
+#endif
-
+int
+VL_ListAttributesN2(struct rx_call *call,
+ const struct VldbListByAttributes *attributes,
+ const char *volumename,
+ const int32_t startindex,
+ int32_t *nentries,
+ nbulkentries *blkentries,
+ int32_t *nextstartindex)
+{
+ mlog_log (MDEBVL, "VL_ListAttributesN2 (not implemented)\n");
+ return VL_PERM;
+}
/*
*
*/
@@ -729,29 +788,33 @@ static struct rx_service *ubikservice = NULL;
static char *cell = NULL;
static char *realm = NULL;
-static char *databasedir = NULL;
static char *srvtab_file = NULL;
static char *log_file = "syslog";
+static char *debug_levels = NULL;
static int no_auth = 0;
+static int do_help = 0;
+static char *databasedir = NULL;
static int do_create = 0;
-static int vlsrv_debug = 0;
static struct agetargs args[] = {
- {"create", 0, aarg_flag, &do_create, "create new database"},
{"cell", 0, aarg_string, &cell, "what cell to use"},
{"realm", 0, aarg_string, &realm, "what realm to use"},
- {"prefix",'p', aarg_string, &databasedir, "what dir to store the db"},
+ {"debug", 'd', aarg_string, &debug_levels, "debug level"},
+ {"log", 'l', aarg_string, &log_file,
+ "where to write log (stderr, syslog (default), or path to file)"},
+ {"srvtab", 0, aarg_string, &srvtab_file, "what srvtab to use"},
{"noauth", 0, aarg_flag, &no_auth, "disable authentication checks"},
- {"debug", 'd', aarg_flag, &vlsrv_debug, "output debugging"},
- {"log", 'd', aarg_string, &log_file, "log file"},
- {"srvtab",'s', aarg_string, &srvtab_file, "what srvtab to use"},
+ {"help", 'h', aarg_flag, &do_help, "help"},
+ {"dbdir", 0, aarg_string, &databasedir, "where to store the db"},
+ {"create", 0, aarg_flag, &do_create, "create new database"},
{ NULL, 0, aarg_end, NULL }
};
static void
-usage(void)
+usage(int exit_code)
{
- aarg_printusage(args, NULL, "", AARG_AFSSTYLE);
+ aarg_printusage (args, NULL, "", AARG_GNUSTYLE);
+ exit (exit_code);
}
int
@@ -763,9 +826,8 @@ main(int argc, char **argv)
set_progname (argv[0]);
- if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE)) {
- usage ();
- return 1;
+ if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE)) {
+ usage (1);
}
argc -= optind;
@@ -776,29 +838,34 @@ main(int argc, char **argv)
return 1;
}
- if (vlsrv_debug)
- vldb_setdebug (vlsrv_debug);
+ if (do_help)
+ usage(0);
if (no_auth)
sec_disable_superuser_check ();
- if (do_create) {
- vldb_create (databasedir);
- return 0;
- }
-
- method = log_open (get_progname(), log_file);
+ method = log_open (getprogname(), log_file);
if (method == NULL)
errx (1, "log_open failed");
cell_init(0, method);
ports_init();
+ mlog_loginit (method, milko_deb_units, MDEFAULT_LOG);
+
+ if (debug_levels)
+ mlog_log_set_level (debug_levels);
if (cell)
cell_setthiscell (cell);
network_kerberos_init (srvtab_file);
+ if (do_create) {
+ vldb_create (databasedir);
+ vldb_close();
+ return 0;
+ }
+
vldb_init(databasedir);
ret = network_init(htons(afsvldbport), "vl", VLDB_SERVICE_ID,
diff --git a/usr.sbin/afs/src/milko/vldb/vled.c b/usr.sbin/afs/src/milko/vldb/vled.c
index 7f125201329..3012e23a95e 100644
--- a/usr.sbin/afs/src/milko/vldb/vled.c
+++ b/usr.sbin/afs/src/milko/vldb/vled.c
@@ -37,7 +37,7 @@
#include <arpa/inet.h>
#include <limits.h>
-RCSID("$KTH: vled.c,v 1.6 2000/10/03 00:21:23 lha Exp $");
+RCSID("$arla: vled.c,v 1.7 2002/10/01 23:35:35 lha Exp $");
struct ed_context {
long begin;
@@ -277,7 +277,7 @@ get_string (FILE *f, char *buf, size_t len)
return ED_EOF;
return ED_FATAL;
}
- buf[strlen(buf)-1] = '\0';
+ buf[strcspn(buf, "\n")] = '\0';
return ED_NOERR;
}
diff --git a/usr.sbin/afs/src/rxdef/bos.xg b/usr.sbin/afs/src/rxdef/bos.xg
index d718fd06f28..cab1df32128 100644
--- a/usr.sbin/afs/src/rxdef/bos.xg
+++ b/usr.sbin/afs/src/rxdef/bos.xg
@@ -1,5 +1,5 @@
/* This is -*-c-*- */
-/* $KTH: bos.xg,v 1.6 2000/08/31 02:46:42 lha Exp $ */
+/* $arla: bos.xg,v 1.8 2002/05/31 21:05:55 lha Exp $ */
/*
* Interface to BOS server
@@ -7,8 +7,6 @@
package BOZO_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
error-function conv_to_arla_errno
@@ -38,14 +36,14 @@ const BSTAT_STARTINGUP = 3;
const BOZO_PRUNEOLD = 1;
const BOZO_PRUNEBAK = 2;
-const BOZO_PRUNECORE = 3;
+const BOZO_PRUNECORE = 4;
const BPROC_STARTED = 1;
const BPROC_EXITED = 2;
const BOZO_HASCORE = 1;
const BOZO_ERRORSTOP = 2;
-const BOZO_BADDIRACCESS = 3;
+const BOZO_BADDIRACCESS = 4;
const BNODE_NEEDTIMEOUT = 0x01;
const BNODE_ACTIVE = 0x02;
@@ -108,19 +106,6 @@ struct bozo_keyInfo {
long spare2;
};
-struct bozo_keyInfoFOOO {
- long goal;
- long fileGoal;
- long procStartTime;
- long procStarts;
- long lastAnyExit;
- long lastErrorExit;
- long errorCode;
- long errorSignal;
- long flags;
- long spare[8];
-};
-
#if 0
struct bnode_ops {
struct bnode *(*create)();
@@ -148,7 +133,9 @@ CreateBnode (IN string type<BOZO_BSSIZE>,
DeleteBnode (IN string instance<BOZO_BSSIZE>) = 81;
-SetStatus (IN string instance<BOZO_BSSIZE>) = 82;
+SetStatus (IN string instance<BOZO_BSSIZE>,
+ IN long status) = 82;
+
GetStatus (IN string instance<BOZO_BSSIZE>,
OUT long *inStat,
@@ -215,7 +202,7 @@ Install (IN string path<BOZO_BSSIZE>,
IN long flags,
IN long date) split = 105;
-UnInstall (IN string path) = 106;
+UnInstall (IN string path<BOZO_BSSIZE>) = 106;
GetDates (IN string path<BOZO_BSSIZE>,
OUT long *newtime,
@@ -239,7 +226,7 @@ GetLog(IN string name<BOZO_BSSIZE>) split = 112;
WaitAll () = 113;
-GetInstanceStrings (IN string instance,
+GetInstanceStrings (IN string instance<BOZO_BSSIZE>,
OUT string errorname<BOZO_BSSIZE>,
OUT string spare1<BOZO_BSSIZE>,
OUT string spare2<BOZO_BSSIZE>,
diff --git a/usr.sbin/afs/src/rxdef/cb.xg b/usr.sbin/afs/src/rxdef/cb.xg
index e43de4c34a6..a34c8e06c45 100644
--- a/usr.sbin/afs/src/rxdef/cb.xg
+++ b/usr.sbin/afs/src/rxdef/cb.xg
@@ -6,14 +6,11 @@
package RXAFSCB_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
+%#include <fs.h>
error-function conv_to_arla_errno
-/*%#include "fs.h"*/
-
/*
* Interface
*/
@@ -67,6 +64,13 @@ struct interfaceAddr { /* for multihomed clients */
int32_t mtu[AFS_MAX_INTERFACE_ADDR]; /* MTU */
};
+const AFSMAXCELLHOSTS = 8; /*Max VLDB servers per cell*/
+
+typedef int32_t serverList[AFSMAXCELLHOSTS];
+
+typedef afs_uint32 cacheConfig<>;
+
+
CallBack (IN AFSCBFids *a_fidArrayP,
IN AFSCBs *a_callBackArrayP) = 204;
@@ -105,3 +109,21 @@ InitCallBackState3(IN afsUUID *serverUuid) = 213;
/* still there? 0 if match, !0 otherwise */
ProbeUUID(IN afsUUID *uuid) = 214;
+
+GetCellServDB(IN afs_int32 cellIndex,
+ OUT string cellName<AFSNAMEMAX>,
+ OUT serverList *cellHosts) = 216;
+
+GetLocalCell(OUT string cellName<AFSNAMEMAX>) = 217;
+
+GetCacheConfig(IN afs_uint32 callerVersion,
+ OUT afs_uint32 *serverVersion,
+ OUT afs_uint32 *configCount,
+ OUT cacheConfig *config) = 218;
+
+GetCellByNum(IN int32_t cellNumber,
+ OUT string cellName<AFSNAMEMAX>,
+ OUT serverList *cellHosts) = 65537;
+
+TellMeAboutYourself(OUT struct interfaceAddr *addr,
+ OUT Capabilities *capabilities) = 65538;
diff --git a/usr.sbin/afs/src/rxdef/common.h b/usr.sbin/afs/src/rxdef/common.h
index 892adf493e1..ecb55301c45 100644
--- a/usr.sbin/afs/src/rxdef/common.h
+++ b/usr.sbin/afs/src/rxdef/common.h
@@ -2,7 +2,7 @@
* Common defintions used by several *.xg files
*/
-/* $KTH: common.h,v 1.12 2000/11/03 10:09:48 lha Exp $ */
+/* $arla: common.h,v 1.19 2003/03/06 20:39:47 lha Exp $ */
%#ifndef _COMMON_
%#define _COMMON_
@@ -14,21 +14,25 @@ const LockRelease = 3;
const AFSNAMEMAX = 256;
+const RWVOL = 0;
+const ROVOL = 1;
+const BACKVOL = 2;
+
struct AFSFid {
- unsigned long Volume;
- unsigned long Vnode;
- unsigned long Unique;
+ uint32_t Volume;
+ uint32_t Vnode;
+ uint32_t Unique;
};
struct VenusFid {
- long Cell;
+ int32_t Cell;
AFSFid fid;
};
struct AFSCallBack {
- unsigned long CallBackVersion;
- unsigned long ExpirationTime;
- unsigned long CallBackType;
+ uint32_t CallBackVersion;
+ uint32_t ExpirationTime;
+ uint32_t CallBackType;
};
enum CallBackType { CBEXCLUSIVE = 1, CBSHARED = 2, CBDROPPED = 3};
@@ -36,12 +40,12 @@ enum CallBackType { CBEXCLUSIVE = 1, CBSHARED = 2, CBDROPPED = 3};
const CALLBACK_VERSION = 1;
struct AFSVolSync {
- unsigned spare1;
- unsigned spare2;
- unsigned spare3;
- unsigned spare4;
- unsigned spare5;
- unsigned spare6;
+ uint32_t spare1;
+ uint32_t spare2;
+ uint32_t spare3;
+ uint32_t spare4;
+ uint32_t spare5;
+ uint32_t spare6;
};
const TYPE_FILE = 1;
@@ -49,27 +53,27 @@ const TYPE_DIR = 2;
const TYPE_LINK = 3;
struct AFSFetchStatus {
- unsigned long InterfaceVersion;
- unsigned long FileType;
- unsigned long LinkCount;
- unsigned long Length;
- unsigned long DataVersion;
- unsigned long Author;
- unsigned long Owner;
- unsigned long CallerAccess;
- unsigned long AnonymousAccess;
- unsigned long UnixModeBits;
- unsigned long ParentVnode;
- unsigned long ParentUnique;
- unsigned long SegSize;
- unsigned long ClientModTime;
- unsigned long ServerModTime;
- unsigned long Group;
- unsigned long SyncCount;
- unsigned spare1;
- unsigned spare2;
- unsigned spare3;
- unsigned spare4;
+ uint32_t InterfaceVersion;
+ uint32_t FileType;
+ uint32_t LinkCount;
+ uint32_t Length;
+ uint32_t DataVersion;
+ uint32_t Author;
+ uint32_t Owner;
+ uint32_t CallerAccess;
+ uint32_t AnonymousAccess;
+ uint32_t UnixModeBits;
+ uint32_t ParentVnode;
+ uint32_t ParentUnique;
+ uint32_t SegSize;
+ uint32_t ClientModTime;
+ uint32_t ServerModTime;
+ uint32_t Group;
+ uint32_t SyncCount;
+ uint32_t DataVersionHigh; /* For AFS/DFS translator */
+ uint32_t LockCount;
+ uint32_t LengthHigh;
+ uint32_t ErrorCode;
};
/*
@@ -85,12 +89,12 @@ const SS_FSYNC = 0x400; /* 1024 */
struct AFSStoreStatus {
- unsigned long Mask;
- unsigned long ClientModTime;
- unsigned long Owner;
- unsigned long Group;
- unsigned long UnixModeBits;
- unsigned long SegSize;
+ uint32_t Mask;
+ uint32_t ClientModTime;
+ uint32_t Owner;
+ uint32_t Group;
+ uint32_t UnixModeBits;
+ uint32_t SegSize;
};
struct AFSFetchVolumeStatus {
@@ -114,11 +118,14 @@ struct AFSStoreVolumeStatus {
int32_t MaxQuota;
};
+const AFS_SETMINQUOTA = 1;
+const AFS_SETMAXQUOTA = 2;
+
const AFSOPAQUEMAX = 1024;
typedef opaque AFSOpaque<AFSOPAQUEMAX>;
-typedef long ViceLockType;
+typedef int32_t ViceLockType;
const AFSCBMAX = 50;
@@ -137,39 +144,36 @@ const PRSFS_LOCK = 32 ; /* Read-lock files */
const PRSFS_ADMINISTER = 64 ; /* Set access list of directory */
struct AFSVolumeInfo {
- u_long Vid;
- long Type;
- u_long Type0;
- u_long Type1;
- u_long Type2;
- u_long Type3;
- u_long Type4;
- u_long ServerCount;
- u_long Server0;
- u_long Server1;
- u_long Server2;
- u_long Server3;
- u_long Server4;
- u_long Server5;
- u_long Server6;
- u_long Server7;
- unsigned short Port0;
- unsigned short Port1;
- unsigned short Port2;
- unsigned short Port3;
- unsigned short Port4;
- unsigned short Port5;
- unsigned short Port6;
- unsigned short Port7;
+ uint32_t Vid;
+ int32_t Type;
+ uint32_t Type0;
+ uint32_t Type1;
+ uint32_t Type2;
+ uint32_t Type3;
+ uint32_t Type4;
+ uint32_t ServerCount;
+ uint32_t Server0;
+ uint32_t Server1;
+ uint32_t Server2;
+ uint32_t Server3;
+ uint32_t Server4;
+ uint32_t Server5;
+ uint32_t Server6;
+ uint32_t Server7;
+ uint16_t Port0;
+ uint16_t Port1;
+ uint16_t Port2;
+ uint16_t Port3;
+ uint16_t Port4;
+ uint16_t Port5;
+ uint16_t Port6;
+ uint16_t Port7;
};
-struct afsUUID {
- u_long time_low;
- u_short time_mid;
- u_short time_hi_and_version;
- char clock_seq_hi_and_reserved;
- char clock_seq_low;
- char node[6];
-};
+#include "afsuuid.h"
+
+const AFSCAPABILITIESMAX = 196;
+
+typedef int32_t Capabilities<AFSCAPABILITIESMAX>;
%#endif /* _COMMON_ */
diff --git a/usr.sbin/afs/src/rxdef/fs.xg b/usr.sbin/afs/src/rxdef/fs.xg
index e2523fcca33..a0faf5ee483 100644
--- a/usr.sbin/afs/src/rxdef/fs.xg
+++ b/usr.sbin/afs/src/rxdef/fs.xg
@@ -1,6 +1,6 @@
/* This is -*-c-*- */
-/* $KTH: fs.xg,v 1.13 2000/04/30 10:14:25 assar Exp $ */
+/* $arla: fs.xg,v 1.18 2003/03/06 16:15:53 lha Exp $ */
/*
* Interface to FS
@@ -8,14 +8,18 @@
package RXAFS_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
error-function conv_to_arla_errno
+#define AFSUUID_GENERATE
+
#include "common.h"
+const FLUSHMAX = 10;
+typedef int32_t ViceIds<FLUSHMAX>;
+typedef int32_t IPAddrs<FLUSHMAX>;
+
/*
* Interface
*/
@@ -152,3 +156,30 @@ ExtendLock (IN AFSFid *Fid,
ReleaseLock (IN AFSFid *Fid,
OUT AFSVolSync *Sync) = 158;
+
+FlushCPS (IN ViceIds *IdsArray,
+ IN IPAddrs *AddrsArray,
+ IN int32_t spare1,
+ OUT int32_t *spare2,
+ OUT int32_t *spare3) = 162;
+
+#if 0
+FetchData64 (IN AFSFid *Fid,
+ IN int64_t Pos,
+ IN int64_t Length,
+ OUT AFSFetchStatus *OutStatus,
+ OUT AFSCallBack *CallBack,
+ OUT AFSVolSync *Sync) split = 65537;
+
+StoreData64 (IN AFSFid *Fid,
+ IN AFSStoreStatus *InStatus,
+ IN uint64_t Pos,
+ INT uint64_t Length,
+ INT uint64_t FileLength,
+ OUT AFSFetchStatus *OutStatus,
+ AFSVolSync *Sync) split = 65538;
+#endif
+
+GiveUpAllCallBacks () = 65539 ;
+
+GetCapabilities(OUT Capabilities *capabilities) = 65540;
diff --git a/usr.sbin/afs/src/rxdef/ka.xg b/usr.sbin/afs/src/rxdef/ka.xg
index d4044dd67f1..5ae7125c034 100644
--- a/usr.sbin/afs/src/rxdef/ka.xg
+++ b/usr.sbin/afs/src/rxdef/ka.xg
@@ -47,7 +47,7 @@ const KAMINORVERSION = 1;
const NEVERDATE = 037777777777;
const KADEBUGKCINFOSIZE = 25;
-#define Date u_int32_t
+#define Date uint32_t
/* Errors */
@@ -112,10 +112,11 @@ struct EncryptionKey {
const MAXKANAMELEN = 64;
#define MAXKANAMELEN 64
+const KA_LABELSIZE = 4;
+
%#ifndef MAXKTCTICKETLEN
const MAXKTCTICKETLEN = 344;
%#endif
-const KA_LABELSIZE = 4;
typedef string kaname<MAXKANAMELEN>;
@@ -127,14 +128,14 @@ struct kaident {
struct kaentryinfo {
int32_t minor_version;
int32_t flags;
- u_int32_t user_expiration;
+ uint32_t user_expiration;
Date modification_time;
kaident modification_user;
Date change_password_time;
long max_ticket_lifetime;
long key_version;
EncryptionKey key;
- u_int32_t keyCheckSym;
+ uint32_t keyCheckSym;
int32_t reserved2;
int32_t reserved3;
int32_t reserved4;
diff --git a/usr.sbin/afs/src/rxdef/pts.xg b/usr.sbin/afs/src/rxdef/pts.xg
index 5d2fb931775..91123502b32 100644
--- a/usr.sbin/afs/src/rxdef/pts.xg
+++ b/usr.sbin/afs/src/rxdef/pts.xg
@@ -6,8 +6,6 @@
package PR_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
error-function conv_to_arla_errno
@@ -112,6 +110,16 @@ struct prheader {
long idHash[HASHSIZE];
};
+struct prheader_disk {
+ long version;
+ long headerSize;
+ long maxGroup;
+ long maxID;
+ long orphan<>;
+ long usercount;
+ long groupcount;
+};
+
struct prentry {
long flags;
long id;
@@ -139,32 +147,12 @@ struct prentry_disk {
long flags;
long id;
long cellid;
- long next;
- long reserved[5];
- long entries[PRSIZE];
- long nextID;
- long nextName;
long owner;
long creator;
long ngroups;
- long nusers;
- long count;
- long instance;
- long owned;
- long nextOwned;
- long parent;
- long sibling;
- long child;
+ long owned<PR_MAXGROUPS>;
string name<PR_MAXNAMELEN>;
-};
-
-struct contentry {
- long flags;
- long id;
- long cellid;
- long next;
- long reserved[5];
- long entries[COSIZE];
+ long entries<PR_MAXGROUPS>;
};
struct prdebugentry {
@@ -266,6 +254,16 @@ SetFieldsEntry(IN long id,
IN long spare1,
IN long spare2) = 516;
+/*
+ * Group/entries that can't be deleted: SYSADMINID, ANYUSERID,
+ * AUTHUSERID, ANONYMOUSID. Error returned is PRPERM.
+ *
+ * Rights: member of SYSADMINID, or owner to entry, or member of the
+ * owner to `id'.
+ *
+ * Sucess: PRSUCCESS.
+ */
+
Delete(IN long id) = 506;
WhereIsIt(IN long id,
diff --git a/usr.sbin/afs/src/rxdef/ubik.xg b/usr.sbin/afs/src/rxdef/ubik.xg
index dac783ff270..821a9aad051 100644
--- a/usr.sbin/afs/src/rxdef/ubik.xg
+++ b/usr.sbin/afs/src/rxdef/ubik.xg
@@ -1,13 +1,11 @@
/* -*- C -*- */
/*
- * $KTH: ubik.xg,v 1.8 2000/03/14 22:28:12 assar Exp $
+ * $arla: ubik.xg,v 1.10 2002/09/07 21:02:38 mattiasa Exp $
*/
package Ubik_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
error-function conv_to_arla_errno
@@ -21,6 +19,8 @@ struct net_tid {
long counter;
};
+const UBIK_MAX_INTERFACE_ADDR = 256; /* max interfaces per server */
+
typedef net_tid net_version;
struct ubik_debug {
@@ -60,6 +60,8 @@ struct ubik_sdebug {
long currentDB;
long beaconSinceDown;
long up;
+ afs_int32 altAddr[255]; /*alternate addresses:host byte */
+ /*this is actually UBIK_MAX_INTERFACE_ADDR-1*/
};
diff --git a/usr.sbin/afs/src/rxdef/vldb.xg b/usr.sbin/afs/src/rxdef/vldb.xg
index 5364cb3c921..d114d5de8d5 100644
--- a/usr.sbin/afs/src/rxdef/vldb.xg
+++ b/usr.sbin/afs/src/rxdef/vldb.xg
@@ -6,9 +6,8 @@
package VL_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
+%#include <fs.h>
error-function conv_to_arla_errno
@@ -33,39 +32,45 @@ typedef opaque bulk<DEFAULTBULK>;
typedef struct single_vldbentry *vldblist;
#endif
-const VLLIST_SERVER = 0x1;
-const VLLIST_PARTITION = 0x2;
-const VLLIST_VOLUMETYPE = 0x4;
-const VLLIST_VOLUMEID = 0x8;
-const VLLIST_FLAG = 0x10;
-
-const RWVOL = 0;
-const ROVOL = 1;
-const BACKVOL = 2;
-
/*
* Used in vlentry.server[i].flags
- * ie for each server
+ * ie for each site/server
*/
-const VLSF_NEWREPSITE = 0x01;
-const VLSF_ROVOL = 0x02;
-const VLSF_RWVOL = 0x04;
-const VLSF_BACKVOL = 0x08;
-const VLSF_UUID = 0x10;
-const VLSF_DONTUSE = 0x20;
+const VLSF_NEWREPSITE = 0x01; /* ??? */
+const VLSF_ROVOL = 0x02; /* Readonly volume on this site */
+const VLSF_RWVOL = 0x04; /* Readwrite volume on this site */
+const VLSF_BACKVOL = 0x08; /* Backup volume on this site */
+const VLSF_UUID = 0x10; /* Internal flag in Transarc client */
+const VLSF_DONTUSE = 0x20; /* Not yet released volumes */
/*
* Used in vlentry.flags
* ie used for whole entry
*/
+/* Internal information in the vldb */
+const VLFREE = 0x1;
+const VLDELETED = 0x2;
+const VLLOCKED = 0x4;
+
+/* Volser information/status */
+const VLOP_MOVE = 0x10;
+const VLOP_RELEASE = 0x20;
+const VLOP_BACKUP = 0x40;
+const VLOP_DELETE = 0x80;
+const VLOP_DUMP = 0x100;
+
+%#define VLOP_ALLOPERS ( VLOP_MOVE | VLOP_RELEASE | VLOP_BACKUP | VLOP_DELETE | VLOP_DUMP)
+
+/* Location information */
const VLF_RWEXISTS = 0x1000;
const VLF_ROEXISTS = 0x2000;
const VLF_BOEXISTS = 0x4000;
const VLF_BACKEXISTS = 0x4000;
const VLF_DFSFILESET = 0x8000;
+/* VL error interface */
const VL_IDEXIST = 363520;
const VL_IO = 363521;
const VL_NAMEEXIST = 363522;
@@ -94,18 +99,50 @@ const VL_RERELEASE = 363544;
const VL_BADSERVERFLAG = 363545;
const VL_PERM = 363546;
const VL_NOMEM = 363547;
+const VL_BADVERSION = 363548;
+const VL_INDEXERANGE = 363549;
+const VL_MULTIPADDR = 363550;
+const VL_BADMASK = 363551;
+
/*
- * States for struct vlentry
+ * Opcodes
*/
-const VLFREE = 0x1;
-const VLDELETED = 0x2;
-const VLLOCKED = 0x4;
-const VLOP_MOVE = 0x10;
-const VLOP_RELEASE = 0x20;
-const VLOP_BACKUP = 0x40;
-const VLOP_DELETE = 0x80;
-const VLOP_DUMP = 0x100;
+
+const VLCREATEENTRY = 501;
+const VLDELETEENTRY = 502;
+const VLGETENTRYBYID = 503;
+const VLGETENTRYBYNAME = 504;
+const VLGETNEWVOLUMEID = 505;
+const VLREPLACEENTRY = 506;
+const VLUPDATEENTRY = 507;
+const VLSETLOCK = 508;
+const VLRELEASELOCK = 509;
+const VLLISTENTRY = 510;
+const VLLISTATTRIBUTES = 511;
+const VLLINKEDLIST = 512;
+const VLGETSTATS = 513;
+const VLPROBE = 514;
+const VLGETADDRS = 515;
+const VLCHANGEADDR = 516;
+const VLCREATEENTRYN = 517;
+const VLGETENTRYBYIDN = 518;
+const VLGETENTRYBYNAMEN = 519;
+const VLREPLACEENTRYN = 520;
+const VLLISTENTRYN = 521;
+const VLLISTATTRIBUTESN = 522;
+const VLLINKEDLISTN = 523;
+const VLUPDATEENTRYBYNAME = 524;
+const VLCREATEENTRYU = 525;
+const VLGETENTRYBYIDU = 526;
+const VLGETENTRYBYNAMEU = 527;
+const VLREPLACEENTRYU = 528;
+const VLLISTENTRYU = 529;
+const VLLISTATTRIBUTESU = 530;
+const VLLINKEDLISTU = 531;
+const VLREGADDR = 532;
+const VLGETADDRSU = 533;
+const VLLISTATTRIBUTESN2 = 534;
/*
* ReleaseType argument for VL_ReleaseLock
@@ -116,7 +153,7 @@ const LOCKREL_AFSID = 4;
struct vldbentry {
char name[VLDB_MAXNAMELEN];
- long volumeType; /* spares */
+ long volumeType; /* currrent unused */
long nServers;
long serverNumber[MAXNSERVERS];
long serverPartition[MAXNSERVERS];
@@ -135,7 +172,7 @@ struct nvldbentry {
u_long volumeId[MAXTYPES];
long cloneId;
long flags;
- long spares1;
+ long matchindex;
long spares2;
long spares3;
long spares4;
@@ -165,23 +202,16 @@ struct vlentry {
char spares2[1];
};
+/* disk_vlentry is arla specific */
+
struct disk_vlentry {
u_long volumeId[MAXTYPES];
long flags;
- long LockAfsId;
- long LockTimestamp;
long cloneId;
- long AssociatedChain;
- long nextIdHash[MAXTYPES];
- long nextNameHash;
- long spares1[2];
- char name[VLDB_MAXNAMELEN];
- u_char volumeType;
- long serverNumber[MAXNSERVERS];
- u_char serverPartition[MAXNSERVERS];
- u_char serverFlags[MAXNSERVERS];
- u_char RefCount;
- char spares2[1];
+ string name<>;
+ long serverNumber<>;
+ long serverPartition<>;
+ long serverFlags<>;
};
struct vital_vlheader {
@@ -240,11 +270,18 @@ struct VldbUpdateEntry {
long RepsitesNewFlags[MAXNSERVERS];
};
+/* bit mask for VldbListByAttributes.Mask */
+const VLLIST_SERVER = 0x1;
+const VLLIST_PARTITION = 0x2;
+/* 0x4 was VLLIST_VOLUMETYPE but now it seems to be depricated */
+const VLLIST_VOLUMEID = 0x8;
+const VLLIST_FLAG = 0x10;
+
struct VldbListByAttributes {
u_long Mask;
long server;
long partition;
- long volumetype;
+ long volumetype; /* depricated */
long volumeid;
long flag;
};
@@ -289,78 +326,83 @@ struct vldstats {
long reserved[5];
};
+const VL_MAX_BULK_ADDRS = 1024 ;
+
typedef vldbentry bulkentries<>;
typedef nvldbentry nbulkentries<>;
typedef uvldbentry ubulkentries<>;
+typedef int32_t bulkaddrs<VL_MAX_BULK_ADDRS>;
+
-/* Mask-flags for ListAddrByAttributes */
+/*
+ * Bits for ListAddrByAttributes.Mask
+ * Note, IPADDR/INDEX/UUID are mutually exclusive
+ */
const VLADDR_IPADDR = 0x1;
const VLADDR_INDEX = 0x2;
const VLADDR_UUID = 0x4;
struct ListAddrByAttributes {
- int32_t mask;
- u_int32_t ipaddr;
+ int32_t Mask;
+ uint32_t ipaddr;
int32_t index;
int32_t spare;
afsUUID uuid;
};
-typedef int32_t bulkaddrs<>;
-
struct VL_Callback {
- u_int32_t version;
- u_int32_t expiration_time;
- u_int32_t time;
- u_int32_t handle;
+ uint32_t version;
+ uint32_t expiration_time;
+ uint32_t time;
+ uint32_t handle;
};
/*
* Interface
*/
-CreateEntry (IN vldbentry *newentry) = 501;
+CreateEntry (IN vldbentry *newentry) = VLCREATEENTRY;
DeleteEntry (IN long Volid,
- IN long voltype) = 502;
+ IN long voltype) = VLDELETEENTRY;
GetEntryByID (IN long Volid,
IN long voltype,
- OUT vldbentry *entry) = 503;
+ OUT vldbentry *entry) = VLGETENTRYBYID;
GetEntryByName (IN string volumename<VLDB_MAXNAMELEN>,
- OUT vldbentry *entry) = 504;
+ OUT vldbentry *entry) = VLGETENTRYBYNAME;
GetNewVolumeId (IN long bumpcount,
- OUT long *newvolumid) = 505;
+ OUT long *newvolumid) = VLGETNEWVOLUMEID;
ReplaceEntry (IN long Volid,
IN long voltype,
IN vldbentry *newentry,
- IN long ReleaseType) = 506;
+ IN long ReleaseType) = VLREPLACEENTRY;
UpdateEntry (IN long Volid,
IN long voltype,
IN VldbUpdateEntry *UpdateEntry,
- IN long ReleaseType) = 507;
+ IN long ReleaseType) = VLUPDATEENTRY;
SetLock (IN long Volid,
IN long voltype,
- IN long voloper) = 508;
+ IN long voloper) = VLSETLOCK;
ReleaseLock (IN long volid,
IN long voltype,
- IN long ReleaseType) = 509;
+ IN long ReleaseType) = VLRELEASELOCK;
ListEntry (IN long previous_index,
OUT long *count,
OUT long *next_index,
- OUT vldbentry *entry) = 510;
+ OUT vldbentry *entry) = VLLISTENTRY;
ListAttributes (IN VldbListByAttributes *attributes,
OUT long *nentries,
- OUT bulkentries *blkentries) = 511;
+ OUT bulkentries *blkentries) = VLLISTATTRIBUTES;
#if 0
LinkedList (IN VldbListByAttributes *attributes,
@@ -369,68 +411,135 @@ LinkedList (IN VldbListByAttributes *attributes,
#endif
GetStats (OUT vldstats *stats,
- OUT vital_vlheader *vital_header) = 513;
+ OUT vital_vlheader *vital_header) = VLGETSTATS;
-Probe () = 514;
+Probe () = VLPROBE;
GetAddrs(IN int32_t handle,
IN int32_t spare,
OUT VL_Callback *spare3,
- IN int32_t *nentries,
- OUT bulkaddrs *blkaddr) = 515;
+ OUT int32_t *nentries,
+ OUT bulkaddrs *blkaddr) = VLGETADDRS;
ChangeAddrs(IN int32_t old_ip,
- IN int32_t new_ip) = 516; /* obsolete */
+ IN int32_t new_ip) = VLCHANGEADDR; /* obsolete */
-CreateEntryN(IN nvldbentry *newentry) = 517;
+CreateEntryN(IN nvldbentry *newentry) = VLCREATEENTRYN;
GetEntryByIDN (IN long Volid,
IN long voltype,
- OUT nvldbentry *entry) = 518;
+ OUT nvldbentry *entry) = VLGETENTRYBYIDN;
GetEntryByNameN (IN string volumename<VLDB_MAXNAMELEN>,
- OUT nvldbentry *entry) = 519;
+ OUT nvldbentry *entry) = VLGETENTRYBYNAMEN;
ReplaceEntryN (IN long Volid,
IN long voltype,
IN nvldbentry *newentry,
- IN long ReleaseType) = 520;
+ IN long ReleaseType) = VLREPLACEENTRYN;
-ListEntryN() = 521;
+ListEntryN(IN afs_int32 previous_index,
+ OUT afs_int32 *count,
+ OUT afs_int32 *next_index,
+ OUT nvldbentry *entry) = VLLISTENTRYN;
ListAttributesN (IN VldbListByAttributes *attributes,
OUT long *nentries,
- OUT nbulkentries *blkentries) = 522;
+ OUT nbulkentries *blkentries) = VLLISTATTRIBUTESN;
+#if 0
LinkedListN() = 523;
+#endif
UpdateEntryByName (IN string volname<VLDB_MAXNAMELEN>,
IN VldbUpdateEntry *UpdateEntry,
- IN long ReleaseType) = 524;
+ IN long ReleaseType) = VLUPDATEENTRYBYNAME;
-CreateEntryU(IN uvldbentry *newentry) = 525;
+#ifdef not_implemented_yet
+CreateEntryU(IN uvldbentry *newentry) = VLCREATEENTRYU;
-GetEntryByIDU() = 526;
+GetEntryByIDU() = VLGETENTRYBYIDU;
GetEntryByNameU (IN string volumename<VLDB_MAXNAMELEN>,
- OUT struct uvldbentry *entry) = 527;
+ OUT struct uvldbentry *entry) = VLGETENTRYBYNAMEU;
-ReplaceEntryU() = 528;
+ReplaceEntryU() = VLREPLACEENTRYU;
-ListEntryU() = 529;
+ListEntryU() = VLLISTENTRYU;
ListAttributesU (IN VldbListByAttributes *attributes,
OUT long *nentries,
- OUT ubulkentries *blkentries) = 530;
+ OUT ubulkentries *blkentries) = VLLISTATTRIBUTESU;
+
+LinkedListU() = VLLINKEDLISTU;
+#endif
+
+GetAddrsU(IN ListAddrByAttributes *inaddr,
+ OUT afsUUID *uuidp1,
+ OUT afs_int32 *uniquifier,
+ OUT afs_int32 *nentries,
+ OUT bulkaddrs *blkaddrs) = VLGETADDRSU;
-LinkedListU() = 531;
RegisterAddrs(IN afsUUID *uid,
IN int32_t spare,
- IN bulkaddrs *addrs) = 532;
+ IN bulkaddrs *addrs) = VLREGADDR;
-GetAddrsU(IN ListAddrByAttributes *inaddr,
- OUT afsUUID *uuid,
- OUT int32_t *uniq,
- OUT int32_t *nentries,
- OUT bulkaddrs *addrs) = 533;
+
+ListAttributesN2(IN VldbListByAttributes *attributes,
+ IN string volumename<VLDB_MAXNAMELEN>,
+ IN afs_int32 startindex,
+ OUT afs_int32 *nentries,
+ OUT nbulkentries *blkentries,
+ OUT afs_int32 *nextstartindex) = VLLISTATTRIBUTESN2;
+
+#if 0
+
+/*
+ *
+ */
+
+const VL_LISTATTRUUID_MAXATTR = 64;
+const VL_LISTATTRUUID_MAXATTRSIZE = 512;
+
+struct VL_ListAddrUUID {
+ afs_int32 type;
+ afs_int32 error;
+ opaque data<VL_LISTATTRUUID_MAXATTRSIZE>;
+};
+
+typedef VL_ListAddrUUID VL_ListAddrUUIDs<>;
+
+const VL_UUID_data_INVALID = 1;
+
+const VL_UUID_data_IPV6 = 1;
+struct VL_UUID_data {
+ opaque ipv6_addr<128>;
+ int ipv6_mtu;
+};
+
+const VL_UUID_data_GSSAPI_name = 2;
+struct VL_UUID_data_gss_name {
+ opaque gss_name<>;
+};
+
+/*
+ * `uuid' is the uuid we query information the diffrent types are in
+ * `query'.
+ *
+ * For each `query'-item there can be one or more items in `reply'.
+ * The reply items have `reply<>.type' set to the same type as in the
+ * query. The are always sorted in the same order as the `query'.
+ *
+ * If the `query' type isn't supported a `reply<>' is sent back with
+ * `reply<>.error' set.
+ *
+ * The `reply<>.data' is filled with `reply<>.type' specific data.
+ * XXX should we use union, I don't think so.
+ */
+
+ListAttrUUID(IN afsUUID *uuid,
+ IN afs_int32 query<VL_LISTATTRUUID_MAXATTR>,
+ OUT VL_ListAddrUUIDs *reply) = 10001;
+
+#endif
diff --git a/usr.sbin/afs/src/rxdef/volumeserver.xg b/usr.sbin/afs/src/rxdef/volumeserver.xg
index e67ec1cb029..640b077079f 100644
--- a/usr.sbin/afs/src/rxdef/volumeserver.xg
+++ b/usr.sbin/afs/src/rxdef/volumeserver.xg
@@ -2,13 +2,11 @@
* Interface to Volumeserver,
* reference /afs/nada.kth.se/misc/reference/programming/afs/shadow/
*
- * $KTH: volumeserver.xg,v 1.20 2000/06/01 23:59:02 ahltorp Exp $
+ * $arla: volumeserver.xg,v 1.25 2002/08/05 16:46:14 lha Exp $
*/
package VOLSER_
-%#include <config.h>
-%#include <roken.h>
%#include <fs_errors.h>
error-function conv_to_arla_errno
@@ -259,7 +257,9 @@ struct replica {
struct destServer destserver;
};
-typedef replica replicas<>;
+#define AFS_MAX_DESTINATIONS 255
+
+typedef replica manyDests<AFS_MAX_DESTINATIONS>;
AFSVolCreateVolume(IN long partition,
IN string name,
@@ -276,7 +276,7 @@ AFSVolNukeVolume(IN long partID,
AFSVolDump(IN long fromTrans,
IN long fromDate) split = VOLDUMP;
-AFSVolSignalRestore(IN char *name,
+AFSVolSignalRestore(IN string name<>,
IN int type,
IN long pid,
IN long cloneid) = VOLSIGNALRESTORE;
@@ -294,7 +294,7 @@ AFSVolForward(IN int32_t fromTrans,
AFSVolClone(IN long trans,
IN long purgeVol,
IN long newType,
- IN char *newName,
+ IN string newName,
INOUT long *newVol) = VOLCLONE;
AFSVolReClone(IN long tid,
@@ -324,7 +324,7 @@ AFSVolGetStatus(IN long tid,
OUT volser_status *status) = VOLGETSTATUS;
AFSVolSetIdsTypes(IN long tId,
- IN char *name,
+ IN string name<>,
IN long type,
IN long pId,
IN long cloneId,
@@ -367,7 +367,7 @@ AFSVolXListPartitions(OUT part_entries *ent) = VOLXLISTPARTITIONS;
AFSVolForwardMultiple(IN int32_t fromTrans,
IN int32_t fromData,
- IN replicas *destinations,
+ IN manyDests *destinations,
IN long spare0,
IN struct restoreCookie *cookie,
- IN multi_results *results) = VOLFORWARDMULTIPLE;
+ OUT multi_results *results) = VOLFORWARDMULTIPLE;
diff --git a/usr.sbin/afs/src/rxkad/compat.c b/usr.sbin/afs/src/rxkad/compat.c
index 902d71f7e00..6002788fd17 100644
--- a/usr.sbin/afs/src/rxkad/compat.c
+++ b/usr.sbin/afs/src/rxkad/compat.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#include "rxkad_locl.h"
-RCSID("$KTH: compat.c,v 1.5 2000/10/03 00:38:11 lha Exp $");
+RCSID("$arla: compat.c,v 1.6 2003/01/11 00:50:30 lha Exp $");
void initialize_rxk_error_table(void);
@@ -43,14 +43,14 @@ initialize_rxk_error_table(void)
/* A no op, our com_err is not compatible anyways. */
}
-u_int32
-life_to_time(u_int32 start, int life_)
+uint32_t
+life_to_time(uint32_t start, int life_)
{
return krb_life_to_time(start, life_);
}
int
-time_to_life(u_int32 start, u_int32 end)
+time_to_life(uint32_t start, uint32_t end)
{
return krb_time_to_life(start, end);
}
@@ -75,7 +75,7 @@ time_to_life(u_int32 start, u_int32 end)
* and the lifetime is within the legal limit.
*/
int
-tkt_CheckTimes(int32 begin, int32 end, int32 now)
+tkt_CheckTimes(int32_t begin, int32_t end, int32_t now)
{
if (end <= begin
|| begin > now + KTC_TIME_UNCERTAINTY + MAXKTCTICKETLIFETIME
@@ -104,9 +104,9 @@ tkt_MakeTicket(char *ticket,
int *ticketLen,
struct ktc_encryptionKey *key,
char *name, char *inst, char *cell,
- u_int32 start, u_int32 end,
+ uint32_t start, uint32_t end,
struct ktc_encryptionKey *sessionKey,
- u_int32 host,
+ uint32_t host,
char *sname, char *sinst)
{
int code;
@@ -132,15 +132,15 @@ tkt_MakeTicket(char *ticket,
int
tkt_DecodeTicket (char *asecret,
- int32 ticketLen,
+ int32_t ticketLen,
struct ktc_encryptionKey *key_,
char *name,
char *inst,
char *cell,
char *sessionKey,
- int32 *host_,
- int32 *start_,
- int32 *end)
+ int32_t *host_,
+ int32_t *start_,
+ int32_t *end)
{
des_cblock *key = (des_cblock *)key_;
des_key_schedule sched;
@@ -150,8 +150,8 @@ tkt_DecodeTicket (char *asecret,
int life;
char sname[ANAME_SZ];
char sinst[INST_SZ];
- u_int32 *start = (u_int32 *)start_;
- u_int32 *host = (u_int32 *)host_;
+ uint32_t *start = (uint32_t *)start_;
+ uint32_t *host = (uint32_t *)host_;
des_key_sched(key, sched);
txt.length = ticketLen;
diff --git a/usr.sbin/afs/src/rxkad/osi_alloc.c b/usr.sbin/afs/src/rxkad/osi_alloc.c
index 76b515c747b..5a7b3d2330b 100644
--- a/usr.sbin/afs/src/rxkad/osi_alloc.c
+++ b/usr.sbin/afs/src/rxkad/osi_alloc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,17 +33,17 @@
#include "rxkad_locl.h"
-RCSID("$KTH: osi_alloc.c,v 1.4 2000/10/03 00:38:16 lha Exp $");
+RCSID("$arla: osi_alloc.c,v 1.5 2003/01/11 00:50:30 lha Exp $");
#undef osi_Alloc
#undef osi_Free
-char *osi_Alloc(int32 size);
-void osi_Free(void *p, int32 size);
+char *osi_Alloc(int32_t size);
+void osi_Free(void *p, int32_t size);
static char zero_malloc;
char *
-osi_Alloc(int32 size)
+osi_Alloc(int32_t size)
{
if (size == 0)
return &zero_malloc;
@@ -51,7 +51,7 @@ osi_Alloc(int32 size)
}
void
-osi_Free(void *p, int32 size)
+osi_Free(void *p, int32_t size)
{
if (p == &zero_malloc)
return;
diff --git a/usr.sbin/afs/src/rxkad/rxk_clnt.c b/usr.sbin/afs/src/rxkad/rxk_clnt.c
index 06117be55bc..6367e153928 100644
--- a/usr.sbin/afs/src/rxkad/rxk_clnt.c
+++ b/usr.sbin/afs/src/rxkad/rxk_clnt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2000, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,15 +33,15 @@
#include "rxkad_locl.h"
-RCSID("$KTH: rxk_clnt.c,v 1.7 2000/10/03 00:38:22 lha Exp $");
+RCSID("$arla: rxk_clnt.c,v 1.8 2003/01/11 00:50:31 lha Exp $");
/* This code also links into the kernel so we need to use osi_Alloc()
* to avoid calling malloc(). Similar trick with memcpy() */
#undef osi_Alloc
#undef osi_Free
-char *osi_Alloc(int32 size);
-void osi_Free(void *p, int32 size);
+char *osi_Alloc(int32_t size);
+void osi_Free(void *p, int32_t size);
#undef memcpy
#define memcpy(to, from, len) bcopy1((from), (to), (len))
@@ -65,8 +65,8 @@ typedef struct rxkad_clnt_class {
struct rx_securityClass klass;
rxkad_level level;
key_stuff k;
- int32 kvno;
- int32 ticket_len;
+ int32_t kvno;
+ int32_t ticket_len;
char *ticket;
} rxkad_clnt_class;
@@ -183,14 +183,14 @@ client_GetResponse(const struct rx_securityClass *obj_,
}
}
r.encrypted.inc_nonce = htonl(ntohl(c.nonce) + 1);
- r.encrypted.level = htonl((int32)obj->level);
+ r.encrypted.level = htonl((int32_t)obj->level);
r.kvno = htonl(obj->kvno);
r.ticket_len = htonl(obj->ticket_len);
/* Make checksum before we seal r.encrypted */
r.encrypted.cksum = rxkad_cksum_response(&r);
/* Seal r.encrypted */
fc_cbc_enc2(&r.encrypted, &r.encrypted, sizeof(r.encrypted),
- obj->k.keysched, (u_int32*)obj->k.key, ENCRYPT);
+ obj->k.keysched, (uint32_t*)obj->k.key, ENCRYPT);
/* Stuff response and kerberos ticket into packet */
if (rx_SlowWritePacket(pkt, 0, sizeof(r), &r) != sizeof(r))
@@ -283,7 +283,7 @@ int rxkad_min_level = rxkad_clear; /* rxkad_{clear, auth, crypt} */
struct rx_securityClass *
rxkad_NewClientSecurityObject(/*rxkad_level*/ int level,
void *sessionkey,
- int32 kvno,
+ int32_t kvno,
int ticket_len,
char *ticket)
{
@@ -298,10 +298,10 @@ rxkad_NewClientSecurityObject(/*rxkad_level*/ int level,
/* Any good random numbers will do, no real need to use
* cryptographic techniques here */
union {
- u_int32 rnd[2];
+ uint32_t rnd[2];
des_cblock k;
} u;
- int32 sched[ROUNDS];
+ int32_t sched[ROUNDS];
u_long next_epoch;
u.rnd[0] = rx_nextCid;
diff --git a/usr.sbin/afs/src/rxkad/rxk_crpt.c b/usr.sbin/afs/src/rxkad/rxk_crpt.c
index 0c19e3405a8..fc85a93c3c9 100644
--- a/usr.sbin/afs/src/rxkad/rxk_crpt.c
+++ b/usr.sbin/afs/src/rxkad/rxk_crpt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2000, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -53,7 +53,7 @@
# endif
#endif
-RCSID("$KTH: rxk_crpt.c,v 1.12 2000/10/03 00:38:27 lha Exp $");
+RCSID("$arla: rxk_crpt.c,v 1.15 2003/04/09 02:34:16 lha Exp $");
/*
* Unrolling of the inner loops helps the most on pentium chips
@@ -88,9 +88,13 @@ RCSID("$KTH: rxk_crpt.c,v 1.12 2000/10/03 00:38:27 lha Exp $");
#endif
/* Rotate 32 bit word left */
-#define ROT32L(x, n) ((((u_int32) x) << (n)) | (((u_int32) x) >> (32-(n))))
+#undef bswap32
+#undef ROT32L
+
+#define ROT32L(x, n) ((((uint32_t) x) << (n)) | (((uint32_t) x) >> (32-(n))))
#define bswap32(x) (((ROT32L(x, 16) & 0x00ff00ff)<<8) | ((ROT32L(x, 16)>>8) & 0x00ff00ff))
+
#if WORDS_BIGENDIAN
#define NTOH(x) (x)
#else
@@ -109,8 +113,8 @@ RCSID("$KTH: rxk_crpt.c,v 1.12 2000/10/03 00:38:27 lha Exp $");
*/
#if defined(__GNUC__) && (defined(i386) || defined(__i386__))
-static inline u_int32
-bswap(u_int32 x)
+static inline uint32_t
+bswap(uint32_t x)
{
asm("bswap %0" : "=r" (x) : "0" (x));
return x;
@@ -124,7 +128,7 @@ bswap(u_int32 x)
#undef Z
#define Z(x) NTOH(x << 3)
-static const u_int32 sbox0[256] = {
+static const uint32_t sbox0[256] = {
Z(0xea), Z(0x7f), Z(0xb2), Z(0x64), Z(0x9d), Z(0xb0), Z(0xd9), Z(0x11), Z(0xcd), Z(0x86), Z(0x86),
Z(0x91), Z(0x0a), Z(0xb2), Z(0x93), Z(0x06), Z(0x0e), Z(0x06), Z(0xd2), Z(0x65), Z(0x73), Z(0xc5),
Z(0x28), Z(0x60), Z(0xf2), Z(0x20), Z(0xb5), Z(0x38), Z(0x7e), Z(0xda), Z(0x9f), Z(0xe3), Z(0xd2),
@@ -152,7 +156,7 @@ static const u_int32 sbox0[256] = {
#undef Z
#define Z(x) NTOH((x << 27) | (x >> 5))
-static const u_int32 sbox1[256] = {
+static const uint32_t sbox1[256] = {
Z(0x77), Z(0x14), Z(0xa6), Z(0xfe), Z(0xb2), Z(0x5e), Z(0x8c), Z(0x3e), Z(0x67), Z(0x6c), Z(0xa1),
Z(0x0d), Z(0xc2), Z(0xa2), Z(0xc1), Z(0x85), Z(0x6c), Z(0x7b), Z(0x67), Z(0xc6), Z(0x23), Z(0xe3),
Z(0xf2), Z(0x89), Z(0x50), Z(0x9c), Z(0x03), Z(0xb7), Z(0x73), Z(0xe6), Z(0xe1), Z(0x39), Z(0x31),
@@ -180,7 +184,7 @@ static const u_int32 sbox1[256] = {
#undef Z
#define Z(x) NTOH(x << 11)
-static const u_int32 sbox2[256] = {
+static const uint32_t sbox2[256] = {
Z(0xf0), Z(0x37), Z(0x24), Z(0x53), Z(0x2a), Z(0x03), Z(0x83), Z(0x86), Z(0xd1), Z(0xec), Z(0x50),
Z(0xf0), Z(0x42), Z(0x78), Z(0x2f), Z(0x6d), Z(0xbf), Z(0x80), Z(0x87), Z(0x27), Z(0x95), Z(0xe2),
Z(0xc5), Z(0x5d), Z(0xf9), Z(0x6f), Z(0xdb), Z(0xb4), Z(0x65), Z(0x6e), Z(0xe7), Z(0x24), Z(0xc8),
@@ -208,7 +212,7 @@ static const u_int32 sbox2[256] = {
#undef Z
#define Z(x) NTOH(x << 19)
-static const u_int32 sbox3[256] = {
+static const uint32_t sbox3[256] = {
Z(0xa9), Z(0x2a), Z(0x48), Z(0x51), Z(0x84), Z(0x7e), Z(0x49), Z(0xe2), Z(0xb5), Z(0xb7), Z(0x42),
Z(0x33), Z(0x7d), Z(0x5d), Z(0xa6), Z(0x12), Z(0x44), Z(0x48), Z(0x6d), Z(0x28), Z(0xaa), Z(0x20),
Z(0x6d), Z(0x57), Z(0xd6), Z(0x6b), Z(0x5d), Z(0x72), Z(0xf0), Z(0x92), Z(0x5a), Z(0x1b), Z(0x53),
@@ -239,7 +243,7 @@ static const u_int32 sbox3[256] = {
*/
#define F_ENCRYPT(R, L, sched) { \
- union lc4 { u_int32 l; unsigned char c[4]; } u; \
+ union lc4 { uint32_t l; unsigned char c[4]; } u; \
u.l = sched ^ R; \
L ^= sbox0[u.c[0]] ^ sbox1[u.c[1]] ^ sbox2[u.c[2]] ^ sbox3[u.c[3]]; }
@@ -250,17 +254,17 @@ static const u_int32 sbox3[256] = {
#undef F_ENCRYPT
#define FF(y, shiftN) (((y) >> shiftN) & 0xFF)
#define F_ENCRYPT(R, L, sched) { \
- u_int32 u; \
+ uint32_t u; \
u = sched ^ R; \
L ^= sbox0[FF(u, 0)] ^ sbox1[FF(u, 8)] ^ sbox2[FF(u, 16)] ^ sbox3[FF(u, 24)];}
#endif
static inline
void
-fc_ecb_enc(u_int32 l,
- u_int32 r,
- u_int32 out[2],
- const int32 sched[ROUNDS])
+fc_ecb_enc(uint32_t l,
+ uint32_t r,
+ uint32_t out[2],
+ const int32_t sched[ROUNDS])
{
#if !defined(UNROLL_LOOPS)
{
@@ -298,10 +302,10 @@ fc_ecb_enc(u_int32 l,
static inline
void
-fc_ecb_dec(u_int32 l,
- u_int32 r,
- u_int32 out[2],
- const int32 sched[ROUNDS])
+fc_ecb_dec(uint32_t l,
+ uint32_t r,
+ uint32_t out[2],
+ const int32_t sched[ROUNDS])
{
sched = &sched[ROUNDS-1];
@@ -341,17 +345,17 @@ fc_ecb_dec(u_int32 l,
static inline
void
-fc_cbc_enc(const u_int32 *in,
- u_int32 *out,
- int32 length,
- const int32 sched[ROUNDS],
- u_int32 iv[2])
+fc_cbc_enc(const uint32_t *in,
+ uint32_t *out,
+ int32_t length,
+ const int32_t sched[ROUNDS],
+ uint32_t iv[2])
{
- int32 xor0 = iv[0], xor1 = iv[1];
+ int32_t xor0 = iv[0], xor1 = iv[1];
for (; length > 0; length -= 8)
{
- u_int32 b8[2];
+ uint32_t b8[2];
/* If length < 8 we read to much, usally ok */
xor0 ^= in[0];
xor1 ^= in[1];
@@ -370,17 +374,17 @@ fc_cbc_enc(const u_int32 *in,
static inline
void
-fc_cbc_dec(const u_int32 *in,
- u_int32 *out,
- int32 length,
- const int32 sched[ROUNDS],
- u_int32 iv[2])
+fc_cbc_dec(const uint32_t *in,
+ uint32_t *out,
+ int32_t length,
+ const int32_t sched[ROUNDS],
+ uint32_t iv[2])
{
- int32 xor0 = iv[0], xor1 = iv[1];
+ int32_t xor0 = iv[0], xor1 = iv[1];
for (; length > 0; length -= 8)
{
- u_int32 b8[2];
+ uint32_t b8[2];
/* In is always a multiple of 8 */
fc_ecb_dec(in[0], in[1], b8, sched);
b8[0] ^= xor0;
@@ -407,11 +411,11 @@ fc_cbc_dec(const u_int32 *in,
int
fc_ecb_encrypt(const void *in_,
void *out_,
- const int32 sched[ROUNDS],
+ const int32_t sched[ROUNDS],
int encrypt)
{
- const u_int32 *in = in_; /* In must be u_int32 aligned */
- u_int32 *out = out_; /* Out must be u_int32 aligned */
+ const uint32_t *in = in_; /* In must be uint32_t aligned */
+ uint32_t *out = out_; /* Out must be uint32_t aligned */
if (encrypt)
fc_ecb_enc(in[0], in[1], out, sched);
else
@@ -422,13 +426,13 @@ fc_ecb_encrypt(const void *in_,
int
fc_cbc_encrypt(const void *in_,
void *out_,
- int32 length,
- const int32 sched[ROUNDS],
- u_int32 iv[2],
+ int32_t length,
+ const int32_t sched[ROUNDS],
+ uint32_t iv[2],
int encrypt)
{
- const u_int32 *in = in_; /* In must be u_int32 aligned */
- u_int32 *out = out_; /* Out must be u_int32 aligned */
+ const uint32_t *in = in_; /* In must be uint32_t aligned */
+ uint32_t *out = out_; /* Out must be uint32_t aligned */
if (encrypt)
fc_cbc_enc(in, out, length, sched, iv);
else
@@ -438,7 +442,7 @@ fc_cbc_encrypt(const void *in_,
/* Rotate two 32 bit numbers as a 56 bit number */
#define ROT56R(hi, lo, n) { \
- u_int32 t = lo & ((1<<n)-1); \
+ uint32_t t = lo & ((1<<n)-1); \
lo = (lo >> n) | ((hi & ((1<<n)-1)) << (32-n)); \
hi = (hi >> n) | (t << (24-n)); }
@@ -460,7 +464,7 @@ fc_cbc_encrypt(const void *in_,
*/
int
fc_keysched(const void *key_,
- int32 sched[ROUNDS])
+ int32_t sched[ROUNDS])
{
const unsigned char *key = key_;
@@ -486,43 +490,43 @@ fc_keysched(const void *key_,
k |= (*key) >> 1;
/* Use lower 32 bits for schedule, rotate by 11 each round (16 times) */
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
ROT56R64(k, 11);
- *sched++ = EFF_NTOHL((u_int32)k);
+ *sched++ = EFF_NTOHL((uint32_t)k);
return 0;
#else
- u_int32 hi, lo; /* hi is upper 24 bits and lo lower 32, total 56 */
+ uint32_t hi, lo; /* hi is upper 24 bits and lo lower 32, total 56 */
/* Compress out parity bits */
lo = (*key++) >> 1;
@@ -589,12 +593,12 @@ fc_keysched(const void *key_,
*/
int
rxkad_EncryptPacket(const void *rx_connection_not_used,
- const int32 sched[ROUNDS],
- const u_int32 iv[2],
+ const int32_t sched[ROUNDS],
+ const uint32_t iv[2],
int len,
struct rx_packet *packet)
{
- u_int32 ivec[2];
+ uint32_t ivec[2];
struct iovec *frag;
{
@@ -602,7 +606,7 @@ rxkad_EncryptPacket(const void *rx_connection_not_used,
* It turns out that the security header for auth_enc is of
* size 8 bytes and the last 4 bytes are defined to be 0!
*/
- u_int32 *t = (u_int32 *)packet->wirevec[1].iov_base;
+ uint32_t *t = (uint32_t *)packet->wirevec[1].iov_base;
t[1] = 0;
}
@@ -610,7 +614,7 @@ rxkad_EncryptPacket(const void *rx_connection_not_used,
for (frag = &packet->wirevec[1]; len; frag++)
{
int iov_len = frag->iov_len;
- u_int32 *iov_bas = (u_int32 *) frag->iov_base;
+ uint32_t *iov_bas = (uint32_t *) frag->iov_base;
if (iov_len == 0)
return RXKADDATALEN; /* Length mismatch */
if (len < iov_len)
@@ -623,19 +627,19 @@ rxkad_EncryptPacket(const void *rx_connection_not_used,
int
rxkad_DecryptPacket(const void *rx_connection_not_used,
- const int32 sched[ROUNDS],
- const u_int32 iv[2],
+ const int32_t sched[ROUNDS],
+ const uint32_t iv[2],
int len,
struct rx_packet *packet)
{
- u_int32 ivec[2];
+ uint32_t ivec[2];
struct iovec *frag;
memcpy(ivec, iv, sizeof(ivec)); /* Must use copy of iv */
for (frag = &packet->wirevec[1]; len > 0; frag++)
{
int iov_len = frag->iov_len;
- u_int32 *iov_bas = (u_int32 *) frag->iov_base;
+ uint32_t *iov_bas = (uint32_t *) frag->iov_base;
if (iov_len == 0)
return RXKADDATALEN; /* Length mismatch */
if (len < iov_len)
@@ -681,21 +685,19 @@ const char ciph2[] = {
#define rxkad_EncryptPacket _afs_bpwQbdoghO
#endif
-int rx_SlowPutInt32() { abort(); }
-
int
main()
{
- int32 sched[ROUNDS];
+ int32_t sched[ROUNDS];
char ciph[100], clear[100], tmp[100];
- u_int32 data[2];
- u_int32 iv[2];
+ uint32_t data[2];
+ uint32_t iv[2];
struct rx_packet packet;
- if (sizeof(int32) != 4)
- fprintf(stderr, "error: sizeof(int32) != 4\n");
- if (sizeof(u_int32) != 4)
- fprintf(stderr, "error: sizeof(u_int32) != 4\n");
+ if (sizeof(int32_t) != 4)
+ fprintf(stderr, "error: sizeof(int32_t) != 4\n");
+ if (sizeof(uint32_t) != 4)
+ fprintf(stderr, "error: sizeof(uint32_t) != 4\n");
/*
* Use key1 and key2 as iv */
diff --git a/usr.sbin/afs/src/rxkad/rxk_info.c b/usr.sbin/afs/src/rxkad/rxk_info.c
index 4a6a454a275..2338456c0dc 100644
--- a/usr.sbin/afs/src/rxkad/rxk_info.c
+++ b/usr.sbin/afs/src/rxkad/rxk_info.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,16 +33,16 @@
#include "rxkad_locl.h"
-RCSID("$KTH: rxk_info.c,v 1.4 2000/10/03 00:38:33 lha Exp $");
+RCSID("$arla: rxk_info.c,v 1.5 2003/01/11 00:50:32 lha Exp $");
-int32
+int32_t
rxkad_GetServerInfo(struct rx_connection *con,
rxkad_level *level,
- u_int32 *expiration,
+ uint32_t *expiration,
char *name,
char *instance,
char *cell,
- int32 *kvno)
+ int32_t *kvno)
{
serv_con_data *cdat = (serv_con_data *) con->securityData;
diff --git a/usr.sbin/afs/src/rxkad/rxk_locl.c b/usr.sbin/afs/src/rxkad/rxk_locl.c
index f27b623aa96..e1789db8f43 100644
--- a/usr.sbin/afs/src/rxkad/rxk_locl.c
+++ b/usr.sbin/afs/src/rxkad/rxk_locl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#include "rxkad_locl.h"
-RCSID("$KTH: rxk_locl.c,v 1.8 2000/10/03 00:38:38 lha Exp $");
+RCSID("$arla: rxk_locl.c,v 1.9 2003/01/11 00:50:32 lha Exp $");
/* The header checksum is the last 16 bits of this struct after
* encryption. Note that only the last 8 bytes change per packet. */
@@ -46,16 +46,16 @@ struct header_data {
struct const_header_data {
/* Data that is constant per connection */
- u_int32 epoch;
- u_int32 cid;
- u_int32 zero;
- u_int32 security_index;
+ uint32_t epoch;
+ uint32_t cid;
+ uint32_t zero;
+ uint32_t security_index;
};
struct variable_header_data {
/* Data that changes per packet */
- u_int32 call_number;
- u_int32 channel_and_seq;
+ uint32_t call_number;
+ uint32_t channel_and_seq;
};
/* To create a 16 bit packet header checksum we first create an iv
@@ -63,19 +63,19 @@ struct variable_header_data {
*/
void
rxkad_calc_header_iv(const struct rx_connection *conn,
- const int32 *sched,
+ const int32_t *sched,
const des_cblock *in_iv,
- u_int32 *out_iv)
+ uint32_t *out_iv)
{
struct const_header_data h;
- u_int32 *t;
+ uint32_t *t;
h.epoch = htonl(conn->epoch);
h.cid = htonl(conn->cid & RX_CIDMASK);
h.zero = 0;
h.security_index = htonl(conn->securityIndex);
- t = (u_int32 *)in_iv; /* memcpy(out_iv, in_iv, 8); */
+ t = (uint32_t *)in_iv; /* memcpy(out_iv, in_iv, 8); */
out_iv[0] = t[0];
out_iv[1] = t[1];
fc_cbc_encrypt(&h, &h, sizeof(h), sched, out_iv, ENCRYPT);
@@ -93,11 +93,11 @@ rxkad_calc_header_iv(const struct rx_connection *conn,
static
int
rxkad_cksum_header(const struct rx_packet *packet,
- const int32 *sched,
+ const int32_t *sched,
const unsigned int *iv)
{
struct variable_header_data h;
- u_int32 t;
+ uint32_t t;
/* Collect selected packet fields */
h.call_number = htonl(packet->header.callNumber);
@@ -120,11 +120,11 @@ rxkad_cksum_header(const struct rx_packet *packet,
/* Checksum a rxkad_response, this checksum is buried within the
* encrypted part of the response but covers the entire response. */
-u_int32
+uint32_t
rxkad_cksum_response(rxkad_response *r)
{
u_char *t;
- u_int32 cksum = 1000003;
+ uint32_t cksum = 1000003;
for (t = (u_char *)r; t < (u_char*)(r + 1); t++)
cksum = *t + cksum * 0x10204081;
@@ -149,9 +149,9 @@ rxkad_prepare_packet(struct rx_packet *pkt,
if (level != rxkad_clear)
{
- u_int32 *data = (u_int32 *) rx_DataOf(pkt);
- u_int32 t;
- int32 code = 0;
+ uint32_t *data = (uint32_t *) rx_DataOf(pkt);
+ uint32_t t;
+ int32_t code = 0;
assert(pkt->wirevec[1].iov_len >= 4);
@@ -190,7 +190,7 @@ rxkad_prepare_packet(struct rx_packet *pkt,
rx_SetDataSize(pkt, len); /* Set extended packet length */
assert((len % 8) == 0);
- code = rxkad_EncryptPacket(con, k->keysched,(u_int32*)k->key, len,pkt);
+ code = rxkad_EncryptPacket(con, k->keysched,(uint32_t*)k->key, len,pkt);
break;
default:
@@ -224,9 +224,9 @@ rxkad_check_packet(struct rx_packet *pkt,
else
{
u_int len; /* Real packet length */
- u_int32 *data = (u_int32 *) rx_DataOf(pkt);
- u_int32 t;
- int32 code;
+ uint32_t *data = (uint32_t *) rx_DataOf(pkt);
+ uint32_t t;
+ int32_t code;
switch (level) {
case rxkad_auth:
@@ -235,7 +235,7 @@ rxkad_check_packet(struct rx_packet *pkt,
break;
case rxkad_crypt:
- code = rxkad_DecryptPacket(con, k->keysched,(u_int32*)k->key, xlen, pkt);
+ code = rxkad_DecryptPacket(con, k->keysched,(uint32_t*)k->key, xlen, pkt);
if (code)
return code;
break;
diff --git a/usr.sbin/afs/src/rxkad/rxk_serv.c b/usr.sbin/afs/src/rxkad/rxk_serv.c
index 2e18608f773..d3eef933380 100644
--- a/usr.sbin/afs/src/rxkad/rxk_serv.c
+++ b/usr.sbin/afs/src/rxkad/rxk_serv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -37,7 +37,7 @@
#include <krb5.h>
#endif
-RCSID("$KTH: rxk_serv.c,v 1.6 2000/10/03 00:38:44 lha Exp $");
+RCSID("$arla: rxk_serv.c,v 1.11 2003/06/11 15:24:34 lha Exp $");
/* Security object specific server data */
typedef struct rxkad_serv_class {
@@ -113,13 +113,13 @@ server_CreateChallenge(struct rx_securityClass *obj_,
rxkad_serv_class *obj = (rxkad_serv_class *) obj_;
serv_con_data *cdat = (serv_con_data *) con->securityData;
union {
- u_int32 rnd[2];
+ uint32_t rnd[2];
des_cblock k;
} u;
/* Any good random numbers will do, no real need to use
* cryptographic techniques here */
- des_random_key(u.k);
+ des_random_key(&u.k);
cdat->nonce = u.rnd[0] ^ u.rnd[1];
cdat->authenticated = 0;
cdat->cur_level = obj->min_level;
@@ -141,7 +141,7 @@ server_GetChallenge(const struct rx_securityClass *obj,
/* Make challenge */
c.version = htonl(RXKAD_VERSION);
c.nonce = htonl(cdat->nonce);
- c.min_level = htonl((int32)cdat->cur_level);
+ c.min_level = htonl((int32_t)cdat->cur_level);
c.unused = 0; /* Use this to hint client we understand krb5 tickets??? */
/* Stuff into packet */
@@ -156,10 +156,10 @@ int
decode_krb5_ticket(rxkad_serv_class *obj,
int serv_kvno,
char *ticket,
- int32 ticket_len,
+ int32_t ticket_len,
/* OUT parms */
des_cblock session_key,
- u_int32 *expires,
+ uint32_t *expires,
krb_principal *p)
{
#if !defined(KRB5)
@@ -225,6 +225,16 @@ decode_krb5_ticket(rxkad_serv_class *obj,
if (code != 0)
goto bad_ticket;
+ /* Check that the key type really fit into 8 bytes */
+ switch (decr_part.key.etype) {
+ case ETYPE_DES_CBC_CRC:
+ case ETYPE_DES_CBC_MD4:
+ case ETYPE_DES_CBC_MD5:
+ break;
+ default:
+ goto unknown_key;
+ }
+
/* Extract realm and principal */
memset(p, 0x0, sizeof(p));
strncpy(p->realm, decr_part.crealm, REALM_SZ - 1);
@@ -285,16 +295,16 @@ int
decode_krb4_ticket(rxkad_serv_class *obj,
int serv_kvno,
char *ticket,
- int32 ticket_len,
+ int32_t ticket_len,
/* OUT parms */
des_cblock session_key,
- u_int32 *expires,
+ uint32_t *expires,
krb_principal *p)
{
u_char kflags;
int klife;
- u_int32 start;
- u_int32 paddress;
+ uint32_t start;
+ uint32_t paddress;
char sname[SNAME_SZ], sinstance[INST_SZ];
KTEXT_ST tkt;
des_cblock serv_key; /* Service's secret key */
@@ -348,12 +358,12 @@ server_CheckResponse(struct rx_securityClass *obj_,
serv_con_data *cdat = (serv_con_data *) con->securityData;
int serv_kvno; /* Service's kvno we used */
- int32 ticket_len;
+ int32_t ticket_len;
char ticket[MAXKRB5TICKETLEN];
int code;
rxkad_response r;
krb_principal p;
- u_int32 cksum;
+ uint32_t cksum;
if (rx_SlowReadPacket(pkt, 0, sizeof(r), &r) != sizeof(r))
return RXKADPACKETSHORT;
@@ -381,7 +391,7 @@ server_CheckResponse(struct rx_securityClass *obj_,
/* Unseal r.encrypted */
fc_cbc_enc2(&r.encrypted, &r.encrypted, sizeof(r.encrypted),
- cdat->k.keysched, (u_int32*)cdat->k.key, DECRYPT);
+ cdat->k.keysched, (uint32_t*)cdat->k.key, DECRYPT);
/* Verify response integrity */
cksum = r.encrypted.cksum;
@@ -528,7 +538,7 @@ rxkad_NewServerSecurityObject(/*rxkad_level*/ int min_level,
void *appl_data,
int (*get_key)(void *appl_data,
int kvno,
- des_cblock *key),
+ void *opaque_key),
int (*user_ok)(char *name,
char *inst,
char *realm,
@@ -546,7 +556,7 @@ rxkad_NewServerSecurityObject(/*rxkad_level*/ int min_level,
obj->min_level = min_level;
obj->appl_data = appl_data;
- obj->get_key = get_key;
+ obj->get_key = (void *)get_key;
obj->user_ok = user_ok;
return &obj->klass;
diff --git a/usr.sbin/afs/src/rxkad/rxkad.h b/usr.sbin/afs/src/rxkad/rxkad.h
index 2b617dad87f..5be5e965d54 100644
--- a/usr.sbin/afs/src/rxkad/rxkad.h
+++ b/usr.sbin/afs/src/rxkad/rxkad.h
@@ -1,7 +1,7 @@
/* -*- C -*- */
/*
- * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*/
-/* @(#)$KTH: rxkad.h,v 1.8.2.1 2001/10/03 22:55:31 assar Exp $ */
+/* @(#)$arla: rxkad.h,v 1.11 2003/06/10 16:15:39 lha Exp $ */
#ifndef __RXKAD_H
#define __RXKAD_H
@@ -51,6 +51,7 @@
/* Is this really large enough for a krb5 ticket? */
#define MAXKRB5TICKETLEN 1024
+#define MAXKRB4TICKETLEN 1024
typedef char rxkad_level;
#define rxkad_clear 0 /* checksum some selected header fields */
@@ -64,20 +65,22 @@ extern int rxkad_EpochWasSet;
#define __P(x) x
#endif
-int32 rxkad_GetServerInfo __P((struct rx_connection *con,
+struct rx_connection;
+
+int32_t rxkad_GetServerInfo __P((struct rx_connection *con,
rxkad_level *level,
- u_int32 *expiration,
+ uint32_t *expiration,
char *name,
char *instance,
char *cell,
- int32 *kvno));
+ int32_t *kvno));
struct rx_securityClass *
rxkad_NewServerSecurityObject __P((/*rxkad_level*/ int min_level,
void *appl_data,
int (*get_key)(void *appl_data,
int kvno,
- des_cblock *key),
+ void *key),
int (*user_ok)(char *name,
char *inst,
char *realm,
@@ -86,7 +89,7 @@ rxkad_NewServerSecurityObject __P((/*rxkad_level*/ int min_level,
struct rx_securityClass *
rxkad_NewClientSecurityObject __P((/*rxkad_level*/ int level,
void *sessionkey,
- int32 kvno,
+ int32_t kvno,
int ticketLen,
char *ticket));
@@ -136,32 +139,32 @@ struct ktc_principal {
char cell[MAXKTCREALMLEN];
};
-u_int32 life_to_time __P((u_int32 start, int life_));
+uint32_t life_to_time __P((uint32_t start, int life_));
-int time_to_life __P((u_int32 start, u_int32 end));
+int time_to_life __P((uint32_t start, uint32_t end));
-int tkt_CheckTimes __P((int32 begin, int32 end, int32 now));
+int tkt_CheckTimes __P((int32_t begin, int32_t end, int32_t now));
int
tkt_MakeTicket __P((char *ticket,
int *ticketLen,
struct ktc_encryptionKey *key,
char *name, char *inst, char *cell,
- u_int32 start, u_int32 end,
+ uint32_t start, uint32_t end,
struct ktc_encryptionKey *sessionKey,
- u_int32 host,
+ uint32_t host,
char *sname, char *sinst));
int
tkt_DecodeTicket __P((char *asecret,
- int32 ticketLen,
+ int32_t ticketLen,
struct ktc_encryptionKey *key,
char *name,
char *inst,
char *cell,
char *sessionKey,
- int32 *host,
- int32 *start,
- int32 *end));
+ int32_t *host,
+ int32_t *start,
+ int32_t *end));
#endif /* __RXKAD_H */
diff --git a/usr.sbin/afs/src/rxkad/rxkad_locl.h b/usr.sbin/afs/src/rxkad/rxkad_locl.h
index fa480af5dc7..6c25b4ce6dd 100644
--- a/usr.sbin/afs/src/rxkad/rxkad_locl.h
+++ b/usr.sbin/afs/src/rxkad/rxkad_locl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -31,12 +31,12 @@
* SUCH DAMAGE.
*/
-/* @(#)$KTH: rxkad_locl.h,v 1.10 2000/10/03 00:38:55 lha Exp $ */
+/* @(#)$arla: rxkad_locl.h,v 1.14 2003/06/12 05:32:16 lha Exp $ */
#ifndef __RXKAD_LOCL_H
#define __RXKAD_LOCL_H
-/* $KTH: rxkad_locl.h,v 1.10 2000/10/03 00:38:55 lha Exp $ */
+/* $arla: rxkad_locl.h,v 1.14 2003/06/12 05:32:16 lha Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -49,11 +49,6 @@
#include <sys/types.h>
#include <netinet/in.h>
-#ifdef USE_MMAPTIME
-#include <mmaptime.h>
-#define gettimeofday mmaptime_gettimeofday
-#endif
-
#ifdef NDEBUG
#ifndef assert
#define assert(e) ((void)0)
@@ -64,8 +59,14 @@
#endif
#endif
+#ifdef HAVE_OPENSSL
+#include <openssl/des.h>
+#else
#include <des.h>
+#endif
+#ifdef HAVE_KRB4
#include <krb.h>
+#endif /* HAVE_KRB4 */
#undef RCSID
#include <rx/rx.h>
@@ -86,39 +87,39 @@ extern int rx_epoch, rx_nextCid;
#define ROUNDS 16
-int fc_keysched(const void *key_, int32 sched[ROUNDS]);
+int fc_keysched(const void *key_, int32_t sched[ROUNDS]);
-/* In_ and out_ MUST be u_int32 aligned */
+/* In_ and out_ MUST be uint32_t aligned */
int fc_ecb_encrypt(const void *in_, void *out_,
- const int32 sched[ROUNDS], int encrypt);
+ const int32_t sched[ROUNDS], int encrypt);
-/* In_ and out_ MUST be u_int32 aligned */
-int fc_cbc_encrypt(const void *in_, void *out_, int32 length,
- const int32 sched[ROUNDS], u_int32 iv[2],
+/* In_ and out_ MUST be uint32_t aligned */
+int fc_cbc_encrypt(const void *in_, void *out_, int32_t length,
+ const int32_t sched[ROUNDS], uint32_t iv[2],
int encrypt);
int rxkad_EncryptPacket(const void *rx_connection_not_used,
- const int32 sched[ROUNDS], const u_int32 iv[2],
+ const int32_t sched[ROUNDS], const uint32_t iv[2],
int len, struct rx_packet *packet);
int rxkad_DecryptPacket(const void *rx_connection_not_used,
- const int32 sched[ROUNDS], const u_int32 iv[2],
+ const int32_t sched[ROUNDS], const uint32_t iv[2],
int len, struct rx_packet *packet);
#ifdef __GNUC__
static inline
void
-fc_cbc_enc2(const void *in, void *out, int32 length, const int32 sched[ROUNDS],
- const u_int32 iv_[2], int encrypt)
+fc_cbc_enc2(const void *in, void *out, int32_t length, const int32_t sched[ROUNDS],
+ const uint32_t iv_[2], int encrypt)
{
- u_int32 iv[2];
+ uint32_t iv[2];
iv[0] = iv_[0];
iv[1] = iv_[1];
fc_cbc_encrypt(in, out, length, sched, iv, encrypt);
}
#else
#define fc_cbc_enc2(in, out, length, sched, iv_, encrypt) \
-{ u_int32 _iv_[2]; u_int32 *_tmp_ = (iv_); \
+{ uint32_t _iv_[2]; uint32_t *_tmp_ = (iv_); \
memcpy(_iv_, _tmp_, 8); \
fc_cbc_encrypt((in), (out), (length), (sched), (_iv_), (encrypt)); }
#endif
@@ -127,49 +128,49 @@ fc_cbc_enc2(const void *in, void *out, int32 length, const int32 sched[ROUNDS],
/* Version 2 challenge format */
typedef struct rxkad_challenge {
- int32 version;
- int32 nonce;
- int32 min_level;
- int32 unused;
+ int32_t version;
+ int32_t nonce;
+ int32_t min_level;
+ int32_t unused;
} rxkad_challenge;
/* To protect the client from being used as an oracle the response
* contains connection specific information. */
typedef struct rxkad_response {
- int32 version;
- int32 unused;
+ int32_t version;
+ int32_t unused;
struct {
- int32 epoch;
- int32 cid;
- u_int32 cksum; /* Cksum of this response */
- int32 security_index;
- int32 call_numbers[RX_MAXCALLS];
- int32 inc_nonce;
- int32 level;
+ int32_t epoch;
+ int32_t cid;
+ uint32_t cksum; /* Cksum of this response */
+ int32_t security_index;
+ int32_t call_numbers[RX_MAXCALLS];
+ int32_t inc_nonce;
+ int32_t level;
} encrypted;
- int32 kvno;
- int32 ticket_len;
+ int32_t kvno;
+ int32_t ticket_len;
/* u_char the_ticket[ticket_len]; */
} rxkad_response;
typedef struct key_stuff {
- int32 keysched[ROUNDS];
+ int32_t keysched[ROUNDS];
des_cblock key;
} key_stuff;
typedef struct end_stuff {
- u_int32 header_iv[2];
- u_int32 bytesReceived, packetsReceived, bytesSent, packetsSent;
+ uint32_t header_iv[2];
+ uint32_t bytesReceived, packetsReceived, bytesSent, packetsSent;
} end_stuff;
-u_int32
+uint32_t
rxkad_cksum_response(rxkad_response *r);
void
rxkad_calc_header_iv(const struct rx_connection *conn,
- const int32 sched[ROUNDS],
+ const int32_t sched[ROUNDS],
const des_cblock *in_iv,
- u_int32 out_iv[2]);
+ uint32_t out_iv[2]);
int
rxkad_prepare_packet(struct rx_packet *pkt, struct rx_connection *con,
@@ -179,15 +180,19 @@ int
rxkad_check_packet(struct rx_packet *pkt, struct rx_connection *con,
int level, key_stuff *k, end_stuff *e);
+#ifdef HAVE_KRB4
+
/* Per connection specific server data */
typedef struct serv_con_data {
end_stuff e;
key_stuff k;
- u_int32 expires;
- int32 nonce;
+ uint32_t expires;
+ int32_t nonce;
krb_principal *user;
rxkad_level cur_level; /* Starts at min_level and can only increase */
char authenticated;
} serv_con_data;
+#endif
+
#endif /* __RXKAD_LOCL_H */
diff --git a/usr.sbin/afs/src/util/bool.h b/usr.sbin/afs/src/util/bool.h
index 6ee8a06939e..fdf90dd177f 100644
--- a/usr.sbin/afs/src/util/bool.h
+++ b/usr.sbin/afs/src/util/bool.h
@@ -35,10 +35,10 @@
* Boolean
*/
-/* $KTH: bool.h,v 1.4 2000/10/03 00:30:38 lha Exp $ */
+/* $arla: bool.h,v 1.5 2003/01/10 12:38:40 lha Exp $ */
-#ifndef _BOOL_
-#define _BOOL_
+#ifndef _ARLAUTIL_BOOL_H
+#define _ARLAUTIL_BOOL_H 1
#ifndef FALSE
@@ -65,4 +65,4 @@ typedef int Bool;
#endif /* FALSE */
-#endif /* _BOOL_ */
+#endif /* _ARLAUTIL_BOOL_H */
diff --git a/usr.sbin/afs/src/util/hash.c b/usr.sbin/afs/src/util/hash.c
index 12143f903d6..7777335af5d 100644
--- a/usr.sbin/afs/src/util/hash.c
+++ b/usr.sbin/afs/src/util/hash.c
@@ -37,7 +37,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: hash.c,v 1.14.2.1 2001/08/31 18:10:43 ahltorp Exp $");
+RCSID("$arla: hash.c,v 1.18 2002/05/23 15:21:41 lha Exp $");
#endif
#include <assert.h>
@@ -47,31 +47,85 @@ RCSID("$KTH: hash.c,v 1.14.2.1 2001/08/31 18:10:43 ahltorp Exp $");
#include <ctype.h>
#include <bool.h>
#include <hash.h>
+#include <arlamath.h>
+
+struct ht_bucket {
+ Hashentry *e;
+ int len;
+};
+
+
+struct hashtab { /* Hash table */
+ int (*cmp)(void *, void *); /* Compare function */
+ unsigned (*hash)(void *); /* hash function */
+ int flags; /* flags */
+ int sz; /* Size */
+ int maxbucketlen; /* max bucket length */
+ struct ht_bucket *tab; /* The table */
+};
+
+struct hashentry { /* Entry in bucket */
+ struct hashentry **prev;
+ struct hashentry *next;
+ void *ptr;
+};
+
+#define HASHTAB_INITAL_SIZE 17
+#define HASHTAB_MAX_BUCKET_LEN 20
static Hashentry *_search(Hashtab * htab, /* The hash table */
void *ptr); /* And key */
+static void *_add(Hashtab * htab,
+ void *ptr,
+ Bool unique);
+
+static void _might_resize(Hashtab *htab, /* The hash table */
+ int bucket_len); /* Hash bucket len */
Hashtab *
hashtabnew(int sz,
int (*cmp) (void *, void *),
unsigned (*hash) (void *))
{
+ return hashtabnewf(sz, cmp, hash, 0);
+}
+
+Hashtab *
+hashtabnewf(int sz,
+ int (*cmp) (void *, void *),
+ unsigned (*hash) (void *),
+ int flags)
+{
Hashtab *htab;
int i;
- assert(sz > 0);
+ assert(sz > 0 || (flags & HASHTAB_GROW));
- htab = (Hashtab *) malloc(sizeof(Hashtab) + (sz - 1) * sizeof(Hashentry *));
+ htab = (Hashtab *) malloc(sizeof(Hashtab));
if (htab == NULL)
return NULL;
- for (i = 0; i < sz; ++i)
- htab->tab[i] = NULL;
+ if (sz == 0 && (flags & HASHTAB_GROW))
+ sz = HASHTAB_INITAL_SIZE;
+
+ htab->tab = malloc(sz * sizeof(struct ht_bucket));
+ if (htab->tab == NULL){
+ free(htab);
+ return NULL;
+ }
+
+ for (i = 0; i < sz; ++i) {
+ htab->tab[i].e = NULL;
+ htab->tab[i].len = 0;
+ }
htab->cmp = cmp;
htab->hash = hash;
htab->sz = sz;
+ htab->maxbucketlen = HASHTAB_MAX_BUCKET_LEN;
+ htab->flags = flags;
+
return htab;
}
@@ -84,7 +138,7 @@ _search(Hashtab * htab, void *ptr)
assert(htab && ptr);
- for (hptr = htab->tab[(*htab->hash) (ptr) % htab->sz];
+ for (hptr = htab->tab[(*htab->hash) (ptr) % htab->sz].e;
hptr;
hptr = hptr->next)
if ((*htab->cmp) (ptr, hptr->ptr) == 0)
@@ -92,6 +146,48 @@ _search(Hashtab * htab, void *ptr)
return hptr;
}
+/* Interal resize function */
+
+static Bool
+_resize(void *ptr, void *arg)
+{
+ Hashtab *h = arg;
+ _add(h, ptr, TRUE);
+ return TRUE;
+}
+
+static void
+_might_resize(Hashtab *htab, int bucket_len)
+{
+ if (bucket_len > htab->maxbucketlen) {
+ Hashtab *nhtab;
+ struct ht_bucket *tab;
+ int new_size, old_size;
+
+ new_size = arlautil_findprime(htab->sz * 2);
+ assert (new_size > htab->sz);
+
+ nhtab = hashtabnewf(new_size, htab->cmp,
+ htab->hash, htab->flags);
+ if (nhtab == NULL)
+ return;
+
+ hashtabcleantab(htab, _resize, nhtab);
+
+ /* switch place between the tab and size */
+ tab = htab->tab;
+ htab->tab = nhtab->tab;
+ nhtab->tab = tab;
+
+ old_size = htab->sz;
+ htab->sz = nhtab->sz;
+ nhtab->sz = old_size;
+
+ hashtabrelease(nhtab);
+ }
+}
+
+
/* Search for element in hash table */
void *
@@ -112,6 +208,7 @@ _add(Hashtab * htab, void *ptr, Bool unique)
{
Hashentry *h = _search(htab, ptr);
Hashentry **tabptr;
+ struct ht_bucket *hb;
assert(htab && ptr);
@@ -119,19 +216,24 @@ _add(Hashtab * htab, void *ptr, Bool unique)
if (unique)
return NULL;
free((void *) h->ptr);
+ h->ptr = ptr;
} else {
h = (Hashentry *) malloc(sizeof(Hashentry));
if (h == NULL) {
return NULL;
}
- tabptr = &htab->tab[(*htab->hash) (ptr) % htab->sz];
+ hb = &htab->tab[(*htab->hash) (ptr) % htab->sz];
+ hb->len++;
+ tabptr = &hb->e;
h->next = *tabptr;
*tabptr = h;
h->prev = tabptr;
if (h->next)
h->next->prev = &h->next;
+ h->ptr = ptr;
+ if (htab->flags & HASHTAB_GROW)
+ _might_resize(htab, hb->len);
}
- h->ptr = ptr;
return h;
}
@@ -174,12 +276,13 @@ void
hashtabforeach(Hashtab * htab, Bool(*func) (void *ptr, void *arg),
void *arg)
{
- Hashentry **h, *g, *next;
+ struct ht_bucket *h;
+ Hashentry *g, *next;
assert(htab);
for (h = htab->tab; h < &htab->tab[htab->sz]; ++h)
- for (g = *h; g; g = next) {
+ for (g = h->e; g; g = next) {
next = g->next;
if ((*func) (g->ptr, arg))
return;
@@ -193,18 +296,21 @@ void
hashtabcleantab(Hashtab * htab, Bool(*cond) (void *ptr, void *arg),
void *arg)
{
- Hashentry **h, *g, *f;
+ struct ht_bucket *h;
+ Hashentry *g, *f;
assert(htab);
for (h = htab->tab; h < &htab->tab[htab->sz]; ++h) {
- for (g = *h; g;) {
+ for (g = h->e; g;) {
if ((*cond) (g->ptr, arg)) {
f = g ;
g = g->next ;
if ((*(f->prev) = f->next))
f->next->prev = f->prev;
free(f);
+ assert(h->len > 0);
+ h->len--;
} else {
g = g->next;
}
@@ -224,6 +330,7 @@ void
hashtabrelease(Hashtab *htab)
{
hashtabcleantab(htab, true_cond, NULL);
+ free(htab->tab);
free(htab);
}
diff --git a/usr.sbin/afs/src/util/hash.h b/usr.sbin/afs/src/util/hash.h
index 38f55219230..c8095aa3905 100644
--- a/usr.sbin/afs/src/util/hash.h
+++ b/usr.sbin/afs/src/util/hash.h
@@ -35,24 +35,16 @@
* hash.h. Header file for hash table functions
*/
-/* $KTH: hash.h,v 1.6.2.1 2001/08/31 18:09:17 ahltorp Exp $ */
+/* $arla: hash.h,v 1.8 2002/05/12 16:02:33 lha Exp $ */
#include <bool.h>
-struct hashentry { /* Entry in bucket */
- struct hashentry **prev;
- struct hashentry *next;
- void *ptr;
-};
+#define HASHTAB_GROW 0x01
+struct hashentry;
typedef struct hashentry Hashentry;
-struct hashtab { /* Hash table */
- int (*cmp)(void *, void *); /* Compare function */
- unsigned (*hash)(void *); /* hash function */
- int sz; /* Size */
- Hashentry *tab[1]; /* The table */
-};
+struct hashtab;
typedef struct hashtab Hashtab;
typedef int (*hashtabnew_arg2_t)(void *, void *);
@@ -64,6 +56,11 @@ Hashtab *hashtabnew(int sz,
int (*cmp)(void *, void *),
unsigned (*hash)(void *)); /* Make new hash table */
+Hashtab *hashtabnewf(int sz,
+ int (*cmp)(void *, void *),
+ unsigned (*hash)(void *),
+ int flags); /* Make new hash table */
+
void *hashtabsearch(Hashtab *htab, /* The hash table */
void *ptr); /* The key */
diff --git a/usr.sbin/afs/src/util/heap.c b/usr.sbin/afs/src/util/heap.c
index 7cc4e71db6f..5142c13e6bb 100644
--- a/usr.sbin/afs/src/util/heap.c
+++ b/usr.sbin/afs/src/util/heap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1998 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -37,7 +37,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: heap.c,v 1.2.2.1 2001/03/12 16:49:07 lha Exp $");
+RCSID("$arla: heap.c,v 1.5 2003/01/11 00:18:24 lha Exp $");
#endif
#include <assert.h>
@@ -241,6 +241,8 @@ heap_remove (Heap *h, heap_ptr ptr)
if (h->sz == 0)
return -1;
+ assert (h->data[ptr].ptr != &dummy);
+
remove_this (h, ptr);
return 0;
}
diff --git a/usr.sbin/afs/src/util/heap.h b/usr.sbin/afs/src/util/heap.h
index 02766c20b46..d62d1c3f4df 100644
--- a/usr.sbin/afs/src/util/heap.h
+++ b/usr.sbin/afs/src/util/heap.h
@@ -35,10 +35,10 @@
* an abstract heap implementation
*/
-/* $KTH: heap.h,v 1.2 2000/10/03 00:30:58 lha Exp $ */
+/* $arla: heap.h,v 1.3 2003/01/10 12:38:42 lha Exp $ */
-#ifndef _HEAP_
-#define _HEAP_
+#ifndef _ARLAUTIL_HEAP_H
+#define _ARLAUTIL_HEAP_H 1
#include "bool.h"
@@ -82,4 +82,4 @@ heap_delete (Heap *h);
Bool
heap_verify (Heap *h);
-#endif /* _HEAP_ */
+#endif /* _ARLAUTIL_HEAP_H */
diff --git a/usr.sbin/afs/src/util/heaptest.c b/usr.sbin/afs/src/util/heaptest.c
index 74b09b96be4..5e942e834ac 100644
--- a/usr.sbin/afs/src/util/heaptest.c
+++ b/usr.sbin/afs/src/util/heaptest.c
@@ -35,7 +35,7 @@
#include <config.h>
#endif
-RCSID("$KTH: heaptest.c,v 1.3 2000/10/03 00:31:03 lha Exp $");
+RCSID("$arla: heaptest.c,v 1.3 2000/10/03 00:31:03 lha Exp $");
#include <stdio.h>
#include <stdlib.h>
diff --git a/usr.sbin/afs/src/util/list.c b/usr.sbin/afs/src/util/list.c
index cc70742d517..7eaac166870 100644
--- a/usr.sbin/afs/src/util/list.c
+++ b/usr.sbin/afs/src/util/list.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998, 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -37,7 +37,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: list.c,v 1.11 2000/10/03 00:31:09 lha Exp $");
+RCSID("$arla: list.c,v 1.12 2002/04/20 17:06:21 lha Exp $");
#endif
#include <assert.h>
@@ -65,6 +65,17 @@ listnew (void)
}
/*
+ * Free a list, assume that its empty
+ */
+
+void
+listfree(List *list)
+{
+ list->head = list->tail = NULL;
+ free(list);
+}
+
+/*
* Add an element before `item'
*/
diff --git a/usr.sbin/afs/src/util/list.h b/usr.sbin/afs/src/util/list.h
index cc9e877c868..55ccba4fc85 100644
--- a/usr.sbin/afs/src/util/list.h
+++ b/usr.sbin/afs/src/util/list.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -35,10 +35,10 @@
* list handling functions
*/
-/* $KTH: list.h,v 1.10 2000/10/03 00:31:14 lha Exp $ */
+/* $arla: list.h,v 1.13 2003/01/10 12:38:43 lha Exp $ */
-#ifndef _LIST_
-#define _LIST_
+#ifndef _ARLAUTIL_LIST_H
+#define _ARLAUTIL_LIST_H 1
#include "bool.h"
#include <roken.h>
@@ -62,6 +62,8 @@ typedef struct list List;
List *listnew (void);
+void listfree(List *);
+
Listitem *listaddhead (List *list, void *data);
Listitem *listaddtail (List *list, void *data);
@@ -125,4 +127,4 @@ listnextp(Listitem *item)
return (Bool)(item->next != NULL);
}
-#endif /* _LIST_ */
+#endif /* _ARLAUTIL_LIST_H */
diff --git a/usr.sbin/afs/src/util/log.c b/usr.sbin/afs/src/util/log.c
index 2bb4ab7f349..454e4fe6ea0 100644
--- a/usr.sbin/afs/src/util/log.c
+++ b/usr.sbin/afs/src/util/log.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -37,7 +37,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: log.c,v 1.28.2.2 2001/04/30 02:55:41 lha Exp $");
+RCSID("$arla: log.c,v 1.38 2003/03/13 14:50:58 lha Exp $");
#endif
#include <sys/types.h>
@@ -97,6 +97,7 @@ struct log_method_file_data {
FILE *f;
int flags;
#define LOGFILE_NO_TIME 1
+ char *progname;
};
#if HAVE_SYSLOG
@@ -281,14 +282,14 @@ log_open_syslog (Log_method *lm, const char *progname, char *fname,
static void
log_vprint_syslog (Log_method *lm, char *fmt, va_list args)
{
- vsyslog (LOG_INFO, fmt, args);
+ vsyslog (LOG_NOTICE, fmt, args);
}
#endif /* HAVE_VSYSLOG */
static void
log_print_syslog (Log_method *lm, char *str)
{
- syslog (LOG_INFO, "%s", str);
+ syslog (LOG_NOTICE, "%s", str);
}
static void
@@ -325,6 +326,19 @@ file_parse_extra(FILE *f, char *extra_args)
}
static void
+log_open_file_common(struct log_method_file_data *data,
+ const char *progname, char *extra_args)
+{
+ if (progname != NULL)
+ data->progname = strdup(progname);
+ else
+ progname = "unknown-program";
+ if (data->progname == NULL)
+ data->progname = "out of memory";
+ data->flags = file_parse_extra(data->f, extra_args);
+}
+
+static void
log_open_stderr (Log_method *lm, const char *progname, char *fname,
char *extra_args)
{
@@ -335,7 +349,7 @@ log_open_stderr (Log_method *lm, const char *progname, char *fname,
lm->data.v = data;
data->f = stderr;
- data->flags = file_parse_extra(stderr, extra_args);
+ log_open_file_common(data, progname, extra_args);
}
static void
@@ -351,7 +365,7 @@ log_open_file (Log_method *lm, const char *progname, char *fname,
data->f = fopen (fname, "a");
if (data->f == NULL)
data->f = stderr;
- data->flags = file_parse_extra(data->f, extra_args);
+ log_open_file_common(data, progname, extra_args);
}
static void
@@ -383,13 +397,13 @@ log_vprint_file (Log_method *lm, char *fmt, va_list args)
struct tm tm;
gettimeofday(&tv, NULL);
t = tv.tv_sec;
- strftime(time, sizeof(time), "%Y-%m-%d %H:%M:%S",
+ strftime(time, sizeof(time), "%Y-%m-%d %H:%M:%S %Z",
localtime_r(&t, &tm));
time[sizeof(time)-1] = '\0';
fprintf (f, "%s: ", time);
}
- fprintf (f, "%s: ", __progname);
+ fprintf (f, "%s: ", data->progname);
vfprintf (f, fmt, args);
putc ('\n', f);
fflush (f);
@@ -407,17 +421,17 @@ Log_method *
log_open (const char *progname, char *fname)
{
int i;
- Log_method *log;
+ Log_method *logm;
char *name, *extra;
name = strdup(fname);
if (name == NULL)
return NULL;
- log = (Log_method *)malloc (sizeof(Log_method));
- if (log == NULL) {
+ logm = (Log_method *)malloc (sizeof(Log_method));
+ if (logm == NULL) {
free (name);
- return log;
+ return logm;
}
for (i = 0; i < sizeof(special_names) / sizeof(*special_names);
++i) {
@@ -428,17 +442,17 @@ log_open (const char *progname, char *fname)
|| (strncmp (special_names[i].name, fname, len) == 0 &&
(special_names[i].name[len] == '\0'
|| special_names[i].name[len] == ':'))) {
- *log = special_names[i];
+ *logm = special_names[i];
break;
}
}
extra = name;
strsep(&extra, ":");
- log->num_units = 0;
- log->units = NULL;
- (*log->open)(log, progname, name, extra);
+ logm->num_units = 0;
+ logm->units = NULL;
+ (*logm->open)(logm, progname, name, extra);
free (name);
- return log;
+ return logm;
}
log_flags
@@ -458,9 +472,9 @@ log_getflags(Log_method *method)
}
void
-log_set_mask (Log_unit *log, unsigned m)
+log_set_mask (Log_unit *logu, unsigned m)
{
- log->mask = m;
+ logu->mask = m;
}
unsigned
@@ -532,12 +546,12 @@ log_vlog(Log_unit *unit, unsigned level, const char *fmt, va_list args)
void
-log_log (Log_unit *log, unsigned level, const char *fmt, ...)
+log_log (Log_unit *logu, unsigned level, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
- log_vlog(log, level, fmt, args);
+ log_vlog(logu, level, fmt, args);
va_end (args);
}
@@ -581,13 +595,13 @@ log_unit_init (Log_method *method, const char *name, struct units *unit,
}
void
-log_unit_free (Log_method *method, Log_unit *log)
+log_unit_free (Log_method *method, Log_unit *logu)
{
Log_unit **list;
int i;
for (i = 0; i < method->num_units; i++)
- if (log == method->units[method->num_units])
+ if (logu == method->units[method->num_units])
break;
if (i < method->num_units - 1)
memmove (&method->units[i], &method->units[i+1],
@@ -599,12 +613,12 @@ log_unit_free (Log_method *method, Log_unit *log)
abort();
method->units = list;
- free (log->name);
- assert (log->method == method);
- log->name = NULL;
- log->unit = NULL;
- log->mask = 0;
- free (log);
+ free (logu->name);
+ assert (logu->method == method);
+ logu->name = NULL;
+ logu->unit = NULL;
+ logu->mask = 0;
+ free (logu);
}
static int
diff --git a/usr.sbin/afs/src/util/log.h b/usr.sbin/afs/src/util/log.h
index fe20ee59a5f..9fb7250a2bc 100644
--- a/usr.sbin/afs/src/util/log.h
+++ b/usr.sbin/afs/src/util/log.h
@@ -31,14 +31,18 @@
* SUCH DAMAGE.
*/
-/* $KTH: log.h,v 1.8.2.1 2001/04/29 23:53:31 lha Exp $ */
+/* $arla: log.h,v 1.12 2003/01/10 12:38:44 lha Exp $ */
-#ifndef _LOG_
-#define _LOG_
+#ifndef _ARLAUTIL_LOG_H
+#define _ARLAUTIL_LOG_H 1
#include <stdarg.h>
#include <parse_units.h>
+#if !defined(__GNUC__) && !defined(__attribute__)
+#define __attribute__(x)
+#endif
+
typedef enum {
LOG_CPU_USAGE = 1
} log_flags;
@@ -54,32 +58,32 @@ Log_method *log_open (const char *progname, char *fname);
/* Starting logging to `fname'. Label all messages as coming from
* `progname'. */
-void log_close (Log_method *log);
+void log_close (Log_method *logm);
Log_unit *log_unit_init (Log_method *method, const char *name,
struct units *lognames,
unsigned long default_mask);
-void log_unit_free (Log_method *method, Log_unit *log);
+void log_unit_free (Log_method *method, Log_unit *logu);
-log_flags log_setflags(Log_method *log, log_flags flags);
-log_flags log_getflags(Log_method *log);
+log_flags log_setflags(Log_method *logm, log_flags flags);
+log_flags log_getflags(Log_method *logm);
-void log_log (Log_unit *log, unsigned level, const char *fmt, ...)
+void log_log (Log_unit *logu, unsigned level, const char *fmt, ...)
__attribute__((format (printf, 3, 4)))
;
-void log_vlog(Log_unit *log, unsigned level, const char *fmt, va_list args)
+void log_vlog(Log_unit *logu, unsigned level, const char *fmt, va_list args)
__attribute__((format (printf, 3, 0)))
;
-unsigned log_get_mask (Log_unit *log);
+unsigned log_get_mask (Log_unit *logu);
-void log_set_mask (Log_unit *log, unsigned mask);
+void log_set_mask (Log_unit *logu, unsigned mask);
void log_set_mask_str (Log_method *method, Log_unit *default_unit,
const char *str);
size_t log_mask2str (Log_method *method, Log_unit *unit, char *buf, size_t sz);
-#endif /* _LOG_ */
+#endif /* _ARLAUTIL_LOG_H */
diff --git a/usr.sbin/afs/src/util/log_log.3 b/usr.sbin/afs/src/util/log_log.3
index a0c4c5d7ef4..169ff13ffde 100644
--- a/usr.sbin/afs/src/util/log_log.3
+++ b/usr.sbin/afs/src/util/log_log.3
@@ -1,5 +1,5 @@
.\" Copyright (c) 2000 Kungliga Tekniska Högskolan
-.\" $KTH: log_log.3,v 1.5 2000/09/04 05:34:16 lha Exp $
+.\" $arla: log_log.3,v 1.6 2002/10/17 09:18:06 lha Exp $
.Dd August 24, 2000
.Dt LOG_LOG
.Os UTIL
@@ -75,8 +75,8 @@ what fd will be connected to fd number 2).
.Pp
.Fn log_open
will open a Log_method that all Log_units will log though, Log_method
-controls to what device the log is sent. Logging devices, passed in
-fname, are syslog, /dev/stderr, or a file.
+controls to what device the log is sent.
+Logging devices, passed in fname, are syslog, /dev/stderr, or a file.
.Pp
Options can be passes to the subsystem with an extra colon. Valid
options are:
@@ -100,7 +100,8 @@ get the logging mask for a logging unit.
.Pp
.Fn log_mask2str
convert the longing mask for `unit' (or all if this is NULL), to a
-string that can be printed. The string can be parsed by
+string that can be printed.
+The string can be parsed by
.Fn log_set_mask_str .
.Pp
.Fn log_set_mask_str
diff --git a/usr.sbin/afs/src/util/mmaptime.c b/usr.sbin/afs/src/util/mmaptime.c
index 16342e5c31e..1741a9ee1fb 100644
--- a/usr.sbin/afs/src/util/mmaptime.c
+++ b/usr.sbin/afs/src/util/mmaptime.c
@@ -1,197 +1,201 @@
-/*
- * Copyright (c) 1998 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: mmaptime.c,v 1.6 2000/10/03 00:31:36 lha Exp $");
-
-#include <stdio.h>
-
-/*
- * Speed hack
- *
- * Here we try to mmap time from the kernelspace.
- * There are people claiming that this is about 100 times faster
- * then gettimeofday()
- *
- * You need to have USE_MMAPTIME defined to get it.
- *
- * Other thing that you need is mmap(), getpagesize(), kvm_open() & co
- *
- * If not initalized with mmaptime_probe gettimeofday will be called
- *
- */
-
-#include "mmaptime.h"
-
-#if defined(USE_MMAPTIME) && defined(HAVE_MMAP) && defined(HAVE_KVM_OPEN) && defined(HAVE_KVM_NLIST) && defined(HAVE_GETPAGESIZE)
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_NLIST_H
-#include <nlist.h>
-#endif
-#ifdef HAVE_ELFLIB_NLIST_H
-#include <elflib/nlist.h>
-#endif
-#ifdef HAVE_KVM_H
-#include <kvm.h>
-#endif
-#include <errno.h>
-
-
-static unsigned long ps;
-static unsigned long begpage;
-static void *mem;
-static int kmemfd = -1;
-static struct timeval *tp = NULL;
-
-
-int mmaptime_probe(void)
-{
- kvm_t *kvm;
- unsigned long value;
- struct nlist nl[2];
- int i, saved_errno;
-
- if (tp)
- return 0;
-
- if (geteuid()) {
- fprintf(stderr, "mmaptime needs to be run as root, falling back on gettimeofday\n");
- return EPERM;
- }
-
- kvm = kvm_open(NULL, NULL, NULL, O_RDONLY, "util/mmaptime");
- nl[0].n_name = "_time";
- nl[1].n_name = NULL;
- i = kvm_nlist(kvm, nl);
-
- /*
- * SunOS 5.6 is broken and returns a zero even when it fails.
- */
-
- if (nl[0].n_value == 0) {
- nl[0].n_name = "time";
- nl[1].n_name = NULL;
- i = kvm_nlist(kvm, nl);
- }
-
- kvm_close(kvm);
-
- if (i != 0)
- return ENOENT;
-
- kmemfd = open("/dev/kmem", O_RDONLY);
- if (kmemfd < 0)
- return errno;
-
- value = nl[0].n_value;
-
- ps = getpagesize();
-
- begpage = value - value % ps ;
- mem = mmap(NULL, ps, PROT_READ, MAP_SHARED, kmemfd, begpage);
-
- if (mem == (void *) -1) {
- saved_errno = errno;
- close(kmemfd);
- return saved_errno;
- }
-
- tp = (struct timeval *) (mem + value % ps);
- return 0;
-}
-
-
-int
-mmaptime_close(void)
-{
- if (tp)
- munmap(mem, ps);
-
- tp = NULL;
-
- if (kmemfd >= 0)
- close(kmemfd);
-
-
- return 0;
-}
-
-int
-mmaptime_gettimeofday(struct timeval *t, void *tzp)
-{
- if (t && tp && !tzp) {
- *t = *tp;
- return 0;
- } else
- return gettimeofday(tp, tzp);
-
- /* NOT REACHED */
- return -1;
-}
-
-
-#else /* USE_MMAPTIME */
-
-#include <errno.h>
-
-int
-mmaptime_probe(void)
-{
- return EOPNOTSUPP;
-}
-
-int
-mmaptime_gettimeofday(struct timeval *tp, void *tzp)
-{
- return gettimeofday(tp, tzp);
-}
-
-int
-mmaptime_close(void)
-{
- return 0;
-}
-
-#endif
+OBSOLETE /*
+OBSOLETE * Copyright (c) 1998 Kungliga Tekniska Högskolan
+OBSOLETE * (Royal Institute of Technology, Stockholm, Sweden).
+OBSOLETE * All rights reserved.
+OBSOLETE *
+OBSOLETE * Redistribution and use in source and binary forms, with or without
+OBSOLETE * modification, are permitted provided that the following conditions
+OBSOLETE * are met:
+OBSOLETE *
+OBSOLETE * 1. Redistributions of source code must retain the above copyright
+OBSOLETE * notice, this list of conditions and the following disclaimer.
+OBSOLETE *
+OBSOLETE * 2. Redistributions in binary form must reproduce the above copyright
+OBSOLETE * notice, this list of conditions and the following disclaimer in the
+OBSOLETE * documentation and/or other materials provided with the distribution.
+OBSOLETE *
+OBSOLETE * 3. Neither the name of the Institute nor the names of its contributors
+OBSOLETE * may be used to endorse or promote products derived from this software
+OBSOLETE * without specific prior written permission.
+OBSOLETE *
+OBSOLETE * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+OBSOLETE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+OBSOLETE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+OBSOLETE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+OBSOLETE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+OBSOLETE * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OBSOLETE * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+OBSOLETE * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+OBSOLETE * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OBSOLETE * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+OBSOLETE * SUCH DAMAGE.
+OBSOLETE */
+OBSOLETE
+OBSOLETE #ifdef HAVE_CONFIG_H
+OBSOLETE #include <config.h>
+OBSOLETE #endif
+OBSOLETE
+OBSOLETE RCSID("$arla: mmaptime.c,v 1.8 2002/12/20 12:57:07 lha Exp $");
+OBSOLETE
+OBSOLETE #include <stdio.h>
+OBSOLETE
+OBSOLETE /*
+OBSOLETE * Speed hack
+OBSOLETE *
+OBSOLETE * Here we try to mmap time from the kernelspace.
+OBSOLETE * There are people claiming that this is about 100 times faster
+OBSOLETE * then gettimeofday()
+OBSOLETE *
+OBSOLETE * You need to have USE_MMAPTIME defined to get it.
+OBSOLETE *
+OBSOLETE * Other thing that you need is mmap(), getpagesize(), kvm_open() & co
+OBSOLETE *
+OBSOLETE * If not initalized with mmaptime_probe gettimeofday will be called
+OBSOLETE *
+OBSOLETE */
+OBSOLETE
+OBSOLETE #if defined(USE_MMAPTIME)
+OBSOLETE
+OBSOLETE #if defined(HAVE_MMAP) && defined(HAVE_KVM_OPEN) && defined(HAVE_KVM_NLIST) && defined(HAVE_GETPAGESIZE)
+OBSOLETE
+OBSOLETE #include "mmaptime.h"
+OBSOLETE
+OBSOLETE #ifdef HAVE_UNISTD_H
+OBSOLETE #include <unistd.h>
+OBSOLETE #endif
+OBSOLETE #ifdef HAVE_SYS_MMAN_H
+OBSOLETE #include <sys/mman.h>
+OBSOLETE #endif
+OBSOLETE #ifdef HAVE_FCNTL_H
+OBSOLETE #include <fcntl.h>
+OBSOLETE #endif
+OBSOLETE #ifdef HAVE_NLIST_H
+OBSOLETE #include <nlist.h>
+OBSOLETE #endif
+OBSOLETE #ifdef HAVE_ELFLIB_NLIST_H
+OBSOLETE #include <elflib/nlist.h>
+OBSOLETE #endif
+OBSOLETE #ifdef HAVE_KVM_H
+OBSOLETE #include <kvm.h>
+OBSOLETE #endif
+OBSOLETE #include <errno.h>
+OBSOLETE
+OBSOLETE
+OBSOLETE static unsigned long ps;
+OBSOLETE static unsigned long begpage;
+OBSOLETE static void *mem;
+OBSOLETE static int kmemfd = -1;
+OBSOLETE static struct timeval *tp = NULL;
+OBSOLETE
+OBSOLETE
+OBSOLETE int mmaptime_probe(void)
+OBSOLETE {
+OBSOLETE kvm_t *kvm;
+OBSOLETE unsigned long value;
+OBSOLETE struct nlist nl[2];
+OBSOLETE int i, saved_errno;
+OBSOLETE
+OBSOLETE if (tp)
+OBSOLETE return 0;
+OBSOLETE
+OBSOLETE if (geteuid()) {
+OBSOLETE fprintf(stderr, "mmaptime needs to be run as root, falling back on gettimeofday\n");
+OBSOLETE return EPERM;
+OBSOLETE }
+OBSOLETE
+OBSOLETE kvm = kvm_open(NULL, NULL, NULL, O_RDONLY, "util/mmaptime");
+OBSOLETE nl[0].n_name = "_time";
+OBSOLETE nl[1].n_name = NULL;
+OBSOLETE i = kvm_nlist(kvm, nl);
+OBSOLETE
+OBSOLETE /*
+OBSOLETE * SunOS 5.6 is broken and returns a zero even when it fails.
+OBSOLETE */
+OBSOLETE
+OBSOLETE if (nl[0].n_value == 0) {
+OBSOLETE nl[0].n_name = "time";
+OBSOLETE nl[1].n_name = NULL;
+OBSOLETE i = kvm_nlist(kvm, nl);
+OBSOLETE }
+OBSOLETE
+OBSOLETE kvm_close(kvm);
+OBSOLETE
+OBSOLETE if (i != 0)
+OBSOLETE return ENOENT;
+OBSOLETE
+OBSOLETE kmemfd = open("/dev/kmem", O_RDONLY);
+OBSOLETE if (kmemfd < 0)
+OBSOLETE return errno;
+OBSOLETE
+OBSOLETE value = nl[0].n_value;
+OBSOLETE
+OBSOLETE ps = getpagesize();
+OBSOLETE
+OBSOLETE begpage = value - value % ps ;
+OBSOLETE mem = mmap(NULL, ps, PROT_READ, MAP_SHARED, kmemfd, begpage);
+OBSOLETE
+OBSOLETE if (mem == (void *) -1) {
+OBSOLETE saved_errno = errno;
+OBSOLETE close(kmemfd);
+OBSOLETE return saved_errno;
+OBSOLETE }
+OBSOLETE
+OBSOLETE tp = (struct timeval *) (mem + value % ps);
+OBSOLETE return 0;
+OBSOLETE }
+OBSOLETE
+OBSOLETE
+OBSOLETE int
+OBSOLETE mmaptime_close(void)
+OBSOLETE {
+OBSOLETE if (tp)
+OBSOLETE munmap(mem, ps);
+OBSOLETE
+OBSOLETE tp = NULL;
+OBSOLETE
+OBSOLETE if (kmemfd >= 0)
+OBSOLETE close(kmemfd);
+OBSOLETE
+OBSOLETE
+OBSOLETE return 0;
+OBSOLETE }
+OBSOLETE
+OBSOLETE int
+OBSOLETE mmaptime_gettimeofday(struct timeval *t, void *tzp)
+OBSOLETE {
+OBSOLETE if (t && tp && !tzp) {
+OBSOLETE *t = *tp;
+OBSOLETE return 0;
+OBSOLETE } else
+OBSOLETE return gettimeofday(tp, tzp);
+OBSOLETE
+OBSOLETE /* NOT REACHED */
+OBSOLETE return -1;
+OBSOLETE }
+OBSOLETE
+OBSOLETE
+OBSOLETE #else /* USE_MMAPTIME not useable */
+OBSOLETE
+OBSOLETE #include <errno.h>
+OBSOLETE
+OBSOLETE int
+OBSOLETE mmaptime_probe(void)
+OBSOLETE {
+OBSOLETE return EOPNOTSUPP;
+OBSOLETE }
+OBSOLETE
+OBSOLETE int
+OBSOLETE mmaptime_gettimeofday(struct timeval *tp, void *tzp)
+OBSOLETE {
+OBSOLETE return gettimeofday(tp, tzp);
+OBSOLETE }
+OBSOLETE
+OBSOLETE int
+OBSOLETE mmaptime_close(void)
+OBSOLETE {
+OBSOLETE return 0;
+OBSOLETE }
+OBSOLETE
+OBSOLETE #endif /* USE_MMAPTIME not useable */
+OBSOLETE #endif /* USE_MMAPTIME */
+OBSOLETE
diff --git a/usr.sbin/afs/src/util/mmaptime.h b/usr.sbin/afs/src/util/mmaptime.h
index a0764ed245a..2296d772f0d 100644
--- a/usr.sbin/afs/src/util/mmaptime.h
+++ b/usr.sbin/afs/src/util/mmaptime.h
@@ -1,47 +1,47 @@
-/*
- * Copyright (c) 1998 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: mmaptime.h,v 1.2 2000/10/03 00:31:41 lha Exp $ */
-
-#ifndef _UTIL_MMAPTIME_H
-#define _UTIL_MMAPTIME_H 1
-
-#include <sys/time.h>
-
-int mmaptime_probe(void);
-int mmaptime_gettimeofday(struct timeval *tp, void *tzp);
-int mmaptime_close(void);
-
-#endif
-
-
+OBSOLETE /*
+OBSOLETE * Copyright (c) 1998 Kungliga Tekniska Högskolan
+OBSOLETE * (Royal Institute of Technology, Stockholm, Sweden).
+OBSOLETE * All rights reserved.
+OBSOLETE *
+OBSOLETE * Redistribution and use in source and binary forms, with or without
+OBSOLETE * modification, are permitted provided that the following conditions
+OBSOLETE * are met:
+OBSOLETE *
+OBSOLETE * 1. Redistributions of source code must retain the above copyright
+OBSOLETE * notice, this list of conditions and the following disclaimer.
+OBSOLETE *
+OBSOLETE * 2. Redistributions in binary form must reproduce the above copyright
+OBSOLETE * notice, this list of conditions and the following disclaimer in the
+OBSOLETE * documentation and/or other materials provided with the distribution.
+OBSOLETE *
+OBSOLETE * 3. Neither the name of the Institute nor the names of its contributors
+OBSOLETE * may be used to endorse or promote products derived from this software
+OBSOLETE * without specific prior written permission.
+OBSOLETE *
+OBSOLETE * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+OBSOLETE * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+OBSOLETE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+OBSOLETE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+OBSOLETE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+OBSOLETE * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OBSOLETE * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+OBSOLETE * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+OBSOLETE * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OBSOLETE * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+OBSOLETE * SUCH DAMAGE.
+OBSOLETE */
+OBSOLETE
+OBSOLETE /* $arla: mmaptime.h,v 1.3 2002/12/20 13:11:51 lha Exp $ */
+OBSOLETE
+OBSOLETE #ifndef _UTIL_MMAPTIME_H
+OBSOLETE #define _UTIL_MMAPTIME_H 1
+OBSOLETE
+OBSOLETE #include <sys/time.h>
+OBSOLETE
+OBSOLETE int mmaptime_probe(void);
+OBSOLETE int mmaptime_gettimeofday(struct timeval *tp, void *tzp);
+OBSOLETE int mmaptime_close(void);
+OBSOLETE
+OBSOLETE #endif
+OBSOLETE
+OBSOLETE
diff --git a/usr.sbin/afs/src/util/mmaptime_test.c b/usr.sbin/afs/src/util/mmaptime_test.c
index 5fe477b4eb2..7793f4b5c8e 100644
--- a/usr.sbin/afs/src/util/mmaptime_test.c
+++ b/usr.sbin/afs/src/util/mmaptime_test.c
@@ -35,7 +35,9 @@
#include <config.h>
#endif
-RCSID("$KTH: mmaptime_test.c,v 1.4 2000/10/03 00:31:46 lha Exp $");
+RCSID("$arla: mmaptime_test.c,v 1.6 2002/05/16 22:09:46 hin Exp $");
+
+#ifdef USE_MMAPTIME
#include <stdio.h>
#include <time.h>
@@ -79,7 +81,7 @@ int main(int argc, char **argv)
if (!(argc == 2 && sscanf(argv[1], "%d", &times) == 1))
times = 100000;
- /* Get date two diffrent ways */
+ /* Get date two different ways */
if (mmaptime_gettimeofday(&t, NULL))
err(1, "mmaptime_gettimeofday: here am I");
@@ -123,3 +125,12 @@ int main(int argc, char **argv)
return 0;
}
+#else /* !USE_MMAPTIME */
+
+int
+main(int argc, char **argv)
+{
+ return 0;
+}
+
+#endif /* USE_MMAPTIME */
diff --git a/usr.sbin/afs/src/util/util-tester.c b/usr.sbin/afs/src/util/util-tester.c
index a4c04672484..1adb53a841b 100644
--- a/usr.sbin/afs/src/util/util-tester.c
+++ b/usr.sbin/afs/src/util/util-tester.c
@@ -35,6 +35,8 @@
#include <config.h>
#endif
+#include <roken.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -45,6 +47,7 @@
#include "bool.h"
#include "hash.h"
#include "log.h"
+#include "arlamath.h"
struct timeval time1, time2;
@@ -120,8 +123,8 @@ test_hash(void)
(char *)hashtabsearch(h, "three"),
(char *)hashtabsearch(h, "four"));
-
- printf("XXX there is no simple way to free a hashtab\n");
+ hashtabrelease(h);
+
return endtesting(0);
}
@@ -236,11 +239,35 @@ test_log (void)
return endtesting (0);
}
+static int
+test_math (void)
+{
+ starttesting ("math");
+
+ if (arlautil_findprime(17) != 17)
+ return endtesting (1);
+ if (arlautil_findprime(18) != 19)
+ return endtesting (1);
+ if (arlautil_findprime(11412) != 11423)
+ return endtesting (1);
+
+ if (arlautil_findprime(11412) != 11423)
+ return endtesting (1);
+
+ if (arlautil_isprime(20897) == 0)
+ return endtesting (1);
+ if (arlautil_isprime(49037) == 0)
+ return endtesting (1);
+
+ return endtesting (0);
+}
+
int
main(int argc, char **argv)
{
int ret = 0;
ret |= test_hash();
ret |= test_log();
+ ret |= test_math();
return ret;
}
diff --git a/usr.sbin/afs/src/ydr/lex.h b/usr.sbin/afs/src/ydr/lex.h
index e89921a1ea3..450193d7543 100644
--- a/usr.sbin/afs/src/ydr/lex.h
+++ b/usr.sbin/afs/src/ydr/lex.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: lex.h,v 1.6 2000/10/02 22:36:33 lha Exp $ */
+/* $arla: lex.h,v 1.6 2000/10/02 22:36:33 lha Exp $ */
#ifndef _LEX_
#define _LEX_
diff --git a/usr.sbin/afs/src/ydr/lex.l b/usr.sbin/afs/src/ydr/lex.l
index 26bb0d4ce1b..d1a2e9ee4b7 100644
--- a/usr.sbin/afs/src/ydr/lex.l
+++ b/usr.sbin/afs/src/ydr/lex.l
@@ -1,6 +1,6 @@
%{
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -34,7 +34,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: lex.l,v 1.24.2.1 2001/05/28 23:23:03 mattiasa Exp $");
+RCSID("$arla: lex.l,v 1.31 2003/01/20 07:12:56 lha Exp $");
#endif
/*
@@ -84,13 +84,19 @@ struct { return T_STRUCT; }
typedef { return T_TYPEDEF; }
unsigned { return T_UNSIGNED; }
long { return T_LONG; }
+afs_int32 { return T_LONG; }
int32_t { return T_LONG; }
+afs_int64 { return T_LONGLONG; }
+int64_t { return T_LONGLONG; }
u_long { return T_ULONG; }
-u_int32_t { return T_ULONG; }
+uint32_t { return T_ULONG; }
+afs_uint32 { return T_ULONG; }
+uint64_t { return T_ULONGLONG; }
+afs_uint64 { return T_ULONGLONG; }
short { return T_SHORT; }
int16_t { return T_SHORT; }
u_short { return T_USHORT; }
-u_int16_t { return T_USHORT; }
+uint16_t { return T_USHORT; }
int { return T_INT; }
u_char { return T_UCHAR; }
char { return T_CHAR; }
@@ -110,7 +116,7 @@ ASIS { return T_ASIS; }
^\%[^\n]*$ { yylval.name = strdup (yytext+1); return T_VERBATIM; }
-?[0-9]+ { yylval.constant = atoi(yytext); return T_CONSTANT; }
0[Xx][0-9a-fA-F]+ { yylval.constant = (int)strtol(yytext+2, NULL, 0x10); return T_CONSTANT; }
-[A-Za-z][A-Za-z0-9_]* {
+[A-Za-z_][A-Za-z0-9_]* {
Symbol *sym;
sym = findsym(yytext);
@@ -118,9 +124,11 @@ yylval.sym = sym;
if (sym == NULL) {
yylval.name = strdup(yytext);
return T_IDENTIFIER;
-} else if (sym->type == TCONST)
+} else if (sym->type == YDR_TCONST)
return T_IDCONST;
-else if (sym->type == TTYPEDEF || sym->type == TENUM || sym->type == TSTRUCT)
+else if (sym->type == YDR_TTYPEDEF
+ || sym->type == YDR_TENUM
+ || sym->type == YDR_TSTRUCT)
return T_IDTYPE;
else
error_message (0, "Ignoring \"%s\"\n", yytext);
diff --git a/usr.sbin/afs/src/ydr/main.c b/usr.sbin/afs/src/ydr/main.c
index a646e72eb8f..951c73102d7 100644
--- a/usr.sbin/afs/src/ydr/main.c
+++ b/usr.sbin/afs/src/ydr/main.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: main.c,v 1.22 2000/10/16 22:01:45 assar Exp $");
+RCSID("$arla: main.c,v 1.23 2002/11/27 23:48:58 lha Exp $");
#endif
#include <stdio.h>
@@ -141,7 +141,6 @@ main (int argc, char **argv)
free (arg);
ret = yyparse ();
generate_server_switch (serverfile.stream, serverhdrfile.stream);
- generate_tcpdump_patches (td_file.stream, filename);
pclose (yyin);
close_generator (filename);
unlink (tmp_filename);
diff --git a/usr.sbin/afs/src/ydr/output.c b/usr.sbin/afs/src/ydr/output.c
index 1712f6bd177..7f80a17587d 100644
--- a/usr.sbin/afs/src/ydr/output.c
+++ b/usr.sbin/afs/src/ydr/output.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,13 +33,14 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: output.c,v 1.73.2.1 2001/03/04 04:48:48 lha Exp $");
+RCSID("$arla: output.c,v 1.91 2003/04/16 09:07:03 lha Exp $");
#endif
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <list.h>
+#include <ctype.h>
#include <err.h>
#include <roken.h>
#include "sym.h"
@@ -76,10 +77,9 @@ ydr_file headerfile,
serverfile,
clienthdrfile,
serverhdrfile,
- td_file,
ydrfile;
-long tmpcnt = 0;
+static long tmpcnt = 0;
/*
* Function to convert error codes with.
@@ -116,31 +116,39 @@ static void encode_typedef (Symbol *s, char *name, FILE *f,
static void encode_symbol (Symbol *s, char *name, FILE *f,
EncodeType encodetype, Side side);
static void print_symbol (char *where, Symbol *s, char *name, FILE *f);
+static void free_symbol (char *where, Symbol *s, char *name, FILE *f);
+static void free_type (char *where, char *name, Type *type, FILE *f);
static void
print_type (char *name, Type *type, enum argtype argtype,
DeclType decl, FILE *f)
{
switch (type->type) {
- case TCHAR :
+ case YDR_TCHAR :
fprintf (f, "char %s", name);
break;
- case TUCHAR :
+ case YDR_TUCHAR :
fprintf (f, "unsigned char %s", name);
break;
- case TSHORT :
+ case YDR_TSHORT :
fprintf (f, "int16_t %s", name);
break;
- case TUSHORT :
- fprintf (f, "u_int16_t %s", name);
+ case YDR_TUSHORT :
+ fprintf (f, "uint16_t %s", name);
break;
- case TLONG :
+ case YDR_TLONG :
fprintf (f, "int32_t %s", name);
break;
- case TULONG :
- fprintf (f, "u_int32_t %s", name);
+ case YDR_TULONG :
+ fprintf (f, "uint32_t %s", name);
break;
- case TSTRING :
+ case YDR_TLONGLONG:
+ fprintf (f, "int64_t %s", name);
+ break;
+ case YDR_TULONGLONG:
+ fprintf (f, "uint64_t %s", name);
+ break;
+ case YDR_TSTRING :
if (type->size && decl == VDECL)
fprintf (f, "char %s[%d]", name, type->size);
else if (argtype != TIN && type->size == 0)
@@ -148,7 +156,7 @@ print_type (char *name, Type *type, enum argtype argtype,
else
fprintf (f, "char *%s", name);
break;
- case TPOINTER :
+ case YDR_TPOINTER :
{
char *tmp;
size_t len = strlen(name) + 2;
@@ -160,13 +168,13 @@ print_type (char *name, Type *type, enum argtype argtype,
free (tmp);
break;
}
- case TUSERDEF :
- if(type->symbol->type == TSTRUCT)
+ case YDR_TUSERDEF :
+ if(type->symbol->type == YDR_TSTRUCT)
fprintf (f, "struct %s %s", type->symbol->name, name);
else
fprintf (f, "%s %s", type->symbol->name, name);
break;
- case TVARRAY :
+ case YDR_TVARRAY :
{
char *s;
size_t len = strlen (name) + 6;
@@ -188,11 +196,11 @@ print_type (char *name, Type *type, enum argtype argtype,
free(s);
break;
}
- case TARRAY :
+ case YDR_TARRAY :
print_type (name, type->subtype, argtype, decl, f);
fprintf (f, "[ %d ]", type->size);
break;
- case TOPAQUE :
+ case YDR_TOPAQUE :
fprintf (f, "char %s", name);
break;
default :
@@ -214,7 +222,8 @@ print_entry (List *list, Listitem *item, void *i)
/*
* Return the size of this type in bytes.
- * In the case of a variable-sized type, return -1.
+ * In the case of a variable-sized type, return -1 (unknown) or
+ * the negative maxsize.
*/
static Bool
@@ -228,8 +237,11 @@ sizeof_struct_iter (List *list, Listitem *item, void *arg)
if (sz == -1) {
*tot = -1;
return TRUE;
+ } else if (sz < 0 || *tot < 0) {
+ *tot = -1 * (abs(*tot) + abs(sz));
+ return FALSE;
} else {
- *tot += sz;
+ *tot = *tot + sz;
return FALSE;
}
}
@@ -239,7 +251,8 @@ sizeof_struct (Symbol *s)
{
int tot = 0;
- listiter (s->u.list, sizeof_struct_iter, &tot);
+ if (s->u.list)
+ listiter (s->u.list, sizeof_struct_iter, &tot);
return tot;
}
@@ -247,36 +260,44 @@ static int
sizeof_type (Type *t)
{
switch (t->type) {
- case TCHAR :
- case TUCHAR :
-/* return 1;*/
- case TSHORT :
- case TUSHORT :
-/* return 2;*/
- case TLONG :
- case TULONG :
+ case YDR_TCHAR :
+ case YDR_TUCHAR :
+ case YDR_TSHORT :
+ case YDR_TUSHORT :
+ case YDR_TLONG :
+ case YDR_TULONG :
return 4;
- case TSTRING :
+ case YDR_TLONGLONG :
+ case YDR_TULONGLONG :
+ return 8;
+ case YDR_TSTRING :
if (t->size == 0)
return -1;
else
return t->size;
- case TOPAQUE :
+ case YDR_TOPAQUE :
return 1;
- case TUSERDEF :
+ case YDR_TUSERDEF :
return sizeof_symbol (t->symbol);
- case TARRAY :
+ case YDR_TARRAY :
{
int sz = sizeof_type (t->subtype);
if (sz == -1)
return -1;
- else
- return t->size * sz;
+ return t->size * sz;
}
- case TVARRAY :
- return -1;
- case TPOINTER :
+ case YDR_TVARRAY :
+ {
+ int sz;
+ if (t->size == 0)
+ return -1;
+ sz = sizeof_type(t->subtype);
+ if (sz == -1)
+ return -1;
+ return -1 * (t->size * abs(sz) + 4); /* 4 is size of the var part */
+ }
+ case YDR_TPOINTER :
return -1;
default :
abort ();
@@ -287,18 +308,18 @@ static int
sizeof_symbol (Symbol *s)
{
switch (s->type) {
- case TUNDEFINED :
+ case YDR_TUNDEFINED :
fprintf (stderr, "What is %s doing in sizeof_type?", s->name);
return 0;
- case TSTRUCT :
+ case YDR_TSTRUCT :
return sizeof_struct (s);
- case TENUM :
+ case YDR_TENUM :
return 4;
- case TCONST :
+ case YDR_TCONST :
return 0;
- case TENUMVAL :
+ case YDR_TENUMVAL :
return 0;
- case TTYPEDEF :
+ case YDR_TTYPEDEF :
return sizeof_type (s->u.type);
default :
abort ();
@@ -325,16 +346,20 @@ generate_hdr_enum (Symbol *s, FILE *f)
Symbol *e;
fprintf (f, "enum %s {\n", s->name);
- for (item = listhead (s->u.list);
- item && listnext (s->u.list, item);
- item = listnext (s->u.list, item)) {
- e = (Symbol *)listdata (item);
-
- fprintf (f, " %s = %d,\n", e->name, e->u.val);
+ if (s->u.list) {
+ for (item = listhead (s->u.list);
+ item && listnext (s->u.list, item);
+ item = listnext (s->u.list, item))
+ {
+ e = (Symbol *)listdata (item);
+
+ fprintf (f, " %s = %d,\n", e->name, e->u.val);
+ }
+ e = (Symbol *)listdata (item);
+ fprintf (f, " %s = %d\n};\n", e->name, e->u.val);
}
- e = (Symbol *)listdata (item);
- fprintf (f, " %s = %d\n};\ntypedef enum %s %s;\n",
- e->name, e->u.val, s->name, s->name);
+ fprintf (f, "typedef enum %s %s;\n",
+ s->name, s->name);
}
static void
@@ -356,15 +381,19 @@ generate_sizeof (Symbol *s, FILE *f)
{
int sz;
- if (s->type == TCONST)
+ if (s->type == YDR_TCONST)
return;
sz = sizeof_symbol (s);
- if (sz != -1) {
- char *name;
+ if (sz == -1) {
+ ; /* the size is unknown */
+ } else {
+ char *name, *ms = "";
+ if (sz < 0)
+ ms = "MAX_";
name = estrdup (s->name);
- fprintf (f, "#define %s_SIZE %d\n", strupr (name), sz);
+ fprintf (f, "#define %s_%sSIZE %d\n", strupr (name), ms, abs(sz));
free (name);
}
}
@@ -373,21 +402,21 @@ void
generate_header (Symbol *s, FILE *f)
{
switch (s->type) {
- case TUNDEFINED :
+ case YDR_TUNDEFINED :
fprintf (f, "What is %s doing in generate_header?", s->name);
break;
- case TSTRUCT :
+ case YDR_TSTRUCT :
generate_hdr_struct (s, f);
break;
- case TENUM :
+ case YDR_TENUM :
generate_hdr_enum (s, f);
break;
- case TCONST :
+ case YDR_TCONST :
generate_hdr_const (s, f);
break;
- case TENUMVAL :
+ case YDR_TENUMVAL :
break;
- case TTYPEDEF :
+ case YDR_TTYPEDEF :
generate_hdr_typedef (s, f);
default :
break;
@@ -399,78 +428,78 @@ generate_header (Symbol *s, FILE *f)
* Generate functions for encoding and decoding.
*/
-/* XXX - still assumes that a word is 32 bits */
-
static char *
encode_function (Type *type, EncodeType encodetype)
{
if (type->flags & TASIS)
return "";
- else if (encodetype == ENCODE_RX || encodetype == ENCODE_MEM)
- return "htonl";
-#if 0
- if (type->type == TSHORT || type->type == TUSHORT)
- return "htons";
- else if (type->type == TLONG || type->type == TULONG)
- return "htonl";
- else
- abort();
-#endif
- else if (encodetype == DECODE_RX || encodetype == DECODE_MEM)
- return "ntohl";
-#if 0
- if (type->type == TSHORT || type->type == TUSHORT)
- return "ntohs";
- else if (type->type == TLONG || type->type == TULONG)
- return "ntohl";
- else
- abort();
-#endif
- else
+ else if (encodetype == ENCODE_RX || encodetype == ENCODE_MEM) {
+ switch (type->type) {
+ case YDR_TLONGLONG:
+ case YDR_TULONGLONG:
+ return "htole64";
+ default:
+ return "htonl";
+ break;
+ }
+ } else if (encodetype == DECODE_RX || encodetype == DECODE_MEM) {
+ switch (type->type) {
+ case YDR_TLONGLONG:
+ case YDR_TULONGLONG:
+ return "letoh64";
+ default:
+ return "ntohl";
+ break;
+ }
+ } else
abort();
}
/*
- * encode/decode long
+ * encode/decode long/longlong
*/
static void
-encode_long (char *name, Type *type, FILE *f, EncodeType encodetype)
+encode_int_type (char *name, char *tname, Type *type,
+ FILE *f, EncodeType encodetype)
{
switch (encodetype) {
case ENCODE_RX :
- fprintf (f, "{ u_int32_t u;\n"
+ fprintf (f, "{ u%s u;\n"
"u = %s (%s);\n"
"if(rx_Write(call, &u, sizeof(u)) != sizeof(u))\n"
"goto fail;\n"
"}\n",
+ tname,
encode_function (type, encodetype),
name);
break;
case DECODE_RX :
- fprintf (f, "{ u_int32_t u;\n"
+ fprintf (f, "{ u%s u;\n"
"if(rx_Read(call, &u, sizeof(u)) != sizeof(u))\n"
"goto fail;\n"
"%s = %s (u);\n"
- "}\n", name,
+ "}\n", tname, name,
encode_function (type, encodetype));
break;
case ENCODE_MEM :
- fprintf (f, "{ int32_t tmp = %s(%s); "
- "if (*total_len < sizeof(int32_t)) goto fail;\n"
- "bcopy ((char*)&tmp, ptr, sizeof(int32_t)); "
- "ptr += sizeof(int32_t); "
- "*total_len -= sizeof(int32_t);}\n",
+ fprintf (f, "{ %s tmp = %s(%s); "
+ "if (*total_len < sizeof(tmp)) goto fail;\n"
+ "memcpy (ptr, (char*)&tmp, sizeof(tmp)); "
+ "ptr += sizeof(tmp); "
+ "*total_len -= sizeof(tmp);}\n",
+ tname,
encode_function (type, encodetype),
name);
break;
case DECODE_MEM :
- fprintf (f, "{ int32_t tmp; "
- "if (*total_len < sizeof(int32_t)) goto fail;"
- "bcopy (ptr, (char *)&tmp, sizeof(int32_t)); "
+ fprintf (f, "{ %s tmp; "
+ "if (*total_len < sizeof(tmp)) goto fail;"
+ "memcpy ((char*)&tmp, ptr, sizeof(tmp)); "
"%s = %s(tmp); "
- "ptr += sizeof(int32_t); "
- "*total_len -= sizeof(int32_t);}\n",
+ "ptr += sizeof(tmp); "
+ "*total_len -= sizeof(tmp);}\n",
+ tname,
name,
encode_function (type, encodetype));
break;
@@ -479,6 +508,18 @@ encode_long (char *name, Type *type, FILE *f, EncodeType encodetype)
}
}
+static void
+encode_long (char *name, Type *type, FILE *f, EncodeType encodetype)
+{
+ encode_int_type(name, "int32_t", type, f, encodetype);
+}
+
+static void
+encode_longlong (char *name, Type *type, FILE *f, EncodeType encodetype)
+{
+ encode_int_type(name, "int64_t", type, f, encodetype);
+}
+
/*
* print long
*/
@@ -490,6 +531,38 @@ print_long (char *where, char *name, Type *type, FILE *f)
}
/*
+ * print longlong
+ */
+
+static void
+print_longlong (char *where, char *name, Type *type, FILE *f)
+{
+ fprintf (f, "printf(\" %s = %%d\", (int32_t)%s%s);", name, where, name);
+}
+
+/*
+ *
+ */
+
+static void
+gen_check_overflow(Type *indextype, Type *subtype, char *num, FILE *f)
+{
+ /* Check if we will overflow */
+ fprintf(f, "{\n");
+ print_type ("overI", indextype, TIN, VDECL, f);
+ fprintf(f, ";\n");
+ fprintf(f, "overI = ((");
+ print_type ("", indextype, TIN, VDECL, f);
+ fprintf(f, ")~((");
+ print_type ("", indextype, TIN, VDECL, f);
+ fprintf(f, ")0) >> 1) / sizeof(");
+ print_type ("", subtype, TIN, VDECL, f);
+ fprintf(f, ");\n");
+ fprintf(f, "if (overI < %s) goto fail;\n", num);
+ fprintf(f, "}\n");
+}
+
+/*
*
*/
@@ -550,7 +623,7 @@ encode_short (char *name, Type *type, FILE *f, EncodeType encodetype)
case ENCODE_MEM :
fprintf (f, "{ in16_t tmp = %s(%s); "
"if (*total_len < sizeof(int16_t)) goto fail;\n"
- "bcopy ((char*)&tmp, ptr, sizeof(int16_t)); "
+ "memcpy (ptr, (char*)&tmp, sizeof(int16_t)); "
"ptr += sizeof(int16_t); "
"*total_len -= sizeof(int16_t);}\n",
encode_function (type, encodetype),
@@ -559,7 +632,7 @@ encode_short (char *name, Type *type, FILE *f, EncodeType encodetype)
case DECODE_MEM :
fprintf (f, "{ int16_t tmp; "
"if (*total_len < sizeof(int16_t)) goto fail;\n"
- "bcopy (ptr, (char *)&tmp, sizeof(int16_t)); "
+ "memcpy ((char *)&tmp, ptr, sizeof(int16_t)); "
"%s = %s(tmp); "
"ptr += sizeof(int16_t); "
"*total_len -= sizeof(int16_t); }\n",
@@ -579,7 +652,7 @@ static void
encode_string (char *name, Type *type, FILE *f, EncodeType encodetype,
Side side)
{
- Type lentype = {TULONG};
+ Type lentype = {YDR_TULONG};
char *nname;
asprintf (&nname, "(%s%s)",
@@ -611,12 +684,21 @@ encode_string (char *name, Type *type, FILE *f, EncodeType encodetype,
if (type->size != 0) {
fprintf (f,
"if (len >= %u) {\n"
- "rx_Error(call) = ENOMEM;\n"
+ "rx_SetCallError(call, ENOMEM);\n"
"goto fail;\n"
"}\n",
type->size);
} else {
- fprintf(f, "%s = malloc(len + 1);\n", nname);
+ fprintf(f, "if (len == (uint32_t) -1) {\n"
+ "rx_SetCallError(call, ENOMEM);\n"
+ "goto fail;\n"
+ "}\n");
+ fprintf(f, "%s = malloc(len + 1);\n"
+ "if (%s == NULL) {\n"
+ "rx_SetCallError(call, ENOMEM);\n"
+ "goto fail;\n"
+ "}\n",
+ nname, nname);
}
fprintf (f,
@@ -636,8 +718,8 @@ encode_string (char *name, Type *type, FILE *f, EncodeType encodetype,
name);
encode_type ("len", &lentype, f, encodetype, side);
fprintf (f, "strncpy (ptr, %s, len);\n", name);
- fprintf (f, "ptr += len + (4 - (len %% 4) %% 4);\n"
- "*total_len -= len + (4 - (len %% 4) %% 4);\n}\n");
+ fprintf (f, "ptr += len + (4 - (len %% 4)) %% 4;\n"
+ "*total_len -= len + (4 - (len %% 4)) %% 4;\n}\n");
break;
case DECODE_MEM :
fprintf (f,
@@ -652,13 +734,20 @@ encode_string (char *name, Type *type, FILE *f, EncodeType encodetype,
"goto fail;\n",
type->size);
} else {
- fprintf (f, "%s = malloc(len + 1);\n", nname);
+ fprintf(f, "if (len == (uint32_t) -1) {\n"
+ "goto fail;\n"
+ "}\n");
+ fprintf(f, "%s = malloc(len + 1);\n"
+ "if (%s == NULL) {\n"
+ "goto fail;\n"
+ "}\n",
+ nname, nname);
}
fprintf (f,
"memcpy (%s, ptr, len);\n"
"%s[len] = '\\0';\n"
"ptr += len + (4 - (len %% 4)) %% 4;\n"
- "*total_len -= len + (4 - (len %% 4) %% 4);\n}\n",
+ "*total_len -= len + (4 - (len %% 4)) %% 4;\n}\n",
nname, nname);
break;
default :
@@ -678,6 +767,18 @@ print_string (char *where, char *name, Type *type, FILE *f)
fprintf (f, "printf(\" %s = %%s\", %s%s);", name, where, name);
}
+#if 0
+/*
+ * free TSTRING
+ */
+
+static void
+free_string (char *where, char *name, Type *type, FILE *f)
+{
+ fprintf (f, "free(%s%s);\n", where, name);
+}
+#endif
+
/*
* encode/decode TARRAY
*/
@@ -686,7 +787,7 @@ static void
encode_array (char *name, Type *type, FILE *f, EncodeType encodetype,
Side side)
{
- if (type->subtype->type == TOPAQUE) {
+ if (type->subtype->type == YDR_TOPAQUE) {
if (type->size % 4 != 0)
error_message (1, "Opaque array should be"
"multiple of 4");
@@ -736,7 +837,7 @@ encode_array (char *name, Type *type, FILE *f, EncodeType encodetype,
}
/*
- * encode/decode TARRAY
+ * print ARRAY
*/
static void
@@ -746,7 +847,7 @@ print_array (char *where, char *name, Type *type, FILE *f)
fprintf (f, "/* printing ARRAY %s%s */\n", where, name);
- if (type->subtype->type == TOPAQUE) {
+ if (type->subtype->type == YDR_TOPAQUE) {
if (type->size % 4 != 0)
error_message (1, "print_array: Opaque array should be"
"multiple of 4");
@@ -776,6 +877,30 @@ print_array (char *where, char *name, Type *type, FILE *f)
}
/*
+ * free TARRAY
+ */
+
+static void
+free_array (char *where, char *name, Type *type, FILE *f)
+{
+ if (type->subtype->type == YDR_TOPAQUE) {
+ ; /* nothing */
+ } else {
+ char tmp[256];
+
+ fprintf (f, "{\nint i%lu;\nfor(i%lu = 0; i%lu < %u;"
+ "++i%lu){\n", tmpcnt, tmpcnt, tmpcnt, type->size,tmpcnt);
+ snprintf(tmp, sizeof(tmp)-1, "%s[i%lu]", name, tmpcnt);
+ tmpcnt++;
+ if (type->flags)
+ type->subtype->flags |= type->flags;
+ free_type (tmp, "", type->subtype, f);
+ tmpcnt--;
+ fprintf (f, "}\n}\n");
+ }
+}
+
+/*
* encode/decode TVARRAY
*/
@@ -784,21 +909,34 @@ encode_varray (char *name, Type *type, FILE *f, EncodeType encodetype,
Side side)
{
char tmp[256];
- Type lentype = {TULONG};
+ Type lentype = {YDR_TULONG};
+ Type *indextype;
strlcpy (tmp, name, sizeof tmp);
strlcat (tmp, ".len", sizeof tmp);
- encode_type (tmp, type->indextype ? type->indextype : &lentype,
- f, encodetype, side);
+ indextype = type->indextype ? type->indextype : &lentype;
+
+ encode_type (tmp, indextype, f, encodetype, side);
+ if (encodetype == DECODE_MEM || encodetype == DECODE_RX) {
+ if (type->size != 0)
+ fprintf (f, "if (%s > %d) goto fail;\n", tmp, type->size);
+ if (encodetype == DECODE_MEM) {
+ fprintf (f, "if ((%s * sizeof(", tmp);
+ print_type ("", type->subtype, TIN, VDECL, f);
+ fprintf (f, ")) > *total_len) goto fail;\n");
+ }
+ }
+ gen_check_overflow(indextype, type->subtype, tmp, f);
if (encodetype == DECODE_MEM || encodetype == DECODE_RX) {
fprintf (f, "%s.val = (", name);
print_type ("*", type->subtype, TIN, VDECL, f);
fprintf (f, ")malloc(sizeof(");
print_type ("", type->subtype, TIN, VDECL, f);
fprintf (f, ") * %s);\n", tmp);
+ fprintf (f, "if (%s.val == NULL) goto fail;\n", name);
}
- if (type->subtype->type == TOPAQUE) {
+ if (type->subtype->type == YDR_TOPAQUE) {
switch (encodetype) {
case ENCODE_RX :
fprintf (f, "{\n"
@@ -823,18 +961,19 @@ encode_varray (char *name, Type *type, FILE *f, EncodeType encodetype,
tmp, name, tmp, tmp);
break;
case ENCODE_MEM :
- /* XXX bounce checking */
fprintf (f, "{\n"
"char zero[4] = {0, 0, 0, 0};\n"
+ "size_t sz = %s + (4 - (%s %% 4)) %% 4;\n"
+ "if (*total_len < sz) goto fail;\n"
"memcpy (ptr, %s.val, %s);\n"
"memcpy (ptr + %s, zero, (4 - (%s %% 4)) %% 4);\n"
- "ptr += %s + (4 - (%s %% 4)) %% 4;\n"
+ "ptr += sz; *total_len -= sz;\n"
"}\n",
- name, tmp, tmp, tmp, tmp, tmp);
+ tmp, tmp, name, tmp, tmp, tmp);
break;
case DECODE_MEM :
- /* XXX bounce checking */
- fprintf (f, "{\n"
+ fprintf (f,
+ "{\n"
"memcpy (%s.val, ptr, %s);\n"
"ptr += %s + (4 - (%s %% 4)) %% 4;\n"
"}\n",
@@ -865,9 +1004,9 @@ print_varray (char *where, char *name, Type *type, FILE *f)
{
fprintf (f, "{\nunsigned int i%lu;\n", tmpcnt);
- fprintf (f, "/* printing TVARRAY %s%s */\n", where, name);
+ fprintf (f, "/* printing YDR_TVARRAY %s%s */\n", where, name);
- if (type->subtype->type == TOPAQUE) {
+ if (type->subtype->type == YDR_TOPAQUE) {
fprintf (f, "char *ptr = %s%s.val;\n", where, name);
fprintf (f, "printf(\"0x\");");
fprintf (f, "for (i%lu = 0; i%lu < %s%s.len; ++i%lu)\n"
@@ -892,6 +1031,30 @@ print_varray (char *where, char *name, Type *type, FILE *f)
}
/*
+ * free TVARRAY
+ */
+
+static void
+free_varray (char *where, char *name, Type *type, FILE *f)
+{
+ if (type->subtype->type != YDR_TOPAQUE) {
+ char *ptr;
+ fprintf (f, "{\n"
+ "unsigned int i%lu;\n", tmpcnt);
+ fprintf (f, "for (i%lu = 0; i%lu < %s%s.len; ++i%lu) {\n",
+ tmpcnt, tmpcnt, where, name, tmpcnt);
+ asprintf(&ptr, "%s%s.val[i%ld]", where, name, tmpcnt);
+ tmpcnt++;
+ free_type (ptr, "", type->subtype, f);
+ tmpcnt--;
+ free(ptr);
+ fprintf (f, "}\n");
+ fprintf (f, "}\n");
+ }
+ fprintf (f, "free((%s%s).val);\n", where, name);
+}
+
+/*
* encode/decode pointer
*/
@@ -899,7 +1062,7 @@ static void
encode_pointer (char *name, Type *type, FILE *f, EncodeType encodetype,
Side side)
{
- Type booltype = {TULONG};
+ Type booltype = {YDR_TULONG};
char tmp[256];
snprintf (tmp, sizeof(tmp), "*(%s)", name);
@@ -937,6 +1100,21 @@ encode_pointer (char *name, Type *type, FILE *f, EncodeType encodetype,
}
/*
+ * free pointer
+ */
+
+static void
+free_pointer (char *where, char *name, Type *type, FILE *f)
+{
+ char *tmp;
+
+ asprintf (&tmp, "*(%s%s)", where, name);
+ fprintf (f, "if(%s%s)", where, name);
+ free_type(tmp, "", type->subtype, f);
+ free(tmp);
+}
+
+/*
* encode type
*/
@@ -945,39 +1123,35 @@ encode_type (char *name, Type *type, FILE *f, EncodeType encodetype,
Side side)
{
switch (type->type) {
- case TCHAR :
- case TUCHAR :
-#if 0
- encode_char (name, type, f, encodetype);
- break;
-#endif
- case TSHORT :
- case TUSHORT :
-#if 0
- encode_short (name, type, f, encodetype);
- break;
-#endif
- case TLONG :
- case TULONG :
+ case YDR_TCHAR :
+ case YDR_TUCHAR :
+ case YDR_TSHORT :
+ case YDR_TUSHORT :
+ case YDR_TLONG :
+ case YDR_TULONG :
encode_long (name, type, f, encodetype);
break;
- case TSTRING :
+ case YDR_TLONGLONG :
+ case YDR_TULONGLONG :
+ encode_longlong (name, type, f, encodetype);
+ break;
+ case YDR_TSTRING :
encode_string (name, type, f, encodetype, side);
break;
- case TOPAQUE :
+ case YDR_TOPAQUE :
error_message (1,
"Type opaque only allowed as part of an array");
break;
- case TUSERDEF :
+ case YDR_TUSERDEF :
encode_symbol (type->symbol, name, f, encodetype, side);
break;
- case TARRAY :
+ case YDR_TARRAY :
encode_array (name, type, f, encodetype, side);
break;
- case TVARRAY :
+ case YDR_TVARRAY :
encode_varray (name, type, f, encodetype, side);
break;
- case TPOINTER :
+ case YDR_TPOINTER :
encode_pointer (name, type, f, encodetype, side);
break;
default :
@@ -995,38 +1169,34 @@ display_type (char *where, char *name, Type *type, FILE *f)
assert (where);
switch (type->type) {
- case TCHAR :
- case TUCHAR :
-#if 0
- print_char (name, type, f, encodetype);
- break;
-#endif
- case TSHORT :
- case TUSHORT :
-#if 0
- print_short (name, type, f, encodetype);
- break;
-#endif
- case TLONG :
- case TULONG :
+ case YDR_TCHAR :
+ case YDR_TUCHAR :
+ case YDR_TSHORT :
+ case YDR_TUSHORT :
+ case YDR_TLONG :
+ case YDR_TULONG :
print_long (where, name, type, f);
break;
- case TSTRING :
+ case YDR_TLONGLONG :
+ case YDR_TULONGLONG :
+ print_longlong (where, name, type, f);
+ break;
+ case YDR_TSTRING :
print_string (where, name, type, f);
break;
- case TOPAQUE :
+ case YDR_TOPAQUE :
fprintf (f, "printf(\"printing TOPAQUE\\n\");");
break;
- case TUSERDEF :
+ case YDR_TUSERDEF :
print_symbol (where, type->symbol, name, f);
break;
- case TARRAY :
+ case YDR_TARRAY :
print_array (where, name, type, f);
break;
- case TVARRAY :
+ case YDR_TVARRAY :
print_varray (where, name, type, f);
break;
- case TPOINTER :
+ case YDR_TPOINTER :
fprintf (f, "printf(\"printing TPOINTER\\n\");");
break;
default :
@@ -1034,6 +1204,47 @@ display_type (char *where, char *name, Type *type, FILE *f)
}
}
+/*
+ * free type
+ */
+
+static void
+free_type (char *where, char *name, Type *type, FILE *f)
+{
+ switch (type->type) {
+ case YDR_TCHAR :
+ case YDR_TUCHAR :
+ case YDR_TSHORT :
+ case YDR_TUSHORT :
+ case YDR_TLONG :
+ case YDR_TULONG :
+ case YDR_TLONGLONG :
+ case YDR_TULONGLONG :
+ break;
+ case YDR_TSTRING :
+#if 0
+ free_string (where, name, type, f);
+#endif
+ break;
+ case YDR_TOPAQUE :
+ break;
+ case YDR_TUSERDEF :
+ free_symbol (where, type->symbol, name, f);
+ break;
+ case YDR_TARRAY :
+ free_array (where, name, type, f);
+ break;
+ case YDR_TVARRAY :
+ free_varray (where, name, type, f);
+ break;
+ case YDR_TPOINTER :
+ free_pointer (where, name, type, f);
+ break;
+ default :
+ abort();
+ }
+}
+
struct context {
char *name;
FILE *f;
@@ -1057,9 +1268,9 @@ encode_entry (List *list, Listitem *item, void *arg)
strlcat (tmp, ".", sizeof tmp);
strlcat (tmp, s->name, sizeof tmp);
- if (s->type->type == TPOINTER
- && s->type->subtype->type == TUSERDEF
- && s->type->subtype->symbol->type == TSTRUCT
+ if (s->type->type == YDR_TPOINTER
+ && s->type->subtype->type == YDR_TUSERDEF
+ && s->type->subtype->symbol->type == YDR_TSTRUCT
&& strcmp(s->type->subtype->symbol->name,
context->symbol->name) == 0) {
fprintf (context->f,
@@ -1090,7 +1301,8 @@ encode_struct (Symbol *s, char *name, FILE *f, EncodeType encodetype,
context.encodetype = encodetype;
context.side = side;
- listiter (s->u.list, encode_entry, (void *)&context);
+ if (s->u.list)
+ listiter (s->u.list, encode_entry, (void *)&context);
}
/*
@@ -1116,9 +1328,9 @@ print_structentry (List *list, Listitem *item, void *arg)
asprintf(&tmp, ".%s", s->name);
asprintf(&tmp2, "%s%s", context->where, context->name);
- if (s->type->type == TPOINTER
- && s->type->subtype->type == TUSERDEF
- && s->type->subtype->symbol->type == TSTRUCT
+ if (s->type->type == YDR_TPOINTER
+ && s->type->subtype->type == YDR_TUSERDEF
+ && s->type->subtype->symbol->type == YDR_TSTRUCT
&& strcmp(s->type->subtype->symbol->name,
context->symbol->name) == 0) {
fprintf (context->f,
@@ -1155,7 +1367,70 @@ print_struct (char *where, Symbol *s, char *name, FILE *f)
fprintf (f, "/* printing TSTRUCT %s%s */\n", where, name);
- listiter (s->u.list, print_structentry, (void *)&context);
+ if (s->u.list)
+ listiter (s->u.list, print_structentry, (void *)&context);
+}
+
+/*
+ * help function for free_struct
+ */
+
+struct freecontext {
+ char *where;
+ char *name;
+ FILE *f;
+ Symbol *symbol;
+};
+
+static Bool
+free_structentry (List *list, Listitem *item, void *arg)
+{
+ StructEntry *s = (StructEntry *)listdata (item);
+ struct freecontext *context = (struct freecontext *)arg;
+
+ char *tmp;
+ char *tmp2;
+
+ asprintf(&tmp, ".%s", s->name);
+ asprintf(&tmp2, "%s%s", context->where, context->name);
+
+ if (s->type->type == YDR_TPOINTER
+ && s->type->subtype->type == YDR_TUSERDEF
+ && s->type->subtype->symbol->type == YDR_TSTRUCT
+ && strcmp(s->type->subtype->symbol->name,
+ context->symbol->name) == 0) {
+ fprintf (context->f,
+ "ydr_free_%s%s(%s%s, ptr);\n",
+ package,
+ context->symbol->name,
+ tmp2,
+ tmp);
+ } else {
+ free_type (tmp2, tmp, s->type, context->f);
+ }
+
+ free(tmp);
+ free(tmp2);
+
+ return FALSE;
+}
+
+/*
+ * free TSTRUCT
+ */
+
+static void
+free_struct (char *where, Symbol *s, char *name, FILE *f)
+{
+ struct freecontext context;
+
+ context.name = name;
+ context.symbol = s;
+ context.f = f;
+ context.where = where;
+
+ if (s->u.list)
+ listiter (s->u.list, free_structentry, (void *)&context);
}
/*
@@ -1166,7 +1441,7 @@ static void
encode_enum (Symbol *s, char *name, FILE *f, EncodeType encodetype,
Side side)
{
- Type type = {TLONG};
+ Type type = {YDR_TLONG};
encode_type (name, &type, f, encodetype, side);
}
@@ -1196,7 +1471,8 @@ print_enum (char *where, Symbol *s, char *name, FILE *f)
fprintf (f, "printf(\"%s = \");", name);
fprintf (f, "switch(%s) {\n", where);
- listiter (s->u.list, gen_printenum, f);
+ if (s->u.list)
+ listiter (s->u.list, gen_printenum, f);
fprintf (f,
"default:\n"
"printf(\" unknown enum %%d\", %s);\n"
@@ -1226,6 +1502,16 @@ print_typedef (char *where, Symbol *s, char *name, FILE *f)
}
/*
+ * free TTYPEDEF
+ */
+
+static void
+free_typedef (char *where, Symbol *s, char *name, FILE *f)
+{
+ free_type (where, name, s->u.type, f);
+}
+
+/*
* Encode symbol/TUSERDEF
*/
@@ -1234,13 +1520,13 @@ encode_symbol (Symbol *s, char *name, FILE *f, EncodeType encodetype,
Side side)
{
switch (s->type) {
- case TSTRUCT :
+ case YDR_TSTRUCT :
encode_struct (s, name, f, encodetype, side);
break;
- case TENUM :
+ case YDR_TENUM :
encode_enum (s, name, f, encodetype, side);
break;
- case TTYPEDEF :
+ case YDR_TTYPEDEF :
encode_typedef (s, name, f, encodetype, side);
break;
default :
@@ -1256,13 +1542,13 @@ static void
print_symbol (char *where, Symbol *s, char *name, FILE *f)
{
switch (s->type) {
- case TSTRUCT :
+ case YDR_TSTRUCT :
print_struct (where, s, name, f);
break;
- case TENUM :
+ case YDR_TENUM :
print_enum (where, s, name, f);
break;
- case TTYPEDEF :
+ case YDR_TTYPEDEF :
print_typedef (where, s, name, f);
break;
default :
@@ -1271,19 +1557,48 @@ print_symbol (char *where, Symbol *s, char *name, FILE *f)
}
/*
+ * Generate a free function for symbol
+ */
+
+static void
+free_symbol (char *where, Symbol *s, char *name, FILE *f)
+{
+ switch (s->type) {
+ case YDR_TSTRUCT :
+ free_struct (where, s, name, f);
+ break;
+ case YDR_TENUM :
+ break;
+ case YDR_TTYPEDEF :
+ free_typedef (where, s, name, f);
+ break;
+ default :
+ abort();
+ }
+}
+
+/*
* Generate the definition of an encode/decode function.
*/
static void
generate_function_definition (Symbol *s, FILE *f, Bool encodep)
{
- if (s->type == TSTRUCT || s->type == TENUM || s->type == TTYPEDEF) {
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF)
+ {
fprintf (f,
- "char *ydr_%scode_%s(%s *o, char *ptr, size_t *total_len)",
+ "%schar *ydr_%scode_%s(%s%s *o, %schar *ptr, size_t *total_len)",
+ encodep ? "" : "const ",
encodep ? "en" : "de",
- s->name, s->name);
- } else if (s->type == TCONST || s->type == TENUMVAL
- || s->type == TTYPEDEF)
+ s->name,
+ encodep ? "const " : "",
+ s->name,
+ encodep ? "" : "const ");
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
;
else
error_message (1, "What is %s (type %d) doing here?\n",
@@ -1297,12 +1612,39 @@ generate_function_definition (Symbol *s, FILE *f, Bool encodep)
static void
generate_printfunction_definition (Symbol *s, FILE *f)
{
- if (s->type == TSTRUCT || s->type == TENUM || s->type == TTYPEDEF) {
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF)
+ {
fprintf (f,
"void ydr_print_%s(%s *o)",
s->name, s->name);
- } else if (s->type == TCONST || s->type == TENUMVAL
- || s->type == TTYPEDEF)
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
+ ;
+ else
+ error_message (1, "What is %s (type %d) doing here?\n",
+ s->name, s->type);
+}
+
+/*
+ * Generate a defintion for a function to free `s', writing it to `f'
+ */
+
+static void
+generate_freefunction_definition (Symbol *s, FILE *f)
+{
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF)
+ {
+ fprintf (f,
+ "void ydr_free_%s(%s *o)",
+ s->name, s->name);
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
;
else
error_message (1, "What is %s (type %d) doing here?\n",
@@ -1316,17 +1658,25 @@ generate_printfunction_definition (Symbol *s, FILE *f)
void
generate_function (Symbol *s, FILE *f, Bool encodep)
{
- if (s->type == TSTRUCT || s->type == TENUM || s->type == TTYPEDEF) {
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF)
+ {
generate_function_definition (s, f, encodep);
fprintf (f, "\n{\n");
+ if (!encodep)
+ fprintf (f, "memset(o, 0, sizeof(*o));\n");
encode_symbol (s, "(*o)", f,
encodep ? ENCODE_MEM : DECODE_MEM, CLIENT);
fprintf (f, "return ptr;\n"
- "fail:\n"
- "errno = EFAULT;\n"
+ "fail:\n");
+ if (!encodep)
+ free_symbol ("", s, "(*o)", f);
+ fprintf (f, "errno = EINVAL;\n"
"return NULL;}\n");
- } else if (s->type == TCONST || s->type == TENUMVAL
- || s->type == TTYPEDEF)
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
;
else
error_message (1, "What is %s (type %d) doing here?\n",
@@ -1340,13 +1690,39 @@ generate_function (Symbol *s, FILE *f, Bool encodep)
void
generate_printfunction (Symbol *s, FILE *f)
{
- if (s->type == TSTRUCT || s->type == TENUM || s->type == TTYPEDEF) {
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF) {
generate_printfunction_definition (s, f);
fprintf (f, "\n{\n");
print_symbol ("(*o)", s, "", f);
fprintf (f, "return;\n}\n");
- } else if (s->type == TCONST || s->type == TENUMVAL
- || s->type == TTYPEDEF)
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
+ ;
+ else
+ error_message (1, "What is %s (type %d) doing here?\n",
+ s->name, s->type);
+}
+
+/*
+ * Generate a free function for the type `s' and print it on `f'.
+ */
+
+void
+generate_freefunction (Symbol *s, FILE *f)
+{
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF) {
+ generate_freefunction_definition (s, f);
+ fprintf (f, "\n{\n");
+ free_symbol("(*o)", s, "", f);
+ fprintf (f, "return;\n}\n");
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
;
else
error_message (1, "What is %s (type %d) doing here?\n",
@@ -1360,11 +1736,15 @@ generate_printfunction (Symbol *s, FILE *f)
void
generate_function_prototype (Symbol *s, FILE *f, Bool encodep)
{
- if (s->type == TSTRUCT || s->type == TENUM || s->type == TTYPEDEF) {
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF)
+ {
generate_function_definition (s, f, encodep);
fprintf (f, ";\n");
- } else if (s->type == TCONST || s->type == TENUMVAL
- || s->type == TTYPEDEF)
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
;
else
error_message (1, "What is %s (type %d) doing here?\n",
@@ -1378,11 +1758,36 @@ generate_function_prototype (Symbol *s, FILE *f, Bool encodep)
void
generate_printfunction_prototype (Symbol *s, FILE *f)
{
- if (s->type == TSTRUCT || s->type == TENUM || s->type == TTYPEDEF) {
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF) {
generate_printfunction_definition (s, f);
fprintf (f, ";\n");
- } else if (s->type == TCONST || s->type == TENUMVAL
- || s->type == TTYPEDEF)
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
+ ;
+ else
+ error_message (1, "What is %s (type %d) doing here?\n",
+ s->name, s->type);
+}
+
+/*
+ * Generate a prototype for a free function for the `s' type
+ * and output it to `f'
+ */
+
+void
+generate_freefunction_prototype(Symbol *s, FILE *f)
+{
+ if (s->type == YDR_TSTRUCT
+ || s->type == YDR_TENUM
+ || s->type == YDR_TTYPEDEF) {
+ generate_freefunction_definition (s, f);
+ fprintf (f, ";\n");
+ } else if (s->type == YDR_TCONST
+ || s->type == YDR_TENUMVAL
+ || s->type == YDR_TTYPEDEF)
;
else
error_message (1, "What is %s (type %d) doing here?\n",
@@ -1396,8 +1801,8 @@ gen1 (List *list, Listitem *item, void *arg)
FILE *f = (FILE *)arg;
if ((a->argtype == TOUT || a->argtype == TINOUT)
- && a->type->type != TPOINTER
- && a->type->type != TSTRING)
+ && a->type->type != YDR_TPOINTER
+ && a->type->type != YDR_TSTRING)
error_message (1, "Argument %s is OUT and not pointer or string.\n",
a->name);
fprintf (f, ", ");
@@ -1439,7 +1844,7 @@ gendeclare (List *list, Listitem *item, void *arg)
Argument *a = (Argument *)listdata (item);
FILE *f = (FILE *)arg;
- if (a->type->type == TPOINTER)
+ if (a->type->type == YDR_TPOINTER)
print_type (a->name, a->type->subtype, TIN, VDECL, f);
else
print_type (a->name, a->type, TIN, VDECL, f);
@@ -1448,15 +1853,26 @@ gendeclare (List *list, Listitem *item, void *arg)
}
static Bool
+genzero (List *list, Listitem *item, void *arg)
+{
+ Argument *a = (Argument *)listdata (item);
+ FILE *f = (FILE *)arg;
+
+ fprintf (f, "memset(&%s, 0, sizeof(%s));\n",
+ a->name, a->name);
+ return FALSE;
+}
+
+static Bool
genfree_isarrayp(Type *type)
{
- if (type->type == TVARRAY)
+ if (type->type == YDR_TVARRAY)
return TRUE;
- if (type->type == TPOINTER)
+ if (type->type == YDR_TPOINTER)
return genfree_isarrayp(type->subtype);
- if (type->type == TUSERDEF &&
+ if (type->type == YDR_TUSERDEF &&
type->symbol &&
- type->symbol->type == TTYPEDEF)
+ type->symbol->type == YDR_TTYPEDEF)
return genfree_isarrayp(type->symbol->u.type);
return FALSE;
@@ -1472,7 +1888,7 @@ genfree (List *list, Listitem *item, void *arg)
if (genfree_isarrayp(a->type))
fprintf(f, "free(%s.val);\n", a->name);
else if (a->argtype != TIN
- && a->type->type == TSTRING && a->type->size == 0)
+ && a->type->type == YDR_TSTRING && a->type->size == 0)
fprintf (f, "free(%s);\n", a->name);
return FALSE;
}
@@ -1513,7 +1929,7 @@ gendecodeout (List *list, Listitem *item, void *arg)
encode_type (tmp, a->type->subtype, f, DECODE_RX, CLIENT);
free (tmp);
- } else if(a->type->type == TSTRING) {
+ } else if(a->type->type == YDR_TSTRING) {
encode_type (a->name, a->type, f, DECODE_RX, CLIENT);
}
}
@@ -1529,7 +1945,7 @@ gendecodein (List *list, Listitem *item, void *arg)
if (a->argtype != TIN && a->argtype != TINOUT)
return TRUE;
else {
- if (a->type->type == TPOINTER) {
+ if (a->type->type == YDR_TPOINTER) {
#if 0
size_t len = strlen(a->name) + 4;
char *tmp = (char *)emalloc (len);
@@ -1553,7 +1969,7 @@ genencodeout (List *list, Listitem *item, void *arg)
FILE *f = (FILE *)arg;
if (a->argtype == TOUT || a->argtype == TINOUT) {
- if (a->type->type == TPOINTER)
+ if (a->type->type == YDR_TPOINTER)
encode_type (a->name, a->type->subtype, f, ENCODE_RX, SERVER);
else
encode_type (a->name, a->type, f, ENCODE_RX, SERVER);
@@ -1590,9 +2006,9 @@ genargs (List *list, Listitem *item, void *arg)
Argument *a = (Argument *)listdata (item);
FILE *f = (FILE *)arg;
- if (a->type->type == TPOINTER
+ if (a->type->type == YDR_TPOINTER
|| (a->argtype != TIN
- && a->type->type == TSTRING && a->type->size == 0))
+ && a->type->type == YDR_TSTRING && a->type->size == 0))
putc ('&', f);
fputs (a->name, f);
if (listnext (list, item))
@@ -1607,7 +2023,7 @@ genargs (List *list, Listitem *item, void *arg)
static void
generate_simple_stub (Symbol *s, FILE *f, FILE *headerf)
{
- Type type = {TLONG};
+ Type type = {YDR_TLONG};
char *op;
fprintf (headerf, "int %s%s(\nstruct rx_connection *connection\n",
@@ -1632,7 +2048,7 @@ generate_simple_stub (Symbol *s, FILE *f, FILE *headerf)
fprintf (f,
"return %s(rx_EndCall (call,0));\n"
"fail:\n"
- "ret = %s(rx_Error(call));\n"
+ "ret = %s(rx_GetCallError(call));\n"
"rx_EndCall (call, 0);\n"
"return ret;\n"
"}\n",
@@ -1643,7 +2059,7 @@ generate_simple_stub (Symbol *s, FILE *f, FILE *headerf)
static void
generate_split_stub (Symbol *s, FILE *f, FILE *headerf)
{
- Type type = {TLONG};
+ Type type = {YDR_TLONG};
char *op;
fprintf (headerf, "int Start%s%s(\nstruct rx_call *call\n",
@@ -1666,7 +2082,7 @@ generate_split_stub (Symbol *s, FILE *f, FILE *headerf)
if (findargtype(s->u.proc.arguments, TIN) ||
findargtype(s->u.proc.arguments, TINOUT))
fprintf (f, "fail:\n"
- "return %s(rx_Error(call));\n",
+ "return %s(rx_GetCallError(call));\n",
error_function);
fprintf (f, "}\n\n");
@@ -1687,7 +2103,7 @@ generate_split_stub (Symbol *s, FILE *f, FILE *headerf)
if (findargtype(s->u.proc.arguments, TOUT) ||
findargtype(s->u.proc.arguments, TINOUT))
fprintf (f, "fail:\n"
- "return %s(rx_Error(call));\n",
+ "return %s(rx_GetCallError(call));\n",
error_function);
fprintf (f, "}\n\n");
@@ -1767,15 +2183,32 @@ generate_standard_c_prologue (FILE *f,
fprintf (f, "#include <string.h>\n");
fprintf (f, "#include <netinet/in.h>\n");
fprintf (f, "#include <errno.h>\n");
- fprintf (f, "#ifndef HAVE_BCOPY\n"
- "#define bcopy(a,b,c) memcpy((b),(a),(c))\n"
- "#endif /* !HAVE_BCOPY */\n\n");
fprintf (f, "#ifdef RCSID\n"
- "RCSID(\"%s generated from %s.xg with $KTH: output.c,v 1.73.2.1 2001/03/04 04:48:48 lha Exp $\");\n"
+ "RCSID(\"%s generated from %s.xg with $arla: output.c,v 1.91 2003/04/16 09:07:03 lha Exp $\");\n"
"#endif\n\n", filename, basename);
}
/*
+ * Convert filename into a cpp symbol
+ */
+
+static char *
+cppfilesymbolname(const char *fn)
+{
+ char *symname, *tmp;
+
+ symname = estrdup(fn);
+ estrdup (symname);
+ for (tmp = symname; *tmp; tmp++) {
+ if (tmp == symname && isdigit((unsigned char)*tmp))
+ *tmp = '_';
+ if (!isalpha((unsigned char)*tmp))
+ *tmp = '_';
+ }
+ return symname;
+}
+
+/*
* open all files
*/
@@ -1783,7 +2216,7 @@ void
init_generate (const char *filename)
{
char *tmp;
- char *fileuppr;
+ char *fileupr;
func_list = listnew ();
@@ -1793,13 +2226,12 @@ init_generate (const char *filename)
ydr_fopen (tmp, "w", &headerfile);
free (tmp);
- fileuppr = estrdup (filename);
- strupr (fileuppr);
+ fileupr = cppfilesymbolname(filename);
fprintf (headerfile.stream, "/* Generated from %s.xg */\n", filename);
fprintf (headerfile.stream, "#ifndef _%s_\n"
- "#define _%s_\n\n", fileuppr, fileuppr);
+ "#define _%s_\n\n", fileupr, fileupr);
fprintf (headerfile.stream, "#include <atypes.h>\n\n");
- free (fileuppr);
+ free (fileupr);
asprintf (&tmp, "%s.ydr.c", filename);
if (tmp == NULL)
@@ -1842,12 +2274,6 @@ init_generate (const char *filename)
fprintf (serverhdrfile.stream, "#include <rx/rx.h>\n");
fprintf (serverhdrfile.stream, "#include \"%s.h\"\n\n", filename);
- asprintf (&tmp, "%s.td.c", filename);
- if (tmp == NULL)
- err (1, "malloc");
- ydr_fopen (tmp, "w", &td_file);
- free (tmp);
-
packagelist = listnew();
if (packagelist == NULL)
err (1, "init_generate: listnew: packagelist");
@@ -1856,17 +2282,17 @@ init_generate (const char *filename)
void
close_generator (const char *filename)
{
- char *fileupr = estrdup (filename);
+ char *fileupr;
- strupr (fileupr);
+ fileupr = cppfilesymbolname(filename);
fprintf (headerfile.stream, "\n#endif /* %s */\n", fileupr);
+ free(fileupr);
ydr_fclose (&headerfile);
ydr_fclose (&clientfile);
ydr_fclose (&serverfile);
ydr_fclose (&clienthdrfile);
ydr_fclose (&serverhdrfile);
ydr_fclose (&ydrfile);
- ydr_fclose (&td_file);
}
/*
@@ -1877,21 +2303,20 @@ close_generator (const char *filename)
void
generate_server_stub (Symbol *s, FILE *f, FILE *headerf, FILE *h_file)
{
- fprintf (headerf, "int _%s%s(\nstruct rx_call *call);\n",
- package, s->name);
- fprintf (headerf, "int %s%s%s(\nstruct rx_call *call\n",
+ fprintf (headerf, "int S%s%s%s(\nstruct rx_call *call\n",
prefix, package, s->name);
listiter (s->u.proc.arguments, gen1, headerf);
fprintf (headerf, ");\n\n");
- fprintf (f, "int _%s%s(\nstruct rx_call *call)\n",
+ fprintf (f, "static int ydr_ps_%s%s(\nstruct rx_call *call)\n",
package, s->name);
fprintf (f, "{\n"
"int32_t _result;\n");
listiter (s->u.proc.arguments, gendeclare, f);
+ listiter (s->u.proc.arguments, genzero, f);
fprintf (f, "\n");
listiter (s->u.proc.arguments, gendecodein, f);
- fprintf (f, "_result = %s%s%s(", prefix, package, s->name);
+ fprintf (f, "_result = S%s%s%s(", prefix, package, s->name);
if (/* s->u.proc.splitp */ 1) {
fprintf (f, "call");
if (!listemptyp (s->u.proc.arguments))
@@ -1906,7 +2331,7 @@ generate_server_stub (Symbol *s, FILE *f, FILE *headerf, FILE *h_file)
if (!listemptyp(s->u.proc.arguments)) {
fprintf(f, "fail:\n");
listiter (s->u.proc.arguments, genfree, f);
- fprintf(f, "return rx_Error(call);\n");
+ fprintf(f, "return rx_GetCallError(call);\n");
}
fprintf(f, "funcfail:\n"
@@ -1932,7 +2357,7 @@ gencase (List *list, Listitem *item, void *arg)
if (c->package == s->u.proc.package) {
fprintf (f, "case %u: {\n"
- "_result = _%s%s(call);\n"
+ "_result = ydr_ps_%s%s(call);\n"
"break;\n"
"}\n",
s->u.proc.id, s->u.proc.package, s->name);
@@ -1948,7 +2373,7 @@ void
generate_server_switch (FILE *c_file,
FILE *h_file)
{
- Type optype = {TULONG};
+ Type optype = {YDR_TULONG};
Listitem *li;
struct gencase_context c;
@@ -1976,151 +2401,20 @@ generate_server_switch (FILE *c_file,
fprintf (c_file, "default:\n"
"_result = RXGEN_OPCODE;\n"
- "fprintf (stderr, \"Ignoring %%d\\n\", opcode);\n"
"}\n"
"return _result;\n"
"fail:\n"
- "return rx_Error(call);\n"
+ "return rx_GetCallError(call);\n"
"}\n\n");
li = listnext (packagelist, li);
}
}
-static Bool
-gentcpdump_decode (List *list, Listitem *item, void *arg)
-{
- Argument *a = (Argument *)listdata (item);
- FILE *f = (FILE *)arg;
-
- if (a->type->type == TPOINTER)
- encode_type (a->name, a->type->subtype, f, ENCODE_MEM, CLIENT);
- else
- encode_type (a->name, a->type, f, ENCODE_MEM, CLIENT);
-
- fprintf (f, "++found;\n");
- return FALSE;
-}
-
/*
*
*/
-static Bool
-gentcpdump_print (List *list, Listitem *item, void *arg)
-{
- Argument *a = (Argument *)listdata (item);
- FILE *f = (FILE *)arg;
-
- fprintf (f, "if (found > 0)\n\n"
- "{ --found;\n");
-
- if (a->type->type == TPOINTER)
- display_type ("", a->name, a->type->subtype, f);
- else
- display_type ("", a->name, a->type, f);
-
- if (listnextp(item))
- fprintf (f, "printf(\",\");\n");
-
- fprintf (f, "} else\n"
- "goto failandquit;\n");
-
- return FALSE;
-}
-
-/*
- *
- */
-
-void
-generate_tcpdump_stub (Symbol *s, FILE *f)
-{
- fprintf (f, "void %s%s_print(char *ptr, size_t *total_len)\n"
- "{\n"
- "int found = 0;\n",
- package, s->name);
- listiter (s->u.proc.arguments, gendeclare, f);
- fprintf (f, "\n");
-
- listiter (s->u.proc.arguments, gentcpdump_decode, f);
- if (!listemptyp(s->u.proc.arguments))
- fprintf(f, "fail:\n");
- fprintf (f, "printf(\"{\");");
- listiter (s->u.proc.arguments, gentcpdump_print, f);
- fprintf (f, "printf(\"}\\n\");");
-
- fprintf (f, "\nreturn ptr;\n");
- if (!listemptyp(s->u.proc.arguments))
- fprintf(f, "failandquit:\n"
- "printf(\"Error decoding paket\");\n"
- "return NULL;");
- fprintf(f, "}\n\n");
-}
-
-
-static Bool
-gentcpdump_case (List *list, Listitem *item, void *arg)
-{
- Symbol *s = (Symbol *)listdata (item);
- FILE *f = (FILE *)arg;
-
- fprintf (f, "case %u:\n"
- "printf(\"%s%s(\");\n"
- "ret = %s%s_print(ptr, &total_len);\n"
- "break;\n",
- s->u.proc.id,
- package,
- s->name,
- package,
- s->name);
-
- return FALSE;
-}
-
-/*
- * generate tcpdump patches
- */
-
-
-void
-generate_tcpdump_patches(FILE *td_file, const char *filename)
-{
- Type optype = {TULONG};
-
- fprintf(td_file, "/* generated by $KTH: output.c,v 1.73.2.1 2001/03/04 04:48:48 lha Exp $ */\n\n");
-
- fprintf (td_file,
- "#include <stdio.h>\n"
- "#include <stdlib.h>\n"
- "#include \"%s.h\"\n",
- filename);
-
- fprintf (td_file, "%stcpdump_print(const unsigned char *ptr,"
- "unsigned int len,"
- "unsigned char *bp2)\n"
- "{\n"
- "u_int32_t opcode;\n"
- "size_t *total_len = len;\n"
- "char *ret;\n",
- package);
-
- encode_type ("opcode", &optype, td_file, DECODE_MEM, CLIENT);
-
- fprintf (td_file, "switch(opcode) {\n");
-
- listiter (func_list, gentcpdump_case, td_file);
-
- fprintf (td_file, "default:\n"
- "printf (\"Unknown opcode %%s->%%d\\n\", "
- "package, opcode);\n"
- "}\n"
- "fail:\n"
- "printf(\"Error decoding packet\\n\");\n"
- "}\n\n");
-
-}
-
void
ydr_fopen (const char *name, const char *mode, ydr_file *f)
{
diff --git a/usr.sbin/afs/src/ydr/output.h b/usr.sbin/afs/src/ydr/output.h
index 7d85f5fe879..7b059a2b6ed 100644
--- a/usr.sbin/afs/src/ydr/output.h
+++ b/usr.sbin/afs/src/ydr/output.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: output.h,v 1.16 2000/10/10 00:48:55 lha Exp $ */
+/* $arla: output.h,v 1.17 2002/11/27 23:51:35 lha Exp $ */
#ifndef _OUTPUT_
#define _OUTPUT_
@@ -56,7 +56,8 @@ void generate_client_stub (Symbol *s, FILE *f, FILE *headerf);
void generate_server_stub (Symbol *s, FILE *f, FILE *headerf, FILE *h_file);
void generate_tcpdump_stub (Symbol *s, FILE *f);
void generate_server_switch (FILE *c_f, FILE *h_file);
-void generate_tcpdump_patches(FILE *td_file, const char *filename);
+void generate_freefunction (Symbol *s, FILE *f);
+void generate_freefunction_prototype (Symbol *s, FILE *f);
void init_generate (const char *filename);
void close_generator (const char *filename);
@@ -66,7 +67,7 @@ extern List *packagelist;
extern char *prefix;
extern ydr_file headerfile, clientfile, serverfile, clienthdrfile,
- serverhdrfile, ydrfile, td_file;
+ serverhdrfile, ydrfile;
extern char *error_function;
diff --git a/usr.sbin/afs/src/ydr/parse.y b/usr.sbin/afs/src/ydr/parse.y
index eb6fdd857c2..6dae1015fc1 100644
--- a/usr.sbin/afs/src/ydr/parse.y
+++ b/usr.sbin/afs/src/ydr/parse.y
@@ -34,7 +34,7 @@
%{
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: parse.y,v 1.24 2000/10/02 22:36:59 lha Exp $");
+RCSID("$arla: parse.y,v 1.28 2003/01/20 07:12:58 lha Exp $");
#endif
#include <stdio.h>
@@ -66,6 +66,7 @@ static int varcnt = 0;
%token T_ENUM T_STRUCT T_CONST T_UNSIGNED T_ULONG T_INT T_CHAR T_STRING
%token T_LONG T_TYPEDEF T_OPAQUE T_IN T_OUT T_INOUT T_SPLIT T_MULTI
%token T_SHORT T_USHORT T_UCHAR T_ASIS T_PROC
+%token T_LONGLONG T_ULONGLONG
%token <name> T_IDENTIFIER T_VERBATIM T_PACKAGE T_PREFIX T_ERROR_FUNCTION
%token <constant> T_CONSTANT
%token <sym> T_IDCONST T_IDTYPE
@@ -73,11 +74,12 @@ static int varcnt = 0;
%type <constant> constant opt_constant opt_proc
%type <constant> param_type
%type <sym> enumentry type_decl proc_decl
-%type <list> enumentries enumbody structbody memberdecls params
+%type <list> enumentries enumbody structbody memberdecls params attrs
%type <type> type
%type <sentry> memberdecl memberdecl2
%type <arg> param
%type <flags> flags
+%type <name> attr
%start specification
@@ -90,6 +92,7 @@ specification:
;
declaration: type_decl {
+ if (!sym_find_attr($1, "__nogenerate__")) {
generate_header ($1, headerfile.stream);
generate_sizeof ($1, headerfile.stream);
generate_function ($1, ydrfile.stream, TRUE);
@@ -98,6 +101,9 @@ declaration: type_decl {
generate_function_prototype ($1, headerfile.stream, FALSE);
generate_printfunction ($1, ydrfile.stream);
generate_printfunction_prototype ($1, headerfile.stream);
+ generate_freefunction ($1, ydrfile.stream);
+ generate_freefunction_prototype ($1, headerfile.stream);
+ }
}
| proc_decl {
generate_client_stub ($1, clientfile.stream,
@@ -105,19 +111,20 @@ declaration: type_decl {
generate_server_stub ($1, serverfile.stream,
serverhdrfile.stream,
headerfile.stream);
- generate_tcpdump_stub ($1, td_file.stream);
}
;
type_decl : T_ENUM T_IDENTIFIER enumbody ';'
{ $$ = define_enum ($2, $3); varcnt = 0; }
- | T_STRUCT T_IDENTIFIER { define_struct($2); } structbody ';'
- { $$ = set_struct_body ($2, $4); }
- | T_STRUCT type structbody ';'
- { if($2->symbol && $2->symbol->type != TSTRUCT)
+ | T_STRUCT T_IDENTIFIER { define_struct($2); } structbody attrs ';'
+ { $$ = set_struct_body ($2, $4);
+ set_sym_attrs($$, $5); }
+ | T_STRUCT type structbody attrs';'
+ { if($2->symbol && $2->symbol->type != YDR_TSTRUCT)
error_message (1, "%s is not a struct\n",
$2->symbol->name);
$$ = set_struct_body_sym ($2->symbol, $3);
+ set_sym_attrs($2->symbol, $4);
}
| T_TYPEDEF memberdecl ';'
{ $$ = define_typedef ($2); }
@@ -136,7 +143,7 @@ opt_proc: { $$ = 0; }/* empty */
proc_decl: opt_proc T_IDENTIFIER '(' params ')' flags '=' constant ';'
{ $$ = (Symbol *)emalloc(sizeof(Symbol));
- $$->type = TPROC;
+ $$->type = YDR_TPROC;
$$->name = $2;
$$->u.proc.package = package;
$$->u.proc.arguments = $4;
@@ -202,67 +209,71 @@ memberdecl: T_ASIS memberdecl2
memberdecl2: type T_IDENTIFIER
{ $$ = createstructentry ($2, $1); }
| T_STRING T_IDENTIFIER '<' opt_constant '>'
- { Type *t = create_type (TSTRING, NULL, $4, NULL, NULL, 0);
+ { Type *t = create_type (YDR_TSTRING, NULL, $4, NULL, NULL,0);
$$ = createstructentry ($2, t);
}
| T_STRING T_IDENTIFIER
- { Type *t = create_type (TSTRING, NULL, 0, NULL, NULL, 0);
+ { Type *t = create_type (YDR_TSTRING, NULL, 0, NULL, NULL, 0);
$$ = createstructentry ($2, t);
}
| type T_IDENTIFIER '[' opt_constant ']'
- { Type *t = create_type (TARRAY, NULL, $4, $1, NULL, 0);
+ { Type *t = create_type (YDR_TARRAY, NULL, $4, $1, NULL, 0);
$$ = createstructentry ($2, t); }
| type T_IDENTIFIER '<' opt_constant '>'
- { Type *t = create_type (TVARRAY, NULL, $4, $1, NULL, 0);
+ { Type *t = create_type (YDR_TVARRAY, NULL, $4, $1, NULL, 0);
$$ = createstructentry ($2, t); }
| type T_IDENTIFIER '<' type '>'
- { Type *t = create_type (TVARRAY, NULL, 0, $1, $4, 0);
+ { Type *t = create_type (YDR_TVARRAY, NULL, 0, $1, $4, 0);
$$ = createstructentry ($2, t); }
;
type: long_or_int
- { $$ = create_type (TLONG, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TLONG, NULL, 0, NULL, NULL, 0); }
| T_UNSIGNED
- { $$ = create_type (TULONG, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TULONG, NULL, 0, NULL, NULL, 0); }
| T_ULONG
- { $$ = create_type (TULONG, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TULONG, NULL, 0, NULL, NULL, 0); }
| T_UNSIGNED T_LONG
- { $$ = create_type (TULONG, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TULONG, NULL, 0, NULL, NULL, 0); }
+ | T_LONGLONG
+ { $$ = create_type (YDR_TLONGLONG, NULL, 0, NULL, NULL, 0); }
+ | T_ULONGLONG
+ { $$ = create_type (YDR_TULONGLONG, NULL, 0, NULL, NULL, 0); }
| T_CHAR
- { $$ = create_type (TCHAR, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TCHAR, NULL, 0, NULL, NULL, 0); }
| T_UCHAR
- { $$ = create_type (TUCHAR, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TUCHAR, NULL, 0, NULL, NULL, 0); }
| T_UNSIGNED T_CHAR
- { $$ = create_type (TUCHAR, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TUCHAR, NULL, 0, NULL, NULL, 0); }
| T_SHORT
- { $$ = create_type (TSHORT, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TSHORT, NULL, 0, NULL, NULL, 0); }
| T_USHORT
- { $$ = create_type (TUSHORT, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TUSHORT, NULL, 0, NULL, NULL, 0); }
| T_UNSIGNED T_SHORT
- { $$ = create_type (TUSHORT, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TUSHORT, NULL, 0, NULL, NULL, 0); }
| T_STRING
- { $$ = create_type (TSTRING, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TSTRING, NULL, 0, NULL, NULL, 0); }
| T_OPAQUE
- { $$ = create_type (TOPAQUE, NULL, 0, NULL, NULL, 0); }
+ { $$ = create_type (YDR_TOPAQUE, NULL, 0, NULL, NULL, 0); }
| type '*'
- { $$ = create_type (TPOINTER, NULL, 0, $1, NULL, 0); }
+ { $$ = create_type (YDR_TPOINTER, NULL, 0, $1, NULL, 0); }
| T_IDTYPE
- { $$ = create_type (TUSERDEF, $1, 0, NULL, NULL, 0);
- if ($$->symbol->type != TSTRUCT
- && $$->symbol->type != TENUM
- && $$->symbol->type != TTYPEDEF)
+ { $$ = create_type (YDR_TUSERDEF, $1, 0, NULL, NULL, 0);
+ if ($$->symbol->type != YDR_TSTRUCT
+ && $$->symbol->type != YDR_TENUM
+ && $$->symbol->type != YDR_TTYPEDEF)
error_message (1, "%s used as a type\n",
$$->symbol->name);
}
| T_STRUCT type
{
$$ = $2;
- if ($$->symbol && $$->symbol->type != TSTRUCT)
+ if ($$->symbol && $$->symbol->type != YDR_TSTRUCT)
error_message (1, "%s is not a struct\n",
$$->symbol->name);
}
| T_STRUCT T_IDENTIFIER
- { $$ = create_type (TUSERDEF, define_struct($2), 0, NULL,
+ { $$ = create_type (YDR_TUSERDEF, define_struct($2), 0, NULL,
NULL, 0);
}
;
@@ -286,12 +297,24 @@ opt_constant: { $$ = 0; }
constant: T_CONSTANT { $$ = $1; }
| T_IDCONST
{ Symbol *s = $1;
- if (s->type != TCONST) {
+ if (s->type != YDR_TCONST) {
error_message (1, "%s not a constant\n", s->name);
} else
$$ = s->u.val;
- }
+ }
+ ;
+attrs: { $$ = listnew(); }
+ | attr { $$ = listnew(); listaddhead ($$, $1); }
+ | attrs attr
+ { listaddtail ($1, $2); $$ = $1; }
+ ;
+
+attr: T_IDENTIFIER '(' '(' T_IDENTIFIER ')' ')'
+ { $$ = $4;
+ if (strcmp($1, "__attribute__") != 0)
+ error_message(1, "%s isn't __attribute__"); }
+ ;
%%
void
diff --git a/usr.sbin/afs/src/ydr/sym.h b/usr.sbin/afs/src/ydr/sym.h
index bc4325ba91a..07fcc625eb0 100644
--- a/usr.sbin/afs/src/ydr/sym.h
+++ b/usr.sbin/afs/src/ydr/sym.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: sym.h,v 1.8 2000/10/02 22:37:05 lha Exp $ */
+/* $arla: sym.h,v 1.10 2002/04/15 14:53:19 lha Exp $ */
#ifndef _SYM_
#define _SYM_
@@ -45,7 +45,8 @@ typedef struct Type Type;
typedef enum
{
- TUNDEFINED, TSTRUCT, TENUM, TCONST, TENUMVAL, TTYPEDEF, TPROC
+ YDR_TUNDEFINED, YDR_TSTRUCT, YDR_TENUM, YDR_TCONST, YDR_TENUMVAL,
+ YDR_TTYPEDEF, YDR_TPROC
} SymbolType;
enum { TSPLIT = 1, TSIMPLE = 2, TMULTI = 4};
@@ -64,6 +65,7 @@ typedef struct {
char *package;
} proc;
} u;
+ List *attrs;
} Symbol;
void initsym (void);
diff --git a/usr.sbin/afs/src/ydr/symbol.c b/usr.sbin/afs/src/ydr/symbol.c
index 3460d036382..4fc9feeb000 100644
--- a/usr.sbin/afs/src/ydr/symbol.c
+++ b/usr.sbin/afs/src/ydr/symbol.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: symbol.c,v 1.8 2000/10/02 22:37:10 lha Exp $");
+RCSID("$arla: symbol.c,v 1.10 2002/04/15 14:53:19 lha Exp $");
#endif
#include <stdio.h>
@@ -81,7 +81,8 @@ addsym (char *name)
if (sym == NULL) {
sym = (Symbol *)emalloc (sizeof (Symbol));
sym->name = name;
- sym->type = TUNDEFINED;
+ sym->type = YDR_TUNDEFINED;
+ sym->attrs = NULL;
hashtabadd (hashtab, sym);
}
return sym;
@@ -102,22 +103,22 @@ printsymbol (void *ptr, void *arg)
Symbol *s = (Symbol *)ptr;
switch (s->type) {
- case TUNDEFINED :
+ case YDR_TUNDEFINED :
printf ("undefined ");
break;
- case TSTRUCT :
+ case YDR_TSTRUCT :
printf ("struct ");
break;
- case TENUM :
+ case YDR_TENUM :
printf ("enum ");
break;
- case TENUMVAL :
+ case YDR_TENUMVAL :
printf ("enumval ");
break;
- case TCONST :
+ case YDR_TCONST :
printf ("const ");
break;
- case TTYPEDEF :
+ case YDR_TTYPEDEF :
printf ("typedef ");
break;
default :
diff --git a/usr.sbin/afs/src/ydr/types.c b/usr.sbin/afs/src/ydr/types.c
index 9ad48f27680..daa1dd3a71b 100644
--- a/usr.sbin/afs/src/ydr/types.c
+++ b/usr.sbin/afs/src/ydr/types.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$KTH: types.c,v 1.8 2000/10/02 22:37:15 lha Exp $");
+RCSID("$arla: types.c,v 1.10 2002/04/15 14:53:19 lha Exp $");
#endif
#include <stdio.h>
@@ -48,11 +48,11 @@ define_const (char *name, int value)
s = addsym (name);
- if (s->type != TUNDEFINED) {
+ if (s->type != YDR_TUNDEFINED) {
error_message (1, "Redeclaration of %s\n", s->name);
return NULL;
}
- s->type = TCONST;
+ s->type = YDR_TCONST;
s->u.val = value;
return s;
}
@@ -64,11 +64,11 @@ define_enum (char *name, List *list)
s = addsym (name);
- if (s->type != TUNDEFINED) {
+ if (s->type != YDR_TUNDEFINED) {
error_message (1, "Redeclaration of %s\n", s->name);
return NULL;
}
- s->type = TENUM;
+ s->type = YDR_TENUM;
s->u.list = list;
return s;
}
@@ -80,12 +80,12 @@ define_struct (char *name)
s = addsym (name);
- if (s->type != TSTRUCT && s->type != TUNDEFINED) {
+ if (s->type != YDR_TSTRUCT && s->type != YDR_TUNDEFINED) {
error_message (1, "Redeclaration of %s as a different type\n",
s->name);
return NULL;
}
- s->type = TSTRUCT;
+ s->type = YDR_TSTRUCT;
s->u.list = NULL;
return s;
}
@@ -117,11 +117,11 @@ define_typedef (StructEntry *entry)
s = addsym (entry->name);
- if (s->type != TUNDEFINED) {
+ if (s->type != YDR_TUNDEFINED) {
error_message (1, "Redeclaration of %s\n", s->name);
return NULL;
}
- s->type = TTYPEDEF;
+ s->type = YDR_TTYPEDEF;
s->name = entry->name;
s->u.type = entry->type;
free (entry);
@@ -136,11 +136,11 @@ define_proc (char *name, List *args, unsigned id)
s = addsym (name);
- if (s->type != TUNDEFINED) {
+ if (s->type != YDR_TUNDEFINED) {
error_message (1, "Redeclaration of %s\n", s->name);
return NULL;
}
- s->type = TPROC;
+ s->type = YDR_TPROC;
s->u.proc.id = id;
s->u.proc.arguments = args;
return s;
@@ -153,11 +153,11 @@ createenumentry (char *name, int value)
s = addsym (name);
- if (s->type != TUNDEFINED) {
+ if (s->type != YDR_TUNDEFINED) {
error_message (1,"Redeclaration of %s\n", s->name);
return NULL;
}
- s->type = TENUMVAL;
+ s->type = YDR_TENUMVAL;
s->u.val = value;
return s;
}
@@ -191,3 +191,48 @@ create_type (TypeType type, Symbol *symbol, unsigned size,
return t;
}
+void
+set_sym_attrs(Symbol *symbol, List *attrs)
+{
+ switch (symbol->type) {
+ case YDR_TSTRUCT:
+ break;
+ default:
+ error_message(1, "can't set attribues for %s", symbol->name);
+ return;
+ }
+ symbol->attrs = attrs;
+}
+
+struct fa {
+ char *attr;
+ int found;
+};
+
+static int
+find_attr(List *l, Listitem *li, void *ptr)
+{
+ struct fa *f = ptr;
+ char *mem = listdata(li);
+ if (strcmp(f->attr, mem) == 0) {
+ f->found = 1;
+ return 1;
+ }
+ return 0;
+}
+
+int
+sym_find_attr(Symbol *symbol, char *attr)
+{
+ struct fa f;
+
+ if (symbol->attrs == NULL)
+ return 0;
+
+ f.attr = attr;
+ f.found = 0;
+
+ listiter(symbol->attrs, find_attr, &f);
+
+ return f.found;
+}
diff --git a/usr.sbin/afs/src/ydr/types.h b/usr.sbin/afs/src/ydr/types.h
index e22d1ceeae8..00eb7cf253d 100644
--- a/usr.sbin/afs/src/ydr/types.h
+++ b/usr.sbin/afs/src/ydr/types.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $KTH: types.h,v 1.10 2000/10/02 22:37:20 lha Exp $ */
+/* $arla: types.h,v 1.13 2003/01/20 07:12:59 lha Exp $ */
#ifndef _YDR_TYPES_
#define _YDR_TYPES_
@@ -44,9 +44,9 @@ typedef struct {
} EnumEntry;
typedef enum {
- TCHAR, TUCHAR, TSHORT, TUSHORT, TLONG, TULONG, TSTRING, TOPAQUE,
- TUSERDEF, TARRAY,
- TVARRAY, TPOINTER
+ YDR_TCHAR, YDR_TUCHAR, YDR_TSHORT, YDR_TUSHORT, YDR_TLONG, YDR_TULONG,
+ YDR_TSTRING, YDR_TOPAQUE, YDR_TUSERDEF, YDR_TARRAY,
+ YDR_TVARRAY, YDR_TPOINTER, YDR_TLONGLONG, YDR_TULONGLONG
} TypeType;
struct Type {
@@ -79,6 +79,8 @@ Symbol *set_struct_body (char *name, List *list);
Symbol *define_typedef (StructEntry *entry);
Symbol *define_proc (char *name, List *args, unsigned id);
Symbol *createenumentry (char *name, int val);
+void set_sym_attrs(Symbol *, List *);
+int sym_find_attr(Symbol *, char *);
StructEntry *createstructentry (char *name, Type *type);
struct Type *create_type (TypeType type, Symbol *symbol, unsigned size,
Type *subtype, Type *indextype, int flags);