Open SCAP Library
fsdev.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
9  * All Rights Reserved.
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  *
25  * Authors:
26  * "Daniel Kopecek" <dkopecek@redhat.com>
27  */
28 
29 #pragma once
30 #ifndef FSDEV_H
31 #define FSDEV_H
32 
33 #include <stddef.h>
34 #include <stdint.h>
35 #include <sys/stat.h>
36 #include "oscap_export.h"
37 
38 #if defined(__linux__) || defined(_AIX)
39 #include <mntent.h>
40 #endif
41 
45 typedef struct {
46  dev_t *ids;
47  uint16_t cnt;
48 } fsdev_t;
49 
54 fsdev_t *fsdev_init(void);
55 
59 void fsdev_free(fsdev_t *lfs);
60 
64 int fsdev_search(fsdev_t *lfs, void *id);
65 
75 int fsdev_path(fsdev_t *lfs, const char *path);
76 
86 int fsdev_fd(fsdev_t *lfs, int fd);
87 
88 #endif /* FSDEV_H */
uint16_t cnt
Number of items in the array.
Definition: fsdev.h:47
fsdev_t * fsdev_init(void)
Initialize the fsdev_t structure from an array of filesystem names.
Definition: fsdev.c:289
int fsdev_search(fsdev_t *lfs, void *id)
Search an id in the fsdev_t structure.
Definition: fsdev.c:321
void fsdev_free(fsdev_t *lfs)
Free the fsdev_t structure.
Definition: fsdev.c:312
Filesystem device structure.
Definition: fsdev.h:45
dev_t * ids
Sorted array of device ids.
Definition: fsdev.h:46
int fsdev_fd(fsdev_t *lfs, int fd)
Check whether a file descriptor is associated with a file that resides on any of the devices in the f...
Definition: fsdev.c:357
int fsdev_path(fsdev_t *lfs, const char *path)
Check whether a path points points to a place on any of the devices in the fsdev_t structure...
Definition: fsdev.c:347