Fix libprocstat build after r305902.

- Use _Bool to not require userspace to include stdbool.h.
- Make extattr.h usable without vnode_if.h.
- Follow i_ump to get cdev pointer.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2016-09-17 18:14:31 +00:00
parent e1db68971e
commit 6bd8ddcf0c
3 changed files with 14 additions and 3 deletions

View File

@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
#include <ufs/ufs/extattr.h>
#include <ufs/ufs/ufsmount.h>
#include <fs/devfs/devfs.h>
#include <fs/devfs/devfs_int.h>
#undef _KERNEL
@ -88,17 +90,22 @@ int
ufs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn)
{
struct inode inode;
struct ufsmount um;
if (!kvm_read_all(kd, (unsigned long)VTOI(vp), &inode, sizeof(inode))) {
warnx("can't read inode at %p", (void *)VTOI(vp));
return (1);
}
if (!kvm_read_all(kd, (unsigned long)inode.i_ump, &um, sizeof(um))) {
warnx("can't read ufsmount at %p", (void *)inode.i_ump);
return (1);
}
/*
* The st_dev from stat(2) is a dev_t. These kernel structures
* contain cdev pointers. We need to convert to dev_t to make
* comparisons
*/
vn->vn_fsid = dev2udev(kd, inode.i_dev);
vn->vn_fsid = dev2udev(kd, um.um_dev);
vn->vn_fileid = inode.i_number;
vn->vn_mode = (mode_t)inode.i_mode;
vn->vn_size = inode.i_size;

View File

@ -133,6 +133,10 @@ struct ufs_extattr_per_mount {
int uepm_flags;
};
struct vop_getextattr_args;
struct vop_deleteextattr_args;
struct vop_setextattr_args;
void ufs_extattr_uepm_init(struct ufs_extattr_per_mount *uepm);
void ufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm);
int ufs_extattr_start(struct mount *mp, struct thread *td);

View File

@ -145,14 +145,14 @@ struct inode {
#define ITOFS(ip) (ITOUMP(ip)->um_fs)
#define ITOVFS(ip) ((ip)->i_vnode->v_mount)
static inline bool
static inline _Bool
I_IS_UFS1(const struct inode *ip)
{
return ((ip->i_flag & IN_UFS2) == 0);
}
static inline bool
static inline _Bool
I_IS_UFS2(const struct inode *ip)
{