home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / misc / src / install / libfdisk / constraints.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-17  |  2.4 KB  |  56 lines

  1. #ifndef FDISK_CONSTRAINTS_H
  2. #define FDISK_CONSTRAINTS_H
  3.  
  4. /* lets define a 'contraint' - use for automatic allocation of resources     */
  5. /* contraints are able to handle unsigned values only, but thats all we need */
  6. /* if active, contraint requires value to be within the range defined by     */
  7. /* min and max, inclusively.                                                 */
  8. struct constraint {
  9.     unsigned int         active;     /* 0 is contraint disabled, 1 otherwise */
  10.     unsigned int         current;    /* current value         */
  11.     unsigned int         min;        /* minimum value allowed */
  12.     unsigned int         max;        /* maximum value allowed */
  13. };
  14.  
  15. typedef struct constraint     Constraint;
  16.  
  17. /* DriveSet describes a set of numbers (drive numbers usually) */
  18. /* If active[n] is non-zero, then the number 'n' is in the set */
  19. #define MAX_DRIVESET_NUM 32
  20. struct driveset {
  21.     unsigned int  current;
  22.     unsigned char active[MAX_DRIVESET_NUM+1];
  23. };
  24.  
  25. typedef struct driveset       DriveSet;
  26.  
  27. int fdiskSetFixedConstraint( Constraint *c, unsigned int value );
  28. int fdiskGetConstraint( Constraint *c, unsigned int *cur,
  29.             unsigned int *min, unsigned int *max,
  30.             unsigned int *active);
  31. int fdiskSetConstraint( Constraint *c, unsigned int cur,
  32.             unsigned int min, unsigned int max,
  33.             unsigned int active);
  34. int fdiskGetMinMaxConstraint(Constraint *c,unsigned int *mn,unsigned int *mx);
  35. int fdiskGetCurrentConstraint(Constraint *c, unsigned int *current);
  36. int fdiskSetCurrentConstraint(Constraint *c, unsigned int current);
  37. int fdiskQueryConstraint( Constraint *c, unsigned int *cur,
  38.             unsigned int *min, unsigned int *max,
  39.             unsigned int dmin, unsigned int dmax );
  40. int fdiskConstraintIsActive( Constraint *c );
  41. int fdiskEnableConstraint( Constraint *c );
  42. int fdiskDisableConstraint( Constraint *c );
  43. int fdiskResetConstraint( Constraint *c );
  44.  
  45. int fdiskActivateAllDriveSet( DriveSet *ds );
  46. int fdiskDeactivateAllDriveSet( DriveSet *ds );
  47. int fdiskActivateDriveSet( DriveSet *ds, unsigned int i);
  48. int fdiskDeactiveDriveSet( DriveSet *ds, unsigned int i);
  49. int fdiskThisDriveSetIsActive( DriveSet *ds, unsigned int i);
  50. int fdiskDriveSetIsActive( DriveSet *ds );
  51. int fdiskInitWalkDriveSet( DriveSet *ds, unsigned int *i );
  52. int fdiskWalkDriveSet( DriveSet *ds, unsigned int *i );
  53. int fdiskSetCurrentDriveSet( DriveSet *ds, unsigned int i );
  54. int fdiskGetCurrentDriveSet( DriveSet *ds, unsigned int *i );
  55. #endif
  56.