Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fsdev.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
11  * All Rights Reserved.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this library; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  * Authors:
28  * "Daniel Kopecek" <dkopecek@redhat.com>
29  */
30 
31 #pragma once
32 #ifndef FSDEV_H
33 #define FSDEV_H
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 #include <sys/stat.h>
38 
42 typedef struct {
43  dev_t *ids;
44  uint16_t cnt;
45 } fsdev_t;
46 
51 fsdev_t *fsdev_init(const char **fs, size_t fs_cnt);
52 
57 fsdev_t *fsdev_strinit(const char *fs_names);
58 
62 void fsdev_free(fsdev_t * lfs);
63 
67 int fsdev_search(fsdev_t * lfs, void *id);
68 
78 int fsdev_path(fsdev_t * lfs, const char *path);
79 
89 int fsdev_fd(fsdev_t * lfs, int fd);
90 
91 #endif /* FSDEV_H */
92 
fsdev_t * fsdev_init(const char **fs, size_t fs_cnt)
Initialize the fsdev_t structure from an array of filesystem names.
Definition: fsdev.c:346
void fsdev_free(fsdev_t *lfs)
Free the fsdev_t structure.
Definition: fsdev.c:416
int fsdev_search(fsdev_t *lfs, void *id)
Search an id in the fsdev_t structure.
Definition: fsdev.c:425
uint16_t cnt
Number of items in the array.
Definition: fsdev.h:44
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:461
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:451
fsdev_t * fsdev_strinit(const char *fs_names)
Initialize the fsdev_t structure from a string containing filesystem names.
Definition: fsdev.c:369
Filesystem device structure.
Definition: fsdev.h:42
dev_t * ids
Sorted array of device ids.
Definition: fsdev.h:43