916 |
; |
; |
917 |
|
|
918 |
space : IF SPACE operator value unit THEN action { |
space : IF SPACE operator value unit THEN action { |
919 |
DeviceInfo_T di; |
if(!DeviceInfo_Usage(current->devinfo, current->path)) { |
|
NEW(di); |
|
|
if(!DeviceInfo_Usage(di, current->path)) { |
|
920 |
log("%s: Cannot read usage of device %s at line %d\n", |
log("%s: Cannot read usage of device %s at line %d\n", |
921 |
prog, current->path, lineno-1); |
prog, current->path, lineno-1); |
|
free(di); |
|
922 |
exit(1); |
exit(1); |
923 |
} |
} |
924 |
deviceset.resource= RESOURCE_ID_SPACE; |
deviceset.resource= RESOURCE_ID_SPACE; |
925 |
deviceset.operator= $<number>3; |
deviceset.operator= $<number>3; |
926 |
deviceset.limit_absolute= (int)((float)$<real>4 / |
deviceset.limit_absolute= (int)((float)$<real>4 / |
927 |
(float)di->f_bsize * |
(float)current->devinfo->f_bsize * |
928 |
(float)$<number>5 ); |
(float)$<number>5 ); |
929 |
deviceset.action= $<number>7; |
deviceset.action= $<number>7; |
|
free(di); |
|
930 |
adddevice(&deviceset); |
adddevice(&deviceset); |
931 |
} |
} |
932 |
| IF SPACE operator PERCENT THEN action { |
| IF SPACE operator PERCENT THEN action { |
1528 |
*/ |
*/ |
1529 |
static void adddevice(struct DeviceSet *ds) { |
static void adddevice(struct DeviceSet *ds) { |
1530 |
|
|
1531 |
Device_T d; |
Device_T dev; |
1532 |
|
|
1533 |
ASSERT(ds); |
ASSERT(ds); |
1534 |
|
|
1535 |
NEW(d); |
NEW(dev); |
1536 |
d->resource= ds->resource; |
dev->resource= ds->resource; |
1537 |
d->operator= ds->operator; |
dev->operator= ds->operator; |
1538 |
d->limit_absolute= ds->limit_absolute; |
dev->limit_absolute= ds->limit_absolute; |
1539 |
d->limit_percent= ds->limit_percent; |
dev->limit_percent= ds->limit_percent; |
1540 |
d->action= ds->action; |
dev->action= ds->action; |
1541 |
|
|
1542 |
d->next= current->devicelist; |
dev->next= current->devicelist; |
1543 |
current->devicelist= d; |
current->devicelist= dev; |
1544 |
|
|
1545 |
reset_deviceset(); |
reset_deviceset(); |
1546 |
|
|