Windows: Add cm_GetVolumeType
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 26 Jul 2009 16:57:10 +0000 (12:57 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 26 Jul 2009 16:59:34 +0000 (09:59 -0700)
Add new volume utility function cm_GetVolumeType which returns
the type of volume based upon provided volume group and volume id.

LICENSE MIT

Reviewed-on: http://gerrit.openafs.org/224
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_volume.c
src/WINNT/afsd/cm_volume.h

index fe84a41..491d533 100644 (file)
@@ -1789,3 +1789,15 @@ cm_VolumeStateByName(cm_volume_t *volp, char *volname)
     return statep;
 }
 
+afs_int32 
+cm_VolumeType(cm_volume_t *volp, afs_uint32 id)
+{
+    if (id == volp->vol[RWVOL].ID)
+        return(RWVOL);
+    else if (id == volp->vol[ROVOL].ID)
+        return(ROVOL);
+    else if (id == volp->vol[BACKVOL].ID)
+        return (BACKVOL);
+
+    return -1;
+}
index 3cef972..a7aecff 100644 (file)
@@ -145,5 +145,7 @@ extern cm_vol_state_t * cm_VolumeStateByID(cm_volume_t *volp, afs_uint32 id);
 
 extern cm_vol_state_t * cm_VolumeStateByName(cm_volume_t *volp, char *volname);
 
+extern afs_int32 cm_VolumeType(cm_volume_t *volp, afs_uint32 id);
+
 extern osi_rwlock_t cm_volumeLock;
 #endif /*  __CM_VOLUME_H_ENV__ */