Coda Distributed File System
coda-src
kerndep
pioctl.h
Go to the documentation of this file.
1
/* BLURB lgpl
2
3
Coda File System
4
Release 6
5
6
Copyright (c) 1987-2018 Carnegie Mellon University
7
Additional copyrights listed below
8
9
This code is distributed "AS IS" without warranty of any kind under
10
the terms of the GNU Library General Public Licence Version 2, as
11
shown in the file LICENSE. The technical and financial contributors to
12
Coda are listed in the file CREDITS.
13
14
Additional copyrights
15
none currently
16
17
#*/
18
19
/*
20
* TODO: combine ViceIoctl and PioctlData structures.
21
*/
22
23
#ifndef _PIOCTL_H_
24
#define _PIOCTL_H_
25
26
#ifdef HAVE_CONFIG_H
27
#include <config.h>
28
#endif
29
30
#include <sys/types.h>
31
#include <time.h>
32
#include <sys/ioctl.h>
33
#ifdef HAVE_SYS_IOCCOM_H
34
#include <sys/ioccom.h>
35
#endif
36
#include <
coda.h
>
37
38
/* WARNING: don't send more data than allowed by the CFS_MAXMSG size
39
in coda.h */
40
41
#define PIOCTL_PREFIX "...PIOCTL."
42
43
int
pioctl
(
const
char
*
path
,
unsigned
long
com,
struct
ViceIoctl
*vidata,
44
int
follow);
45
46
#if defined(__APPLE__) && defined(__MACH__)
47
/*
48
* These are absent from Darwin's <sys/ioccom.h>.
49
*/
50
#define _IOC_NRBITS 8
51
#define _IOC_TYPEBITS 8
52
#define _IOC_SIZEBITS 14
53
#define _IOC_DIRBITS 2
54
55
#define _IOC_NRMASK ((1 << _IOC_NRBITS) - 1)
56
#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS) - 1)
57
#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS) - 1)
58
#define _IOC_DIRMASK ((1 << _IOC_DIRBITS) - 1)
59
60
#define _IOC_NRSHIFT 0
61
#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
62
#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
63
#define _IOC_DIRSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
64
65
/* used to decode ioctl numbers.. */
66
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
67
#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
68
#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
69
#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
70
71
#endif
/* Darwin */
72
73
#if defined(__CYGWIN32__)
74
/* Get the _IO... definitions for CYGWIN. */
75
#include <asm/socket.h>
76
#endif
77
78
/* people who understand ioctling probably know why this is useful... */
79
#define _VICEIOCTL(id) (_IOW('V', id, struct ViceIoctl))
80
#define _VALIDVICEIOCTL(com) (com >= _VICEIOCTL(0) && com <= _VICEIOCTL(255))
81
82
/* unpacking macros */
83
#ifndef _IOC_NR
84
85
#if defined(__NetBSD__) || defined(__FreeBSD__)
86
#define _IOC_TYPEMASK 0xff
87
#define _IOC_TYPESHIFT 8
88
#define _IOC_NRMASK 0xff
89
#define _IOC_NRSHIFT 0
90
#endif
91
92
#define _IOC_TYPE(nr) ((nr >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
93
#define _IOC_NR(nr) ((nr >> _IOC_NRSHIFT) & _IOC_NRMASK)
94
#endif
95
96
#endif
/* _PIOCTL_H_ */
coda.h
path
void path(char *pathname, char *direc, char *file)
Definition:
path.c:53
pioctl
int pioctl(const char *path, unsigned long com, struct ViceIoctl *vidata, int follow)
Definition:
pioctl.c:147
ViceIoctl
Definition:
coda.h:790
Generated by
1.9.4