summaryrefslogtreecommitdiffstats
path: root/utils/mount/parse_opt.h
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-10-11 13:55:02 -0400
committerNeil Brown <neilb@suse.de>2007-10-12 09:08:21 +1000
commitda7454e3cf772edacc55a0f47d49cef7a03a4d10 (patch)
treefd02277554b3073db56eb536384f4ef869613f0b /utils/mount/parse_opt.h
parentff7c7426065f816ec3c6cd9c46d9ffbfbff80d71 (diff)
downloadnfs-utils-da7454e3cf772edacc55a0f47d49cef7a03a4d10.tar.gz
nfs-utils-da7454e3cf772edacc55a0f47d49cef7a03a4d10.tar.xz
nfs-utils-da7454e3cf772edacc55a0f47d49cef7a03a4d10.zip
text-based mount.nfs: Fix po_rightmost() enum return values
Neil observed that po_rightmost() now returns enum values from both enum { PO_NOT_FOUND = 0, PO_FOUND = 1, } and enum { PO_KEY2_RIGHTMOST = 1, PO_KEY1_RIGHTMOST = -1, } It would be cleaner to use a single enum for po_rightmost()'s return value. We take the next logical step and create specific types for the return values in order to ensure we don't mix the enum values, and to document explicitly what return values callers can expect. This could have been a simpler patch, but I think the end result is a cleaner overall parser API. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/parse_opt.h')
-rw-r--r--utils/mount/parse_opt.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/utils/mount/parse_opt.h b/utils/mount/parse_opt.h
index 6b9fb5e..e7924dd 100644
--- a/utils/mount/parse_opt.h
+++ b/utils/mount/parse_opt.h
@@ -21,31 +21,32 @@
*
*/
-enum {
+typedef enum {
PO_FAILED = 0,
PO_SUCCEEDED = 1,
-};
+} po_return_t;
-enum {
+typedef enum {
PO_NOT_FOUND = 0,
PO_FOUND = 1,
-};
+} po_found_t;
-enum {
- PO_KEY2_RIGHTMOST = 1,
+typedef enum {
PO_KEY1_RIGHTMOST = -1,
-};
+ PO_NEITHER_FOUND = 0,
+ PO_KEY2_RIGHTMOST = 1,
+} po_rightmost_t;
struct mount_options;
struct mount_options * po_split(char *);
void po_replace(struct mount_options *,
struct mount_options *);
-int po_join(struct mount_options *, char **);
+po_return_t po_join(struct mount_options *, char **);
-int po_append(struct mount_options *, char *);
-int po_contains(struct mount_options *, char *);
+po_return_t po_append(struct mount_options *, char *);
+po_found_t po_contains(struct mount_options *, char *);
char * po_get(struct mount_options *, char *);
-int po_rightmost(struct mount_options *, char *, char *);
-int po_remove_all(struct mount_options *, char *);
+po_rightmost_t po_rightmost(struct mount_options *, char *, char *);
+po_found_t po_remove_all(struct mount_options *, char *);
void po_destroy(struct mount_options *);