From 5c206470444f8f6531384a056c0a4484e127c01b Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Wed, 2 Aug 2006 16:54:11 +0000 Subject: [PATCH] vioc-header-split-20060802 Modify vice.h so that it doesn't depend on afs/param.h. Split the VIOC* constant definitions out of afs/venus.h into a separate header file included by it. Update various comments to reflect a more recent version of reality. This is in preparation for kopenafs work so that kopenafs.h can include afs/vioc.h as well to get the same definitions. --- src/config/Makefile.in | 6 +++ src/config/venus.h | 87 ++-------------------------------- src/config/vioc.h | 104 +++++++++++++++++++++++++++++++++++++++++ src/util/vice.h | 76 ++++++++++++++---------------- 4 files changed, 150 insertions(+), 123 deletions(-) create mode 100644 src/config/vioc.h diff --git a/src/config/Makefile.in b/src/config/Makefile.in index aea755546..1d153bce5 100644 --- a/src/config/Makefile.in +++ b/src/config/Makefile.in @@ -19,6 +19,7 @@ all: config mkvers \ ${TOP_INCDIR}/afs/afs_args.h \ ${TOP_INCDIR}/afs/icl.h \ ${TOP_INCDIR}/afs/venus.h \ + ${TOP_INCDIR}/afs/vioc.h \ ${TOP_INCDIR}/afs/debug.h Makefile.version: ${srcdir}/Makefile.version-CML Makefile.version-NOCML @@ -84,6 +85,9 @@ ${DEST}/include/afs/afs_args.h ${DESTDIR}${includedir}/afs/afs_args.h ${TOP_INCD ${DEST}/include/afs/venus.h ${DESTDIR}${includedir}/afs/venus.h ${TOP_INCDIR}/afs/venus.h: ${srcdir}/venus.h $(INST) +${DEST}/include/afs/vioc.h ${DESTDIR}${includedir}/afs/vioc.h ${TOP_INCDIR}/afs/vioc.h: ${srcdir}/vioc.h + $(INST) + ${DEST}/include/afs/debug.h ${DESTDIR}${includedir}/afs/debug.h ${TOP_INCDIR}/afs/debug.h: ${srcdir}/debug.h $(INST) @@ -98,6 +102,7 @@ install: ${DESTDIR}${includedir}/afs/param.h \ ${DESTDIR}${includedir}/afs/afs_args.h \ ${DESTDIR}${includedir}/afs/icl.h \ ${DESTDIR}${includedir}/afs/venus.h \ + ${DESTDIR}${includedir}/afs/vioc.h \ ${DESTDIR}${includedir}/afs/debug.h clean: @@ -109,5 +114,6 @@ dest: ${DEST}/include/afs/param.h \ ${DEST}/include/afs/afs_args.h \ ${DEST}/include/afs/icl.h \ ${DEST}/include/afs/venus.h \ + ${DEST}/include/afs/vioc.h \ ${DEST}/include/afs/debug.h diff --git a/src/config/venus.h b/src/config/venus.h index bf14ae30e..a5cae44f5 100644 --- a/src/config/venus.h +++ b/src/config/venus.h @@ -15,15 +15,12 @@ Definitions of Venus-specific ioctls for Venus 2. #ifndef AFS_VENUS_H #define AFS_VENUS_H -#if !defined(UKERNEL) +/* The VIOC* constants are defined here. */ +#include -#ifndef _IOW -#include -#endif +#if !defined(UKERNEL) -#ifndef _VICEIOCTL -#include -#endif +#include /* some structures used with CM pioctls */ @@ -110,80 +107,4 @@ struct cm_initparams { #endif /* !defined(UKERNEL) */ -/* IOCTLS to Venus. Apply these to open file decriptors. */ -#define VIOCCLOSEWAIT _VICEIOCTL(1) /* Force close to wait for store */ -#define VIOCABORT _VICEIOCTL(2) /* Abort close on this fd */ -#define VIOCIGETCELL _VICEIOCTL(3) /* ioctl to get cell name */ - -/* PIOCTLS to Venus. Apply these to path names with pioctl. */ -#define VIOCSETAL _VICEIOCTL(1) /* Set access control list */ -#define VIOCGETAL _VICEIOCTL(2) /* Get access control list */ -#define VIOCSETTOK _VICEIOCTL(3) /* Set authentication tokens */ -#define VIOCGETVOLSTAT _VICEIOCTL(4) /* Get volume status */ -#define VIOCSETVOLSTAT _VICEIOCTL(5) /* Set volume status */ -#define VIOCFLUSH _VICEIOCTL(6) /* Invalidate cache entry */ -#define VIOCSTAT _VICEIOCTL(7) /* Get file status */ -#define VIOCGETTOK _VICEIOCTL(8) /* Get authentication tokens */ -#define VIOCUNLOG _VICEIOCTL(9) /* Invalidate tokens */ -#define VIOCCKSERV _VICEIOCTL(10) /* Check that servers are up */ -#define VIOCCKBACK _VICEIOCTL(11) /* Check backup volume mappings */ -#define VIOCCKCONN _VICEIOCTL(12) /* Check connections for a user */ -#define VIOCGETTIME _VICEIOCTL(13) /* Do a vice gettime for performance testing */ -#define VIOCWHEREIS _VICEIOCTL(14) /* Find out where a volume is located */ -#define VIOCPREFETCH _VICEIOCTL(15) /* Prefetch a file */ -#define VIOCNOP _VICEIOCTL(16) /* Do nothing (more preformance) */ -#define VIOCENGROUP _VICEIOCTL(17) /* Enable group access for a group */ -#define VIOCDISGROUP _VICEIOCTL(18) /* Disable group access */ -#define VIOCLISTGROUPS _VICEIOCTL(19) /* List enabled and disabled groups */ -#define VIOCACCESS _VICEIOCTL(20) /* Access using PRS_FS bits */ -#define VIOCUNPAG _VICEIOCTL(21) /* Invalidate pag */ -#define VIOCGETFID _VICEIOCTL(22) /* Get file ID quickly */ -#define VIOCWAITFOREVER _VICEIOCTL(23) /* Wait for dead servers forever */ -#define VIOCSETCACHESIZE _VICEIOCTL(24) /* Set venus cache size in 1k units */ -#define VIOCFLUSHCB _VICEIOCTL(25) /* Flush callback only */ -#define VIOCNEWCELL _VICEIOCTL(26) /* Configure new cell */ -#define VIOCGETCELL _VICEIOCTL(27) /* Get cell info */ -#define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28) /* [AFS] Delete mount point */ -#define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29) /* [AFS] Stat mount point */ -#define VIOC_FILE_CELL_NAME _VICEIOCTL(30) /* Get cell in which file lives */ -#define VIOC_GET_WS_CELL _VICEIOCTL(31) /* Get cell in which workstation lives */ -#define VIOC_AFS_MARINER_HOST _VICEIOCTL(32) /* [AFS] Get/set mariner host */ -#define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33) /* Get primary cell for caller */ -#define VIOC_VENUSLOG _VICEIOCTL(34) /* Enable/Disable venus logging */ -#define VIOC_GETCELLSTATUS _VICEIOCTL(35) /* get cell status info */ -#define VIOC_SETCELLSTATUS _VICEIOCTL(36) /* set corresponding info */ -#define VIOC_FLUSHVOLUME _VICEIOCTL(37) /* flush whole volume's data */ -#define VIOC_AFS_SYSNAME _VICEIOCTL(38) /* Change @sys value */ -#define VIOC_EXPORTAFS _VICEIOCTL(39) /* Export afs to nfs clients */ -#define VIOCGETCACHEPARMS _VICEIOCTL(40) /* Get cache stats */ -#define VIOCGETVCXSTATUS _VICEIOCTL(41) -#define VIOC_SETSPREFS33 _VICEIOCTL(42) /* Set server ranks */ -#define VIOC_GETSPREFS _VICEIOCTL(43) /* Get server ranks */ -#define VIOC_GAG _VICEIOCTL(44) /* silence CM */ -#define VIOC_TWIDDLE _VICEIOCTL(45) /* adjust RX knobs */ -#define VIOC_SETSPREFS _VICEIOCTL(46) /* Set server ranks */ -#define VIOC_STORBEHIND _VICEIOCTL(47) /* adjust store asynchrony */ -#define VIOC_GCPAGS _VICEIOCTL(48) /* disable automatic pag gc-ing */ -#define VIOC_GETINITPARAMS _VICEIOCTL(49) /* get initial cm params */ -#define VIOC_GETCPREFS _VICEIOCTL(50) /* Get client interface */ -#define VIOC_SETCPREFS _VICEIOCTL(51) /* Set client interface */ -#define VIOC_AFS_FLUSHMOUNT _VICEIOCTL(52) /* Flush mount symlink data */ -#define VIOC_RXSTAT_PROC _VICEIOCTL(53) /* Control process RX stats */ -#define VIOC_RXSTAT_PEER _VICEIOCTL(54) /* Control peer RX stats */ -#define VIOC_GETRXKCRYPT _VICEIOCTL(55) /* Set rxkad enc flag */ -#define VIOC_SETRXKCRYPT _VICEIOCTL(56) /* Set rxkad enc flag */ -#define VIOC_PREFETCHTAPE _VICEIOCTL(66) /* MR-AFS prefetch from tape */ -#define VIOC_RESIDENCY_CMD _VICEIOCTL(67) /* generic MR-AFS cmds */ -#define VIOC_STATISTICS _VICEIOCTL(68) /* arla: fetch statistics */ -#define VIOC_GETVCXSTATUS2 _VICEIOCTL(69) /* vcache statistics */ - -/* Coordinated 'C' pioctl's */ -#define VIOC_NEWALIAS _CVICEIOCTL(1) /* create new cell alias */ -#define VIOC_GETALIAS _CVICEIOCTL(2) /* get alias info */ -#define VIOC_CBADDR _CVICEIOCTL(3) /* push callback addr */ -#define VIOC_DISCON _CVICEIOCTL(5) /* set/get discon mode */ - -/* OpenAFS-specific 'O' pioctl's */ -#define VIOC_NFS_NUKE_CREDS _OVICEIOCTL(1) /* nuke creds for all PAG's */ - #endif /* AFS_VENUS_H */ diff --git a/src/config/vioc.h b/src/config/vioc.h new file mode 100644 index 000000000..1c930afbe --- /dev/null +++ b/src/config/vioc.h @@ -0,0 +1,104 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +/* + * The constants for doing ioctl or pioctl calls to AFS. For more information + * see the registry at . This + * is separate from afs/venus.h (which defines some of the structure arguments + * for some of these calls) so that it can also be used by kopenafs.h; they + * may be re-merged later. + * + * You probably don't want to include this header file directly; instead, + * include afs/venus.h or kopenafs.h depending on the context. + */ + +#ifndef AFS_VIOC_H +#define AFS_VIOC_H 1 + +#ifndef _VICEIOCTL +#include +#endif + +/* IOCTLS to Venus. Apply these to open file decriptors. */ +#define VIOCCLOSEWAIT _VICEIOCTL(1) /* Force close to wait for store */ +#define VIOCABORT _VICEIOCTL(2) /* Abort close on this fd */ +#define VIOCIGETCELL _VICEIOCTL(3) /* ioctl to get cell name */ + +/* PIOCTLS to Venus. Apply these to path names with pioctl. */ +#define VIOCSETAL _VICEIOCTL(1) /* Set access control list */ +#define VIOCGETAL _VICEIOCTL(2) /* Get access control list */ +#define VIOCSETTOK _VICEIOCTL(3) /* Set authentication tokens */ +#define VIOCGETVOLSTAT _VICEIOCTL(4) /* Get volume status */ +#define VIOCSETVOLSTAT _VICEIOCTL(5) /* Set volume status */ +#define VIOCFLUSH _VICEIOCTL(6) /* Invalidate cache entry */ +#define VIOCSTAT _VICEIOCTL(7) /* Get file status */ +#define VIOCGETTOK _VICEIOCTL(8) /* Get authentication tokens */ +#define VIOCUNLOG _VICEIOCTL(9) /* Invalidate tokens */ +#define VIOCCKSERV _VICEIOCTL(10) /* Check that servers are up */ +#define VIOCCKBACK _VICEIOCTL(11) /* Check backup volume mappings */ +#define VIOCCKCONN _VICEIOCTL(12) /* Check connections for a user */ +#define VIOCGETTIME _VICEIOCTL(13) /* Do a vice gettime for performance testing */ +#define VIOCWHEREIS _VICEIOCTL(14) /* Find out where a volume is located */ +#define VIOCPREFETCH _VICEIOCTL(15) /* Prefetch a file */ +#define VIOCNOP _VICEIOCTL(16) /* Do nothing (more preformance) */ +#define VIOCENGROUP _VICEIOCTL(17) /* Enable group access for a group */ +#define VIOCDISGROUP _VICEIOCTL(18) /* Disable group access */ +#define VIOCLISTGROUPS _VICEIOCTL(19) /* List enabled and disabled groups */ +#define VIOCACCESS _VICEIOCTL(20) /* Access using PRS_FS bits */ +#define VIOCUNPAG _VICEIOCTL(21) /* Invalidate pag */ +#define VIOCGETFID _VICEIOCTL(22) /* Get file ID quickly */ +#define VIOCWAITFOREVER _VICEIOCTL(23) /* Wait for dead servers forever */ +#define VIOCSETCACHESIZE _VICEIOCTL(24) /* Set venus cache size in 1k units */ +#define VIOCFLUSHCB _VICEIOCTL(25) /* Flush callback only */ +#define VIOCNEWCELL _VICEIOCTL(26) /* Configure new cell */ +#define VIOCGETCELL _VICEIOCTL(27) /* Get cell info */ +#define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28) /* [AFS] Delete mount point */ +#define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29) /* [AFS] Stat mount point */ +#define VIOC_FILE_CELL_NAME _VICEIOCTL(30) /* Get cell in which file lives */ +#define VIOC_GET_WS_CELL _VICEIOCTL(31) /* Get cell in which workstation lives */ +#define VIOC_AFS_MARINER_HOST _VICEIOCTL(32) /* [AFS] Get/set mariner host */ +#define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33) /* Get primary cell for caller */ +#define VIOC_VENUSLOG _VICEIOCTL(34) /* Enable/Disable venus logging */ +#define VIOC_GETCELLSTATUS _VICEIOCTL(35) /* get cell status info */ +#define VIOC_SETCELLSTATUS _VICEIOCTL(36) /* set corresponding info */ +#define VIOC_FLUSHVOLUME _VICEIOCTL(37) /* flush whole volume's data */ +#define VIOC_AFS_SYSNAME _VICEIOCTL(38) /* Change @sys value */ +#define VIOC_EXPORTAFS _VICEIOCTL(39) /* Export afs to nfs clients */ +#define VIOCGETCACHEPARMS _VICEIOCTL(40) /* Get cache stats */ +#define VIOCGETVCXSTATUS _VICEIOCTL(41) +#define VIOC_SETSPREFS33 _VICEIOCTL(42) /* Set server ranks */ +#define VIOC_GETSPREFS _VICEIOCTL(43) /* Get server ranks */ +#define VIOC_GAG _VICEIOCTL(44) /* silence CM */ +#define VIOC_TWIDDLE _VICEIOCTL(45) /* adjust RX knobs */ +#define VIOC_SETSPREFS _VICEIOCTL(46) /* Set server ranks */ +#define VIOC_STORBEHIND _VICEIOCTL(47) /* adjust store asynchrony */ +#define VIOC_GCPAGS _VICEIOCTL(48) /* disable automatic pag gc-ing */ +#define VIOC_GETINITPARAMS _VICEIOCTL(49) /* get initial cm params */ +#define VIOC_GETCPREFS _VICEIOCTL(50) /* Get client interface */ +#define VIOC_SETCPREFS _VICEIOCTL(51) /* Set client interface */ +#define VIOC_AFS_FLUSHMOUNT _VICEIOCTL(52) /* Flush mount symlink data */ +#define VIOC_RXSTAT_PROC _VICEIOCTL(53) /* Control process RX stats */ +#define VIOC_RXSTAT_PEER _VICEIOCTL(54) /* Control peer RX stats */ +#define VIOC_GETRXKCRYPT _VICEIOCTL(55) /* Set rxkad enc flag */ +#define VIOC_SETRXKCRYPT _VICEIOCTL(56) /* Set rxkad enc flag */ +#define VIOC_PREFETCHTAPE _VICEIOCTL(66) /* MR-AFS prefetch from tape */ +#define VIOC_RESIDENCY_CMD _VICEIOCTL(67) /* generic MR-AFS cmds */ +#define VIOC_STATISTICS _VICEIOCTL(68) /* arla: fetch statistics */ +#define VIOC_GETVCXSTATUS2 _VICEIOCTL(69) /* vcache statistics */ + +/* Coordinated 'C' pioctl's */ +#define VIOC_NEWALIAS _CVICEIOCTL(1) /* create new cell alias */ +#define VIOC_GETALIAS _CVICEIOCTL(2) /* get alias info */ +#define VIOC_CBADDR _CVICEIOCTL(3) /* push callback addr */ +#define VIOC_DISCON _CVICEIOCTL(5) /* set/get discon mode */ + +/* OpenAFS-specific 'O' pioctl's */ +#define VIOC_NFS_NUKE_CREDS _OVICEIOCTL(1) /* nuke creds for all PAG's */ + +#endif /* AFS_VIOC_H */ diff --git a/src/util/vice.h b/src/util/vice.h index f8fee6939..dc8553082 100644 --- a/src/util/vice.h +++ b/src/util/vice.h @@ -7,24 +7,19 @@ * directory or online at http://www.openafs.org/dl/license10.html */ +#ifndef AFS_VICE_H +#define AFS_VICE_H 1 + +#include +#include + /* - * /usr/include/sys/vice.h - * - * Definitions required by user processes needing extended vice facilities - * of the kernel. - * - * NOTE: /usr/include/sys/remote.h contains definitions common between - * Venus and the kernel. - * /usr/local/include/viceioctl.h contains ioctl definitions common - * between user processes and Venus. + * Structures used to pass data into AFS ioctls. The buffer pointers may be + * null, or the counts may be 0 if there are no input or output parameters. */ -#include -#ifdef AFS_SUN_ENV -#include -#endif #if defined(KERNEL) -/* a fixed size, whether the kernel uses the ILP32 or LP64 data models */ +/* A fixed size, whether the kernel uses the ILP32 or LP64 data models. */ struct ViceIoctl32 { unsigned int in, out; /* Data to be transferred in, or out */ short in_size; /* Size of input buffer <= 2K */ @@ -32,7 +27,8 @@ struct ViceIoctl32 { }; #endif -#ifndef AFS_NT40_ENV /* NT decl in sys/pioctl_nt.h with pioctl() decl */ +/* Windows uses a different structure layout, defined in sys/pioctl_nt.h. */ +#ifndef _WIN32_WINNT struct ViceIoctl { caddr_t in, out; /* Data to be transferred in, or out */ short in_size; /* Size of input buffer <= 2K */ @@ -40,38 +36,38 @@ struct ViceIoctl { }; #endif -/* The 2K limits above are a consequence of the size of the kernel buffer - used to buffer requests from the user to venus--2*MAXPATHLEN. - The buffer pointers may be null, or the counts may be 0 if there - are no input or output parameters - */ /* - * The structure argument to _IOW() is used to add a structure - * size component to the _IOW() value, to help the kernel code identify - * how big a structure the calling process is passing into a system - * call. + * The structure argument to _IOW() is used to add a structure size component + * to the _IOW() value, to help the kernel code identify how big a structure + * the calling process is passing into a system call. * - * In user space, struct ViceIoctl32 and struct ViceIoctl are the same - * except on Digital Unix, where user space code is compiled in 64-bit - * mode. + * In user space, struct ViceIoctl32 and struct ViceIoctl are the same except + * on Digital Unix, where user space code is compiled in 64-bit mode. * - * So, in kernel space, regardless whether it is compiled in 32-bit - * mode or 64-bit mode, the kernel code can use the struct ViceIoctl32 - * version of _IOW() to check the size of user space arguments -- except - * on Digital Unix. + * So, in kernel space, regardless whether it is compiled in 32-bit mode or + * 64-bit mode, the kernel code can use the struct ViceIoctl32 version of + * _IOW() to check the size of user space arguments -- except on Digital Unix + * (or Linux on Alpha, since it's compatible with Digital Unix). We don't + * care about other 64-bit Linux versions since they don't check this length. */ -#if defined(KERNEL) && !defined(AFS_OSF_ENV) && !defined(AFS_ALPHA_LINUX20_ENV) -#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl32)) -#define _VICEIOCTL2(dev, id) ((unsigned int ) _IOW(dev, id, struct ViceIoctl32)) +#if defined(KERNEL) && !defined(__alpha__) +#define _VICEIOCTL(id) ((unsigned int) _IOW('V', id, struct ViceIoctl32)) +#define _VICEIOCTL2(dev, id) ((unsigned int) _IOW(dev, id, struct ViceIoctl32)) #else -#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) -#define _VICEIOCTL2(dev, id) ((unsigned int ) _IOW(dev, id, struct ViceIoctl)) +#define _VICEIOCTL(id) ((unsigned int) _IOW('V', id, struct ViceIoctl)) +#define _VICEIOCTL2(dev, id) ((unsigned int) _IOW(dev, id, struct ViceIoctl)) #endif #define _CVICEIOCTL(id) _VICEIOCTL2('C', id) #define _OVICEIOCTL(id) _VICEIOCTL2('O', id) -/* Use this macro to define up to 256 vice ioctl's. These ioctl's - all potentially have in/out parameters--this depends upon the - values in the ViceIoctl structure. This structure is itself passed - into the kernel by the normal ioctl parameter passing mechanism. +/* + * Use these macros to define up to 256 vice ioctls in each space. These + * ioctls all potentially have in/out parameters, depending on the values in + * the ViceIoctl structure. This structure is passed into the kernel by the + * normal ioctl parameter passing mechanism. + * + * See for the definition of + * the namespaces. */ + +#endif /* AFS_VICE_H */ -- 2.39.5