Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F3151764
scandisk.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
scandisk.h
View Options
/******************************************************************************
*******************************************************************************
**
** Copyright (C) 2008 Red Hat, Inc. All rights reserved.
**
** Author: Fabio M. Di Nitto <fdinitto@redhat.com>
**
** Original design by:
** Joel Becker <Joel.Becker@oracle.com>
** Fabio M. Di Nitto <fdinitto@redhat.com>
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
** of the GNU General Public License v.2.
**
*******************************************************************************
******************************************************************************/
#ifndef __SCANDISK_H__
#define __SCANDISK_H__
#ifndef DEVPATH
#define DEVPATH "/dev"
#endif
#ifndef SYSFSPATH
#define SYSFSPATH "/sys"
#endif
#ifndef SYSBLOCKPATH
#define SYSBLOCKPATH SYSFSPATH "/block"
#endif
#ifdef DEBUG
#define DEVCACHETIMEOUT 5 /* expressed in seconds */
#else
#define DEVCACHETIMEOUT 30
#endif
/* each entry can be (generally):
* > 0 on success or good hit
* 0 on success with no hit
* < 0 on error
*/
struct sysfsattrs { /* usual 0 | 1 game */
int sysfs; /* did we find an entry in sysfs at all? */
int slaves; /* device has slaves */
int holders; /* device has holders */
int removable; /* device is removable */
int disk; /* device is a disk */
};
/* this structure is required because we don't know upfront how many
* entries for a certain maj/min will be found in /dev, and so we need
* to alloc them dynamically.
*/
struct devpath {
struct devpath *next;
char path[MAXPATHLEN];
};
/* this structure holds all the data for each maj/min found in the system
* that is a block device
*/
struct devnode {
struct devnode *next;
struct devpath *devpath; /* point to the first path entry */
int maj; /* device major */
int min; /* device minor */
struct sysfsattrs sysfsattrs; /* like the others.. scanning /sys */
int procpart; /* 0 if the device is not in proc/part or 1 on success. <0 on error */
char procname[MAXPATHLEN]; /* non-NULL if we find a maj/min match */
int md; /* 0 nothing to do with raid, 1 is raid,
* 2 is raid slave - data from /proc/mdstat */
int mapper; /* 0 nothing, 1 we believe it's a devmap dev */
void *filter; /* your filter output.. whatever it is */
};
/* this is what you get after a scan... if you are lucky */
/* each entry can be 0 if we can't scan or < 0 if there are errors */
struct devlisthead {
time_t cache_timestamp; /* this cache timestamp */
int cache_timeout; /* for how long this cache is valid */
int sysfs; /* set to 1 if we were able to scan
* /sys */
int procpart; /* set to 1 if we were able to scan
* /proc/partitions */
int lsdev; /* set to 1 if we were able to ls /dev */
int mdstat; /* set to 1 if we were able to scan
* /proc/mdstat */
int mapper; /* set to 1 if we were able to run
* something against mapper */
struct devnode *devnode; /* points to the first entry */
};
typedef void (*devfilter) (struct devnode * cur, void *arg);
struct devlisthead *scan_for_dev(struct devlisthead *devlisthead,
time_t timeout,
devfilter filter, void *filter_args);
void free_dev_list(struct devlisthead *devlisthead);
#endif /* __SCANDISK_H__ */
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Mon, Feb 24, 10:28 AM (16 h, 48 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1462419
Default Alt Text
scandisk.h (3 KB)
Attached To
Mode
rF Fence Agents
Attached
Detach File
Event Timeline
Log In to Comment