newsyslog(8): Further reduce differences with FreeBSD.
[dragonfly.git] / usr.bin / fstat / fstat.h
blobe5fd5df19620189f8ad754b8df258bb0a5a53c56
1 /*-
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
29 * $FreeBSD: src/usr.bin/fstat/fstat.h,v 1.1.2.1 2000/07/02 10:20:25 ps Exp $
32 #ifndef __FSTAT_H__
33 #define __FSTAT_H__
35 #define dprintf if (vflg) fprintf
37 typedef struct devs {
38 struct devs *next;
39 long fsid;
40 ino_t ino;
41 const char *name;
42 } DEVS;
44 struct filestat {
45 long fsid;
46 long fileid;
47 mode_t mode;
48 long long size;
49 int64_t offset;
50 dev_t rdev;
53 static inline mode_t
54 mtrans(enum vtype type)
56 switch (type) {
57 case VREG:
58 return S_IFREG;
59 case VDIR:
60 return S_IFDIR;
61 case VBLK:
62 return S_IFBLK;
63 case VCHR:
64 return S_IFCHR;
65 case VLNK:
66 return S_IFLNK;
67 case VSOCK:
68 return S_IFSOCK;
69 case VFIFO:
70 return S_IFIFO;
71 default:
72 return 0;
76 /* Ugh */
77 extern kvm_t *kd;
78 extern int vflg;
79 extern int Pid;
81 /* XXX symbol conflict with libkvm.a */
82 #define dev2udev fstat_dev2udev
83 udev_t dev2udev(void *);
84 udev_t makeudev(int, int);
86 /* Additional filesystem types */
87 int ext2fs_filestat(struct vnode *, struct filestat *);
88 int hammer_filestat(struct vnode *, struct filestat *);
89 int isofs_filestat(struct vnode *, struct filestat *);
90 int msdosfs_filestat(struct vnode *, struct filestat *);
91 int ntfs_filestat(struct vnode *, struct filestat *);
92 int tmpfs_filestat(struct vnode *, struct filestat *);
93 ssize_t kread(const void *, void *, size_t);
95 #endif /* __FSTAT_H__ */