X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_mount.h;h=0ad7d0201bd9e9e711b9fb37492ae9a373d04cdf;hb=0d9f395599348e735e6f461e1c328293bef0d060;hp=0a5c980f39be58cd87df3d06667e220677d788af;hpb=441e067a2d5a294517bd87ca45c87fd67377d2cf;p=collectd.git diff --git a/src/utils_mount.h b/src/utils_mount.h index 0a5c980f..0ad7d020 100644 --- a/src/utils_mount.h +++ b/src/utils_mount.h @@ -27,153 +27,153 @@ #include #if HAVE_FS_INFO_H -# include +#include #endif #if HAVE_FSHELP_H -# include +#include #endif #if HAVE_PATHS_H -# include +#include #endif #if HAVE_MNTENT_H -# include +#include #endif #if HAVE_MNTTAB_H -# include +#include #endif #if HAVE_SYS_FSTYP_H -# include +#include #endif #if HAVE_SYS_FS_TYPES_H -# include +#include #endif #if HAVE_SYS_MNTENT_H -# include +#include #endif #if HAVE_SYS_MNTTAB_H -# include +#include #endif #if HAVE_SYS_MOUNT_H -# include +#include #endif #if HAVE_SYS_STATFS_H -# include +#include #endif #if HAVE_SYS_VFS_H -# include +#include #endif #if HAVE_SYS_VFSTAB_H -# include +#include #endif /* Collectd Utils Mount Type */ #define CUMT_UNKNOWN (0) -#define CUMT_EXT2 (1) -#define CUMT_EXT3 (2) -#define CUMT_XFS (3) -#define CUMT_UFS (4) -#define CUMT_VXFS (5) -#define CUMT_ZFS (6) +#define CUMT_EXT2 (1) +#define CUMT_EXT3 (2) +#define CUMT_XFS (3) +#define CUMT_UFS (4) +#define CUMT_VXFS (5) +#define CUMT_ZFS (6) typedef struct _cu_mount_t cu_mount_t; struct _cu_mount_t { - char *dir; /* "/sys" or "/" */ - char *spec_device; /* "LABEL=/" or "none" or "proc" or "/dev/hda1" */ - char *device; /* "none" or "proc" or "/dev/hda1" */ - char *type; /* "sysfs" or "ext3" */ - char *options; /* "rw,noatime,commit=600,quota,grpquota" */ - cu_mount_t *next; + char *dir; /* "/sys" or "/" */ + char *spec_device; /* "LABEL=/" or "none" or "proc" or "/dev/hda1" */ + char *device; /* "none" or "proc" or "/dev/hda1" */ + char *type; /* "sysfs" or "ext3" */ + char *options; /* "rw,noatime,commit=600,quota,grpquota" */ + cu_mount_t *next; }; cu_mount_t *cu_mount_getlist(cu_mount_t **list); /* DESCRIPTION - The cu_mount_getlist() function creates a list - of all mountpoints. + The cu_mount_getlist() function creates a list + of all mountpoints. - If *list is NULL, a new list is created and *list is - set to point to the first entry. + If *list is NULL, a new list is created and *list is + set to point to the first entry. - If *list is not NULL, the list of mountpoints is appended - and *list is not changed. + If *list is not NULL, the list of mountpoints is appended + and *list is not changed. RETURN VALUE - The cu_mount_getlist() function returns a pointer to - the last entry of the list, or NULL if an error has - occured. + The cu_mount_getlist() function returns a pointer to + the last entry of the list, or NULL if an error has + occured. NOTES - In case of an error, *list is not modified. + In case of an error, *list is not modified. */ void cu_mount_freelist(cu_mount_t *list); /* DESCRIPTION - The cu_mount_freelist() function free()s all memory - allocated by *list and *list itself as well. + The cu_mount_freelist() function free()s all memory + allocated by *list and *list itself as well. */ char *cu_mount_checkoption(char *line, const char *keyword, int full); /* DESCRIPTION - The cu_mount_checkoption() function is a replacement of - char *hasmntopt(const struct mntent *mnt, const char *opt). - In fact hasmntopt() just looks for the first occurrence of the - characters at opt in mnt->mnt_opts. cu_mount_checkoption() - checks for the *option* keyword in line, starting at the - first character of line or after a ','. + The cu_mount_checkoption() function is a replacement of + char *hasmntopt(const struct mntent *mnt, const char *opt). + In fact hasmntopt() just looks for the first occurrence of the + characters at opt in mnt->mnt_opts. cu_mount_checkoption() + checks for the *option* keyword in line, starting at the + first character of line or after a ','. - If full is not 0 then also the end of keyword has to match - either the end of line or a ',' after keyword. + If full is not 0 then also the end of keyword has to match + either the end of line or a ',' after keyword. RETURN VALUE - The cu_mount_checkoption() function returns a pointer into - string line if a match of keyword is found. If no match is - found cu_mount_checkoption() returns NULL. + The cu_mount_checkoption() function returns a pointer into + string line if a match of keyword is found. If no match is + found cu_mount_checkoption() returns NULL. NOTES - Do *not* try to free() the pointer which is returned! It is - just part of the string line. + Do *not* try to free() the pointer which is returned! It is + just part of the string line. - full should be set to 0 when matching options like: rw, quota, - noatime. Set full to 1 when matching options like: loop=, - gid=, commit=. + full should be set to 0 when matching options like: rw, quota, + noatime. Set full to 1 when matching options like: loop=, + gid=, commit=. EXAMPLES - If line is "rw,usrquota,grpquota", keyword is "quota", NULL - will be returned (independend of full). + If line is "rw,usrquota,grpquota", keyword is "quota", NULL + will be returned (independend of full). - If line is "rw,usrquota,grpquota", keyword is "usrquota", - a pointer to "usrquota,grpquota" is returned (independend - of full). + If line is "rw,usrquota,grpquota", keyword is "usrquota", + a pointer to "usrquota,grpquota" is returned (independend + of full). - If line is "rw,loop=/dev/loop1,quota", keyword is "loop=" - and full is 0, then a pointer to "loop=/dev/loop1,quota" - is returned. If full is not 0 then NULL is returned. But - maybe you might want to try cu_mount_getoptionvalue()... + If line is "rw,loop=/dev/loop1,quota", keyword is "loop=" + and full is 0, then a pointer to "loop=/dev/loop1,quota" + is returned. If full is not 0 then NULL is returned. But + maybe you might want to try cu_mount_getoptionvalue()... */ char *cu_mount_getoptionvalue(char *line, const char *keyword); /* DESCRIPTION - The cu_mount_getoptionvalue() function can be used to grab - a VALUE out of a mount option (line) like: - loop=VALUE - whereas "loop=" is the keyword. + The cu_mount_getoptionvalue() function can be used to grab + a VALUE out of a mount option (line) like: + loop=VALUE + whereas "loop=" is the keyword. RETURN VALUE - If the cu_mount_getoptionvalue() function can find the option - keyword in line, then memory is allocated for the value of - that option and a pointer to that value is returned. + If the cu_mount_getoptionvalue() function can find the option + keyword in line, then memory is allocated for the value of + that option and a pointer to that value is returned. - If the option keyword is not found, cu_mount_getoptionvalue() - returns NULL; + If the option keyword is not found, cu_mount_getoptionvalue() + returns NULL; NOTES - Internally it calls cu_mount_checkoption(), then it - allocates memory for VALUE and returns a pointer to that - string. So *do not forget* to free() the memory returned - after use!!! + Internally it calls cu_mount_checkoption(), then it + allocates memory for VALUE and returns a pointer to that + string. So *do not forget* to free() the memory returned + after use!!! */ int cu_mount_type(const char *type); @@ -183,6 +183,4 @@ int cu_mount_type(const char *type); RETURN VALUE */ - #endif /* !COLLECTD_UTILS_MOUNT_H */ -